sendTransaction static method

Future<String> sendTransaction(
  1. String transaction, {
  2. AAFeeMode? feeMode,
})

Send transaction

transaction requires hexadecimal string

feeMode is optional, works with aa service.

Result signature or error.

Implementation

static Future<String> sendTransaction(String transaction,
    {AAFeeMode? feeMode}) async {
  final json = jsonEncode({"transaction": transaction, "fee_mode": feeMode});
  print("sendTransaction json<< $json");
  final result =
      await _channel.invokeMethod('evmSendTransaction', json);
  if (jsonDecode(result)["status"] == true ||
      jsonDecode(result)["status"] == 1) {
    final signature = jsonDecode(result)["data"] as String;
    return signature;
  } else {
    final error = RpcError.fromJson(jsonDecode(result)["data"]);
    return Future.error(error);
  }
}