encodeERC721SafeTransferCall static method

Uint8List encodeERC721SafeTransferCall(
  1. EthereumAddress from,
  2. EthereumAddress nftContractAddress,
  3. EthereumAddress to,
  4. BigInt tokenId,
)

Encodes the data for an ERC721 'safeTransferFrom' operation.

from - Address sending the NFT. nftContractAddress - Address of the ERC721 token contract. to - Address receiving the NFT. tokenId - ID of the NFT being transferred.

Implementation

static Uint8List encodeERC721SafeTransferCall(
  EthereumAddress from,
  EthereumAddress nftContractAddress,
  EthereumAddress to,
  BigInt tokenId,
) {
  final params = [from, to, tokenId];
  final jsonInterface =
      '[{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]}]';

  return _encodeContractCall(
    'ERC721',
    nftContractAddress,
    'safeTransferFrom',
    params,
    jsonInterface: jsonInterface,
  );
}