sendCoin method

Future<String> sendCoin({
  1. required TransferIntent<EvmFeeInformation<EvmGasPrice>> intent,
  2. required String from,
  3. required Uint8List seed,
})

Send Currency

Implementation

Future<String> sendCoin({
  required TransferIntent<EvmFeeInformation> intent,
  required String from,
  required Uint8List seed,
}) async {
  final tx = await buildTransaction(
    sender: from,
    recipient: intent.recipient,
    seed: seed,
    feeInfo: intent.feeInfo,
    data: intent.encodedMemo,
    value: intent.amount.value,
    accessList: intent.accessList,
  );
  final balance = await fetchBalance(address: toChecksumAddress(from)).then(
    (amount) => amount.value,
  );

  if (balance < tx.gasFee + tx.value) {
    throw Failure("Insufficient funds to pay native gas fee");
  }

  return await sendRawTransaction(tx.serialized.toHex);
}