Function useUpdateMetadata

  • Beta

    Set the metadata of this contract

    Parameters

    • contract: RequiredParam<ValidContractInstance>

      an instance of a SmartContract

    Returns UseMutationResult<any, any, any>

    a mutation object that can be used to update the metadata

    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>
    );
    };

    See

    Documentation

Generated using TypeDoc