Skip to content

Commit

Permalink
fix rlp decoding bug (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2-nomo authored Nov 17, 2023
1 parent 04060a2 commit 13e7266
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/src/crypto/evm/function_signature.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class FunctionSignature {

if (contractFunction == null) {
return FunctionSignature(
"unknown",
"function not found",
null,
decodeDataValues(data, {}),
);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/crypto/evm/rlp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ Transaction getTransactionFromMessageHash(String messageHex) {
BigInt gasPrice = parseAsHexBigInt(en.result[1]);
BigInt gasLimit = parseAsHexBigInt(en.result[2]);
String evmAddress = en.result[3];
BigInt value = parseAsHexBigInt(en.result[4]);

BigInt value = parseAsHexBigInt(en.result[4] == "" ? "0x0" : en.result[4]);
final Uint8List data = Uint8List.fromList(hex.decode(en.result[5]));

return Transaction(
Expand Down
2 changes: 2 additions & 0 deletions lib/walletkit_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ export 'src/domain/entities/hd_wallet_type.dart';
export 'src/domain/entities/address_type.dart';

export 'src/crypto/evm/rlp.dart';

export 'src/crypto/evm/function_signature.dart';
1 change: 0 additions & 1 deletion test/ci/parsing/reverse-hash-computation_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:typed_data';
import 'package:convert/convert.dart';
import 'package:test/test.dart';
import 'package:walletkit_dart/src/crypto/evm/function_signature.dart';
import 'package:walletkit_dart/walletkit_dart.dart';

void main() {
Expand Down

0 comments on commit 13e7266

Please sign in to comment.