Skip to main content

Method Signature

align.blockchain.nfts.transferERC721(
  wallet: Wallet,
  contractAddress: string,
  to: string,
  tokenId: string,
  network: Network
): Promise<TransactionResponse>

Parameters

wallet
Wallet
required
Owner wallet (must own the NFT)
contractAddress
string
required
NFT contract address
to
string
required
Recipient address
tokenId
string
required
Token ID to transfer
network
string
required
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}`);
You must own the NFT to transfer it. The transaction will fail if you don’t own the specified token ID.