Skip to content

Commit 2dbd1cf

Browse files
committed
Update readme
1 parent 00effd5 commit 2dbd1cf

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# ethereum_util
22

3-
Ported from:
3+
**This project is a work in progress.**
4+
5+
Porting Ethereum utilities from Javascript to Dart:
46

57
- https://github.com/ethjs/ethjs-util/
68
- https://github.com/ethereumjs/ethereumjs-util
79
- https://github.com/simolus3/web3dart/
810
- https://github.com/maxholman/rlp
911
- https://github.com/MetaMask/eth-sig-util
1012
- https://github.com/ethereumjs/ethereumjs-abi
11-
- https://github.com/ethereumjs/ethereumjs-wallet
13+
- https://github.com/ethereumjs/ethereumjs-wallet
14+
15+
Check [test](./test) folder for usage.

test/typed_data_test.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:ethereum_util/src/signature.dart';
66
import 'package:ethereum_util/src/typed_data.dart';
77
import 'package:test/test.dart';
88

9-
var typedData = TypedData(
9+
final TypedData typedData = TypedData(
1010
types: {
1111
"EIP712Domain": [
1212
TypedDataField(name: "name", type: "string"),
@@ -86,4 +86,9 @@ void main() {
8686
test('normalize an unsupported type throws', () {
8787
expect(() => normalize({}), throwsArgumentError);
8888
});
89+
90+
test('toJson', () {
91+
expect(jsonEncode(typedData.toJson()),
92+
r'{"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Person":[{"name":"name","type":"string"},{"name":"wallet","type":"address"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person"},{"name":"contents","type":"string"}]},"primaryType":"Mail","domain":{"name":"Ether Mail","version":"1","chainId":1,"verifyingContract":"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},"message":{"from":{"name":"Cow","wallet":"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},"to":{"name":"Bob","wallet":"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"},"contents":"Hello, Bob!"}}');
93+
});
8994
}

0 commit comments

Comments
 (0)