DOCS

useUpdateMetadata

Set the metadata of this contract

Example

const Component = () => {
  const { contract } = useContract("{{contract_address}}");
  const {
    mutate: updateMetadata,
    isLoading,
    error,
  } = useUpdateMetadata(contract);

  if (error) {
    console.error("failed to update metadata", error);
  }

  return (
    <button
      disabled={isLoading}
      onClick={() =>
        updateMetadata({
          name: "My Contract",
          description: "This is my contract",
        })
      }
    >
      Update Contract Metadata
    </button>
  );
};

Parameters

Returns

a mutation object that can be used to update the metadata