Implementation
TransactionBuilder addNFTTransfer(to, double amount, nftAddress) {
if (!(to is Uint8List) && !(to is String)) {
throw "'to' must be a string or Uint8List";
}
if (to is String) {
if (isHex(to)) {
to = hexToUint8List(to);
} else {
throw "'to' must be an hexadecimal string";
}
}
if (!(nftAddress is Uint8List) && !(nftAddress is String)) {
throw "'nftAddress' must be a string or Uint8List";
}
if (nftAddress is String) {
if (isHex(nftAddress)) {
nftAddress = hexToUint8List(nftAddress);
} else {
throw "'nftAddress' must be an hexadecimal string";
}
}
final NftTransfer nftTransfer = NftTransfer();
nftTransfer.to = to;
nftTransfer.amount = amount;
nftTransfer.nft = nftAddress;
data!.ledger!.nft!.transfers!.add(nftTransfer);
return this;
}