Function useTransferNFT

  • Beta

    Transfer an NFT

    Type Parameters

    Parameters

    Returns UseMutationResult<Omit<{
        data: (() => Promise<unknown>);
        receipt: providers.TransactionReceipt;
    }, "data">, unknown, TransferNFTParams, unknown>

    a mutation object that can be used to transfer NFTs

    Example

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

    if (error) {
    console.error("failed to transfer NFT", error);
    }

    return (
    <button
    disabled={isLoading}
    onClick={() => transferNFT({
    to: "{{wallet_address}}",
    tokenId: 2
    })}
    >
    Transfer
    </button>
    );
    };

    Twfeature

    ERC721 | ERC1155

    See

    Documentation

Generated using TypeDoc