getTransactionByHash method
Implementation
Future<RawEvmTransaction> getTransactionByHash(
String messageHash, [
int? chainId,
]) async {
final response = await _call<Json>(
'eth_getTransactionByHash',
args: [messageHash],
);
final type_i = response['type'].toString().toInt;
final type = TransactionType.fromInt(type_i.toInt());
return switch (type) {
TransactionType.Legacy => RawEVMTransactionType0(
nonce: response['nonce'].toString().toBigInt,
gasPrice: response['gasPrice'].toString().toBigInt,
gasLimit: response['gas'].toString().toBigInt,
to: response['to'],
value: response['value'].toString().toBigInt,
data: response['input'].toString().hexToBytesWithPrefixOrNull ??
Uint8List(0),
v: response['v'].toString().toInt,
r: response['r'].toString().toBigInt,
s: response['s'].toString().toBigInt,
),
_ => throw UnsupportedError('Unsupported transaction type: $type'),
};
}