-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implement a raw evm transaction * add check for the length of the decoded Uint8list * fix dart analyze --------- Co-authored-by: dev2-nomo <dev2@nomo.app>
- Loading branch information
Showing
7 changed files
with
55 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'dart:typed_data'; | ||
|
||
class RawEVMTransaction { | ||
final BigInt nonce; | ||
final BigInt gasPrice; | ||
final BigInt gasLimit; | ||
final String to; | ||
final BigInt value; | ||
final Uint8List? data; | ||
final BigInt? chainId; | ||
|
||
RawEVMTransaction({ | ||
required this.nonce, | ||
required this.gasPrice, | ||
required this.gasLimit, | ||
required String to, | ||
required this.value, | ||
required this.data, | ||
this.chainId, | ||
}) : to = to.startsWith("0x") ? to : "0x${to}"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import 'package:test/test.dart'; | ||
import 'package:walletkit_dart/src/crypto/evm/rlp.dart'; | ||
import 'package:web3dart/web3dart.dart'; | ||
import 'package:walletkit_dart/src/crypto/evm/transaction/raw_evm_transaction.dart'; | ||
|
||
void main() { | ||
/// Send ZeniqSmart to own Wallet | ||
test('parse hex transaction', () { | ||
const String unsignedTxFromNomo = // from nomo.signEvmTransaction | ||
"0xf38207488502540be4008252089405870f1507d820212e921e1f39f14660336231d188016345785d8a0000808559454e49518080"; | ||
|
||
final Transaction tx = getTransactionFromMessageHash(unsignedTxFromNomo); | ||
final RawEVMTransaction tx = | ||
getTransactionFromMessageHash(unsignedTxFromNomo); | ||
|
||
expect(tx.nonce, 1864); | ||
expect(tx.gasPrice!.getInWei, BigInt.from(10000000000)); | ||
expect(tx.maxGas, 21000); | ||
expect(tx.to!.hex, "0x05870f1507d820212e921e1f39f14660336231d1"); | ||
expect(tx.value!.getInWei, BigInt.from(100000000000000000)); | ||
expect(tx.nonce, BigInt.from(1864)); | ||
expect(tx.gasPrice, BigInt.from(10000000000)); | ||
expect(tx.gasLimit, BigInt.from(21000)); | ||
expect(tx.to, "0x05870f1507d820212e921e1f39f14660336231d1"); | ||
expect(tx.value, BigInt.from(100000000000000000)); | ||
expect(tx.data, []); | ||
expect(tx.chainId, BigInt.from(383414847825)); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters