RawEvmTransaction.fromUnsignedHex constructor

RawEvmTransaction.fromUnsignedHex(
  1. String hex
)

Implementation

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

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

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

  return RawEVMTransactionType0.fromUnsignedHex(hex);
}