@@ -37,7 +37,7 @@ var tests = [
37
37
rawTransaction : "0xf868808504a817c80082520894f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008026a0afa02d193471bb974081585daabf8a751d4decbb519604ac7df612cc11e9226da04bf1bd55e82cebb2b09ed39bbffe35107ea611fa212c2d9a1f1ada4952077118" ,
38
38
oldSignature : "0xf868808504a817c80082520894f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008026a0afa02d193471bb974081585daabf8a751d4decbb519604ac7df612cc11e9226da04bf1bd55e82cebb2b09ed39bbffe35107ea611fa212c2d9a1f1ada4952077118" ,
39
39
transactionHash : "0xab0f71614c37231d71ae521ce188a9c7c9d5e976124a91f62f9f125348dd0326" ,
40
- messageHash : "0x2c7903a33b55caf582d170f21595f1a7e598df3fa61b103ea0cd9d6b2a92565d "
40
+ messageHash : "0xab0f71614c37231d71ae521ce188a9c7c9d5e976124a91f62f9f125348dd0326 "
41
41
} ,
42
42
{
43
43
address : '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23' ,
@@ -46,7 +46,7 @@ var tests = [
46
46
transaction : {
47
47
chainId : 1 ,
48
48
nonce : 0 ,
49
- gasPrice : "0 " ,
49
+ gasPrice : "1 " ,
50
50
gas : 31853 ,
51
51
to : '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55' ,
52
52
toIban : 'XE04S1IRT2PR8A8422TPBL9SR6U0HODDCUT' , // will be switched to "to" in the test
@@ -58,10 +58,15 @@ var tests = [
58
58
r : "0x22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd9" ,
59
59
s : "0x83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20" ,
60
60
// signature from eth_signTransaction
61
- rawTransaction : "0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20" ,
62
61
oldSignature : "0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20" ,
63
- transactionHash : "0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a" ,
64
- messageHash : "0x21975b15072795e610d2937abcf15ed4aecd0650b8a62204274bef3b57a8501a"
62
+ // for gasPrice = 0
63
+ // rawTransaction: "0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20",
64
+ // transactionHash: "0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a",
65
+ // messageHash: "0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a"
66
+ // for gasPrice = 1
67
+ rawTransaction : "0xf85f8001827c6d94f0109fc8df283027b6285cc889f5aa624eac1f55808026a074dcecc6b8ad09ca09882ac1088eac145e799f56ea3f5b5fe8fcb52bbd3ea4f7a03d49e02af9c239b1b8aea8a7ac9162862dec03207f9f59bc38a4f2b9e42077a9" ,
68
+ transactionHash : "0xfe1f3da48513409d62210b76d3493190fed19e4d54f0aa4283715184bff68e0b" ,
69
+ messageHash : "0xfe1f3da48513409d62210b76d3493190fed19e4d54f0aa4283715184bff68e0b"
65
70
} ,
66
71
{
67
72
address : '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23' ,
@@ -85,7 +90,7 @@ var tests = [
85
90
rawTransaction : "0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428" ,
86
91
oldSignature : "0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428" ,
87
92
transactionHash : "0xd8f64a42b57be0d565f385378db2f6bf324ce14a594afc05de90436e9ce01f60" ,
88
- messageHash : "0x6893a6ee8df79b0f5d64a180cd1ef35d030f3e296a5361cf04d02ce720d32ec5 "
93
+ messageHash : "0xd8f64a42b57be0d565f385378db2f6bf324ce14a594afc05de90436e9ce01f60 "
89
94
} ,
90
95
{
91
96
address : '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23' ,
@@ -94,7 +99,7 @@ var tests = [
94
99
transaction : {
95
100
chainId : 1 ,
96
101
nonce : 0 ,
97
- gasPrice : "0 " ,
102
+ gasPrice : "10 " ,
98
103
gas : 31853 ,
99
104
to : '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55' ,
100
105
toIban : 'XE04S1IRT2PR8A8422TPBL9SR6U0HODDCUT' , // will be switched to "to" in the test
@@ -106,10 +111,15 @@ var tests = [
106
111
r : "0x22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd9" ,
107
112
s : "0x83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20" ,
108
113
// signature from eth_signTransaction
109
- rawTransaction : "0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20" ,
110
114
oldSignature : "0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20" ,
111
- transactionHash : "0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a" ,
112
- messageHash : "0x21975b15072795e610d2937abcf15ed4aecd0650b8a62204274bef3b57a8501a"
115
+ // for gasPrice = 0
116
+ // rawTransaction: "0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20",
117
+ // transactionHash: "0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a",
118
+ // messageHash: "0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a"
119
+ // for gasPrice = 10
120
+ rawTransaction : "0xf85f800a827c6d94f0109fc8df283027b6285cc889f5aa624eac1f55808025a03cbfff5b8ef4588b930ecbf9b85388795875edf814dfc6c71884f99b6d7555cca057142e729c1c83bfccb2785e629fc32dffb2e613df565e78e119aa4694cb1df9" ,
121
+ transactionHash : "0x247533e8b3d12185a871fca5503b7e86f2fecef4a43ded244d5c18ec6b6b057f" ,
122
+ messageHash : "0x247533e8b3d12185a871fca5503b7e86f2fecef4a43ded244d5c18ec6b6b057f"
113
123
} ,
114
124
{
115
125
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -130,7 +140,7 @@ var tests = [
130
140
rawTransaction : "0xf86c808504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a04f4c17305743700648bc4f6cd3038ec6f6af0df73e31757007b7f59df7bee88da07e1941b264348e80c78c4027afc65a87b0a5e43e86742b8ca0823584c6788fd0" ,
131
141
oldSignature : "0xf86c808504a817c800825208943535353535353535353535353535353535353535880de0b6b3a7640000801ba0300e0d8f83ac82943e468164fa80236fdfcff21f978f66dd038b875cea6faa51a05a8e4b38b819491a0bb4e1f5fb4fd203b6a1df19e2adbec2ebdddcbfaca555f0" ,
132
142
transactionHash : "0xda3be87732110de6c1354c83770aae630ede9ac308d9f7b399ecfba23d923384" ,
133
- messageHash : "0x7dbc5644b83abd32d014d170ba9bdc855c126328c0cb41af0ed6422bef0bb32e "
143
+ messageHash : "0xda3be87732110de6c1354c83770aae630ede9ac308d9f7b399ecfba23d923384 "
134
144
} ,
135
145
{
136
146
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -151,7 +161,7 @@ var tests = [
151
161
rawTransaction : "0xf8708085358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd26a031bb05bd1535150d312dcaa870a4a69c130a51aa80537659c1f308bf1f180ac6a012c938a8e04ac4e279d0b7c29811609031a96e949ad98f1ca74ca6078910bede" ,
152
162
oldSignature : "0xf8708085358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd1ba081bba037015419ab5ce36e930b987da71b0ed5f0efb1849613223bf72399f598a05d2c1f109ad13f98a7693cfc35291e404ea8795755a176eb58a818de44f3756d" ,
153
163
transactionHash : "0xe86ab542020b3f386af1a1c79881d5db06f5fac58da79f697308f1d1e1799f2c" ,
154
- messageHash : "0x044d45bc28c2126e98c9cd0103a6559f5a92e01ecc201f48472f1e10a4c3ae27 "
164
+ messageHash : "0xe86ab542020b3f386af1a1c79881d5db06f5fac58da79f697308f1d1e1799f2c "
155
165
} ,
156
166
{
157
167
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -172,7 +182,7 @@ var tests = [
172
182
rawTransaction : "0xf8700a85358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd25a0496e628e8348a24312ded09ee3d99d85b1b8f947725aa382dcf4003b7389d5aaa00c1b1cfdd66c510fd708d33279a1a61e53dff3c6ced67cf7f7b830862d6e2029" ,
173
183
oldSignature : "0xf8700a85358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd25a0496e628e8348a24312ded09ee3d99d85b1b8f947725aa382dcf4003b7389d5aaa00c1b1cfdd66c510fd708d33279a1a61e53dff3c6ced67cf7f7b830862d6e2029" ,
174
184
transactionHash : "0x42fb18cc20b10438c6b4bcb4f3fc777a72195caf3e8b6ddc671df4a249e84ba7" ,
175
- messageHash : "0xa75c245723fedf4b739771f5eeedeb3dc6ecd3b9ea79277a33dc5ab27be0c911 "
185
+ messageHash : "0x42fb18cc20b10438c6b4bcb4f3fc777a72195caf3e8b6ddc671df4a249e84ba7 "
176
186
} ,
177
187
{
178
188
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -193,7 +203,7 @@ var tests = [
193
203
rawTransaction : "0xf8700a85358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd25a0496e628e8348a24312ded09ee3d99d85b1b8f947725aa382dcf4003b7389d5aaa00c1b1cfdd66c510fd708d33279a1a61e53dff3c6ced67cf7f7b830862d6e2029" ,
194
204
oldSignature : "0xf8700a85358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd25a0496e628e8348a24312ded09ee3d99d85b1b8f947725aa382dcf4003b7389d5aaa00c1b1cfdd66c510fd708d33279a1a61e53dff3c6ced67cf7f7b830862d6e2029" ,
195
205
transactionHash : "0x42fb18cc20b10438c6b4bcb4f3fc777a72195caf3e8b6ddc671df4a249e84ba7" ,
196
- messageHash : "0xa75c245723fedf4b739771f5eeedeb3dc6ecd3b9ea79277a33dc5ab27be0c911 "
206
+ messageHash : "0x42fb18cc20b10438c6b4bcb4f3fc777a72195caf3e8b6ddc671df4a249e84ba7 "
197
207
} ,
198
208
{
199
209
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -214,7 +224,7 @@ var tests = [
214
224
rawTransaction : "0xf8701085358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd25a04ba217e16f62ac277698e8853bcc010db07285b457606e9f3487c70ccc5e6508a05c6cfaa17fc1a52bede0cf25c8bd2e024b4fb89ed205f62cb3e177a83654f29d" ,
215
225
oldSignature : "0xf8701085358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd25a04ba217e16f62ac277698e8853bcc010db07285b457606e9f3487c70ccc5e6508a05c6cfaa17fc1a52bede0cf25c8bd2e024b4fb89ed205f62cb3e177a83654f29d" ,
216
226
transactionHash : "0xa2db7be5398c250e3ecf569c573f222255d46c509199ff649cca5e806edf5212" ,
217
- messageHash : "0x9c8c1fb88a95974c5ac75b6c58af2b5a62d9ccb9dffad7552a3182344bf37c27 "
227
+ messageHash : "0xa2db7be5398c250e3ecf569c573f222255d46c509199ff649cca5e806edf5212 "
218
228
} ,
219
229
{
220
230
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -235,7 +245,7 @@ var tests = [
235
245
rawTransaction : "0xf8701085358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd25a04ba217e16f62ac277698e8853bcc010db07285b457606e9f3487c70ccc5e6508a05c6cfaa17fc1a52bede0cf25c8bd2e024b4fb89ed205f62cb3e177a83654f29d" ,
236
246
oldSignature : "0xf8701085358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd25a04ba217e16f62ac277698e8853bcc010db07285b457606e9f3487c70ccc5e6508a05c6cfaa17fc1a52bede0cf25c8bd2e024b4fb89ed205f62cb3e177a83654f29d" ,
237
247
transactionHash : "0xa2db7be5398c250e3ecf569c573f222255d46c509199ff649cca5e806edf5212" ,
238
- messageHash : "0x9c8c1fb88a95974c5ac75b6c58af2b5a62d9ccb9dffad7552a3182344bf37c27 "
248
+ messageHash : "0xa2db7be5398c250e3ecf569c573f222255d46c509199ff649cca5e806edf5212 "
239
249
} ,
240
250
{
241
251
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -256,7 +266,7 @@ var tests = [
256
266
rawTransaction : "0xf8701685358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd26a0e027ec9e9921975678b73de44f7d2cd6b987a6655b9d0291b2cdff15836c6efba051b4e20835793bf0cdf268339111a24d80a4a7bb141e975a66d0edbcc20542d0" ,
257
267
oldSignature : "0xf8701685358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd26a0e027ec9e9921975678b73de44f7d2cd6b987a6655b9d0291b2cdff15836c6efba051b4e20835793bf0cdf268339111a24d80a4a7bb141e975a66d0edbcc20542d0" ,
258
268
transactionHash : "0x3135f97ac8d534b4b487cc2965fb1dcf427b92fd233577900dab3420e7afca13" ,
259
- messageHash : "0x77fd104f011a0085a9fa80f6f77cb213bce71fe8b4585d6fa9e3217117263a5b "
269
+ messageHash : "0x3135f97ac8d534b4b487cc2965fb1dcf427b92fd233577900dab3420e7afca13 "
260
270
} ,
261
271
{
262
272
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -277,7 +287,7 @@ var tests = [
277
287
rawTransaction : "0xf8701685358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd26a0e027ec9e9921975678b73de44f7d2cd6b987a6655b9d0291b2cdff15836c6efba051b4e20835793bf0cdf268339111a24d80a4a7bb141e975a66d0edbcc20542d0" ,
278
288
oldSignature : "0xf8701685358d117c0082c35094fcad0b19bb29d4674531d6f115237e16afce377c880de0b6b3a7640000840123abcd26a0e027ec9e9921975678b73de44f7d2cd6b987a6655b9d0291b2cdff15836c6efba051b4e20835793bf0cdf268339111a24d80a4a7bb141e975a66d0edbcc20542d0" ,
279
289
transactionHash : "0x3135f97ac8d534b4b487cc2965fb1dcf427b92fd233577900dab3420e7afca13" ,
280
- messageHash : "0x77fd104f011a0085a9fa80f6f77cb213bce71fe8b4585d6fa9e3217117263a5b "
290
+ messageHash : "0x3135f97ac8d534b4b487cc2965fb1dcf427b92fd233577900dab3420e7afca13 "
281
291
} ,
282
292
{
283
293
address : '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0' ,
@@ -472,7 +482,9 @@ describe("eth", function () {
472
482
var testAccount = ethAccounts . privateKeyToAccount ( test . privateKey ) ;
473
483
assert . equal ( testAccount . address , test . address ) ;
474
484
475
- testAccount . signTransaction ( test . transaction ) . catch ( function ( err ) {
485
+ testAccount . signTransaction ( test . transaction )
486
+ . then ( ( ) => done ( ) )
487
+ . catch ( function ( err ) {
476
488
assert . instanceOf ( err , Error ) ;
477
489
done ( ) ;
478
490
} ) ;
@@ -487,11 +499,11 @@ describe("eth", function () {
487
499
assert . equal ( testAccount . address , test . address ) ;
488
500
489
501
testAccount . signTransaction ( test . transaction ) . then ( function ( tx ) {
490
- assert . equal ( tx . messageHash , test . messageHash ) ;
491
- assert . equal ( tx . transactionHash , test . transactionHash ) ;
492
- assert . equal ( tx . rawTransaction , test . rawTransaction ) ;
502
+ assert . equal ( tx . messageHash , test . messageHash , "message hash failed" ) ;
503
+ assert . equal ( tx . transactionHash , test . transactionHash , "tx hash failed" ) ;
504
+ assert . equal ( tx . rawTransaction , test . rawTransaction , "rawtx failed" ) ;
493
505
done ( ) ;
494
- } ) ;
506
+ } )
495
507
} ) ;
496
508
497
509
it ( "signTransaction using the iban as \"to\" must compare to eth_signTransaction" , function ( done ) {
@@ -665,17 +677,18 @@ describe("eth", function () {
665
677
} ) ;
666
678
} ) ;
667
679
668
- it ( "recoverTransaction, must recover signature" , function ( ) {
680
+ it ( "recoverTransaction, must recover signature" , function ( done ) {
669
681
var ethAccounts = new Accounts ( ) ;
670
682
671
683
var testAccount = ethAccounts . privateKeyToAccount ( test . privateKey ) ;
672
684
assert . equal ( testAccount . address , test . address ) ;
673
685
674
686
testAccount . signTransaction ( test . transaction ) . then ( function ( tx ) {
675
687
assert . equal ( ethAccounts . recoverTransaction ( tx . rawTransaction ) , test . address ) ;
676
- } ) ;
688
+ done ( ) ;
689
+ } )
677
690
} ) ;
678
691
}
679
692
} ) ;
680
693
} ) ;
681
- } ) ;
694
+ } ) ;
0 commit comments