RawEvmTransaction.fromHex constructor

RawEvmTransaction.fromHex(
  1. String hex
)

Implementation

factory RawEvmTransaction.fromHex(String hex) {
  final rawTxHex = hex.replaceFirst("0x", "");

  /// Check if the transaction is a Type 2 transaction
  if (rawTxHex.startsWith("02")) {
    return RawEVMTransactionType2.fromHex(hex);
  }

  /// Check if the transaction is a Type 1 transaction
  if (rawTxHex.startsWith("01")) {
    return RawEVMTransactionType1.fromHex(hex);
  }

  return RawEVMTransactionType0.fromHex(hex);
}