useContractMetadataUpdate

Update the metadata of the given contract

Example

const Component = () => {
const { contract } = useContract("{{contract_address}}");
const {
mutate: updateContractMetadata,
isLoading,
error,
} = useContractMetadataUpdate(contract);
if (error) {
console.error("failed to update contract metadata", error);
}
return (
<button
disabled={isLoading}
onClick={() =>
updateContractMetadata({
name: "New name",
description: "New description",
})
}
>
Update contract metadata
</button>
);
};
function useContractMetadataUpdate(
contract: RequiredParam<ValidContractInstance>,
): UseMutationResult<
{ data: () => Promise<any>; receipt: providers.TransactionReceipt },
unknown,
{
app_uri?: string;
description?: string;
external_link?: string;
image?: any;
name: string;
},
unknown
>;

Parameters

The ValidContractInstance instance of the contract to get the metadata for

Type

let contract: RequiredParam<ValidContractInstance>;

Returns

let returnType: UseMutationResult<
{ data: () => Promise<any>; receipt: providers.TransactionReceipt },
unknown,
{
app_uri?: string;
description?: string;
external_link?: string;
image?: any;
name: string;
},
unknown
>;

Mutation object to update the contract metadata