useUpdateMetadata
This feature is currently in beta and may change based on feedback that we receive.
Use this to update the metadata of your
Example
const Component = () => {
const {
mutate: updateMetadata,
isLoading,
error,
} = useUpdateMetadata(SmartContract);
if (error) {
console.error("failed to update metadata", error);
}
return (
<button
disabled={isLoading}
onClick={() => updateMetadata({ updatePayload: { name: "My Contract", description: "This is my contract" } })}
>
Update Metadata
</button>
);
};
Signature:
export declare function useUpdateMetadata(contract: RequiredParam<ValidContractInstance>): import("@tanstack/react-query").UseMutationResult<{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<any>;
}, unknown, {
[x: string]: unknown;
description?: string | undefined;
image?: any;
external_link?: string | undefined;
name: string;
}, unknown>;
Parameters
Parameter | Type | Description |
---|---|---|
contract | RequiredParam<ValidContractInstance> | an instance of a |
Returns:
import("@tanstack/react-query").UseMutationResult<{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () => Promise<any>; }, unknown, { [x: string]: unknown; description?: string | undefined; image?: any; external_link?: string | undefined; name: string; }, unknown>
a mutation object that can be used to update the metadata