Skip to main content

Method Signature

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

Parameters

wallet
Wallet
required
Owner wallet
contractAddress
string
required
ERC-1155 contract address
to
string
required
Recipient address
tokenId
string
required
Token ID to transfer
amount
string
required
Amount to transfer
network
string
required
Network

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

// Transfer 5 of token ID 42
const tx = await align.blockchain.nfts.transferERC1155(
  wallet,
  "0xERC1155ContractAddress...",
  "0xRecipientAddress...",
  "42",     // Token ID
  "5",      // Amount to transfer
  "polygon"
);

console.log(`TX Hash: ${tx.hash}`);
await tx.wait();
console.log("Tokens transferred!");
ERC-1155 is commonly used for gaming items, where you might have 100 copies of a “sword” token.