diff --git a/lib/src/crypto/evm/function_signature.dart b/lib/src/crypto/evm/function_signature.dart index c1e6710e5..0fce45427 100644 --- a/lib/src/crypto/evm/function_signature.dart +++ b/lib/src/crypto/evm/function_signature.dart @@ -37,7 +37,7 @@ class FunctionSignature { final sublist = data.sublist(offset, offset + 32).toHex; final arg = switch (value) { - "address" => sublist.substring(24), + "address" => "0x" + sublist.substring(24), "uint256" => sublist.toBigIntFromHex, "uint256[]" => () { final field_length = data @@ -113,7 +113,7 @@ class FunctionSignature { if (contractFunction == null) { return FunctionSignature( - "function not found", + "unknown", null, decodeDataValues(data, {}), ); diff --git a/lib/src/domain/entities/transactions/evm_transaction.dart b/lib/src/domain/entities/transactions/evm_transaction.dart index 698135b1b..99dcf71b4 100644 --- a/lib/src/domain/entities/transactions/evm_transaction.dart +++ b/lib/src/domain/entities/transactions/evm_transaction.dart @@ -1,5 +1,4 @@ import 'dart:typed_data'; - import 'package:hive/hive.dart'; import 'package:walletkit_dart/walletkit_dart.dart'; @@ -111,9 +110,13 @@ abstract base class EVMTransaction extends GenericTransaction { required this.input, }); - FunctionSignature get getFunctionSignature { + FunctionSignature? get getFunctionSignature { if (!_cachedFunctionSigs.containsKey(hash)) { - _cachedFunctionSigs[hash] = FunctionSignature.fromData(input); + try { + _cachedFunctionSigs[hash] = FunctionSignature.fromData(input); + } catch (e) { + return null; + } } return _cachedFunctionSigs[hash]!; } diff --git a/test/ci/parsing/reverse-hash-computation_test.dart b/test/ci/parsing/reverse-hash-computation_test.dart index 547c37913..d47a25cf0 100644 --- a/test/ci/parsing/reverse-hash-computation_test.dart +++ b/test/ci/parsing/reverse-hash-computation_test.dart @@ -28,7 +28,7 @@ void main() { }); expect(functionSignature.args?[0].value, - "05870f1507d820212e921e1f39f14660336231d1"); + "0x05870f1507d820212e921e1f39f14660336231d1"); expect(functionSignature.args?[1].value, BigInt.from(15942468)); });