Covalent attachment of chelating groups to macromolecules