tokenTransfer method
Implementation
Future<String> tokenTransfer(
String tokenAddress,
String receiverAddress,
num tokensAmount,
String privateKey,
) async {
EthereumAddress receiver = EthereumAddress.fromHex(receiverAddress);
///
dynamic tokenDetails = await getTokenDetails(tokenAddress);
int tokenDecimals = int.parse(tokenDetails["decimals"].toString());
Decimal tokensAmountDecimal = Decimal.parse(tokensAmount.toString());
Decimal decimals = Decimal.parse(pow(10, tokenDecimals).toString());
BigInt amount = BigInt.parse((tokensAmountDecimal * decimals).toString());
///
return await _callContract(
'BasicToken',
tokenAddress,
'transfer',
[receiver, amount],
privateKey,
);
}