Compare commits
2443 Commits
Author | SHA1 | Date | |
---|---|---|---|
218f437b0c | |||
7336dfad02 | |||
00fca40939 | |||
8a0f23915e | |||
8305d409d2 | |||
5c251b6928 | |||
bde3ff16ad | |||
76fa75b394 | |||
32a9c0ca80 | |||
fd3e1061e0 | |||
cf754b9483 | |||
5cc1256fd6 | |||
7101f44998 | |||
22ee366ed6 | |||
75d164037f | |||
a5ea21cd85 | |||
5110f80bba | |||
170eb3ac68 | |||
82f0bd9009 | |||
d0a2e655c9 | |||
1543833ca0 | |||
38faf2c51a | |||
31fdc645ed | |||
b64ad7a2a6 | |||
3f6baa45a7 | |||
558c67d392 | |||
d73dff4d5b | |||
b94f85de22 | |||
1fc3524e40 | |||
ebc506dae8 | |||
6221b282d4 | |||
db24fb792c | |||
d311b1b9b7 | |||
3c40eb9e5a | |||
df49c609a0 | |||
3d6fd601c5 | |||
ef6c7bd726 | |||
d613bf69bf | |||
cfddb7f3cd | |||
c6af5f0a27 | |||
e433525f51 | |||
ab66a3d0d3 | |||
d53e5646ec | |||
5fe2916ee1 | |||
acc667fbef | |||
80890cd9dd | |||
6b5f4ed244 | |||
4242b05462 | |||
a21b30c901 | |||
ddccea75e8 | |||
da2fae0e43 | |||
a3cd218719 | |||
0c7df37351 | |||
70e2df3904 | |||
f1ebad2508 | |||
9915d3c3be | |||
58ba290a9f | |||
b22f0f2ef5 | |||
16a04e64f2 | |||
c8147fb7b9 | |||
0fa6927171 | |||
99ebb869bf | |||
44eafb15e0 | |||
792cd0aa10 | |||
028775a086 | |||
2cf4fed11b | |||
e34d134102 | |||
8564eb9f7e | |||
e4bb419707 | |||
5e0b2b260c | |||
b58b6b9bac | |||
f3ac378ca4 | |||
56f777b2fc | |||
e40c1c62ce | |||
8e8ec8f5f8 | |||
5bdc115943 | |||
739066ec56 | |||
12224c7f59 | |||
8c3095faf0 | |||
410b35e913 | |||
2e48d39fc7 | |||
488a042736 | |||
71765957e4 | |||
68205dec9f | |||
4499743522 | |||
54252ede31 | |||
faa069a126 | |||
20aade56c3 | |||
1f2adb05b5 | |||
4afde4e738 | |||
364b783281 | |||
58fc2c679b | |||
923504ce3d | |||
2e868566d7 | |||
e252c634cb | |||
1803c65e40 | |||
489d956283 | |||
076c382a74 | |||
3b6385b146 | |||
714b955d6e | |||
b855f671a5 | |||
4e52adb84a | |||
d227f6184e | |||
88167f39a6 | |||
c8a8aa0d43 | |||
6b5f25802e | |||
f8c1eb157d | |||
59665ade85 | |||
c1f6e259a9 | |||
03b89ab712 | |||
ae3e9d4881 | |||
cad53fa191 | |||
0e682d936d | |||
cec30e23b2 | |||
47129428fe | |||
2f30a27b2b | |||
8be1d134aa | |||
7e0799ff21 | |||
9d84609b3f | |||
c64852dbcc | |||
bcacaaa4f4 | |||
d00e2731e5 | |||
99a1551b20 | |||
ac69538707 | |||
82cc5f63ae | |||
9d2166a964 | |||
db7c34a9df | |||
a1b4547a53 | |||
57f95c1dc7 | |||
1d519854e2 | |||
292f7ada8e | |||
65158d39b0 | |||
7c278d6ac2 | |||
429077a5a0 | |||
2656a2d038 | |||
3f03197dae | |||
b1870631a4 | |||
859a1999cb | |||
f3e1797153 | |||
55ed0ff07c | |||
07590196a5 | |||
697c2b5dc1 | |||
a0cfa3ca21 | |||
e58e2f5ee4 | |||
45134de740 | |||
f3ce1f07c4 | |||
ddc17196da | |||
fdcc1af4e2 | |||
4a54b8c451 | |||
4dc283c0fb | |||
f1a5cf9128 | |||
a5909d82eb | |||
59b7386abb | |||
7bd2fbe2b1 | |||
623469cb6c | |||
663d725026 | |||
1860b3dff9 | |||
03faec9d41 | |||
30fa30bd4a | |||
faa54e59c1 | |||
93ae7bb0d2 | |||
3c7181d28f | |||
6fecb150d6 | |||
1f4ed49b4c | |||
57c6caf146 | |||
4bb5ba78b0 | |||
9d9c23e315 | |||
1a6b7de0af | |||
b2b42f759c | |||
7139c1aff7 | |||
1e60919d47 | |||
011fdd91df | |||
0994efa66f | |||
8ccde784f9 | |||
d52878c744 | |||
d5166918e9 | |||
0d97c3ce13 | |||
19cff8ecca | |||
bb2e847363 | |||
a008c21cf0 | |||
9016ce8dd8 | |||
79cd58bdf3 | |||
d1e5d92191 | |||
cb382fa76b | |||
e6c0ec7278 | |||
3cdf108057 | |||
688030ecb6 | |||
589c4fb30f | |||
b20e972bec | |||
a8a2e3231c | |||
4bdf52fc1e | |||
0b82a05a75 | |||
80c97ca21b | |||
2491c99b37 | |||
cf534d4726 | |||
5689086202 | |||
bd64ed1e93 | |||
995861de4d | |||
56a0131778 | |||
0bb3943698 | |||
2d9b3aa537 | |||
8e14545282 | |||
2eedc330bf | |||
0ed3edc99e | |||
0c0708076e | |||
3847e248df | |||
af927ffdaf | |||
c03d403437 | |||
c48644490f | |||
54927dc0e0 | |||
705cf6113d | |||
9022f5034f | |||
bd992e7baf | |||
0031f388ac | |||
447bad9dbd | |||
89a48e365c | |||
1cfea1113a | |||
6488a392a3 | |||
600c9dd27d | |||
e380462532 | |||
94e0e5ab7d | |||
8613382869 | |||
df17c33898 | |||
ddf17d93ac | |||
c8ee08c24b | |||
84adf77bf3 | |||
f75dcc7f4c | |||
842b8cf323 | |||
b5918a1faa | |||
d0c6559204 | |||
6d012f628b | |||
726852e3d3 | |||
83b385a290 | |||
ec85458612 | |||
73dcbf7ba2 | |||
f80fe97763 | |||
cbf1d07073 | |||
8284bef072 | |||
fd5d061d49 | |||
32fbc0d334 | |||
1337a8dfb1 | |||
3440a8a0bf | |||
5e891ea981 | |||
adda54ac55 | |||
cebb149f5c | |||
e1c0862658 | |||
21fd31dad8 | |||
957f80c623 | |||
1c51e12c18 | |||
872b249711 | |||
1146f25015 | |||
45e15f62f5 | |||
7f638f0b2d | |||
5a52e86546 | |||
a88f609b8a | |||
61e8ae2f7b | |||
b46e1ca97e | |||
fb7c03ff4d | |||
2544d2c952 | |||
ea7c2fc673 | |||
9a11a94894 | |||
cbf162ca64 | |||
85d20cd61b | |||
94976d63ca | |||
cb47a9e97f | |||
ad5894e486 | |||
63d9c070ef | |||
f15d23b496 | |||
4c5968097d | |||
159c4d56cd | |||
f3e78c8f3c | |||
8d9752a557 | |||
1345a8c67c | |||
83fad0fb59 | |||
e9d017ba08 | |||
d8c6168d11 | |||
dd3f38fe5b | |||
a38bca3438 | |||
5f50fe7a4a | |||
b8e7b8e2e1 | |||
2f0166b945 | |||
d790229a33 | |||
8c99a87aa8 | |||
fe14b0b82e | |||
aa5b29e2f2 | |||
382726fde4 | |||
c2cb2bef96 | |||
09f633596d | |||
42a25f2f26 | |||
6d59047c5f | |||
ad7c05778f | |||
f02368141f | |||
649b9cc195 | |||
1f5a6f1341 | |||
da4c2d530d | |||
079c59b929 | |||
5b701962dc | |||
c595632b92 | |||
c5610398d5 | |||
a7f4448f34 | |||
7807a4f738 | |||
e5d294df32 | |||
d0b6f3663b | |||
c71aff99db | |||
5d33d5a7d9 | |||
512ffa2bf4 | |||
d223ac0379 | |||
113a3809ab | |||
fb34c6c7b9 | |||
7869294a26 | |||
61a0158877 | |||
fa93480d9a | |||
063f69d51d | |||
c54a85ee64 | |||
48083608b5 | |||
393a6c5edf | |||
0d96528d2f | |||
2ba54a69be | |||
94106cc41f | |||
3aa0410f6e | |||
7a894e3738 | |||
d792e95c21 | |||
a125b0fbc3 | |||
a216225827 | |||
0dfe511370 | |||
d4cc2d3503 | |||
d5f38f5690 | |||
c01f0ae825 | |||
81bbe8c93b | |||
29fa57e9b3 | |||
13f39afbdd | |||
3073511e30 | |||
6c4432d417 | |||
e45db42e94 | |||
375ca542ab | |||
0202b05a5d | |||
d6a92b18d4 | |||
5e623f14f3 | |||
22c77c607e | |||
b777d6aa3f | |||
4df2e1ef5c | |||
67f9783e6a | |||
6eaa404187 | |||
0045ce4cde | |||
465b0a79d8 | |||
ad8e92e9c6 | |||
edfb874527 | |||
c2d9c1a6f1 | |||
81a5813270 | |||
08e2696627 | |||
c9693b4746 | |||
ceb4357a8d | |||
fc986a3fbe | |||
0d2cccc2ce | |||
8af42d42da | |||
81ff253e68 | |||
e68f8e79ea | |||
e1fcffcc81 | |||
f3e78e50ff | |||
c14900dbb0 | |||
0aa76d3e5b | |||
622bfd4f08 | |||
1077109e11 | |||
ed7d7b405e | |||
41d80ba17b | |||
bdf99e0981 | |||
acdc19d1b7 | |||
7f9c335487 | |||
1f8290ca44 | |||
215780ab56 | |||
a6d4ce2630 | |||
0c77a96249 | |||
d92fde6980 | |||
87f50659db | |||
689630d261 | |||
848c54dc47 | |||
9845029a75 | |||
375cc67ba6 | |||
380c1522ac | |||
4dd7be7ed0 | |||
12fad65991 | |||
5c79ee4446 | |||
d48140cab3 | |||
3cf038f300 | |||
83505e61f3 | |||
6a58db66f7 | |||
af54832d24 | |||
86b417e83f | |||
f34838688e | |||
bcb1166e52 | |||
8d1637f567 | |||
b03614527b | |||
9b509f6478 | |||
89c69a1d25 | |||
06bfe19f05 | |||
7394ee7c72 | |||
b2d23b91e7 | |||
2ce109eb53 | |||
823fb2995b | |||
1e2c1ae98a | |||
b457e88cd0 | |||
e97478cc1e | |||
2d8383d3c8 | |||
1c4d8f36e4 | |||
e94da808cb | |||
a1c0bb68dd | |||
774e9d24a1 | |||
9a264a4284 | |||
0172939490 | |||
24613a60dc | |||
acc8f7fadc | |||
de4ea8e6f4 | |||
2c36d5ff45 | |||
f1295b506d | |||
fbcc6d0d25 | |||
fc92abec2c | |||
52bb149541 | |||
9caf32befe | |||
47d3b3dd58 | |||
a1c2749380 | |||
945798f913 | |||
6d02c0d392 | |||
ec74fc05d4 | |||
46b932ccc0 | |||
f85f77f6cc | |||
6a4b4f3449 | |||
d0473d6d83 | |||
70bf1a5711 | |||
bacc5aa6d3 | |||
29c46cdf34 | |||
552f5b2693 | |||
d5d9746ca3 | |||
508f116738 | |||
472ad43211 | |||
603c790213 | |||
62e0e18030 | |||
b0a9bbf33a | |||
6b2ec23132 | |||
ed1cb9edca | |||
17f2f12ce6 | |||
12bdb5f550 | |||
8d1f96cc0a | |||
a4049fb85c | |||
bb55307a9d | |||
422dc05bb0 | |||
9a8f45ee30 | |||
dac93ed616 | |||
8b7d4b0c9e | |||
499bc404e8 | |||
a81d835e4d | |||
961e4da7d8 | |||
b178414a47 | |||
f54c90a0ba | |||
ee167e53d1 | |||
8f733461b3 | |||
82beaabf6a | |||
4056c046a7 | |||
e3cad04dec | |||
1428dcee21 | |||
f3b71a73e3 | |||
380d9862c3 | |||
b6c0e53d69 | |||
e95bb34ea0 | |||
9e0de57a82 | |||
f6ff1f18b8 | |||
7595a5dfcb | |||
1e5353824a | |||
4704a0a288 | |||
b2112729fa | |||
32bed50ba1 | |||
5b561f434d | |||
750d70c202 | |||
34689cb3f3 | |||
ba225017c4 | |||
507241f73c | |||
8a1b51c716 | |||
75cd9cd2de | |||
00348756bc | |||
35fe4313d5 | |||
9a9987aeed | |||
5582901ca5 | |||
ded221fba2 | |||
ab745d3b0e | |||
b915c7a870 | |||
6c26255979 | |||
e2c4525da7 | |||
e778e127d6 | |||
a4e6f0b3c6 | |||
048e7771fb | |||
15c229300c | |||
24814a4f0f | |||
6188e64473 | |||
c34b0c67a1 | |||
7e6b72cb5c | |||
e3da85faed | |||
491c23a728 | |||
351516c57c | |||
8c7b764d47 | |||
905b8cc82f | |||
47687cf085 | |||
29c60c000a | |||
35f4bb96f3 | |||
92f171ec99 | |||
0933a79ab8 | |||
b136b387a7 | |||
6eb455032c | |||
5c8c0ae04e | |||
a35be3a12a | |||
f9b0d1a8e7 | |||
543a87c63f | |||
c9f566269b | |||
bfa12d75f8 | |||
b3eda29f41 | |||
18d8bf4b9c | |||
aee82d3196 | |||
a5907a8239 | |||
2a6c84984a | |||
0538c11576 | |||
012a1c2533 | |||
c9015e2e04 | |||
07fba274b1 | |||
585f259b63 | |||
b3161f5803 | |||
5a9952c7b4 | |||
8ecc9509b3 | |||
f72cb28b0f | |||
43ed0ed1ae | |||
69dfca2feb | |||
3bdf28c1fe | |||
c8a4c04b36 | |||
26f066f0c7 | |||
4a0ade4788 | |||
c397e350f4 | |||
b6058a837f | |||
5518022a5d | |||
5f958a582d | |||
e27237a03a | |||
ee84b20247 | |||
b25126a277 | |||
807ec60e63 | |||
f9cc090473 | |||
2f3384947b | |||
a8dde17146 | |||
db4aaedcbd | |||
5208bb32f1 | |||
982c812e81 | |||
c1908c7d91 | |||
59c5a2f519 | |||
1d05027ba2 | |||
fed3e6a808 | |||
ec7cb9981c | |||
df4d7846e5 | |||
6c160adab3 | |||
032ab66529 | |||
60d9611c23 | |||
210682b734 | |||
f0ec751237 | |||
1d139f7a0b | |||
25e6c4eff8 | |||
a76b7dadae | |||
b6232cfdd1 | |||
a2a77172a6 | |||
1b903767e0 | |||
4e7f53adf0 | |||
8c1b26889a | |||
af9242f4cc | |||
564f02aa2b | |||
3b8725e0f5 | |||
3caa4ad1ba | |||
b0ff946b55 | |||
eb0e7b1b81 | |||
36e1e5f151 | |||
4c8c115a76 | |||
545e14691b | |||
be97785856 | |||
fde0ddb324 | |||
117f66e823 | |||
a26aecdfdb | |||
47e6b2cef8 | |||
cc7f8f58e8 | |||
c9985bf563 | |||
22c0c5465a | |||
2cfbf76db8 | |||
ec4dee0fcd | |||
952287db29 | |||
b99b2c446c | |||
04c0f7e15c | |||
d001479a47 | |||
f16810c48e | |||
66b05433b6 | |||
6abf8ef78f | |||
b907a5d765 | |||
b0854fbff5 | |||
c1dee15144 | |||
987119cd4a | |||
08b03afa4b | |||
09841b1c9b | |||
bd0c267cbe | |||
ca1b2a1a91 | |||
1b90567546 | |||
16f417f5af | |||
5c82fdc243 | |||
55e55826ee | |||
530953050a | |||
24f89f8bd9 | |||
4dc7ee9087 | |||
e2d1d832ef | |||
d336e24dce | |||
ae2c90cc28 | |||
6cf61039cf | |||
48d2a8b8ee | |||
477a6d426c | |||
0972bdeda2 | |||
1cc86c07a0 | |||
1c7e8e9093 | |||
b619b244c7 | |||
0fb1bcd321 | |||
a4dc12f12c | |||
4547a05a68 | |||
4b4e082102 | |||
1954b87819 | |||
77924757a8 | |||
16460b0048 | |||
a9068aa8ff | |||
89244981a8 | |||
138ab26b8c | |||
51a97c031f | |||
cc5e621fc4 | |||
2ebf33ac1c | |||
788d812a72 | |||
29c887ef2c | |||
1085960ed8 | |||
8df689bd44 | |||
2f8a45cd8b | |||
ce68ac6959 | |||
dc7c584a4d | |||
58d477f7a6 | |||
804af9658a | |||
9d429180f9 | |||
c9f963a77e | |||
7ba9fe4d5d | |||
fb1edd05f4 | |||
780abaec98 | |||
f468a9a0e2 | |||
1054c155db | |||
7d2353f24d | |||
34f72ddb3d | |||
1382e8d84b | |||
e2e3fa3d11 | |||
9e5257b83b | |||
4cd79d8ddd | |||
4b52cd512d | |||
e32f7baa0d | |||
60b1f9629c | |||
4051c0333f | |||
e42517754a | |||
a153b47c2b | |||
e531c6fc6c | |||
ed7e05fb2a | |||
8130df63ca | |||
123098ce79 | |||
4fd4facf35 | |||
43bf3b4a78 | |||
05da381c15 | |||
26bf95731b | |||
03dc6ec0d4 | |||
f7ec759ef0 | |||
7ddebd7a75 | |||
bab78bbeb6 | |||
7a79428278 | |||
1360f027d9 | |||
b3629c6f62 | |||
176c98eb66 | |||
25d16f358a | |||
795b14330a | |||
0e5aed63dd | |||
125bdc3253 | |||
6cff6dd8b8 | |||
3983dd2428 | |||
0a9dc1536c | |||
1508a23a6f | |||
f5b8f3d41b | |||
0e93b98533 | |||
5da5db5a0a | |||
88af879f7a | |||
75f0412f9d | |||
207b6c50fb | |||
12671c82ea | |||
6e24b1587d | |||
59ef6e3693 | |||
22d29a6d52 | |||
a7f4ade711 | |||
1e985f9865 | |||
4789084998 | |||
3325683794 | |||
f7287c626e | |||
198cc69357 | |||
5ad473d758 | |||
db494170dc | |||
9e286e1c33 | |||
0dc566124a | |||
721e8ae93f | |||
2d09e67713 | |||
49e0267fe7 | |||
590aace88d | |||
4b2f1f7628 | |||
df3366d910 | |||
e6fdf0c9f7 | |||
4dbdcaecb1 | |||
8da07e91e4 | |||
b1c58b76a9 | |||
52b54631a4 | |||
e9db2d1b18 | |||
93edae280d | |||
bb17591959 | |||
aa3b91b802 | |||
b55fabc7be | |||
54605d8c8e | |||
52ca80bdd2 | |||
0291eff99a | |||
c96e504adb | |||
01a6db9324 | |||
993280ec03 | |||
6ff9d5770b | |||
455241debb | |||
db89c3e1a3 | |||
ef4135eabe | |||
56dac74f71 | |||
c7bc684909 | |||
96272e19a6 | |||
bd9088792b | |||
cdb2ebbdfa | |||
4b5ad31b3a | |||
6c168c8f22 | |||
afc8b887ab | |||
f111fc0608 | |||
1d959cb0ca | |||
c3ba4ace64 | |||
15e46b97b4 | |||
da900f9435 | |||
f0f6727778 | |||
65e39bf20e | |||
72290f67fe | |||
4c89d5331f | |||
61940b2275 | |||
e77b720ead | |||
7b39cc83cc | |||
01dc1c1394 | |||
4dfce4624d | |||
5e4d77b2b8 | |||
2dd8f41147 | |||
0add0c400f | |||
e847aaca3e | |||
7d02c4fdb7 | |||
d9b16c1197 | |||
ae7c1e3e55 | |||
50e1dcc43a | |||
d84810d89d | |||
39d86a28e7 | |||
5022a31889 | |||
c2af10d256 | |||
b89ed8eb7b | |||
118862f1ba | |||
148de1c875 | |||
76070b4674 | |||
3308d82b23 | |||
c44e025898 | |||
02017ed0e0 | |||
4366fdfc13 | |||
d957dd2c9f | |||
eb5cb04aa9 | |||
e5aa38cb0f | |||
f8061fcba8 | |||
4c84db85c5 | |||
0122989808 | |||
ccb4fc8d03 | |||
aec0c0efcb | |||
bf566a657c | |||
8577e4171a | |||
06e76422b5 | |||
1c7fd62e57 | |||
a17a1f9208 | |||
ed1538248f | |||
9e1689df9c | |||
ca7f385294 | |||
a92ccfc5c6 | |||
25cf0c440c | |||
05fd1dafe2 | |||
e28c60caf9 | |||
9423401d73 | |||
0d57ca486a | |||
2b5fcb4642 | |||
5553e5aaed | |||
af6afbaa56 | |||
1b98cbbfa4 | |||
3e38f8af23 | |||
e74f9f27db | |||
31a9fdced8 | |||
47793b606c | |||
4082c8b61d | |||
dda778eda7 | |||
0f5c6c5e2d | |||
186948da22 | |||
4f1ef89cb2 | |||
1fb84d3c5f | |||
3308491c92 | |||
9ff7be68fb | |||
ce0c4e5d86 | |||
984c7e6689 | |||
87adff7e18 | |||
c24018e273 | |||
6cf4e0329c | |||
df5157c0b0 | |||
acf4b5753f | |||
829730dec4 | |||
c084a7daa5 | |||
93e858f88e | |||
4f12f0697e | |||
76842b0df8 | |||
e3a8412df3 | |||
ebe2d9d872 | |||
f06543fd06 | |||
195b2d2ebd | |||
384b8c75f0 | |||
9925916851 | |||
095cb97675 | |||
d80f8bda94 | |||
3cf0477c21 | |||
8dbca75d85 | |||
710360bab6 | |||
3db9c80070 | |||
085f604b27 | |||
a5b27bbc10 | |||
8c7e4b290f | |||
5653898150 | |||
73123bf257 | |||
73c4ca3a6f | |||
296112848c | |||
008e91db6a | |||
3043b233ea | |||
bff5999efa | |||
f298ffdbb8 | |||
3664cd58e3 | |||
491edc16e7 | |||
83663ed4b0 | |||
9008b155d3 | |||
b6cb5272de | |||
6d99c03d91 | |||
99853ac3ce | |||
8240550187 | |||
709eff4ea7 | |||
6212175be3 | |||
6095edac58 | |||
3d9a4e7084 | |||
f778922086 | |||
edc52bdcbf | |||
0a22dc2ce5 | |||
cb4d168ecc | |||
5ebae82eeb | |||
64f35ba8d1 | |||
99481a245a | |||
9f7a8ea5e6 | |||
b4eeffa8f1 | |||
2df8ad6307 | |||
a052357872 | |||
a22056db59 | |||
beb7d35c40 | |||
d33987cb44 | |||
6dc46d3341 | |||
616066a598 | |||
7c24cd790d | |||
1bce02eff7 | |||
a3559c5e1b | |||
c8d0f8adc5 | |||
6ba8328077 | |||
61556ef01d | |||
ef7961b7d2 | |||
c17a3cb0ce | |||
cfd7e74c25 | |||
3a09459c4c | |||
9b85002b70 | |||
f816fdcb69 | |||
6049fcd52a | |||
c1fca72552 | |||
205af02a1f | |||
5a5560f105 | |||
59b63caf5e | |||
e4a601c644 | |||
7149191dd9 | |||
f38052c499 | |||
4cd9d57bad | |||
8cf9ed0ea5 | |||
28b7dcc204 | |||
eba3fca7bc | |||
6c098ee779 | |||
c0bbb7e69a | |||
d5ac24907e | |||
0f47129113 | |||
9b8a12b4b5 | |||
12f1aea38d | |||
b05e63c34d | |||
cab7e6000e | |||
0f460ad26e | |||
e70529a977 | |||
14e2e488fd | |||
437d79f094 | |||
93e693be72 | |||
675ba4d7eb | |||
f8d0cd9906 | |||
a1b6a9ac29 | |||
b402484e41 | |||
62cd9946ee | |||
e08aba5dd9 | |||
34f29d57b6 | |||
3220a32ff0 | |||
f7417d3552 | |||
04845d42c0 | |||
0d526d66b7 | |||
8fe16df6c9 | |||
1a9624af51 | |||
8b7e59729f | |||
5c958ec5f6 | |||
2a5af8fac7 | |||
559a81da6f | |||
27a8799e48 | |||
a19d2c2278 | |||
cad770c734 | |||
ca74bcc4cd | |||
b4e47a094c | |||
bd0a50fdc3 | |||
74266d5bbd | |||
9095b37343 | |||
ffab36c7d8 | |||
f82fb889b7 | |||
ddca18638f | |||
3588c4a9fe | |||
71b338e8ac | |||
58812fad42 | |||
790ded0f47 | |||
6dbd7a9a80 | |||
e1e50f4afd | |||
3a656c07f1 | |||
ec75119341 | |||
0b64906a72 | |||
1beb9a2b8b | |||
242667ebe5 | |||
5211fb0c79 | |||
81e7f8679e | |||
6f7f570670 | |||
8f9a354682 | |||
bc5d924b83 | |||
9481f86c37 | |||
dd9e99a418 | |||
33afb10b0d | |||
1ecb3b4cf3 | |||
dcd8cc8341 | |||
e6e468ef59 | |||
2a9fc7baa9 | |||
f6ee8e52dd | |||
08f2dde45a | |||
42713c6e99 | |||
7ffba22f2d | |||
60198a05b9 | |||
6b8b1259e2 | |||
c966a5c17e | |||
56aa24002d | |||
711be7009e | |||
f6e55962a8 | |||
ea8db7a4ae | |||
8aaec1d98f | |||
b1428555d1 | |||
20d518ee95 | |||
0e67fcd361 | |||
313cfba7d4 | |||
d99fea2db6 | |||
461324a801 | |||
fa59db7595 | |||
bd9bd4abed | |||
6eacc8eab9 | |||
00878e5b6e | |||
7ce63d32b2 | |||
3451f26086 | |||
05290d5547 | |||
60cdb1148c | |||
9bb1ac7564 | |||
6c9e503eb8 | |||
1d866b5e57 | |||
5c5df21e3d | |||
12e8404f8f | |||
0d1cdd26d6 | |||
cff0d93105 | |||
c24d143c9e | |||
bfd1fe977e | |||
d9ccbf04db | |||
dc100f85b3 | |||
0316490c54 | |||
d85cef557b | |||
838ca2fd93 | |||
cd94b5ffb3 | |||
3c619baec5 | |||
8f3a03c0cc | |||
75ee3b3f08 | |||
84b36a7193 | |||
dea68f073e | |||
7af9cc70d0 | |||
4b876168f4 | |||
d92a7527db | |||
720365859c | |||
d95e2b7999 | |||
9509322ecd | |||
6fc5d8e81e | |||
bed659f9b3 | |||
ad0acb5762 | |||
67e3eff806 | |||
f5024b4926 | |||
c1b2595deb | |||
512d4ca6a4 | |||
c91e4afe6c | |||
ebb7db263f | |||
d30571a7a8 | |||
cbeebcd47d | |||
f538ea25e4 | |||
a2d8b89289 | |||
8ca991ecd2 | |||
e3ad9be4c8 | |||
0d6479e1d6 | |||
429dd2a100 | |||
3270b432bc | |||
0a3a148ed4 | |||
bd14b4d23e | |||
4402a7d817 | |||
5871d1e359 | |||
2f33a8c657 | |||
6dc7be6cd1 | |||
7d6164b351 | |||
48a3f0986c | |||
a1d62abca4 | |||
44ab30f628 | |||
be96da179a | |||
8f94f731a5 | |||
ab6b9c44aa | |||
4e15adac6d | |||
dcae30c1e4 | |||
f281a362f0 | |||
c402dad6fa | |||
45d0d72138 | |||
15088d7ebe | |||
4be4db5e6c | |||
b100546c9d | |||
834f8a1dc8 | |||
ada684e054 | |||
92b30cc452 | |||
cb32f52b9c | |||
4f00929084 | |||
94b0ce84da | |||
e76c58d175 | |||
92299b7c24 | |||
48488017e4 | |||
b4da085a9f | |||
7db44b56b0 | |||
3e174a0879 | |||
99d5769c2b | |||
1b1fa049fa | |||
8cfbf1836d | |||
78fb2af6f1 | |||
b96a59eb28 | |||
64b6172089 | |||
e7d9bcd36b | |||
123282e045 | |||
e22e8b7fef | |||
a9db1ee8d4 | |||
699dcaf65c | |||
f4b717cb9d | |||
f59a3b67f6 | |||
1025d097fd | |||
d56d0c64aa | |||
0c4adeceae | |||
f76f953f0c | |||
9c2b878678 | |||
a82b89e2d5 | |||
c8302882c8 | |||
d87aa24885 | |||
0cdef3376d | |||
92c7aca817 | |||
b0e11826e5 | |||
e3998e30ba | |||
51d79f3e3b | |||
b773e57490 | |||
76c9c8d653 | |||
bd4f51ff3c | |||
5dcf59bdf4 | |||
9f8bcf3abc | |||
1bb398f4e2 | |||
3f90f7c898 | |||
c8438979a9 | |||
141d3caabb | |||
394e0f60c2 | |||
b95d9e005d | |||
f3473312ba | |||
5af4ff985d | |||
4914a78c8c | |||
af34749a6b | |||
af8f5f0b69 | |||
0ed1a8b50a | |||
8826e9694c | |||
c8307a9e44 | |||
b1c247231b | |||
fd9da72536 | |||
3ee0461cb5 | |||
8e0a39f33f | |||
e84fa8d4e6 | |||
f11b5f3e40 | |||
5538ff7252 | |||
aca9a41fcf | |||
df5603de0a | |||
fa890c8c01 | |||
ce2ec1980b | |||
f05d422a97 | |||
2ef044edfc | |||
cc67a84e94 | |||
81ec564ef6 | |||
4cf69d7cd3 | |||
38034c3066 | |||
56014844a9 | |||
d9bccdde23 | |||
051af604e2 | |||
cb607b4911 | |||
31c6159019 | |||
9e2f071d26 | |||
9adb625846 | |||
fb4113dab4 | |||
665a44646e | |||
6b3f5fb82b | |||
e252dbf989 | |||
8170f96ded | |||
0b10cbd713 | |||
3119be908c | |||
48125a25eb | |||
7849b7e978 | |||
28d4250866 | |||
5920aa7be6 | |||
1e55fe3aa2 | |||
9d386033ef | |||
2b02d81253 | |||
11b3f97520 | |||
10782c5aae | |||
cbc6709937 | |||
ca18b3f1e9 | |||
69e745c537 | |||
003280888d | |||
797b93c98c | |||
b095bd3237 | |||
1d3f43f060 | |||
d586dd902d | |||
272d58662c | |||
6623500c6b | |||
08c26ab8b0 | |||
f62b6742f2 | |||
e73aad959e | |||
771fbcc02e | |||
119c5b40a7 | |||
184055b3e2 | |||
bd2862aec6 | |||
69baa465ea | |||
66e439b6f4 | |||
feef194829 | |||
91c876831a | |||
06aa74e7df | |||
50fd469249 | |||
7daa8c2f6e | |||
bb03276c19 | |||
411b9800ae | |||
29b8a0bc5f | |||
2e45e4d015 | |||
5662176f8c | |||
1880c6b3dc | |||
6247a99f41 | |||
53d5c490be | |||
51ecab6967 | |||
f9ca054314 | |||
f7c9c8928e | |||
ea3048421f | |||
037039cace | |||
b5beb1aac1 | |||
5cd93a0618 | |||
ce05634f38 | |||
27cb0750c1 | |||
6b92d541da | |||
6f08e30109 | |||
520fdfe346 | |||
10b252dd05 | |||
eef4cd1b64 | |||
ac7994d8c7 | |||
8a7d1a69b3 | |||
76b20be2ea | |||
74cab14b8d | |||
c8aa5feb14 | |||
590c393680 | |||
6ea44c466a | |||
097ba56df5 | |||
33ca8d7b8f | |||
3ad1daa70d | |||
3bc64b6b6e | |||
73c1c2c4af | |||
350b0b1f66 | |||
3ea0e904ad | |||
20c742e474 | |||
82a2e4fe28 | |||
6956b5104f | |||
a02dc4ccc3 | |||
77badc8c46 | |||
d2bb83833f | |||
e57989c0a6 | |||
b94dfc8d3a | |||
70a00d602e | |||
df238dc7ec | |||
abdf5e76f3 | |||
03fd832ee8 | |||
fc308b842e | |||
35f339e942 | |||
fd9b03a431 | |||
c090a77f1c | |||
50f5ba5b0c | |||
cbd785cfe8 | |||
0165c18330 | |||
e0f93c74c5 | |||
a6265cb49a | |||
793baf060a | |||
ec132749aa | |||
45d1052229 | |||
d5a7ba1626 | |||
3b1296077b | |||
dac128a029 | |||
4e95cecfb9 | |||
3976b52ed7 | |||
e183880d8b | |||
d7736a7bbb | |||
df2b70853f | |||
9e6411db31 | |||
3b70985284 | |||
fa84e50ddb | |||
ade980912d | |||
28570ef109 | |||
20cdb73862 | |||
36cdab2068 | |||
6906904896 | |||
10bbf265b2 | |||
dac4a8f113 | |||
93fcabd251 | |||
f5b8775bed | |||
bb5038699e | |||
65cdb3436e | |||
86f789333a | |||
febec5ca4a | |||
70f7a0be11 | |||
0a99719a39 | |||
311c6f8a3f | |||
7227552f42 | |||
266d212094 | |||
3d177be73e | |||
0aea5fc4a3 | |||
7ca7938d8e | |||
f55e39cf1a | |||
393a92811b | |||
294b437414 | |||
c5bd32b0ad | |||
03e082d4ac | |||
db6f4ab1cc | |||
1644b1e53e | |||
cfd1f0907f | |||
2e894b668a | |||
8128190fb2 | |||
cb845b9bc8 | |||
56843ca0fc | |||
e02c0fa808 | |||
9b494c6869 | |||
3db6a8e92d | |||
6fec5bd32e | |||
6877660fe2 | |||
c1f8a640d3 | |||
e83a999039 | |||
44674cb96c | |||
d451269977 | |||
7c9508ed71 | |||
a38dafcc57 | |||
bd7aca76e1 | |||
4de3ad1712 | |||
83a4b8b49b | |||
b93d6ca5d2 | |||
9d86a49a73 | |||
f3196c915a | |||
9b60cf267a | |||
11ace54307 | |||
6de726f16c | |||
b417766b36 | |||
b4fa28a3e6 | |||
d1a6084bf7 | |||
a9b857769d | |||
0015ce1e35 | |||
4ed94d3d51 | |||
c95dfec5e4 | |||
e100aa3c6c | |||
677836cbee | |||
a75c92000f | |||
b55e017e62 | |||
82be305496 | |||
3bc238b1ce | |||
5053ec2190 | |||
a34a971b50 | |||
5fa0173c41 | |||
3af211dd65 | |||
6db40ecb22 | |||
a3c66b2740 | |||
0cae9c3c1b | |||
68ccbefc94 | |||
ab6ede51d7 | |||
ea0357bf02 | |||
44d50bc8d2 | |||
e20b113053 | |||
0acdeca3d6 | |||
a45e293267 | |||
41ae6f298e | |||
bd95fd770b | |||
b8354124be | |||
2b8eae9810 | |||
b2dc19155f | |||
7a5b279459 | |||
cf999c4622 | |||
68119d0929 | |||
9ed8dc7384 | |||
dc944f7518 | |||
d5d1e50365 | |||
2458697dad | |||
206672db5e | |||
5c2aa1d4f5 | |||
5cb4120ef5 | |||
496df5c29a | |||
3aeba50c38 | |||
29f5dd38e3 | |||
b8b1453392 | |||
ecdda01841 | |||
bb4495722f | |||
1118aaf840 | |||
1cb12296f6 | |||
96fd1ce270 | |||
544b7fba7f | |||
6ecbbe4006 | |||
cba2f6c2c4 | |||
1fe2d0d0e0 | |||
54558dd8ae | |||
60a8c9527c | |||
84690bfbbe | |||
d3a0bb4f35 | |||
ad13b402d7 | |||
b66fcf85df | |||
ba43364f36 | |||
57dc435f9b | |||
c582890590 | |||
615d20598a | |||
46a496428f | |||
acfb5b85fb | |||
70db149494 | |||
a4007f3b68 | |||
bc1a173d2f | |||
5c5db7d931 | |||
6800c3665a | |||
b73c07dd80 | |||
ea67d853a8 | |||
ac5e86b7ae | |||
353b558536 | |||
8516e748ca | |||
8780deece9 | |||
29ca238a7a | |||
1b66e1c93a | |||
0705bb3fe5 | |||
48fd23dc10 | |||
6e4818d742 | |||
df30588eb6 | |||
ce149d2733 | |||
9ac4e23b66 | |||
154ca03228 | |||
c7d666ad61 | |||
7d08e4f7d1 | |||
2ae3bda029 | |||
d5262a3350 | |||
67dc3be54a | |||
c35950de47 | |||
761af68df4 | |||
1bc815e0b1 | |||
16871ae2b4 | |||
9ed5b4d90e | |||
430a489446 | |||
b4bd70c402 | |||
b65f29f8fa | |||
65a802c678 | |||
151f9c7f82 | |||
8585e59718 | |||
ae1de6593c | |||
723074e71b | |||
80261c803a | |||
e429e2614f | |||
2478f49c50 | |||
0a82e3b75b | |||
9689a2012b | |||
02ea68f1f3 | |||
d953415d91 | |||
06a9ee74bc | |||
a96c5986c5 | |||
863785a520 | |||
e077cad333 | |||
7280057228 | |||
b27100c8fc | |||
f3a93b046e | |||
b3834d8272 | |||
01863ebff0 | |||
e4cc365e89 | |||
a26c479182 | |||
9559b53228 | |||
eb32fe20c8 | |||
fd041d91ee | |||
15ded0bea9 | |||
1549a29c9d | |||
66e309c5c4 | |||
fb528c47c0 | |||
74de0f1f2a | |||
b89d9f6e90 | |||
d02024929a | |||
d22db77248 | |||
399256b384 | |||
33a0dec8a1 | |||
2f614900e8 | |||
4db4ec1621 | |||
74ef22d824 | |||
86d1a26b13 | |||
742a9b00bc | |||
9e89dacc64 | |||
f63cb27803 | |||
18bf586d55 | |||
3dfda15ef3 | |||
954ba211bf | |||
ddefa11695 | |||
91ca5d724e | |||
4b4830692a | |||
2fb57b2ea7 | |||
96cf6fc147 | |||
8ef17c2fb1 | |||
10564723b9 | |||
369e8c4150 | |||
c0187930dc | |||
2f362509b8 | |||
8ac1b85a0b | |||
7dacd7eb78 | |||
2949990016 | |||
893e9256a0 | |||
d91357d00c | |||
0fea62ec6d | |||
a63b74e345 | |||
0b6b6b52fe | |||
250d40bca0 | |||
adabd71a4a | |||
ff27df78fc | |||
627b7c9fd7 | |||
4e6defd657 | |||
1cdf0a2c51 | |||
e68c502f7a | |||
6afc16399f | |||
3f904bf3ac | |||
cdbc3ecc2a | |||
67af300383 | |||
ccea5fa948 | |||
fcc6f183a4 | |||
997e92191d | |||
4be75b1858 | |||
444c9effdb | |||
962255b373 | |||
ded013b7a7 | |||
d9d4f63cd4 | |||
56103f0751 | |||
be9bfb5536 | |||
5ac875b097 | |||
842f2cc8a0 | |||
77fd361c62 | |||
09c7d158d1 | |||
836ed9d6b7 | |||
a9f9a59416 | |||
42d43147ca | |||
93008e279d | |||
740081e2f7 | |||
088bbc6bb7 | |||
2d00027fd9 | |||
d03ab3c976 | |||
fb90ecc8bc | |||
9131a7c65e | |||
7855a233a7 | |||
b849547116 | |||
5196f9a340 | |||
6d171ff511 | |||
732573ba51 | |||
854d6d4e5c | |||
48a99d23cd | |||
a289a77d5d | |||
3def9258be | |||
0eb08693e9 | |||
cc6ad034f1 | |||
0af0f0d890 | |||
b3c975269e | |||
ed73fc0be3 | |||
cb65848fee | |||
1f59c37b89 | |||
c173e9f4ab | |||
be9912fae2 | |||
15ef3388c1 | |||
d90ae4d45b | |||
38cf52b62c | |||
b368549fd5 | |||
c44f4f32fe | |||
eaa2e8900d | |||
7c65560f20 | |||
79c64f6bca | |||
89c442cadb | |||
245ffb1123 | |||
55a2f35a64 | |||
fb49e5565a | |||
0eb1db0d17 | |||
ecc2c609d4 | |||
b97ea0e447 | |||
b0ae61c652 | |||
a8409b0a8b | |||
5ae3deea86 | |||
88655439a0 | |||
e12abfd43b | |||
793e666f36 | |||
4008ff32c9 | |||
d79387c27e | |||
27735bbdfc | |||
2eab964a00 | |||
4bd6003b7f | |||
8f1b461228 | |||
c2c8757bd1 | |||
7d95e8624a | |||
203c4b99a0 | |||
9f4886839f | |||
df0c43265e | |||
a6c4543c57 | |||
2b9f71c6ca | |||
d701b23230 | |||
f6a4f9c753 | |||
79bc628858 | |||
ace551030f | |||
c362172567 | |||
c7ee9844bd | |||
0fcc606569 | |||
aadc5be3ff | |||
07cfb7b64a | |||
0d733aa071 | |||
1fd69e9569 | |||
612b631823 | |||
3fd0337330 | |||
0283498140 | |||
14e4f1283c | |||
95ba340d07 | |||
fa881220ae | |||
d518423b9c | |||
3569e8d7df | |||
e85f3972b9 | |||
1fa792eae7 | |||
dc3b0e170c | |||
59d9746849 | |||
2e2f23a0ae | |||
0c9c79a89b | |||
ac14f002e6 | |||
c59d7a899b | |||
ce8f24e57a | |||
a760ce05b9 | |||
2e5d28c73f | |||
51a2087081 | |||
42d2bc28af | |||
024be32f06 | |||
27290e1277 | |||
c51db4c940 | |||
3fc24013ef | |||
4dc5855dfe | |||
d6b0ab3028 | |||
a915ba17ed | |||
7272577fe6 | |||
bbe896875e | |||
c7afb5fb72 | |||
852d1ee395 | |||
da50c75148 | |||
4edf7cfb05 | |||
3c78e418fb | |||
e71b198e3d | |||
4f0bda403e | |||
c215bbadf1 | |||
0f84b9c30d | |||
342cc122b4 | |||
03ce15df4c | |||
3debeb7236 | |||
3c319f93f2 | |||
2e7cf83522 | |||
8bed47a2d4 | |||
5ede1224e4 | |||
9831619881 | |||
34e937c976 | |||
834803f1e8 | |||
5501679642 | |||
5a2d62e4d9 | |||
42d47ecfb0 | |||
23f83f53cc | |||
1f9894c084 | |||
719b7784f3 | |||
5c9fd19105 | |||
27f8922653 | |||
74d7012025 | |||
5ca2938117 | |||
6fd2401cdf | |||
6e94c024e4 | |||
d1d2b660dc | |||
8e7c4f91e3 | |||
41bd38147c | |||
92ffc1cc4c | |||
d761af84c8 | |||
beca2234af | |||
97004f7eb2 | |||
54f9ea14e1 | |||
7ee49c32b7 | |||
702cf5a3e1 | |||
dcf4fad971 | |||
6d69ca36a7 | |||
a45c08f9fe | |||
3c3292d505 | |||
306b5bcff3 | |||
cbd71ef8f5 | |||
32d125131f | |||
958b482ada | |||
92b16618ed | |||
a3771e7d7b | |||
06ec80f394 | |||
5d57b78471 | |||
490ca410c0 | |||
9c86e99968 | |||
1e8b54abfb | |||
2f5c95610f | |||
20ee1ae65e | |||
74abc457ad | |||
eab0b2a90a | |||
194c58858c | |||
67528cf970 | |||
6774ddaba2 | |||
13cc220c0d | |||
9f7d8ff302 | |||
4d5a890b46 | |||
1e4af85a38 | |||
8f91d47bf3 | |||
5d2669dbd3 | |||
93261b98c2 | |||
9f00aeae29 | |||
2762ec22d0 | |||
cd9b344506 | |||
61cc2ba7d9 | |||
dad29bcaa1 | |||
65650a5c66 | |||
db8170def3 | |||
449b9a9d68 | |||
28a146d438 | |||
6a19b62db6 | |||
a626b7ebe1 | |||
3331bb29ea | |||
16f6100500 | |||
90f63657cb | |||
0415e4a637 | |||
ed3424ff75 | |||
14c4f06100 | |||
8820d4e5ac | |||
7c0a27a0f4 | |||
7a410643ac | |||
34da3b4fa8 | |||
4a2dd306c7 | |||
09bade6466 | |||
9a93169898 | |||
017d36e6b2 | |||
75a7a4c97c | |||
1735ec0362 | |||
0ecc5c815e | |||
94b12f7804 | |||
5ec62a5153 | |||
2784e256f1 | |||
50bc838047 | |||
69acda2c25 | |||
98f21d8973 | |||
767d24ea5d | |||
d1c89727dc | |||
3d5db7288f | |||
dc11b5c55e | |||
5c03adbded | |||
353ecbb7d7 | |||
8845fb7eae | |||
5a0c4ce295 | |||
04f8c455e2 | |||
2c46bfde8b | |||
5b2e5d180f | |||
6426f3635e | |||
ee3ba0b1d6 | |||
54715586ab | |||
9010857677 | |||
ff151f9fbc | |||
5c7e96d895 | |||
04561c4ddc | |||
9688ebef52 | |||
d6753b2883 | |||
b7ff773ecf | |||
e504088b79 | |||
d52e5f7130 | |||
bea468f1e5 | |||
639f1fd339 | |||
67e5689f87 | |||
dcbd97d29c | |||
794e65b60e | |||
6cb35836a2 | |||
e4e704f480 | |||
14d13167a7 | |||
78aad9a192 | |||
b01cb2406f | |||
42bb3d8aae | |||
96ac061e68 | |||
890745e846 | |||
4d77b7face | |||
68fba4b781 | |||
239a5d3230 | |||
6fe9b4ab5e | |||
9dab7dcc3c | |||
d40cba3042 | |||
1199941475 | |||
ec040908e9 | |||
b958179263 | |||
5a2afc5754 | |||
d4300c406c | |||
4fb2905b1e | |||
6b296d907b | |||
b232acd04e | |||
329887df99 | |||
44d0d6abd2 | |||
0c6f1c9c3a | |||
584d1c61ec | |||
af27264140 | |||
90eb4f1939 | |||
23b5b5fa36 | |||
d5bcc01eae | |||
633027d980 | |||
d3d043dba0 | |||
db60ebbbd7 | |||
cb7ebdf821 | |||
70e1a1a4df | |||
7c41e413e4 | |||
f02602d02d | |||
90c2064640 | |||
c833c3fec8 | |||
c64629964f | |||
de2da4fd19 | |||
198e5eeab9 | |||
8baa0f84e7 | |||
5d67139206 | |||
5b8dde9602 | |||
81bc721c5c | |||
35ae9e3aa8 | |||
2f9bc2ab75 | |||
8de099ae75 | |||
40e3d2ab55 | |||
6748158ab4 | |||
e4d2d00d41 | |||
315d65280b | |||
d15952c867 | |||
1954ef47e6 | |||
fd1d0bbde7 | |||
d7e396a98c | |||
00d3935aac | |||
bb2433ca1a | |||
7238a77327 | |||
dd869064a6 | |||
7a2a63f32b | |||
28ef7d228c | |||
6151ae7db5 | |||
3889785017 | |||
7a9ff4f8d4 | |||
29f613ef84 | |||
ff5703fd9b | |||
89630d2826 | |||
550407b0ec | |||
d0959063d5 | |||
d294dedfad | |||
e798294a4b | |||
114e715e3c | |||
253c23240b | |||
0ce9003ba7 | |||
2bbc204328 | |||
92693e4459 | |||
39263b674c | |||
5f5910c603 | |||
ed276cd7c2 | |||
82272ee08a | |||
9ed0d389b2 | |||
00bb68d7d2 | |||
c23074d5ad | |||
8ddd4c4c52 | |||
5a86892ecb | |||
12972b4b65 | |||
2920795168 | |||
25314313f8 | |||
a8be0d9f48 | |||
dabaa4cce0 | |||
707d413761 | |||
4be3521727 | |||
e3b911652d | |||
5e50b50dc3 | |||
772e7e8c8d | |||
e1ea41ee9c | |||
d87857ffdb | |||
1db3e2241e | |||
d085133c6d | |||
5c1e0a6dc4 | |||
7489fb784e | |||
2eae52ebd1 | |||
79009ca074 | |||
8151858e70 | |||
6c7e58643c | |||
423beddf57 | |||
30f5642c62 | |||
e3ad2a3969 | |||
8119d77a21 | |||
d551a75c35 | |||
8935a93cf8 | |||
9d5a3f0131 | |||
a98e6a262a | |||
491925b71e | |||
853053a3b2 | |||
21e389bec5 | |||
da38faa8f7 | |||
098136b681 | |||
0ed19d9f20 | |||
39cb34850a | |||
782f780476 | |||
a243e3b858 | |||
98f1ee9442 | |||
a02edf7a93 | |||
6465e4c3fd | |||
e75f7ae330 | |||
b0dc50c2a0 | |||
6d32bef65a | |||
4141cc39d0 | |||
d8c675afbf | |||
8fe8175c78 | |||
589d27386a | |||
e58ba2fcfa | |||
9dae1a1732 | |||
0c55a11318 | |||
16e8fc7427 | |||
f58c7ac5a6 | |||
63157c798d | |||
b9e8a3e024 | |||
8e9cc36979 | |||
614624754d | |||
d890258af6 | |||
803e4807ed | |||
a4e26bf7c2 | |||
9350ecd36f | |||
8c96c5662f | |||
842d52db7b | |||
bb1641e4ec | |||
299b50a0d4 | |||
931ae0f116 | |||
7fb5e993e3 | |||
0251fae5cc | |||
0c6b41f4c9 | |||
f63f3853bb | |||
3f1f8438ed | |||
7ad073fb30 | |||
09f37bd023 | |||
8f29f6a4d4 | |||
6fcc6a2f7c | |||
0b8ba1d55b | |||
933aa63b7d | |||
80ffe1610c | |||
9104dcc29c | |||
7e6684d926 | |||
1b431f29e5 | |||
5ea7598408 | |||
731f55a05d | |||
509389be97 | |||
f911087eab | |||
c4af1340fa | |||
3bc57fe5b5 | |||
7f94bd09ae | |||
d179f31d4f | |||
fba6de834e | |||
1f79175898 | |||
2fbcfd8824 | |||
22e16f15a6 | |||
dc9c9369e0 | |||
2565a79575 | |||
8a885c2606 | |||
ca79360fd7 | |||
34c8045d5b | |||
a90ffe1af1 | |||
01e6f63e98 | |||
3621988e15 | |||
53e30f750d | |||
6656f99c54 | |||
5a0e751736 | |||
ff0f15f763 | |||
887debb055 | |||
0d77632839 | |||
8b15732c1e | |||
48bca30e61 | |||
9f62d441a7 | |||
b836267401 | |||
7b55bcf484 | |||
15d1f753f7 | |||
1d76e433f7 | |||
02d8ad030f | |||
58a0e8e3e2 | |||
dccef70728 | |||
1fbea2e438 | |||
8198fd7913 | |||
d80f999a21 | |||
5871dbaf5a | |||
b0e023e432 | |||
6d52da58d9 | |||
63883bf27d | |||
8124547348 | |||
c734dde982 | |||
cebf4e3697 | |||
5e2bf12a31 | |||
d078e9b8c9 | |||
b855e5f7df | |||
6593c69424 | |||
3a9d7d318a | |||
8a2e50ab2a | |||
9ee6295c75 | |||
1bf6f8b4a6 | |||
4d3209ad1d | |||
9ff97a98a7 | |||
1938bfcddf | |||
71ab5d52b6 | |||
e090d131c3 | |||
97cc762143 | |||
bdc206885a | |||
69044fe577 | |||
753f749423 | |||
2e6cf42011 | |||
2995d6c281 | |||
1b40f69ce5 | |||
771f64397f | |||
d8339fa29a | |||
006ac772e6 | |||
a51dfe89c0 | |||
c7d1924c34 | |||
1153fd9a0c | |||
a56f78af67 | |||
d7b882977c | |||
2010fea088 | |||
fb6ff61730 | |||
ff8a834ccc | |||
9e8127accb | |||
6b7dfa1fb5 | |||
17c825f53a | |||
b15e03acd7 | |||
e0b6a31613 | |||
f382221b28 | |||
6c91ffcfbe | |||
15e0093e13 | |||
99797858a6 | |||
8fcba0eb1e | |||
9bb7633254 | |||
e7097641e3 | |||
a2d01d6af8 | |||
2ef3a98929 | |||
4d98762486 | |||
73a42d34a5 | |||
95adac7522 | |||
76a59274bf | |||
a453b5514d | |||
8601604a09 | |||
b695c82520 | |||
a98e35d7a0 | |||
65722aeeca | |||
8278ba5e45 | |||
6e98e5709a | |||
2fec1af275 | |||
cfb979b5e3 | |||
9988b1a047 | |||
73761f7af6 | |||
1c01e9c095 | |||
98d4b51120 | |||
ab8c7252da | |||
818cbcbdd4 | |||
a428533160 | |||
006c757a03 | |||
4eb1771e67 | |||
aba3066658 | |||
c1b09d639c | |||
817def000b | |||
6e24d603a1 | |||
5cdfee5143 | |||
2232974cda | |||
aefcb83419 | |||
24a6d87c3f | |||
4c7bd75c1a | |||
b1463b2dc2 | |||
1f3f76cb09 | |||
3ebd7f1166 | |||
81ef40010f | |||
99fa9afaf1 | |||
281559d427 | |||
cc8464ce80 | |||
230aafbf66 | |||
14787ac148 | |||
4e1c6a8a22 | |||
f8f84ef095 | |||
e1b7bd51ee | |||
56c2f651fe | |||
c371f9a162 | |||
d6e398aba4 | |||
7fe73deb2d | |||
8f5eddd0ba | |||
f5852b47d1 | |||
1275e5bdc9 | |||
86cf69648e | |||
d658a7f4ab | |||
0e9c8568fd | |||
2667cb3ab6 | |||
0c27c5eb7f | |||
05e4e97276 | |||
07fe00c466 | |||
cbf221f6b7 | |||
734b2e4cf7 | |||
85793a4706 | |||
3c35ba7c31 | |||
5ceb1620e9 | |||
e8b4585295 | |||
6ef2832083 | |||
6ba534af92 | |||
47fd4833ee | |||
64701e388c | |||
27aae60381 | |||
7dae955c1a | |||
3b38df085e | |||
de87e436ab | |||
e837c9ab3f | |||
ad51c85e5d | |||
9562aba86a | |||
4b13f93a3e | |||
c37b3cef7d | |||
0c4040d191 | |||
2bd377a3de | |||
31e44c2ab9 | |||
f5d4414734 | |||
7d3e99a2ab | |||
b4e156e1d7 | |||
6a31d55b2e | |||
45b810450f | |||
f292e93e0e | |||
378815ee62 | |||
38b4dc2cdf | |||
530ab6b8fc | |||
fafdd21e4f | |||
faa57ecaef | |||
2450398862 | |||
36c9c93720 | |||
12f30e6220 | |||
fd19142c0d | |||
a2fb265563 | |||
b8034f4d9e | |||
bd48690f63 | |||
8730dfdcc2 | |||
88686cbed2 | |||
f95993e326 | |||
7bf2ae0b11 | |||
2734fc4079 | |||
6efdd21633 | |||
ad4ffdc947 | |||
65f570271c | |||
a6b9ea05e8 | |||
166853aed9 | |||
98a631b556 | |||
ff2cf2dacd | |||
3ac74b1e78 | |||
f4fa0d48cb | |||
0512113bdd | |||
7c0df348f8 | |||
0c1f732c64 | |||
283f4d8eb3 | |||
a4883a029f | |||
b2181ac814 | |||
b0798e0a72 | |||
9831ba20b2 | |||
485e04d9df | |||
86d6aba012 | |||
c9ac5b0f74 | |||
28357d657b | |||
8ec1bb382a | |||
cac9562c05 | |||
d31303a592 | |||
a9d5656a46 | |||
3647cc5b07 | |||
cc341b8734 | |||
52b664b0ae | |||
8fe0864680 | |||
5fcbaefd0b | |||
7f9fd08792 | |||
8b4ed8c505 | |||
4eb3ad192e | |||
36572f03a7 | |||
a32dffb0e8 | |||
e22e83b19a | |||
d3d9ed62e2 | |||
be7da48dad | |||
3af35d922e | |||
dbf8645aaf | |||
c03bf14e02 | |||
afe83af219 | |||
5a0bae1dae | |||
e8fb965ccb | |||
d709815106 | |||
f0440e85dc | |||
554f4f6f7d | |||
6c66cb3fa9 | |||
45ce820b11 | |||
76d7bad722 | |||
a0af7de58e | |||
050684450b | |||
e18b96b486 | |||
af6875f4b2 | |||
66af749023 | |||
2096b3a9ed | |||
fedd4c906f | |||
78cb04cca3 | |||
14a6e6a9ce | |||
3e5a7b34b1 | |||
a4ca9927ab | |||
9b1f11695d | |||
87a5e94525 | |||
b98cc2fb4e | |||
fde3e01f80 | |||
c496aad20b | |||
8adad0654a | |||
5757f5df2a | |||
39b8c83ba6 | |||
7c91159449 | |||
4f20e8f649 | |||
1f6df0cd52 | |||
69d83b1da5 | |||
e798f221dd | |||
c54788338a | |||
ebdf339a61 | |||
70c8656640 | |||
17674fb888 | |||
91aa189ef3 | |||
e6a68f0c3a | |||
d2ab322267 | |||
c3293641e7 | |||
21724f7ef9 | |||
38d6b67b5c | |||
5516efdfa0 | |||
21f8806eed | |||
bf850974f3 | |||
338b698091 | |||
16e52327a4 | |||
05d2d8f27d | |||
ca6e3f6def | |||
d3a159ad3d | |||
0f93da400a | |||
f3818478e2 | |||
ee7c16a8d9 | |||
1c85d8c66b | |||
0651af9dfd | |||
c81804444f | |||
ef7f3f36e2 | |||
f7d4e3cd6b | |||
6b08efabf8 | |||
3a9a252f6e | |||
61cd1594b5 | |||
11c26e3211 | |||
6930260962 | |||
a96c8c8af9 | |||
c5729d7ecc | |||
d811920d8b | |||
9c6aca7893 | |||
ca13e3b105 | |||
086acd122b | |||
116516158d | |||
ca747f2688 | |||
7d6ba88d2b | |||
d927c154e7 | |||
25dd46061f | |||
afc92fb7d7 | |||
891f725909 | |||
969e748dce | |||
6a530ea371 | |||
0fccbeabcc | |||
720521ed4a | |||
e09f0a5f2c | |||
4f2e9c2640 | |||
5714a82778 | |||
272b135b74 | |||
335dc9e687 | |||
03e139d23b | |||
6d28bf534f | |||
c0cad0b534 | |||
a83db489df | |||
035f0ffb8a | |||
b66a99e32d | |||
527a3bbc2a | |||
c0a030ef0a | |||
35a82f8f4a | |||
12643c7c57 | |||
90bb512f42 | |||
782910eaa7 | |||
3558dd5ed4 | |||
0a88010826 | |||
7d0348e4ba | |||
5f49a659c3 | |||
7277c42047 | |||
7cc28c8b46 | |||
205e33bc83 | |||
6625b6ffbd | |||
b888652201 | |||
60fd2f3521 | |||
75e6406c1f | |||
3c3431d111 | |||
56a58ad70d | |||
00c5f9b9a6 | |||
7660e1ed90 | |||
43cad69016 | |||
308c59320c | |||
6253d10938 | |||
e0b6091d7e | |||
ec6ec62dd4 | |||
97786d03d5 | |||
274d5cc91c | |||
6a86c517c4 | |||
01c1bce9c5 | |||
9a9e252cab | |||
b52b1fca89 | |||
2ea4c632d1 | |||
fa1db8d2dc | |||
9cf8ce9ef8 | |||
f567f89b99 | |||
7705b23f24 | |||
f3d27bf5d8 | |||
c68ff9886b | |||
f21eb88ad1 | |||
c642094cac | |||
3520771d68 | |||
c17381b853 | |||
59d8dc3950 | |||
38ea6a6d5d | |||
82d0f65dab | |||
c135b389fe | |||
bdc0d1b7ad | |||
ae837c4719 | |||
344e827061 | |||
2be2fc7974 | |||
826c827e6b | |||
2b9b02812e | |||
07578fe25f | |||
095d5baaed | |||
8ea7e21f64 | |||
3274e0a249 | |||
b15a4985e8 | |||
d5efeab8f9 | |||
54bcee512d | |||
685ea3e9a9 | |||
694ef47041 | |||
9d887234ea | |||
e2e338929f | |||
8162aff8cf | |||
ea873304ca | |||
f80984491a | |||
e7770b2332 | |||
be543a6d17 | |||
6c6e8b0fd7 | |||
79320e2868 | |||
92f2abdf76 | |||
c1de7bcec5 | |||
8577e9116e | |||
5b1613d65b | |||
c1d0ea7366 | |||
9d492b0509 | |||
bfed1c7cac | |||
d2bc57cd34 | |||
d65b4cd0dd | |||
f1b354e6aa | |||
d7c5936ac4 | |||
ceada15290 | |||
b462ca4aad | |||
601340bd46 | |||
8ee8ec8a36 | |||
7de2c7f176 | |||
839bd73fbb | |||
3f7ec1a83f | |||
8fa19664e6 | |||
9d06f9e6fb | |||
c0fcefa3a0 | |||
c9f3d1c00b | |||
179255c3fe | |||
4fad5958d0 | |||
e98b53bbef | |||
4b8c50e2cd | |||
1e7b3cbb13 | |||
ce07d9bb4c | |||
507fc7b9d1 | |||
4f4175a3e2 | |||
c7e73ba12d | |||
b30b9ab8cb | |||
0afdedb01a | |||
6c7255cde2 | |||
f2234264ed | |||
95a8ebc249 | |||
88a9c62fcc | |||
b29c1eecd1 | |||
d69db6e617 | |||
d8b5bbd48c | |||
22e2c3429b | |||
4cc5b03137 | |||
a3fb7008b2 | |||
55c1c220d0 | |||
5971c82094 | |||
1a98bbf1c8 | |||
377c995103 | |||
8ecb24f114 | |||
3a45cdeaf9 | |||
a4a4ffbeff | |||
f5737b929a | |||
c66cf95b40 | |||
73b9ae9579 | |||
4bfd717ba2 | |||
cca8585554 | |||
18cc35338a | |||
681eacaa7f | |||
b20c0b1d59 | |||
f2a1260294 | |||
06ea7fc830 | |||
ed05779adb | |||
8f69c2ac45 | |||
504d356232 | |||
059ad35215 | |||
9bc5c4a0c5 | |||
4afb624c45 | |||
39b6eaf51c | |||
d4cc125456 | |||
dc994b3518 | |||
8e7daec886 | |||
b3da104e56 | |||
0936e5ccf5 | |||
531b3a96eb | |||
3dae732f36 | |||
1e241e3a61 | |||
24f2b2afc3 | |||
357b4bc14c | |||
5adbd39946 | |||
6dac014978 | |||
4d405f6654 | |||
bbcf304b99 | |||
c866fcc5b3 | |||
d7eca7bcc1 | |||
68028f492f | |||
8629d9a418 | |||
c7623c3165 | |||
ba95849097 | |||
bb3e28310e | |||
a5b7279cb5 | |||
c5b009ba6f | |||
e72a782bf0 | |||
7413552a28 | |||
b7a636b894 | |||
e5b97fe03e | |||
2ea05292c0 | |||
e4a6ee3d7f | |||
7264044122 | |||
f1d6f1bd17 | |||
c95a27e394 | |||
066940f134 | |||
07c12f0b92 | |||
5883446b21 | |||
9bcb3d2216 | |||
424b0b8bac | |||
30ee32a725 | |||
f5fbbb147f | |||
147a74dff2 | |||
60afd02e59 | |||
fd1aa869e1 | |||
334c41d088 | |||
4a656eff7b | |||
73fd358d94 | |||
f247f0c518 | |||
f6d1bfe45b | |||
c2fb9f06ad | |||
67de76c217 | |||
02acef23d5 | |||
5a83114efd | |||
42123b4396 | |||
0ae6a38825 | |||
8ab6c53231 | |||
1d26ae2dea | |||
d2edc2bbf4 | |||
8db7d791f0 | |||
a50b4f6b11 | |||
156495732b | |||
3c4fb01da3 | |||
c00b1dd508 | |||
0de31a3898 | |||
24349bc431 | |||
1f7b13ff4e | |||
04c00f40f0 | |||
9e9b7a520e | |||
f995f5763b | |||
6292c5ad5a | |||
a9a564c226 | |||
04b6e413d9 | |||
aa9341570b | |||
f4a96ca588 | |||
48b41862ef | |||
3f503ffc7f | |||
ae0d4eb7aa | |||
cb8a7d979d | |||
b70fe3a9be | |||
dfa778fed6 | |||
8c4746a3df | |||
ce69334988 | |||
8c09602a8b | |||
da66eddfcc | |||
dfa38b3f91 | |||
36f221dbe7 | |||
7f100e9610 | |||
7ccf51fd30 | |||
3e400739a7 | |||
4a82230de5 | |||
884f792871 | |||
7931c6624c | |||
1b7cba1878 | |||
233f5200ef | |||
878e796c0a | |||
2b32f47d2c |
9
.gitignore
vendored
9
.gitignore
vendored
@ -9,6 +9,11 @@
|
||||
*un~
|
||||
.DS_Store
|
||||
*/**/.DS_Store
|
||||
ethereum/ethereum
|
||||
ethereal/ethereal
|
||||
.ethtest
|
||||
|
||||
#*
|
||||
.#*
|
||||
*#
|
||||
*~
|
||||
.project
|
||||
.settings
|
||||
|
12
.mailmap
Normal file
12
.mailmap
Normal file
@ -0,0 +1,12 @@
|
||||
Jeffrey Wilcke <jeffrey@ethereum.org>
|
||||
Jeffrey Wilcke <jeffrey@ethereum.org> <geffobscura@gmail.com>
|
||||
Jeffrey Wilcke <jeffrey@ethereum.org> <obscuren@obscura.com>
|
||||
Jeffrey Wilcke <jeffrey@ethereum.org> <obscuren@users.noreply.github.com>
|
||||
|
||||
Viktor Trón <viktor.tron@gmail.com>
|
||||
|
||||
Joseph Goulden <joegoulden@gmail.com>
|
||||
|
||||
Nick Savers <nicksavers@gmail.com>
|
||||
|
||||
Maran Hidskes <maran.hidskes@gmail.com>
|
31
.travis.yml
31
.travis.yml
@ -1,4 +1,31 @@
|
||||
before_install: sudo apt-get install libgmp3-dev
|
||||
language: go
|
||||
go:
|
||||
- 1.2
|
||||
- 1.4.1
|
||||
before_install:
|
||||
- sudo add-apt-repository ppa:beineri/opt-qt54 -y
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -yqq libgmp3-dev libreadline6-dev qt54quickcontrols qt54webengine
|
||||
install:
|
||||
- go get code.google.com/p/go.tools/cmd/goimports
|
||||
- go get github.com/golang/lint/golint
|
||||
# - go get golang.org/x/tools/cmd/vet
|
||||
- if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get gopkg.in/check.v1
|
||||
- DEPS=$(go list -f '{{.Imports}}' ./... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$DEPS" ]; then go get -d -v $DEPS; fi
|
||||
before_script:
|
||||
- gofmt -l -w .
|
||||
- goimports -l -w .
|
||||
- golint .
|
||||
# - go vet ./...
|
||||
# - go test -race ./...
|
||||
script:
|
||||
- ./gocoverage.sh
|
||||
after_success:
|
||||
- if [ "$COVERALLS_TOKEN" ]; then goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN; fi
|
||||
env:
|
||||
global:
|
||||
- PKG_CONFIG_PATH=/opt/qt54/lib/pkgconfig
|
||||
- LD_LIBRARY_PATH=/opt/qt54/lib
|
||||
- secure: "U2U1AmkU4NJBgKR/uUAebQY87cNL0+1JHjnLOmmXwxYYyj5ralWb1aSuSH3qSXiT93qLBmtaUkuv9fberHVqrbAeVlztVdUsKAq7JMQH+M99iFkC9UiRMqHmtjWJ0ok4COD1sRYixxi21wb/JrMe3M1iL4QJVS61iltjHhVdM64="
|
||||
|
||||
|
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@ -0,0 +1,37 @@
|
||||
FROM ubuntu:14.04
|
||||
|
||||
## Environment setup
|
||||
ENV HOME /root
|
||||
ENV GOPATH /root/go
|
||||
ENV PATH /golang/bin:/root/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
|
||||
ENV PKG_CONFIG_PATH /opt/qt54/lib/pkgconfig
|
||||
|
||||
RUN mkdir -p /root/go
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
## Install base dependencies
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
RUN apt-get install -y git mercurial build-essential software-properties-common pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev mesa-common-dev libglu1-mesa-dev
|
||||
|
||||
## Install Qt5.4 dependencies from PPA
|
||||
RUN add-apt-repository ppa:beineri/opt-qt54-trusty -y
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y qt54quickcontrols qt54webengine
|
||||
|
||||
## Build and install latest Go
|
||||
RUN git clone https://go.googlesource.com/go golang
|
||||
RUN cd golang && git checkout go1.4.1
|
||||
RUN cd golang/src && ./make.bash && go version
|
||||
|
||||
# this is a workaround, to make sure that docker's cache is invalidated whenever the git repo changes
|
||||
ADD https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop file_does_not_exist
|
||||
|
||||
## Fetch and install go-ethereum
|
||||
RUN go get -u -v -d github.com/ethereum/go-ethereum/...
|
||||
WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum
|
||||
RUN ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get $ETH_DEPS; fi
|
||||
RUN go install -v ./cmd/ethereum
|
||||
|
||||
## Run & expose JSON RPC
|
||||
ENTRYPOINT ["ethereum", "-rpc=true", "-rpcport=8080"]
|
||||
EXPOSE 8080
|
31
LICENSE
31
LICENSE
@ -1,21 +1,16 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
|
||||
Copyright (c) 2013 Jeffrey Wilcke
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301 USA
|
||||
|
102
README.md
102
README.md
@ -1,42 +1,75 @@
|
||||
Ethereum
|
||||
========
|
||||
|
||||
[](https://travis-ci.org/ethereum/go-ethereum)
|
||||
## Ethereum Go
|
||||
|
||||
Ethereum Go Client © 2014 Jeffrey Wilcke.
|
||||
|
||||
Current state: Proof of Concept 0.6.0.
|
||||
| Linux | OSX | Windows
|
||||
----------|---------|-----|--------
|
||||
develop | [](http://build.ethdev.com/builders/Linux%20Go%20develop%20branch/builds/-1) | [](http://build.ethdev.com/builders/OSX%20Go%20develop%20branch/builds/-1) | N/A
|
||||
master | [](http://build.ethdev.com/builders/Linux%20Go%20master%20branch/builds/-1) | [](http://build.ethdev.com/builders/OSX%20Go%20master%20branch/builds/-1) | N/A
|
||||
|
||||
[](https://waffle.io/ethereum/go-ethereum)
|
||||
[](https://waffle.io/ethereum/go-ethereum)
|
||||
[](http://waffle.io/ethereum/go-ethereum)
|
||||
[](https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
For the development package please see the [eth-go package](https://github.com/ethereum/eth-go).
|
||||
|
||||
Build
|
||||
=======
|
||||
=====
|
||||
|
||||
To build Ethereal (GUI):
|
||||
Mist (GUI):
|
||||
|
||||
`go get github.com/ethereum/go-ethereum/ethereal`
|
||||
`go get github.com/ethereum/go-ethereum/cmd/mist`
|
||||
|
||||
To build the node (CLI):
|
||||
Ethereum (CLI):
|
||||
|
||||
`go get github.com/ethereum/go-ethereum/ethereum`
|
||||
`go get github.com/ethereum/go-ethereum/cmd/ethereum`
|
||||
|
||||
For further, detailed, build instruction please see the [Wiki](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum(Go))
|
||||
|
||||
Automated (dev) builds
|
||||
======================
|
||||
|
||||
* [[OS X](http://build.ethdev.com/builds/OSX%20Go%20develop%20branch/Mist-OSX-latest.dmg)]
|
||||
* [Windows] Coming soon™
|
||||
* [Linux] Coming soon™
|
||||
|
||||
Binaries
|
||||
========
|
||||
|
||||
Go Ethereum comes with several binaries found in
|
||||
[cmd](https://github.com/ethereum/go-ethereum/tree/master/cmd):
|
||||
|
||||
* `mist` Official Ethereum Browser
|
||||
* `ethereum` Ethereum CLI
|
||||
* `ethtest` test tool which runs with the [tests](https://github.com/ethereum/testes) suit:
|
||||
`cat file | ethtest`.
|
||||
* `evm` is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas
|
||||
10000 -price 0 -dump`. See `-h` for a detailed description.
|
||||
* `rlpdump` converts a rlp stream to `interface{}`.
|
||||
* `peerserver` simple P2P (noi-ethereum) peer server.
|
||||
* `disasm` disassembles EVM code: `echo "6001" | disasm`
|
||||
|
||||
General command line options
|
||||
====================
|
||||
============================
|
||||
|
||||
```
|
||||
Shared between ethereum and ethereal
|
||||
== Shared between ethereum and Mist ==
|
||||
|
||||
= Settings
|
||||
-id Set the custom identifier of the client (shows up on other clients)
|
||||
-port Port on which the server will accept incomming connections
|
||||
-upnp Enable UPnP
|
||||
-maxpeer Desired amount of peers
|
||||
-rpc Start JSON RPC
|
||||
|
||||
-dir Data directory used to store configs and databases
|
||||
-import Import a private key
|
||||
-genaddr Generates a new address and private key (destructive action)
|
||||
-h This
|
||||
|
||||
= Utility
|
||||
-h This
|
||||
-import Import a private key
|
||||
-genaddr Generates a new address and private key (destructive action)
|
||||
-dump Dump a specific state of a block to stdout given the -number or -hash
|
||||
-difftool Supress all output and prints VM output to stdout
|
||||
-diff vm=only vm output, all=all output including state storage
|
||||
|
||||
Ethereum only
|
||||
ethereum [options] [filename]
|
||||
@ -44,31 +77,34 @@ ethereum [options] [filename]
|
||||
filename Load the given file and interpret as JavaScript
|
||||
-m Start mining blocks
|
||||
|
||||
Etheral only
|
||||
== Mist only ==
|
||||
|
||||
-asset_path absolute path to GUI assets directory
|
||||
```
|
||||
|
||||
Contribution
|
||||
============
|
||||
|
||||
If you would like to contribute to Ethereum Go, please fork, fix, commit and
|
||||
send a pull request to the main repository. Commits which do not comply with the coding standards explained below
|
||||
will be ignored. If you send a pull request, make sure that you
|
||||
commit to the `develop` branch and that you do not merge to `master`.
|
||||
Commits that are directly based off of the `master` branch instead of the `develop` branch will be ignored.
|
||||
If you'd like to contribute to Ethereum please fork, fix, commit and
|
||||
send a pull request. Commits who do not comply with the coding standards
|
||||
are ignored (use gofmt!). If you send pull requests make absolute sure that you
|
||||
commit on the `develop` branch and that you do not merge to master.
|
||||
Commits that are directly based on master are simply ignored.
|
||||
|
||||
To make this process simpler try following the [git flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model, as it sets this process up and streamlines work flow.
|
||||
To make life easier try [git flow](http://nvie.com/posts/a-successful-git-branching-model/) it sets
|
||||
this all up and streamlines your work flow.
|
||||
|
||||
Coding standards
|
||||
================
|
||||
|
||||
Code should be formatted according to the [Go Formatting
|
||||
Sources should be formatted according to the [Go Formatting
|
||||
Style](http://golang.org/doc/effective_go.html#formatting).
|
||||
|
||||
Unless struct fields are supposed to be directly accessible, provide
|
||||
getters and hide the fields through Go's exporting facility.
|
||||
Unless structs fields are supposed to be directly accesible, provide
|
||||
Getters and hide the fields through Go's exporting facility.
|
||||
|
||||
Make comments in your code meaningful and only use them when necessary. Describe in detail what your code is trying to achieve. For example, this would be redundant and unnecessary commenting:
|
||||
When you comment put meaningful comments. Describe in detail what you
|
||||
want to achieve.
|
||||
|
||||
*wrong*
|
||||
|
||||
@ -79,7 +115,13 @@ if x > y {
|
||||
}
|
||||
```
|
||||
|
||||
Everyone reading the source code should know what this code snippet was meant to achieve, and so those are **not** meaningful comments.
|
||||
Everyone reading the source probably know what you wanted to achieve
|
||||
with above code. Those are **not** meaningful comments.
|
||||
|
||||
While the project isn't 100% tested I want you to write tests non the
|
||||
less. I haven't got time to evaluate everyone's code in detail so I
|
||||
expect you to write tests for me so I don't have to test your code
|
||||
manually. (If you want to contribute by just writing tests that's fine
|
||||
too!)
|
||||
|
||||
While this project is constantly tested and run, code tests should be written regardless. There is not time to evaluate every person's code specifically, so it is expected of you to write tests for the code so that it does not have to be tested manually. In fact, contributing by simply writing tests is perfectly fine!
|
||||
|
||||
|
BIN
_data/invalid1
Executable file
BIN
_data/invalid1
Executable file
Binary file not shown.
BIN
_data/valid1
Executable file
BIN
_data/valid1
Executable file
Binary file not shown.
BIN
_data/valid2
Executable file
BIN
_data/valid2
Executable file
Binary file not shown.
BIN
_data/valid3
Executable file
BIN
_data/valid3
Executable file
Binary file not shown.
BIN
_data/valid4
Executable file
BIN
_data/valid4
Executable file
Binary file not shown.
155
accounts/abi/abi.go
Normal file
155
accounts/abi/abi.go
Normal file
@ -0,0 +1,155 @@
|
||||
package abi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
// Callable method given a `Name` and whether the method is a constant.
|
||||
// If the method is `Const` no transaction needs to be created for this
|
||||
// particular Method call. It can easily be simulated using a local VM.
|
||||
// For example a `Balance()` method only needs to retrieve something
|
||||
// from the storage and therefor requires no Tx to be send to the
|
||||
// network. A method such as `Transact` does require a Tx and thus will
|
||||
// be flagged `true`.
|
||||
// Input specifies the required input parameters for this gives method.
|
||||
type Method struct {
|
||||
Name string
|
||||
Const bool
|
||||
Input []Argument
|
||||
Return Type // not yet implemented
|
||||
}
|
||||
|
||||
// Returns the methods string signature according to the ABI spec.
|
||||
//
|
||||
// Example
|
||||
//
|
||||
// function foo(uint32 a, int b) = "foo(uint32,int256)"
|
||||
//
|
||||
// Please note that "int" is substitute for its canonical representation "int256"
|
||||
func (m Method) String() (out string) {
|
||||
out += m.Name
|
||||
types := make([]string, len(m.Input))
|
||||
i := 0
|
||||
for _, input := range m.Input {
|
||||
types[i] = input.Type.String()
|
||||
i++
|
||||
}
|
||||
out += "(" + strings.Join(types, ",") + ")"
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (m Method) Id() []byte {
|
||||
return crypto.Sha3([]byte(m.String()))[:4]
|
||||
}
|
||||
|
||||
// Argument holds the name of the argument and the corresponding type.
|
||||
// Types are used when packing and testing arguments.
|
||||
type Argument struct {
|
||||
Name string
|
||||
Type Type
|
||||
}
|
||||
|
||||
func (a *Argument) UnmarshalJSON(data []byte) error {
|
||||
var extarg struct {
|
||||
Name string
|
||||
Type string
|
||||
}
|
||||
err := json.Unmarshal(data, &extarg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("argument json err: %v", err)
|
||||
}
|
||||
|
||||
a.Type, err = NewType(extarg.Type)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a.Name = extarg.Name
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// The ABI holds information about a contract's context and available
|
||||
// invokable methods. It will allow you to type check function calls and
|
||||
// packs data accordingly.
|
||||
type ABI struct {
|
||||
Methods map[string]Method
|
||||
}
|
||||
|
||||
// tests, tests whether the given input would result in a successful
|
||||
// call. Checks argument list count and matches input to `input`.
|
||||
func (abi ABI) pack(name string, args ...interface{}) ([]byte, error) {
|
||||
method := abi.Methods[name]
|
||||
|
||||
var ret []byte
|
||||
for i, a := range args {
|
||||
input := method.Input[i]
|
||||
|
||||
packed, err := input.Type.pack(a)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("`%s` %v", name, err)
|
||||
}
|
||||
ret = append(ret, packed...)
|
||||
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// Pack the given method name to conform the ABI. Method call's data
|
||||
// will consist of method_id, args0, arg1, ... argN. Method id consists
|
||||
// of 4 bytes and arguments are all 32 bytes.
|
||||
// Method ids are created from the first 4 bytes of the hash of the
|
||||
// methods string signature. (signature = baz(uint32,string32))
|
||||
func (abi ABI) Pack(name string, args ...interface{}) ([]byte, error) {
|
||||
method, exist := abi.Methods[name]
|
||||
if !exist {
|
||||
return nil, fmt.Errorf("method '%s' not found", name)
|
||||
}
|
||||
|
||||
// start with argument count match
|
||||
if len(args) != len(method.Input) {
|
||||
return nil, fmt.Errorf("argument count mismatch: %d for %d", len(args), len(method.Input))
|
||||
}
|
||||
|
||||
arguments, err := abi.pack(name, args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Set function id
|
||||
packed := abi.Methods[name].Id()
|
||||
packed = append(packed, arguments...)
|
||||
|
||||
return packed, nil
|
||||
}
|
||||
|
||||
func (abi *ABI) UnmarshalJSON(data []byte) error {
|
||||
var methods []Method
|
||||
if err := json.Unmarshal(data, &methods); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
abi.Methods = make(map[string]Method)
|
||||
for _, method := range methods {
|
||||
abi.Methods[method.Name] = method
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func JSON(reader io.Reader) (ABI, error) {
|
||||
dec := json.NewDecoder(reader)
|
||||
|
||||
var abi ABI
|
||||
if err := dec.Decode(&abi); err != nil {
|
||||
return ABI{}, err
|
||||
}
|
||||
|
||||
return abi, nil
|
||||
}
|
330
accounts/abi/abi_test.go
Normal file
330
accounts/abi/abi_test.go
Normal file
@ -0,0 +1,330 @@
|
||||
package abi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"math/big"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
const jsondata = `
|
||||
[
|
||||
{ "name" : "balance", "const" : true },
|
||||
{ "name" : "send", "const" : false, "input" : [ { "name" : "amount", "type" : "uint256" } ] }
|
||||
]`
|
||||
|
||||
const jsondata2 = `
|
||||
[
|
||||
{ "name" : "balance", "const" : true },
|
||||
{ "name" : "send", "const" : false, "input" : [ { "name" : "amount", "type" : "uint256" } ] },
|
||||
{ "name" : "test", "const" : false, "input" : [ { "name" : "number", "type" : "uint32" } ] },
|
||||
{ "name" : "string", "const" : false, "input" : [ { "name" : "input", "type" : "string" } ] },
|
||||
{ "name" : "bool", "const" : false, "input" : [ { "name" : "input", "type" : "bool" } ] },
|
||||
{ "name" : "address", "const" : false, "input" : [ { "name" : "input", "type" : "address" } ] },
|
||||
{ "name" : "string32", "const" : false, "input" : [ { "name" : "input", "type" : "string32" } ] },
|
||||
{ "name" : "uint64[2]", "const" : false, "input" : [ { "name" : "input", "type" : "uint64[2]" } ] },
|
||||
{ "name" : "uint64[]", "const" : false, "input" : [ { "name" : "input", "type" : "uint64[]" } ] },
|
||||
{ "name" : "foo", "const" : false, "input" : [ { "name" : "input", "type" : "uint32" } ] },
|
||||
{ "name" : "bar", "const" : false, "input" : [ { "name" : "input", "type" : "uint32" }, { "name" : "string", "type" : "uint16" } ] },
|
||||
{ "name" : "slice", "const" : false, "input" : [ { "name" : "input", "type" : "uint32[2]" } ] },
|
||||
{ "name" : "slice256", "const" : false, "input" : [ { "name" : "input", "type" : "uint256[2]" } ] }
|
||||
]`
|
||||
|
||||
func TestType(t *testing.T) {
|
||||
typ, err := NewType("uint32")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if typ.Kind != reflect.Ptr {
|
||||
t.Error("expected uint32 to have kind Ptr")
|
||||
}
|
||||
|
||||
typ, err = NewType("uint32[]")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if typ.Kind != reflect.Slice {
|
||||
t.Error("expected uint32[] to have type slice")
|
||||
}
|
||||
if typ.Type != ubig_ts {
|
||||
t.Error("expcted uith32[] to have type uint64")
|
||||
}
|
||||
|
||||
typ, err = NewType("uint32[2]")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if typ.Kind != reflect.Slice {
|
||||
t.Error("expected uint32[2] to have kind slice")
|
||||
}
|
||||
if typ.Type != ubig_ts {
|
||||
t.Error("expcted uith32[2] to have type uint64")
|
||||
}
|
||||
if typ.Size != 2 {
|
||||
t.Error("expected uint32[2] to have a size of 2")
|
||||
}
|
||||
}
|
||||
|
||||
func TestReader(t *testing.T) {
|
||||
Uint256, _ := NewType("uint256")
|
||||
exp := ABI{
|
||||
Methods: map[string]Method{
|
||||
"balance": Method{
|
||||
"balance", true, nil, Type{},
|
||||
},
|
||||
"send": Method{
|
||||
"send", false, []Argument{
|
||||
Argument{"amount", Uint256},
|
||||
}, Type{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
abi, err := JSON(strings.NewReader(jsondata))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
// deep equal fails for some reason
|
||||
t.Skip()
|
||||
if !reflect.DeepEqual(abi, exp) {
|
||||
t.Errorf("\nabi: %v\ndoes not match exp: %v", abi, exp)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTestNumbers(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("balance"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("balance", 1); err == nil {
|
||||
t.Error("expected error for balance(1)")
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("doesntexist", nil); err == nil {
|
||||
t.Errorf("doesntexist shouldn't exist")
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("doesntexist", 1); err == nil {
|
||||
t.Errorf("doesntexist(1) shouldn't exist")
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("send", big.NewInt(1000)); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
i := new(int)
|
||||
*i = 1000
|
||||
if _, err := abi.Pack("send", i); err == nil {
|
||||
t.Errorf("expected send( ptr ) to throw, requires *big.Int instead of *int")
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("send", 1000); err != nil {
|
||||
t.Error("expected send(1000) to cast to big")
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("test", uint32(1000)); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTestString(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("string", "hello world"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
str10 := string(make([]byte, 10))
|
||||
if _, err := abi.Pack("string32", str10); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
str32 := string(make([]byte, 32))
|
||||
if _, err := abi.Pack("string32", str32); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
str33 := string(make([]byte, 33))
|
||||
if _, err := abi.Pack("string32", str33); err == nil {
|
||||
t.Error("expected str33 to throw out of bound error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTestBool(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("bool", true); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTestSlice(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
addr := make([]byte, 20)
|
||||
if _, err := abi.Pack("address", addr); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
addr = make([]byte, 21)
|
||||
if _, err := abi.Pack("address", addr); err == nil {
|
||||
t.Error("expected address of 21 width to throw")
|
||||
}
|
||||
|
||||
slice := make([]byte, 2)
|
||||
if _, err := abi.Pack("uint64[2]", slice); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if _, err := abi.Pack("uint64[]", slice); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTestAddress(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
addr := make([]byte, 20)
|
||||
if _, err := abi.Pack("address", addr); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMethodSignature(t *testing.T) {
|
||||
String, _ := NewType("string")
|
||||
String32, _ := NewType("string32")
|
||||
m := Method{"foo", false, []Argument{Argument{"bar", String32}, Argument{"baz", String}}, Type{}}
|
||||
exp := "foo(string32,string)"
|
||||
if m.String() != exp {
|
||||
t.Error("signature mismatch", exp, "!=", m.String())
|
||||
}
|
||||
|
||||
idexp := crypto.Sha3([]byte(exp))[:4]
|
||||
if !bytes.Equal(m.Id(), idexp) {
|
||||
t.Errorf("expected ids to match %x != %x", m.Id(), idexp)
|
||||
}
|
||||
|
||||
uintt, _ := NewType("uint")
|
||||
m = Method{"foo", false, []Argument{Argument{"bar", uintt}}, Type{}}
|
||||
exp = "foo(uint256)"
|
||||
if m.String() != exp {
|
||||
t.Error("signature mismatch", exp, "!=", m.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestPack(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
sig := crypto.Sha3([]byte("foo(uint32)"))[:4]
|
||||
sig = append(sig, make([]byte, 32)...)
|
||||
sig[35] = 10
|
||||
|
||||
packed, err := abi.Pack("foo", uint32(10))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if !bytes.Equal(packed, sig) {
|
||||
t.Errorf("expected %x got %x", sig, packed)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMultiPack(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
sig := crypto.Sha3([]byte("bar(uint32,uint16)"))[:4]
|
||||
sig = append(sig, make([]byte, 64)...)
|
||||
sig[35] = 10
|
||||
sig[67] = 11
|
||||
|
||||
packed, err := abi.Pack("bar", uint32(10), uint16(11))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if !bytes.Equal(packed, sig) {
|
||||
t.Errorf("expected %x got %x", sig, packed)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPackSlice(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
sig := crypto.Sha3([]byte("slice(uint32[2])"))[:4]
|
||||
sig = append(sig, make([]byte, 64)...)
|
||||
sig[35] = 1
|
||||
sig[67] = 2
|
||||
|
||||
packed, err := abi.Pack("slice", []uint32{1, 2})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if !bytes.Equal(packed, sig) {
|
||||
t.Errorf("expected %x got %x", sig, packed)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPackSliceBig(t *testing.T) {
|
||||
abi, err := JSON(strings.NewReader(jsondata2))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
sig := crypto.Sha3([]byte("slice256(uint256[2])"))[:4]
|
||||
sig = append(sig, make([]byte, 64)...)
|
||||
sig[35] = 1
|
||||
sig[67] = 2
|
||||
|
||||
packed, err := abi.Pack("slice256", []*big.Int{big.NewInt(1), big.NewInt(2)})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if !bytes.Equal(packed, sig) {
|
||||
t.Errorf("expected %x got %x", sig, packed)
|
||||
}
|
||||
}
|
10
accounts/abi/doc.go
Normal file
10
accounts/abi/doc.go
Normal file
@ -0,0 +1,10 @@
|
||||
// Package abi implements the Ethereum ABI (Application Binary
|
||||
// Interface).
|
||||
//
|
||||
// The Ethereum ABI is strongly typed, known at compile time
|
||||
// and static. This ABI will handle basic type casting; unsigned
|
||||
// to signed and visa versa. It does not handle slice casting such
|
||||
// as unsigned slice to signed slice. Bit size type casting is also
|
||||
// handled. ints with a bit size of 32 will be properly cast to int256,
|
||||
// etc.
|
||||
package abi
|
106
accounts/abi/numbers.go
Normal file
106
accounts/abi/numbers.go
Normal file
@ -0,0 +1,106 @@
|
||||
package abi
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"reflect"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
)
|
||||
|
||||
var big_t = reflect.TypeOf(&big.Int{})
|
||||
var ubig_t = reflect.TypeOf(&big.Int{})
|
||||
var byte_t = reflect.TypeOf(byte(0))
|
||||
var byte_ts = reflect.TypeOf([]byte(nil))
|
||||
var uint_t = reflect.TypeOf(uint(0))
|
||||
var uint8_t = reflect.TypeOf(uint8(0))
|
||||
var uint16_t = reflect.TypeOf(uint16(0))
|
||||
var uint32_t = reflect.TypeOf(uint32(0))
|
||||
var uint64_t = reflect.TypeOf(uint64(0))
|
||||
var int_t = reflect.TypeOf(int(0))
|
||||
var int8_t = reflect.TypeOf(int8(0))
|
||||
var int16_t = reflect.TypeOf(int16(0))
|
||||
var int32_t = reflect.TypeOf(int32(0))
|
||||
var int64_t = reflect.TypeOf(int64(0))
|
||||
|
||||
var uint_ts = reflect.TypeOf([]uint(nil))
|
||||
var uint8_ts = reflect.TypeOf([]uint8(nil))
|
||||
var uint16_ts = reflect.TypeOf([]uint16(nil))
|
||||
var uint32_ts = reflect.TypeOf([]uint32(nil))
|
||||
var uint64_ts = reflect.TypeOf([]uint64(nil))
|
||||
var ubig_ts = reflect.TypeOf([]*big.Int(nil))
|
||||
|
||||
var int_ts = reflect.TypeOf([]int(nil))
|
||||
var int8_ts = reflect.TypeOf([]int8(nil))
|
||||
var int16_ts = reflect.TypeOf([]int16(nil))
|
||||
var int32_ts = reflect.TypeOf([]int32(nil))
|
||||
var int64_ts = reflect.TypeOf([]int64(nil))
|
||||
var big_ts = reflect.TypeOf([]*big.Int(nil))
|
||||
|
||||
// U256 will ensure unsigned 256bit on big nums
|
||||
func U256(n *big.Int) []byte {
|
||||
return ethutil.LeftPadBytes(ethutil.U256(n).Bytes(), 32)
|
||||
}
|
||||
|
||||
func S256(n *big.Int) []byte {
|
||||
sint := ethutil.S256(n)
|
||||
ret := ethutil.LeftPadBytes(sint.Bytes(), 32)
|
||||
if sint.Cmp(ethutil.Big0) < 0 {
|
||||
for i, b := range ret {
|
||||
if b == 0 {
|
||||
ret[i] = 1
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// S256 will ensure signed 256bit on big nums
|
||||
func U2U256(n uint64) []byte {
|
||||
return U256(big.NewInt(int64(n)))
|
||||
}
|
||||
|
||||
func S2S256(n int64) []byte {
|
||||
return S256(big.NewInt(n))
|
||||
}
|
||||
|
||||
// packNum packs the given number (using the reflect value) and will cast it to appropriate number representation
|
||||
func packNum(value reflect.Value, to byte) []byte {
|
||||
switch kind := value.Kind(); kind {
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
if to == UintTy {
|
||||
return U2U256(value.Uint())
|
||||
} else {
|
||||
return S2S256(int64(value.Uint()))
|
||||
}
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
if to == UintTy {
|
||||
return U2U256(uint64(value.Int()))
|
||||
} else {
|
||||
return S2S256(value.Int())
|
||||
}
|
||||
case reflect.Ptr:
|
||||
// This only takes care of packing and casting. No type checking is done here. It should be done prior to using this function.
|
||||
if to == UintTy {
|
||||
return U256(value.Interface().(*big.Int))
|
||||
} else {
|
||||
return S256(value.Interface().(*big.Int))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// checks whether the given reflect value is signed. This also works for slices with a number type
|
||||
func isSigned(v reflect.Value) bool {
|
||||
switch v.Type() {
|
||||
case ubig_ts, big_ts, big_t, ubig_t:
|
||||
return true
|
||||
case int_ts, int8_ts, int16_ts, int32_ts, int64_ts, int_t, int8_t, int16_t, int32_t, int64_t:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
72
accounts/abi/numbers_test.go
Normal file
72
accounts/abi/numbers_test.go
Normal file
@ -0,0 +1,72 @@
|
||||
package abi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"math/big"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNumberTypes(t *testing.T) {
|
||||
ubytes := make([]byte, 32)
|
||||
ubytes[31] = 1
|
||||
sbytesmin := []byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
|
||||
|
||||
unsigned := U256(big.NewInt(1))
|
||||
if !bytes.Equal(unsigned, ubytes) {
|
||||
t.Error("expected %x got %x", ubytes, unsigned)
|
||||
}
|
||||
|
||||
signed := S256(big.NewInt(1))
|
||||
if !bytes.Equal(signed, ubytes) {
|
||||
t.Error("expected %x got %x", ubytes, unsigned)
|
||||
}
|
||||
|
||||
signed = S256(big.NewInt(-1))
|
||||
if !bytes.Equal(signed, sbytesmin) {
|
||||
t.Error("expected %x got %x", ubytes, unsigned)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPackNumber(t *testing.T) {
|
||||
ubytes := make([]byte, 32)
|
||||
ubytes[31] = 1
|
||||
sbytesmin := []byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
|
||||
maxunsigned := []byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
|
||||
|
||||
packed := packNum(reflect.ValueOf(1), IntTy)
|
||||
if !bytes.Equal(packed, ubytes) {
|
||||
t.Errorf("expected %x got %x", ubytes, packed)
|
||||
}
|
||||
packed = packNum(reflect.ValueOf(-1), IntTy)
|
||||
if !bytes.Equal(packed, sbytesmin) {
|
||||
t.Errorf("expected %x got %x", ubytes, packed)
|
||||
}
|
||||
packed = packNum(reflect.ValueOf(1), UintTy)
|
||||
if !bytes.Equal(packed, ubytes) {
|
||||
t.Errorf("expected %x got %x", ubytes, packed)
|
||||
}
|
||||
packed = packNum(reflect.ValueOf(-1), UintTy)
|
||||
if !bytes.Equal(packed, maxunsigned) {
|
||||
t.Errorf("expected %x got %x", maxunsigned, packed)
|
||||
}
|
||||
|
||||
packed = packNum(reflect.ValueOf("string"), UintTy)
|
||||
if packed != nil {
|
||||
t.Errorf("expected 'string' to pack to nil. got %x instead", packed)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSigned(t *testing.T) {
|
||||
if isSigned(reflect.ValueOf(uint(10))) {
|
||||
t.Error()
|
||||
}
|
||||
|
||||
if !isSigned(reflect.ValueOf(int(10))) {
|
||||
t.Error()
|
||||
}
|
||||
|
||||
if !isSigned(reflect.ValueOf(big.NewInt(10))) {
|
||||
t.Error()
|
||||
}
|
||||
}
|
106
accounts/abi/profile.cov
Normal file
106
accounts/abi/profile.cov
Normal file
@ -0,0 +1,106 @@
|
||||
mode: set
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:27.39,31.32 4 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:35.2,37.8 2 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:31.32,34.3 2 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:40.29,42.2 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:51.53,57.16 3 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:61.2,62.16 2 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:65.2,67.12 2 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:57.16,59.3 1 0
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:62.16,64.3 1 0
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:79.71,83.25 3 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:94.2,94.17 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:83.25,87.17 3 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:90.3,90.31 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:87.17,89.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:102.71,104.12 2 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:109.2,109.36 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:113.2,114.16 2 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:119.2,122.20 3 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:104.12,106.3 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:109.36,111.3 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:114.16,116.3 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:125.50,127.55 2 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:131.2,132.33 2 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:136.2,136.12 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:127.55,129.3 1 0
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:132.33,134.3 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:139.42,143.41 3 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:147.2,147.17 1 1
|
||||
github.com/ethereum/go-ethereum/abi/abi.go:143.41,145.3 1 0
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:39.30,41.2 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:43.30,46.32 3 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:56.2,56.12 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:46.32,47.25 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:47.25,48.14 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:52.4,52.9 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:48.14,50.13 2 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:59.30,61.2 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:63.29,65.2 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:67.51,68.36 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:91.2,91.12 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:69.2,70.19 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:75.2,76.19 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:81.2,83.19 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:70.19,72.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:72.4,74.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:76.19,78.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:78.4,80.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:83.19,85.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:85.4,87.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:94.37,95.18 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:101.2,101.14 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:96.2,97.14 1 1
|
||||
github.com/ethereum/go-ethereum/abi/numbers.go:98.2,99.14 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:32.46,35.16 2 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:38.2,43.9 3 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:55.2,56.16 2 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:60.2,64.55 4 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:69.2,69.13 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:111.2,113.8 2 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:35.16,37.3 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:44.2,47.17 2 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:48.2,50.12 2 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:51.2,52.60 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:56.16,58.3 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:64.55,67.3 2 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:69.13,72.16 3 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:73.3,74.21 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:75.3,76.22 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:77.3,78.66 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:80.3,81.16 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:82.3,86.17 4 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:87.3,91.18 4 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:92.3,93.27 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:94.3,95.30 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:96.3,100.21 4 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:101.3,104.17 3 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:107.3,108.60 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:104.17,106.5 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:116.37,118.2 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:126.51,128.36 2 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:179.2,179.20 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:129.2,130.23 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:133.3,133.34 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:134.2,135.23 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:138.3,138.34 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:139.2,142.49 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:145.3,145.34 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:146.2,147.42 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:150.3,150.60 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:151.2,152.42 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:157.3,157.23 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:162.3,162.78 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:166.3,167.36 2 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:170.3,170.21 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:171.2,172.19 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:130.23,132.4 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:135.23,137.4 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:142.49,144.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:147.42,149.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:152.42,154.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:157.23,159.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:162.78,164.4 1 0
|
||||
github.com/ethereum/go-ethereum/abi/type.go:167.36,169.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:172.19,174.4 1 1
|
||||
github.com/ethereum/go-ethereum/abi/type.go:174.4,176.4 1 0
|
190
accounts/abi/type.go
Normal file
190
accounts/abi/type.go
Normal file
@ -0,0 +1,190 @@
|
||||
package abi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
)
|
||||
|
||||
const (
|
||||
IntTy byte = iota
|
||||
UintTy
|
||||
BoolTy
|
||||
SliceTy
|
||||
AddressTy
|
||||
RealTy
|
||||
)
|
||||
|
||||
// Type is the reflection of the supported argument type
|
||||
type Type struct {
|
||||
Kind reflect.Kind
|
||||
Type reflect.Type
|
||||
Size int
|
||||
T byte // Our own type checking
|
||||
stringKind string // holds the unparsed string for deriving signatures
|
||||
}
|
||||
|
||||
// New type returns a fully parsed Type given by the input string or an error if it can't be parsed.
|
||||
//
|
||||
// Strings can be in the format of:
|
||||
//
|
||||
// Input = Type [ "[" [ Number ] "]" ] Name .
|
||||
// Type = [ "u" ] "int" [ Number ] .
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// string int uint real
|
||||
// string32 int8 uint8 uint[]
|
||||
// address int256 uint256 real[2]
|
||||
func NewType(t string) (typ Type, err error) {
|
||||
// 1. full string 2. type 3. (opt.) is slice 4. (opt.) size
|
||||
freg, err := regexp.Compile("([a-zA-Z0-9]+)(\\[([0-9]*)?\\])?")
|
||||
if err != nil {
|
||||
return Type{}, err
|
||||
}
|
||||
res := freg.FindAllStringSubmatch(t, -1)[0]
|
||||
var (
|
||||
isslice bool
|
||||
size int
|
||||
)
|
||||
switch {
|
||||
case res[3] != "":
|
||||
// err is ignored. Already checked for number through the regexp
|
||||
size, _ = strconv.Atoi(res[3])
|
||||
isslice = true
|
||||
case res[2] != "":
|
||||
isslice = true
|
||||
size = -1
|
||||
case res[0] == "":
|
||||
return Type{}, fmt.Errorf("type parse error for `%s`", t)
|
||||
}
|
||||
|
||||
treg, err := regexp.Compile("([a-zA-Z]+)([0-9]*)?")
|
||||
if err != nil {
|
||||
return Type{}, err
|
||||
}
|
||||
|
||||
parsedType := treg.FindAllStringSubmatch(res[1], -1)[0]
|
||||
vsize, _ := strconv.Atoi(parsedType[2])
|
||||
vtype := parsedType[1]
|
||||
// substitute canonical representation
|
||||
if vsize == 0 && (vtype == "int" || vtype == "uint") {
|
||||
vsize = 256
|
||||
t += "256"
|
||||
}
|
||||
|
||||
if isslice {
|
||||
typ.Kind = reflect.Slice
|
||||
typ.Size = size
|
||||
switch vtype {
|
||||
case "int":
|
||||
typ.Type = big_ts
|
||||
case "uint":
|
||||
typ.Type = ubig_ts
|
||||
default:
|
||||
return Type{}, fmt.Errorf("unsupported arg slice type: %s", t)
|
||||
}
|
||||
} else {
|
||||
switch vtype {
|
||||
case "int":
|
||||
typ.Kind = reflect.Ptr
|
||||
typ.Type = big_t
|
||||
typ.Size = 256
|
||||
typ.T = IntTy
|
||||
case "uint":
|
||||
typ.Kind = reflect.Ptr
|
||||
typ.Type = ubig_t
|
||||
typ.Size = 256
|
||||
typ.T = UintTy
|
||||
case "bool":
|
||||
typ.Kind = reflect.Bool
|
||||
case "real": // TODO
|
||||
typ.Kind = reflect.Invalid
|
||||
case "address":
|
||||
typ.Kind = reflect.Slice
|
||||
typ.Type = byte_ts
|
||||
typ.Size = 20
|
||||
typ.T = AddressTy
|
||||
case "string":
|
||||
typ.Kind = reflect.String
|
||||
typ.Size = -1
|
||||
if vsize > 0 {
|
||||
typ.Size = 32
|
||||
}
|
||||
default:
|
||||
return Type{}, fmt.Errorf("unsupported arg type: %s", t)
|
||||
}
|
||||
}
|
||||
typ.stringKind = t
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (t Type) String() (out string) {
|
||||
return t.stringKind
|
||||
}
|
||||
|
||||
// Test the given input parameter `v` and checks if it matches certain
|
||||
// criteria
|
||||
// * Big integers are checks for ptr types and if the given value is
|
||||
// assignable
|
||||
// * Integer are checked for size
|
||||
// * Strings, addresses and bytes are checks for type and size
|
||||
func (t Type) pack(v interface{}) ([]byte, error) {
|
||||
value := reflect.ValueOf(v)
|
||||
switch kind := value.Kind(); kind {
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
if t.Type != ubig_t {
|
||||
return nil, fmt.Errorf("type mismatch: %s for %T", t.Type, v)
|
||||
}
|
||||
return packNum(value, t.T), nil
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
if t.Type != ubig_t {
|
||||
return nil, fmt.Errorf("type mismatch: %s for %T", t.Type, v)
|
||||
}
|
||||
return packNum(value, t.T), nil
|
||||
case reflect.Ptr:
|
||||
// If the value is a ptr do a assign check (only used by
|
||||
// big.Int for now)
|
||||
if t.Type == ubig_t && value.Type() != ubig_t {
|
||||
return nil, fmt.Errorf("type mismatch: %s for %T", t.Type, v)
|
||||
}
|
||||
return packNum(value, t.T), nil
|
||||
case reflect.String:
|
||||
if t.Size > -1 && value.Len() > t.Size {
|
||||
return nil, fmt.Errorf("%v out of bound. %d for %d", value.Kind(), value.Len(), t.Size)
|
||||
}
|
||||
return []byte(ethutil.LeftPadString(t.String(), 32)), nil
|
||||
case reflect.Slice:
|
||||
if t.Size > -1 && value.Len() > t.Size {
|
||||
return nil, fmt.Errorf("%v out of bound. %d for %d", value.Kind(), value.Len(), t.Size)
|
||||
}
|
||||
|
||||
// Address is a special slice. The slice acts as one rather than a list of elements.
|
||||
if t.T == AddressTy {
|
||||
return ethutil.LeftPadBytes(v.([]byte), 32), nil
|
||||
}
|
||||
|
||||
// Signed / Unsigned check
|
||||
if (t.T != IntTy && isSigned(value)) || (t.T == UintTy && isSigned(value)) {
|
||||
return nil, fmt.Errorf("slice of incompatible types.")
|
||||
}
|
||||
|
||||
var packed []byte
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
packed = append(packed, packNum(value.Index(i), t.T)...)
|
||||
}
|
||||
return packed, nil
|
||||
case reflect.Bool:
|
||||
if value.Bool() {
|
||||
return ethutil.LeftPadBytes(ethutil.Big1.Bytes(), 32), nil
|
||||
} else {
|
||||
return ethutil.LeftPadBytes(ethutil.Big0.Bytes(), 32), nil
|
||||
}
|
||||
}
|
||||
|
||||
panic("unreached")
|
||||
}
|
95
accounts/account_manager.go
Normal file
95
accounts/account_manager.go
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
This file is part of go-ethereum
|
||||
|
||||
go-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
go-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @authors
|
||||
* Gustav Simonsson <gustav.simonsson@gmail.com>
|
||||
* @date 2015
|
||||
*
|
||||
*/
|
||||
/*
|
||||
|
||||
This abstracts part of a user's interaction with an account she controls.
|
||||
It's not an abstraction of core Ethereum accounts data type / logic -
|
||||
for that see the core processing code of blocks / txs.
|
||||
|
||||
Currently this is pretty much a passthrough to the KeyStore2 interface,
|
||||
and accounts persistence is derived from stored keys' addresses
|
||||
|
||||
*/
|
||||
package accounts
|
||||
|
||||
import (
|
||||
crand "crypto/rand"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
// TODO: better name for this struct?
|
||||
type Account struct {
|
||||
Address []byte
|
||||
}
|
||||
|
||||
type AccountManager struct {
|
||||
keyStore crypto.KeyStore2
|
||||
}
|
||||
|
||||
// TODO: get key by addr - modify KeyStore2 GetKey to work with addr
|
||||
|
||||
// TODO: pass through passphrase for APIs which require access to private key?
|
||||
func NewAccountManager(keyStore crypto.KeyStore2) AccountManager {
|
||||
am := &AccountManager{
|
||||
keyStore: keyStore,
|
||||
}
|
||||
return *am
|
||||
}
|
||||
|
||||
func (am *AccountManager) Sign(fromAccount *Account, keyAuth string, toSign []byte) (signature []byte, err error) {
|
||||
key, err := am.keyStore.GetKey(fromAccount.Address, keyAuth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
signature, err = crypto.Sign(toSign, key.PrivateKey)
|
||||
return signature, err
|
||||
}
|
||||
|
||||
func (am AccountManager) NewAccount(auth string) (*Account, error) {
|
||||
key, err := am.keyStore.GenerateNewKey(crand.Reader, auth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ua := &Account{
|
||||
Address: key.Address,
|
||||
}
|
||||
return ua, err
|
||||
}
|
||||
|
||||
// set of accounts == set of keys in given key store
|
||||
// TODO: do we need persistence of accounts as well?
|
||||
func (am *AccountManager) Accounts() ([]Account, error) {
|
||||
addresses, err := am.keyStore.GetKeyAddresses()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
accounts := make([]Account, len(addresses))
|
||||
|
||||
for i, addr := range addresses {
|
||||
accounts[i] = Account{
|
||||
Address: addr,
|
||||
}
|
||||
}
|
||||
return accounts, err
|
||||
}
|
18
accounts/accounts_test.go
Normal file
18
accounts/accounts_test.go
Normal file
@ -0,0 +1,18 @@
|
||||
package accounts
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAccountManager(t *testing.T) {
|
||||
ks := crypto.NewKeyStorePlain(crypto.DefaultDataDir())
|
||||
am := NewAccountManager(ks)
|
||||
pass := "" // not used but required by API
|
||||
a1, err := am.NewAccount(pass)
|
||||
toSign := crypto.GetEntropyCSPRNG(32)
|
||||
_, err = am.Sign(a1, pass, toSign)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
16
cmd/LICENSE
Normal file
16
cmd/LICENSE
Normal file
@ -0,0 +1,16 @@
|
||||
Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301 USA
|
93
cmd/bootnode/main.go
Normal file
93
cmd/bootnode/main.go
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
This file is part of go-ethereum
|
||||
|
||||
go-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
go-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Command bootnode runs a bootstrap node for the Discovery Protocol.
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"encoding/hex"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
"github.com/ethereum/go-ethereum/p2p/discover"
|
||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var (
|
||||
listenAddr = flag.String("addr", ":30301", "listen address")
|
||||
genKey = flag.String("genkey", "", "generate a node key and quit")
|
||||
nodeKeyFile = flag.String("nodekey", "", "private key filename")
|
||||
nodeKeyHex = flag.String("nodekeyhex", "", "private key as hex (for testing)")
|
||||
natdesc = flag.String("nat", "none", "port mapping mechanism (any|none|upnp|pmp|extip:<IP>)")
|
||||
|
||||
nodeKey *ecdsa.PrivateKey
|
||||
err error
|
||||
)
|
||||
flag.Parse()
|
||||
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.DebugLevel))
|
||||
|
||||
if *genKey != "" {
|
||||
writeKey(*genKey)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
natm, err := nat.Parse(*natdesc)
|
||||
if err != nil {
|
||||
log.Fatalf("-nat: %v", err)
|
||||
}
|
||||
switch {
|
||||
case *nodeKeyFile == "" && *nodeKeyHex == "":
|
||||
log.Fatal("Use -nodekey or -nodekeyhex to specify a private key")
|
||||
case *nodeKeyFile != "" && *nodeKeyHex != "":
|
||||
log.Fatal("Options -nodekey and -nodekeyhex are mutually exclusive")
|
||||
case *nodeKeyFile != "":
|
||||
if nodeKey, err = crypto.LoadECDSA(*nodeKeyFile); err != nil {
|
||||
log.Fatalf("-nodekey: %v", err)
|
||||
}
|
||||
case *nodeKeyHex != "":
|
||||
if nodeKey, err = crypto.HexToECDSA(*nodeKeyHex); err != nil {
|
||||
log.Fatalf("-nodekeyhex: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := discover.ListenUDP(nodeKey, *listenAddr, natm); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
select {}
|
||||
}
|
||||
|
||||
func writeKey(target string) {
|
||||
key, err := crypto.GenerateKey()
|
||||
if err != nil {
|
||||
log.Fatal("could not generate key: %v", err)
|
||||
}
|
||||
b := crypto.FromECDSA(key)
|
||||
if target == "-" {
|
||||
fmt.Println(hex.EncodeToString(b))
|
||||
} else {
|
||||
if err := ioutil.WriteFile(target, b, 0600); err != nil {
|
||||
log.Fatal("write error: ", err)
|
||||
}
|
||||
}
|
||||
}
|
34
cmd/disasm/main.go
Normal file
34
cmd/disasm/main.go
Normal file
@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
"github.com/ethereum/go-ethereum/vm"
|
||||
)
|
||||
|
||||
func main() {
|
||||
code, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
code = ethutil.Hex2Bytes(string(code[:len(code)-1]))
|
||||
fmt.Printf("%x\n", code)
|
||||
|
||||
for pc := uint64(0); pc < uint64(len(code)); pc++ {
|
||||
op := vm.OpCode(code[pc])
|
||||
fmt.Printf("%-5d %v", pc, op)
|
||||
|
||||
switch op {
|
||||
case vm.PUSH1, vm.PUSH2, vm.PUSH3, vm.PUSH4, vm.PUSH5, vm.PUSH6, vm.PUSH7, vm.PUSH8, vm.PUSH9, vm.PUSH10, vm.PUSH11, vm.PUSH12, vm.PUSH13, vm.PUSH14, vm.PUSH15, vm.PUSH16, vm.PUSH17, vm.PUSH18, vm.PUSH19, vm.PUSH20, vm.PUSH21, vm.PUSH22, vm.PUSH23, vm.PUSH24, vm.PUSH25, vm.PUSH26, vm.PUSH27, vm.PUSH28, vm.PUSH29, vm.PUSH30, vm.PUSH31, vm.PUSH32:
|
||||
a := uint64(op) - uint64(vm.PUSH1) + 1
|
||||
fmt.Printf(" => %x", code[pc+1:pc+1+a])
|
||||
|
||||
pc += a
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
55
cmd/ethereum/cmd.go
Normal file
55
cmd/ethereum/cmd.go
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
This file is part of go-ethereum
|
||||
|
||||
go-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
go-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @authors
|
||||
* Jeffrey Wilcke <i@jev.io>
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/ethereum/go-ethereum/cmd/ethereum/repl"
|
||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/javascript"
|
||||
)
|
||||
|
||||
func InitJsConsole(ethereum *eth.Ethereum) {
|
||||
repl := ethrepl.NewJSRepl(ethereum)
|
||||
go repl.Start()
|
||||
utils.RegisterInterrupt(func(os.Signal) {
|
||||
repl.Stop()
|
||||
})
|
||||
}
|
||||
|
||||
func ExecJsFile(ethereum *eth.Ethereum, InputFile string) {
|
||||
file, err := os.Open(InputFile)
|
||||
if err != nil {
|
||||
clilogger.Fatalln(err)
|
||||
}
|
||||
content, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
clilogger.Fatalln(err)
|
||||
}
|
||||
re := javascript.NewJSRE(ethereum)
|
||||
utils.RegisterInterrupt(func(os.Signal) {
|
||||
re.Stop()
|
||||
})
|
||||
re.Run(string(content))
|
||||
}
|
165
cmd/ethereum/flags.go
Normal file
165
cmd/ethereum/flags.go
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
This file is part of go-ethereum
|
||||
|
||||
go-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
go-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @authors
|
||||
* Jeffrey Wilcke <i@jev.io>
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||
"github.com/ethereum/go-ethereum/vm"
|
||||
)
|
||||
|
||||
var (
|
||||
Identifier string
|
||||
KeyRing string
|
||||
DiffTool bool
|
||||
DiffType string
|
||||
KeyStore string
|
||||
StartRpc bool
|
||||
StartWebSockets bool
|
||||
RpcPort int
|
||||
WsPort int
|
||||
OutboundPort string
|
||||
ShowGenesis bool
|
||||
AddPeer string
|
||||
MaxPeer int
|
||||
GenAddr bool
|
||||
BootNodes string
|
||||
NodeKey *ecdsa.PrivateKey
|
||||
NAT nat.Interface
|
||||
SecretFile string
|
||||
ExportDir string
|
||||
NonInteractive bool
|
||||
Datadir string
|
||||
LogFile string
|
||||
ConfigFile string
|
||||
DebugFile string
|
||||
LogLevel int
|
||||
LogFormat string
|
||||
Dump bool
|
||||
DumpHash string
|
||||
DumpNumber int
|
||||
VmType int
|
||||
ImportChain string
|
||||
SHH bool
|
||||
Dial bool
|
||||
PrintVersion bool
|
||||
)
|
||||
|
||||
// flags specific to cli client
|
||||
var (
|
||||
StartMining bool
|
||||
StartJsConsole bool
|
||||
InputFile string
|
||||
)
|
||||
|
||||
func defaultDataDir() string {
|
||||
usr, _ := user.Current()
|
||||
return path.Join(usr.HomeDir, ".ethereum")
|
||||
}
|
||||
|
||||
var defaultConfigFile = path.Join(defaultDataDir(), "conf.ini")
|
||||
|
||||
func Init() {
|
||||
// TODO: move common flag processing to cmd/util
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "%s [options] [filename]:\noptions precedence: default < config file < environment variables < command line\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
flag.IntVar(&VmType, "vm", 0, "Virtual Machine type: 0-1: standard, debug")
|
||||
flag.StringVar(&Identifier, "id", "", "Custom client identifier")
|
||||
flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use")
|
||||
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)")
|
||||
|
||||
flag.IntVar(&RpcPort, "rpcport", 8545, "port to start json-rpc server on")
|
||||
flag.IntVar(&WsPort, "wsport", 40404, "port to start websocket rpc server on")
|
||||
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
|
||||
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
|
||||
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
||||
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
||||
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
||||
flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given")
|
||||
flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)")
|
||||
flag.StringVar(&Datadir, "datadir", defaultDataDir(), "specifies the datadir to use")
|
||||
flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file")
|
||||
flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)")
|
||||
flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)")
|
||||
flag.StringVar(&LogFormat, "logformat", "std", "logformat: std,raw)")
|
||||
flag.BoolVar(&DiffTool, "difftool", false, "creates output for diff'ing. Sets LogLevel=0")
|
||||
flag.StringVar(&DiffType, "diff", "all", "sets the level of diff output [vm, all]. Has no effect if difftool=false")
|
||||
flag.BoolVar(&ShowGenesis, "genesis", false, "Dump the genesis block")
|
||||
flag.StringVar(&ImportChain, "chain", "", "Imports given chain")
|
||||
|
||||
flag.BoolVar(&Dump, "dump", false, "output the ethereum state in JSON format. Sub args [number, hash]")
|
||||
flag.StringVar(&DumpHash, "hash", "", "specify arg in hex")
|
||||
flag.IntVar(&DumpNumber, "number", -1, "specify arg in number")
|
||||
|
||||
flag.BoolVar(&StartMining, "mine", false, "start dagger mining")
|
||||
flag.BoolVar(&StartJsConsole, "js", false, "launches javascript console")
|
||||
flag.BoolVar(&PrintVersion, "version", false, "prints version number")
|
||||
|
||||
// Network stuff
|
||||
var (
|
||||
nodeKeyFile = flag.String("nodekey", "", "network private key file")
|
||||
nodeKeyHex = flag.String("nodekeyhex", "", "network private key (for testing)")
|
||||
natstr = flag.String("nat", "any", "port mapping mechanism (any|none|upnp|pmp|extip:<IP>)")
|
||||
)
|
||||
flag.BoolVar(&Dial, "dial", true, "dial out connections (default on)")
|
||||
flag.BoolVar(&SHH, "shh", true, "run whisper protocol (default on)")
|
||||
flag.StringVar(&OutboundPort, "port", "30303", "listening port")
|
||||
|
||||
flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap")
|
||||
flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
var err error
|
||||
if NAT, err = nat.Parse(*natstr); err != nil {
|
||||
log.Fatalf("-nat: %v", err)
|
||||
}
|
||||
switch {
|
||||
case *nodeKeyFile != "" && *nodeKeyHex != "":
|
||||
log.Fatal("Options -nodekey and -nodekeyhex are mutually exclusive")
|
||||
case *nodeKeyFile != "":
|
||||
if NodeKey, err = crypto.LoadECDSA(*nodeKeyFile); err != nil {
|
||||
log.Fatalf("-nodekey: %v", err)
|
||||
}
|
||||
case *nodeKeyHex != "":
|
||||
if NodeKey, err = crypto.HexToECDSA(*nodeKeyHex); err != nil {
|
||||
log.Fatalf("-nodekeyhex: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if VmType >= int(vm.MaxVmTy) {
|
||||
log.Fatal("Invalid VM type ", VmType)
|
||||
}
|
||||
|
||||
InputFile = flag.Arg(0)
|
||||
}
|
156
cmd/ethereum/main.go
Normal file
156
cmd/ethereum/main.go
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
This file is part of go-ethereum
|
||||
|
||||
go-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
go-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @authors
|
||||
* Jeffrey Wilcke <i@jev.io>
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
"github.com/ethereum/go-ethereum/p2p"
|
||||
"github.com/ethereum/go-ethereum/state"
|
||||
)
|
||||
|
||||
const (
|
||||
ClientIdentifier = "Ethereum(G)"
|
||||
Version = "0.8.2"
|
||||
)
|
||||
|
||||
var clilogger = logger.NewLogger("CLI")
|
||||
|
||||
func main() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
||||
defer func() {
|
||||
logger.Flush()
|
||||
}()
|
||||
|
||||
utils.HandleInterrupt()
|
||||
|
||||
// precedence: code-internal flag default < config file < environment variables < command line
|
||||
Init() // parsing command line
|
||||
|
||||
if PrintVersion {
|
||||
printVersion()
|
||||
return
|
||||
}
|
||||
|
||||
utils.InitConfig(VmType, ConfigFile, Datadir, "ETH")
|
||||
|
||||
ethereum, err := eth.New(ð.Config{
|
||||
Name: p2p.MakeName(ClientIdentifier, Version),
|
||||
KeyStore: KeyStore,
|
||||
DataDir: Datadir,
|
||||
LogFile: LogFile,
|
||||
LogLevel: LogLevel,
|
||||
MaxPeers: MaxPeer,
|
||||
Port: OutboundPort,
|
||||
NAT: NAT,
|
||||
KeyRing: KeyRing,
|
||||
Shh: SHH,
|
||||
Dial: Dial,
|
||||
BootNodes: BootNodes,
|
||||
NodeKey: NodeKey,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
clilogger.Fatalln(err)
|
||||
}
|
||||
|
||||
utils.KeyTasks(ethereum.KeyManager(), KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive)
|
||||
|
||||
if Dump {
|
||||
var block *types.Block
|
||||
|
||||
if len(DumpHash) == 0 && DumpNumber == -1 {
|
||||
block = ethereum.ChainManager().CurrentBlock()
|
||||
} else if len(DumpHash) > 0 {
|
||||
block = ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(DumpHash))
|
||||
} else {
|
||||
block = ethereum.ChainManager().GetBlockByNumber(uint64(DumpNumber))
|
||||
}
|
||||
|
||||
if block == nil {
|
||||
fmt.Fprintln(os.Stderr, "block not found")
|
||||
|
||||
// We want to output valid JSON
|
||||
fmt.Println("{}")
|
||||
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Leave the Println. This needs clean output for piping
|
||||
statedb := state.New(block.Root(), ethereum.Db())
|
||||
fmt.Printf("%s\n", statedb.Dump())
|
||||
|
||||
fmt.Println(block)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if StartMining {
|
||||
utils.StartMining(ethereum)
|
||||
}
|
||||
|
||||
if len(ImportChain) > 0 {
|
||||
start := time.Now()
|
||||
err := utils.ImportChain(ethereum, ImportChain)
|
||||
if err != nil {
|
||||
clilogger.Infoln(err)
|
||||
}
|
||||
clilogger.Infoln("import done in", time.Since(start))
|
||||
return
|
||||
}
|
||||
|
||||
if StartRpc {
|
||||
utils.StartRpc(ethereum, RpcPort)
|
||||
}
|
||||
|
||||
if StartWebSockets {
|
||||
utils.StartWebSockets(ethereum, WsPort)
|
||||
}
|
||||
|
||||
utils.StartEthereum(ethereum)
|
||||
|
||||
if StartJsConsole {
|
||||
InitJsConsole(ethereum)
|
||||
} else if len(InputFile) > 0 {
|
||||
ExecJsFile(ethereum, InputFile)
|
||||
}
|
||||
// this blocks the thread
|
||||
ethereum.WaitForShutdown()
|
||||
}
|
||||
|
||||
func printVersion() {
|
||||
fmt.Printf(`%v %v
|
||||
PV=%d
|
||||
GOOS=%s
|
||||
GO=%s
|
||||
GOPATH=%s
|
||||
GOROOT=%s
|
||||
`, ClientIdentifier, Version, eth.ProtocolVersion, runtime.GOOS, runtime.Version(), os.Getenv("GOPATH"), runtime.GOROOT())
|
||||
}
|
97
cmd/ethereum/repl/console_colors_windows.go
Normal file
97
cmd/ethereum/repl/console_colors_windows.go
Normal file
@ -0,0 +1,97 @@
|
||||
// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301 USA
|
||||
|
||||
/* Inspired by https://github.com/xuyu/logging/blob/master/colorful_win.go */
|
||||
|
||||
package ethrepl
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type color uint16
|
||||
|
||||
const (
|
||||
green = color(0x0002)
|
||||
red = color(0x0004)
|
||||
yellow = color(0x000E)
|
||||
)
|
||||
|
||||
const (
|
||||
mask = uint16(yellow | green | red)
|
||||
)
|
||||
|
||||
var (
|
||||
kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||
procGetStdHandle = kernel32.NewProc("GetStdHandle")
|
||||
procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute")
|
||||
procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
|
||||
hStdout uintptr
|
||||
initScreenInfo *consoleScreenBufferInfo
|
||||
)
|
||||
|
||||
func setConsoleTextAttribute(hConsoleOutput uintptr, wAttributes uint16) bool {
|
||||
ret, _, _ := procSetConsoleTextAttribute.Call(hConsoleOutput, uintptr(wAttributes))
|
||||
return ret != 0
|
||||
}
|
||||
|
||||
type coord struct {
|
||||
X, Y int16
|
||||
}
|
||||
|
||||
type smallRect struct {
|
||||
Left, Top, Right, Bottom int16
|
||||
}
|
||||
|
||||
type consoleScreenBufferInfo struct {
|
||||
DwSize coord
|
||||
DwCursorPosition coord
|
||||
WAttributes uint16
|
||||
SrWindow smallRect
|
||||
DwMaximumWindowSize coord
|
||||
}
|
||||
|
||||
func getConsoleScreenBufferInfo(hConsoleOutput uintptr) *consoleScreenBufferInfo {
|
||||
var csbi consoleScreenBufferInfo
|
||||
ret, _, _ := procGetConsoleScreenBufferInfo.Call(hConsoleOutput, uintptr(unsafe.Pointer(&csbi)))
|
||||
if ret == 0 {
|
||||
return nil
|
||||
}
|
||||
return &csbi
|
||||
}
|
||||
|
||||
const (
|
||||
stdOutputHandle = uint32(-11 & 0xFFFFFFFF)
|
||||
)
|
||||
|
||||
func init() {
|
||||
hStdout, _, _ = procGetStdHandle.Call(uintptr(stdOutputHandle))
|
||||
initScreenInfo = getConsoleScreenBufferInfo(hStdout)
|
||||
}
|
||||
|
||||
func resetColorful() {
|
||||
if initScreenInfo == nil {
|
||||
return
|
||||
}
|
||||
setConsoleTextAttribute(hStdout, initScreenInfo.WAttributes)
|
||||
}
|
||||
|
||||
func changeColor(c color) {
|
||||
attr := uint16(0) & ^mask | uint16(c)
|
||||
setConsoleTextAttribute(hStdout, attr)
|
||||
}
|
102
cmd/ethereum/repl/repl.go
Normal file
102
cmd/ethereum/repl/repl.go
Normal file
@ -0,0 +1,102 @@
|
||||
// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301 USA
|
||||
|
||||
package ethrepl
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
"github.com/ethereum/go-ethereum/javascript"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
)
|
||||
|
||||
var repllogger = logger.NewLogger("REPL")
|
||||
|
||||
type Repl interface {
|
||||
Start()
|
||||
Stop()
|
||||
}
|
||||
|
||||
type JSRepl struct {
|
||||
re *javascript.JSRE
|
||||
|
||||
prompt string
|
||||
|
||||
history *os.File
|
||||
|
||||
running bool
|
||||
}
|
||||
|
||||
func NewJSRepl(ethereum *eth.Ethereum) *JSRepl {
|
||||
hist, err := os.OpenFile(path.Join(ethutil.Config.ExecPath, "history"), os.O_RDWR|os.O_CREATE, os.ModePerm)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &JSRepl{re: javascript.NewJSRE(ethereum), prompt: "> ", history: hist}
|
||||
}
|
||||
|
||||
func (self *JSRepl) Start() {
|
||||
if !self.running {
|
||||
self.running = true
|
||||
repllogger.Infoln("init JS Console")
|
||||
reader := bufio.NewReader(self.history)
|
||||
for {
|
||||
line, err := reader.ReadString('\n')
|
||||
if err != nil && err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
fmt.Println("error reading history", err)
|
||||
break
|
||||
}
|
||||
|
||||
addHistory(line[:len(line)-1])
|
||||
}
|
||||
self.read()
|
||||
}
|
||||
}
|
||||
|
||||
func (self *JSRepl) Stop() {
|
||||
if self.running {
|
||||
self.running = false
|
||||
self.re.Stop()
|
||||
repllogger.Infoln("exit JS Console")
|
||||
self.history.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func (self *JSRepl) parseInput(code string) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Println("[native] error", r)
|
||||
}
|
||||
}()
|
||||
|
||||
value, err := self.re.Run(code)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
self.PrintValue(value)
|
||||
}
|
@ -1,3 +1,20 @@
|
||||
// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301 USA
|
||||
|
||||
package ethrepl
|
||||
|
||||
// #cgo darwin CFLAGS: -I/usr/local/opt/readline/include
|
||||
@ -9,6 +26,7 @@ package ethrepl
|
||||
// #include <readline/history.h>
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
@ -115,9 +133,12 @@ L:
|
||||
}
|
||||
|
||||
func (self *JSRepl) PrintValue(v interface{}) {
|
||||
method, _ := self.re.vm.Get("prettyPrint")
|
||||
v, err := self.re.vm.ToValue(v)
|
||||
method, _ := self.re.Vm.Get("prettyPrint")
|
||||
v, err := self.re.Vm.ToValue(v)
|
||||
if err == nil {
|
||||
method.Call(method, v)
|
||||
val, err := method.Call(method, v)
|
||||
if err == nil {
|
||||
fmt.Printf("%v", val)
|
||||
}
|
||||
}
|
||||
}
|
92
cmd/ethereum/repl/repl_windows.go
Normal file
92
cmd/ethereum/repl/repl_windows.go
Normal file
@ -0,0 +1,92 @@
|
||||
// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
// MA 02110-1301 USA
|
||||
|
||||
package ethrepl
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (self *JSRepl) read() {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
for {
|
||||
fmt.Printf(self.prompt)
|
||||
str, _, err := reader.ReadLine()
|
||||
if err != nil {
|
||||
fmt.Println("Error reading input", err)
|
||||
} else {
|
||||
if string(str) == "exit" {
|
||||
self.Stop()
|
||||
break
|
||||
} else {
|
||||
self.parseInput(string(str))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func addHistory(s string) {
|
||||
}
|
||||
|
||||
func printColored(outputVal string) {
|
||||
for outputVal != "" {
|
||||
codePart := ""
|
||||
if strings.HasPrefix(outputVal, "\033[32m") {
|
||||
codePart = "\033[32m"
|
||||
changeColor(2)
|
||||
}
|
||||
if strings.HasPrefix(outputVal, "\033[1m\033[30m") {
|
||||
codePart = "\033[1m\033[30m"
|
||||
changeColor(8)
|
||||
}
|
||||
if strings.HasPrefix(outputVal, "\033[31m") {
|
||||
codePart = "\033[31m"
|
||||
changeColor(red)
|
||||
}
|
||||
if strings.HasPrefix(outputVal, "\033[35m") {
|
||||
codePart = "\033[35m"
|
||||
changeColor(5)
|
||||
}
|
||||
if strings.HasPrefix(outputVal, "\033[0m") {
|
||||
codePart = "\033[0m"
|
||||
resetColorful()
|
||||
}
|
||||
textPart := outputVal[len(codePart):len(outputVal)]
|
||||
index := strings.Index(textPart, "\033")
|
||||
if index == -1 {
|
||||
outputVal = ""
|
||||
} else {
|
||||
outputVal = textPart[index:len(textPart)]
|
||||
textPart = textPart[0:index]
|
||||
}
|
||||
fmt.Printf("%v", textPart)
|
||||
}
|
||||
}
|
||||
|
||||
func (self *JSRepl) PrintValue(v interface{}) {
|
||||
method, _ := self.re.Vm.Get("prettyPrint")
|
||||
v, err := self.re.Vm.ToValue(v)
|
||||
if err == nil {
|
||||
val, err := method.Call(method, v)
|
||||
if err == nil {
|
||||
printColored(fmt.Sprintf("%v", val))
|
||||
}
|
||||
}
|
||||
}
|
5
cmd/ethtest/.bowerrc
Normal file
5
cmd/ethtest/.bowerrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"directory": "example/js/",
|
||||
"cwd": "./",
|
||||
"analytics": false
|
||||
}
|
12
cmd/ethtest/.editorconfig
Normal file
12
cmd/ethtest/.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
18
cmd/ethtest/.gitignore
vendored
Normal file
18
cmd/ethtest/.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
#
|
||||
# If you find yourself ignoring temporary files generated by your text editor
|
||||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile ~/.gitignore_global
|
||||
|
||||
*.swp
|
||||
/tmp
|
||||
*/**/*un~
|
||||
*un~
|
||||
.DS_Store
|
||||
*/**/.DS_Store
|
||||
ethereum/ethereum
|
||||
ethereal/ethereal
|
||||
example/js
|
||||
node_modules
|
||||
bower_components
|
||||
npm-debug.log
|
50
cmd/ethtest/.jshintrc
Normal file
50
cmd/ethtest/.jshintrc
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"predef": [
|
||||
"console",
|
||||
"require",
|
||||
"equal",
|
||||
"test",
|
||||
"testBoth",
|
||||
"testWithDefault",
|
||||
"raises",
|
||||
"deepEqual",
|
||||
"start",
|
||||
"stop",
|
||||
"ok",
|
||||
"strictEqual",
|
||||
"module",
|
||||
"expect",
|
||||
"reject",
|
||||
"impl"
|
||||
],
|
||||
|
||||
"esnext": true,
|
||||
"proto": true,
|
||||
"node" : true,
|
||||
"browser" : true,
|
||||
"browserify" : true,
|
||||
|
||||
"boss" : true,
|
||||
"curly": false,
|
||||
"debug": true,
|
||||
"devel": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"shadow": true,
|
||||
"eqnull": true
|
||||
}
|
9
cmd/ethtest/.npmignore
Normal file
9
cmd/ethtest/.npmignore
Normal file
@ -0,0 +1,9 @@
|
||||
example/js
|
||||
node_modules
|
||||
test
|
||||
.gitignore
|
||||
.editorconfig
|
||||
.travis.yml
|
||||
.npmignore
|
||||
component.json
|
||||
testling.html
|
11
cmd/ethtest/.travis.yml
Normal file
11
cmd/ethtest/.travis.yml
Normal file
@ -0,0 +1,11 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
before_script:
|
||||
- npm install
|
||||
- npm install jshint
|
||||
script:
|
||||
- "jshint *.js lib"
|
||||
after_script:
|
||||
- npm run-script gulp
|
138
cmd/ethtest/main.go
Normal file
138
cmd/ethtest/main.go
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
This file is part of go-ethereum
|
||||
|
||||
go-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
go-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @authors:
|
||||
* Jeffrey Wilcke <i@jev.io>
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
"github.com/ethereum/go-ethereum/state"
|
||||
"github.com/ethereum/go-ethereum/tests/helper"
|
||||
)
|
||||
|
||||
type Account struct {
|
||||
Balance string
|
||||
Code string
|
||||
Nonce string
|
||||
Storage map[string]string
|
||||
}
|
||||
|
||||
func StateObjectFromAccount(db ethutil.Database, addr string, account Account) *state.StateObject {
|
||||
obj := state.NewStateObject(ethutil.Hex2Bytes(addr), db)
|
||||
obj.SetBalance(ethutil.Big(account.Balance))
|
||||
|
||||
if ethutil.IsHex(account.Code) {
|
||||
account.Code = account.Code[2:]
|
||||
}
|
||||
obj.Code = ethutil.Hex2Bytes(account.Code)
|
||||
obj.Nonce = ethutil.Big(account.Nonce).Uint64()
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
type VmTest struct {
|
||||
Callcreates interface{}
|
||||
Env map[string]string
|
||||
Exec map[string]string
|
||||
Gas string
|
||||
Out string
|
||||
Post map[string]Account
|
||||
Pre map[string]Account
|
||||
}
|
||||
|
||||
func RunVmTest(r io.Reader) (failed int) {
|
||||
tests := make(map[string]VmTest)
|
||||
|
||||
data, _ := ioutil.ReadAll(r)
|
||||
err := json.Unmarshal(data, &tests)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
for name, test := range tests {
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
state := state.New(nil, db)
|
||||
for addr, account := range test.Pre {
|
||||
obj := StateObjectFromAccount(db, addr, account)
|
||||
state.SetStateObject(obj)
|
||||
}
|
||||
|
||||
ret, _, gas, err := helper.RunVm(state, test.Env, test.Exec)
|
||||
// When an error is returned it doesn't always mean the tests fails.
|
||||
// Have to come up with some conditional failing mechanism.
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
rexp := helper.FromHex(test.Out)
|
||||
if bytes.Compare(rexp, ret) != 0 {
|
||||
log.Printf("%s's return failed. Expected %x, got %x\n", name, rexp, ret)
|
||||
failed = 1
|
||||
}
|
||||
|
||||
if len(test.Gas) == 0 && err == nil {
|
||||
log.Printf("0 gas indicates error but no error given by VM")
|
||||
failed = 1
|
||||
} else {
|
||||
gexp := ethutil.Big(test.Gas)
|
||||
if gexp.Cmp(gas) != 0 {
|
||||
log.Printf("%s's gas failed. Expected %v, got %v\n", name, gexp, gas)
|
||||
failed = 1
|
||||
}
|
||||
}
|
||||
|
||||
for addr, account := range test.Post {
|
||||
obj := state.GetStateObject(helper.FromHex(addr))
|
||||
for addr, value := range account.Storage {
|
||||
v := obj.GetState(helper.FromHex(addr)).Bytes()
|
||||
vexp := helper.FromHex(value)
|
||||
|
||||
if bytes.Compare(v, vexp) != 0 {
|
||||
log.Printf("%s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, ethutil.BigD(vexp), ethutil.BigD(v))
|
||||
failed = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.Flush()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func main() {
|
||||
helper.Logger.SetLogLevel(5)
|
||||
|
||||
if len(os.Args) > 1 {
|
||||
os.Exit(RunVmTest(strings.NewReader(os.Args[1])))
|
||||
} else {
|
||||
os.Exit(RunVmTest(os.Stdin))
|
||||
}
|
||||
}
|
1
cmd/evm/code.txt
Normal file
1
cmd/evm/code.txt
Normal file
@ -0,0 +1 @@
|
||||
60006102ff5360003560001a60008114156103395760013560405260216040516020025990590160009052606052604051602002816060513760405160200281019050506002604051121561005957604051602002606051f35b604051602002599059016000905260a052600060c052604051602002599059016000905260e0526000610100526001610120525b604051610120511215610109576060515161012051602002606051015112156100d8576101205160200260605101516101005160200260e051015260016101005101610100526100f9565b61012051602002606051015160c05160200260a0510152600160c0510160c0525b600161012051016101205261008d565b60216020599059016000905260c051808252806020028301925050602082015990590160009052600081538151600182015260218101825160200260a0518260005b8381101561016657808301518186015260208101905061014b565b50505050825160200281019050604059905901600090526102405281610240515283602061024051015261024051905090509050905060c05160200280599059016000905281816020850151855160003060195a03f1508090509050905060a05260216020599059016000905261010051808252806020028301925050602082015990590160009052600081538151600182015260218101825160200260e0518260005b8381101561022557808301518186015260208101905061020a565b50505050825160200281019050604059905901600090526102c052816102c051528360206102c05101526102c05190509050905090506101005160200280599059016000905281816020850151855160003060195a03f1508090509050905060e05260405160200259905901600090526102e0526000610120525b610100516101205112156102d7576101205160200260e0510151610120516020026102e051015260016101205101610120526102a0565b60605151610100516020026102e05101526000610120525b60c05161012051121561032d576101205160200260a05101516101205160016101005101016020026102e051015260016101205101610120526102ef565b6040516020026102e051f35b50
|
1
cmd/evm/input.txt
Normal file
1
cmd/evm/input.txt
Normal file
File diff suppressed because one or more lines are too long
166
cmd/evm/main.go
Normal file
166
cmd/evm/main.go
Normal file
@ -0,0 +1,166 @@
|
||||
/*
|
||||
This file is part of go-ethereum
|
||||
|
||||
go-ethereum is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
go-ethereum is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* @authors
|
||||
* Jeffrey Wilcke <i@jev.io>
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/big"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/ethutil"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
"github.com/ethereum/go-ethereum/state"
|
||||
"github.com/ethereum/go-ethereum/vm"
|
||||
)
|
||||
|
||||
var (
|
||||
code = flag.String("code", "", "evm code")
|
||||
loglevel = flag.Int("log", 4, "log level")
|
||||
gas = flag.String("gas", "1000000000", "gas amount")
|
||||
price = flag.String("price", "0", "gas price")
|
||||
value = flag.String("value", "0", "tx value")
|
||||
dump = flag.Bool("dump", false, "dump state after run")
|
||||
data = flag.String("data", "", "data")
|
||||
)
|
||||
|
||||
func perr(v ...interface{}) {
|
||||
fmt.Println(v...)
|
||||
//os.Exit(1)
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.LogLevel(*loglevel)))
|
||||
|
||||
ethutil.ReadConfig("/tmp/evmtest", "/tmp/evm", "")
|
||||
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
statedb := state.New(nil, db)
|
||||
sender := statedb.NewStateObject([]byte("sender"))
|
||||
receiver := statedb.NewStateObject([]byte("receiver"))
|
||||
//receiver.SetCode([]byte(*code))
|
||||
receiver.SetCode(ethutil.Hex2Bytes(*code))
|
||||
|
||||
vmenv := NewEnv(statedb, []byte("evmuser"), ethutil.Big(*value))
|
||||
|
||||
tstart := time.Now()
|
||||
|
||||
ret, e := vmenv.Call(sender, receiver.Address(), ethutil.Hex2Bytes(*data), ethutil.Big(*gas), ethutil.Big(*price), ethutil.Big(*value))
|
||||
|
||||
logger.Flush()
|
||||
if e != nil {
|
||||
perr(e)
|
||||
}
|
||||
|
||||
if *dump {
|
||||
fmt.Println(string(statedb.Dump()))
|
||||
}
|
||||
|
||||
var mem runtime.MemStats
|
||||
runtime.ReadMemStats(&mem)
|
||||
fmt.Printf("vm took %v\n", time.Since(tstart))
|
||||
fmt.Printf(`alloc: %d
|
||||
tot alloc: %d
|
||||
no. malloc: %d
|
||||
heap alloc: %d
|
||||
heap objs: %d
|
||||
num gc: %d
|
||||
`, mem.Alloc, mem.TotalAlloc, mem.Mallocs, mem.HeapAlloc, mem.HeapObjects, mem.NumGC)
|
||||
|
||||
fmt.Printf("%x\n", ret)
|
||||
}
|
||||
|
||||
type VMEnv struct {
|
||||
state *state.StateDB
|
||||
block *types.Block
|
||||
|
||||
transactor []byte
|
||||
value *big.Int
|
||||
|
||||
depth int
|
||||
Gas *big.Int
|
||||
time int64
|
||||
}
|
||||
|
||||
func NewEnv(state *state.StateDB, transactor []byte, value *big.Int) *VMEnv {
|
||||
return &VMEnv{
|
||||
state: state,
|
||||
transactor: transactor,
|
||||
value: value,
|
||||
time: time.Now().Unix(),
|
||||
}
|
||||
}
|
||||
|
||||
func (self *VMEnv) State() *state.StateDB { return self.state }
|
||||
func (self *VMEnv) Origin() []byte { return self.transactor }
|
||||
func (self *VMEnv) BlockNumber() *big.Int { return ethutil.Big0 }
|
||||
func (self *VMEnv) PrevHash() []byte { return make([]byte, 32) }
|
||||
func (self *VMEnv) Coinbase() []byte { return self.transactor }
|
||||
func (self *VMEnv) Time() int64 { return self.time }
|
||||
func (self *VMEnv) Difficulty() *big.Int { return ethutil.Big1 }
|
||||
func (self *VMEnv) BlockHash() []byte { return make([]byte, 32) }
|
||||
func (self *VMEnv) Value() *big.Int { return self.value }
|
||||
func (self *VMEnv) GasLimit() *big.Int { return big.NewInt(1000000000) }
|
||||
func (self *VMEnv) VmType() vm.Type { return vm.StdVmTy }
|
||||
func (self *VMEnv) Depth() int { return 0 }
|
||||
func (self *VMEnv) SetDepth(i int) { self.depth = i }
|
||||
func (self *VMEnv) GetHash(n uint64) []byte {
|
||||
if self.block.Number().Cmp(big.NewInt(int64(n))) == 0 {
|
||||
return self.block.Hash()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (self *VMEnv) AddLog(log state.Log) {
|
||||
self.state.AddLog(log)
|
||||
}
|
||||
func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
|
||||
return vm.Transfer(from, to, amount)
|
||||
}
|
||||
|
||||
func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution {
|
||||
return core.NewExecution(self, addr, data, gas, price, value)
|
||||
}
|
||||
|
||||
func (self *VMEnv) Call(caller vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) {
|
||||
exe := self.vm(addr, data, gas, price, value)
|
||||
ret, err := exe.Call(addr, caller)
|
||||
self.Gas = exe.Gas
|
||||
|
||||
return ret, err
|
||||
}
|
||||
func (self *VMEnv) CallCode(caller vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) {
|
||||
exe := self.vm(caller.Address(), data, gas, price, value)
|
||||
return exe.Call(addr, caller)
|
||||
}
|
||||
|
||||
func (self *VMEnv) Create(caller vm.ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ContextRef) {
|
||||
exe := self.vm(addr, data, gas, price, value)
|
||||
return exe.Create(caller)
|
||||
}
|
BIN
cmd/mist/assets/back.png
Normal file
BIN
cmd/mist/assets/back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1004 B |
BIN
cmd/mist/assets/backButton.png
Normal file
BIN
cmd/mist/assets/backButton.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 663 B |
BIN
cmd/mist/assets/backButton@2x.png
Normal file
BIN
cmd/mist/assets/backButton@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
cmd/mist/assets/browser.png
Normal file
BIN
cmd/mist/assets/browser.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
cmd/mist/assets/bug.png
Normal file
BIN
cmd/mist/assets/bug.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
cmd/mist/assets/close.png
Normal file
BIN
cmd/mist/assets/close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 905 B |
436
cmd/mist/assets/debugger/debugger.qml
Normal file
436
cmd/mist/assets/debugger/debugger.qml
Normal file
@ -0,0 +1,436 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0;
|
||||
import QtQuick.Layouts 1.0;
|
||||
import QtQuick.Dialogs 1.0;
|
||||
import QtQuick.Window 2.1;
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import Ethereum 1.0
|
||||
|
||||
ApplicationWindow {
|
||||
id: win
|
||||
visible: false
|
||||
title: "IceCREAM"
|
||||
minimumWidth: 1280
|
||||
minimumHeight: 700
|
||||
width: 1290
|
||||
height: 750
|
||||
|
||||
property alias codeText: codeEditor.text
|
||||
property alias dataText: rawDataField.text
|
||||
|
||||
onClosing: {
|
||||
//dbg.Stop()
|
||||
}
|
||||
|
||||
menuBar: MenuBar {
|
||||
Menu {
|
||||
title: "Edit"
|
||||
MenuItem {
|
||||
text: "Focus code"
|
||||
shortcut: "Ctrl+1"
|
||||
onTriggered: {
|
||||
codeEditor.focus = true
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: "Focus data"
|
||||
shortcut: "Ctrl+2"
|
||||
onTriggered: {
|
||||
rawDataField.focus = true
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Command"
|
||||
shortcut: "Ctrl+l"
|
||||
onTriggered: {
|
||||
dbgCommand.focus = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
title: "Debugger"
|
||||
MenuItem {
|
||||
text: "Run"
|
||||
shortcut: "Ctrl+r"
|
||||
onTriggered: debugCurrent()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Stop"
|
||||
onTriggered: dbp.stop()
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
text: "Next"
|
||||
shortcut: "Ctrl+n"
|
||||
onTriggered: dbg.next()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Continue"
|
||||
shortcut: "Ctrl+g"
|
||||
onTriggered: dbg.continue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SplitView {
|
||||
anchors.fill: parent
|
||||
property var asmModel: ListModel {
|
||||
id: asmModel
|
||||
}
|
||||
|
||||
TableView {
|
||||
id: asmTableView
|
||||
width: 200
|
||||
headerVisible: false
|
||||
TableViewColumn{ role: "value" ; title: "" ; width: asmTableView.width - 2 }
|
||||
model: asmModel
|
||||
/*
|
||||
alternatingRowColors: false
|
||||
itemDelegate: Item {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "#DDD"
|
||||
Text {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
color: "#333"
|
||||
elide: styleData.elideMode
|
||||
text: styleData.value
|
||||
font.pixelSize: 11
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
mouse.accepted = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "#00000000"
|
||||
anchors.left: asmTableView.right
|
||||
anchors.right: parent.right
|
||||
SplitView {
|
||||
orientation: Qt.Vertical
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
color: "#00000000"
|
||||
height: 330
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
TextArea {
|
||||
id: codeEditor
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: settings.left
|
||||
focus: true
|
||||
|
||||
/*
|
||||
Timer {
|
||||
id: compileTimer
|
||||
interval: 500 ; running: true ; repeat: true
|
||||
onTriggered: {
|
||||
dbg.autoComp(codeEditor.text)
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Column {
|
||||
id: settings
|
||||
spacing: 5
|
||||
width: 300
|
||||
height: parent.height
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
Label {
|
||||
text: "Arbitrary data"
|
||||
}
|
||||
TextArea {
|
||||
id: rawDataField
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: 150
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "Amount"
|
||||
}
|
||||
TextField {
|
||||
id: txValue
|
||||
width: 200
|
||||
placeholderText: "Amount"
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
}
|
||||
Label {
|
||||
text: "Amount of gas"
|
||||
}
|
||||
TextField {
|
||||
id: txGas
|
||||
width: 200
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
text: "10000"
|
||||
placeholderText: "Gas"
|
||||
}
|
||||
Label {
|
||||
text: "Gas price"
|
||||
}
|
||||
TextField {
|
||||
id: txGasPrice
|
||||
width: 200
|
||||
placeholderText: "Gas price"
|
||||
text: "1000000000000"
|
||||
validator: RegExpValidator { regExp: /\d*/ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SplitView {
|
||||
orientation: Qt.Vertical
|
||||
id: inspectorPane
|
||||
height: 500
|
||||
|
||||
SplitView {
|
||||
orientation: Qt.Horizontal
|
||||
height: 150
|
||||
|
||||
TableView {
|
||||
id: stackTableView
|
||||
property var stackModel: ListModel {
|
||||
id: stackModel
|
||||
}
|
||||
height: parent.height
|
||||
width: 300
|
||||
TableViewColumn{ role: "value" ; title: "Local VM stack" ; width: stackTableView.width - 2 }
|
||||
model: stackModel
|
||||
}
|
||||
|
||||
TableView {
|
||||
id: memoryTableView
|
||||
property var memModel: ListModel {
|
||||
id: memModel
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width - stackTableView.width
|
||||
TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50 }
|
||||
TableViewColumn{ role: "value" ; title: "Memory" ; width: 650 }
|
||||
model: memModel
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 100
|
||||
width: parent.width
|
||||
TableView {
|
||||
id: storageTableView
|
||||
property var memModel: ListModel {
|
||||
id: storageModel
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
TableViewColumn{ id: key ; role: "key" ; title: "#" ; width: storageTableView.width / 2 - 1}
|
||||
TableViewColumn{ role: "value" ; title: "Storage" ; width: storageTableView.width / 2 - 1}
|
||||
model: storageModel
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 200
|
||||
width: parent.width * 0.66
|
||||
TableView {
|
||||
id: logTableView
|
||||
property var logModel: ListModel {
|
||||
id: logModel
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
TableViewColumn{ id: message ; role: "message" ; title: "log" ; width: logTableView.width - 2 }
|
||||
model: logModel
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function exec() {
|
||||
dbg.execCommand(dbgCommand.text);
|
||||
dbgCommand.text = "";
|
||||
}
|
||||
statusBar: StatusBar {
|
||||
height: 30
|
||||
|
||||
|
||||
TextField {
|
||||
id: dbgCommand
|
||||
y: 1
|
||||
x: asmTableView.width
|
||||
width: 500
|
||||
placeholderText: "Debugger (type 'help')"
|
||||
Keys.onReturnPressed: {
|
||||
exec()
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.left: dbgCommand.right
|
||||
anchors.leftMargin: 10
|
||||
spacing: 5
|
||||
y: parent.height / 2 - this.height / 2
|
||||
|
||||
Text {
|
||||
objectName: "stackFrame"
|
||||
font.pixelSize: 10
|
||||
text: "<b>stack ptr</b>: 0"
|
||||
}
|
||||
|
||||
Text {
|
||||
objectName: "stackSize"
|
||||
font.pixelSize: 10
|
||||
text: "<b>stack size</b>: 0"
|
||||
}
|
||||
|
||||
Text {
|
||||
objectName: "memSize"
|
||||
font.pixelSize: 10
|
||||
text: "<b>mem size</b>: 0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
toolBar: ToolBar {
|
||||
height: 30
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
|
||||
Button {
|
||||
property var enabled: true
|
||||
id: debugStart
|
||||
onClicked: {
|
||||
debugCurrent()
|
||||
}
|
||||
text: "Debug"
|
||||
}
|
||||
|
||||
Button {
|
||||
property var enabled: true
|
||||
id: debugNextButton
|
||||
onClicked: {
|
||||
dbg.next()
|
||||
}
|
||||
text: "Next"
|
||||
}
|
||||
|
||||
Button {
|
||||
id: debugContinueButton
|
||||
onClicked: {
|
||||
dbg.continue()
|
||||
}
|
||||
text: "Continue"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ComboBox {
|
||||
visible: false
|
||||
id: snippets
|
||||
anchors.right: parent.right
|
||||
model: ListModel {
|
||||
ListElement { text: "Snippets" ; value: "" }
|
||||
ListElement { text: "Call Contract" ; value: "var[2] in = { \"arg1\", 0xdeadbeef };\nvar ret;\n\nvar success = call(0x0c542ddea93dae0c2fcb2cf175f03ad80d6be9a0, 0, 7000, in, ret)\n\nreturn ret" }
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
if(currentIndex != 0) {
|
||||
var code = snippets.model.get(currentIndex).value;
|
||||
codeEditor.insert(codeEditor.cursorPosition, code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function debugCurrent() {
|
||||
dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text, rawDataField.text)
|
||||
}
|
||||
|
||||
function setAsm(asm) {
|
||||
asmModel.append({asm: asm})
|
||||
}
|
||||
|
||||
function clearAsm() {
|
||||
asmModel.clear()
|
||||
}
|
||||
|
||||
function setInstruction(num) {
|
||||
asmTableView.selection.clear()
|
||||
asmTableView.selection.select(num)
|
||||
asmTableView.positionViewAtRow(num, ListView.Center)
|
||||
}
|
||||
|
||||
function setMem(mem) {
|
||||
memModel.append({num: mem.num, value: mem.value})
|
||||
}
|
||||
function clearMem(){
|
||||
memModel.clear()
|
||||
}
|
||||
|
||||
function setStack(stack) {
|
||||
stackModel.append({value: stack})
|
||||
}
|
||||
function addDebugMessage(message){
|
||||
debuggerLog.append({value: message})
|
||||
}
|
||||
|
||||
function clearStack() {
|
||||
stackModel.clear()
|
||||
}
|
||||
|
||||
function clearStorage() {
|
||||
storageModel.clear()
|
||||
}
|
||||
|
||||
function setStorage(storage) {
|
||||
storageModel.append({key: storage.key, value: storage.value})
|
||||
}
|
||||
|
||||
function setLog(msg) {
|
||||
// Remove first item once we've reached max log items
|
||||
if(logModel.count > 250) {
|
||||
logModel.remove(0)
|
||||
}
|
||||
|
||||
if(msg.len != 0) {
|
||||
if(logTableView.flickableItem.atYEnd) {
|
||||
logModel.append({message: msg})
|
||||
logTableView.positionViewAtRow(logTableView.rowCount - 1, ListView.Contain)
|
||||
} else {
|
||||
logModel.append({message: msg})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearLog() {
|
||||
logModel.clear()
|
||||
}
|
||||
}
|
55
cmd/mist/assets/examples/abi.html
Normal file
55
cmd/mist/assets/examples/abi.html
Normal file
@ -0,0 +1,55 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello world</title>
|
||||
<script src="../ext/bignumber.min.js"></script>
|
||||
<script src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
<script>
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
var eth = web3.eth;
|
||||
var desc = [{
|
||||
"name": "multiply(uint256)",
|
||||
"inputs": [{
|
||||
"name": "a",
|
||||
"type": "uint256"
|
||||
}],
|
||||
"outputs": [{
|
||||
"name": "d",
|
||||
"type": "uint256"
|
||||
}]
|
||||
}];
|
||||
var address = web3.eth.transact({
|
||||
data: "0x603880600c6000396000f3006001600060e060020a600035048063c6888fa114601857005b6021600435602b565b8060005260206000f35b600081600702905091905056",
|
||||
gasPrice: "1000000000000000",
|
||||
gas: "10000",
|
||||
});
|
||||
var contract = web3.eth.contract(address, desc);
|
||||
|
||||
function calculate() {
|
||||
var param = parseInt(document.getElementById('value').value);
|
||||
|
||||
var res = contract.call().multiply(param);
|
||||
document.getElementById('result').innerText = res.toString(10);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h3>Contract content</h3>
|
||||
<textarea style="height:100px; width: 300px;" disabled="disabled">
|
||||
contract test {
|
||||
function multiply(uint a) returns(uint d) {
|
||||
return a * 7;
|
||||
}
|
||||
}
|
||||
</textarea>
|
||||
<code><pre>
|
||||
603880600c6000396000f3006001600060e060020a600035048063c6888fa1140
|
||||
05b6021600435602b565b8060005260206000f35b600081600702905091905056</pre></code>
|
||||
|
||||
<hr>
|
||||
<div>7 x <input type="number" id="value" onkeyup='calculate()'></input> =
|
||||
<span id="result"></spa>
|
||||
|
||||
</body>
|
||||
</html>
|
40
cmd/mist/assets/examples/balance.html
Normal file
40
cmd/mist/assets/examples/balance.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script src="../ext/bignumber.min.js"></script>
|
||||
<script src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
function watchBalance() {
|
||||
var coinbase = web3.eth.coinbase;
|
||||
var originalBalance = 0;
|
||||
|
||||
var balance = web3.eth.balanceAt(coinbase);
|
||||
var originalBalance = web3.toDecimal(balance);
|
||||
document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...';
|
||||
|
||||
web3.eth.watch({altered: coinbase}).changed(function() {
|
||||
balance = web3.eth.balanceAt(coinbase)
|
||||
var currentBalance = web3.toDecimal(balance);
|
||||
document.getElementById("current").innerText = 'current: ' + currentBalance;
|
||||
document.getElementById("diff").innerText = 'diff: ' + (currentBalance - originalBalance);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>coinbase balance</h1>
|
||||
<button type="button" onClick="watchBalance();">watch balance</button>
|
||||
<div></div>
|
||||
<div id="original"></div>
|
||||
<div id="current"></div>
|
||||
<div id="diff"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
147
cmd/mist/assets/examples/coin.html
Normal file
147
cmd/mist/assets/examples/coin.html
Normal file
@ -0,0 +1,147 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
<title>JevCoin</title>
|
||||
<head>
|
||||
<script type="text/javascript" src="../ext/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>JevCoin <code id="contract_addr"></code></h1>
|
||||
<div>
|
||||
<strong>Balance</strong>
|
||||
<span id="balance"></strong>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="amount">Amount:</span>
|
||||
<input type="text" id="address" style="width:200px">
|
||||
<input type="text" id="amount" style="width:200px">
|
||||
<button onclick="transact()">Send</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<table width="100%" id="table">
|
||||
<tr><td style="width:40%;">Address</td><td>Balance</td></tr>
|
||||
<tbody id="table_body"></tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var web3 = require('web3');
|
||||
var eth = web3.eth;
|
||||
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545'));
|
||||
var desc = [{
|
||||
"name": "balance(address)",
|
||||
"type": "function",
|
||||
"inputs": [{
|
||||
"name": "who",
|
||||
"type": "address"
|
||||
}],
|
||||
"constant": true,
|
||||
"outputs": [{
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}]
|
||||
}, {
|
||||
"name": "send(address,uint256)",
|
||||
"type": "function",
|
||||
"inputs": [{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
}, {
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}],
|
||||
"outputs": []
|
||||
}, {
|
||||
"name":"received",
|
||||
"type":"event",
|
||||
"inputs": [
|
||||
{"name":"from","type":"address","indexed":true},
|
||||
{"name":"amount","type":"uint256","indexed":true},
|
||||
],
|
||||
}];
|
||||
|
||||
var address = localStorage.getItem("address");
|
||||
// deploy if not exist
|
||||
if (address == null) {
|
||||
var code = "0x60056013565b61012b806100346000396000f35b6103e8600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a681461002b578063d0679d3414610039578063e3d670d71461004d57005b610033610126565b60006000f35b610047600435602435610062565b60006000f35b610058600435610104565b8060005260206000f35b80600033600160a060020a0316600052602052604060002054101561008657610100565b80600033600160a060020a0316600052602052604060002090815403908190555080600083600160a060020a0316600052602052604060002090815401908190555033600160a060020a0316600052806020527ff11e547d796cc64acdf758e7cee90439494fd886a19159454aa61e473fdbafef60406000a15b5050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156";
|
||||
address = web3.eth.transact({data: code});
|
||||
localStorage.setItem("address", address);
|
||||
}
|
||||
document.querySelector("#contract_addr").innerHTML = address.toUpperCase();
|
||||
|
||||
var contract = web3.eth.contract(address, desc);
|
||||
contract.received({from: eth.coinbase}).changed(function() {
|
||||
refresh();
|
||||
});
|
||||
|
||||
var ev = contract.SingleTransact({})
|
||||
ev.watch(function(log) {
|
||||
someElement.innerHTML += "tnaheousnthaoeu";
|
||||
});
|
||||
|
||||
eth.watch('chain').changed(function() {
|
||||
refresh();
|
||||
});
|
||||
|
||||
function refresh() {
|
||||
document.querySelector("#balance").innerHTML = contract.balance(eth.coinbase);
|
||||
|
||||
var table = document.querySelector("#table_body");
|
||||
table.innerHTML = ""; // clear
|
||||
|
||||
var storage = eth.storageAt(address);
|
||||
table.innerHTML = "";
|
||||
for( var item in storage ) {
|
||||
table.innerHTML += "<tr><td>"+item.toUpperCase()+"</td><td>"+web3.toDecimal(storage[item])+"</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
function transact() {
|
||||
var to = document.querySelector("#address").value;
|
||||
if( to.length == 0 ) {
|
||||
to = "0x4205b06c2cfa0e30359edcab94543266cb6fa1d3";
|
||||
} else {
|
||||
to = "0x"+to;
|
||||
}
|
||||
|
||||
var value = parseInt( document.querySelector("#amount").value );
|
||||
|
||||
contract.send( to, value );
|
||||
}
|
||||
|
||||
refresh();
|
||||
</script>
|
||||
</html>
|
||||
|
||||
<!--
|
||||
contract JevCoin {
|
||||
function JevCoin()
|
||||
{
|
||||
balances[msg.sender] = 1000000;
|
||||
}
|
||||
|
||||
event changed(address indexed from, address indexed to);
|
||||
function send(address to, uint value)
|
||||
{
|
||||
if( balances[msg.sender] < value ) return;
|
||||
|
||||
balances[msg.sender] -= value;
|
||||
balances[to] += value;
|
||||
|
||||
changed(msg.sender, to);
|
||||
}
|
||||
|
||||
function balance(address who) constant returns(uint t)
|
||||
{
|
||||
t = balances[who];
|
||||
}
|
||||
|
||||
mapping(address => uint256) balances;
|
||||
}
|
||||
-!>
|
64
cmd/mist/assets/examples/coin.js
Normal file
64
cmd/mist/assets/examples/coin.js
Normal file
@ -0,0 +1,64 @@
|
||||
var contract = web3.eth.contractFromAbi([
|
||||
{
|
||||
"constant":false,
|
||||
"inputs":[
|
||||
{"name":"_h","type":"hash256"}
|
||||
],
|
||||
"name":"confirm",
|
||||
"outputs":[],
|
||||
"type":"function"
|
||||
},{
|
||||
"constant":false,
|
||||
"inputs":[
|
||||
{"name":_to,"type":"address"},
|
||||
{"name":"_value","type":"uint256"},
|
||||
{"name":"_data","type":"bytes"}
|
||||
],
|
||||
"name":"execute",
|
||||
"outputs":[
|
||||
{"name":"_r","type":"hash256"}
|
||||
],
|
||||
"type":"function"
|
||||
},{
|
||||
"constant":false,
|
||||
"inputs":[
|
||||
{"name":"_to","type":"address"}
|
||||
],"name":"kill",
|
||||
"outputs":[],
|
||||
"type":"function"
|
||||
},{
|
||||
"constant":false,
|
||||
"inputs":[
|
||||
{"name":"_from","type":"address"},
|
||||
{"name":"_to","type":"address"}
|
||||
],
|
||||
"name":"changeOwner",
|
||||
"outputs":[],
|
||||
"type":"function"
|
||||
},{
|
||||
"inputs":[
|
||||
{"indexed":false,"name":"value","type":"uint256"}
|
||||
],
|
||||
"name":"CashIn",
|
||||
"type":"event"
|
||||
},{
|
||||
"inputs":[
|
||||
{"indexed":true,"name":"out","type":"string32"},
|
||||
{"indexed":false,"name":"owner","type":"address"},
|
||||
{"indexed":false,"name":"value","type":"uint256"},
|
||||
{"indexed":false,"name":"to","type":"address"}
|
||||
],
|
||||
"name":"SingleTransact",
|
||||
"type":"event"
|
||||
},{
|
||||
"inputs":[
|
||||
{"indexed":true,"name":"out","type":"string32"},
|
||||
{"indexed":false,"name":"owner","type":"address"},
|
||||
{"indexed":false,"name":"operation","type":"hash256"},
|
||||
{"indexed":false,"name":"value","type":"uint256"},
|
||||
{"indexed":false,"name":"to","type":"address"}
|
||||
],
|
||||
"name":"MultiTransact",
|
||||
"type":"event"
|
||||
}
|
||||
]);
|
77
cmd/mist/assets/examples/info.html
Normal file
77
cmd/mist/assets/examples/info.html
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
<!doctype>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script type="text/javascript" src="../ext/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Info</h1>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>Block number</td>
|
||||
<td id="number"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Peer count</td>
|
||||
<td id="peer_count"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Default block</td>
|
||||
<td id="default_block"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Accounts</td>
|
||||
<td id="accounts"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Balance</td>
|
||||
<td id="balance"></td>
|
||||
|
||||
<tr>
|
||||
<td>Gas price</td>
|
||||
<td id="gas_price"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Mining</td>
|
||||
<td id="mining"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Listening</td>
|
||||
<td id="listening"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Coinbase</td>
|
||||
<td id="coinbase"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var web3 = require('web3');
|
||||
var eth = web3.eth;
|
||||
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
document.querySelector("#number").innerHTML = eth.number;
|
||||
document.querySelector("#coinbase").innerHTML = eth.coinbase
|
||||
document.querySelector("#peer_count").innerHTML = eth.peerCount;
|
||||
document.querySelector("#default_block").innerHTML = eth.defaultBlock;
|
||||
document.querySelector("#accounts").innerHTML = eth.accounts;
|
||||
document.querySelector("#balance").innerHTML = web3.toEth(eth.balanceAt(eth.accounts[0]));
|
||||
document.querySelector("#gas_price").innerHTML = eth.gasPrice;
|
||||
document.querySelector("#mining").innerHTML = eth.mining;
|
||||
document.querySelector("#listening").innerHTML = eth.listening;
|
||||
</script>
|
||||
|
||||
</html>
|
||||
|
70
cmd/mist/assets/examples/whisper.html
Normal file
70
cmd/mist/assets/examples/whisper.html
Normal file
@ -0,0 +1,70 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
<title>Whisper test</title>
|
||||
<head>
|
||||
<script type="text/javascript" src="../ext/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../ext/ethereum.js/dist/ethereum.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Whisper test</h1>
|
||||
|
||||
<button onclick="test()">Send</button>
|
||||
<button onclick="test2()">Private send</button>
|
||||
|
||||
<table width="100%" id="table">
|
||||
<tr>
|
||||
<td>Count</td>
|
||||
<td id="count"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td id="id"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Has identity</td>
|
||||
<td id="known"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
var shh = web3.shh;
|
||||
|
||||
var id = shh.newIdentity();
|
||||
document.querySelector("#id").innerHTML = id;
|
||||
document.querySelector("#known").innerHTML = shh.haveIdentity(id);
|
||||
|
||||
var watch = shh.watch({topics: ["test"]})
|
||||
watch.arrived(function(message) {
|
||||
document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>";
|
||||
});
|
||||
|
||||
var selfWatch = shh.watch({to: id, topics: ["test"]})
|
||||
selfWatch.arrived(function(message) {
|
||||
document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>";
|
||||
});
|
||||
|
||||
function test() {
|
||||
shh.post({topics: ["test"], payload: web3.fromAscii("test it")});
|
||||
count();
|
||||
}
|
||||
|
||||
function test2() {
|
||||
shh.post({to: id, topics: ["test"], payload: web3.fromAscii("Private")});
|
||||
count();
|
||||
}
|
||||
|
||||
function count() {
|
||||
document.querySelector("#count").innerHTML = watch.messages().length;
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
|
||||
|
5
cmd/mist/assets/ext/.bowerrc
Normal file
5
cmd/mist/assets/ext/.bowerrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"directory": "example/js/",
|
||||
"cwd": "./",
|
||||
"analytics": false
|
||||
}
|
12
cmd/mist/assets/ext/.editorconfig
Normal file
12
cmd/mist/assets/ext/.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
18
cmd/mist/assets/ext/.gitignore
vendored
Normal file
18
cmd/mist/assets/ext/.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
#
|
||||
# If you find yourself ignoring temporary files generated by your text editor
|
||||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile ~/.gitignore_global
|
||||
|
||||
*.swp
|
||||
/tmp
|
||||
*/**/*un~
|
||||
*un~
|
||||
.DS_Store
|
||||
*/**/.DS_Store
|
||||
ethereum/ethereum
|
||||
ethereal/ethereal
|
||||
example/js
|
||||
node_modules
|
||||
bower_components
|
||||
npm-debug.log
|
50
cmd/mist/assets/ext/.jshintrc
Normal file
50
cmd/mist/assets/ext/.jshintrc
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"predef": [
|
||||
"console",
|
||||
"require",
|
||||
"equal",
|
||||
"test",
|
||||
"testBoth",
|
||||
"testWithDefault",
|
||||
"raises",
|
||||
"deepEqual",
|
||||
"start",
|
||||
"stop",
|
||||
"ok",
|
||||
"strictEqual",
|
||||
"module",
|
||||
"expect",
|
||||
"reject",
|
||||
"impl"
|
||||
],
|
||||
|
||||
"esnext": true,
|
||||
"proto": true,
|
||||
"node" : true,
|
||||
"browser" : true,
|
||||
"browserify" : true,
|
||||
|
||||
"boss" : true,
|
||||
"curly": false,
|
||||
"debug": true,
|
||||
"devel": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"shadow": true,
|
||||
"eqnull": true
|
||||
}
|
9
cmd/mist/assets/ext/.npmignore
Normal file
9
cmd/mist/assets/ext/.npmignore
Normal file
@ -0,0 +1,9 @@
|
||||
example/js
|
||||
node_modules
|
||||
test
|
||||
.gitignore
|
||||
.editorconfig
|
||||
.travis.yml
|
||||
.npmignore
|
||||
component.json
|
||||
testling.html
|
13
cmd/mist/assets/ext/.travis.yml
Normal file
13
cmd/mist/assets/ext/.travis.yml
Normal file
@ -0,0 +1,13 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
before_script:
|
||||
- npm install
|
||||
- npm install jshint
|
||||
script:
|
||||
- "jshint *.js lib"
|
||||
after_script:
|
||||
- npm run-script build
|
||||
- npm test
|
||||
|
2
cmd/mist/assets/ext/bignumber.min.js
vendored
Normal file
2
cmd/mist/assets/ext/bignumber.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
cmd/mist/assets/ext/ethereum.js/.bowerrc
Normal file
5
cmd/mist/assets/ext/ethereum.js/.bowerrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"directory": "example/js/",
|
||||
"cwd": "./",
|
||||
"analytics": false
|
||||
}
|
12
cmd/mist/assets/ext/ethereum.js/.editorconfig
Normal file
12
cmd/mist/assets/ext/ethereum.js/.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
18
cmd/mist/assets/ext/ethereum.js/.gitignore
vendored
Normal file
18
cmd/mist/assets/ext/ethereum.js/.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
#
|
||||
# If you find yourself ignoring temporary files generated by your text editor
|
||||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile ~/.gitignore_global
|
||||
|
||||
*.swp
|
||||
/tmp
|
||||
*/**/*un~
|
||||
*un~
|
||||
.DS_Store
|
||||
*/**/.DS_Store
|
||||
ethereum/ethereum
|
||||
ethereal/ethereal
|
||||
example/js
|
||||
node_modules
|
||||
bower_components
|
||||
npm-debug.log
|
50
cmd/mist/assets/ext/ethereum.js/.jshintrc
Normal file
50
cmd/mist/assets/ext/ethereum.js/.jshintrc
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"predef": [
|
||||
"console",
|
||||
"require",
|
||||
"equal",
|
||||
"test",
|
||||
"testBoth",
|
||||
"testWithDefault",
|
||||
"raises",
|
||||
"deepEqual",
|
||||
"start",
|
||||
"stop",
|
||||
"ok",
|
||||
"strictEqual",
|
||||
"module",
|
||||
"expect",
|
||||
"reject",
|
||||
"impl"
|
||||
],
|
||||
|
||||
"esnext": true,
|
||||
"proto": true,
|
||||
"node" : true,
|
||||
"browser" : true,
|
||||
"browserify" : true,
|
||||
|
||||
"boss" : true,
|
||||
"curly": false,
|
||||
"debug": true,
|
||||
"devel": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"shadow": true,
|
||||
"eqnull": true
|
||||
}
|
9
cmd/mist/assets/ext/ethereum.js/.npmignore
Normal file
9
cmd/mist/assets/ext/ethereum.js/.npmignore
Normal file
@ -0,0 +1,9 @@
|
||||
example/js
|
||||
node_modules
|
||||
test
|
||||
.gitignore
|
||||
.editorconfig
|
||||
.travis.yml
|
||||
.npmignore
|
||||
component.json
|
||||
testling.html
|
13
cmd/mist/assets/ext/ethereum.js/.travis.yml
Normal file
13
cmd/mist/assets/ext/ethereum.js/.travis.yml
Normal file
@ -0,0 +1,13 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
before_script:
|
||||
- npm install
|
||||
- npm install jshint
|
||||
script:
|
||||
- "jshint *.js lib"
|
||||
after_script:
|
||||
- npm run-script build
|
||||
- npm test
|
||||
|
14
cmd/mist/assets/ext/ethereum.js/LICENSE
Normal file
14
cmd/mist/assets/ext/ethereum.js/LICENSE
Normal file
@ -0,0 +1,14 @@
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
96
cmd/mist/assets/ext/ethereum.js/README.md
Normal file
96
cmd/mist/assets/ext/ethereum.js/README.md
Normal file
@ -0,0 +1,96 @@
|
||||
# Ethereum JavaScript API
|
||||
|
||||
This is the Ethereum compatible [JavaScript API](https://github.com/ethereum/wiki/wiki/JavaScript-API)
|
||||
which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec. It's available on npm as a node module and also for bower and component as an embeddable js
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url]
|
||||
|
||||
<!-- [](https://ci.testling.com/ethereum/ethereum.js) -->
|
||||
|
||||
## Installation
|
||||
|
||||
### Node.js
|
||||
|
||||
npm install ethereum.js
|
||||
|
||||
### For browser
|
||||
Bower
|
||||
|
||||
bower install ethereum.js
|
||||
|
||||
Component
|
||||
|
||||
component install ethereum/ethereum.js
|
||||
|
||||
* Include `ethereum.min.js` in your html file.
|
||||
* Include [bignumber.js](https://github.com/MikeMcl/bignumber.js/)
|
||||
|
||||
## Usage
|
||||
Require the library:
|
||||
|
||||
var web3 = require('web3');
|
||||
|
||||
Set a provider (QtProvider, WebSocketProvider, HttpRpcProvider)
|
||||
|
||||
var web3.setProvider(new web3.providers.WebSocketProvider('ws://localhost:40404/eth'));
|
||||
|
||||
There you go, now you can use it:
|
||||
|
||||
```
|
||||
var coinbase = web3.eth.coinbase;
|
||||
var balance = web3.eth.balanceAt(coinbase);
|
||||
```
|
||||
|
||||
|
||||
For another example see `example/index.html`.
|
||||
|
||||
## Contribute!
|
||||
|
||||
### Requirements
|
||||
|
||||
* Node.js
|
||||
* npm
|
||||
* gulp (build)
|
||||
* mocha (tests)
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install nodejs
|
||||
sudo apt-get install npm
|
||||
sudo apt-get install nodejs-legacy
|
||||
```
|
||||
|
||||
### Building (gulp)
|
||||
|
||||
```bash
|
||||
npm run-script build
|
||||
```
|
||||
|
||||
|
||||
### Testing (mocha)
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
**Please note this repo is in it's early stage.**
|
||||
|
||||
If you'd like to run a WebSocket ethereum node check out
|
||||
[go-ethereum](https://github.com/ethereum/go-ethereum).
|
||||
|
||||
To install ethereum and spawn a node:
|
||||
|
||||
```
|
||||
go get github.com/ethereum/go-ethereum/ethereum
|
||||
ethereum -ws -loglevel=4
|
||||
```
|
||||
|
||||
[npm-image]: https://badge.fury.io/js/ethereum.js.png
|
||||
[npm-url]: https://npmjs.org/package/ethereum.js
|
||||
[travis-image]: https://travis-ci.org/ethereum/ethereum.js.svg
|
||||
[travis-url]: https://travis-ci.org/ethereum/ethereum.js
|
||||
[dep-image]: https://david-dm.org/ethereum/ethereum.js.svg
|
||||
[dep-url]: https://david-dm.org/ethereum/ethereum.js
|
||||
[dep-dev-image]: https://david-dm.org/ethereum/ethereum.js/dev-status.svg
|
||||
[dep-dev-url]: https://david-dm.org/ethereum/ethereum.js#info=devDependencies
|
||||
|
51
cmd/mist/assets/ext/ethereum.js/bower.json
Normal file
51
cmd/mist/assets/ext/ethereum.js/bower.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "ethereum.js",
|
||||
"namespace": "ethereum",
|
||||
"version": "0.0.13",
|
||||
"description": "Ethereum Compatible JavaScript API",
|
||||
"main": ["./dist/ethereum.js", "./dist/ethereum.min.js"],
|
||||
"dependencies": {
|
||||
"bignumber.js": ">=2.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ethereum/ethereum.js.git"
|
||||
},
|
||||
"homepage": "https://github.com/ethereum/ethereum.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ethereum/ethereum.js/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"ethereum",
|
||||
"javascript",
|
||||
"API"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marek Kotewicz",
|
||||
"email": "marek@ethdev.com",
|
||||
"homepage": "https://github.com/debris"
|
||||
},
|
||||
{
|
||||
"name": "Marian Oancea",
|
||||
"email": "marian@ethdev.com",
|
||||
"homepage": "https://github.com/cubedro"
|
||||
}
|
||||
],
|
||||
"license": "LGPL-3.0",
|
||||
"ignore": [
|
||||
"example",
|
||||
"lib",
|
||||
"node_modules",
|
||||
"package.json",
|
||||
".bowerrc",
|
||||
".editorconfig",
|
||||
".gitignore",
|
||||
".jshintrc",
|
||||
".npmignore",
|
||||
".travis.yml",
|
||||
"gulpfile.js",
|
||||
"index.js",
|
||||
"**/*.txt"
|
||||
]
|
||||
}
|
1639
cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
vendored
Normal file
1639
cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
41
cmd/mist/assets/ext/ethereum.js/dist/ethereum.js.map
vendored
Normal file
41
cmd/mist/assets/ext/ethereum.js/dist/ethereum.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1
cmd/mist/assets/ext/ethereum.js/dist/ethereum.min.js
vendored
Normal file
1
cmd/mist/assets/ext/ethereum.js/dist/ethereum.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
43
cmd/mist/assets/ext/ethereum.js/example/balance.html
Normal file
43
cmd/mist/assets/ext/ethereum.js/example/balance.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
function watchBalance() {
|
||||
var coinbase = web3.eth.coinbase;
|
||||
var originalBalance = 0;
|
||||
|
||||
var balance = web3.eth.balanceAt(coinbase);
|
||||
var originalBalance = web3.toDecimal(balance);
|
||||
document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...';
|
||||
|
||||
<<<<<<< HEAD:cmd/mist/assets/ext/ethereum.js/example/balance.html
|
||||
var filter = web3.eth.watch({address: coinbase}).changed(function() {
|
||||
=======
|
||||
web3.eth.watch('pending').changed(function() {
|
||||
>>>>>>> 859a1999cb204d2c6fcb08d6569c738c5af5cd86:example/balance.html
|
||||
balance = web3.eth.balanceAt(coinbase)
|
||||
var currentBalance = web3.toDecimal(balance);
|
||||
document.getElementById("current").innerText = 'current: ' + currentBalance;
|
||||
document.getElementById("diff").innerText = 'diff: ' + (currentBalance - originalBalance);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>coinbase balance</h1>
|
||||
<button type="button" onClick="watchBalance();">watch balance</button>
|
||||
<div></div>
|
||||
<div id="original"></div>
|
||||
<div id="current"></div>
|
||||
<div id="diff"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
74
cmd/mist/assets/ext/ethereum.js/example/contract.html
Normal file
74
cmd/mist/assets/ext/ethereum.js/example/contract.html
Normal file
@ -0,0 +1,74 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider());
|
||||
|
||||
// solidity source code
|
||||
var source = "" +
|
||||
"contract test {\n" +
|
||||
" function multiply(uint a) returns(uint d) {\n" +
|
||||
" return a * 7;\n" +
|
||||
" }\n" +
|
||||
"}\n";
|
||||
|
||||
// contract description, this will be autogenerated somehow
|
||||
var desc = [{
|
||||
"name": "multiply(uint256)",
|
||||
"type": "function",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "a",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "d",
|
||||
"type": "uint256"
|
||||
}
|
||||
]
|
||||
}];
|
||||
|
||||
var contract;
|
||||
|
||||
function createExampleContract() {
|
||||
// hide create button
|
||||
document.getElementById('create').style.visibility = 'hidden';
|
||||
document.getElementById('source').innerText = source;
|
||||
|
||||
// create contract
|
||||
var address = web3.eth.transact({code: web3.eth.solidity(source)});
|
||||
contract = web3.eth.contract(address, desc);
|
||||
document.getElementById('call').style.visibility = 'visible';
|
||||
}
|
||||
|
||||
function callExampleContract() {
|
||||
// this should be generated by ethereum
|
||||
var param = parseInt(document.getElementById('value').value);
|
||||
|
||||
// call the contract
|
||||
var res = contract.call().multiply(param);
|
||||
document.getElementById('result').innerText = res.toString(10);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>contract</h1>
|
||||
<div id="source"></div>
|
||||
<div id='create'>
|
||||
<button type="button" onClick="createExampleContract();">create example contract</button>
|
||||
</div>
|
||||
<div id='call' style='visibility: hidden;'>
|
||||
<input type="number" id="value" onkeyup='callExampleContract()'></input>
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,76 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider());
|
||||
|
||||
// solidity source code
|
||||
var source = "" +
|
||||
"contract test {\n" +
|
||||
" function multiply(uint[] a) returns(uint d) {\n" +
|
||||
" return a[0] + a[1];\n" +
|
||||
" }\n" +
|
||||
"}\n";
|
||||
|
||||
// contract description, this will be autogenerated somehow
|
||||
var desc = [{
|
||||
"name": "multiply(uint256[])",
|
||||
"type": "function",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "a",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "d",
|
||||
"type": "uint256"
|
||||
}
|
||||
]
|
||||
}];
|
||||
|
||||
var contract;
|
||||
|
||||
function createExampleContract() {
|
||||
// hide create button
|
||||
document.getElementById('create').style.visibility = 'hidden';
|
||||
document.getElementById('source').innerText = source;
|
||||
|
||||
// create contract
|
||||
var address = web3.eth.transact({code: web3.eth.solidity(source)});
|
||||
contract = web3.eth.contract(address, desc);
|
||||
document.getElementById('call').style.visibility = 'visible';
|
||||
}
|
||||
|
||||
function callExampleContract() {
|
||||
// this should be generated by ethereum
|
||||
var param = parseInt(document.getElementById('value').value);
|
||||
var param2 = parseInt(document.getElementById('value2').value);
|
||||
|
||||
// call the contract
|
||||
var res = contract.call().multiply([param, param2]);
|
||||
document.getElementById('result').innerText = res.toString(10);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>contract</h1>
|
||||
<div id="source"></div>
|
||||
<div id='create'>
|
||||
<button type="button" onClick="createExampleContract();">create example contract</button>
|
||||
</div>
|
||||
<div id='call' style='visibility: hidden;'>
|
||||
<input type="number" id="value" onkeyup='callExampleContract()'></input>
|
||||
<input type="number" id="value2" onkeyup='callExampleContract()'></input>
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
120
cmd/mist/assets/ext/ethereum.js/example/event.html
Normal file
120
cmd/mist/assets/ext/ethereum.js/example/event.html
Normal file
@ -0,0 +1,120 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
var desc = [{
|
||||
"type":"event",
|
||||
"inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}],
|
||||
"name":"Event"
|
||||
}, {
|
||||
"type":"event",
|
||||
"inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}],
|
||||
"name":"Event2"
|
||||
}, {
|
||||
"type":"function",
|
||||
"inputs": [{"name":"a","type":"uint256"}],
|
||||
"name":"foo",
|
||||
"outputs": []
|
||||
}];
|
||||
|
||||
var address = '0x01';
|
||||
|
||||
var contract = web3.eth.contract(address, desc);
|
||||
|
||||
function test1() {
|
||||
// "{"topic":["0x83c9849c","0xc4d76332"],"address":"0x01"}"
|
||||
web3.eth.watch(contract).changed(function (res) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
function test2() {
|
||||
// "{"topic":["0x83c9849c"],"address":"0x01"}"
|
||||
web3.eth.watch(contract.Event).changed(function (res) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
function test3() {
|
||||
// "{"topic":["0x83c9849c"],"address":"0x01"}"
|
||||
contract.Event().changed(function (res) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
function test4() {
|
||||
// "{"topic":["0x83c9849c","0000000000000000000000000000000000000000000000000000000000000045"],"address":"0x01"}"
|
||||
contract.Event({a: 69}).changed(function (res) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
function test5() {
|
||||
// "{"topic":["0x83c9849c",["0000000000000000000000000000000000000000000000000000000000000045","000000000000000000000000000000000000000000000000000000000000002a"]],"address":"0x01"}"
|
||||
contract.Event({a: [69, 42]}).changed(function (res) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
function test6() {
|
||||
// "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"max":100,"address":"0x01"}"
|
||||
contract.Event({a: 30}, {max: 100}).changed(function (res) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
function test7() {
|
||||
// "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"address":"0x01"}"
|
||||
web3.eth.watch(contract.Event, {a: 30}).changed(function (res) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
function test8() {
|
||||
// "{"topic":["0x83c9849c","000000000000000000000000000000000000000000000000000000000000001e"],"max":100,"address":"0x01"}"
|
||||
web3.eth.watch(contract.Event, {a: 30}, {max: 100}).changed(function (res) {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
// not valid
|
||||
// function testX() {
|
||||
// web3.eth.watch([contract.Event, contract.Event2]).changed(function (res) {
|
||||
// });
|
||||
// };
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<button type="button" onClick="test1();">test1</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" onClick="test2();">test2</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" onClick="test3();">test3</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" onClick="test4();">test4</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" onClick="test5();">test5</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" onClick="test6();">test6</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" onClick="test7();">test7</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" onClick="test8();">test8</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
66
cmd/mist/assets/ext/ethereum.js/example/event_inc.html
Normal file
66
cmd/mist/assets/ext/ethereum.js/example/event_inc.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
var source = "" +
|
||||
"contract Contract { " +
|
||||
" event Incremented(bool indexed odd, uint x); " +
|
||||
" function Contract() { " +
|
||||
" x = 69; " +
|
||||
" } " +
|
||||
" function inc() { " +
|
||||
" ++x; " +
|
||||
" Incremented(x % 2 == 1, x); " +
|
||||
" } " +
|
||||
" uint x; " +
|
||||
"}";
|
||||
|
||||
var desc = [{
|
||||
"type":"event",
|
||||
"name":"Incremented",
|
||||
"inputs": [{"name":"odd","type":"bool","indexed":true},{"name":"x","type":"uint","indexed":false}],
|
||||
}, {
|
||||
"type":"function",
|
||||
"name":"inc",
|
||||
"inputs": [],
|
||||
"outputs": []
|
||||
}];
|
||||
|
||||
var address;
|
||||
var contract;
|
||||
|
||||
var update = function (x) {
|
||||
document.getElementById('result').innerText = JSON.stringify(x);
|
||||
};
|
||||
|
||||
var createContract = function () {
|
||||
address = web3.eth.transact({code: web3.eth.solidity(source)});
|
||||
contract = web3.eth.contract(address, desc);
|
||||
contract.Incremented({odd: true}).changed(update);
|
||||
|
||||
};
|
||||
|
||||
var callContract = function () {
|
||||
contract.call().inc();
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<button type="button" onClick="createContract();">create contract</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" onClick="callContract();">test1</button>
|
||||
</div>
|
||||
<div id="result">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,77 @@
|
||||
<!doctype>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<script type="text/javascript" src="js/bignumber.js/bignumber.min.js"></script>
|
||||
<script type="text/javascript" src="../dist/ethereum.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var web3 = require('web3');
|
||||
web3.setProvider(new web3.providers.QtSyncProvider());
|
||||
|
||||
// solidity source code
|
||||
var source = "" +
|
||||
"contract test {\n" +
|
||||
" /// @notice Will multiply `a` by 7. \n" +
|
||||
" function multiply(uint a) returns(uint d) {\n" +
|
||||
" return a * 7;\n" +
|
||||
" }\n" +
|
||||
"}\n";
|
||||
|
||||
// contract description, this will be autogenerated somehow
|
||||
var desc = [{
|
||||
"name": "multiply(uint256)",
|
||||
"type": "function",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "a",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "d",
|
||||
"type": "uint256"
|
||||
}
|
||||
]
|
||||
}];
|
||||
|
||||
var contract;
|
||||
|
||||
function createExampleContract() {
|
||||
// hide create button
|
||||
document.getElementById('create').style.visibility = 'hidden';
|
||||
document.getElementById('source').innerText = source;
|
||||
|
||||
// create contract
|
||||
var address = web3.eth.transact({code: web3.eth.solidity(source)});
|
||||
contract = web3.eth.contract(address, desc);
|
||||
document.getElementById('call').style.visibility = 'visible';
|
||||
}
|
||||
|
||||
function callExampleContract() {
|
||||
// this should be generated by ethereum
|
||||
var param = parseInt(document.getElementById('value').value);
|
||||
|
||||
// transaction does not return any result, cause it's not synchronous and we don't know,
|
||||
// when it will be processed
|
||||
contract.transact().multiply(param);
|
||||
document.getElementById('result').innerText = 'transaction made';
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>contract</h1>
|
||||
<div id="source"></div>
|
||||
<div id='create'>
|
||||
<button type="button" onClick="createExampleContract();">create example contract</button>
|
||||
</div>
|
||||
<div id='call' style='visibility: hidden;'>
|
||||
<input type="number" id="value"></input>
|
||||
<button type="button" onClick="callExampleContract()">Call Contract</button>
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
12
cmd/mist/assets/ext/ethereum.js/example/node-app.js
Normal file
12
cmd/mist/assets/ext/ethereum.js/example/node-app.js
Normal file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var web3 = require("../index.js");
|
||||
|
||||
web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080'));
|
||||
|
||||
var coinbase = web3.eth.coinbase;
|
||||
console.log(coinbase);
|
||||
|
||||
var balance = web3.eth.balanceAt(coinbase);
|
||||
console.log(balance);
|
||||
|
104
cmd/mist/assets/ext/ethereum.js/gulpfile.js
Normal file
104
cmd/mist/assets/ext/ethereum.js/gulpfile.js
Normal file
@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var del = require('del');
|
||||
var gulp = require('gulp');
|
||||
var browserify = require('browserify');
|
||||
var jshint = require('gulp-jshint');
|
||||
var uglify = require('gulp-uglify');
|
||||
var rename = require('gulp-rename');
|
||||
var envify = require('envify/custom');
|
||||
var unreach = require('unreachable-branch-transform');
|
||||
var source = require('vinyl-source-stream');
|
||||
var exorcist = require('exorcist');
|
||||
var bower = require('bower');
|
||||
|
||||
var DEST = './dist/';
|
||||
|
||||
var build = function(src, dst, ugly) {
|
||||
var result = browserify({
|
||||
debug: true,
|
||||
insert_global_vars: false,
|
||||
detectGlobals: false,
|
||||
bundleExternal: false
|
||||
})
|
||||
.require('./' + src + '.js', {expose: 'web3'})
|
||||
.add('./' + src + '.js')
|
||||
.transform('envify', {
|
||||
NODE_ENV: 'build'
|
||||
})
|
||||
.transform('unreachable-branch-transform');
|
||||
|
||||
if (ugly) {
|
||||
result = result.transform('uglifyify', {
|
||||
mangle: false,
|
||||
compress: {
|
||||
dead_code: false,
|
||||
conditionals: true,
|
||||
unused: false,
|
||||
hoist_funs: true,
|
||||
hoist_vars: true,
|
||||
negate_iife: false
|
||||
},
|
||||
beautify: true,
|
||||
warnings: true
|
||||
});
|
||||
}
|
||||
|
||||
return result.bundle()
|
||||
.pipe(exorcist(path.join( DEST, dst + '.js.map')))
|
||||
.pipe(source(dst + '.js'))
|
||||
.pipe(gulp.dest( DEST ));
|
||||
};
|
||||
|
||||
var uglifyFile = function(file) {
|
||||
return gulp.src( DEST + file + '.js')
|
||||
.pipe(uglify())
|
||||
.pipe(rename(file + '.min.js'))
|
||||
.pipe(gulp.dest( DEST ));
|
||||
};
|
||||
|
||||
gulp.task('bower', function(cb){
|
||||
bower.commands.install().on('end', function (installed){
|
||||
console.log(installed);
|
||||
cb();
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('clean', ['lint'], function(cb) {
|
||||
del([ DEST ], cb);
|
||||
});
|
||||
|
||||
gulp.task('lint', function(){
|
||||
return gulp.src(['./*.js', './lib/*.js'])
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter('default'));
|
||||
});
|
||||
|
||||
gulp.task('build', ['clean'], function () {
|
||||
return build('index', 'ethereum', true);
|
||||
});
|
||||
|
||||
gulp.task('buildDev', ['clean'], function () {
|
||||
return build('index', 'ethereum', false);
|
||||
});
|
||||
|
||||
gulp.task('uglify', ['build'], function(){
|
||||
return uglifyFile('ethereum');
|
||||
});
|
||||
|
||||
gulp.task('uglifyDev', ['buildDev'], function(){
|
||||
return uglifyFile('ethereum');
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
gulp.watch(['./lib/*.js'], ['lint', 'prepare', 'build']);
|
||||
});
|
||||
|
||||
gulp.task('release', ['bower', 'lint', 'build', 'uglify']);
|
||||
gulp.task('dev', ['bower', 'lint', 'buildDev', 'uglifyDev']);
|
||||
gulp.task('default', ['dev']);
|
||||
|
11
cmd/mist/assets/ext/ethereum.js/index.js
Normal file
11
cmd/mist/assets/ext/ethereum.js/index.js
Normal file
@ -0,0 +1,11 @@
|
||||
var web3 = require('./lib/web3');
|
||||
var ProviderManager = require('./lib/providermanager');
|
||||
web3.provider = new ProviderManager();
|
||||
web3.filter = require('./lib/filter');
|
||||
web3.providers.HttpSyncProvider = require('./lib/httpsync');
|
||||
web3.providers.QtSyncProvider = require('./lib/qtsync');
|
||||
web3.eth.contract = require('./lib/contract');
|
||||
web3.abi = require('./lib/abi');
|
||||
|
||||
|
||||
module.exports = web3;
|
210
cmd/mist/assets/ext/ethereum.js/lib/abi.js
Normal file
210
cmd/mist/assets/ext/ethereum.js/lib/abi.js
Normal file
@ -0,0 +1,210 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file abi.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* Gav Wood <g@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
var web3 = require('./web3');
|
||||
var utils = require('./utils');
|
||||
var types = require('./types');
|
||||
var c = require('./const');
|
||||
var f = require('./formatters');
|
||||
|
||||
var displayTypeError = function (type) {
|
||||
console.error('parser does not support type: ' + type);
|
||||
};
|
||||
|
||||
/// This method should be called if we want to check if givent type is an array type
|
||||
/// @returns true if it is, otherwise false
|
||||
var arrayType = function (type) {
|
||||
return type.slice(-2) === '[]';
|
||||
};
|
||||
|
||||
var dynamicTypeBytes = function (type, value) {
|
||||
// TODO: decide what to do with array of strings
|
||||
if (arrayType(type) || type === 'string') // only string itself that is dynamic; stringX is static length.
|
||||
return f.formatInputInt(value.length);
|
||||
return "";
|
||||
};
|
||||
|
||||
var inputTypes = types.inputTypes();
|
||||
|
||||
/// Formats input params to bytes
|
||||
/// @param abi contract method inputs
|
||||
/// @param array of params that will be formatted to bytes
|
||||
/// @returns bytes representation of input params
|
||||
var formatInput = function (inputs, params) {
|
||||
var bytes = "";
|
||||
var padding = c.ETH_PADDING * 2;
|
||||
|
||||
/// first we iterate in search for dynamic
|
||||
inputs.forEach(function (input, index) {
|
||||
bytes += dynamicTypeBytes(input.type, params[index]);
|
||||
});
|
||||
|
||||
inputs.forEach(function (input, i) {
|
||||
var typeMatch = false;
|
||||
for (var j = 0; j < inputTypes.length && !typeMatch; j++) {
|
||||
typeMatch = inputTypes[j].type(inputs[i].type, params[i]);
|
||||
}
|
||||
if (!typeMatch) {
|
||||
displayTypeError(inputs[i].type);
|
||||
}
|
||||
|
||||
var formatter = inputTypes[j - 1].format;
|
||||
var toAppend = "";
|
||||
|
||||
if (arrayType(inputs[i].type))
|
||||
toAppend = params[i].reduce(function (acc, curr) {
|
||||
return acc + formatter(curr);
|
||||
}, "");
|
||||
else
|
||||
toAppend = formatter(params[i]);
|
||||
|
||||
bytes += toAppend;
|
||||
});
|
||||
return bytes;
|
||||
};
|
||||
|
||||
var dynamicBytesLength = function (type) {
|
||||
if (arrayType(type) || type === 'string') // only string itself that is dynamic; stringX is static length.
|
||||
return c.ETH_PADDING * 2;
|
||||
return 0;
|
||||
};
|
||||
|
||||
var outputTypes = types.outputTypes();
|
||||
|
||||
/// Formats output bytes back to param list
|
||||
/// @param contract abi method outputs
|
||||
/// @param bytes representtion of output
|
||||
/// @returns array of output params
|
||||
var formatOutput = function (outs, output) {
|
||||
|
||||
output = output.slice(2);
|
||||
var result = [];
|
||||
var padding = c.ETH_PADDING * 2;
|
||||
|
||||
var dynamicPartLength = outs.reduce(function (acc, curr) {
|
||||
return acc + dynamicBytesLength(curr.type);
|
||||
}, 0);
|
||||
|
||||
var dynamicPart = output.slice(0, dynamicPartLength);
|
||||
output = output.slice(dynamicPartLength);
|
||||
|
||||
outs.forEach(function (out, i) {
|
||||
var typeMatch = false;
|
||||
for (var j = 0; j < outputTypes.length && !typeMatch; j++) {
|
||||
typeMatch = outputTypes[j].type(outs[i].type);
|
||||
}
|
||||
|
||||
if (!typeMatch) {
|
||||
displayTypeError(outs[i].type);
|
||||
}
|
||||
|
||||
var formatter = outputTypes[j - 1].format;
|
||||
if (arrayType(outs[i].type)) {
|
||||
var size = f.formatOutputUInt(dynamicPart.slice(0, padding));
|
||||
dynamicPart = dynamicPart.slice(padding);
|
||||
var array = [];
|
||||
for (var k = 0; k < size; k++) {
|
||||
array.push(formatter(output.slice(0, padding)));
|
||||
output = output.slice(padding);
|
||||
}
|
||||
result.push(array);
|
||||
}
|
||||
else if (types.prefixedType('string')(outs[i].type)) {
|
||||
dynamicPart = dynamicPart.slice(padding);
|
||||
result.push(formatter(output.slice(0, padding)));
|
||||
output = output.slice(padding);
|
||||
} else {
|
||||
result.push(formatter(output.slice(0, padding)));
|
||||
output = output.slice(padding);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/// @param json abi for contract
|
||||
/// @returns input parser object for given json abi
|
||||
/// TODO: refactor creating the parser, do not double logic from contract
|
||||
var inputParser = function (json) {
|
||||
var parser = {};
|
||||
json.forEach(function (method) {
|
||||
var displayName = utils.extractDisplayName(method.name);
|
||||
var typeName = utils.extractTypeName(method.name);
|
||||
|
||||
var impl = function () {
|
||||
var params = Array.prototype.slice.call(arguments);
|
||||
return formatInput(method.inputs, params);
|
||||
};
|
||||
|
||||
if (parser[displayName] === undefined) {
|
||||
parser[displayName] = impl;
|
||||
}
|
||||
|
||||
parser[displayName][typeName] = impl;
|
||||
});
|
||||
|
||||
return parser;
|
||||
};
|
||||
|
||||
/// @param json abi for contract
|
||||
/// @returns output parser for given json abi
|
||||
var outputParser = function (json) {
|
||||
var parser = {};
|
||||
json.forEach(function (method) {
|
||||
|
||||
var displayName = utils.extractDisplayName(method.name);
|
||||
var typeName = utils.extractTypeName(method.name);
|
||||
|
||||
var impl = function (output) {
|
||||
return formatOutput(method.outputs, output);
|
||||
};
|
||||
|
||||
if (parser[displayName] === undefined) {
|
||||
parser[displayName] = impl;
|
||||
}
|
||||
|
||||
parser[displayName][typeName] = impl;
|
||||
});
|
||||
|
||||
return parser;
|
||||
};
|
||||
|
||||
/// @param function/event name for which we want to get signature
|
||||
/// @returns signature of function/event with given name
|
||||
var signatureFromAscii = function (name) {
|
||||
return web3.sha3(web3.fromAscii(name)).slice(0, 2 + c.ETH_SIGNATURE_LENGTH * 2);
|
||||
};
|
||||
|
||||
var eventSignatureFromAscii = function (name) {
|
||||
return web3.sha3(web3.fromAscii(name));
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
inputParser: inputParser,
|
||||
outputParser: outputParser,
|
||||
formatInput: formatInput,
|
||||
formatOutput: formatOutput,
|
||||
signatureFromAscii: signatureFromAscii,
|
||||
eventSignatureFromAscii: eventSignatureFromAscii
|
||||
};
|
||||
|
56
cmd/mist/assets/ext/ethereum.js/lib/const.js
Normal file
56
cmd/mist/assets/ext/ethereum.js/lib/const.js
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file const.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
/// required to define ETH_BIGNUMBER_ROUNDING_MODE
|
||||
if (process.env.NODE_ENV !== 'build') {
|
||||
var BigNumber = require('bignumber.js'); // jshint ignore:line
|
||||
}
|
||||
|
||||
var ETH_UNITS = [
|
||||
'wei',
|
||||
'Kwei',
|
||||
'Mwei',
|
||||
'Gwei',
|
||||
'szabo',
|
||||
'finney',
|
||||
'ether',
|
||||
'grand',
|
||||
'Mether',
|
||||
'Gether',
|
||||
'Tether',
|
||||
'Pether',
|
||||
'Eether',
|
||||
'Zether',
|
||||
'Yether',
|
||||
'Nether',
|
||||
'Dether',
|
||||
'Vether',
|
||||
'Uether'
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
ETH_PADDING: 32,
|
||||
ETH_SIGNATURE_LENGTH: 4,
|
||||
ETH_UNITS: ETH_UNITS,
|
||||
ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }
|
||||
};
|
||||
|
217
cmd/mist/assets/ext/ethereum.js/lib/contract.js
Normal file
217
cmd/mist/assets/ext/ethereum.js/lib/contract.js
Normal file
@ -0,0 +1,217 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file contract.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
var web3 = require('./web3');
|
||||
var abi = require('./abi');
|
||||
var utils = require('./utils');
|
||||
var eventImpl = require('./event');
|
||||
|
||||
var exportNatspecGlobals = function (vars) {
|
||||
// it's used byt natspec.js
|
||||
// TODO: figure out better way to solve this
|
||||
web3._currentContractAbi = vars.abi;
|
||||
web3._currentContractAddress = vars.address;
|
||||
web3._currentContractMethodName = vars.method;
|
||||
web3._currentContractMethodParams = vars.params;
|
||||
};
|
||||
|
||||
var addFunctionRelatedPropertiesToContract = function (contract) {
|
||||
|
||||
contract.call = function (options) {
|
||||
contract._isTransact = false;
|
||||
contract._options = options;
|
||||
return contract;
|
||||
};
|
||||
|
||||
contract.transact = function (options) {
|
||||
contract._isTransact = true;
|
||||
contract._options = options;
|
||||
return contract;
|
||||
};
|
||||
|
||||
contract._options = {};
|
||||
['gas', 'gasPrice', 'value', 'from'].forEach(function(p) {
|
||||
contract[p] = function (v) {
|
||||
contract._options[p] = v;
|
||||
return contract;
|
||||
};
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var addFunctionsToContract = function (contract, desc, address) {
|
||||
var inputParser = abi.inputParser(desc);
|
||||
var outputParser = abi.outputParser(desc);
|
||||
|
||||
// create contract functions
|
||||
utils.filterFunctions(desc).forEach(function (method) {
|
||||
|
||||
var displayName = utils.extractDisplayName(method.name);
|
||||
var typeName = utils.extractTypeName(method.name);
|
||||
|
||||
var impl = function () {
|
||||
var params = Array.prototype.slice.call(arguments);
|
||||
var signature = abi.signatureFromAscii(method.name);
|
||||
var parsed = inputParser[displayName][typeName].apply(null, params);
|
||||
|
||||
var options = contract._options || {};
|
||||
options.to = address;
|
||||
options.data = signature + parsed;
|
||||
|
||||
var isTransact = contract._isTransact === true || (contract._isTransact !== false && !method.constant);
|
||||
var collapse = options.collapse !== false;
|
||||
|
||||
// reset
|
||||
contract._options = {};
|
||||
contract._isTransact = null;
|
||||
|
||||
if (isTransact) {
|
||||
|
||||
exportNatspecGlobals({
|
||||
abi: desc,
|
||||
address: address,
|
||||
method: method.name,
|
||||
params: params
|
||||
});
|
||||
|
||||
// transactions do not have any output, cause we do not know, when they will be processed
|
||||
web3.eth.transact(options);
|
||||
return;
|
||||
}
|
||||
|
||||
var output = web3.eth.call(options);
|
||||
var ret = outputParser[displayName][typeName](output);
|
||||
if (collapse)
|
||||
{
|
||||
if (ret.length === 1)
|
||||
ret = ret[0];
|
||||
else if (ret.length === 0)
|
||||
ret = null;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
if (contract[displayName] === undefined) {
|
||||
contract[displayName] = impl;
|
||||
}
|
||||
|
||||
contract[displayName][typeName] = impl;
|
||||
});
|
||||
};
|
||||
|
||||
var addEventRelatedPropertiesToContract = function (contract, desc, address) {
|
||||
contract.address = address;
|
||||
contract._onWatchEventResult = function (data) {
|
||||
var matchingEvent = event.getMatchingEvent(utils.filterEvents(desc));
|
||||
var parser = eventImpl.outputParser(matchingEvent);
|
||||
return parser(data);
|
||||
};
|
||||
|
||||
Object.defineProperty(contract, 'topic', {
|
||||
get: function() {
|
||||
return utils.filterEvents(desc).map(function (e) {
|
||||
return abi.eventSignatureFromAscii(e.name);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var addEventsToContract = function (contract, desc, address) {
|
||||
// create contract events
|
||||
utils.filterEvents(desc).forEach(function (e) {
|
||||
|
||||
var impl = function () {
|
||||
var params = Array.prototype.slice.call(arguments);
|
||||
var signature = abi.eventSignatureFromAscii(e.name);
|
||||
var event = eventImpl.inputParser(address, signature, e);
|
||||
var o = event.apply(null, params);
|
||||
o._onWatchEventResult = function (data) {
|
||||
var parser = eventImpl.outputParser(e);
|
||||
return parser(data);
|
||||
};
|
||||
return web3.eth.watch(o);
|
||||
};
|
||||
|
||||
// this property should be used by eth.filter to check if object is an event
|
||||
impl._isEvent = true;
|
||||
|
||||
var displayName = utils.extractDisplayName(e.name);
|
||||
var typeName = utils.extractTypeName(e.name);
|
||||
|
||||
if (contract[displayName] === undefined) {
|
||||
contract[displayName] = impl;
|
||||
}
|
||||
|
||||
contract[displayName][typeName] = impl;
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This method should be called when we want to call / transact some solidity method from javascript
|
||||
* it returns an object which has same methods available as solidity contract description
|
||||
* usage example:
|
||||
*
|
||||
* var abi = [{
|
||||
* name: 'myMethod',
|
||||
* inputs: [{ name: 'a', type: 'string' }],
|
||||
* outputs: [{name: 'd', type: 'string' }]
|
||||
* }]; // contract abi
|
||||
*
|
||||
* var myContract = web3.eth.contract('0x0123123121', abi); // creation of contract object
|
||||
*
|
||||
* myContract.myMethod('this is test string param for call'); // myMethod call (implicit, default)
|
||||
* myContract.call().myMethod('this is test string param for call'); // myMethod call (explicit)
|
||||
* myContract.transact().myMethod('this is test string param for transact'); // myMethod transact
|
||||
*
|
||||
* @param address - address of the contract, which should be called
|
||||
* @param desc - abi json description of the contract, which is being created
|
||||
* @returns contract object
|
||||
*/
|
||||
|
||||
var contract = function (address, desc) {
|
||||
|
||||
// workaround for invalid assumption that method.name is the full anonymous prototype of the method.
|
||||
// it's not. it's just the name. the rest of the code assumes it's actually the anonymous
|
||||
// prototype, so we make it so as a workaround.
|
||||
// TODO: we may not want to modify input params, maybe use copy instead?
|
||||
desc.forEach(function (method) {
|
||||
if (method.name.indexOf('(') === -1) {
|
||||
var displayName = method.name;
|
||||
var typeName = method.inputs.map(function(i){return i.type; }).join();
|
||||
method.name = displayName + '(' + typeName + ')';
|
||||
}
|
||||
});
|
||||
|
||||
var result = {};
|
||||
addFunctionRelatedPropertiesToContract(result);
|
||||
addFunctionsToContract(result, desc, address);
|
||||
addEventRelatedPropertiesToContract(result, desc, address);
|
||||
addEventsToContract(result, desc, address);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
module.exports = contract;
|
||||
|
135
cmd/mist/assets/ext/ethereum.js/lib/event.js
Normal file
135
cmd/mist/assets/ext/ethereum.js/lib/event.js
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file event.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
var abi = require('./abi');
|
||||
var utils = require('./utils');
|
||||
|
||||
/// filter inputs array && returns only indexed (or not) inputs
|
||||
/// @param inputs array
|
||||
/// @param bool if result should be an array of indexed params on not
|
||||
/// @returns array of (not?) indexed params
|
||||
var filterInputs = function (inputs, indexed) {
|
||||
return inputs.filter(function (current) {
|
||||
return current.indexed === indexed;
|
||||
});
|
||||
};
|
||||
|
||||
var inputWithName = function (inputs, name) {
|
||||
var index = utils.findIndex(inputs, function (input) {
|
||||
return input.name === name;
|
||||
});
|
||||
|
||||
if (index === -1) {
|
||||
console.error('indexed param with name ' + name + ' not found');
|
||||
return undefined;
|
||||
}
|
||||
return inputs[index];
|
||||
};
|
||||
|
||||
var indexedParamsToTopics = function (event, indexed) {
|
||||
// sort keys?
|
||||
return Object.keys(indexed).map(function (key) {
|
||||
var inputs = [inputWithName(filterInputs(event.inputs, true), key)];
|
||||
|
||||
var value = indexed[key];
|
||||
if (value instanceof Array) {
|
||||
return value.map(function (v) {
|
||||
return abi.formatInput(inputs, [v]);
|
||||
});
|
||||
}
|
||||
return abi.formatInput(inputs, [value]);
|
||||
});
|
||||
};
|
||||
|
||||
var inputParser = function (address, signature, event) {
|
||||
|
||||
// valid options are 'earliest', 'latest', 'offset' and 'max', as defined for 'eth.watch'
|
||||
return function (indexed, options) {
|
||||
var o = options || {};
|
||||
o.address = address;
|
||||
o.topic = [];
|
||||
o.topic.push(signature);
|
||||
if (indexed) {
|
||||
o.topic = o.topic.concat(indexedParamsToTopics(event, indexed));
|
||||
}
|
||||
return o;
|
||||
};
|
||||
};
|
||||
|
||||
var getArgumentsObject = function (inputs, indexed, notIndexed) {
|
||||
var indexedCopy = indexed.slice();
|
||||
var notIndexedCopy = notIndexed.slice();
|
||||
return inputs.reduce(function (acc, current) {
|
||||
var value;
|
||||
if (current.indexed)
|
||||
value = indexed.splice(0, 1)[0];
|
||||
else
|
||||
value = notIndexed.splice(0, 1)[0];
|
||||
|
||||
acc[current.name] = value;
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
|
||||
var outputParser = function (event) {
|
||||
|
||||
return function (output) {
|
||||
var result = {
|
||||
event: utils.extractDisplayName(event.name),
|
||||
number: output.number,
|
||||
args: {}
|
||||
};
|
||||
|
||||
if (!output.topic) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var indexedOutputs = filterInputs(event.inputs, true);
|
||||
var indexedData = "0x" + output.topic.slice(1, output.topic.length).map(function (topic) { return topic.slice(2); }).join("");
|
||||
var indexedRes = abi.formatOutput(indexedOutputs, indexedData);
|
||||
|
||||
var notIndexedOutputs = filterInputs(event.inputs, false);
|
||||
var notIndexedRes = abi.formatOutput(notIndexedOutputs, output.data);
|
||||
|
||||
result.args = getArgumentsObject(event.inputs, indexedRes, notIndexedRes);
|
||||
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
var getMatchingEvent = function (events, payload) {
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
var signature = abi.eventSignatureFromAscii(events[i].name);
|
||||
if (signature === payload.topic[0]) {
|
||||
return events[i];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
inputParser: inputParser,
|
||||
outputParser: outputParser,
|
||||
getMatchingEvent: getMatchingEvent
|
||||
};
|
||||
|
101
cmd/mist/assets/ext/ethereum.js/lib/filter.js
Normal file
101
cmd/mist/assets/ext/ethereum.js/lib/filter.js
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file filter.js
|
||||
* @authors:
|
||||
* Jeffrey Wilcke <jeff@ethdev.com>
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* Marian Oancea <marian@ethdev.com>
|
||||
* Gav Wood <g@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
var web3 = require('./web3'); // jshint ignore:line
|
||||
|
||||
/// should be used when we want to watch something
|
||||
/// it's using inner polling mechanism and is notified about changes
|
||||
/// TODO: change 'options' name cause it may be not the best matching one, since we have events
|
||||
var Filter = function(options, impl) {
|
||||
|
||||
if (typeof options !== "string") {
|
||||
|
||||
// topics property is deprecated, warn about it!
|
||||
if (options.topics) {
|
||||
console.warn('"topics" is deprecated, use "topic" instead');
|
||||
}
|
||||
|
||||
this._onWatchResult = options._onWatchEventResult;
|
||||
|
||||
// evaluate lazy properties
|
||||
options = {
|
||||
to: options.to,
|
||||
topic: options.topic,
|
||||
earliest: options.earliest,
|
||||
latest: options.latest,
|
||||
max: options.max,
|
||||
skip: options.skip,
|
||||
address: options.address
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
this.impl = impl;
|
||||
this.callbacks = [];
|
||||
|
||||
this.id = impl.newFilter(options);
|
||||
web3.provider.startPolling({method: impl.changed, params: [this.id]}, this.id, this.trigger.bind(this));
|
||||
};
|
||||
|
||||
/// alias for changed*
|
||||
Filter.prototype.arrived = function(callback) {
|
||||
this.changed(callback);
|
||||
};
|
||||
Filter.prototype.happened = function(callback) {
|
||||
this.changed(callback);
|
||||
};
|
||||
|
||||
/// gets called when there is new eth/shh message
|
||||
Filter.prototype.changed = function(callback) {
|
||||
this.callbacks.push(callback);
|
||||
};
|
||||
|
||||
/// trigger calling new message from people
|
||||
Filter.prototype.trigger = function(messages) {
|
||||
for (var i = 0; i < this.callbacks.length; i++) {
|
||||
for (var j = 0; j < messages.length; j++) {
|
||||
var message = this._onWatchResult ? this._onWatchResult(messages[j]) : messages[j];
|
||||
this.callbacks[i].call(this, message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// should be called to uninstall current filter
|
||||
Filter.prototype.uninstall = function() {
|
||||
this.impl.uninstallFilter(this.id);
|
||||
web3.provider.stopPolling(this.id);
|
||||
};
|
||||
|
||||
/// should be called to manually trigger getting latest messages from the client
|
||||
Filter.prototype.messages = function() {
|
||||
return this.impl.getMessages(this.id);
|
||||
};
|
||||
|
||||
/// alias for messages
|
||||
Filter.prototype.logs = function () {
|
||||
return this.messages();
|
||||
};
|
||||
|
||||
module.exports = Filter;
|
154
cmd/mist/assets/ext/ethereum.js/lib/formatters.js
Normal file
154
cmd/mist/assets/ext/ethereum.js/lib/formatters.js
Normal file
@ -0,0 +1,154 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file formatters.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
if (process.env.NODE_ENV !== 'build') {
|
||||
var BigNumber = require('bignumber.js'); // jshint ignore:line
|
||||
}
|
||||
|
||||
var utils = require('./utils');
|
||||
var c = require('./const');
|
||||
|
||||
/// @param string string to be padded
|
||||
/// @param number of characters that result string should have
|
||||
/// @param sign, by default 0
|
||||
/// @returns right aligned string
|
||||
var padLeft = function (string, chars, sign) {
|
||||
return new Array(chars - string.length + 1).join(sign ? sign : "0") + string;
|
||||
};
|
||||
|
||||
/// Formats input value to byte representation of int
|
||||
/// If value is negative, return it's two's complement
|
||||
/// If the value is floating point, round it down
|
||||
/// @returns right-aligned byte representation of int
|
||||
var formatInputInt = function (value) {
|
||||
var padding = c.ETH_PADDING * 2;
|
||||
if (value instanceof BigNumber || typeof value === 'number') {
|
||||
if (typeof value === 'number')
|
||||
value = new BigNumber(value);
|
||||
BigNumber.config(c.ETH_BIGNUMBER_ROUNDING_MODE);
|
||||
value = value.round();
|
||||
|
||||
if (value.lessThan(0))
|
||||
value = new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).plus(value).plus(1);
|
||||
value = value.toString(16);
|
||||
}
|
||||
else if (value.indexOf('0x') === 0)
|
||||
value = value.substr(2);
|
||||
else if (typeof value === 'string')
|
||||
value = formatInputInt(new BigNumber(value));
|
||||
else
|
||||
value = (+value).toString(16);
|
||||
return padLeft(value, padding);
|
||||
};
|
||||
|
||||
/// Formats input value to byte representation of string
|
||||
/// @returns left-algined byte representation of string
|
||||
var formatInputString = function (value) {
|
||||
return utils.fromAscii(value, c.ETH_PADDING).substr(2);
|
||||
};
|
||||
|
||||
/// Formats input value to byte representation of bool
|
||||
/// @returns right-aligned byte representation bool
|
||||
var formatInputBool = function (value) {
|
||||
return '000000000000000000000000000000000000000000000000000000000000000' + (value ? '1' : '0');
|
||||
};
|
||||
|
||||
/// Formats input value to byte representation of real
|
||||
/// Values are multiplied by 2^m and encoded as integers
|
||||
/// @returns byte representation of real
|
||||
var formatInputReal = function (value) {
|
||||
return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128)));
|
||||
};
|
||||
|
||||
|
||||
/// Check if input value is negative
|
||||
/// @param value is hex format
|
||||
/// @returns true if it is negative, otherwise false
|
||||
var signedIsNegative = function (value) {
|
||||
return (new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1)) === '1';
|
||||
};
|
||||
|
||||
/// Formats input right-aligned input bytes to int
|
||||
/// @returns right-aligned input bytes formatted to int
|
||||
var formatOutputInt = function (value) {
|
||||
value = value || "0";
|
||||
// check if it's negative number
|
||||
// it it is, return two's complement
|
||||
if (signedIsNegative(value)) {
|
||||
return new BigNumber(value, 16).minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)).minus(1);
|
||||
}
|
||||
return new BigNumber(value, 16);
|
||||
};
|
||||
|
||||
/// Formats big right-aligned input bytes to uint
|
||||
/// @returns right-aligned input bytes formatted to uint
|
||||
var formatOutputUInt = function (value) {
|
||||
value = value || "0";
|
||||
return new BigNumber(value, 16);
|
||||
};
|
||||
|
||||
/// @returns input bytes formatted to real
|
||||
var formatOutputReal = function (value) {
|
||||
return formatOutputInt(value).dividedBy(new BigNumber(2).pow(128));
|
||||
};
|
||||
|
||||
/// @returns input bytes formatted to ureal
|
||||
var formatOutputUReal = function (value) {
|
||||
return formatOutputUInt(value).dividedBy(new BigNumber(2).pow(128));
|
||||
};
|
||||
|
||||
/// @returns right-aligned input bytes formatted to hex
|
||||
var formatOutputHash = function (value) {
|
||||
return "0x" + value;
|
||||
};
|
||||
|
||||
/// @returns right-aligned input bytes formatted to bool
|
||||
var formatOutputBool = function (value) {
|
||||
return value === '0000000000000000000000000000000000000000000000000000000000000001' ? true : false;
|
||||
};
|
||||
|
||||
/// @returns left-aligned input bytes formatted to ascii string
|
||||
var formatOutputString = function (value) {
|
||||
return utils.toAscii(value);
|
||||
};
|
||||
|
||||
/// @returns right-aligned input bytes formatted to address
|
||||
var formatOutputAddress = function (value) {
|
||||
return "0x" + value.slice(value.length - 40, value.length);
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
formatInputInt: formatInputInt,
|
||||
formatInputString: formatInputString,
|
||||
formatInputBool: formatInputBool,
|
||||
formatInputReal: formatInputReal,
|
||||
formatOutputInt: formatOutputInt,
|
||||
formatOutputUInt: formatOutputUInt,
|
||||
formatOutputReal: formatOutputReal,
|
||||
formatOutputUReal: formatOutputUReal,
|
||||
formatOutputHash: formatOutputHash,
|
||||
formatOutputBool: formatOutputBool,
|
||||
formatOutputString: formatOutputString,
|
||||
formatOutputAddress: formatOutputAddress
|
||||
};
|
||||
|
46
cmd/mist/assets/ext/ethereum.js/lib/httpsync.js
Normal file
46
cmd/mist/assets/ext/ethereum.js/lib/httpsync.js
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file httpsync.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* Marian Oancea <marian@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
if (process.env.NODE_ENV !== 'build') {
|
||||
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line
|
||||
}
|
||||
|
||||
var HttpSyncProvider = function (host) {
|
||||
this.handlers = [];
|
||||
this.host = host || 'http://localhost:8080';
|
||||
};
|
||||
|
||||
HttpSyncProvider.prototype.send = function (payload) {
|
||||
//var data = formatJsonRpcObject(payload);
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('POST', this.host, false);
|
||||
request.send(JSON.stringify(payload));
|
||||
|
||||
// check request.status
|
||||
var result = request.responseText;
|
||||
return JSON.parse(result);
|
||||
};
|
||||
|
||||
module.exports = HttpSyncProvider;
|
||||
|
65
cmd/mist/assets/ext/ethereum.js/lib/jsonrpc.js
Normal file
65
cmd/mist/assets/ext/ethereum.js/lib/jsonrpc.js
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file jsonrpc.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
var messageId = 1;
|
||||
|
||||
/// Should be called to valid json create payload object
|
||||
/// @param method of jsonrpc call, required
|
||||
/// @param params, an array of method params, optional
|
||||
/// @returns valid jsonrpc payload object
|
||||
var toPayload = function (method, params) {
|
||||
if (!method)
|
||||
console.error('jsonrpc method should be specified!');
|
||||
|
||||
return {
|
||||
jsonrpc: '2.0',
|
||||
method: method,
|
||||
params: params || [],
|
||||
id: messageId++
|
||||
};
|
||||
};
|
||||
|
||||
/// Should be called to check if jsonrpc response is valid
|
||||
/// @returns true if response is valid, otherwise false
|
||||
var isValidResponse = function (response) {
|
||||
return !!response &&
|
||||
!response.error &&
|
||||
response.jsonrpc === '2.0' &&
|
||||
typeof response.id === 'number' &&
|
||||
response.result !== undefined; // only undefined is not valid json object
|
||||
};
|
||||
|
||||
/// Should be called to create batch payload object
|
||||
/// @param messages, an array of objects with method (required) and params (optional) fields
|
||||
var toBatchPayload = function (messages) {
|
||||
return messages.map(function (message) {
|
||||
return toPayload(message.method, message.params);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
toPayload: toPayload,
|
||||
isValidResponse: isValidResponse,
|
||||
toBatchPayload: toBatchPayload
|
||||
};
|
||||
|
||||
|
18
cmd/mist/assets/ext/ethereum.js/lib/local.js
Normal file
18
cmd/mist/assets/ext/ethereum.js/lib/local.js
Normal file
@ -0,0 +1,18 @@
|
||||
var addressName = {"0x12378912345789": "Gav", "0x57835893478594739854": "Jeff"};
|
||||
var nameAddress = {};
|
||||
|
||||
for (var prop in addressName) {
|
||||
if (addressName.hasOwnProperty(prop)) {
|
||||
nameAddress[addressName[prop]] = prop;
|
||||
}
|
||||
}
|
||||
|
||||
var local = {
|
||||
addressBook:{
|
||||
byName: addressName,
|
||||
byAddress: nameAddress
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof(module) !== "undefined")
|
||||
module.exports = local;
|
102
cmd/mist/assets/ext/ethereum.js/lib/providermanager.js
Normal file
102
cmd/mist/assets/ext/ethereum.js/lib/providermanager.js
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file providermanager.js
|
||||
* @authors:
|
||||
* Jeffrey Wilcke <jeff@ethdev.com>
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* Marian Oancea <marian@ethdev.com>
|
||||
* Gav Wood <g@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
var web3 = require('./web3');
|
||||
var jsonrpc = require('./jsonrpc');
|
||||
|
||||
|
||||
/**
|
||||
* Provider manager object prototype
|
||||
* It's responsible for passing messages to providers
|
||||
* If no provider is set it's responsible for queuing requests
|
||||
* It's also responsible for polling the ethereum node for incoming messages
|
||||
* Default poll timeout is 12 seconds
|
||||
* If we are running ethereum.js inside ethereum browser, there are backend based tools responsible for polling,
|
||||
* and provider manager polling mechanism is not used
|
||||
*/
|
||||
var ProviderManager = function() {
|
||||
this.polls = [];
|
||||
this.provider = undefined;
|
||||
|
||||
var self = this;
|
||||
var poll = function () {
|
||||
self.polls.forEach(function (data) {
|
||||
var result = self.send(data.data);
|
||||
|
||||
if (!(result instanceof Array) || result.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
data.callback(result);
|
||||
});
|
||||
|
||||
setTimeout(poll, 1000);
|
||||
};
|
||||
poll();
|
||||
};
|
||||
|
||||
/// sends outgoing requests
|
||||
/// @params data - an object with at least 'method' property
|
||||
ProviderManager.prototype.send = function(data) {
|
||||
var payload = jsonrpc.toPayload(data.method, data.params);
|
||||
|
||||
if (this.provider === undefined) {
|
||||
console.error('provider is not set');
|
||||
return null;
|
||||
}
|
||||
|
||||
var result = this.provider.send(payload);
|
||||
|
||||
if (!jsonrpc.isValidResponse(result)) {
|
||||
console.log(result);
|
||||
return null;
|
||||
}
|
||||
|
||||
return result.result;
|
||||
};
|
||||
|
||||
/// setups provider, which will be used for sending messages
|
||||
ProviderManager.prototype.set = function(provider) {
|
||||
this.provider = provider;
|
||||
};
|
||||
|
||||
/// this method is only used, when we do not have native qt bindings and have to do polling on our own
|
||||
/// should be callled, on start watching for eth/shh changes
|
||||
ProviderManager.prototype.startPolling = function (data, pollId, callback) {
|
||||
this.polls.push({data: data, id: pollId, callback: callback});
|
||||
};
|
||||
|
||||
/// should be called to stop polling for certain watch changes
|
||||
ProviderManager.prototype.stopPolling = function (pollId) {
|
||||
for (var i = this.polls.length; i--;) {
|
||||
var poll = this.polls[i];
|
||||
if (poll.id === pollId) {
|
||||
this.polls.splice(i, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ProviderManager;
|
||||
|
33
cmd/mist/assets/ext/ethereum.js/lib/qtsync.js
Normal file
33
cmd/mist/assets/ext/ethereum.js/lib/qtsync.js
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file qtsync.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* Marian Oancea <marian@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
var QtSyncProvider = function () {
|
||||
};
|
||||
|
||||
QtSyncProvider.prototype.send = function (payload) {
|
||||
var result = navigator.qt.callMethod(JSON.stringify(payload));
|
||||
return JSON.parse(result);
|
||||
};
|
||||
|
||||
module.exports = QtSyncProvider;
|
||||
|
79
cmd/mist/assets/ext/ethereum.js/lib/types.js
Normal file
79
cmd/mist/assets/ext/ethereum.js/lib/types.js
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file types.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
var f = require('./formatters');
|
||||
|
||||
/// @param expected type prefix (string)
|
||||
/// @returns function which checks if type has matching prefix. if yes, returns true, otherwise false
|
||||
var prefixedType = function (prefix) {
|
||||
return function (type) {
|
||||
return type.indexOf(prefix) === 0;
|
||||
};
|
||||
};
|
||||
|
||||
/// @param expected type name (string)
|
||||
/// @returns function which checks if type is matching expected one. if yes, returns true, otherwise false
|
||||
var namedType = function (name) {
|
||||
return function (type) {
|
||||
return name === type;
|
||||
};
|
||||
};
|
||||
|
||||
/// Setups input formatters for solidity types
|
||||
/// @returns an array of input formatters
|
||||
var inputTypes = function () {
|
||||
|
||||
return [
|
||||
{ type: prefixedType('uint'), format: f.formatInputInt },
|
||||
{ type: prefixedType('int'), format: f.formatInputInt },
|
||||
{ type: prefixedType('hash'), format: f.formatInputInt },
|
||||
{ type: prefixedType('string'), format: f.formatInputString },
|
||||
{ type: prefixedType('real'), format: f.formatInputReal },
|
||||
{ type: prefixedType('ureal'), format: f.formatInputReal },
|
||||
{ type: namedType('address'), format: f.formatInputInt },
|
||||
{ type: namedType('bool'), format: f.formatInputBool }
|
||||
];
|
||||
};
|
||||
|
||||
/// Setups output formaters for solidity types
|
||||
/// @returns an array of output formatters
|
||||
var outputTypes = function () {
|
||||
|
||||
return [
|
||||
{ type: prefixedType('uint'), format: f.formatOutputUInt },
|
||||
{ type: prefixedType('int'), format: f.formatOutputInt },
|
||||
{ type: prefixedType('hash'), format: f.formatOutputHash },
|
||||
{ type: prefixedType('string'), format: f.formatOutputString },
|
||||
{ type: prefixedType('real'), format: f.formatOutputReal },
|
||||
{ type: prefixedType('ureal'), format: f.formatOutputUReal },
|
||||
{ type: namedType('address'), format: f.formatOutputAddress },
|
||||
{ type: namedType('bool'), format: f.formatOutputBool }
|
||||
];
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
prefixedType: prefixedType,
|
||||
namedType: namedType,
|
||||
inputTypes: inputTypes,
|
||||
outputTypes: outputTypes
|
||||
};
|
||||
|
142
cmd/mist/assets/ext/ethereum.js/lib/utils.js
Normal file
142
cmd/mist/assets/ext/ethereum.js/lib/utils.js
Normal file
@ -0,0 +1,142 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file utils.js
|
||||
* @authors:
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2015
|
||||
*/
|
||||
|
||||
var c = require('./const');
|
||||
|
||||
/// Finds first index of array element matching pattern
|
||||
/// @param array
|
||||
/// @param callback pattern
|
||||
/// @returns index of element
|
||||
var findIndex = function (array, callback) {
|
||||
var end = false;
|
||||
var i = 0;
|
||||
for (; i < array.length && !end; i++) {
|
||||
end = callback(array[i]);
|
||||
}
|
||||
return end ? i - 1 : -1;
|
||||
};
|
||||
|
||||
/// @returns ascii string representation of hex value prefixed with 0x
|
||||
var toAscii = function(hex) {
|
||||
// Find termination
|
||||
var str = "";
|
||||
var i = 0, l = hex.length;
|
||||
if (hex.substring(0, 2) === '0x') {
|
||||
i = 2;
|
||||
}
|
||||
for (; i < l; i+=2) {
|
||||
var code = parseInt(hex.substr(i, 2), 16);
|
||||
if (code === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
str += String.fromCharCode(code);
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
var toHex = function(str) {
|
||||
var hex = "";
|
||||
for(var i = 0; i < str.length; i++) {
|
||||
var n = str.charCodeAt(i).toString(16);
|
||||
hex += n.length < 2 ? '0' + n : n;
|
||||
}
|
||||
|
||||
return hex;
|
||||
};
|
||||
|
||||
/// @returns hex representation (prefixed by 0x) of ascii string
|
||||
var fromAscii = function(str, pad) {
|
||||
pad = pad === undefined ? 0 : pad;
|
||||
var hex = toHex(str);
|
||||
while (hex.length < pad*2)
|
||||
hex += "00";
|
||||
return "0x" + hex;
|
||||
};
|
||||
|
||||
/// @returns display name for function/event eg. multiply(uint256) -> multiply
|
||||
var extractDisplayName = function (name) {
|
||||
var length = name.indexOf('(');
|
||||
return length !== -1 ? name.substr(0, length) : name;
|
||||
};
|
||||
|
||||
/// @returns overloaded part of function/event name
|
||||
var extractTypeName = function (name) {
|
||||
/// TODO: make it invulnerable
|
||||
var length = name.indexOf('(');
|
||||
return length !== -1 ? name.substr(length + 1, name.length - 1 - (length + 1)).replace(' ', '') : "";
|
||||
};
|
||||
|
||||
/// Filters all function from input abi
|
||||
/// @returns abi array with filtered objects of type 'function'
|
||||
var filterFunctions = function (json) {
|
||||
return json.filter(function (current) {
|
||||
return current.type === 'function';
|
||||
});
|
||||
};
|
||||
|
||||
/// Filters all events form input abi
|
||||
/// @returns abi array with filtered objects of type 'event'
|
||||
var filterEvents = function (json) {
|
||||
return json.filter(function (current) {
|
||||
return current.type === 'event';
|
||||
});
|
||||
};
|
||||
|
||||
/// used to transform value/string to eth string
|
||||
/// TODO: use BigNumber.js to parse int
|
||||
/// TODO: add tests for it!
|
||||
var toEth = function (str) {
|
||||
var val = typeof str === "string" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;
|
||||
var unit = 0;
|
||||
var units = c.ETH_UNITS;
|
||||
while (val > 3000 && unit < units.length - 1)
|
||||
{
|
||||
val /= 1000;
|
||||
unit++;
|
||||
}
|
||||
var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);
|
||||
var replaceFunction = function($0, $1, $2) {
|
||||
return $1 + ',' + $2;
|
||||
};
|
||||
|
||||
while (true) {
|
||||
var o = s;
|
||||
s = s.replace(/(\d)(\d\d\d[\.\,])/, replaceFunction);
|
||||
if (o === s)
|
||||
break;
|
||||
}
|
||||
return s + ' ' + units[unit];
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
findIndex: findIndex,
|
||||
toAscii: toAscii,
|
||||
fromAscii: fromAscii,
|
||||
extractDisplayName: extractDisplayName,
|
||||
extractTypeName: extractTypeName,
|
||||
filterFunctions: filterFunctions,
|
||||
filterEvents: filterEvents,
|
||||
toEth: toEth
|
||||
};
|
||||
|
256
cmd/mist/assets/ext/ethereum.js/lib/web3.js
Normal file
256
cmd/mist/assets/ext/ethereum.js/lib/web3.js
Normal file
@ -0,0 +1,256 @@
|
||||
/*
|
||||
This file is part of ethereum.js.
|
||||
|
||||
ethereum.js is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
ethereum.js is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @file web3.js
|
||||
* @authors:
|
||||
* Jeffrey Wilcke <jeff@ethdev.com>
|
||||
* Marek Kotewicz <marek@ethdev.com>
|
||||
* Marian Oancea <marian@ethdev.com>
|
||||
* Gav Wood <g@ethdev.com>
|
||||
* @date 2014
|
||||
*/
|
||||
|
||||
if (process.env.NODE_ENV !== 'build') {
|
||||
var BigNumber = require('bignumber.js');
|
||||
}
|
||||
|
||||
var utils = require('./utils');
|
||||
|
||||
/// @returns an array of objects describing web3 api methods
|
||||
var web3Methods = function () {
|
||||
return [
|
||||
{ name: 'sha3', call: 'web3_sha3' }
|
||||
];
|
||||
};
|
||||
|
||||
/// @returns an array of objects describing web3.eth api methods
|
||||
var ethMethods = function () {
|
||||
var blockCall = function (args) {
|
||||
return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber";
|
||||
};
|
||||
|
||||
var transactionCall = function (args) {
|
||||
return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber';
|
||||
};
|
||||
|
||||
var uncleCall = function (args) {
|
||||
return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber';
|
||||
};
|
||||
|
||||
var methods = [
|
||||
{ name: 'balanceAt', call: 'eth_balanceAt' },
|
||||
{ name: 'stateAt', call: 'eth_stateAt' },
|
||||
{ name: 'storageAt', call: 'eth_storageAt' },
|
||||
{ name: 'countAt', call: 'eth_countAt'},
|
||||
{ name: 'codeAt', call: 'eth_codeAt' },
|
||||
{ name: 'transact', call: 'eth_transact' },
|
||||
{ name: 'call', call: 'eth_call' },
|
||||
{ name: 'block', call: blockCall },
|
||||
{ name: 'transaction', call: transactionCall },
|
||||
{ name: 'uncle', call: uncleCall },
|
||||
{ name: 'compilers', call: 'eth_compilers' },
|
||||
{ name: 'flush', call: 'eth_flush' },
|
||||
{ name: 'lll', call: 'eth_lll' },
|
||||
{ name: 'solidity', call: 'eth_solidity' },
|
||||
{ name: 'serpent', call: 'eth_serpent' },
|
||||
{ name: 'logs', call: 'eth_logs' }
|
||||
];
|
||||
return methods;
|
||||
};
|
||||
|
||||
/// @returns an array of objects describing web3.eth api properties
|
||||
var ethProperties = function () {
|
||||
return [
|
||||
{ name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },
|
||||
{ name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },
|
||||
{ name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },
|
||||
{ name: 'gasPrice', getter: 'eth_gasPrice' },
|
||||
{ name: 'accounts', getter: 'eth_accounts' },
|
||||
{ name: 'peerCount', getter: 'eth_peerCount' },
|
||||
{ name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },
|
||||
{ name: 'number', getter: 'eth_number'}
|
||||
];
|
||||
};
|
||||
|
||||
/// @returns an array of objects describing web3.db api methods
|
||||
var dbMethods = function () {
|
||||
return [
|
||||
{ name: 'put', call: 'db_put' },
|
||||
{ name: 'get', call: 'db_get' },
|
||||
{ name: 'putString', call: 'db_putString' },
|
||||
{ name: 'getString', call: 'db_getString' }
|
||||
];
|
||||
};
|
||||
|
||||
/// @returns an array of objects describing web3.shh api methods
|
||||
var shhMethods = function () {
|
||||
return [
|
||||
{ name: 'post', call: 'shh_post' },
|
||||
{ name: 'newIdentity', call: 'shh_newIdentity' },
|
||||
{ name: 'haveIdentity', call: 'shh_haveIdentity' },
|
||||
{ name: 'newGroup', call: 'shh_newGroup' },
|
||||
{ name: 'addToGroup', call: 'shh_addToGroup' }
|
||||
];
|
||||
};
|
||||
|
||||
/// @returns an array of objects describing web3.eth.watch api methods
|
||||
var ethWatchMethods = function () {
|
||||
var newFilter = function (args) {
|
||||
return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';
|
||||
};
|
||||
|
||||
return [
|
||||
{ name: 'newFilter', call: newFilter },
|
||||
{ name: 'uninstallFilter', call: 'eth_uninstallFilter' },
|
||||
{ name: 'getMessages', call: 'eth_filterLogs' }
|
||||
];
|
||||
};
|
||||
|
||||
/// @returns an array of objects describing web3.shh.watch api methods
|
||||
var shhWatchMethods = function () {
|
||||
return [
|
||||
{ name: 'newFilter', call: 'shh_newFilter' },
|
||||
{ name: 'uninstallFilter', call: 'shh_uninstallFilter' },
|
||||
{ name: 'getMessages', call: 'shh_getMessages' }
|
||||
];
|
||||
};
|
||||
|
||||
/// creates methods in a given object based on method description on input
|
||||
/// setups api calls for these methods
|
||||
var setupMethods = function (obj, methods) {
|
||||
methods.forEach(function (method) {
|
||||
obj[method.name] = function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var call = typeof method.call === 'function' ? method.call(args) : method.call;
|
||||
return web3.provider.send({
|
||||
method: call,
|
||||
params: args
|
||||
});
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/// creates properties in a given object based on properties description on input
|
||||
/// setups api calls for these properties
|
||||
var setupProperties = function (obj, properties) {
|
||||
properties.forEach(function (property) {
|
||||
var proto = {};
|
||||
proto.get = function () {
|
||||
return web3.provider.send({
|
||||
method: property.getter
|
||||
});
|
||||
};
|
||||
|
||||
if (property.setter) {
|
||||
proto.set = function (val) {
|
||||
return web3.provider.send({
|
||||
method: property.setter,
|
||||
params: [val]
|
||||
});
|
||||
};
|
||||
}
|
||||
Object.defineProperty(obj, property.name, proto);
|
||||
});
|
||||
};
|
||||
|
||||
/// setups web3 object, and it's in-browser executed methods
|
||||
var web3 = {
|
||||
_callbacks: {},
|
||||
_events: {},
|
||||
providers: {},
|
||||
|
||||
/// @returns ascii string representation of hex value prefixed with 0x
|
||||
toAscii: utils.toAscii,
|
||||
|
||||
/// @returns hex representation (prefixed by 0x) of ascii string
|
||||
fromAscii: utils.fromAscii,
|
||||
|
||||
/// @returns decimal representaton of hex value prefixed by 0x
|
||||
toDecimal: function (val) {
|
||||
// remove 0x and place 0, if it's required
|
||||
val = val.length > 2 ? val.substring(2) : "0";
|
||||
return (new BigNumber(val, 16).toString(10));
|
||||
},
|
||||
|
||||
/// @returns hex representation (prefixed by 0x) of decimal value
|
||||
fromDecimal: function (val) {
|
||||
return "0x" + (new BigNumber(val).toString(16));
|
||||
},
|
||||
|
||||
/// used to transform value/string to eth string
|
||||
toEth: utils.toEth,
|
||||
|
||||
/// eth object prototype
|
||||
eth: {
|
||||
contractFromAbi: function (abi) {
|
||||
return function(addr) {
|
||||
// Default to address of Config. TODO: rremove prior to genesis.
|
||||
addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b';
|
||||
var ret = web3.eth.contract(addr, abi);
|
||||
ret.address = addr;
|
||||
return ret;
|
||||
};
|
||||
},
|
||||
|
||||
/// @param filter may be a string, object or event
|
||||
/// @param indexed is optional, this is an object with optional event indexed params
|
||||
/// @param options is optional, this is an object with optional event options ('max'...)
|
||||
watch: function (filter, indexed, options) {
|
||||
if (filter._isEvent) {
|
||||
return filter(indexed, options);
|
||||
}
|
||||
return new web3.filter(filter, ethWatch);
|
||||
}
|
||||
},
|
||||
|
||||
/// db object prototype
|
||||
db: {},
|
||||
|
||||
/// shh object prototype
|
||||
shh: {
|
||||
|
||||
/// @param filter may be a string, object or event
|
||||
watch: function (filter, indexed) {
|
||||
return new web3.filter(filter, shhWatch);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/// setups all api methods
|
||||
setupMethods(web3, web3Methods());
|
||||
setupMethods(web3.eth, ethMethods());
|
||||
setupProperties(web3.eth, ethProperties());
|
||||
setupMethods(web3.db, dbMethods());
|
||||
setupMethods(web3.shh, shhMethods());
|
||||
|
||||
var ethWatch = {
|
||||
changed: 'eth_changed'
|
||||
};
|
||||
|
||||
setupMethods(ethWatch, ethWatchMethods());
|
||||
|
||||
var shhWatch = {
|
||||
changed: 'shh_changed'
|
||||
};
|
||||
|
||||
setupMethods(shhWatch, shhWatchMethods());
|
||||
|
||||
web3.setProvider = function(provider) {
|
||||
web3.provider.set(provider);
|
||||
};
|
||||
|
||||
module.exports = web3;
|
||||
|
69
cmd/mist/assets/ext/ethereum.js/package.json
Normal file
69
cmd/mist/assets/ext/ethereum.js/package.json
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "ethereum.js",
|
||||
"namespace": "ethereum",
|
||||
"version": "0.0.13",
|
||||
"description": "Ethereum Compatible JavaScript API",
|
||||
"main": "./index.js",
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"ws": "*",
|
||||
"xmlhttprequest": "*",
|
||||
"bignumber.js": ">=2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bower": ">=1.3.0",
|
||||
"browserify": ">=6.0",
|
||||
"del": ">=0.1.1",
|
||||
"envify": "^3.0.0",
|
||||
"exorcist": "^0.1.6",
|
||||
"gulp": ">=3.4.0",
|
||||
"gulp-jshint": ">=1.5.0",
|
||||
"gulp-rename": ">=1.2.0",
|
||||
"gulp-uglify": ">=1.0.0",
|
||||
"jshint": ">=2.5.0",
|
||||
"uglifyify": "^2.6.0",
|
||||
"unreachable-branch-transform": "^0.1.0",
|
||||
"vinyl-source-stream": "^1.0.0",
|
||||
"mocha": ">=2.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp",
|
||||
"watch": "gulp watch",
|
||||
"lint": "gulp lint",
|
||||
"test": "mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ethereum/ethereum.js.git"
|
||||
},
|
||||
"homepage": "https://github.com/ethereum/ethereum.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ethereum/ethereum.js/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"ethereum",
|
||||
"javascript",
|
||||
"API"
|
||||
],
|
||||
"author": "ethdev.com",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeffery Wilcke",
|
||||
"email": "jeff@ethdev.com",
|
||||
"url": "https://github.com/obscuren"
|
||||
},
|
||||
{
|
||||
"name": "Marek Kotewicz",
|
||||
"email": "marek@ethdev.com",
|
||||
"url": "https://github.com/debris"
|
||||
},
|
||||
{
|
||||
"name": "Marian Oancea",
|
||||
"email": "marian@ethdev.com",
|
||||
"url": "https://github.com/cubedro"
|
||||
}
|
||||
],
|
||||
"license": "LGPL-3.0"
|
||||
}
|
860
cmd/mist/assets/ext/ethereum.js/test/abi.parsers.js
Normal file
860
cmd/mist/assets/ext/ethereum.js/test/abi.parsers.js
Normal file
@ -0,0 +1,860 @@
|
||||
var assert = require('assert');
|
||||
var BigNumber = require('bignumber.js');
|
||||
var abi = require('../lib/abi.js');
|
||||
var clone = function (object) { return JSON.parse(JSON.stringify(object)); };
|
||||
|
||||
var description = [{
|
||||
"name": "test",
|
||||
"inputs": [{
|
||||
"name": "a",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "d",
|
||||
"type": "uint256"
|
||||
}
|
||||
]
|
||||
}];
|
||||
|
||||
describe('abi', function() {
|
||||
describe('inputParser', function() {
|
||||
it('should parse input uint', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "uint" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test(1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(parser.test(10), "000000000000000000000000000000000000000000000000000000000000000a");
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(
|
||||
parser.test(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(parser.test(0.1), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test(3.9), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
assert.equal(parser.test('0.1'), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test('3.9'), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input uint128', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "uint128" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test(1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(parser.test(10), "000000000000000000000000000000000000000000000000000000000000000a");
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(
|
||||
parser.test(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(parser.test(0.1), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test(3.9), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
assert.equal(parser.test('0.1'), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test('3.9'), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input uint256', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "uint256" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test(1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(parser.test(10), "000000000000000000000000000000000000000000000000000000000000000a");
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(
|
||||
parser.test(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(parser.test(0.1), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test(3.9), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
assert.equal(parser.test('0.1'), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test('3.9'), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input int', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "int" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test(1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(parser.test(10), "000000000000000000000000000000000000000000000000000000000000000a");
|
||||
assert.equal(parser.test(-1), "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
assert.equal(parser.test(-2), "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe");
|
||||
assert.equal(parser.test(-16), "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0");
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(
|
||||
parser.test(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(parser.test(0.1), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test(3.9), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
assert.equal(parser.test('0.1'), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test('3.9'), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
});
|
||||
|
||||
it('should parse input int128', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "int128" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test(1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(parser.test(10), "000000000000000000000000000000000000000000000000000000000000000a");
|
||||
assert.equal(parser.test(-1), "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
assert.equal(parser.test(-2), "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe");
|
||||
assert.equal(parser.test(-16), "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0");
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(
|
||||
parser.test(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(parser.test(0.1), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test(3.9), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
assert.equal(parser.test('0.1'), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test('3.9'), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input int256', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "int256" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test(1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(parser.test(10), "000000000000000000000000000000000000000000000000000000000000000a");
|
||||
assert.equal(parser.test(-1), "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
assert.equal(parser.test(-2), "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe");
|
||||
assert.equal(parser.test(-16), "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0");
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(
|
||||
parser.test(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)),
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
);
|
||||
assert.equal(parser.test(0.1), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test(3.9), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
assert.equal(parser.test('0.1'), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
assert.equal(parser.test('3.9'), "0000000000000000000000000000000000000000000000000000000000000003");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input bool', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: 'bool' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test(true), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(parser.test(false), "0000000000000000000000000000000000000000000000000000000000000000");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input hash', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "hash" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x407d73d8a49eeb85d32cf465507dd71d507100c1"), "000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input hash256', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "hash256" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x407d73d8a49eeb85d32cf465507dd71d507100c1"), "000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1");
|
||||
|
||||
});
|
||||
|
||||
|
||||
it('should parse input hash160', function() {
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "hash160" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x407d73d8a49eeb85d32cf465507dd71d507100c1"), "000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1");
|
||||
});
|
||||
|
||||
it('should parse input address', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "address" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d)
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x407d73d8a49eeb85d32cf465507dd71d507100c1"), "000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input string', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "string" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test('hello'),
|
||||
"000000000000000000000000000000000000000000000000000000000000000568656c6c6f000000000000000000000000000000000000000000000000000000"
|
||||
);
|
||||
assert.equal(
|
||||
parser.test('world'),
|
||||
"0000000000000000000000000000000000000000000000000000000000000005776f726c64000000000000000000000000000000000000000000000000000000"
|
||||
);
|
||||
});
|
||||
|
||||
it('should use proper method name', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
d[0].name = 'helloworld(int)';
|
||||
d[0].inputs = [
|
||||
{ type: "int" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.helloworld(1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(parser.helloworld['int'](1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
|
||||
});
|
||||
|
||||
it('should parse multiple methods', function () {
|
||||
|
||||
// given
|
||||
var d = [{
|
||||
name: "test",
|
||||
inputs: [{ type: "int" }],
|
||||
outputs: [{ type: "int" }]
|
||||
},{
|
||||
name: "test2",
|
||||
inputs: [{ type: "string" }],
|
||||
outputs: [{ type: "string" }]
|
||||
}];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
//then
|
||||
assert.equal(parser.test(1), "0000000000000000000000000000000000000000000000000000000000000001");
|
||||
assert.equal(
|
||||
parser.test2('hello'),
|
||||
"000000000000000000000000000000000000000000000000000000000000000568656c6c6f000000000000000000000000000000000000000000000000000000"
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
it('should parse input array of ints', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: "int[]" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test([5, 6]),
|
||||
"0000000000000000000000000000000000000000000000000000000000000002" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000006"
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse input real', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: 'real' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test([1]), "0000000000000000000000000000000100000000000000000000000000000000");
|
||||
assert.equal(parser.test([2.125]), "0000000000000000000000000000000220000000000000000000000000000000");
|
||||
assert.equal(parser.test([8.5]), "0000000000000000000000000000000880000000000000000000000000000000");
|
||||
assert.equal(parser.test([-1]), "ffffffffffffffffffffffffffffffff00000000000000000000000000000000");
|
||||
|
||||
});
|
||||
|
||||
it('should parse input ureal', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].inputs = [
|
||||
{ type: 'ureal' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.inputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test([1]), "0000000000000000000000000000000100000000000000000000000000000000");
|
||||
assert.equal(parser.test([2.125]), "0000000000000000000000000000000220000000000000000000000000000000");
|
||||
assert.equal(parser.test([8.5]), "0000000000000000000000000000000880000000000000000000000000000000");
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('outputParser', function() {
|
||||
it('should parse output string', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: "string" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"68656c6c6f000000000000000000000000000000000000000000000000000000")[0],
|
||||
'hello'
|
||||
);
|
||||
assert.equal(
|
||||
parser.test("0x" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"776f726c64000000000000000000000000000000000000000000000000000000")[0],
|
||||
'world'
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
it('should parse output uint', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'uint' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
||||
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
||||
);
|
||||
assert.equal(
|
||||
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
||||
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse output uint256', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'uint256' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
||||
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
||||
);
|
||||
assert.equal(
|
||||
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
||||
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse output uint128', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'uint128' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||
assert.equal(
|
||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
||||
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
||||
);
|
||||
assert.equal(
|
||||
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
||||
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse output int', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'int' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
||||
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
||||
});
|
||||
|
||||
it('should parse output int256', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'int256' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
||||
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
||||
});
|
||||
|
||||
it('should parse output int128', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'int128' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
||||
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
||||
});
|
||||
|
||||
it('should parse output hash', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'hash' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse output hash256', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'hash256' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse output hash160', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'hash160' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||
);
|
||||
// TODO shouldnt' the expected hash be shorter?
|
||||
});
|
||||
|
||||
it('should parse output address', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'address' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||
"0x407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse output bool', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'bool' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], true);
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000000")[0], false);
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('should parse output real', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'real' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000100000000000000000000000000000000")[0], 1);
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000220000000000000000000000000000000")[0], 2.125);
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000880000000000000000000000000000000")[0], 8.5);
|
||||
assert.equal(parser.test("0xffffffffffffffffffffffffffffffff00000000000000000000000000000000")[0], -1);
|
||||
|
||||
});
|
||||
|
||||
it('should parse output ureal', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: 'ureal' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000100000000000000000000000000000000")[0], 1);
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000220000000000000000000000000000000")[0], 2.125);
|
||||
assert.equal(parser.test("0x0000000000000000000000000000000880000000000000000000000000000000")[0], 8.5);
|
||||
|
||||
});
|
||||
|
||||
|
||||
it('should parse multiple output strings', function() {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
|
||||
d[0].outputs = [
|
||||
{ type: "string" },
|
||||
{ type: "string" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(
|
||||
parser.test("0x" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"68656c6c6f000000000000000000000000000000000000000000000000000000" +
|
||||
"776f726c64000000000000000000000000000000000000000000000000000000")[0],
|
||||
'hello'
|
||||
);
|
||||
assert.equal(
|
||||
parser.test("0x" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"68656c6c6f000000000000000000000000000000000000000000000000000000" +
|
||||
"776f726c64000000000000000000000000000000000000000000000000000000")[1],
|
||||
'world'
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
it('should use proper method name', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
d[0].name = 'helloworld(int)';
|
||||
d[0].outputs = [
|
||||
{ type: "int" }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.helloworld("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
assert.equal(parser.helloworld['int']("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
|
||||
});
|
||||
|
||||
|
||||
it('should parse multiple methods', function () {
|
||||
|
||||
// given
|
||||
var d = [{
|
||||
name: "test",
|
||||
inputs: [{ type: "int" }],
|
||||
outputs: [{ type: "int" }]
|
||||
},{
|
||||
name: "test2",
|
||||
inputs: [{ type: "string" }],
|
||||
outputs: [{ type: "string" }]
|
||||
}];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
//then
|
||||
assert.equal(parser.test("0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||
assert.equal(parser.test2("0x" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"68656c6c6f000000000000000000000000000000000000000000000000000000")[0],
|
||||
"hello"
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
it('should parse output array', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
d[0].outputs = [
|
||||
{ type: 'int[]' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000002" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000006")[0][0],
|
||||
5
|
||||
);
|
||||
assert.equal(parser.test("0x" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000002" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||
"0000000000000000000000000000000000000000000000000000000000000006")[0][1],
|
||||
6
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
it('should parse 0x value', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
d[0].outputs = [
|
||||
{ type: 'int' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x")[0], 0);
|
||||
|
||||
});
|
||||
|
||||
it('should parse 0x value', function () {
|
||||
|
||||
// given
|
||||
var d = clone(description);
|
||||
d[0].outputs = [
|
||||
{ type: 'uint' }
|
||||
];
|
||||
|
||||
// when
|
||||
var parser = abi.outputParser(d);
|
||||
|
||||
// then
|
||||
assert.equal(parser.test("0x")[0], 0);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
14
cmd/mist/assets/ext/ethereum.js/test/db.methods.js
Normal file
14
cmd/mist/assets/ext/ethereum.js/test/db.methods.js
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
var assert = require('assert');
|
||||
var web3 = require('../index.js');
|
||||
var u = require('./test.utils.js');
|
||||
|
||||
describe('web3', function() {
|
||||
describe('db', function() {
|
||||
u.methodExists(web3.db, 'put');
|
||||
u.methodExists(web3.db, 'get');
|
||||
u.methodExists(web3.db, 'putString');
|
||||
u.methodExists(web3.db, 'getString');
|
||||
});
|
||||
});
|
||||
|
34
cmd/mist/assets/ext/ethereum.js/test/eth.methods.js
Normal file
34
cmd/mist/assets/ext/ethereum.js/test/eth.methods.js
Normal file
@ -0,0 +1,34 @@
|
||||
var assert = require('assert');
|
||||
var web3 = require('../index.js');
|
||||
var u = require('./test.utils.js');
|
||||
|
||||
describe('web3', function() {
|
||||
describe('eth', function() {
|
||||
u.methodExists(web3.eth, 'balanceAt');
|
||||
u.methodExists(web3.eth, 'stateAt');
|
||||
u.methodExists(web3.eth, 'storageAt');
|
||||
u.methodExists(web3.eth, 'countAt');
|
||||
u.methodExists(web3.eth, 'codeAt');
|
||||
u.methodExists(web3.eth, 'transact');
|
||||
u.methodExists(web3.eth, 'call');
|
||||
u.methodExists(web3.eth, 'block');
|
||||
u.methodExists(web3.eth, 'transaction');
|
||||
u.methodExists(web3.eth, 'uncle');
|
||||
u.methodExists(web3.eth, 'compilers');
|
||||
u.methodExists(web3.eth, 'lll');
|
||||
u.methodExists(web3.eth, 'solidity');
|
||||
u.methodExists(web3.eth, 'serpent');
|
||||
u.methodExists(web3.eth, 'logs');
|
||||
|
||||
u.propertyExists(web3.eth, 'coinbase');
|
||||
u.propertyExists(web3.eth, 'listening');
|
||||
u.propertyExists(web3.eth, 'mining');
|
||||
u.propertyExists(web3.eth, 'gasPrice');
|
||||
u.propertyExists(web3.eth, 'accounts');
|
||||
u.propertyExists(web3.eth, 'peerCount');
|
||||
u.propertyExists(web3.eth, 'defaultBlock');
|
||||
u.propertyExists(web3.eth, 'number');
|
||||
});
|
||||
});
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user