transfer method

Future<String> transfer(
  1. String receiverAddress,
  2. int amountInWei,
  3. String privateKey
)

Implementation

Future<String> transfer(String receiverAddress, int amountInWei, String privateKey) async {
  print('transfer start --> receiver: $receiverAddress, amountInWei: $amountInWei');

  /// todo: check approved

  EthereumAddress receiver = EthereumAddress.fromHex(receiverAddress);
  EtherAmount amount = EtherAmount.fromUnitAndValue(EtherUnit.wei, BigInt.from(amountInWei));

  ///
  String txHash = await _sendTransactionAndWaitForReceipt(
    Transaction(to: receiver, value: amount),
    privateKey,
  );
  print('transfer done --> txID: $txHash successful');
  return txHash;
}