Method Signature
align.blockchain.nfts.transferERC721(
wallet: Wallet,
contractAddress: string,
to: string,
tokenId: string,
network: Network
): Promise<TransactionResponse>
Parameters
Owner wallet (must own the NFT)
Network where the NFT exists
Examples
import Align from "@tolbel/align";
const align = new Align({
apiKey: process.env.ALIGN_API_KEY!,
environment: "sandbox",
});
const wallet = await align.blockchain.wallets.createFromPrivateKey(
process.env.PRIVATE_KEY!
);
const tx = await align.blockchain.nfts.transferERC721(
wallet,
"0xNFTContractAddress...",
"0xRecipientAddress...",
"123", // Token ID
"polygon"
);
console.log(`TX Hash: ${tx.hash}`);
const receipt = await tx.wait();
console.log(`NFT transferred in block ${receipt?.blockNumber}`);
const tx = await align.blockchain.nfts.transferERC721(
wallet,
nftContract,
recipient,
"123",
"polygon"
);
await tx.wait();
console.log("NFT transferred!");
You must own the NFT to transfer it. The transaction will fail if you don’t
own the specified token ID.