SDK Reference
react
transferNFT

transferNFT Method

This method is used to transfer NFT's from one wallet to another wallet.

Parameters

  • operationType - Type of operation to perform. In our case it will be NFT_TRANSFER.
  • quantity - The amount of nft to transfer.
  • recipientAddress - Address of the recipient wallet.
  • networkName - Name of the network to transfer funds.
  • nftId - Id of the NFT to transfer.
  • collectionAddress - Address of the collection from which to transfer the NFT.
  • collectionName - Name of the collection to transfer.
transferNft: (data: {
  operation_type: string;
  network_name: string;
  collection_address: string;
  collection_name: string;
  quantity: string;
  recipient_address: string;
  nft_address: string;
}) => Promise<TransferNftData>;

Example

import { useOkto, type OktoContextType} from 'okto-sdk-react';
 
const operationType = "NFT_TRANSFER"
const quantity = "1"
const recipientAddress = "0x0FC096A53343C68c1086e626661A4bb31486A9e2"
const networkName = "POLYGON_TESTNET"
const nftId = "0xf137ad32d4d695c9eb7cb4831e6198924afe5fb8c51576e8a5b5b07f6da8e0d3"
const collectionAddress = "0x171e643e8e8dabc66b838b9055dbdf88647cf6601b164f5987f50a497bedfbe1"
const collectionName = "super avengers"
 
transferNft({
    operation_type: operationType,
    network_name: networkName,
    collection_address: collection_address,
    collection_name: collection_name,
    quantity: quantity,
    recipient_address: recipientAddress,
    nft_address: nftAddress
}).then((result) => {
    console.log(result)
}).catch((error) => {
    console.error(`error:`, error);
});