Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63483b9db7 | ||
|
|
b26c7f9f0a | ||
|
|
a165c9375c | ||
|
|
28631f7180 | ||
|
|
6489251b47 | ||
|
|
66884febea | ||
|
|
8058dc350f | ||
|
|
63096cc238 | ||
|
|
05600c0cd0 | ||
|
|
eed5e23e65 | ||
|
|
cdf5b15673 | ||
|
|
1922676bd7 | ||
|
|
b6c427e985 | ||
|
|
0327aedf8e | ||
|
|
d7035cebb1 | ||
|
|
8b492021af | ||
|
|
6a01fc7c8c | ||
|
|
bbc30ec9dc | ||
|
|
f07c0628bc | ||
|
|
023c7588e5 | ||
|
|
7dfc8625cc | ||
|
|
8643b5da87 | ||
|
|
afa0e63ae8 | ||
|
|
534303ff45 | ||
|
|
f1ebcddec6 | ||
|
|
657a2006dd | ||
|
|
219e928c01 | ||
|
|
43183118d5 | ||
|
|
76e15d465d | ||
|
|
4c0387e1a3 | ||
|
|
bbbd82eb4a | ||
|
|
a34a7450aa | ||
|
|
bf472fdcf4 | ||
|
|
f428a58006 | ||
|
|
fcce2ab340 | ||
|
|
877eb11717 | ||
|
|
4b55f1be93 | ||
|
|
f2a677634e | ||
|
|
eea4c8775e | ||
|
|
792bf0ec36 | ||
|
|
e3d13107a9 | ||
|
|
e5c2c6a228 | ||
|
|
d2be79132c | ||
|
|
76da2638c1 | ||
|
|
daf3912920 | ||
|
|
6dfebbb9fe | ||
|
|
e55c5f77f7 | ||
|
|
c7315ffb74 | ||
|
|
84eb806f07 | ||
|
|
2493442a2e | ||
|
|
77df7907c7 | ||
|
|
f1b6268784 | ||
|
|
9aa9380251 | ||
|
|
b4306cb60a | ||
|
|
1e83daf797 | ||
|
|
d46d32d9bc | ||
|
|
032a0a595c | ||
|
|
34101ec12b | ||
|
|
4e02b982d3 | ||
|
|
5b96d52fa6 | ||
|
|
735f2b835e | ||
|
|
646e64c286 | ||
|
|
fc9060caa8 | ||
|
|
503c2b3c63 | ||
|
|
168abc130f | ||
|
|
5c5db2709b | ||
|
|
5a4ff5420f | ||
|
|
a1655508ba | ||
|
|
64827a6114 | ||
|
|
2eb09374bc | ||
|
|
ddf67d5564 | ||
|
|
ad6b8280a2 | ||
|
|
682c6b6fb2 | ||
|
|
6a281211b4 | ||
|
|
6ef94b3c3b | ||
|
|
e900d1d657 | ||
|
|
7f1a3fa636 | ||
|
|
21802664b8 | ||
|
|
1492df11a7 | ||
|
|
00fed90da2 | ||
|
|
e6beb6554d | ||
|
|
099cf5a351 | ||
|
|
55e762a348 | ||
|
|
0ad146c607 | ||
|
|
4e7f3f5268 | ||
|
|
6a9e3d80f1 | ||
|
|
dee98fae55 | ||
|
|
ff52876920 | ||
|
|
4d01a09c54 | ||
|
|
7310ea825e | ||
|
|
15b80a47c3 | ||
|
|
622682b4ef | ||
|
|
56415df4ab | ||
|
|
8bea5e5a3b | ||
|
|
d6372ade44 | ||
|
|
f501994df8 | ||
|
|
b787a7d5a0 | ||
|
|
11d162a10d | ||
|
|
e2564dea17 | ||
|
|
2b9152871e | ||
|
|
70ecb03d14 | ||
|
|
a2f179acb1 | ||
|
|
c8cb97edef | ||
|
|
69d344c6c3 | ||
|
|
44cdf49b2c | ||
|
|
daaf4654a1 | ||
|
|
f8d4fcaf04 | ||
|
|
eb19a39d82 | ||
|
|
7ed958fb2d | ||
|
|
bbe9b94f26 | ||
|
|
6e83e6aaef | ||
|
|
1545bbf7c5 | ||
|
|
5bfc2cd534 | ||
|
|
b22d0a196f | ||
|
|
b174864804 | ||
|
|
e6834d60c5 | ||
|
|
97438bb2e8 | ||
|
|
f630d43a25 | ||
|
|
0187f1ff19 | ||
|
|
d8db866316 | ||
|
|
28aa9e18a7 | ||
|
|
3eaea97b8f | ||
|
|
ea0e5e4547 | ||
|
|
1256317b65 | ||
|
|
e0c3ed1b96 | ||
|
|
9f2c3016d7 | ||
|
|
938ace2342 | ||
|
|
e5d2607dff | ||
|
|
50b8db2263 | ||
|
|
91766a6885 | ||
|
|
4b1a9ab9e1 | ||
|
|
9a14c65336 | ||
|
|
4aa66fd4c6 | ||
|
|
3d9c62d538 | ||
|
|
4156eb44ab | ||
|
|
4b2d33693c | ||
|
|
e8b127e177 | ||
|
|
b052b03f31 | ||
|
|
6727e12468 | ||
|
|
c130285651 | ||
|
|
47fc4a2b3c | ||
|
|
97cb408f36 | ||
|
|
dde7c8085a | ||
|
|
8b02fafb99 | ||
|
|
393f46ba4a | ||
|
|
455f5ad834 | ||
|
|
674324e7f9 | ||
|
|
b0dc7cf451 | ||
|
|
cbe1b2b1ce | ||
|
|
4bd2f2fc32 | ||
|
|
053112470d | ||
|
|
acdf27a272 | ||
|
|
f70b32ba76 | ||
|
|
67a3376ef8 | ||
|
|
eb06bb6e93 | ||
|
|
f8f7e92da4 | ||
|
|
d0fd3eca25 | ||
|
|
dac1df35de | ||
|
|
597563d2bb | ||
|
|
f825c7f187 | ||
|
|
2e71a6160e | ||
|
|
c076c37119 | ||
|
|
0e18fdbccc | ||
|
|
c3eebd8fbe | ||
|
|
45786b31da | ||
|
|
f348e34de7 | ||
|
|
337de79bef | ||
|
|
a13b51b985 | ||
|
|
c5c77c9b52 | ||
|
|
2a033e5634 | ||
|
|
00ffb358cb | ||
|
|
66d1bbe4cb | ||
|
|
3baf36e9e6 | ||
|
|
e3abb95111 | ||
|
|
da281c9531 | ||
|
|
c0e3026772 | ||
|
|
757da68675 | ||
|
|
f145488314 | ||
|
|
0ce10d2938 | ||
|
|
6f2d62bb3b | ||
|
|
fc7c8310ae | ||
|
|
c9921f002f | ||
|
|
6b8a65eb31 | ||
|
|
0cf29719b3 | ||
|
|
abecabdaed | ||
|
|
0c5b69bea1 | ||
|
|
7b3f24b1f5 | ||
|
|
d1f8f8b5e8 | ||
|
|
3f060b9e0d | ||
|
|
fe69f70539 | ||
|
|
578c4ffb69 | ||
|
|
66aa38000b | ||
|
|
50ddff6907 | ||
|
|
14874f41f7 | ||
|
|
5a11b0c701 | ||
|
|
8491ab8ca6 | ||
|
|
4f5cb0f35e | ||
|
|
53d081df65 | ||
|
|
6b5dbb6948 | ||
|
|
3879986a75 | ||
|
|
378ca10580 | ||
|
|
d75d8bec0e | ||
|
|
6f6a32a7a2 | ||
|
|
226426e67e | ||
|
|
66e2a4d298 | ||
|
|
664151f829 | ||
|
|
49b00524b1 | ||
|
|
401784b7e6 | ||
|
|
99873e901a | ||
|
|
72d131f62f | ||
|
|
c412f7fa11 | ||
|
|
a1ad90c2b4 | ||
|
|
92f62bfa15 | ||
|
|
fa9c5778be | ||
|
|
e6f877621a | ||
|
|
5c35a70e9d | ||
|
|
a287096cc3 | ||
|
|
c35f31bfbd | ||
|
|
718afa91e3 | ||
|
|
102a06b0f2 | ||
|
|
58f0df1ef0 | ||
|
|
a458589222 | ||
|
|
deef4ce4c7 | ||
|
|
f5d2449407 | ||
|
|
8bb1d1259e | ||
|
|
abd860d548 | ||
|
|
25936d882f | ||
|
|
9deaff54e4 | ||
|
|
bc479a995b | ||
|
|
458b7fa7e4 | ||
|
|
2fc17a66e1 | ||
|
|
94f81db568 | ||
|
|
e83d97c849 | ||
|
|
4a497fa970 | ||
|
|
cb40d459b5 | ||
|
|
c70cdb351f | ||
|
|
001aa0d011 | ||
|
|
961d27ad46 | ||
|
|
1c09bb69dd | ||
|
|
174510a928 | ||
|
|
39ed76f2de | ||
|
|
7d1c93db59 | ||
|
|
e9b1b4ee77 | ||
|
|
2367978f6e | ||
|
|
e77050b9f5 | ||
|
|
844d1a2928 | ||
|
|
6a70beda0f | ||
|
|
05a834b822 | ||
|
|
6a3af506a4 | ||
|
|
c82b85ef79 | ||
|
|
91ab81ef60 | ||
|
|
3665690444 | ||
|
|
03dcefceb5 | ||
|
|
e84be032f4 | ||
|
|
033ff7a28c | ||
|
|
7c8b2abf92 | ||
|
|
5312ec1f3a | ||
|
|
cdfbf91ee6 | ||
|
|
14f2abdc37 | ||
|
|
04c8d49e9d | ||
|
|
722929d0d4 | ||
|
|
d1fae523ac | ||
|
|
ce9a92cdc0 | ||
|
|
3de09a2e27 | ||
|
|
f28479180f | ||
|
|
0d1d42f6c2 | ||
|
|
c93dad0bc5 | ||
|
|
e3d3a1ff71 | ||
|
|
1c8bd896e1 | ||
|
|
e0119c1873 | ||
|
|
defe81e560 | ||
|
|
932122cd21 | ||
|
|
40d035eca7 | ||
|
|
a135abaea2 | ||
|
|
00b8c10881 | ||
|
|
11e7b90918 | ||
|
|
ae74467e6a | ||
|
|
5a929d3810 | ||
|
|
63732f1456 | ||
|
|
ea6bb83c01 | ||
|
|
d6a443ca2a | ||
|
|
d983ee106c | ||
|
|
beed1df5bd | ||
|
|
426aef6088 | ||
|
|
9be9b3fb83 | ||
|
|
8676f30cbf | ||
|
|
154561c34c | ||
|
|
714b242ec0 | ||
|
|
32ce650ee1 | ||
|
|
3715df2f5b | ||
|
|
dd6e6ddfc1 | ||
|
|
9975f58cfb | ||
|
|
536369261f | ||
|
|
33165e93dc | ||
|
|
39a38a6c44 | ||
|
|
b18bdc37f9 | ||
|
|
79847aabf7 | ||
|
|
ab75863d94 | ||
|
|
c908a27b7d | ||
|
|
98c7e5d5ea | ||
|
|
fd4587a0bc | ||
|
|
e211ae1667 | ||
|
|
af735176fe | ||
|
|
9eb44d6e89 | ||
|
|
379e841808 | ||
|
|
5c16b8e8a1 | ||
|
|
96d7d9ff5a | ||
|
|
e9fbbbbd42 | ||
|
|
73750ddb7d | ||
|
|
4e1145c66f | ||
|
|
7f35fa22d5 | ||
|
|
da1daf5bd9 | ||
|
|
5afc87ce47 | ||
|
|
a2269cd999 | ||
|
|
201308c259 | ||
|
|
00490116dd | ||
|
|
1968c878f5 | ||
|
|
52ccb9fbbf | ||
|
|
03e21ea64b | ||
|
|
8c949bb3df | ||
|
|
e484e7cf35 | ||
|
|
7aac4c7936 | ||
|
|
933c8d48e2 | ||
|
|
d3d3bb9b5a | ||
|
|
f4d976c337 | ||
|
|
07c4037fcf | ||
|
|
52d73d8698 | ||
|
|
ccfab75f41 | ||
|
|
b8204b138d | ||
|
|
a97cb6e25d | ||
|
|
11534a1153 | ||
|
|
dd1fab5366 | ||
|
|
dbb3a5ccc2 | ||
|
|
fb08215e0d | ||
|
|
d7d7ab2f89 | ||
|
|
25393cd982 | ||
|
|
d6a6089e2d | ||
|
|
a3eaca0270 | ||
|
|
f9d1b4d653 | ||
|
|
f81712343a | ||
|
|
33e414be12 | ||
|
|
9387103558 | ||
|
|
3b7c1afa95 | ||
|
|
7e1fa8954b | ||
|
|
53c62f1542 | ||
|
|
5ed94a50e1 | ||
|
|
b1c047149b | ||
|
|
7a0efaf58c | ||
|
|
5acce98346 | ||
|
|
165179ebf2 | ||
|
|
def60dce9e | ||
|
|
c8f91fcf7a | ||
|
|
70a160cca0 | ||
|
|
9691fd5ba7 | ||
|
|
475cb4fa69 | ||
|
|
5c54b3cc92 | ||
|
|
55d8c58d95 | ||
|
|
edf8adaa88 | ||
|
|
1f8f6e54bd | ||
|
|
f6ca7b9a9d | ||
|
|
7732339fc0 | ||
|
|
5a8a8c7ecb | ||
|
|
05df087e73 | ||
|
|
5b71abfe80 | ||
|
|
1d6c33060a | ||
|
|
eae573e6a2 | ||
|
|
0f08031792 | ||
|
|
e0bde927d1 | ||
|
|
e569de520a | ||
|
|
a833dccdaf | ||
|
|
b58d772156 | ||
|
|
e5d9bbc264 | ||
|
|
3089529405 | ||
|
|
5ab24390c5 | ||
|
|
245047a41f | ||
|
|
8aa1bd5bd0 | ||
|
|
e0dde35621 | ||
|
|
9ba91a3851 | ||
|
|
351cb97667 | ||
|
|
afdb476796 | ||
|
|
3b67b65091 | ||
|
|
25580b2026 | ||
|
|
2db16e94b7 | ||
|
|
9184268c3d | ||
|
|
83a762af1e | ||
|
|
6a8e5370b6 | ||
|
|
9cd4bf7cf7 | ||
|
|
c4708dcfca | ||
|
|
041d06a6c8 | ||
|
|
2b4bd75499 | ||
|
|
c4c47a84e1 | ||
|
|
a241bd1c38 | ||
|
|
d420cede82 | ||
|
|
b869695e40 | ||
|
|
37caf4e710 | ||
|
|
134bc22463 | ||
|
|
39d142876e | ||
|
|
6d95eb418d | ||
|
|
e26a6a28ff | ||
|
|
d80d6f2a06 | ||
|
|
ff8dabb249 | ||
|
|
e7a01f9780 | ||
|
|
94938c7075 | ||
|
|
f37e729605 | ||
|
|
9cfde73ff8 | ||
|
|
f5c140d1c2 | ||
|
|
472e1022d3 | ||
|
|
f71211f5dc | ||
|
|
7e06974f1b | ||
|
|
f95384d9ff | ||
|
|
baedd5b689 | ||
|
|
9ec1cb194a | ||
|
|
d730310ea5 | ||
|
|
641fe5c380 | ||
|
|
c5a8d5e018 | ||
|
|
02d130f0a0 | ||
|
|
5554f17f05 | ||
|
|
69351ceb9e | ||
|
|
0cf9fa7405 | ||
|
|
8213fa7cb9 | ||
|
|
8ef983169f | ||
|
|
e392dd745e | ||
|
|
6b07a9c2a5 | ||
|
|
114ac59707 | ||
|
|
3c95bfe56e | ||
|
|
58de0b8b9c | ||
|
|
1f97c5e9e3 | ||
|
|
0dc46445bc | ||
|
|
7d3464ae2c | ||
|
|
295cd2a7e0 | ||
|
|
5a66ce5a87 | ||
|
|
d8d008108d | ||
|
|
491518405d | ||
|
|
7290b3d296 | ||
|
|
b6162a316f | ||
|
|
71c1d16dc4 | ||
|
|
204f592bea | ||
|
|
39c44bb5aa | ||
|
|
df0de49a67 | ||
|
|
0bdbf4b7a7 | ||
|
|
ef9cd6fc4b | ||
|
|
5ab0bf3998 | ||
|
|
e69d97619e | ||
|
|
6aa0d90fc0 | ||
|
|
d338fcb58c | ||
|
|
b9a60a2519 | ||
|
|
7b8b4e8078 | ||
|
|
50b551e4fc | ||
|
|
a4ea4d648a | ||
|
|
146360a454 | ||
|
|
2e83d92adc | ||
|
|
b77e5d079c | ||
|
|
0d067c9484 | ||
|
|
88519eff3f | ||
|
|
bb14471e60 | ||
|
|
97ab7fcf2f | ||
|
|
922cfb8759 | ||
|
|
717f33ca02 | ||
|
|
21a2b5f0b7 | ||
|
|
54efead9d7 | ||
|
|
c472a451a4 | ||
|
|
6ed2de43fc | ||
|
|
8976ded37f | ||
|
|
169a374544 | ||
|
|
6476d88e19 | ||
|
|
75de454619 | ||
|
|
851428aef9 | ||
|
|
dfc51ad300 | ||
|
|
e16d288644 | ||
|
|
a19928fef9 | ||
|
|
0906c7837a | ||
|
|
cb9831c4f8 | ||
|
|
620d3757ba | ||
|
|
601288b3ec | ||
|
|
efbeecc8f6 | ||
|
|
852e0d4f0b | ||
|
|
5c7f9f1c8a | ||
|
|
64f64c1001 | ||
|
|
15c3085511 | ||
|
|
27cd9b1ca4 | ||
|
|
1c2a95f820 | ||
|
|
8bf5e51725 | ||
|
|
493225aa9d | ||
|
|
a0979a9ce3 | ||
|
|
02849ae49b | ||
|
|
602bb1406b | ||
|
|
d70930587c | ||
|
|
8c011cdc86 | ||
|
|
eb3e7a0740 | ||
|
|
2071de517d | ||
|
|
205ae40f20 | ||
|
|
aa37e372dd | ||
|
|
8cdac77a8e | ||
|
|
7a7d6e9b8a | ||
|
|
7a1bdb18a8 | ||
|
|
39f22ca403 | ||
|
|
b3c6a5acc5 | ||
|
|
b3a6b3dcb5 | ||
|
|
0c0e4c4d7c | ||
|
|
9d67d711d4 | ||
|
|
f45d03fa17 | ||
|
|
af11444b72 | ||
|
|
f412a5ac86 | ||
|
|
c9dcd51ba6 | ||
|
|
5dca826429 | ||
|
|
8dc53e6339 | ||
|
|
5867f8ab0c | ||
|
|
6d3db2fb3f | ||
|
|
3a1634d67f | ||
|
|
53d18d874d | ||
|
|
044efbc6de | ||
|
|
27e3fbfd0f | ||
|
|
b7af4781ea | ||
|
|
c51e351117 | ||
|
|
e6afed9bb1 | ||
|
|
4b07d5511e | ||
|
|
a613308bdb | ||
|
|
a863e5eb95 | ||
|
|
623420ca3d | ||
|
|
9ea6053a42 | ||
|
|
73dce6bfd1 | ||
|
|
5a7811c80f | ||
|
|
1c529bdc6a | ||
|
|
3f4576f524 | ||
|
|
2619489ec3 | ||
|
|
f165845cc3 | ||
|
|
897f03e4c1 | ||
|
|
82c1e3f35a | ||
|
|
c06f260d3c | ||
|
|
63573ca0de | ||
|
|
bf1a5f0d91 | ||
|
|
1750522cb6 | ||
|
|
ed3b507ea6 | ||
|
|
f942510309 | ||
|
|
09a9153645 | ||
|
|
908d0fcf52 | ||
|
|
707c93a557 | ||
|
|
82addc4f6a | ||
|
|
d595eb440c | ||
|
|
e86fe5bab0 | ||
|
|
7187dca2f7 | ||
|
|
94a3b1f09a | ||
|
|
d88b300a6d | ||
|
|
dd217f82b2 | ||
|
|
3b4cee08e2 | ||
|
|
34be2399eb | ||
|
|
27d879a325 | ||
|
|
4093ef9ffa | ||
|
|
261eebee03 | ||
|
|
d9dad3566a | ||
|
|
3d0fdbd6da | ||
|
|
affa5d390c | ||
|
|
1659e672ae | ||
|
|
0fa6b99c9e | ||
|
|
ef9db7bf78 | ||
|
|
8c6505d870 | ||
|
|
48f83c7d5b | ||
|
|
f3c2c5c084 | ||
|
|
98e1cc3f73 | ||
|
|
4fd74a04c8 | ||
|
|
421594b0eb | ||
|
|
2e79c25da1 | ||
|
|
ca2a313aec | ||
|
|
693315dad3 | ||
|
|
c2f9ef7ca8 | ||
|
|
fc477b98bd | ||
|
|
b8cdfd226a | ||
|
|
a5725d7bd6 | ||
|
|
8995ef6ae2 | ||
|
|
742baa3dad | ||
|
|
3a37bf1e6b | ||
|
|
f4b51f6311 | ||
|
|
a09fc51693 | ||
|
|
1d8b6a79ef | ||
|
|
164a1b6867 | ||
|
|
032f2dc040 | ||
|
|
3dbe33378c | ||
|
|
bb08ac4a28 | ||
|
|
4656d32e22 | ||
|
|
60c982ed95 | ||
|
|
cacafab912 | ||
|
|
99d4806a0d | ||
|
|
59a194a48d | ||
|
|
d818f61dc8 | ||
|
|
f1cbfff5a6 | ||
|
|
92cdc6c840 | ||
|
|
1ff864ea2f | ||
|
|
071b5ba7cb | ||
|
|
2e6d89a093 | ||
|
|
049a1a59f5 | ||
|
|
201098e9f6 | ||
|
|
423227d385 | ||
|
|
c1facd8b1c | ||
|
|
842d371699 | ||
|
|
bcbd4b8d40 | ||
|
|
b526873837 | ||
|
|
6f85c6783e | ||
|
|
672983f6c1 | ||
|
|
3ee3fb05cc | ||
|
|
8ff32d9c1e | ||
|
|
8ad3d35dd2 | ||
|
|
cb5fdc9078 | ||
|
|
77d894dd00 | ||
|
|
5b40d95b0f | ||
|
|
385d157f3f | ||
|
|
81a2a51610 | ||
|
|
ff8383c5ed | ||
|
|
ca9f671553 | ||
|
|
eb17de0888 | ||
|
|
110c9d199d | ||
|
|
b5cc8f193e | ||
|
|
abebe9ef43 | ||
|
|
e55f69a009 | ||
|
|
9bf854445c | ||
|
|
17f7e4b753 | ||
|
|
0a6c6ec4c5 | ||
|
|
7456113cef | ||
|
|
7051e20d59 | ||
|
|
79dba43f0f | ||
|
|
6bb421dac6 | ||
|
|
0ce28c519f | ||
|
|
cdde702db7 | ||
|
|
6b4a76b54b | ||
|
|
57e2a9dc14 | ||
|
|
798f1e6e91 | ||
|
|
0e264a029e | ||
|
|
8745c059f7 | ||
|
|
adee447cd0 | ||
|
|
63c22414ce | ||
|
|
89992ea03e | ||
|
|
e9d24c3213 | ||
|
|
71b33e2e42 | ||
|
|
023bc5aaa6 | ||
|
|
30d4d8c3a5 | ||
|
|
6963e40074 | ||
|
|
2b6aa7972d | ||
|
|
4908c1c82a | ||
|
|
aaf1273794 | ||
|
|
62ef032594 | ||
|
|
3652436125 | ||
|
|
e947c638ff | ||
|
|
6926a30760 | ||
|
|
4feed1db5d | ||
|
|
d462a1d6c0 | ||
|
|
0e297c6779 | ||
|
|
e07636675f | ||
|
|
69020faaab | ||
|
|
4059682ec2 | ||
|
|
eaf5216d49 | ||
|
|
47142448d7 | ||
|
|
586c90208c | ||
|
|
7e0283d7c0 | ||
|
|
d9ee39f367 | ||
|
|
af1a3385cc | ||
|
|
0d58c77de0 | ||
|
|
b588238836 | ||
|
|
3e702b8629 | ||
|
|
62f46359e2 | ||
|
|
fef349880a | ||
|
|
f59cb12ec7 | ||
|
|
96700eef5d | ||
|
|
7316f68cdf | ||
|
|
0078062d33 | ||
|
|
e8cd8c9448 | ||
|
|
58fa1062eb | ||
|
|
bc2b0d513c | ||
|
|
8af58fcea3 | ||
|
|
180738306b | ||
|
|
efbe9060de | ||
|
|
5b9b5586d3 | ||
|
|
6c174e6634 | ||
|
|
1c2c86126c | ||
|
|
01f32f2706 | ||
|
|
94608b0c3f | ||
|
|
6f581d6122 | ||
|
|
9fcb5fe348 | ||
|
|
43e641f6a1 | ||
|
|
b182fd2428 | ||
|
|
af7c17e4bb | ||
|
|
edff4231ff | ||
|
|
a66b98fece | ||
|
|
4e2fb23bdf | ||
|
|
2900ad303c | ||
|
|
4e756704ea | ||
|
|
efd6c5331d | ||
|
|
619ef6f8eb | ||
|
|
2823504156 | ||
|
|
370dc86817 | ||
|
|
ee5628f856 | ||
|
|
a8f2ba8c30 | ||
|
|
24bd513002 | ||
|
|
f73609103a | ||
|
|
206d399258 | ||
|
|
d531dd374f | ||
|
|
e199a9b11a | ||
|
|
0ad8be71f9 | ||
|
|
9be9f59b6a | ||
|
|
5165ce7caf | ||
|
|
b00b84e314 | ||
|
|
85ae6f949b | ||
|
|
e31966496b | ||
|
|
db2ae1324f | ||
|
|
b152a67150 | ||
|
|
bdfc582ba5 | ||
|
|
7a2754109f | ||
|
|
ca76dc170c | ||
|
|
dbfc15ba88 | ||
|
|
2d40d370f9 | ||
|
|
0728e40bfb | ||
|
|
1a50298ffe | ||
|
|
68f2cb5bb2 | ||
|
|
8598002801 | ||
|
|
333ff8528b | ||
|
|
c17f93a3ec | ||
|
|
67841a9212 | ||
|
|
6be6b027cb | ||
|
|
6943c9b36d | ||
|
|
253e48f7bb | ||
|
|
eeaf6118a5 | ||
|
|
c3c77ffe43 | ||
|
|
71e82aece8 | ||
|
|
a7132b4e9c | ||
|
|
8acb65931e | ||
|
|
dcf053633b | ||
|
|
015ade79e6 | ||
|
|
a4f56d3d38 | ||
|
|
73d10a55f1 | ||
|
|
2d0ce2ddff | ||
|
|
775697f51e | ||
|
|
9690777acb | ||
|
|
e7d38a5e59 | ||
|
|
c6355fb147 | ||
|
|
d85d9ca930 | ||
|
|
af643401b8 | ||
|
|
fcea797c8a | ||
|
|
cbc14cc291 | ||
|
|
64aa4dcc1c | ||
|
|
429ea4ca99 | ||
|
|
86ce696808 | ||
|
|
57ca9a9c32 | ||
|
|
70a26e33a7 | ||
|
|
c487094aa7 | ||
|
|
bab79b6473 | ||
|
|
586e838788 | ||
|
|
51cb64ade7 | ||
|
|
d09dcb8282 | ||
|
|
869f9b7af9 | ||
|
|
a938cb545a | ||
|
|
553b3df0b2 | ||
|
|
1fd157364b | ||
|
|
fa7ae72c59 | ||
|
|
443706a6e0 | ||
|
|
ba462aae8b | ||
|
|
a35da085d6 | ||
|
|
3d8d2e4988 | ||
|
|
6c5ef6ecd6 | ||
|
|
3bae45a331 | ||
|
|
196a0891b8 | ||
|
|
2a16b04420 | ||
|
|
790deca695 | ||
|
|
4ec87dc51c | ||
|
|
51686f0cd4 | ||
|
|
deddc6dc79 | ||
|
|
3bf4c3fac5 | ||
|
|
ccf32a6289 | ||
|
|
4540495a44 | ||
|
|
429b797b23 | ||
|
|
a3d5ef790c | ||
|
|
b548277c05 | ||
|
|
2de9317b30 | ||
|
|
877aa33efa | ||
|
|
8a9e523b84 | ||
|
|
19743d6634 | ||
|
|
85ec141b56 | ||
|
|
cb175b4bde | ||
|
|
8672a2e30e | ||
|
|
17936f849b | ||
|
|
3b9f348223 | ||
|
|
b5ff0434d9 | ||
|
|
877a339353 | ||
|
|
716f473887 | ||
|
|
1c1bfb295d | ||
|
|
dd0a31803f | ||
|
|
e04e5577ed | ||
|
|
09617aad2e | ||
|
|
3d8a57a7d5 | ||
|
|
feff458cbf | ||
|
|
543b4846f9 | ||
|
|
09ab373b54 | ||
|
|
bec6dba14a | ||
|
|
e80bea6680 | ||
|
|
9119e791d1 | ||
|
|
46b99ae83d | ||
|
|
92129746dc | ||
|
|
4a8a36d284 | ||
|
|
2b8ce1b3b7 | ||
|
|
0e1e0c0d37 | ||
|
|
427f821430 | ||
|
|
07307f8374 | ||
|
|
cc5b5c81c9 | ||
|
|
efbc017940 | ||
|
|
849972f7b0 | ||
|
|
01758229eb | ||
|
|
add9b59402 | ||
|
|
c8af75088a | ||
|
|
d4b45921fd | ||
|
|
30f5baa906 | ||
|
|
7150bdcbea | ||
|
|
d041c0abb2 | ||
|
|
524e694b90 | ||
|
|
bdd1e4c917 | ||
|
|
7233d7c754 | ||
|
|
aee09c48b9 | ||
|
|
7edbc58129 | ||
|
|
ad2939cc4f | ||
|
|
e984c74ca6 | ||
|
|
a5c8e3c4e1 | ||
|
|
1e5191d695 | ||
|
|
b46093e5d3 | ||
|
|
64f0d7b2a6 | ||
|
|
4a1e504ca2 | ||
|
|
ebf3f4491e | ||
|
|
849f519efe | ||
|
|
accc2b4f7d | ||
|
|
01abc030f9 | ||
|
|
e041946de5 | ||
|
|
502e54ce5c | ||
|
|
12986f0cda | ||
|
|
83d780220c | ||
|
|
ec7848ae92 | ||
|
|
2b5be7eaab | ||
|
|
21f4e3107a | ||
|
|
8a152ea4c0 | ||
|
|
fd7b38e781 | ||
|
|
5df22835f6 | ||
|
|
6a828eb11a | ||
|
|
ad2b1abdc9 | ||
|
|
d3dc2cb00a | ||
|
|
921e55a82e | ||
|
|
fde076152a | ||
|
|
6e535b0502 | ||
|
|
1ddad84d7e | ||
|
|
1e975c68ee | ||
|
|
5c962cf093 | ||
|
|
07f55af202 |
+5
-1
@@ -1 +1,5 @@
|
||||
18
|
||||
24
|
||||
1.4.2
|
||||
1.6.2
|
||||
1.11.2
|
||||
1.12.21.17.2
|
||||
+5
-2
@@ -4,6 +4,9 @@ exclude_patterns:
|
||||
- "**/*.test.js"
|
||||
- "**/*.test.ts"
|
||||
- "docs/**/*.js"
|
||||
- "packages/api/src/types/augment/"
|
||||
- "docs/**/*.ts"
|
||||
- "packages/api/src/augment/"
|
||||
- "packages/typegen/scripts"
|
||||
- "packages/typegen/src"
|
||||
- "packages/types/src/interfaces/"
|
||||
- "packages/types/src/scripts/"
|
||||
- "packages/types/src/augment/"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
.eslintrc.js
|
||||
**/build/*
|
||||
**/coverage/*
|
||||
**/node_modules/*
|
||||
docs/examples/promise/90_typegen/*
|
||||
|
||||
@@ -2,70 +2,15 @@ name: PR
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Linting
|
||||
runs-on: ubuntu-latest
|
||||
pr:
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: lint
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn lint
|
||||
|
||||
test:
|
||||
name: Testing
|
||||
step: ['lint', 'test', 'build', 'docs']
|
||||
name: ${{ matrix.step }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: test
|
||||
- name: ${{ matrix.step }}
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn test
|
||||
|
||||
build_code:
|
||||
name: Build Code
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: build
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn build
|
||||
|
||||
build_docs:
|
||||
name: Build Docs
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: build
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn docs
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
yarn ${{ matrix.step }}
|
||||
|
||||
@@ -5,62 +5,30 @@ on:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build_code:
|
||||
name: Build Code
|
||||
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
|
||||
runs-on: ubuntu-latest
|
||||
master:
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
step: ['build:release', 'docs:release']
|
||||
name: ${{ matrix.step }}
|
||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/api'"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: build
|
||||
- name: ${{ matrix.step }}
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
GH_PAGES_SRC: build-docs
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
GH_TOKEN: ${{ secrets.GH_PAT }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn polkadot-ci-ghact-build
|
||||
|
||||
build_docs:
|
||||
name: Build Docs
|
||||
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: build
|
||||
env:
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
GH_TOKEN: ${{ secrets.GH_PAT }}
|
||||
GH_PAGES_SRC: build-docs
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn polkadot-ci-ghact-docs
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
yarn ${{ matrix.step }}
|
||||
|
||||
dummy:
|
||||
name: Dummy
|
||||
if: "contains(github.event.head_commit.message, '[CI Skip]')"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- name: dummy
|
||||
run: |
|
||||
|
||||
@@ -13,6 +13,10 @@ tmp/
|
||||
.env.production.local
|
||||
.npmrc
|
||||
.rpt2_cache
|
||||
.yarn/*
|
||||
!.yarn/releases
|
||||
!.yarn/plugins
|
||||
.pnp.*
|
||||
.vscode/
|
||||
cc-test-reporter
|
||||
lerna-debug.log*
|
||||
|
||||
File diff suppressed because one or more lines are too long
+56
File diff suppressed because one or more lines are too long
+11
@@ -0,0 +1,11 @@
|
||||
enableImmutableInstalls: false
|
||||
|
||||
enableProgressBars: false
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.js
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-rc.js
|
||||
+360
-72
@@ -1,22 +1,310 @@
|
||||
# 1.2.1 Feb 16, 2020
|
||||
# CHANGELOG
|
||||
|
||||
## 1.23.1 Jul 6, 2020
|
||||
|
||||
- Small README typo fix (Thanks to https://github.com/woss)
|
||||
- Add latest Substrate master types
|
||||
- Adjust `<Codec>.toRawType()` to use registry name as available
|
||||
- Update `ProxyType` for Kusama, Polkadot & Westend with `IdentityJudgement`
|
||||
- Validate number format (signed/unsigned) for number types
|
||||
- Remove core codec dependencies on Base class (with proper TS encapsulation)
|
||||
|
||||
## 1.22.1 Jun 30, 2020
|
||||
|
||||
- **Important** Substrate changed the treasury tip structure, on older chains supply `OpenTip: 'OpenTipTo225'`
|
||||
- Allow for `[u8; 33]` in U8aFixed (Thanks to https://github.com/akru)
|
||||
- Improve derive accountId -> accountIndex lookups (optimize entries queries)
|
||||
- Vesting balance calculations via `derive.balances.all` has been updated for locks
|
||||
- Add derive for multi staking rewards with specified eras
|
||||
- `@polkadot/util` 2.16
|
||||
|
||||
## 1.21.1 Jun 23, 2020
|
||||
|
||||
- Fix subscriptions never unsubscribing after the id swap in 1.18.1 (Thanks to https://github.com/dillu24 for testing iterations)
|
||||
- Add support for `CheckMortality` signed extension (old `CheckEra` is now an alias)
|
||||
- Promise API will default to using `getStorage` on non-subscription calls, reducing RPC overhead
|
||||
- Optimize derive BN allocations, using in-place operators as applicable
|
||||
- Add new substrate types for Babe EquivocationProof
|
||||
- Adjust `Releases` enum to use a shared instance
|
||||
|
||||
## 1.20.1 Jun 22, 2020
|
||||
|
||||
- **Important** RPC for `account_nextIndex` has been moved to `system_accountNextIndex` (Aligning with Substrate as a primary alias)
|
||||
- Cleanup map entries support with only Substrate 2.0-era RPCs (when introduced)
|
||||
- Add `system_dryRun` RPC
|
||||
- Optimize `derive.staking.queryMulti` retrievals with additional per-type batching
|
||||
- Add `derive.staking.waitingInfo` (same as `electedInfo` for waiting validators)
|
||||
- Adjust types & metadata for latest Substrate
|
||||
- `@polkadot/util` 2.15
|
||||
|
||||
## 1.19.1 Jun 16, 2020
|
||||
|
||||
- Improve typing on `.entries()` queries (Thanks to https://github.com/monitz87)
|
||||
- Align metadata and types with latest Substrate
|
||||
- Update Polkadot types for current evolution of parachains
|
||||
- Allow for type aliasing on events (aligning with calls & queries)
|
||||
- `@polkadot/util` 2.14
|
||||
|
||||
## 1.18.1 Jun 8, 2020
|
||||
|
||||
- Expand docs on node-template types (Thanks to https://github.com/g2udevelopment)
|
||||
- Update contract fees to current impl. (Thanks to https://github.com/djuanit0x)
|
||||
- Allow `Option` types in enum/Result type generation (Thanks to http://github.com/xlc)
|
||||
- Add `.entriesPaged` and `.keysPaged` methods for state maps (https://github.com/monitz87)
|
||||
- Add types for new Substrate proxy module
|
||||
- Adjust types for new Substrate (renamed) npos-elections module
|
||||
- `Call` now exposes `method` & `section` fields (aligned with `toHuman()` representation)
|
||||
- Cater for new Substrate string subscription ids (with backwards compatibility)
|
||||
- `@polkadot/util` 2.13
|
||||
|
||||
## 1.17.2 Jun 2, 2020
|
||||
|
||||
- Ensure subscription promise resolves before first result
|
||||
|
||||
## 1.17.1 Jun 2, 2020
|
||||
|
||||
- Fix `ElectionSize` type (Thanks to https://github.com/arjanz)
|
||||
- Allow `BTreeSet` decoding from Array/JSON inputs
|
||||
- Adjust Call-only metadata output to trim documentation to first full line
|
||||
- Safeguard against divide-by-zero for total era points (expired reward eras)
|
||||
- Internal derive optimizations with combining calls
|
||||
- Support for latest Substrate types & metadata
|
||||
- `@polkadot/util` 2.12
|
||||
|
||||
## 1.16.1 May 26, 2020
|
||||
|
||||
- Support for Polkadot CC1 types & signed extensions
|
||||
- Add support for Babe VRF secondary digests (author extraction)
|
||||
- Adjust `Perbill/Permill` `toHuman()` formatting to output percentage
|
||||
- Support for latest Substrate types & metadata
|
||||
- Update to latest TypeScript, eslint & typescript-eslint
|
||||
- `@polkadot/util` 2.11
|
||||
|
||||
## 1.15.1 May 23, 2020
|
||||
|
||||
- Adjust `keyPrefix()` with DoubleMap args (Thanks to https://github.com/KiChjang)
|
||||
- Added `WeightToFeeCoefficient` type (Thanks to https://github.com/danforbes)
|
||||
- Spelling fixes for console logs (Thanks to https://github.com/JoshOrndorff)
|
||||
- Spelling fixes in cookbook (Thanks to https://github.com/pawelnguyen)
|
||||
- Add `transactionVersion` getter in payloads (Thanks to https://github.com/amaurymartiny)
|
||||
- Adjust `stakerRewards` derive ordering for improved on-payout refreshes
|
||||
- Baseline implementation for derive caching infrastructure
|
||||
- Adjust `Multiplier` type to `Fixed128` (as per latest Substrate)
|
||||
- Updated to latest Substrate metadata & add new types
|
||||
|
||||
## 1.14.1 May 14, 2020
|
||||
|
||||
- **Important** `DispatchInfo` changed `paysFee` to an enum, if using an older version use, `DispatchInfo: 'DispatchInfoTo244'`
|
||||
- Align imOnline `Heartbeat` with Substrate (Thanks to https://github.com/arjanz)
|
||||
- Adust EVM types to include `Vicinity` (Thanks to https://github.com/drewstone)
|
||||
- Add `derive.democracy.locks` to return extended lock info based on votes
|
||||
- Ensure metadata is only requested once upon startup (bypass on upgrade subscriptions)
|
||||
- Expand testing around `ExtrinsicEra` construction
|
||||
- Expand `Registry` to direct access to available signed extensions (in addition to exposed types)
|
||||
- Cater for new `CheckSpecVersion` and `CheckTxVersion` signed extensions (with `SignerPayload` adjustments)
|
||||
- Cater for new `PrevalidateAttests` signed extensions (Polkadot claims)
|
||||
- Don't re-calculate submittable extrinsic hash on status checks (optimization)
|
||||
- Support for both old/new Tuples in `democracy.depositOf` in derives
|
||||
- Fix democracy `ProxyState` types
|
||||
- Extends types for Polkadot claims
|
||||
- Update `@polkadot/util` to 2.10
|
||||
|
||||
## 1.13.1 May 6, 2020
|
||||
|
||||
- Add support for ECDSA keypairs in extrinsic signers (Thanks to https://github.com/akru)
|
||||
- Rework type generation to use templating for better maintenance (Thanks to https://github.com/xlc)
|
||||
- Adjust extrinsic `sign/signAsync` signature to optional options (Thanks to https://github.com/KiChjang)
|
||||
- Support round-robin endpoints in the `WsProvider` with array of urls (Thanks to https://github.com/hoani)
|
||||
- Remove static test-only metadata for Polkadot dev chains (not updated regularly, Substrate dev to remain)
|
||||
- Revert error swallow for wrong preimage data (temp. override for Kusama upgrade with no migration)
|
||||
- Fix `.encodedLength` calculation on `[Type; N]` types
|
||||
- Add new `rpc.grandpa.roundState` RPC
|
||||
- Update types & metadata as per latest Substrate master
|
||||
- Adjust Centrifuge starting version
|
||||
|
||||
## 1.12.2 Apr 30, 2020
|
||||
|
||||
- Update `@polkadot/util` to stable 2.9.1 (sadly missed in the previous version, stable should match to stable)
|
||||
|
||||
## 1.12.1 Apr 29, 2020
|
||||
|
||||
- Fix `CompactAssignments` types (Thanks to https://github.com/arjanz)
|
||||
- Provider ayo-connect now allows for interval config (Thanks to https://github.com/jnaviask)
|
||||
- Cleanup generation for c-like enums (Thanks to https://github.com/monitz87)
|
||||
- Allow subscription to all storage keys, alignment with Substrate (Thanks to https://github.com/xlc)
|
||||
- Cater for vote delegations in democracy derives
|
||||
- Cleanup account derive flags where to allow for optional council modules
|
||||
- Allow generic types in ApiPromise.combineLatest
|
||||
- Update to latest substrate metadata
|
||||
|
||||
## 1.11.2 Apr 22, 2020
|
||||
|
||||
- Small patch to add missing Polkadot master types (will be in next Kusama update)
|
||||
|
||||
## 1.11.1 Apr 21, 2020
|
||||
|
||||
- **Important** Substrate master has an updated `Weight` (to `u64`), on older chains apply `Weight: 'u32'` (This does affect event decoding if wrongly set)
|
||||
- Allow user type augmentation to work with different versions of rxjs (Thanks to https://github.com/monitz87)
|
||||
- Align augmented generation with camelCase (Thanks to https://github.com/monitz87)
|
||||
- Fix bitfield endian encoding (Thanks to investigation by https://github.com/xlc)
|
||||
- Add account flag derives via `accounts.flags(accountId)` (Thanks to https://github.com/kwingram25)
|
||||
- Fix entries decoding for `Option<Number>` (& simplify, decoding correctly on rpc layer)
|
||||
- Add `system.{localPeerId, localListenAddresses}` & `state.getReadProof` RPCs
|
||||
- Ensure proper propagation of `api.runtimeVersion` (used for signing) after upgrade
|
||||
- Field ordering fix for deprecated `Linkage` (used in linked maps)
|
||||
- `derive.account.info` now returns all field enum types decoded (not only raw)
|
||||
- Add banner with FAQ entries for node-template to aid with common issues
|
||||
- `Digest` has been moved to definitions, removal of `GenericDigest` type
|
||||
- Support `Fixed128` type
|
||||
- Add `transactionVersion` to `RuntimeVersion` struct
|
||||
- Enhance API support for non-subscription providers (skip subscription to runtimeVersion)
|
||||
- Adjust types for Kusama 1057 (notably the new `StakingLedger`)
|
||||
|
||||
## 1.10.1 Apr 13, 2020
|
||||
|
||||
- **Important** Substrate master has updated staking, on older chains apply `StakingLedger: 'StakingLedgerTo240'`
|
||||
- Add `rpc.system.chainType` to retrieve the chain type (Development. Local, Live & Custom)
|
||||
- Adjust types for Westend after the reset
|
||||
- Adjust democracy derives, including the support of the frame-scheduler for scheduled deployments
|
||||
- Allow staking derives to work with new staking payouts, specifically `tx.staking.payoutStakers`
|
||||
- Cleanups to derives for democracy & staking to be more performant
|
||||
- Add Centrifuge base types to `@polkadot/types-known`
|
||||
- Adjust with all the latest substrate master types
|
||||
- Internally all private/protected methods/variables are now `_` prefixed (Aligning with the `private/protected` indicators in the TS definitions)
|
||||
- Update metadata/docs-from-metadata to the latest Substrate
|
||||
|
||||
## 1.9.1 Apr 1, 2020
|
||||
|
||||
- **Breaking change** (TypeScript with derives only) The return type names for `api.derive.*` have been adjusted for consistency, all starting with `Derive*` (previously a mixture of `Derived*` and `Derive*`)
|
||||
- **Breaking change** (derives only) Additional cleanups of democracy proposal & referenda derives, including support for new Polkadot/Substrate vote retrievals
|
||||
- Tx signing via `signAndSend` & `signAsync` now tries to use the last finalized block (depending on finalized drift)
|
||||
- Add support for `api.rpc.childstate.*` Substrate RPCs, older nodes with still populate `api.rpc.state.*` with the child methods
|
||||
- Adjust `Error.message` on RPC failures to not include the (already known) method signature
|
||||
- Split `@polkadot/types/known` into `@polkadot/types-known`, allowing for base API overrides
|
||||
- Extended `api.derive.democracy` to cater for dispatchQueue and externals
|
||||
- Extended `api.derive.council` to cater for new phragmen elections
|
||||
- Use new `queryStorageAt` for query `.entries`, removing unneeded subscriptions (use as available)
|
||||
- Fix `BTreeSet` initialization when it forms part of query interfaces
|
||||
- Fix encoding for `Vec<u8>`-related types as part of constants
|
||||
- Internal adjustment of interface type locations (no impact on imports via `@polkadot/types/interfaces`)
|
||||
|
||||
## 1.8.1 Mar 22, 2020
|
||||
|
||||
- **Breaking change** The format for any custom RPCs have been changed (alongside API-internal changes) to allow for better RPC management. If you are currently using custom RPCs (or planning to do so), look at the [updated documentation](https://polkadot.js.org/api/start/rpc.custom.html)
|
||||
- **Breaking change** Alongside API RPC changes, the `@polkadot/jsonrpc` package has been removed. Since it was never documented and only used internally, this should not have adverse impacts. All RPC definitions itself has now been moved to the relevant modules inside `@polkadot/types/interfaces`
|
||||
- **Important** Substrate has an updated democracy module. If using an older chain add the `ReferendumInfo: 'ReferendumInfoTo239'` type when using referendums
|
||||
- The `isRetracted` Extrinsic status is now a warning, not a fatal error, correctly aligning with Polkadot/Substrate
|
||||
- The Substrate extrinsic phase definitions has been expanded with `Initialization` to align with the latest versions
|
||||
- Add support for all known substrate RPC methods
|
||||
- Extend account derives to include status flags, e.g. `isCouncil`, `isSudo`, ...
|
||||
- Adjusted referendum derives to cater for bot new/old democracy. Derived `referendumInfo` now includes `status` field, not `info`
|
||||
- Add `initWasm` flag to API options. When set to `false` does not init the WASM portion (leaving it to the user elsewhere)
|
||||
|
||||
## 1.7.1 Mar 17, 2020
|
||||
|
||||
- **Important** Current versions of Polkadot/Substrate have dropped support for linked maps on storage entries. If you are using these queries to retrieve all entries, for instance `staking.{nominators,validators}()` and using an upgraded chain, you need to swap to retrieving entries via `.entries()` or `.keys()` for the keys.
|
||||
- Pull in support and types for latest Polkadot/Substrate
|
||||
- Add support for the new Substrate `state_getKeysPaged` RPC, including use in storage keys
|
||||
- Move `derive.staking.controllers` to `derive.staking.stashes`, reflecting actual content
|
||||
- Cater for adjusted storage (non-linked mapped) for `derive.staking.stashes` queries (with old-compat)
|
||||
- Expanded `derive.staking.*` derives, including addition of `derive.staking.own*`
|
||||
- Re-add fixed (with tests) checks for query args, previously disabled in 1.6.2
|
||||
|
||||
## 1.6.2 Mar 12, 2020
|
||||
|
||||
- Revert checks for query args, not working on `.at()` queries (proper fix in next version)
|
||||
|
||||
## 1.6.1 Mar 12, 2020
|
||||
|
||||
- **Breaking change** `api.rpc.state.queryStorage(...)` now fully decodes the `Vec<StorageChangeSet>` and returns a decoded `[Hash, Codec[]][]` when using this RPC.
|
||||
- `StorageKey` now has an `.args` property, decoded from meta where `twox64_concat` or `blake128_concat` are used on maps
|
||||
- Fix `api.query.*.*.entries` type conversions to return exact types (not `Option` in some cases)
|
||||
- Add `api.query.*.*.keys` to retrieve only the storage keys, similar to `.entries`
|
||||
- Full linked map retrievals will now use direct getStorage queries for faster operation
|
||||
- Underlying rpc-core interfaces now unwraps `Error("...")` when found in responses
|
||||
- Added `derive.eras*` interfaces for queries to new Substrate staking interfaces
|
||||
- Update `derive.account` to cater for new indices module storage (detected with fallbacks)
|
||||
- Adjust derive queries for session without module prefix (DoubleMap -> Map), detected on use
|
||||
- Add runtime validation for map arguments to `api.query.*`
|
||||
- TypeScript interfaces for linked maps now correctly generates as `[Type, Linkage<Next>]`
|
||||
|
||||
## 1.5.1 Mar 06, 2020
|
||||
|
||||
- **Important** Substrate master has updated staking, on older chains supply `StakingLedger: 'StakingLedgerTo223'`
|
||||
- **Important** Substrate master has updated collective, on older chains supply `Votes: 'VotesTo230'`
|
||||
- Add proper support for type generation with an Enum containing an Tuple (Thanks to https://github.com/monitz87)
|
||||
- Fix storage parsing not resulting in rejected Promises (Fix from https://github.com/aniiantt applied)
|
||||
- Remove use of deprecated `Observable.create` (Thanks to https://github.com/Himself65)
|
||||
- Add types & metadata for the latest Polkadot/Substrate runtime versions (master branches)
|
||||
- Type extraction will now allow the same sub-module name across packages, i.e. `@polkadot/types/interfaces/runtime` & `@mine/interfaces/runtime` will be valid
|
||||
- Add `.range([from, to]: [Hash, Hash?], ...args: any[]): [Hash, Codec][]` on all storage entries
|
||||
- Add `.raw(...args: any[]): Promise<Uint8Array & Codec>` to all RPC calls, returning the un-encoded result
|
||||
- Allow pre-module type aliasing with `typesAlias: { <moduleName>: { <meta-type>: <alias-type> } }` in API construction options
|
||||
- Allow `BTreeMap` to be initialized with a `Record<string, any>` object (in addition to `Map`)
|
||||
- Allow for `HashMap<KeyType, ValueType>` definitions
|
||||
- `Bool` will now correctly return `isEmpty` on false/default values
|
||||
- Refresh the `NetworkState` types as returned by the `rpc.system.networkState()` call to current
|
||||
- Expose `registry.createClass(<typeName>)` to allow for creating type classes. If you are using `createClass` or `ClassOf` in your code, it is recommended to swap to this instance.
|
||||
- Add additional derives to `api.derive.staking` to handle lazy-payout retrievals
|
||||
- Update `@polkadot/{util, util-crypto, keyring}` to 1.6.1 & `@polkadot/wasm` to 1.2.1
|
||||
|
||||
## 1.4.2 Feb 27, 2020
|
||||
|
||||
- Fix `api.tx(<extrinsic>): Submittable` decoration (non-working in 1.4.1, now with proper test)
|
||||
|
||||
## 1.4.1 Feb 26, 2020
|
||||
|
||||
- **Breaking change** (TypeScript only) The `*.d.ts` files now contain TypeScript 3.8 features (specifically `#private`), which is not usable in TS versions < 3.8
|
||||
- **Breaking change** - `api.derive.staking.*` has updated result types and detects support for lazy payouts queries
|
||||
- Rework type generation for `api.{query, tx}` to properly handle complex type inputs (Thanks to https://github.com/monitz87)
|
||||
- Rework metadata `--strict` mode to effectively decorate chain metadata (Thanks to https://github.com/monitz87)
|
||||
- Add `api.rpc.chain.subscribeAllHeads` (not just best) (Thanks to https://github.com/jak-pan)
|
||||
- Add `api.rpc.engine.*` for manual seal support
|
||||
- Add `api.injectMetadata(metadata)` to initialize API with a specific metadata version
|
||||
- The api now checks for runtime upgrades, augmenting the interfaces with new metadata when found
|
||||
- Support types & interfaces required for lazy reaping, lazy payouts & offchain phragmen
|
||||
- `Option` types now has an `.unwrapOrDefault` as an complement to `.unwrap` & `.unwrapOr`
|
||||
- Support JS `BigInt` inputs in any derived `UInt` and `Int` object, e.g. `api.tx.balances.transfer(..., 9876543210123456789n)`
|
||||
- `UInt` & `Int` now does source bitLength checks upon construction
|
||||
- Registry now exposes `.createType(<type>, ...args)` as an additional helper (like the API)
|
||||
- Expand `.toHuman` on `ExtrinsicEra`, `SubmittableResult` & `Vote`
|
||||
- Move `DigestItem`, `Fixed64`, `H160`, `H256` & `H512` to interfaces in `@polkadot/types/interfaces`
|
||||
- Align construction of unknown types in `registry.get` consistently warn on detection, throw on use
|
||||
- Support for arbitrary `u*`` types via `UInt<bitLength>` type definitions
|
||||
- Expose static `.with` on `UInt`, `Int` & `U8aFixed` classes with optional type name override
|
||||
- Remove [11 Jan 2019](https://github.com/polkadot-js/api/issues/574) extrinsic length hack
|
||||
- Use ES `#field` on private class fields as applicable
|
||||
- Move `types/primitive/{extrinsics, generic}` to `types/{extrinsics, generic}`
|
||||
- Cleanup augmentation and generation scripts for type definitions, aligning with api augmentation
|
||||
- Bump to `@polkadot/{util, util-crypto, keyring}` 2.5.1
|
||||
|
||||
## 1.3.1 Feb 18, 2020
|
||||
|
||||
- Add `@types/bn.js` as a normal dependency, exposed in `*.d.ts` (Thanks to https://github.com/monitz87)
|
||||
- Type generation scripts (including `polkadot-types-from-{chain,defs}`) has been moved to the `@polkadot/typegen` package
|
||||
- The `@polkadot/types/codec/create` has been moved to `@polkadot/types/create`, imports from `@polkadot/types` are unaffected
|
||||
- Expose chain properties on registry (and use for API type formatting)
|
||||
- Add `toHuman(isExtended?: boolean)` to all codec types, formatting into a human-readable structure
|
||||
|
||||
## 1.2.1 Feb 16, 2020
|
||||
|
||||
- **Important** Update RPC status codes (latest Substrate 2), with the `isInBlock` (`isFinalized` now indicates finality)
|
||||
- Storage `.entries(arg?: any)` now has the correct argument type for DoubleMap (Thanks to https://github.com/monitz87)
|
||||
- Swap Kusama and Polkadot aliasses for `Address` to `AccountId` (future update)
|
||||
- Add `LookupSource` and `LookupTarget` types instead of mapping these directly for aliassing
|
||||
- Swap Kusama and Polkadot aliases for `Address` to `AccountId` (future update)
|
||||
- Add `LookupSource` and `LookupTarget` types instead of mapping these directly for aliasing
|
||||
- Add `BitVec` type primitive
|
||||
- Add support for `system.account` for balance & nonce queries in derives as well as Submittables (Substrate composites)
|
||||
- Add `rpc.author.hasKey` and `rpc.author.hasSessinKeys` RPCs
|
||||
- Add `rpc.author.hasKey` and `rpc.author.hasSessionKeys` RPCs
|
||||
- Add derives for the parachains interfaces
|
||||
- Applied the latest types for Polkadot parachains
|
||||
- `registry.findMetaError` now can take in a `DispatchErrorModule` object for error lookups (from `asModule` in `DispatchError`)
|
||||
- Metadata now correctly serializes to the original input data via `toHex()` & `toU8a()`
|
||||
- Metadata dcocumentation generation rework, including the output of errors from metadata
|
||||
- Metadata documentation generation rework, including the output of errors from metadata
|
||||
- Update all examples and comments to use latest `system.account` queries (instead of `system.accountNonce` and `balances.freeBalance`/`balances.reservedBalance`)
|
||||
- Cleanup `codec/Date` tests to make it run properly on all timezones
|
||||
- Add explicit dependencies to all packages and move TypeScript `@types/*` to dev deps
|
||||
|
||||
# 1.1.1 Feb 06, 2020
|
||||
## 1.1.1 Feb 06, 2020
|
||||
|
||||
- **Important** Chains without `balances.account` or `system.account` should supply `"BalanceLock": "BalanceLockTo212"` to their types to use the previous-generation `BalanceLock` (when querying locks)
|
||||
- Add support for `balances.account` in all applicable derives (incl. `vesting` module)
|
||||
@@ -30,7 +318,7 @@
|
||||
- Adjust balances fees derivation with optional transfer and creation fees (removed in Substrate)
|
||||
- Adjust enum `.toJSON()` to return type name as specified
|
||||
|
||||
# 1.0.1 Jan 30, 2020
|
||||
## 1.0.1 Jan 30, 2020
|
||||
|
||||
- **Breaking change** Drop support for Substrate v1 chain in all derives
|
||||
- Return unsub functions from provider .on emitters (Thanks to https://github.com/jak-pan)
|
||||
@@ -49,9 +337,9 @@
|
||||
- Remove support for un-deployed metadata
|
||||
- Remove old known types for Substrate V1
|
||||
|
||||
# 0.100.1 Jan 13, 2020
|
||||
## 0.100.1 Jan 13, 2020
|
||||
|
||||
- **Important** This will the the last API version with Substrate 1.x support. Although you will still be able to use subsequent versions with older chans, dependent libraries such as sr25519 may not be compatible.
|
||||
- **Important** This will the the last API version with Substrate 1.x support. Although you will still be able to use subsequent versions with older chains, dependent libraries such as sr25519 may not be compatible.
|
||||
- Add support for the Substrate identity module
|
||||
- Remove the `codec/Data` type, to remove a conflict with Substrate. This type is now named `Raw`
|
||||
- Fix for linked maps using `Option`
|
||||
@@ -60,16 +348,16 @@
|
||||
- Add support for latest Polkadot/Substrate types
|
||||
- Add `paymentInfo` to submittables to calculate fees
|
||||
|
||||
# 0.99.1 Dec 13, 2019
|
||||
## 0.99.1 Dec 13, 2019
|
||||
|
||||
- **Breaking change** The `Data` and `U8a` type has been renamed and just replaced with the `Raw` type
|
||||
- **Breaking change** The `api.derive.staking.info` has been split into 2 - `staking.query` for non-balance related information (more effective) and `staking.account` that enhances query for all the information previously found `.info`
|
||||
- Cleanup `DoubleMap` hashing to always hash over the full value (in the case of `Vec<T>`, this includes the length)
|
||||
- Update democracy derives to take care of nextTally and lowestU*nbaked
|
||||
- Update democracy derives to take care of nextTally and lowestUnbaked
|
||||
- Add additional derives for both council & treasury
|
||||
- Alignment with latest Polkadot/Substrate master branch types
|
||||
|
||||
# 0.98.1 Dec 04, 2019
|
||||
## 0.98.1 Dec 04, 2019
|
||||
|
||||
- Make the TypeScript generation script mor re-usable (Thanks to https://github.com/xlc)
|
||||
- Add `.entries()` for all map-types, returning storage keys and values
|
||||
@@ -78,7 +366,7 @@
|
||||
- Support for new Substrate democracy with preimages in derive
|
||||
- Alignment of types with Substrate/Polkadot master branches
|
||||
|
||||
# 0.97.1 Nov 29, 2019
|
||||
## 0.97.1 Nov 29, 2019
|
||||
|
||||
- **Breaking change** Add the passing on an explicit `Registry` to all calls to `createType` as well as all codec classes. If you are upgrading form an older version, use the [migration guide](UPGRADING.md) to walk through the changes required.
|
||||
- **Breaking change** The metadata classes have been moved from `@polkadot/types` into `@polkadot/metadata`. If you explicitly create `Metadata` classes, you now would need to do so with the `import Metadata from '@polkadot/metadata';` This is a decorated class, where the previous metadata is now available on `Metadata.metadata`, alongside decorated `consts.*`', `tx.*` and `query.*`.
|
||||
@@ -90,7 +378,7 @@
|
||||
- Support for Metadata V9, which adjusts the hashing methods of storage entries
|
||||
- Support for Metadata V10 (still un-released), which includes prefixed map support
|
||||
|
||||
# 0.96.1 Nov 09, 2019
|
||||
## 0.96.1 Nov 09, 2019
|
||||
|
||||
- Updated types for latest Kusama
|
||||
- Add `filterRecords` (in addition to `findRecord`) on submittable results
|
||||
@@ -100,11 +388,11 @@
|
||||
- Update council derives for the latest Substrate master support (with constants)
|
||||
- Derive cleanups, including sharing of instances between the API and internal to derives
|
||||
|
||||
# 0.95.2 Oct 25, 2019
|
||||
## 0.95.2 Oct 25, 2019
|
||||
|
||||
- Temporary removal of `account_nextIndex` use, will be re-added in a future release
|
||||
|
||||
# 0.95.1 Oct 25, 2019
|
||||
## 0.95.1 Oct 25, 2019
|
||||
|
||||
- Support Extrinsic V4 with additional signature indicator (Latest Polkadot/Substrate/Kusama)
|
||||
- Adjust subscription update checks to avoid duplicated data updates
|
||||
@@ -114,19 +402,19 @@
|
||||
- All latest Polkadot & Substrate types (as per master branches)
|
||||
- **Breaking change** `Call.injectMethods` is moved to `Call.injectMetadata` to align with `Events` (This _should_ not be used externally, however mentioned as breaking here)
|
||||
|
||||
# 0.94.1 Oct 07, 2019
|
||||
## 0.94.1 Oct 07, 2019
|
||||
|
||||
- Add handling of `Result<Ok, Error>` definitions
|
||||
- Adjust API cloning now takes RPC filters from source into account
|
||||
- Simplification of isPedantic checks and less overhead on StorageData types
|
||||
- Cleanups and fixes around RPC and derive type definitions
|
||||
- Fix `derive.imOnline.receivedHeatbeats` to query via indexes
|
||||
- Fix `derive.imOnline.receivedHeartbeats` to query via indexes
|
||||
- Adjustment of `api.derive.elections.{approvalsOf|approvalsOfAt}` to allow ss58 address input
|
||||
- Cleanup `Enum` `.eq` handling to be more exhaustive
|
||||
- Add documentation for custom extrinsic formats (advanced chains)
|
||||
- Update to latest substrate master metadata
|
||||
|
||||
# 0.93.1 Sep 26, 2019
|
||||
## 0.93.1 Sep 26, 2019
|
||||
|
||||
- Support for Kusama CC2
|
||||
- In extrinsic submission, use `rpc.account.nextIndex` to retrieve the nonce when available
|
||||
@@ -136,7 +424,7 @@
|
||||
- Support recursive type registration (self-referencing via `Box`) in addition to better sanitation of user-defined-types
|
||||
- Documentation and example updates (thanks mostly to contributions)
|
||||
|
||||
# 0.92.1 Sep 12, 2019
|
||||
## 0.92.1 Sep 12, 2019
|
||||
|
||||
- The API now correctly sets the ss58 prefix as retrieved from the chain properties via `ss58Format`
|
||||
- Bump to `@polkadot/util` 1.4.1, removing use of `ExtError`
|
||||
@@ -144,7 +432,7 @@
|
||||
- Support the latest Polkadot & Substrate master branches (incl. metadata updates)
|
||||
- Getting started documentation has been made available
|
||||
|
||||
# 0.91.1 Sep 09, 2019
|
||||
## 0.91.1 Sep 09, 2019
|
||||
|
||||
- This release was focussed on stability, with a number of cleanups and bug-fixes
|
||||
- Adjustments for Substrate 1.x chain detection (with auto-types) and Substrate 2.x support has been extended with all latest types
|
||||
@@ -154,11 +442,11 @@
|
||||
- Redeemed balance calculation if `api.derive` now returns the correct values again (bug fix)
|
||||
- added the `yarn chain:info [--ws URL]` utility to extract a calls-only metadata version
|
||||
- Missing types are now logged via a `console.warn`, not via `.error`
|
||||
- `Extrinsic`, `ExtrinsicPayload` & `SignerPayload` is registered in the type registry and can be overriden now
|
||||
- `Extrinsic`, `ExtrinsicPayload` & `SignerPayload` is registered in the type registry and can be overridden now
|
||||
- **Breaking change** `SignerPayload` is renamed to `SignerPayloadJSON`
|
||||
- **Breaking change** `SignerPayloadJSON`, `SignerPayloadRawBase` and `SignerPayloadRaw` are all moved to `@polkadot/types`
|
||||
|
||||
# 0.90.1 Aug 24, 2019
|
||||
## 0.90.1 Aug 24, 2019
|
||||
|
||||
If you are upgrading form an older version, use the CHANGELOG hand-in-hand with the [migration guide](UPGRADING.md).
|
||||
|
||||
@@ -176,11 +464,11 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- The `types/codec/createType` has been moved to `types/codec/create` with the same exports. If you explicitly imported from here (and not doing the suggested `import { createType } from '@polkadot/types`), the reference needs to be updated
|
||||
|
||||
|
||||
# 0.82.0-beta.x Jul 28, 2019
|
||||
## 0.82.0-beta.x Jul 28, 2019
|
||||
|
||||
- Support for substrate 2.x (master) has been extended,
|
||||
- Additional types have been addedd for the modules
|
||||
- `api.derive.contract` is now `api.derive.contracts` to align with the substrate 2.x rename. (Feture detection is used so it supports both 1.x and 2.x chains)
|
||||
- `api.derive.contract` is now `api.derive.contracts` to align with the substrate 2.x rename. (Feature detection is used so it supports both 1.x and 2.x chains)
|
||||
- Addition of `api.derive.elections`
|
||||
|
||||
- Support latest substrate 2 v6 metadata with module constants using `api.consts`.
|
||||
@@ -195,7 +483,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- The `ContractsAbi` type has been moved from `@polkadot/types` to `import { Abi } from '@polkadot/api-contract`. This paves the way for an enhanced contracts interface, instead of dealing with low-level API calls.
|
||||
|
||||
|
||||
# 0.81.1 Jun 14, 2019
|
||||
## 0.81.1 Jun 14, 2019
|
||||
|
||||
- The dependency on `@polkadot/keyring` has been removed - if you relied on the API to provide this, you would now need to manually add it
|
||||
- `createType` allows for the creation of `[u8; <length>]` types (opening the door for contract support)
|
||||
@@ -215,7 +503,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Add `off` method to `Api` (Base, for both `ApiPromise` & `ApiRx`) to remove an event listener
|
||||
|
||||
|
||||
# 0.80.1 Jun 04, 2019
|
||||
## 0.80.1 Jun 04, 2019
|
||||
|
||||
- Support for mortal transactions
|
||||
- Better DoubleMap storage support
|
||||
@@ -225,7 +513,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Misc. cleanups and fixes
|
||||
|
||||
|
||||
# 0.79.1 May 22, 2019
|
||||
## 0.79.1 May 22, 2019
|
||||
|
||||
- DoubleMap query support
|
||||
- Support latest EventRecord metadata (substrate master)
|
||||
@@ -237,7 +525,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Add `toRawType` on all type classes (breakdown into primitive types)
|
||||
|
||||
|
||||
# 0.78.1 May 08, 2019
|
||||
## 0.78.1 May 08, 2019
|
||||
|
||||
- Fix linked-maps (not working since 0.77.1)
|
||||
- Convert Usize to U32 (as found in WASM environments)
|
||||
@@ -248,13 +536,13 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Metadata updates for substrate (WithdrawReasons, ContractInfo)
|
||||
|
||||
|
||||
# 0.77.1 Apr 25, 2019
|
||||
## 0.77.1 Apr 25, 2019
|
||||
|
||||
- Support Metadata v4, which introduces the use of a custom hasher to hash storage map keys.
|
||||
- Add TreasuryProposal (not the same as democracy, type aliased)
|
||||
|
||||
|
||||
# 0.76.1 Apr 03, 2019
|
||||
## 0.76.1 Apr 03, 2019
|
||||
|
||||
- Caching improvements (duplicate queries, no duplicate subscriptions)
|
||||
- Experimental contract API
|
||||
@@ -262,12 +550,12 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Update @polkadot/util-crypto with smaller footprint
|
||||
|
||||
|
||||
# 0.75.1 Mar 29, 2019
|
||||
## 0.75.1 Mar 29, 2019
|
||||
|
||||
- Start journey to 1.0
|
||||
|
||||
|
||||
# 0.53.1 Mar 29, 2019
|
||||
## 0.53.1 Mar 29, 2019
|
||||
|
||||
- Change spelling to US English as per substrate master (1.0-rc1). Breaking changes as a result:
|
||||
- For extrinsic status results, if you have checked the type returns, i.e. `result.type === 'Finalised'` now check on the status for `result.status.isFinalized` or `result.status.isBroadcast`, ... (the `type` property is now accessible only on `result.status.type`)
|
||||
@@ -278,7 +566,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- All examples have been updated with sr25519 addresses (with the new checksums)
|
||||
|
||||
|
||||
# 0.52.1 Mar 28, 2019
|
||||
## 0.52.1 Mar 28, 2019
|
||||
|
||||
- Support queries to linked mapped storage (found in new staking interfaces)
|
||||
- Add `derive.staking.controllers` to retrieve all active staking controllers
|
||||
@@ -288,42 +576,42 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Check for single instances for api and types as they are loaded (assertSingletonPackage)
|
||||
|
||||
|
||||
# 0.51.1 Mar 25, 2019
|
||||
## 0.51.1 Mar 25, 2019
|
||||
|
||||
- Support metadata V2 as per latest substrate master
|
||||
- Update metadata with new types as per latest substrate master
|
||||
|
||||
|
||||
# 0.50.1 Mar 23, 2019
|
||||
## 0.50.1 Mar 23, 2019
|
||||
|
||||
- Latest util-crypto (usage of WASM with JS fallbacks if not available)
|
||||
- Update upstream @polkadot dependencies (for new crypto)
|
||||
|
||||
|
||||
# 0.49.1 Mar 20, 2019
|
||||
## 0.49.1 Mar 20, 2019
|
||||
|
||||
- Fix large message signing on non-known nodes (default is now hashing, there has been enough time between upgrades)
|
||||
|
||||
|
||||
# 0.48.1 Mar 18, 2019
|
||||
## 0.48.1 Mar 18, 2019
|
||||
|
||||
- Pull in new sr25519 capable keyring for dev nodes
|
||||
- When using dev mode, it assumes that the node is the latest with derived sr25519 keys
|
||||
|
||||
|
||||
# 0.47.1 Mar 14, 2019
|
||||
## 0.47.1 Mar 14, 2019
|
||||
|
||||
- Swap to publishing -beta.x on merge (non-breaking testing)
|
||||
|
||||
|
||||
# 0.46.1 Mar 01, 2019
|
||||
## 0.46.1 Mar 01, 2019
|
||||
|
||||
- Extended type registration to now handle internal types as well. Additionally the built-in Extrinsic type can now we overridden with a custom version.
|
||||
- Where `Extrinsic` and `Method` is used as types, consider importing `{ IMethod, IExtrinsic }` from `@polkadot/types/types`, especially in the cases where this is used from a `SubmittableExtrinsic`
|
||||
- The `typeRegistry` constant is now `getTypeRegistry()` as a function
|
||||
|
||||
|
||||
# 0.45.1 Feb 19, 2019
|
||||
## 0.45.1 Feb 19, 2019
|
||||
|
||||
- Storage with option values now correctly return `Option<Type>` and is indicated as such in the documentation
|
||||
|
||||
@@ -340,7 +628,7 @@ console.log('llo', llo.unwrapOr('not set') /* Option<BlockNumber> */)
|
||||
```
|
||||
|
||||
|
||||
# 0.44.1 Feb 19, 2019
|
||||
## 0.44.1 Feb 19, 2019
|
||||
|
||||
- Split primitives and types into separate folders. This should not affect external use since the exports remain the same, however does have an impact where classes are referenced directly. e.g.
|
||||
|
||||
@@ -358,45 +646,45 @@ import { Method, Signature } from '@polkadot/types';
|
||||
```
|
||||
|
||||
|
||||
# 0.43.1 Feb 14, 2019
|
||||
## 0.43.1 Feb 14, 2019
|
||||
|
||||
- Introduces support for the new keyring with sr25519 support in addition to ed25519. While this does not change the exposed API, it is considered breaking since @polkadot/keyring has interface changes. (Unless needed, don't rush the upgrade)
|
||||
|
||||
|
||||
# 0.42.1 Jan 31, 2019
|
||||
## 0.42.1 Jan 31, 2019
|
||||
|
||||
- Support for substrate hash signing with implVersion >= 18
|
||||
- Changed signatures for Extrinsic signing, this should not have (much) of an impact since it is generally not used directly. SubmittableExtrinsic (as exposed by the API), supports the old-style use.
|
||||
|
||||
|
||||
# 0.41.1 Jan 26, 2019
|
||||
## 0.41.1 Jan 26, 2019
|
||||
|
||||
- Support the V1 metadata specification from Substrate in addition to the currently testnet active V0 version
|
||||
|
||||
|
||||
# 0.40.1 Jan 16, 2019
|
||||
## 0.40.1 Jan 16, 2019
|
||||
|
||||
- The API interfaces now require a WS-compatible provider, e.g. subscription support is a must. Previously the HTTPProvider could be use (although it was very limited in the interactions).
|
||||
|
||||
|
||||
# 0.39.1 Jan 11, 2019
|
||||
## 0.39.1 Jan 11, 2019
|
||||
|
||||
- The Promise API now returns a `Promise<UnsubFunction>` instead of `UnsubFunction` when making subscriptions.
|
||||
|
||||
|
||||
# 0.38.1 Jan 08, 2019
|
||||
## 0.38.1 Jan 08, 2019
|
||||
|
||||
Substrate has been updated with a breaking new transaction format where the Index/Nonce is now encoded as a Compact. This change is being rolled out to both Alexander (Polkadot testnet) as well as Charred Cherry (Substrate testnet) - transactions between old and new are not compatible.
|
||||
|
||||
|
||||
# 0.37.1 Jan 04, 2019
|
||||
## 0.37.1 Jan 04, 2019
|
||||
|
||||
api-observable has been removed. This was only used in /apps and inconsistent with the api/rx and api/promise APIs. Future work will include derives like was included in api-observable into the base.
|
||||
|
||||
Tuples now return single types when only one type is available, i.e. `(AccountId)` would now resolve as `AccountId`. The extra type wrapper adds no benefit to users here.
|
||||
|
||||
|
||||
# 0.36.1 Jan 03, 2019
|
||||
## 0.36.1 Jan 03, 2019
|
||||
|
||||
Api Promise has been updated in the way we deal with subscriptions. Previously a subscription returned `Promise<number>` where the caller was to keep track of the id and use it in subsequent unsubscribes. Now any subscriptions return an unsubscribe/destroy function `(): void`, that is use for removing the subscriptions, e.g.
|
||||
|
||||
@@ -407,51 +695,51 @@ unsubscribe(); // here we destroy the subscription
|
||||
```
|
||||
|
||||
|
||||
# 0.35.1 Dec 20, 2018
|
||||
## 0.35.1 Dec 20, 2018
|
||||
|
||||
Swapped to new metadata structures from Substrate. If the API is not working with your node, update Substrate to latest master branch. (Or 0.9.1 for Charred Cherry). Dropped support for old metadata as found as far back as BBQ Birch.
|
||||
|
||||
|
||||
# 0.34.1 Dec 18, 2018
|
||||
## 0.34.1 Dec 18, 2018
|
||||
|
||||
Changed the send signature (for future expansion of eg. events) to return `result: { status: ExtrinsicStatus }` instead of `status: ExtrinsicStatus`. For most cases where only status `type` checks are used, i.e. `status.type === 'Finalised'` this should not be a breaking change. Deep inspection of the status object however will need to adapt.
|
||||
|
||||
# 0.33.1 Dec 06, 2018
|
||||
## 0.33.1 Dec 06, 2018
|
||||
|
||||
# 0.32.1 Nov 21, 2018
|
||||
## 0.32.1 Nov 21, 2018
|
||||
|
||||
# 0.31.1 Oct 10, 2018
|
||||
## 0.31.1 Oct 10, 2018
|
||||
|
||||
# 0.30.1 Sep 27, 2018
|
||||
## 0.30.1 Sep 27, 2018
|
||||
|
||||
# 0.29.1 Sep 14, 2018
|
||||
## 0.29.1 Sep 14, 2018
|
||||
|
||||
# 0.28.1 Aug 11, 2018
|
||||
## 0.28.1 Aug 11, 2018
|
||||
|
||||
# 0.15.1 Aug 07, 2018
|
||||
## 0.15.1 Aug 07, 2018
|
||||
|
||||
# 0.14.1 Jun 23, 2018
|
||||
## 0.14.1 Jun 23, 2018
|
||||
|
||||
# 0.13.1 May 29, 2018
|
||||
## 0.13.1 May 29, 2018
|
||||
|
||||
# 0.12.1 May 18, 2018
|
||||
## 0.12.1 May 18, 2018
|
||||
|
||||
# 0.11.1 May 16, 2018
|
||||
## 0.11.1 May 16, 2018
|
||||
|
||||
# 0.10.1 May 07, 2018
|
||||
## 0.10.1 May 07, 2018
|
||||
|
||||
# 0.9.1 Apr 24, 2018
|
||||
## 0.9.1 Apr 24, 2018
|
||||
|
||||
# 0.8.1 Mar 15, 2018
|
||||
## 0.8.1 Mar 15, 2018
|
||||
|
||||
# 0.7.1 Jan 25, 2018
|
||||
## 0.7.1 Jan 25, 2018
|
||||
|
||||
# 0.6.1 Dec 03, 2017
|
||||
## 0.6.1 Dec 03, 2017
|
||||
|
||||
# 0.5.1 Nov 28, 2017
|
||||
## 0.5.1 Nov 28, 2017
|
||||
|
||||
# 0.4.1 Nov 19, 2017
|
||||
## 0.4.1 Nov 19, 2017
|
||||
|
||||
# 0.3.1 Nov 19, 2017
|
||||
## 0.3.1 Nov 19, 2017
|
||||
|
||||
# 0.2.1 Nov 18, 2017
|
||||
## 0.2.1 Nov 18, 2017
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
# @polkadot/api
|
||||
|
||||
This library provides a clean wrapper around all the methods exposed by a Polkadot/Subtrate network client and defines all the types exposed by a node. For complete documentation around the classes, interfaces and their use, visit the [documentation portal](https://polkadot.js.org/api/).
|
||||
This library provides a clean wrapper around all the methods exposed by a Polkadot/Substrate network client and defines all the types exposed by a node. For complete documentation around the classes, interfaces and their use, visit the [documentation portal](https://polkadot.js.org/api/).
|
||||
|
||||
If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.md) and [UPGRADING](UPGRADING.md) guides when changing versions.
|
||||
|
||||
@@ -27,7 +27,7 @@ The API is split up into a number of internal packages -
|
||||
|
||||
Type definitions for interfaces as exposed by Polkadot & Substrate clients -
|
||||
|
||||
- [@polkadot/jsonrpc](packages/type-jsonrpc/) Definitions for JSONRPC endpoints
|
||||
- [@polkadot/jsonrpc](packages/jsonrpc/) Definitions for JSONRPC endpoints
|
||||
- [@polkadot/types](packages/types/) Codecs for all Polkadot and Substrate primitives
|
||||
|
||||
## development
|
||||
|
||||
+5
-3
@@ -1,3 +1,5 @@
|
||||
module.exports = {
|
||||
extends: '@polkadot/dev/config/babel'
|
||||
};
|
||||
// Copyright 2017-2020 @polkadot/api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
module.exports = require('@polkadot/dev/config/babel');
|
||||
|
||||
+11
-10
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function copy_folder () {
|
||||
SRC="packages/$1/build"
|
||||
DST="../apps/node_modules/@polkadot/$2"
|
||||
DST="../apps/node_modules/@polkadot/$1"
|
||||
|
||||
echo "** Copying $SRC to $DST"
|
||||
|
||||
@@ -12,11 +12,12 @@ function copy_folder () {
|
||||
|
||||
yarn polkadot-dev-build-ts
|
||||
|
||||
copy_folder "api" "api"
|
||||
copy_folder "api-contract" "api-contract"
|
||||
copy_folder "api-derive" "api-derive"
|
||||
copy_folder "metadata" "metadata"
|
||||
copy_folder "rpc-core" "rpc-core"
|
||||
copy_folder "rpc-provider" "rpc-provider"
|
||||
copy_folder "type-jsonrpc" "jsonrpc"
|
||||
copy_folder "types" "types"
|
||||
copy_folder "api"
|
||||
copy_folder "api-contract"
|
||||
copy_folder "api-derive"
|
||||
copy_folder "metadata"
|
||||
copy_folder "rpc-core"
|
||||
copy_folder "rpc-provider"
|
||||
copy_folder "types"
|
||||
copy_folder "types-known"
|
||||
copy_folder "typegen"
|
||||
|
||||
@@ -20,7 +20,8 @@ module.exports = {
|
||||
},
|
||||
{ text: 'GitHub', link: 'https://github.com/polkadot-js/api' }
|
||||
],
|
||||
search: false,
|
||||
search: true,
|
||||
searchMaxSuggestions: 10,
|
||||
sidebar: [
|
||||
{
|
||||
title: 'Getting started',
|
||||
@@ -43,12 +44,24 @@ module.exports = {
|
||||
['start/api.tx.wrap.md', 'Complex transactions'],
|
||||
['start/types.basics.md', 'Type basics'],
|
||||
['start/types.extend.md', 'Extending types'],
|
||||
['start/extrinsic.extend.md', 'Extending extrinsics'],
|
||||
['start/rpc.custom.md', 'Custom RPC'],
|
||||
['start/types.create.md', 'Creating types'],
|
||||
['start/typescript.md', 'TypeScript interfaces'],
|
||||
['start/typescript.user.md', 'TypeScript user generated'],
|
||||
['start/FAQ.md', 'FAQ']
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Cookbook',
|
||||
path: '/cookbook/',
|
||||
collapsable: false,
|
||||
sidebarDepth: 0,
|
||||
children: [
|
||||
['cookbook/blocks.md', 'Blocks'],
|
||||
['cookbook/storage.md', 'Storage'],
|
||||
['cookbook/tx.md', 'Transactions']
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Examples (Promise API)',
|
||||
path: '/examples/promise/',
|
||||
@@ -63,7 +76,8 @@ module.exports = {
|
||||
['examples/promise/06_make_transfer/', 'Make a transfer'],
|
||||
['examples/promise/08_system_events/', 'Display system events'],
|
||||
['examples/promise/09_transfer_events/', 'Transaction with events'],
|
||||
['examples/promise/10_upgrade_chain/', 'Upgrade via sudo']
|
||||
['examples/promise/10_upgrade_chain/', 'Upgrade via sudo'],
|
||||
['examples/promise/90_typegen/', 'TypeScript augmentation']
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -84,5 +98,10 @@ module.exports = {
|
||||
['/types/', '@polkadot/types'],
|
||||
'/CONTRIBUTING.md'
|
||||
]
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
['@vuepress/search', {
|
||||
searchMaxSuggestions: 10
|
||||
}]
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
$accentColor = #fd8824
|
||||
$textColor = #2c3e50
|
||||
$borderColor = #eaecef
|
||||
$codeBgColor = #282c34
|
||||
$arrowBgColor = #ccc
|
||||
|
||||
.home .hero .description,
|
||||
.home .feature h2,
|
||||
|
||||
+2
-9
@@ -13,7 +13,7 @@ features:
|
||||
- title: Types
|
||||
details: Various type interfaces to make using returned values from API calls transparent in your code.
|
||||
|
||||
footer: Apache-2 Licensed | Copyright © 2017-2019 polkadot-js authors and contributors
|
||||
footer: Apache-2 Licensed | Copyright © 2017-2020 polkadot-js authors and contributors
|
||||
---
|
||||
|
||||
## Welcome
|
||||
@@ -21,16 +21,9 @@ footer: Apache-2 Licensed | Copyright © 2017-2019 polkadot-js authors and contr
|
||||
The API provides application developers the ability to query a node and interact with the Polkadot or Substrate chains using Javascript. Here you will find documentation and examples to get you started.
|
||||
|
||||
::: tip Getting started & Examples
|
||||
[Jump right in](/start/) and get an overview on using the API in your projects, from installation all the way through to making it do magic. Already understand how things work and just want the examples? [The ApiPromise examples](/examples/promise/) provide some basic recipies.
|
||||
[Jump right in](/start/) and get an overview on using the API in your projects, from installation all the way through to making it do magic. Have things working and want tips? The [cookbook](/cookbook/) provides some tips and tricks. Getting started and want some full examples? [The ApiPromise examples](/examples/promise/) provide some basic examples.
|
||||
:::
|
||||
|
||||
## Available packages
|
||||
|
||||
This repository split up into a number of internal packages, namely -
|
||||
|
||||
- [api](api/README.md) Promise and RxJS-based APIs
|
||||
- [types](types/README.md) Type encoding and decoding wrappers
|
||||
|
||||
## The Polkadot Project
|
||||
|
||||
You can read more about the Polkadot Network at [https://polkadot.network/](https://polkadot.network/) and more about the polkadot-js projects at [https://polkadot.js.org](https://polkadot.js.org)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Cookbook
|
||||
|
||||
The cookbook hosts small code snippets in a question-answer format. It does not walk you through the whole setup, like the [basic examples](../examples/), but rather aims to answer some questions around specific uses. It also does not replace the [getting started FAQ](../start/FAQ.md), rather this is focussed explicitly on code samples, instead of general trouble-shooting for common mishaps.
|
||||
|
||||
These questions are added as they do come up and the hope is that the snippets here is will be useful to others, instead of just the original person who asked on a specific use-case. As of today, it is only making a start and not fully comprehensive yet - check back early, check back often.
|
||||
|
||||
## Sections
|
||||
|
||||
The following cookbook sections are available -
|
||||
|
||||
- [Blocks](blocks.md) - Snippets around working with blocks and headers
|
||||
- [Storage](storage.md) - Snippets for working with storage
|
||||
- [Transactions](tx.md) - Snippets for working with transactions
|
||||
|
||||
... more to come.
|
||||
|
||||
## Contribute
|
||||
|
||||
And as always, if you have an addition to make, or a question to ask any [any PRs](https://github.com/polkadot-js/api/tree/master/docs) or [issues](https://github.com/polkadot-js/api/issues) are appreciated. The initial content was generate from exactly such questions, either in Riot chat or as submitted as issues.
|
||||
@@ -0,0 +1,44 @@
|
||||
# Blocks
|
||||
|
||||
The building blocks for each blockchain. As such there are a number of examples for working with blocks and headers, that could be useful.
|
||||
|
||||
## How do I retrieve the header/extrinsic hash from blocks?
|
||||
|
||||
A block hash refers to the hash over the header, the extrinsic hash refers to the hash of the encoded extrinsic. Since all objects returned by the API implements the `.hash => Hash` getter, we can simply use this to view the actual hash.
|
||||
|
||||
```js
|
||||
// returns Hash
|
||||
const blockHash = await this.api.rpc.chain.getBlockHash(blockNumber);
|
||||
// returns SignedBlock
|
||||
const signedBlock = await this.api.rpc.chain.getBlock(blockHash);
|
||||
|
||||
// the hash for the block, always via header (Hash -> toHex()) - will be
|
||||
// the same as blockHash above (also available on any header retrieved,
|
||||
// subscription or once-off)
|
||||
console.log(signedBlock.header.hash.toHex());
|
||||
|
||||
// the hash for each extrinsic in the block
|
||||
signedBlock.block.extrinsics.forEach((ex, index) => {
|
||||
console.log(index, ex.hash.toHex());
|
||||
});
|
||||
```
|
||||
|
||||
## How do I extract the block author?
|
||||
|
||||
The block author is encoded inside the consensus logs for the block. To extract, you need to decode the log (which the API does do) and then map the index of the validator to the list of session validators. This extraction is however available on the api derive for new head subscriptions, which returns an extended header with the author populated (assuming that the digest logs are known).
|
||||
|
||||
```js
|
||||
// subscribe to all new headers (with extended info)
|
||||
api.derive.chain.subscribeNewHeads((header) => {
|
||||
console.log(`#${header.number}: ${header.author}`);
|
||||
});
|
||||
```
|
||||
|
||||
For a single header only, the derives also contain a `getHeader`, which once again returns a header extended with the author -
|
||||
|
||||
```js
|
||||
// retrieve the last header (hash optional)
|
||||
const header = await api.derive.chain.getHeader();
|
||||
|
||||
console.log(`#${header.number}: ${header.author}`);
|
||||
```
|
||||
@@ -0,0 +1,55 @@
|
||||
# Storage
|
||||
|
||||
Here you will find snippets for working with storage.
|
||||
|
||||
## How do I check for storage existence?
|
||||
|
||||
In the metadata, for each storage item a fallback is provided. This means that when an entry does not exist, the fallback (which is the default value for the type) will be provided. This means, that querying for a non-existent key (unless an option), will yield a value -
|
||||
|
||||
```js
|
||||
// retrieve Option<StakingLedger>
|
||||
const ledger = await api.query.staking.ledger('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
|
||||
// retrieve ValidatorPrefs (will yield the default value)
|
||||
const prefs = await api.query.staking.validators('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
|
||||
|
||||
console.log(ledger.isNone, ledger.isSome); // true, false
|
||||
console.log(JSON.stringify(prefs.toHuman())); // {"commission":"0"}
|
||||
```
|
||||
|
||||
In the second case, the non-existent prefs returns the default/fallback value for the storage item. So in this case we don't know if the value is set to 0 or unset. Existence can be checked by using the storage size, which would be zero if nothing is stored.
|
||||
|
||||
```js
|
||||
// exists
|
||||
const sizeY = await api.query.staking.validators.size('DB2mp5nNhbFN86J9hxoAog8JALMhDXgwvWMxrRMLNUFMEY4');
|
||||
// non existent
|
||||
const sizeN = await api.query.staking.validators.size('EoukLS2Rzh6dZvMQSkqFy4zGvqeo14ron28Ue3yopVc8e3Q');
|
||||
|
||||
console.log(sizeY.isZero(), sizeY.toNumber()); // false 4
|
||||
console.log(sizeN.isZero(), sizeY.toNumber()); // true 0
|
||||
```
|
||||
|
||||
## How do I use .entries()/.keys() on double maps?
|
||||
|
||||
As [explained elsewhere](../start/api.query.other.md#map-keys-entries) each map-type storage entry exposes the entries/keys helpers to retrieve the whole list. In the case of double maps, with the addition of a single argument, you can retrieve either all entries or a subset based on the first map key.
|
||||
|
||||
In both these cases, entries/keys operate the same way, `.entries()` retrieving `(StorageKey, Codec)[]` and `.keys()` retrieving `StorageKey[]`
|
||||
|
||||
```js
|
||||
// Retrieves the entries for all slashes, in all eras (no arg)
|
||||
const allEntries = await api.query.staking.nominatorSlashInEra.entries();
|
||||
|
||||
// nominatorSlashInEra(EraIndex, AccountId) for the types of the key args
|
||||
allEntries.forEach(([{ args: [era, nominatorId] }, value]) => {
|
||||
console.log(`${era}: ${nominatorId} slashed ${value.toHuman()}`);
|
||||
});
|
||||
```
|
||||
|
||||
While we can retrieve only the keys for a specific era, using a argument for the first part of the doublemap (as defined here, an `EraIndex`) -
|
||||
|
||||
```js
|
||||
// Retrieves the keys for the slashed validators in era 652
|
||||
const slashedKeys = await api.query.staking.nominatorSlashInEra.keys(652);
|
||||
|
||||
// key args still contains [EraIndex, AccountId] decoded
|
||||
console.log(`slashed: ${slashedKeys.map(({ args: [era, nominatorId] }) => nominatorId)`);
|
||||
```
|
||||
@@ -0,0 +1,112 @@
|
||||
# Transactions
|
||||
|
||||
A blockchain is no fun if you are not submitting transactions. Or at least if somebody is not submitting any. Here you will find some snippets for dealing with some common issues.
|
||||
|
||||
## How do I estimate the transaction fees?
|
||||
|
||||
In addition to the `signAndSend` helper on transactions, `.paymentInfo` (with the exact same parameters) are also exposed. Using the same sender, it applies a dummy signature to the transaction and then gets the fee estimation via RPC.
|
||||
|
||||
```js
|
||||
// estimate the fees as RuntimeDispatchInfo, using the signer (either
|
||||
// address or locked/unlocked keypair) (When overrides are applied, e.g
|
||||
// nonce, the format would be `paymentInfo(sender, { nonce })`)
|
||||
const info = await api.tx.balances
|
||||
.transfer(recipient, 123)
|
||||
.paymentInfo(sender);
|
||||
|
||||
// log relevant info, partialFee is Balance, estimated for current
|
||||
console.log(`
|
||||
class=${class.toString()},
|
||||
weight=${weight.toString()},
|
||||
partialFee=${partialFee.toHuman()}
|
||||
`);
|
||||
```
|
||||
|
||||
## How do I get the decoded enum for an ExtrinsicFailed event?
|
||||
|
||||
Assuming you are sending a tx via `.signAndSend`, the callback yields information around the tx pool status as well as any events when `isInBlock` or `isFinalized`. If an extrinsic fails via `system.ExtrinsicFailed` event, you can retrieve the error, if defined as an enum on a module.
|
||||
|
||||
```js
|
||||
api.tx.balances
|
||||
.transfer(recipient, 123)
|
||||
.signAndSend(sender, ({ status, events }) => {
|
||||
if (status.isInBlock || status.isFinalized) {
|
||||
events
|
||||
// find/filter for failed events
|
||||
.filter(({ section, method }) =>
|
||||
section === 'system' &&
|
||||
method === 'ExtrinsicFailed'
|
||||
)
|
||||
// we know that data for system.ExtrinsicFailed is
|
||||
// (DispatchError, DispatchInfo)
|
||||
.forEach(({ data: [error, info] }) => {
|
||||
if (error.isModule) {
|
||||
// for module errors, we have the section indexed, lookup
|
||||
const decoded = api.registry.findMetaError(error.asModule);
|
||||
const { documentation, method, section } = decoded;
|
||||
|
||||
console.log(`${section}.${method}: ${documentation.join(' ')}`);
|
||||
} else {
|
||||
// Other, CannotLookup, BadOrigin, no extra info
|
||||
console.log(error.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## How do I send an unsigned extrinsic?
|
||||
|
||||
For most runtime modules, transactions need to be signed and validation for this happens node-side. There are however modules that accepts unsigned extrinsics, an example would be the Polkadot/Kusama token claims (which is here used as an example).
|
||||
|
||||
```js
|
||||
// construct the transaction, exactly as per normal
|
||||
const utx = api.tx.claims.claim(beneficiary, ethSignature);
|
||||
|
||||
// send it without calling sign, pass callback with status/events
|
||||
tx.send(({ status }) => {
|
||||
if (status.isInBlock) {
|
||||
console.log(`included in ${status.asInBlock}`);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
The signing is indicated by the first byte in the transaction, so in this case we have called `.send` on it (no `.sign` or `.signAndSend`), so it will be sent using the unsigned state, without signature attached.
|
||||
|
||||
## How can I batch transactions?
|
||||
|
||||
Polkadot/Substrate provides a `utility.batch` method that can be used to send a number of transactions at once. These are then executed from a single sender (single nonce specified) in sequence. This is very useful in a number of cases, for instance if you wish to create a payout for a validator for multiple eras, you can use this method. Likewise, you can send a number of transfers at once. Or even batch different types of transactions.
|
||||
|
||||
```js
|
||||
// construct a list of transactions we want to batch
|
||||
const txs = [
|
||||
api.tx.balances.transfer(addrBob, 12345),
|
||||
api.tx.balances.transfer(addrEve, 12345),
|
||||
api.tx.staking.unbond(12345)
|
||||
];
|
||||
|
||||
// construct the batch and send the transactions
|
||||
api.tx.utility
|
||||
.batch(txs)
|
||||
.signAndSend(sender, ({ status }) => {
|
||||
if (status.isInBlock) {
|
||||
console.log(`included in ${status.asInBlock}`);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## How do I take the pending tx pool into account in my nonce?
|
||||
|
||||
The `system.account` query will always contain the current state, i.e. it will reflect the nonce for the last known block. As such when sending multiple transactions in quick succession (see batching above), there may be transactions in the pool that has the same nonce that `signAndSend` would apply - this call doesn't do any magic, it simply reads the state for the nonce. Since we can specify options to the `signandSend` operation, we can override the nonce, either by manually incrementing it o querying it via `nextNonce`.
|
||||
|
||||
```js
|
||||
for (let i = 0; i < 10; i++) {
|
||||
// retrieve the nextNonce, taking txs in the pool into account
|
||||
const nonce = await api.rpc.account.nextNonce(sender);
|
||||
|
||||
// send, just retrieving the hash, not waiting on status
|
||||
const txhash = await api.tx.balances
|
||||
.transfer(recipient, 123)
|
||||
.signAndSend(sender, { nonce });
|
||||
}
|
||||
```
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Required imports
|
||||
const { ApiPromise, WsProvider } = require('@polkadot/api');
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
@@ -13,13 +15,13 @@ async function main () {
|
||||
|
||||
// Retrieve the initial balance. Since the call has no callback, it is simply a promise
|
||||
// that resolves to the current on-chain value
|
||||
let [previousNonce, { free: previousFree }] = await api.query.system.account(Alice);
|
||||
let { data: { free: previousFree }, nonce: previousNonce } = await api.query.system.account(Alice);
|
||||
|
||||
console.log(`${Alice} has a balance of ${previousFree}, nonce ${previousNonce}`);
|
||||
console.log(`You may leave this example running and start example 06 or transfer any value to ${Alice}`);
|
||||
|
||||
// Here we subscribe to any balance changes and update the on-screen value
|
||||
api.query.system.account(Alice, ([currentNonce, { free: currentFree }]) => {
|
||||
api.query.system.account(Alice, ({ data: { free: currentFree }, nonce: currentNonce }) => {
|
||||
// Calculate the delta
|
||||
const change = currentFree.sub(previousFree);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
@@ -16,7 +18,7 @@ async function main () {
|
||||
|
||||
// Subscribe and listen to several balance changes
|
||||
api.query.system.account.multi([ALICE, BOB], (balances) => {
|
||||
console.log('Change detected, new balances: ', balances.map(([, { free }]) => free));
|
||||
console.log('Change detected, new balances: ', balances.map(({ data: { free } }) => free));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
@@ -12,7 +13,7 @@ async function main () {
|
||||
const api = await ApiPromise.create();
|
||||
|
||||
// Make our basic chain state/storage queries, all in one go
|
||||
const [[accountNonce], now, validators] = await Promise.all([
|
||||
const [{ nonce: accountNonce }, now, validators] = await Promise.all([
|
||||
api.query.system.account(ALICE),
|
||||
api.query.timestamp.now(),
|
||||
api.query.session.validators()
|
||||
@@ -24,7 +25,7 @@ async function main () {
|
||||
if (validators && validators.length > 0) {
|
||||
// Retrieve the balances for all validators
|
||||
const validatorBalances = await Promise.all(
|
||||
validators.map(authorityId =>
|
||||
validators.map((authorityId) =>
|
||||
api.query.system.account(authorityId)
|
||||
)
|
||||
);
|
||||
@@ -32,8 +33,8 @@ async function main () {
|
||||
// Print out the authorityIds and balances of all validators
|
||||
console.log('validators', validators.map((authorityId, index) => ({
|
||||
address: authorityId.toString(),
|
||||
balance: validatorBalances[index][1].free.toString(),
|
||||
nonce: validatorBalances[index][0].toString()
|
||||
balance: validatorBalances[index].data.free.toHuman(),
|
||||
nonce: validatorBalances[index].nonce.toHuman()
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
@@ -21,12 +22,12 @@ async function main () {
|
||||
// the format is always `.at(<blockhash>, ...params)`
|
||||
const balance = await api.query.system.account.at(parentHash, ALICE);
|
||||
|
||||
console.log(`Alice's balance at ${parentHash.toHex()} was ${balance[1].free}`);
|
||||
console.log(`Alice's balance at ${parentHash.toHex()} was ${balance.data.free}`);
|
||||
|
||||
// Now perform a multi query, returning multiple balances at once
|
||||
const balances = await api.query.system.account.multi([ALICE, BOB]);
|
||||
|
||||
console.log(`Current balances for Alice and Bob are ${balances[0][1].free} and ${balances[1][1].free}`);
|
||||
console.log(`Current balances for Alice and Bob are ${balances[0].data.free} and ${balances[1].data.free}`);
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => process.exit());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API, Keyring and some utility functions
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { Keyring } = require('@polkadot/keyring');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API, Keyring and some utility functions
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
const { Keyring } = require('@polkadot/keyring');
|
||||
@@ -19,7 +20,7 @@ async function main () {
|
||||
const alice = keyring.addFromUri('//Alice');
|
||||
|
||||
// Get nonce for account
|
||||
const [nonce] = await api.query.system.account(alice.address);
|
||||
const { nonce } = await api.query.system.account(alice.address);
|
||||
|
||||
// Get current block
|
||||
const signedBlock = await api.rpc.chain.getBlock();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
|
||||
// Import the API
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
|
||||
// Import the API & Provider and some utility functions
|
||||
const { ApiPromise } = require('@polkadot/api');
|
||||
|
||||
@@ -24,7 +26,7 @@ async function main () {
|
||||
const keyring = testKeyring.default();
|
||||
|
||||
// Get the nonce for the admin key
|
||||
const [nonce] = await api.query.system.account(ALICE);
|
||||
const { nonce } = await api.query.system.account(ALICE);
|
||||
|
||||
// Find the actual keypair in the keyring
|
||||
const alicePair = keyring.getPair(ALICE);
|
||||
@@ -40,13 +42,15 @@ async function main () {
|
||||
.signAndSend(alicePair, { nonce }, ({ events = [], status }) => {
|
||||
console.log('Transaction status:', status.type);
|
||||
|
||||
if (status.isFinalized) {
|
||||
console.log('Completed at block hash', status.asFinalized.toHex());
|
||||
if (status.isInBlock) {
|
||||
console.log('Included at block hash', status.asInBlock.toHex());
|
||||
console.log('Events:');
|
||||
|
||||
events.forEach(({ phase, event: { data, method, section } }) => {
|
||||
events.forEach(({ event: { data, method, section }, phase }) => {
|
||||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
|
||||
});
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Chain upgrade
|
||||
|
||||
Performs a chain upgrade using the `sudo` module. This may brick your chain, so us it as an educational sample. (use `substrate --dev purge-chain` to remove DB and recover).
|
||||
Performs a chain upgrade using the `sudo` module. This may brick your chain, so use it as an educational sample. (use `substrate purge-chain --dev` to remove DB and recover).
|
||||
|
||||
<<< @/docs/examples/promise/10_upgrade_chain/index.js
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
|
||||
// Import the API & Provider and some utility functions
|
||||
const { ApiPromise, WsProvider } = require('@polkadot/api');
|
||||
|
||||
@@ -39,15 +41,15 @@ async function main () {
|
||||
.signAndSend(adminPair, ({ events = [], status }) => {
|
||||
console.log('Proposal status:', status.type);
|
||||
|
||||
if (status.isFinalized) {
|
||||
if (status.isInBlock) {
|
||||
console.error('You have just upgraded your chain');
|
||||
|
||||
console.log('Completed at block hash', status.asFinalized.toHex());
|
||||
console.log('Included at block hash', status.asInBlock.toHex());
|
||||
console.log('Events:');
|
||||
|
||||
events.forEach(({ phase, event: { data, method, section } }) => {
|
||||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
|
||||
});
|
||||
console.log(JSON.stringify(events.toHuman(), null, 2));
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
# typegen
|
||||
|
||||
This is a sample TypeScript project [with full source & config on GithHub](https://github.com/polkadot-js/api/tree/master/docs/examples/promise/90_typegen), that uses `@polkadot/typegen` to generate type definitions that can be used to decorate the `@polkadot/api`. It uses both types defined for the specific chain as well as the chain metadata to generate TypeScript interfaces. This means that interfaces such as `api.query.*`, `api.tx.*` and `api.consts.*` will be decorated based on chain-specific information, instead of an un-augmented catch-all definition.
|
||||
|
||||
**NOTE** This is built using the updates in the `1.4.0` api track and as such it uses the latest (at the time of writing) `@polkadot/api 1.4.0`. If you want to play on your own, it is also suggested that you use the `1.4+` series since some generation types have moved around internally, making it easier to augment.
|
||||
|
||||
## Packages
|
||||
|
||||
For the packages we need from the `@polkadot/*` we have added `@polkadot/api` (we want to do API stuff) and `@polkadot/typegen` (to generate the actual interfaces). So our scripts and dependencies inside `package.json` contain the following -
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"build": "yarn generate:defs && yarn generate:meta",
|
||||
"generate:defs": "ts-node --skip-project node_modules/.bin/polkadot-types-from-defs --package sample-polkadotjs-typegen/interfaces --input ./src/interfaces",
|
||||
"generate:meta": "ts-node --skip-project node_modules/.bin/polkadot-types-from-chain --package sample-polkadotjs-typegen/interfaces --endpoint ./edgeware.json --output ./src/interfaces",
|
||||
"lint": "tsc --noEmit --pretty"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/typegen": "^1.4.0",
|
||||
"ts-node": "^8.6.2",
|
||||
"typescript": "^3.8.2"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
We will delve into the setup and running the scripts and what they do in a short bit, but as of now just notice that we are running the scripts via `ts-node`. Since we supply our definitions as `*.ts` files, this is important otherwise they will not be parsable. `build` will just run both the types and meta generators (in that order, so metadata can use the types) and we have a `lint` that can just check that everything is as it is meant to be.
|
||||
|
||||
## Metadata setup
|
||||
|
||||
The idea here is to use the actual chain metadata to generate the actual api augmented endpoints. The metadata we are adding here (in addition to the user types), is from the Edgeware Berlin testnet. So this is a real-world example of configuring the API for a specific substrate chain. For the metadata retrieval, we just ran a simple curl command to get it from the node -
|
||||
|
||||
`curl -H "Content-Type: application/json" -d '{"id":"1", "jsonrpc":"2.0", "method": "state_getMetadata", "params":[]}' http://localhost:9933`
|
||||
|
||||
And then add the full JSONPC output as received to the `edgeware.json` file as specified by the generation command. A trimmed version would look like -
|
||||
|
||||
```json
|
||||
{"jsonrpc":"2.0","result":"0x6d6574610b6c185379737....","id":29}
|
||||
```
|
||||
|
||||
The generator can also use a `wss://` as an `--endpoint` param as part of the generation, but in most cases you would want a static metadata to work from in development, hence we are actually adding it here.
|
||||
|
||||
## Types setup
|
||||
|
||||
The types are defined in the `src/interfaces` folder. While this repo contains a number of generated files in there as well, you basically only need to manually add the following -
|
||||
|
||||
- `src/interfaces/definitions.ts` - this just exports all the sub-folder definitions in one go
|
||||
- `src/interfaces/<module>/definitions.ts` - type definitions for a specific module
|
||||
|
||||
This structure fully matches what is available in the `@polkadot/type/interfaces` folder, so the structure is setup based on the convention used in the `@polkadot/types` library. The generating scripts will expect something matching this since the same underlying code is actually used inside `@polkadot/types` as well. The top-level `interfaces/` folder can be name anything, however the internal content structure need to match what is defined above.
|
||||
|
||||
For the top-level the definition file has the following contents -
|
||||
|
||||
```js
|
||||
export { default as signaling } from './signaling/definitions';
|
||||
export { default as treasuryRewards } from './treasuryRewards/definitions';
|
||||
export { default as voting } from './voting/definitions';
|
||||
```
|
||||
|
||||
As explained above, it really is just a re-export of the definitions, so they are all easily accessible to the outside, i.e. we will use this import inside our own code to use the definitions in API initialization. The generation scripts will load this file to determine which types it needs to import. By the `@polkadot/types` convention, match the export names with the folders (preferably your runtime module names), the generation scripts will use these names to find the correct folders to output the generated `types.ts` to.
|
||||
|
||||
For each of the folders, `signaling`, `treasuryRewards` and `voting` another `definitions.ts` file is contained within. Looking at the one from `signaling`, it contains this -
|
||||
|
||||
```js
|
||||
export default {
|
||||
types: {
|
||||
ProposalRecord: {
|
||||
index: 'u32',
|
||||
author: 'AccountId',
|
||||
stage: 'VoteStage',
|
||||
transition_time: 'u32',
|
||||
title: 'Text',
|
||||
contents: 'Text',
|
||||
vote_id: 'u64'
|
||||
},
|
||||
ProposalContents: 'Vec<u8>',
|
||||
ProposalTitle: 'Vec<u8>'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Just the type definitions (the structure of which you should be familiar with), nested inside a `types: {...}` container. This allows us future extension points, i.e. there is some work to expose the custom RPC types alongside, so that would become another key on a per-module basis.
|
||||
|
||||
In the above, you will note that the `ProposalRecord` references a type for `voting`, i.e. `VoteStage`. The type generation and resolution will determine where the type comes from, and provide the required imports on generation.
|
||||
|
||||
Looking at the example in this repo, it also has `augment*`, `index.ts` and `types.ts` files in the interfaces folder. These are all generated, and will be re-generated when the generator is run - so all edits to these files will be lost. The only requirement for user-edits are the `definitions.ts` files.
|
||||
|
||||
## Generating
|
||||
|
||||
Now that both the metadata nd types setup is completed, we just run the build command via `yarn build` and magically (assuming you didn't have the `augment*` and other generated files), these files will be added. When running this command, the console should display something like -
|
||||
|
||||
```
|
||||
> yarn build
|
||||
$ yarn generate:defs && yarn generate:meta
|
||||
$ ts-node --skip-project \
|
||||
node_modules/.bin/polkadot-types-from-defs \
|
||||
--package sample-polkadotjs-typegen/interfaces \
|
||||
--input ./src/interfaces
|
||||
|
||||
sample-polkadotjs-typegen/src/interfaces/types.ts
|
||||
Generating
|
||||
Extracting interfaces for signaling
|
||||
...
|
||||
Writing
|
||||
|
||||
sample-polkadotjs-typegen/src/interfaces/augment-types.ts
|
||||
Generating
|
||||
Writing
|
||||
|
||||
$ ts-node --skip-project \
|
||||
node_modules/.bin/polkadot-types-from-chain \
|
||||
--package sample-polkadotjs-typegen/interfaces \
|
||||
--endpoint ./edgeware.json \
|
||||
--output ./src/interfaces
|
||||
|
||||
Generating from metadata, 81,267 bytes
|
||||
...
|
||||
|
||||
sample-polkadotjs-typegen/src/interfaces/augment-api.ts
|
||||
Generating
|
||||
Writing
|
||||
|
||||
✨ Done in 4.04s.
|
||||
```
|
||||
|
||||
Now if we check the actual output against the source via `yarn lint`, we would see that valid output has been generated -
|
||||
|
||||
```
|
||||
> yarn lint
|
||||
$ tsc --noEmit --pretty
|
||||
✨ Done in 2.28s.
|
||||
```
|
||||
|
||||
## Peering at the output
|
||||
|
||||
We are ready to use all these generated types this after some TS config. If you take a look at the generated `src/signaling/types.ts`, you would see generated TS interfaces, such as -
|
||||
|
||||
```js
|
||||
import { Struct } from '@polkadot/types/codec';
|
||||
import { Bytes, Text, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { AccountId } from '@polkadot/types/interfaces/runtime';
|
||||
import { VoteStage } from 'sample-polkadotjs-typegen/interfaces/voting';
|
||||
|
||||
/** @name ProposalContents */
|
||||
export interface ProposalContents extends Bytes {}
|
||||
|
||||
/** @name ProposalRecord */
|
||||
export interface ProposalRecord extends Struct {
|
||||
readonly index: u32;
|
||||
readonly author: AccountId;
|
||||
readonly stage: VoteStage;
|
||||
readonly transition_time: u32;
|
||||
readonly title: Text;
|
||||
readonly contents: Text;
|
||||
readonly vote_id: u64;
|
||||
}
|
||||
|
||||
/** @name ProposalTitle */
|
||||
export interface ProposalTitle extends Bytes {}
|
||||
```
|
||||
|
||||
As mentioned earlier, here you will notice the `import { VoteStage }`, the generator has determined that `voting` exports that interface and has added the required imports.
|
||||
|
||||
## TypeScript config
|
||||
|
||||
Now that we have files generated, it is time to make TypeScript aware of the types and add an explicit override into out `tsconfig.json`. After some changes, the paths in the config looks as follow (comments are in teh actual config file here) -
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"sample-polkadotjs-typegen/*": ["src/*"],
|
||||
"@polkadot/api/augment": ["src/interfaces/augment-api.ts"],
|
||||
"@polkadot/types/augment": ["src/interfaces/augment-types.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Effectively what we do above is tell the TypeScript compiler to not use the built-in API augmentation, but rather to replace it with our version. This means that all types from these are injected not by the substrate-latest-master version, but rather with what we have defined above.
|
||||
|
||||
## Usage
|
||||
|
||||
For simple usage, we have added the `src/index.ts` file that show how the metadata and types actually decorate the API. In addition, we also have setup instructions included here.
|
||||
|
||||
```js
|
||||
// We need to import the augmented definitions "somewhere" in our project, however since we have
|
||||
// it in tsconfig as an override and the api/types has imports, it is not strictly required here.
|
||||
// Because of the tsconfig override, we could import from '@polkadot/{api, types}/augment'
|
||||
import './interfaces/augment-api';
|
||||
import './interfaces/augment-types';
|
||||
|
||||
// all type stuff, the only one we are using here
|
||||
import type { VoteRecord } from './interfaces';
|
||||
|
||||
// external imports
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
// our local stuff
|
||||
import * as definitions from './interfaces/definitions';
|
||||
|
||||
async function main (): Promise<void> {
|
||||
// extract all types from definitions - fast and dirty approach, flatted on 'types'
|
||||
const types = Object.values(definitions).reduce((res, { types }): object => ({ ...res, ...types }), {});
|
||||
|
||||
const api = await ApiPromise.create({
|
||||
types: {
|
||||
...types,
|
||||
// aliases that don't do well as part of interfaces
|
||||
'voting::VoteType': 'VoteType',
|
||||
'voting::TallyType': 'TallyType',
|
||||
// chain-specific overrides
|
||||
Keys: 'SessionKeys4'
|
||||
}
|
||||
});
|
||||
|
||||
// get a query
|
||||
const recordOpt = await api.query.voting.voteRecords(123);
|
||||
|
||||
// the types match with what we expect here
|
||||
let firstRecord: VoteRecord | null = recordOpt.unwrapOr(null);
|
||||
console.log(firstRecord?.toHuman());
|
||||
|
||||
// it even does work for arrays & subscriptions
|
||||
api.query.signaling.activeProposals((results): void => {
|
||||
results.forEach(([hash, blockNumber]): void => {
|
||||
console.log(hash.toHex(), ':', blockNumber.toNumber());
|
||||
});
|
||||
});
|
||||
|
||||
// even createType works, allowing for our types to be used
|
||||
console.log(`Balance2 bitLength:`, [
|
||||
api.createType('Balance2').bitLength(),
|
||||
api.registry.createType('Balance2').bitLength(),
|
||||
createType(api.registry, 'Balance2').bitLength()
|
||||
]);
|
||||
}
|
||||
|
||||
await main();
|
||||
```
|
||||
|
||||
## And that is a ...
|
||||
|
||||
... wrap. Just a really simple walk-through to customizing the API TypeScript definitions for your chain.
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "sample-polkadotjs-typegen",
|
||||
"version": "0.0.1",
|
||||
"description": "A sample using @polkadot/typegen to generate type definitions",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/jacogr/sample-polkadotjs-typegen",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "The Unlicense",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "yarn generate:defs && yarn generate:meta",
|
||||
"generate:defs": "ts-node --skip-project node_modules/.bin/polkadot-types-from-defs --package sample-polkadotjs-typegen/interfaces --input ./src/interfaces",
|
||||
"generate:meta": "ts-node --skip-project node_modules/.bin/polkadot-types-from-chain --package sample-polkadotjs-typegen/interfaces --endpoint ./edgeware.json --output ./src/interfaces --strict",
|
||||
"lint": "tsc --noEmit --pretty"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/typegen": "^1.4.0",
|
||||
"ts-node": "^8.6.2",
|
||||
"typescript": "^3.8.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// We need to import the augmented definitions "somewhere" in our project, however since we have
|
||||
// it in tsconfig as an override and the api/types has imports, it is not strictly required here.
|
||||
// Because of the tsconfig override, we could import from '@polkadot/{api, types}/augment'
|
||||
import './interfaces/augment-api';
|
||||
import './interfaces/augment-types';
|
||||
|
||||
// all type stuff, the only one we are using here
|
||||
import type { VoteRecord } from './interfaces';
|
||||
|
||||
// external imports
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
// our local stuff
|
||||
import * as definitions from './interfaces/definitions';
|
||||
|
||||
async function main (): Promise<void> {
|
||||
// extract all types from definitions - fast and dirty approach, flatted on 'types'
|
||||
const types = Object.values(definitions).reduce((res, { types }): object => ({ ...res, ...types }), {});
|
||||
|
||||
const api = await ApiPromise.create({
|
||||
types: {
|
||||
...types,
|
||||
// aliasses that don't do well as part of interfaces
|
||||
'voting::VoteType': 'VoteType',
|
||||
'voting::TallyType': 'TallyType',
|
||||
// chain-specific overrides
|
||||
Keys: 'SessionKeys4'
|
||||
}
|
||||
});
|
||||
|
||||
// get a query
|
||||
const recordOpt = await api.query.voting.voteRecords(123);
|
||||
|
||||
// the types match with what we expect here
|
||||
let firstRecord: VoteRecord | null = recordOpt.unwrapOr(null);
|
||||
console.log(firstRecord?.toHuman());
|
||||
|
||||
// it even does work for arrays & subscriptions
|
||||
api.query.signaling.activeProposals((results): void => {
|
||||
results.forEach(([hash, blockNumber]): void => {
|
||||
console.log(hash.toHex(), ':', blockNumber.toNumber());
|
||||
});
|
||||
});
|
||||
|
||||
// even createType works, allowing for our types to be used
|
||||
console.log(`Balance2 bitLength:`, [
|
||||
api.createType('Balance2').bitLength(),
|
||||
api.registry.createType('Balance2').bitLength(),
|
||||
createType(api.registry, 'Balance2').bitLength()
|
||||
]);
|
||||
}
|
||||
|
||||
await main();
|
||||
+37
-52
@@ -1,33 +1,16 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Codec } from '@polkadot/types/types';
|
||||
import { Bytes, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { Balance, BalanceOf, BlockNumber, Moment, Percent, Permill } from '@polkadot/types/interfaces/runtime';
|
||||
import { Bytes, u32 } from '@polkadot/types/primitive';
|
||||
import { Gas } from '@polkadot/types/interfaces/contracts';
|
||||
import { Balance, BalanceOf, BlockNumber, Moment, Percent, Permill } from '@polkadot/types/interfaces/runtime';
|
||||
import { SessionIndex } from '@polkadot/types/interfaces/session';
|
||||
import { EraIndex } from '@polkadot/types/interfaces/staking';
|
||||
|
||||
declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
export interface Constants {
|
||||
babe: {
|
||||
[index: string]: Codec;
|
||||
/**
|
||||
* The number of **slots** that an epoch takes. We couple sessions to
|
||||
* epochs, i.e. we start a new session once the new epoch begins.
|
||||
**/
|
||||
epochDuration: AugmentedConst<u64>;
|
||||
/**
|
||||
* The expected average block time at which BABE should be creating
|
||||
* blocks. Since BABE is probabilistic it is not trivial to figure out
|
||||
* what the expected average block time should be based on the slot
|
||||
* duration and the security parameter `c` (where `1 - c` represents
|
||||
* the probability of a slot being empty).
|
||||
**/
|
||||
expectedBlockTime: AugmentedConst<Moment>;
|
||||
};
|
||||
timestamp: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* The minimum period between blocks. Beware that this is different to the *expected* period
|
||||
* that the block production apparatus provides. Your chosen consensus system will generally
|
||||
@@ -37,14 +20,22 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
minimumPeriod: AugmentedConst<Moment>;
|
||||
};
|
||||
balances: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* The minimum amount required to keep an account open.
|
||||
**/
|
||||
existentialDeposit: AugmentedConst<Balance>;
|
||||
/**
|
||||
* The fee required to make a transfer.
|
||||
**/
|
||||
transferFee: AugmentedConst<Balance>;
|
||||
/**
|
||||
* The fee required to create an account.
|
||||
**/
|
||||
creationFee: AugmentedConst<Balance>;
|
||||
};
|
||||
transactionPayment: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* The fee to be paid for making a transaction; the base.
|
||||
**/
|
||||
@@ -55,7 +46,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
transactionByteFee: AugmentedConst<BalanceOf>;
|
||||
};
|
||||
staking: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* Number of sessions per era.
|
||||
**/
|
||||
@@ -66,7 +57,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
bondingDuration: AugmentedConst<EraIndex>;
|
||||
};
|
||||
session: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* Used as first key for `NextKeys` and `KeyOwner` to put all the data into the same branch
|
||||
* of the trie.
|
||||
@@ -74,7 +65,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
dedupKeyPrefix: AugmentedConst<Bytes>;
|
||||
};
|
||||
democracy: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* The minimum period of locking and the period between a proposal being approved and enacted.
|
||||
* It should generally be a little more than the unstake period to ensure that
|
||||
@@ -108,7 +99,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
preimageByteDeposit: AugmentedConst<BalanceOf>;
|
||||
};
|
||||
elections: {
|
||||
[index: string]: Codec;
|
||||
|
||||
candidacyBond: AugmentedConst<BalanceOf>;
|
||||
votingBond: AugmentedConst<BalanceOf>;
|
||||
desiredMembers: AugmentedConst<u32>;
|
||||
@@ -116,7 +107,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
termDuration: AugmentedConst<BlockNumber>;
|
||||
};
|
||||
finalityTracker: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* The number of recent samples to keep from this chain. Default is 101.
|
||||
**/
|
||||
@@ -127,7 +118,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
reportLatency: AugmentedConst<BlockNumber>;
|
||||
};
|
||||
treasury: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* Fraction of a proposal's value that should be bonded in order to place the proposal.
|
||||
* An accepted proposal gets these back. A rejected proposal does not.
|
||||
@@ -163,7 +154,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
tipReportDepositPerByte: AugmentedConst<BalanceOf>;
|
||||
};
|
||||
contracts: {
|
||||
[index: string]: Codec;
|
||||
|
||||
/**
|
||||
* Number of block delay an extrinsic claim surcharge has.
|
||||
* When claim surcharge is called by an extrinsic the rent is checked
|
||||
@@ -197,6 +188,14 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
* to removal of a contract.
|
||||
**/
|
||||
surchargeReward: AugmentedConst<BalanceOf>;
|
||||
/**
|
||||
* The fee required to make a transfer.
|
||||
**/
|
||||
transferFee: AugmentedConst<BalanceOf>;
|
||||
/**
|
||||
* The fee required to create an account.
|
||||
**/
|
||||
creationFee: AugmentedConst<BalanceOf>;
|
||||
/**
|
||||
* The fee to be paid for making a transaction; the base.
|
||||
**/
|
||||
@@ -235,34 +234,20 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
|
||||
**/
|
||||
blockGasLimit: AugmentedConst<Gas>;
|
||||
};
|
||||
society: {
|
||||
[index: string]: Codec;
|
||||
nicks: {
|
||||
|
||||
/**
|
||||
* The minimum amount of a deposit required for a bid to be made.
|
||||
* Reservation fee.
|
||||
**/
|
||||
candidateDeposit: AugmentedConst<BalanceOf>;
|
||||
reservationFee: AugmentedConst<BalanceOf>;
|
||||
/**
|
||||
* The amount of the unpaid reward that gets deducted in the case that either a skeptic
|
||||
* doesn't vote or someone votes in the wrong way.
|
||||
* The minimum length a name may be.
|
||||
**/
|
||||
wrongSideDeduction: AugmentedConst<BalanceOf>;
|
||||
minLength: AugmentedConst<u32>;
|
||||
/**
|
||||
* The number of times a member may vote the wrong way (or not at all, when they are a skeptic)
|
||||
* before they become suspended.
|
||||
* The maximum length a name may be.
|
||||
**/
|
||||
maxStrikes: AugmentedConst<u32>;
|
||||
/**
|
||||
* The amount of incentive paid within each period. Doesn't include VoterTip.
|
||||
**/
|
||||
periodSpend: AugmentedConst<BalanceOf>;
|
||||
/**
|
||||
* The number of blocks between candidate/membership rotation periods.
|
||||
**/
|
||||
rotationPeriod: AugmentedConst<BlockNumber>;
|
||||
/**
|
||||
* The number of blocks between membership challenges.
|
||||
**/
|
||||
challengePeriod: AugmentedConst<BlockNumber>;
|
||||
maxLength: AugmentedConst<u32>;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,706 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { AnyNumber, ITuple } from '@polkadot/types/types';
|
||||
import { Option, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Data, bool, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||
import { BalanceLock, VestingSchedule } from '@polkadot/types/interfaces/balances';
|
||||
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
|
||||
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||
import { CodeHash, ContractInfo, Gas, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
|
||||
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from '@polkadot/types/interfaces/democracy';
|
||||
import { Vote, VoteThreshold } from '@polkadot/types/interfaces/elections';
|
||||
import { AuthorityList, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
|
||||
import { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
|
||||
import { AuthIndex } from '@polkadot/types/interfaces/imOnline';
|
||||
import { Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
|
||||
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, Index, KeyTypeId, Moment, Perbill, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
|
||||
import { ProposalRecord } from 'sample-polkadotjs-typegen/interfaces/signaling';
|
||||
import { EraIndex, EraPoints, Exposure, Forcing, MomentOf, Nominations, RewardDestination, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
||||
import { DigestOf, EventIndex, EventRecord } from '@polkadot/types/interfaces/system';
|
||||
import { OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
||||
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||
import { Multisig } from '@polkadot/types/interfaces/utility';
|
||||
import { VoteRecord } from 'sample-polkadotjs-typegen/interfaces/voting';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ApiTypes } from '@polkadot/api/types';
|
||||
|
||||
declare module '@polkadot/api/types/storage' {
|
||||
export interface AugmentedQueries<ApiType> {
|
||||
system: {
|
||||
|
||||
/**
|
||||
* Extrinsics nonce for accounts.
|
||||
**/
|
||||
accountNonce: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Index>>;
|
||||
/**
|
||||
* Total extrinsics count for the current block.
|
||||
**/
|
||||
extrinsicCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>>;
|
||||
/**
|
||||
* Total weight for all extrinsics put together, for the current block.
|
||||
**/
|
||||
allExtrinsicsWeight: AugmentedQuery<ApiType, () => Observable<Option<Weight>>>;
|
||||
/**
|
||||
* Total length (in bytes) for all extrinsics put together, for the current block.
|
||||
**/
|
||||
allExtrinsicsLen: AugmentedQuery<ApiType, () => Observable<Option<u32>>>;
|
||||
/**
|
||||
* Map of block numbers to block hashes.
|
||||
**/
|
||||
blockHash: AugmentedQuery<ApiType, (arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Hash>>;
|
||||
/**
|
||||
* Extrinsics data for the current block (maps an extrinsic's index to its data).
|
||||
**/
|
||||
extrinsicData: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Bytes>>;
|
||||
/**
|
||||
* The current block number being processed. Set by `execute_block`.
|
||||
**/
|
||||
number: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
|
||||
/**
|
||||
* Hash of the previous block.
|
||||
**/
|
||||
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>>;
|
||||
/**
|
||||
* Extrinsics root of the current block, also part of the block header.
|
||||
**/
|
||||
extrinsicsRoot: AugmentedQuery<ApiType, () => Observable<Hash>>;
|
||||
/**
|
||||
* Digest of the current block, also part of the block header.
|
||||
**/
|
||||
digest: AugmentedQuery<ApiType, () => Observable<DigestOf>>;
|
||||
/**
|
||||
* Events deposited for the current block.
|
||||
**/
|
||||
events: AugmentedQuery<ApiType, () => Observable<Vec<EventRecord>>>;
|
||||
/**
|
||||
* The number of events in the `Events<T>` list.
|
||||
**/
|
||||
eventCount: AugmentedQuery<ApiType, () => Observable<EventIndex>>;
|
||||
/**
|
||||
* Mapping between a topic (represented by T::Hash) and a vector of indexes
|
||||
* of events in the `<Events<T>>` list.
|
||||
* All topic vectors have deterministic storage locations depending on the topic. This
|
||||
* allows light-clients to leverage the changes trie storage tracking mechanism and
|
||||
* in case of changes fetch the list of events of interest.
|
||||
* The value has the type `(T::BlockNumber, EventIndex)` because if we used only just
|
||||
* the `EventIndex` then in case if the topic has the same contents on the next block
|
||||
* no notification will be triggered thus the event might be lost.
|
||||
**/
|
||||
eventTopics: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Vec<ITuple<[BlockNumber, EventIndex]>>>>;
|
||||
};
|
||||
utility: {
|
||||
|
||||
/**
|
||||
* The set of open multisig operations.
|
||||
**/
|
||||
multisigs: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: U8aFixed | string | Uint8Array) => Observable<Option<Multisig>>>;
|
||||
};
|
||||
timestamp: {
|
||||
|
||||
/**
|
||||
* Current time for the current block.
|
||||
**/
|
||||
now: AugmentedQuery<ApiType, () => Observable<Moment>>;
|
||||
/**
|
||||
* Did the timestamp get updated in this block?
|
||||
**/
|
||||
didUpdate: AugmentedQuery<ApiType, () => Observable<bool>>;
|
||||
};
|
||||
authorship: {
|
||||
|
||||
/**
|
||||
* Uncles
|
||||
**/
|
||||
uncles: AugmentedQuery<ApiType, () => Observable<Vec<UncleEntryItem>>>;
|
||||
/**
|
||||
* Author of current block.
|
||||
**/
|
||||
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>>;
|
||||
/**
|
||||
* Whether uncles were already set in this block.
|
||||
**/
|
||||
didSetUncles: AugmentedQuery<ApiType, () => Observable<bool>>;
|
||||
};
|
||||
indices: {
|
||||
|
||||
/**
|
||||
* The next free enumeration set.
|
||||
**/
|
||||
nextEnumSet: AugmentedQuery<ApiType, () => Observable<AccountIndex>>;
|
||||
/**
|
||||
* The enumeration sets.
|
||||
**/
|
||||
enumSet: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Vec<AccountId>>>;
|
||||
};
|
||||
balances: {
|
||||
|
||||
/**
|
||||
* The total units issued in the system.
|
||||
**/
|
||||
totalIssuance: AugmentedQuery<ApiType, () => Observable<Balance>>;
|
||||
/**
|
||||
* Information regarding the vesting of a given account.
|
||||
**/
|
||||
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingSchedule>>>;
|
||||
/**
|
||||
* The 'free' balance of a given account.
|
||||
* This is the only balance that matters in terms of most operations on tokens. It
|
||||
* alone is used to determine the balance when in the contract execution environment. When this
|
||||
* balance falls below the value of `ExistentialDeposit`, then the 'current account' is
|
||||
* deleted: specifically `FreeBalance`. Further, the `OnFreeBalanceZero` callback
|
||||
* is invoked, giving a chance to external modules to clean up data associated with
|
||||
* the deleted account.
|
||||
* `frame_system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets
|
||||
* collapsed to zero if it ever becomes less than `ExistentialDeposit`.
|
||||
**/
|
||||
freeBalance: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Balance>>;
|
||||
/**
|
||||
* The amount of the balance of a given account that is externally reserved; this can still get
|
||||
* slashed, but gets slashed last of all.
|
||||
* This balance is a 'reserve' balance that other subsystems use in order to set aside tokens
|
||||
* that are still 'owned' by the account holder, but which are suspendable.
|
||||
* When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account'
|
||||
* is deleted: specifically, `ReservedBalance`.
|
||||
* `frame_system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets
|
||||
* collapsed to zero if it ever becomes less than `ExistentialDeposit`.)
|
||||
**/
|
||||
reservedBalance: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Balance>>;
|
||||
/**
|
||||
* Any liquidity locks on some account balances.
|
||||
**/
|
||||
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<BalanceLock>>>;
|
||||
};
|
||||
transactionPayment: {
|
||||
|
||||
nextFeeMultiplier: AugmentedQuery<ApiType, () => Observable<Multiplier>>;
|
||||
};
|
||||
staking: {
|
||||
|
||||
/**
|
||||
* The ideal number of staking participants.
|
||||
**/
|
||||
validatorCount: AugmentedQuery<ApiType, () => Observable<u32>>;
|
||||
/**
|
||||
* Minimum number of staking participants before emergency conditions are imposed.
|
||||
**/
|
||||
minimumValidatorCount: AugmentedQuery<ApiType, () => Observable<u32>>;
|
||||
/**
|
||||
* Any validators that may never be slashed or forcibly kicked. It's a Vec since they're
|
||||
* easy to initialize and the performance hit is minimal (we expect no more than four
|
||||
* invulnerables) and restricted to testnets.
|
||||
**/
|
||||
invulnerables: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>>;
|
||||
/**
|
||||
* Map from all locked "stash" accounts to the controller account.
|
||||
**/
|
||||
bonded: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>>;
|
||||
/**
|
||||
* Map from all (unlocked) "controller" accounts to the info regarding the staking.
|
||||
**/
|
||||
ledger: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<StakingLedger>>>;
|
||||
/**
|
||||
* Where the reward payment should be made. Keyed by stash.
|
||||
**/
|
||||
payee: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<RewardDestination>>;
|
||||
/**
|
||||
* The map from (wannabe) validator stash key to the preferences of that validator.
|
||||
**/
|
||||
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>>;
|
||||
/**
|
||||
* The map from nominator stash key to the set of stash keys of all validators to nominate.
|
||||
* NOTE: is private so that we can ensure upgraded before all typical accesses.
|
||||
* Direct storage APIs can still bypass this protection.
|
||||
**/
|
||||
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Nominations>>>;
|
||||
/**
|
||||
* Nominators for a particular account that is in action right now. You can't iterate
|
||||
* through validators here, but you can find them in the Session module.
|
||||
* This is keyed by the stash account.
|
||||
**/
|
||||
stakers: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Exposure>>;
|
||||
/**
|
||||
* The currently elected validator set keyed by stash account ID.
|
||||
**/
|
||||
currentElected: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>>;
|
||||
/**
|
||||
* The current era index.
|
||||
**/
|
||||
currentEra: AugmentedQuery<ApiType, () => Observable<EraIndex>>;
|
||||
/**
|
||||
* The start of the current era.
|
||||
**/
|
||||
currentEraStart: AugmentedQuery<ApiType, () => Observable<MomentOf>>;
|
||||
/**
|
||||
* The session index at which the current era started.
|
||||
**/
|
||||
currentEraStartSessionIndex: AugmentedQuery<ApiType, () => Observable<SessionIndex>>;
|
||||
/**
|
||||
* Rewards for the current era. Using indices of current elected set.
|
||||
**/
|
||||
currentEraPointsEarned: AugmentedQuery<ApiType, () => Observable<EraPoints>>;
|
||||
/**
|
||||
* The amount of balance actively at stake for each validator slot, currently.
|
||||
* This is used to derive rewards and punishments.
|
||||
**/
|
||||
slotStake: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
|
||||
/**
|
||||
* True if the next session change will be a new era regardless of index.
|
||||
**/
|
||||
forceEra: AugmentedQuery<ApiType, () => Observable<Forcing>>;
|
||||
/**
|
||||
* The percentage of the slash that is distributed to reporters.
|
||||
* The rest of the slashed value is handled by the `Slash`.
|
||||
**/
|
||||
slashRewardFraction: AugmentedQuery<ApiType, () => Observable<Perbill>>;
|
||||
/**
|
||||
* The amount of currency given to reporters of a slash event which was
|
||||
* canceled by extraordinary circumstances (e.g. governance).
|
||||
**/
|
||||
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
|
||||
/**
|
||||
* All unapplied slashes that are queued for later.
|
||||
**/
|
||||
unappliedSlashes: AugmentedQuery<ApiType, (arg: EraIndex | AnyNumber | Uint8Array) => Observable<Vec<UnappliedSlash>>>;
|
||||
/**
|
||||
* A mapping from still-bonded eras to the first session index of that era.
|
||||
**/
|
||||
bondedEras: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[EraIndex, SessionIndex]>>>>;
|
||||
/**
|
||||
* All slashing events on validators, mapped by era to the highest slash proportion
|
||||
* and slash value of the era.
|
||||
**/
|
||||
validatorSlashInEra: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>>;
|
||||
/**
|
||||
* All slashing events on nominators, mapped by era to the highest slash value of the era.
|
||||
**/
|
||||
nominatorSlashInEra: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<BalanceOf>>>;
|
||||
/**
|
||||
* Slashing spans for stash accounts.
|
||||
**/
|
||||
slashingSpans: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<SlashingSpans>>>;
|
||||
/**
|
||||
* Records information about the maximum slash of a stash within a slashing span,
|
||||
* as well as how much reward has been paid out.
|
||||
**/
|
||||
spanSlash: AugmentedQuery<ApiType, (arg: ITuple<[AccountId, SpanIndex]> | [AccountId | string | Uint8Array, SpanIndex | AnyNumber | Uint8Array]) => Observable<SpanRecord>>;
|
||||
/**
|
||||
* The earliest era for which we have a pending, unapplied slash.
|
||||
**/
|
||||
earliestUnappliedSlash: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>>;
|
||||
/**
|
||||
* The version of storage for upgrade.
|
||||
**/
|
||||
storageVersion: AugmentedQuery<ApiType, () => Observable<u32>>;
|
||||
};
|
||||
session: {
|
||||
|
||||
/**
|
||||
* The current set of validators.
|
||||
**/
|
||||
validators: AugmentedQuery<ApiType, () => Observable<Vec<ValidatorId>>>;
|
||||
/**
|
||||
* Current index of the session.
|
||||
**/
|
||||
currentIndex: AugmentedQuery<ApiType, () => Observable<SessionIndex>>;
|
||||
/**
|
||||
* True if the underlying economic identities or weighting behind the validators
|
||||
* has changed in the queued validator set.
|
||||
**/
|
||||
queuedChanged: AugmentedQuery<ApiType, () => Observable<bool>>;
|
||||
/**
|
||||
* The queued keys for the next session. When the next session begins, these keys
|
||||
* will be used to determine the validator's session keys.
|
||||
**/
|
||||
queuedKeys: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[ValidatorId, Keys]>>>>;
|
||||
/**
|
||||
* Indices of disabled validators.
|
||||
* The set is cleared when `on_session_ending` returns a new set of identities.
|
||||
**/
|
||||
disabledValidators: AugmentedQuery<ApiType, () => Observable<Vec<u32>>>;
|
||||
/**
|
||||
* The next session keys for a validator.
|
||||
* The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of
|
||||
* the trie. Having all data in the same branch should prevent slowing down other queries.
|
||||
**/
|
||||
nextKeys: AugmentedQueryDoubleMap<ApiType, (key1: Bytes | string | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<Option<Keys>>>;
|
||||
/**
|
||||
* The owner of a key. The second key is the `KeyTypeId` + the encoded key.
|
||||
* The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of
|
||||
* the trie. Having all data in the same branch should prevent slowing down other queries.
|
||||
**/
|
||||
keyOwner: AugmentedQueryDoubleMap<ApiType, (key1: Bytes | string | Uint8Array, key2: ITuple<[KeyTypeId, Bytes]> | [KeyTypeId | AnyNumber | Uint8Array, Bytes | string | Uint8Array]) => Observable<Option<ValidatorId>>>;
|
||||
};
|
||||
democracy: {
|
||||
|
||||
/**
|
||||
* The number of (public) proposals that have been made so far.
|
||||
**/
|
||||
publicPropCount: AugmentedQuery<ApiType, () => Observable<PropIndex>>;
|
||||
/**
|
||||
* The public proposals. Unsorted. The second item is the proposal's hash.
|
||||
**/
|
||||
publicProps: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[PropIndex, Hash, AccountId]>>>>;
|
||||
/**
|
||||
* Map of hashes to the proposal preimage, along with who registered it and their deposit.
|
||||
* The block number is the block at which it was deposited.
|
||||
**/
|
||||
preimages: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ITuple<[Bytes, AccountId, BalanceOf, BlockNumber]>>>>;
|
||||
/**
|
||||
* Those who have locked a deposit.
|
||||
**/
|
||||
depositOf: AugmentedQuery<ApiType, (arg: PropIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[BalanceOf, Vec<AccountId>]>>>>;
|
||||
/**
|
||||
* The next free referendum index, aka the number of referenda started so far.
|
||||
**/
|
||||
referendumCount: AugmentedQuery<ApiType, () => Observable<ReferendumIndex>>;
|
||||
/**
|
||||
* The lowest referendum index representing an unbaked referendum. Equal to
|
||||
* `ReferendumCount` if there isn't a unbaked referendum.
|
||||
**/
|
||||
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<ReferendumIndex>>;
|
||||
/**
|
||||
* Information concerning any given referendum.
|
||||
**/
|
||||
referendumInfoOf: AugmentedQuery<ApiType, (arg: ReferendumIndex | AnyNumber | Uint8Array) => Observable<Option<ReferendumInfo>>>;
|
||||
/**
|
||||
* Queue of successful referenda to be dispatched. Stored ordered by block number.
|
||||
**/
|
||||
dispatchQueue: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>>;
|
||||
/**
|
||||
* Get the voters for the current proposal.
|
||||
**/
|
||||
votersFor: AugmentedQuery<ApiType, (arg: ReferendumIndex | AnyNumber | Uint8Array) => Observable<Vec<AccountId>>>;
|
||||
/**
|
||||
* Get the vote in a given referendum of a particular voter. The result is meaningful only
|
||||
* if `voters_for` includes the voter when called with the referendum (you'll get the
|
||||
* default `Vote` value otherwise). If you don't want to check `voters_for`, then you can
|
||||
* also check for simple existence with `VoteOf::exists` first.
|
||||
**/
|
||||
voteOf: AugmentedQuery<ApiType, (arg: ITuple<[ReferendumIndex, AccountId]> | [ReferendumIndex | AnyNumber | Uint8Array, AccountId | string | Uint8Array]) => Observable<Vote>>;
|
||||
/**
|
||||
* Who is able to vote for whom. Value is the fund-holding account, key is the
|
||||
* vote-transaction-sending account.
|
||||
**/
|
||||
proxy: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>>;
|
||||
/**
|
||||
* Get the account (and lock periods) to which another account is delegating vote.
|
||||
**/
|
||||
delegations: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[AccountId, Conviction]>>>;
|
||||
/**
|
||||
* True if the last referendum tabled was submitted externally. False if it was a public
|
||||
* proposal.
|
||||
**/
|
||||
lastTabledWasExternal: AugmentedQuery<ApiType, () => Observable<bool>>;
|
||||
/**
|
||||
* The referendum to be tabled whenever it would be valid to table an external proposal.
|
||||
* This happens when a referendum needs to be tabled and one of two conditions are met:
|
||||
* - `LastTabledWasExternal` is `false`; or
|
||||
* - `PublicProps` is empty.
|
||||
**/
|
||||
nextExternal: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[Hash, VoteThreshold]>>>>;
|
||||
/**
|
||||
* A record of who vetoed what. Maps proposal hash to a possible existent block number
|
||||
* (until when it may not be resubmitted) and who vetoed it.
|
||||
**/
|
||||
blacklist: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ITuple<[BlockNumber, Vec<AccountId>]>>>>;
|
||||
/**
|
||||
* Record of all proposals that have been subject to emergency cancellation.
|
||||
**/
|
||||
cancellations: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<bool>>;
|
||||
};
|
||||
council: {
|
||||
|
||||
/**
|
||||
* The hashes of the active proposals.
|
||||
**/
|
||||
proposals: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>>;
|
||||
/**
|
||||
* Actual proposal for a given hash, if it's current.
|
||||
**/
|
||||
proposalOf: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Proposal>>>;
|
||||
/**
|
||||
* Votes on a given proposal, if it is ongoing.
|
||||
**/
|
||||
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>>;
|
||||
/**
|
||||
* Proposals so far.
|
||||
**/
|
||||
proposalCount: AugmentedQuery<ApiType, () => Observable<u32>>;
|
||||
/**
|
||||
* The current members of the collective. This is stored sorted (just by value).
|
||||
**/
|
||||
members: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>>;
|
||||
};
|
||||
elections: {
|
||||
|
||||
/**
|
||||
* The current elected membership. Sorted based on account id.
|
||||
**/
|
||||
members: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>>;
|
||||
/**
|
||||
* The current runners_up. Sorted based on low to high merit (worse to best runner).
|
||||
**/
|
||||
runnersUp: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>>;
|
||||
/**
|
||||
* The total number of vote rounds that have happened, excluding the upcoming one.
|
||||
**/
|
||||
electionRounds: AugmentedQuery<ApiType, () => Observable<u32>>;
|
||||
/**
|
||||
* Votes of a particular voter, with the round index of the votes.
|
||||
**/
|
||||
votesOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<AccountId>>>;
|
||||
/**
|
||||
* Locked stake of a voter.
|
||||
**/
|
||||
stakeOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<BalanceOf>>;
|
||||
/**
|
||||
* The present candidate list. Sorted based on account-id. A current member or a runner can
|
||||
* never enter this vector and is always implicitly assumed to be a candidate.
|
||||
**/
|
||||
candidates: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>>;
|
||||
};
|
||||
grandpa: {
|
||||
|
||||
/**
|
||||
* DEPRECATED
|
||||
* This used to store the current authority set, which has been migrated to the well-known
|
||||
* GRANDPA_AUTHORITES_KEY unhashed key.
|
||||
**/
|
||||
authorities: AugmentedQuery<ApiType, () => Observable<AuthorityList>>;
|
||||
/**
|
||||
* State of the current authority set.
|
||||
**/
|
||||
state: AugmentedQuery<ApiType, () => Observable<StoredState>>;
|
||||
/**
|
||||
* Pending change: (signaled at, scheduled change).
|
||||
**/
|
||||
pendingChange: AugmentedQuery<ApiType, () => Observable<Option<StoredPendingChange>>>;
|
||||
/**
|
||||
* next block number where we can force a change.
|
||||
**/
|
||||
nextForced: AugmentedQuery<ApiType, () => Observable<Option<BlockNumber>>>;
|
||||
/**
|
||||
* `true` if we are currently stalled.
|
||||
**/
|
||||
stalled: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[BlockNumber, BlockNumber]>>>>;
|
||||
/**
|
||||
* The number of changes (both in terms of keys and underlying economic responsibilities)
|
||||
* in the "set" of Grandpa validators from genesis.
|
||||
**/
|
||||
currentSetId: AugmentedQuery<ApiType, () => Observable<SetId>>;
|
||||
/**
|
||||
* A mapping from grandpa set ID to the index of the *most recent* session for which its members were responsible.
|
||||
**/
|
||||
setIdSession: AugmentedQuery<ApiType, (arg: SetId | AnyNumber | Uint8Array) => Observable<Option<SessionIndex>>>;
|
||||
};
|
||||
treasury: {
|
||||
|
||||
/**
|
||||
* Number of proposals that have been made.
|
||||
**/
|
||||
proposalCount: AugmentedQuery<ApiType, () => Observable<ProposalIndex>>;
|
||||
/**
|
||||
* Proposals that have been made.
|
||||
**/
|
||||
proposals: AugmentedQuery<ApiType, (arg: ProposalIndex | AnyNumber | Uint8Array) => Observable<Option<TreasuryProposal>>>;
|
||||
/**
|
||||
* Proposal indices that have been approved but not yet awarded.
|
||||
**/
|
||||
approvals: AugmentedQuery<ApiType, () => Observable<Vec<ProposalIndex>>>;
|
||||
/**
|
||||
* Tips that are not yet completed. Keyed by the hash of `(reason, who)` from the value.
|
||||
* This has the insecure enumerable hash function since the key itself is already
|
||||
* guaranteed to be a secure hash.
|
||||
**/
|
||||
tips: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<OpenTip>>>;
|
||||
/**
|
||||
* Simple preimage lookup from the reason's hash to the original data. Again, has an
|
||||
* insecure enumerable hash since the key is guaranteed to be the result of a secure hash.
|
||||
**/
|
||||
reasons: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Bytes>>>;
|
||||
};
|
||||
contracts: {
|
||||
|
||||
/**
|
||||
* Gas spent so far in this block.
|
||||
**/
|
||||
gasSpent: AugmentedQuery<ApiType, () => Observable<Gas>>;
|
||||
/**
|
||||
* Current cost schedule for contracts.
|
||||
**/
|
||||
currentSchedule: AugmentedQuery<ApiType, () => Observable<Schedule>>;
|
||||
/**
|
||||
* A mapping from an original code hash to the original code, untouched by instrumentation.
|
||||
**/
|
||||
pristineCode: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<Bytes>>>;
|
||||
/**
|
||||
* A mapping between an original code hash and instrumented wasm code, ready for execution.
|
||||
**/
|
||||
codeStorage: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<PrefabWasmModule>>>;
|
||||
/**
|
||||
* The subtrie counter.
|
||||
**/
|
||||
accountCounter: AugmentedQuery<ApiType, () => Observable<u64>>;
|
||||
/**
|
||||
* The code associated with a given account.
|
||||
**/
|
||||
contractInfoOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ContractInfo>>>;
|
||||
/**
|
||||
* The price of one unit of gas.
|
||||
**/
|
||||
gasPrice: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
|
||||
};
|
||||
identity: {
|
||||
|
||||
/**
|
||||
* Information that is pertinent to identify the entity behind an account.
|
||||
**/
|
||||
identityOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Registration>>>;
|
||||
/**
|
||||
* The super-identity of an alternative "sub" identity together with its name, within that
|
||||
* context. If the account is not some other account's sub-identity, then just `None`.
|
||||
**/
|
||||
superOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[AccountId, Data]>>>>;
|
||||
/**
|
||||
* Alternative "sub" identities of this account.
|
||||
* The first item is the deposit, the second is a vector of the accounts.
|
||||
**/
|
||||
subsOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>>;
|
||||
/**
|
||||
* The set of registrars. Not expected to get very big as can only be added through a
|
||||
* special origin (likely a council motion).
|
||||
* The index into this can be cast to `RegistrarIndex` to get a valid value.
|
||||
**/
|
||||
registrars: AugmentedQuery<ApiType, () => Observable<Vec<Option<RegistrarInfo>>>>;
|
||||
};
|
||||
imOnline: {
|
||||
|
||||
/**
|
||||
* The block number after which it's ok to send heartbeats in current session.
|
||||
* At the beginning of each session we set this to a value that should
|
||||
* fall roughly in the middle of the session duration.
|
||||
* The idea is to first wait for the validators to produce a block
|
||||
* in the current session, so that the heartbeat later on will not be necessary.
|
||||
**/
|
||||
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
|
||||
/**
|
||||
* The current set of keys that may issue a heartbeat.
|
||||
**/
|
||||
keys: AugmentedQuery<ApiType, () => Observable<Vec<AuthorityId>>>;
|
||||
/**
|
||||
* For each session index, we keep a mapping of `AuthIndex`
|
||||
* to `offchain::OpaqueNetworkState`.
|
||||
**/
|
||||
receivedHeartbeats: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: AuthIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>>;
|
||||
/**
|
||||
* For each session index, we keep a mapping of `T::ValidatorId` to the
|
||||
* number of blocks authored by the given authority.
|
||||
**/
|
||||
authoredBlocks: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>>;
|
||||
};
|
||||
offences: {
|
||||
|
||||
/**
|
||||
* The primary structure that holds all offence records keyed by report identifiers.
|
||||
**/
|
||||
reports: AugmentedQuery<ApiType, (arg: ReportIdOf | string | Uint8Array) => Observable<Option<OffenceDetails>>>;
|
||||
/**
|
||||
* A vector of reports of the same kind that happened at the same time slot.
|
||||
**/
|
||||
concurrentReportsIndex: AugmentedQueryDoubleMap<ApiType, (key1: Kind | string | Uint8Array, key2: OpaqueTimeSlot | string | Uint8Array) => Observable<Vec<ReportIdOf>>>;
|
||||
/**
|
||||
* Enumerates all reports of a kind along with the time they happened.
|
||||
* All reports are sorted by the time of offence.
|
||||
* Note that the actual type of this mapping is `Vec<u8>`, this is because values of
|
||||
* different types are not supported at the moment so we are doing the manual serialization.
|
||||
**/
|
||||
reportsByKindIndex: AugmentedQuery<ApiType, (arg: Kind | string | Uint8Array) => Observable<Bytes>>;
|
||||
};
|
||||
randomnessCollectiveFlip: {
|
||||
|
||||
/**
|
||||
* Series of block headers from the last 81 blocks that acts as random seed material. This
|
||||
* is arranged as a ring buffer with `block_number % 81` being the index into the `Vec` of
|
||||
* the oldest hash.
|
||||
**/
|
||||
randomMaterial: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>>;
|
||||
};
|
||||
nicks: {
|
||||
|
||||
/**
|
||||
* The lookup table for names.
|
||||
**/
|
||||
nameOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Bytes, BalanceOf]>>>>;
|
||||
};
|
||||
sudo: {
|
||||
|
||||
/**
|
||||
* The `AccountId` of the sudo key.
|
||||
**/
|
||||
key: AugmentedQuery<ApiType, () => Observable<AccountId>>;
|
||||
};
|
||||
signaling: {
|
||||
|
||||
/**
|
||||
* The total number of proposals created thus far.
|
||||
**/
|
||||
proposalCount: AugmentedQuery<ApiType, () => Observable<u32>>;
|
||||
/**
|
||||
* A list of all extant proposals.
|
||||
**/
|
||||
inactiveProposals: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[Hash, BlockNumber]>>>>;
|
||||
/**
|
||||
* A list of active proposals along with the time at which they complete.
|
||||
**/
|
||||
activeProposals: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[Hash, BlockNumber]>>>>;
|
||||
/**
|
||||
* A list of completed proposals, pending deletion
|
||||
**/
|
||||
completedProposals: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[Hash, BlockNumber]>>>>;
|
||||
/**
|
||||
* Amount of time a proposal remains in "Voting" stage.
|
||||
**/
|
||||
votingLength: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
|
||||
/**
|
||||
* Map for retrieving the information about any proposal from its hash.
|
||||
**/
|
||||
proposalOf: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ProposalRecord>>>;
|
||||
/**
|
||||
* Registration bond
|
||||
**/
|
||||
proposalCreationBond: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
|
||||
};
|
||||
voting: {
|
||||
|
||||
/**
|
||||
* The map of all vote records indexed by id
|
||||
**/
|
||||
voteRecords: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<VoteRecord>>>;
|
||||
/**
|
||||
* The number of vote records that have been created
|
||||
**/
|
||||
voteRecordCount: AugmentedQuery<ApiType, () => Observable<u64>>;
|
||||
};
|
||||
treasuryReward: {
|
||||
|
||||
/**
|
||||
* Interval in number of blocks to reward treasury
|
||||
**/
|
||||
mintingInterval: AugmentedQuery<ApiType, () => Observable<BlockNumber>>;
|
||||
/**
|
||||
* Current payout of module
|
||||
**/
|
||||
currentPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>>;
|
||||
/**
|
||||
* Current pot
|
||||
**/
|
||||
pot: AugmentedQuery<ApiType, () => Observable<Balance>>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
|
||||
}
|
||||
}
|
||||
+123
-600
@@ -1,27 +1,29 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { AnyNumber, ITuple } from '@polkadot/types/types';
|
||||
import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Data, IdentityFields, bool, u16, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, Signature } from '@polkadot/types/interfaces/runtime';
|
||||
import { Compact, Option, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Data, bool, u16, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
|
||||
import { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts';
|
||||
import { Conviction, PropIndex, Proposal, ReferendumIndex } from '@polkadot/types/interfaces/democracy';
|
||||
import { Vote } from '@polkadot/types/interfaces/elections';
|
||||
import { IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity';
|
||||
import { Signature } from '@polkadot/types/interfaces/extrinsics';
|
||||
import { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity';
|
||||
import { Heartbeat } from '@polkadot/types/interfaces/imOnline';
|
||||
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment } from '@polkadot/types/interfaces/runtime';
|
||||
import { Keys } from '@polkadot/types/interfaces/session';
|
||||
import { SocietyJudgement } from '@polkadot/types/interfaces/society';
|
||||
import { ProposalContents, ProposalTitle } from 'sample-polkadotjs-typegen/interfaces/signaling';
|
||||
import { EraIndex, RewardDestination, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
||||
import { Key } from '@polkadot/types/interfaces/system';
|
||||
import { Timepoint } from '@polkadot/types/interfaces/utility';
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
||||
import { TallyType, VoteOutcome, VoteType } from 'sample-polkadotjs-typegen/interfaces/voting';
|
||||
import { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
|
||||
|
||||
declare module '@polkadot/api/types/submittable' {
|
||||
export interface AugmentedSubmittables<ApiType> {
|
||||
system: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* A big dispatch that will disallow any other transaction to be included.
|
||||
**/
|
||||
@@ -60,7 +62,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
killPrefix: AugmentedSubmittable<(prefix: Key | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
utility: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Send a batch of dispatch calls.
|
||||
* This will execute until the first one fails and then stop.
|
||||
@@ -151,7 +153,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* `MultisigDepositBase + threshold * MultisigDepositFactor`.
|
||||
* # </weight>
|
||||
**/
|
||||
approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], maybeTimepoint: Option<Timepoint> | null | object | string | Uint8Array, callHash: Raw | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
approveAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], maybeTimepoint: Option<Timepoint> | null | object | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously
|
||||
* for this operation will be unreserved on success.
|
||||
@@ -173,10 +175,10 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Storage: removes one item.
|
||||
* # </weight>
|
||||
**/
|
||||
cancelAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], timepoint: Timepoint | { height?: any; index?: any } | string | Uint8Array, callHash: Raw | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
cancelAsMulti: AugmentedSubmittable<(threshold: u16 | AnyNumber | Uint8Array, otherSignatories: Vec<AccountId> | (AccountId | string | Uint8Array)[], timepoint: Timepoint | { height?: any; index?: any } | string | Uint8Array, callHash: U8aFixed | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
timestamp: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Set the current time.
|
||||
* This call should be invoked exactly once per block. It will panic at the finalization
|
||||
@@ -188,75 +190,14 @@ declare module '@polkadot/api/types/submittable' {
|
||||
set: AugmentedSubmittable<(now: Compact<Moment> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
authorship: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Provide a set of uncles.
|
||||
**/
|
||||
setUncles: AugmentedSubmittable<(newUncles: Vec<Header> | (Header | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
indices: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
/**
|
||||
* Assign an previously unassigned index.
|
||||
* Payment: `Deposit` is reserved from the sender account.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* - `index`: the index to be claimed. This must not be in use.
|
||||
* Emits `IndexAssigned` if successful.
|
||||
* # <weight>
|
||||
* - `O(1)`.
|
||||
* - One storage mutation (codec `O(1)`).
|
||||
* - One reserve operation.
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
claim: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Assign an index already owned by the sender to another account. The balance reservation
|
||||
* is effectively transfered to the new account.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* - `index`: the index to be re-assigned. This must be owned by the sender.
|
||||
* - `new`: the new owner of the index. This function is a no-op if it is equal to sender.
|
||||
* Emits `IndexAssigned` if successful.
|
||||
* # <weight>
|
||||
* - `O(1)`.
|
||||
* - One storage mutation (codec `O(1)`).
|
||||
* - One transfer operation.
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
transfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Free up an index owned by the sender.
|
||||
* Payment: Any previous deposit placed for the index is unreserved in the sender account.
|
||||
* The dispatch origin for this call must be _Signed_ and the sender must own the index.
|
||||
* - `index`: the index to be freed. This must be owned by the sender.
|
||||
* Emits `IndexFreed` if successful.
|
||||
* # <weight>
|
||||
* - `O(1)`.
|
||||
* - One storage mutation (codec `O(1)`).
|
||||
* - One reserve operation.
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
free: AugmentedSubmittable<(index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Force an index to an account. This doesn't require a deposit. If the index is already
|
||||
* held, then any deposit is reimbursed to its current owner.
|
||||
* The dispatch origin for this call must be _Root_.
|
||||
* - `index`: the index to be (re-)assigned.
|
||||
* - `new`: the new owner of the index. This function is a no-op if it is equal to sender.
|
||||
* Emits `IndexAssigned` if successful.
|
||||
* # <weight>
|
||||
* - `O(1)`.
|
||||
* - One storage mutation (codec `O(1)`).
|
||||
* - Up to one reserve operation.
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
forceTransfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
balances: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Transfer some liquid free balance to another account.
|
||||
* `transfer` will set the `FreeBalance` of the sender and receiver.
|
||||
@@ -272,7 +213,8 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - `ensure_can_withdraw` is always called internally but has a bounded complexity.
|
||||
* - Transferring balances to accounts that did not exist before will cause
|
||||
* `T::OnNewAccount::on_new_account` to be called.
|
||||
* - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.
|
||||
* - Removing enough funds from an account will trigger
|
||||
* `T::DustRemoval::on_unbalanced` and `T::OnFreeBalanceZero::on_free_balance_zero`.
|
||||
* - `transfer_keep_alive` works the same way as `transfer`, but has an additional
|
||||
* check that the transfer will not kill the origin account.
|
||||
* # </weight>
|
||||
@@ -305,7 +247,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
staking: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Take the origin account as a stash and lock up `value` of its balance. `controller` will
|
||||
* be the account that controls it.
|
||||
@@ -478,7 +420,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
rebond: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
session: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Sets the session key(s) of the function caller to `keys`.
|
||||
* Allows an account to set its session key prior to becoming a validator.
|
||||
@@ -492,7 +434,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
setKeys: AugmentedSubmittable<(keys: Keys, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
democracy: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Propose a sensitive action to be taken.
|
||||
* # <weight>
|
||||
@@ -630,38 +572,9 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* work an additional `EnactmentPeriod` later.
|
||||
**/
|
||||
reapPreimage: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
unlock: AugmentedSubmittable<(target: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
council: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
/**
|
||||
* Set the collective's membership manually to `new_members`. Be nice to the chain and
|
||||
* provide it pre-sorted.
|
||||
* Requires root origin.
|
||||
**/
|
||||
setMembers: AugmentedSubmittable<(newMembers: Vec<AccountId> | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Dispatch a proposal from a member using the `Member` origin.
|
||||
* Origin must be a member of the collective.
|
||||
**/
|
||||
execute: AugmentedSubmittable<(proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* # <weight>
|
||||
* - Bounded storage reads and writes.
|
||||
* - Argument `threshold` has bearing on weight.
|
||||
* # </weight>
|
||||
**/
|
||||
propose: AugmentedSubmittable<(threshold: Compact<MemberCount> | AnyNumber | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* # <weight>
|
||||
* - Bounded storage read and writes.
|
||||
* - Will be slightly heavier if the proposal is approved / disapproved after the vote.
|
||||
* # </weight>
|
||||
**/
|
||||
vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact<ProposalIndex> | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
technicalCommittee: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Set the collective's membership manually to `new_members`. Be nice to the chain and
|
||||
* provide it pre-sorted.
|
||||
@@ -689,7 +602,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
vote: AugmentedSubmittable<(proposal: Hash | string | Uint8Array, index: Compact<ProposalIndex> | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
elections: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Vote for a set of candidates for the upcoming round of election.
|
||||
* The `votes` should:
|
||||
@@ -768,37 +681,8 @@ declare module '@polkadot/api/types/submittable' {
|
||||
**/
|
||||
removeMember: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
technicalMembership: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
/**
|
||||
* Add a member `who` to the set.
|
||||
* May only be called from `AddOrigin` or root.
|
||||
**/
|
||||
addMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Remove a member `who` from the set.
|
||||
* May only be called from `RemoveOrigin` or root.
|
||||
**/
|
||||
removeMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Swap out one member `remove` for another `add`.
|
||||
* May only be called from `SwapOrigin` or root.
|
||||
**/
|
||||
swapMember: AugmentedSubmittable<(remove: AccountId | string | Uint8Array, add: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Change the membership to a new set, disregarding the existing membership. Be nice and
|
||||
* pass `members` pre-sorted.
|
||||
* May only be called from `ResetOrigin` or root.
|
||||
**/
|
||||
resetMembers: AugmentedSubmittable<(members: Vec<AccountId> | (AccountId | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Swap out the sending member for some other key `new`.
|
||||
* May only be called from `Signed` origin of a current member.
|
||||
**/
|
||||
changeKey: AugmentedSubmittable<(updated: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
finalityTracker: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Hint that the author of this block thinks the best finalized
|
||||
* block is the given number.
|
||||
@@ -806,14 +690,14 @@ declare module '@polkadot/api/types/submittable' {
|
||||
finalHint: AugmentedSubmittable<(hint: Compact<BlockNumber> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
grandpa: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Report some misbehavior.
|
||||
**/
|
||||
reportMisbehavior: AugmentedSubmittable<(report: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
treasury: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Put forward a suggestion for spending. A deposit proportional to the value
|
||||
* is reserved and slashed if the proposal is rejected. It is returned once the
|
||||
@@ -929,7 +813,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
closeTip: AugmentedSubmittable<(hash: Hash | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
contracts: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Updates the schedule for metering contracts.
|
||||
* The schedule must have a greater version than the stored schedule.
|
||||
@@ -968,48 +852,8 @@ declare module '@polkadot/api/types/submittable' {
|
||||
**/
|
||||
claimSurcharge: AugmentedSubmittable<(dest: AccountId | string | Uint8Array, auxSender: Option<AccountId> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
sudo: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
/**
|
||||
* Authenticates the sudo key and dispatches a function call with `Root` origin.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* # <weight>
|
||||
* - O(1).
|
||||
* - Limited storage reads.
|
||||
* - One DB write (event).
|
||||
* - Unknown weight of derivative `proposal` execution.
|
||||
* # </weight>
|
||||
**/
|
||||
sudo: AugmentedSubmittable<(proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* # <weight>
|
||||
* - O(1).
|
||||
* - Limited storage reads.
|
||||
* - One DB change.
|
||||
* # </weight>
|
||||
**/
|
||||
setKey: AugmentedSubmittable<(updated: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Authenticates the sudo key and dispatches a function call with `Signed` origin from
|
||||
* a given account.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* # <weight>
|
||||
* - O(1).
|
||||
* - Limited storage reads.
|
||||
* - One DB write (event).
|
||||
* - Unknown weight of derivative `proposal` execution.
|
||||
* # </weight>
|
||||
**/
|
||||
sudoAs: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
imOnline: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
heartbeat: AugmentedSubmittable<(heartbeat: Heartbeat | { blockNumber?: any; networkState?: any; sessionIndex?: any; authorityIndex?: any } | string | Uint8Array, signature: Signature | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
identity: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
|
||||
/**
|
||||
* Add a registrar to the system.
|
||||
* The dispatch origin for this call must be `RegistrarOrigin` or `Root`.
|
||||
@@ -1174,451 +1018,130 @@ declare module '@polkadot/api/types/submittable' {
|
||||
**/
|
||||
killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
society: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
/**
|
||||
* A user outside of the society can make a bid for entry.
|
||||
* Payment: `CandidateDeposit` will be reserved for making a bid. It is returned
|
||||
* when the bid becomes a member, or if the bid calls `unbid`.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* Parameters:
|
||||
* - `value`: A one time payment the bid would like to receive when joining the society.
|
||||
* # <weight>
|
||||
* Key: B (len of bids), C (len of candidates), M (len of members), X (balance reserve)
|
||||
* - Storage Reads:
|
||||
* - One storage read to check for suspended candidate. O(1)
|
||||
* - One storage read to check for suspended member. O(1)
|
||||
* - One storage read to retrieve all current bids. O(B)
|
||||
* - One storage read to retrieve all current candidates. O(C)
|
||||
* - One storage read to retrieve all members. O(M)
|
||||
* - Storage Writes:
|
||||
* - One storage mutate to add a new bid to the vector O(B) (TODO: possible optimization w/ read)
|
||||
* - Up to one storage removal if bid.len() > MAX_BID_COUNT. O(1)
|
||||
* - Notable Computation:
|
||||
* - O(B + C + log M) search to check user is not already a part of society.
|
||||
* - O(log B) search to insert the new bid sorted.
|
||||
* - External Module Operations:
|
||||
* - One balance reserve operation. O(X)
|
||||
* - Up to one balance unreserve operation if bids.len() > MAX_BID_COUNT.
|
||||
* - Events:
|
||||
* - One event for new bid.
|
||||
* - Up to one event for AutoUnbid if bid.len() > MAX_BID_COUNT.
|
||||
* Total Complexity: O(M + B + C + logM + logB + X)
|
||||
* # </weight>
|
||||
**/
|
||||
bid: AugmentedSubmittable<(value: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* A bidder can remove their bid for entry into society.
|
||||
* By doing so, they will have their candidate deposit returned or
|
||||
* they will unvouch their voucher.
|
||||
* Payment: The bid deposit is unreserved if the user made a bid.
|
||||
* The dispatch origin for this call must be _Signed_ and a bidder.
|
||||
* Parameters:
|
||||
* - `pos`: Position in the `Bids` vector of the bid who wants to unbid.
|
||||
* # <weight>
|
||||
* Key: B (len of bids), X (balance unreserve)
|
||||
* - One storage read and write to retrieve and update the bids. O(B)
|
||||
* - Either one unreserve balance action O(X) or one vouching storage removal. O(1)
|
||||
* - One event.
|
||||
* Total Complexity: O(B + X)
|
||||
* # </weight>
|
||||
**/
|
||||
unbid: AugmentedSubmittable<(pos: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* As a member, vouch for someone to join society by placing a bid on their behalf.
|
||||
* There is no deposit required to vouch for a new bid, but a member can only vouch for
|
||||
* one bid at a time. If the bid becomes a suspended candidate and ultimately rejected by
|
||||
* the suspension judgement origin, the member will be banned from vouching again.
|
||||
* As a vouching member, you can claim a tip if the candidate is accepted. This tip will
|
||||
* be paid as a portion of the reward the member will receive for joining the society.
|
||||
* The dispatch origin for this call must be _Signed_ and a member.
|
||||
* Parameters:
|
||||
* - `who`: The user who you would like to vouch for.
|
||||
* - `value`: The total reward to be paid between you and the candidate if they become
|
||||
* a member in the society.
|
||||
* - `tip`: Your cut of the total `value` payout when the candidate is inducted into
|
||||
* the society. Tips larger than `value` will be saturated upon payout.
|
||||
* # <weight>
|
||||
* Key: B (len of bids), C (len of candidates), M (len of members)
|
||||
* - Storage Reads:
|
||||
* - One storage read to retrieve all members. O(M)
|
||||
* - One storage read to check member is not already vouching. O(1)
|
||||
* - One storage read to check for suspended candidate. O(1)
|
||||
* - One storage read to check for suspended member. O(1)
|
||||
* - One storage read to retrieve all current bids. O(B)
|
||||
* - One storage read to retrieve all current candidates. O(C)
|
||||
* - Storage Writes:
|
||||
* - One storage write to insert vouching status to the member. O(1)
|
||||
* - One storage mutate to add a new bid to the vector O(B) (TODO: possible optimization w/ read)
|
||||
* - Up to one storage removal if bid.len() > MAX_BID_COUNT. O(1)
|
||||
* - Notable Computation:
|
||||
* - O(log M) search to check sender is a member.
|
||||
* - O(B + C + log M) search to check user is not already a part of society.
|
||||
* - O(log B) search to insert the new bid sorted.
|
||||
* - External Module Operations:
|
||||
* - One balance reserve operation. O(X)
|
||||
* - Up to one balance unreserve operation if bids.len() > MAX_BID_COUNT.
|
||||
* - Events:
|
||||
* - One event for vouch.
|
||||
* - Up to one event for AutoUnbid if bid.len() > MAX_BID_COUNT.
|
||||
* Total Complexity: O(M + B + C + logM + logB + X)
|
||||
* # </weight>
|
||||
**/
|
||||
vouch: AugmentedSubmittable<(who: AccountId | string | Uint8Array, value: BalanceOf | AnyNumber | Uint8Array, tip: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* As a vouching member, unvouch a bid. This only works while vouched user is
|
||||
* only a bidder (and not a candidate).
|
||||
* The dispatch origin for this call must be _Signed_ and a vouching member.
|
||||
* Parameters:
|
||||
* - `pos`: Position in the `Bids` vector of the bid who should be unvouched.
|
||||
* # <weight>
|
||||
* Key: B (len of bids)
|
||||
* - One storage read O(1) to check the signer is a vouching member.
|
||||
* - One storage mutate to retrieve and update the bids. O(B)
|
||||
* - One vouching storage removal. O(1)
|
||||
* - One event.
|
||||
* Total Complexity: O(B)
|
||||
* # </weight>
|
||||
**/
|
||||
unvouch: AugmentedSubmittable<(pos: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* As a member, vote on a candidate.
|
||||
* The dispatch origin for this call must be _Signed_ and a member.
|
||||
* Parameters:
|
||||
* - `candidate`: The candidate that the member would like to bid on.
|
||||
* - `approve`: A boolean which says if the candidate should be
|
||||
* approved (`true`) or rejected (`false`).
|
||||
* # <weight>
|
||||
* Key: C (len of candidates), M (len of members)
|
||||
* - One storage read O(M) and O(log M) search to check user is a member.
|
||||
* - One account lookup.
|
||||
* - One storage read O(C) and O(C) search to check that user is a candidate.
|
||||
* - One storage write to add vote to votes. O(1)
|
||||
* - One event.
|
||||
* Total Complexity: O(M + logM + C)
|
||||
* # </weight>
|
||||
**/
|
||||
vote: AugmentedSubmittable<(candidate: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* As a member, vote on the defender.
|
||||
* The dispatch origin for this call must be _Signed_ and a member.
|
||||
* Parameters:
|
||||
* - `approve`: A boolean which says if the candidate should be
|
||||
* approved (`true`) or rejected (`false`).
|
||||
* # <weight>
|
||||
* - Key: M (len of members)
|
||||
* - One storage read O(M) and O(log M) search to check user is a member.
|
||||
* - One storage write to add vote to votes. O(1)
|
||||
* - One event.
|
||||
* Total Complexity: O(M + logM)
|
||||
* # </weight>
|
||||
**/
|
||||
defenderVote: AugmentedSubmittable<(approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Transfer the first matured payout for the sender and remove it from the records.
|
||||
* NOTE: This extrinsic needs to be called multiple times to claim multiple matured payouts.
|
||||
* Payment: The member will receive a payment equal to their first matured
|
||||
* payout to their free balance.
|
||||
* The dispatch origin for this call must be _Signed_ and a member with
|
||||
* payouts remaining.
|
||||
* # <weight>
|
||||
* Key: M (len of members), P (number of payouts for a particular member)
|
||||
* - One storage read O(M) and O(log M) search to check signer is a member.
|
||||
* - One storage read O(P) to get all payouts for a member.
|
||||
* - One storage read O(1) to get the current block number.
|
||||
* - One currency transfer call. O(X)
|
||||
* - One storage write or removal to update the member's payouts. O(P)
|
||||
* Total Complexity: O(M + logM + P + X)
|
||||
* # </weight>
|
||||
**/
|
||||
payout: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Found the society.
|
||||
* This is done as a discrete action in order to allow for the
|
||||
* module to be included into a running chain and can only be done once.
|
||||
* The dispatch origin for this call must be from the _FounderSetOrigin_.
|
||||
* Parameters:
|
||||
* - `founder` - The first member and head of the newly founded society.
|
||||
* - `max_members` - The initial max number of members for the society.
|
||||
* - `rules` - The rules of this society concerning membership.
|
||||
* # <weight>
|
||||
* - Two storage mutates to set `Head` and `Founder`. O(1)
|
||||
* - One storage write to add the first member to society. O(1)
|
||||
* - One event.
|
||||
* Total Complexity: O(1)
|
||||
* # </weight>
|
||||
**/
|
||||
found: AugmentedSubmittable<(founder: AccountId | string | Uint8Array, maxMembers: u32 | AnyNumber | Uint8Array, rules: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Anull the founding of the society.
|
||||
* The dispatch origin for this call must be Signed, and the signing account must be both
|
||||
* the `Founder` and the `Head`. This implies that it may only be done when there is one
|
||||
* member.
|
||||
* # <weight>
|
||||
* - Two storage reads O(1).
|
||||
* - Four storage removals O(1).
|
||||
* - One event.
|
||||
* Total Complexity: O(1)
|
||||
* # </weight>
|
||||
**/
|
||||
unfound: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Allow suspension judgement origin to make judgement on a suspended member.
|
||||
* If a suspended member is forgiven, we simply add them back as a member, not affecting
|
||||
* any of the existing storage items for that member.
|
||||
* If a suspended member is rejected, remove all associated storage items, including
|
||||
* their payouts, and remove any vouched bids they currently have.
|
||||
* The dispatch origin for this call must be from the _SuspensionJudgementOrigin_.
|
||||
* Parameters:
|
||||
* - `who` - The suspended member to be judged.
|
||||
* - `forgive` - A boolean representing whether the suspension judgement origin
|
||||
* forgives (`true`) or rejects (`false`) a suspended member.
|
||||
* # <weight>
|
||||
* Key: B (len of bids), M (len of members)
|
||||
* - One storage read to check `who` is a suspended member. O(1)
|
||||
* - Up to one storage write O(M) with O(log M) binary search to add a member back to society.
|
||||
* - Up to 3 storage removals O(1) to clean up a removed member.
|
||||
* - Up to one storage write O(B) with O(B) search to remove vouched bid from bids.
|
||||
* - Up to one additional event if unvouch takes place.
|
||||
* - One storage removal. O(1)
|
||||
* - One event for the judgement.
|
||||
* Total Complexity: O(M + logM + B)
|
||||
* # </weight>
|
||||
**/
|
||||
judgeSuspendedMember: AugmentedSubmittable<(who: AccountId | string | Uint8Array, forgive: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Allow suspended judgement origin to make judgement on a suspended candidate.
|
||||
* If the judgement is `Approve`, we add them to society as a member with the appropriate
|
||||
* payment for joining society.
|
||||
* If the judgement is `Reject`, we either slash the deposit of the bid, giving it back
|
||||
* to the society treasury, or we ban the voucher from vouching again.
|
||||
* If the judgement is `Rebid`, we put the candidate back in the bid pool and let them go
|
||||
* through the induction process again.
|
||||
* The dispatch origin for this call must be from the _SuspensionJudgementOrigin_.
|
||||
* Parameters:
|
||||
* - `who` - The suspended candidate to be judged.
|
||||
* - `judgement` - `Approve`, `Reject`, or `Rebid`.
|
||||
* # <weight>
|
||||
* Key: B (len of bids), M (len of members), X (balance action)
|
||||
* - One storage read to check `who` is a suspended candidate.
|
||||
* - One storage removal of the suspended candidate.
|
||||
* - Approve Logic
|
||||
* - One storage read to get the available pot to pay users with. O(1)
|
||||
* - One storage write to update the available pot. O(1)
|
||||
* - One storage read to get the current block number. O(1)
|
||||
* - One storage read to get all members. O(M)
|
||||
* - Up to one unreserve currency action.
|
||||
* - Up to two new storage writes to payouts.
|
||||
* - Up to one storage write with O(log M) binary search to add a member to society.
|
||||
* - Reject Logic
|
||||
* - Up to one repatriate reserved currency action. O(X)
|
||||
* - Up to one storage write to ban the vouching member from vouching again.
|
||||
* - Rebid Logic
|
||||
* - Storage mutate with O(log B) binary search to place the user back into bids.
|
||||
* - Up to one additional event if unvouch takes place.
|
||||
* - One storage removal.
|
||||
* - One event for the judgement.
|
||||
* Total Complexity: O(M + logM + B + X)
|
||||
* # </weight>
|
||||
**/
|
||||
judgeSuspendedCandidate: AugmentedSubmittable<(who: AccountId | string | Uint8Array, judgement: SocietyJudgement | ('Rebid' | 'Reject' | 'Approve') | number | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Allows root origin to change the maximum number of members in society.
|
||||
* Max membership count must be greater than 1.
|
||||
* The dispatch origin for this call must be from _ROOT_.
|
||||
* Parameters:
|
||||
* - `max` - The maximum number of members for the society.
|
||||
* # <weight>
|
||||
* - One storage write to update the max. O(1)
|
||||
* - One event.
|
||||
* Total Complexity: O(1)
|
||||
* # </weight>
|
||||
**/
|
||||
setMaxMembers: AugmentedSubmittable<(max: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
imOnline: {
|
||||
|
||||
heartbeat: AugmentedSubmittable<(heartbeat: Heartbeat | { blockNumber?: any; networkState?: any; sessionIndex?: any; authorityIndex?: any } | string | Uint8Array, signature: Signature | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
recovery: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
nicks: {
|
||||
|
||||
/**
|
||||
* Send a call through a recovered account.
|
||||
* The dispatch origin for this call must be _Signed_ and registered to
|
||||
* be able to make calls on behalf of the recovered account.
|
||||
* Parameters:
|
||||
* - `account`: The recovered account you want to make a call on-behalf-of.
|
||||
* - `call`: The call you want to make with the recovered account.
|
||||
* # <weight>
|
||||
* - The weight of the `call`.
|
||||
* - One storage lookup to check account is recovered by `who`. O(1)
|
||||
* # </weight>
|
||||
**/
|
||||
asRecovered: AugmentedSubmittable<(account: AccountId | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Allow ROOT to bypass the recovery process and set an a rescuer account
|
||||
* for a lost account directly.
|
||||
* The dispatch origin for this call must be _ROOT_.
|
||||
* Parameters:
|
||||
* - `lost`: The "lost account" to be recovered.
|
||||
* - `rescuer`: The "rescuer account" which can call as the lost account.
|
||||
* # <weight>
|
||||
* - One storage write O(1)
|
||||
* - One event
|
||||
* # </weight>
|
||||
**/
|
||||
setRecovered: AugmentedSubmittable<(lost: AccountId | string | Uint8Array, rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Create a recovery configuration for your account. This makes your account recoverable.
|
||||
* Payment: `ConfigDepositBase` + `FriendDepositFactor` * #_of_friends balance
|
||||
* will be reserved for storing the recovery configuration. This deposit is returned
|
||||
* in full when the user calls `remove_recovery`.
|
||||
* Set an account's name. The name should be a UTF-8-encoded string by convention, though
|
||||
* we don't check it.
|
||||
* The name may not be more than `T::MaxLength` bytes, nor less than `T::MinLength` bytes.
|
||||
* If the account doesn't already have a name, then a fee of `ReservationFee` is reserved
|
||||
* in the account.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* Parameters:
|
||||
* - `friends`: A list of friends you trust to vouch for recovery attempts.
|
||||
* Should be ordered and contain no duplicate values.
|
||||
* - `threshold`: The number of friends that must vouch for a recovery attempt
|
||||
* before the account can be recovered. Should be less than or equal to
|
||||
* the length of the list of friends.
|
||||
* - `delay_period`: The number of blocks after a recovery attempt is initialized
|
||||
* that needs to pass before the account can be recovered.
|
||||
* # <weight>
|
||||
* - Key: F (len of friends)
|
||||
* - One storage read to check that account is not already recoverable. O(1).
|
||||
* - A check that the friends list is sorted and unique. O(F)
|
||||
* - One currency reserve operation. O(X)
|
||||
* - One storage write. O(1). Codec O(F).
|
||||
* - O(1).
|
||||
* - At most one balance operation.
|
||||
* - One storage read/write.
|
||||
* - One event.
|
||||
* Total Complexity: O(F + X)
|
||||
* # </weight>
|
||||
**/
|
||||
createRecovery: AugmentedSubmittable<(friends: Vec<AccountId> | (AccountId | string | Uint8Array)[], threshold: u16 | AnyNumber | Uint8Array, delayPeriod: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
setName: AugmentedSubmittable<(name: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Initiate the process for recovering a recoverable account.
|
||||
* Payment: `RecoveryDeposit` balance will be reserved for initiating the
|
||||
* recovery process. This deposit will always be repatriated to the account
|
||||
* trying to be recovered. See `close_recovery`.
|
||||
* Clear an account's name and return the deposit. Fails if the account was not named.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* Parameters:
|
||||
* - `account`: The lost account that you want to recover. This account
|
||||
* needs to be recoverable (i.e. have a recovery configuration).
|
||||
* # <weight>
|
||||
* - One storage read to check that account is recoverable. O(F)
|
||||
* - One storage read to check that this recovery process hasn't already started. O(1)
|
||||
* - One currency reserve operation. O(X)
|
||||
* - One storage read to get the current block number. O(1)
|
||||
* - One storage write. O(1).
|
||||
* - O(1).
|
||||
* - One balance operation.
|
||||
* - One storage read/write.
|
||||
* - One event.
|
||||
* Total Complexity: O(F + X)
|
||||
* # </weight>
|
||||
**/
|
||||
initiateRecovery: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
clearName: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Allow a "friend" of a recoverable account to vouch for an active recovery
|
||||
* process for that account.
|
||||
* The dispatch origin for this call must be _Signed_ and must be a "friend"
|
||||
* for the recoverable account.
|
||||
* Parameters:
|
||||
* - `lost`: The lost account that you want to recover.
|
||||
* - `rescuer`: The account trying to rescue the lost account that you
|
||||
* want to vouch for.
|
||||
* The combination of these two parameters must point to an active recovery
|
||||
* process.
|
||||
* Remove an account's name and take charge of the deposit.
|
||||
* Fails if `who` has not been named. The deposit is dealt with through `T::Slashed`
|
||||
* imbalance handler.
|
||||
* The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`.
|
||||
* # <weight>
|
||||
* Key: F (len of friends in config), V (len of vouching friends)
|
||||
* - One storage read to get the recovery configuration. O(1), Codec O(F)
|
||||
* - One storage read to get the active recovery process. O(1), Codec O(V)
|
||||
* - One binary search to confirm caller is a friend. O(logF)
|
||||
* - One binary search to confirm caller has not already vouched. O(logV)
|
||||
* - One storage write. O(1), Codec O(V).
|
||||
* - O(1).
|
||||
* - One unbalanced handler (probably a balance transfer)
|
||||
* - One storage read/write.
|
||||
* - One event.
|
||||
* Total Complexity: O(F + logF + V + logV)
|
||||
* # </weight>
|
||||
**/
|
||||
vouchRecovery: AugmentedSubmittable<(lost: AccountId | string | Uint8Array, rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
killName: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Allow a successful rescuer to claim their recovered account.
|
||||
* The dispatch origin for this call must be _Signed_ and must be a "rescuer"
|
||||
* who has successfully completed the account recovery process: collected
|
||||
* `threshold` or more vouches, waited `delay_period` blocks since initiation.
|
||||
* Parameters:
|
||||
* - `account`: The lost account that you want to claim has been successfully
|
||||
* recovered by you.
|
||||
* Set a third-party account's name with no deposit.
|
||||
* No length checking is done on the name.
|
||||
* The dispatch origin for this call must be _Root_ or match `T::ForceOrigin`.
|
||||
* # <weight>
|
||||
* Key: F (len of friends in config), V (len of vouching friends)
|
||||
* - One storage read to get the recovery configuration. O(1), Codec O(F)
|
||||
* - One storage read to get the active recovery process. O(1), Codec O(V)
|
||||
* - One storage read to get the current block number. O(1)
|
||||
* - One storage write. O(1), Codec O(V).
|
||||
* - O(1).
|
||||
* - At most one balance operation.
|
||||
* - One storage read/write.
|
||||
* - One event.
|
||||
* Total Complexity: O(F + V)
|
||||
* # </weight>
|
||||
**/
|
||||
claimRecovery: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* As the controller of a recoverable account, close an active recovery
|
||||
* process for your account.
|
||||
* Payment: By calling this function, the recoverable account will receive
|
||||
* the recovery deposit `RecoveryDeposit` placed by the rescuer.
|
||||
* The dispatch origin for this call must be _Signed_ and must be a
|
||||
* recoverable account with an active recovery process for it.
|
||||
* Parameters:
|
||||
* - `rescuer`: The account trying to rescue this recoverable account.
|
||||
* # <weight>
|
||||
* Key: V (len of vouching friends)
|
||||
* - One storage read/remove to get the active recovery process. O(1), Codec O(V)
|
||||
* - One balance call to repatriate reserved. O(X)
|
||||
* - One event.
|
||||
* Total Complexity: O(V + X)
|
||||
* # </weight>
|
||||
**/
|
||||
closeRecovery: AugmentedSubmittable<(rescuer: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Remove the recovery process for your account.
|
||||
* NOTE: The user must make sure to call `close_recovery` on all active
|
||||
* recovery attempts before calling this function else it will fail.
|
||||
* Payment: By calling this function the recoverable account will unreserve
|
||||
* their recovery configuration deposit.
|
||||
* (`ConfigDepositBase` + `FriendDepositFactor` * #_of_friends)
|
||||
* The dispatch origin for this call must be _Signed_ and must be a
|
||||
* recoverable account (i.e. has a recovery configuration).
|
||||
* # <weight>
|
||||
* Key: F (len of friends)
|
||||
* - One storage read to get the prefix iterator for active recoveries. O(1)
|
||||
* - One storage read/remove to get the recovery configuration. O(1), Codec O(F)
|
||||
* - One balance call to unreserved. O(X)
|
||||
* - One event.
|
||||
* Total Complexity: O(F + X)
|
||||
* # </weight>
|
||||
**/
|
||||
removeRecovery: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
|
||||
forceName: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, name: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
vesting: {
|
||||
[index: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
sudo: {
|
||||
|
||||
/**
|
||||
* Unlock any vested funds of the sender account.
|
||||
* The dispatch origin for this call must be _Signed_ and the sender must have funds still
|
||||
* locked under this module.
|
||||
* Emits either `VestingCompleted` or `VestingUpdated`.
|
||||
* # <weight>
|
||||
* - `O(1)`.
|
||||
* - One balance-lock operation.
|
||||
* - One storage read (codec `O(1)`) and up to one removal.
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
vest: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Unlock any vested funds of a `target` account.
|
||||
* Authenticates the sudo key and dispatches a function call with `Root` origin.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* - `target`: The account whose vested funds should be unlocked. Must have funds still
|
||||
* locked under this module.
|
||||
* Emits either `VestingCompleted` or `VestingUpdated`.
|
||||
* # <weight>
|
||||
* - `O(1)`.
|
||||
* - Up to one account lookup.
|
||||
* - One balance-lock operation.
|
||||
* - One storage read (codec `O(1)`) and up to one removal.
|
||||
* - One event.
|
||||
* - O(1).
|
||||
* - Limited storage reads.
|
||||
* - One DB write (event).
|
||||
* - Unknown weight of derivative `proposal` execution.
|
||||
* # </weight>
|
||||
**/
|
||||
vestOther: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
sudo: AugmentedSubmittable<(proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* # <weight>
|
||||
* - O(1).
|
||||
* - Limited storage reads.
|
||||
* - One DB change.
|
||||
* # </weight>
|
||||
**/
|
||||
setKey: AugmentedSubmittable<(updated: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Authenticates the sudo key and dispatches a function call with `Signed` origin from
|
||||
* a given account.
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
* # <weight>
|
||||
* - O(1).
|
||||
* - Limited storage reads.
|
||||
* - One DB write (event).
|
||||
* - Unknown weight of derivative `proposal` execution.
|
||||
* # </weight>
|
||||
**/
|
||||
sudoAs: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, proposal: Proposal | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
signaling: {
|
||||
|
||||
/**
|
||||
* Creates a new signaling proposal.
|
||||
**/
|
||||
createProposal: AugmentedSubmittable<(title: ProposalTitle | string | Uint8Array, contents: ProposalContents | string | Uint8Array, outcomes: Vec<VoteOutcome> | (VoteOutcome | string | Uint8Array)[], voteType: VoteType | ('Binary' | 'MultiOption' | 'RankedChoice') | number | Uint8Array, tallyType: TallyType | ('OnePerson' | 'OneCoin') | number | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Advance a signaling proposal into the "voting" or "commit" stage.
|
||||
* Can only be performed by the original author of the proposal.
|
||||
**/
|
||||
advanceProposal: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
voting: {
|
||||
|
||||
/**
|
||||
* A function for commit-reveal voting schemes that adds a vote commitment.
|
||||
* A vote commitment is formatted using the native hash function. There
|
||||
* are currently no cryptoeconomic punishments against not revealing the
|
||||
* commitment.
|
||||
**/
|
||||
commit: AugmentedSubmittable<(voteId: u64 | AnyNumber | Uint8Array, commit: VoteOutcome | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* A function that reveals a vote commitment or serves as the general vote function.
|
||||
* There are currently no cryptoeconomic incentives for revealing commited votes.
|
||||
**/
|
||||
reveal: AugmentedSubmittable<(voteId: u64 | AnyNumber | Uint8Array, vote: Vec<VoteOutcome> | (VoteOutcome | string | Uint8Array)[], secret: Option<VoteOutcome> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> {
|
||||
(extrinsic: Uint8Array | string): SubmittableExtrinsic<ApiType>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import '@polkadot/api/augment/rpc';
|
||||
import './augment-api-consts';
|
||||
import './augment-api-query';
|
||||
import './augment-api-tx';
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
// order here matches with what is found in (unused removed)
|
||||
// https://www.npmjs.com/package/edgeware-node-types
|
||||
// https://github.com/hicommonwealth/edgeware-node-types/tree/master/types
|
||||
|
||||
export { default as signaling } from './signaling/definitions';
|
||||
export { default as treasuryRewards } from './treasuryRewards/definitions';
|
||||
export { default as voting } from './voting/definitions';
|
||||
@@ -0,0 +1,17 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
|
||||
export default {
|
||||
types: {
|
||||
ProposalRecord: {
|
||||
index: 'u32',
|
||||
author: 'AccountId',
|
||||
stage: 'VoteStage',
|
||||
transition_time: 'u32',
|
||||
title: 'Text',
|
||||
contents: 'Text',
|
||||
vote_id: 'u64'
|
||||
},
|
||||
ProposalContents: 'Vec<u8>',
|
||||
ProposalTitle: 'Vec<u8>'
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
export * from './types';
|
||||
@@ -0,0 +1,24 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { Struct } from '@polkadot/types/codec';
|
||||
import { Bytes, Text, u32, u64 } from '@polkadot/types/primitive';
|
||||
import { AccountId } from '@polkadot/types/interfaces/runtime';
|
||||
import { VoteStage } from 'sample-polkadotjs-typegen/interfaces/voting';
|
||||
|
||||
/** @name ProposalContents */
|
||||
export interface ProposalContents extends Bytes {}
|
||||
|
||||
/** @name ProposalRecord */
|
||||
export interface ProposalRecord extends Struct {
|
||||
readonly index: u32;
|
||||
readonly author: AccountId;
|
||||
readonly stage: VoteStage;
|
||||
readonly transition_time: u32;
|
||||
readonly title: Text;
|
||||
readonly contents: Text;
|
||||
readonly vote_id: u64;
|
||||
}
|
||||
|
||||
/** @name ProposalTitle */
|
||||
export interface ProposalTitle extends Bytes {}
|
||||
@@ -0,0 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
|
||||
export default {
|
||||
types: {
|
||||
Balance2: 'u128'
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
export * from './types';
|
||||
@@ -0,0 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { u128 } from '@polkadot/types/primitive';
|
||||
|
||||
/** @name Balance2 */
|
||||
export interface Balance2 extends u128 {}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
export * from './signaling/types';
|
||||
export * from './treasuryRewards/types';
|
||||
export * from './voting/types';
|
||||
@@ -0,0 +1,33 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
|
||||
export default {
|
||||
types: {
|
||||
VoteStage: {
|
||||
_enum: ['PreVoting', 'Commit', 'Voting', 'Completed']
|
||||
},
|
||||
VoteType: {
|
||||
_enum: ['Binary', 'MultiOption', 'RankedChoice']
|
||||
},
|
||||
TallyType: {
|
||||
_enum: ['OnePerson', 'OneCoin']
|
||||
},
|
||||
VoteOutcome: '[u8; 32]',
|
||||
Tally: 'Option<Vec<(VoteOutcome, u128)>>',
|
||||
VoteData: {
|
||||
initiator: 'AccountId',
|
||||
stage: 'VoteStage',
|
||||
vote_type: 'VoteType',
|
||||
tally_type: 'TallyType',
|
||||
is_commit_reveal: 'bool'
|
||||
},
|
||||
Commitments: 'Vec<(AccountId, VoteOutcome)>',
|
||||
Reveals: 'Vec<(AccountId, Vec<VoteOutcome>)>',
|
||||
VoteRecord: {
|
||||
id: 'u64',
|
||||
commitments: 'Commitments',
|
||||
reveals: 'Reveals',
|
||||
data: 'VoteData',
|
||||
outcomes: 'Vec<VoteOutcome>'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
export * from './types';
|
||||
@@ -0,0 +1,58 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Option, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
|
||||
import { bool, u128, u64 } from '@polkadot/types/primitive';
|
||||
import { AccountId } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name Commitments */
|
||||
export interface Commitments extends Vec<ITuple<[AccountId, VoteOutcome]>> {}
|
||||
|
||||
/** @name Reveals */
|
||||
export interface Reveals extends Vec<ITuple<[AccountId, Vec<VoteOutcome>]>> {}
|
||||
|
||||
/** @name Tally */
|
||||
export interface Tally extends Option<Vec<ITuple<[VoteOutcome, u128]>>> {}
|
||||
|
||||
/** @name TallyType */
|
||||
export interface TallyType extends Enum {
|
||||
readonly isOnePerson: boolean;
|
||||
readonly isOneCoin: boolean;
|
||||
}
|
||||
|
||||
/** @name VoteData */
|
||||
export interface VoteData extends Struct {
|
||||
readonly initiator: AccountId;
|
||||
readonly stage: VoteStage;
|
||||
readonly vote_type: VoteType;
|
||||
readonly tally_type: TallyType;
|
||||
readonly is_commit_reveal: bool;
|
||||
}
|
||||
|
||||
/** @name VoteOutcome */
|
||||
export interface VoteOutcome extends U8aFixed {}
|
||||
|
||||
/** @name VoteRecord */
|
||||
export interface VoteRecord extends Struct {
|
||||
readonly id: u64;
|
||||
readonly commitments: Commitments;
|
||||
readonly reveals: Reveals;
|
||||
readonly data: VoteData;
|
||||
readonly outcomes: Vec<VoteOutcome>;
|
||||
}
|
||||
|
||||
/** @name VoteStage */
|
||||
export interface VoteStage extends Enum {
|
||||
readonly isPreVoting: boolean;
|
||||
readonly isCommit: boolean;
|
||||
readonly isVoting: boolean;
|
||||
readonly isCompleted: boolean;
|
||||
}
|
||||
|
||||
/** @name VoteType */
|
||||
export interface VoteType extends Enum {
|
||||
readonly isBinary: boolean;
|
||||
readonly isMultiOption: boolean;
|
||||
readonly isRankedChoice: boolean;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// this is specific with augmented overrides
|
||||
"paths": {
|
||||
// this is the package name we use (in the interface imports, --package for generators)
|
||||
"sample-polkadotjs-typegen/*": ["src/*"],
|
||||
// here we replace the @polkadot/api augmentation with our own, generated from chain
|
||||
"@polkadot/api/augment": ["src/interfaces/augment-api.ts"],
|
||||
// replace the augmented types with our own, as generated from definitions
|
||||
"@polkadot/types/augment": ["src/interfaces/augment-types.ts"]
|
||||
},
|
||||
// some other options, whatever you want for your environment
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"jsx": "preserve",
|
||||
"declaration": true,
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"noUnusedLocals": true,
|
||||
"noImplicitReturns": true,
|
||||
"moduleResolution": "node",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": ".",
|
||||
"skipLibCheck": true,
|
||||
"typeRoots": [
|
||||
"./node_modules/@types"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"build/**/*",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Required imports
|
||||
const { zip } = require('rxjs');
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { switchMap } = require('rxjs/operators');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API and operators from RxJs
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { pairwise, startWith } = require('rxjs/operators');
|
||||
@@ -25,12 +26,13 @@ async function main () {
|
||||
if (balance[0] === 'first') {
|
||||
// Now we know that if the previous value emitted as balance[0] is `first`,
|
||||
// then balance[1] is the initial value of Alice account.
|
||||
console.log(`Alice ${Alice} has a balance of ${balance[1][1].free}`);
|
||||
console.log(`Alice ${Alice} has a balance of ${balance[1].data.free}`);
|
||||
console.log('You may leave this example running and start the "Make a transfer" example or transfer any value to Alice address');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const change = balance[1][1].free.sub(balance[0][1].free);
|
||||
const change = balance[1].data.free.sub(balance[0].date.free);
|
||||
|
||||
// Only display value changes
|
||||
if (!change.isZero()) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { switchMap } = require('rxjs/operators');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { combineLatest, of } = require('rxjs');
|
||||
@@ -22,7 +23,7 @@ function main () {
|
||||
// In the next step, we're checking if the node has active validators.
|
||||
// If it does, we're making another call to the api to get the balances for all validators
|
||||
const balances = (validators && validators.length > 0)
|
||||
? combineLatest(validators.map(authorityId => api.query.system.account(authorityId).pipe(first())))
|
||||
? combineLatest(validators.map((authorityId) => api.query.system.account(authorityId).pipe(first())))
|
||||
: of(null);
|
||||
|
||||
// We're combining the results together with the emitted value 'validators',
|
||||
@@ -36,16 +37,16 @@ function main () {
|
||||
})
|
||||
)
|
||||
// Then we're subscribing to the emitted results
|
||||
.subscribe(([[accountNonce], blockPeriod, validators, validatorBalances]) => {
|
||||
console.log(`accountNonce(${Alice}) ${accountNonce}`);
|
||||
.subscribe(([{ nonce }, blockPeriod, validators, validatorBalances]) => {
|
||||
console.log(`accountNonce(${Alice}) ${nonce}`);
|
||||
console.log(`blockPeriod ${blockPeriod.toNumber()} seconds`);
|
||||
|
||||
if (validatorBalances) {
|
||||
// And lastly we print out the authorityIds and balances of all validators
|
||||
console.log('validators', validators.map((authorityId, index) => ({
|
||||
address: authorityId.toString(),
|
||||
balance: validatorBalances[index][1].free.toString(),
|
||||
nonce: validatorBalances[index][0].toString()
|
||||
balance: validatorBalances[index].data.free.toString(),
|
||||
nonce: validatorBalances[index].data.toString()
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API, Keyring and some utility functions
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
const { Keyring } = require('@polkadot/keyring');
|
||||
@@ -25,9 +27,14 @@ async function main () {
|
||||
.signAndSend(alice)
|
||||
// Subscribe to the status updates of the transfer
|
||||
.subscribe(({ status }) => {
|
||||
if (status.isFinalized) {
|
||||
console.log(`Successful transfer of 12345 from Alice to Bob with hash ${status.asFinalized.toHex()}`);
|
||||
if (status.isInBlock) {
|
||||
console.log(`Successful transfer of 12345 from Alice to Bob at block ${status.asInBlock.toHex()}`);
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
subscription.unsubscribe();
|
||||
|
||||
process.exit(0);
|
||||
} else {
|
||||
console.log(`Status of transfer: ${status.type}`);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API and selected RxJs operators
|
||||
const { switchMap } = require('rxjs/operators');
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API and some utility functions
|
||||
const { ApiRx } = require('@polkadot/api');
|
||||
|
||||
@@ -44,13 +45,17 @@ async function main () {
|
||||
console.log('Transfer status:', status.type);
|
||||
|
||||
// Log system events once the transfer is finalised
|
||||
if (status.isFinalized) {
|
||||
console.log('Completed at block hash', status.asFinalized.toHex());
|
||||
if (status.isInBlock) {
|
||||
console.log('Included at block hash', status.asInBlock.toHex());
|
||||
console.log('Events:');
|
||||
|
||||
events.forEach(({ phase, event: { data, method, section } }) => {
|
||||
events.forEach(({ event: { data, method, section }, phase }) => {
|
||||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
|
||||
});
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable header/header */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
|
||||
// Import the API & Provider and some utility functions
|
||||
const { ApiRx, WsProvider } = require('@polkadot/api');
|
||||
// Import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
|
||||
@@ -40,16 +41,16 @@ async function main () {
|
||||
// Log transfer events
|
||||
console.log('Proposal status:', status.type);
|
||||
|
||||
if (status.isFinalized) {
|
||||
if (status.isInBlock) {
|
||||
console.error('You have just upgraded your chain');
|
||||
|
||||
console.log('Completed at block hash', status.asFinalized.toHex());
|
||||
console.log('Included at block hash', status.asInBlock.toHex());
|
||||
console.log('Events:');
|
||||
|
||||
// Log system events once the chain update is finalised
|
||||
events.forEach(({ phase, event: { data, method, section } }) => {
|
||||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
|
||||
});
|
||||
console.log(JSON.stringify(events.toHuman(), null, 2));
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
**NOTE** Removed - in metadata v11 we get the extensions from the chain, we need to be able to specify these. These docs are now outdated.
|
||||
|
||||
# Extending extrinsics
|
||||
|
||||
On some chains, the need may arise to customize the extrinsic format. In this section we will explain what extrinsics and their payloads contain, explain how signed extensions work and provide a walk through of an advanced use-case where extrinsics are customized for a specific Substrate chain.
|
||||
@@ -153,6 +155,3 @@ In the above example, should these updates only be made on the node side, withou
|
||||
|
||||
(These extensions are not exposed via metadata at all, and would be quite difficult to do as well - since each of these have specific logic as well as data types assigned.)
|
||||
|
||||
## Using with TypeScript
|
||||
|
||||
The API is built with TypeScript (as are all projects in the [polkadot-js organization](https://github.com/polkadot-js/)) and as such allows developers using TS to have access to all the type interfaces defined on the chain, as well as having access to typings on interacting with the `api.*` namespaces. In the next section we will provide an overview of [what is available in terms of types and TypeScript](typescript.md).
|
||||
@@ -1,5 +0,0 @@
|
||||
... somewhere also need a signer injection section, something along the lines of the singlesigner or this https://github.com/polkadot-js/tools/blob/master/packages/signer-cli/src/cmdSubmit.ts#L12
|
||||
|
||||
... DoubleMap & LinkedMap examples
|
||||
|
||||
... api.derive
|
||||
+43
-3
@@ -12,6 +12,17 @@ If however you are running against a master branch of either Polkadot or Substra
|
||||
|
||||
Update your version of the API to the [latest version](install.md). Like types, the [metadata interfaces](basics.md) are continuously evolving. For instance with the Polkadot Alexander network, only metadata v3 is available. By the time Kusama launched, this has been bumped to v7. As these versions are added to the Polkadot/Substrate codebase, they are added to the API.
|
||||
|
||||
## The node returns a "Could not convert" error on send
|
||||
|
||||
The typical error that you would see is `Verification Error: Execution(ApiError("Could not convert parameter 'tx' between node and runtime`. This means that the transaction data serialized from the API cannot be deserialized on the node.
|
||||
|
||||
All data transferred between the API and the Node is in a SCALE-encoded binary format, so the [definition of the types](types.extend.md) between the API and the node needs to match 100%. When you find the above, it would mean the definition of the types on the API side does not match what is on the node. Specifically the API encodes against the definition, but since there is a mismatch the Node cannot parse the data correctly.
|
||||
|
||||
To fix this, you should look at the specific `api.tx.*` params and adjust the type definitions for those param types to match what is found on the node side. In some rare cases the cause could be extrinsic formatting related, to track these make an `api.tx.system.remark(data: Bytes)` call, if it fails, the API and node cannot agree on [an extrinsic format and adjustments are required](types.extend.md#impact-on-extrinsics).
|
||||
|
||||
If you are using a node-template based version of substrate and you changed the specName you need to add these typings(In addition to other custom types) `{"Address": "AccountId","LookupSource": "AccountId"}`. This is also the case when you use [polkadot-js/apps](https://github.com/polkadot-js/apps) to connect to your node. When the specName stays node-template the API is smart enough to add the custom typings.
|
||||
|
||||
|
||||
## I would like to sign transactions offline
|
||||
|
||||
The API itself is independent on where the signature comes from and how it is injected. Additionally it implements a signer interface, that can be used for external signing - an example of this is the [polkadot-js/apps](https://github.com/polkadot-js/apps) support for signing via extensions and even the [polkadot-js/extension](https://github.com/polkadot-js/extension) support for tools such as the [Parity Signer](https://github.com/paritytech/parity-signer).
|
||||
@@ -26,16 +37,45 @@ To submit these transactions, it needs to be send as a [wrapped transaction](api
|
||||
|
||||
## How do I call a function with a Tuple input
|
||||
|
||||
Tuples, as defined in the Polkadot/Substrate types appear as `(TypeA, TypeB)`. For instance we may have an `(AccountId, u64)` input as defined in the metadata or as part of the user types. To specify a Tuple as an input, wrap it is an array format, for instance to call `query.module.get((u32, u64))` where a `(u32, u64)` Tuple input is expected, you would do `query.module.get([123, 456])`
|
||||
Tuples, as defined in the Polkadot/Substrate types appear as `(TypeA, TypeB)`. For instance we may have an `(AccountId, u64)` input as defined in the metadata or as part of the user types. To specify a Tuple as an input, wrap it in an array format, for instance to call `query.module.get((u32, u64))` where a `(u32, u64)` Tuple input is expected, you would do `query.module.get([123, 456])`
|
||||
|
||||
## How long do transactions live
|
||||
|
||||
Polkadot/Substrate supports both immortal and mortal transactions. For immortal, this means that the transaction has an infinite lifetime, for mortals, the transactions expire after a defined period. By default the API sends mortal transactions when no explicit extrinsic era has been specified. This means that all transaction has a limited lifetime and will expire if not included in the period set.
|
||||
|
||||
The length for this transaction validity is set to 50 blocks, which translates to 5 minutes assuming a default of 6 second blocktimes. (10 blocks per minute in this default configuration).
|
||||
The length for this transaction validity is set to 5 minutes, calculated based on the blocktime for the chain. (10 blocks per minute in this default 6s Substrate configuration).
|
||||
|
||||
## My chain does not support system.account queries
|
||||
|
||||
The API always tracks the latest Substrate master in terms of examples. This means that nonce & balance queries are done via the `api.query.system.account(<account>)` which returns a Tuple `(Index, AccountData)` where the first is the nonce, the second a struct containing the free and reserved balances. As with all `api.query.*` endpoint, this is decorated based on what the chain you connect to support.
|
||||
The API always tracks the latest Substrate master in terms of examples. This means that nonce & balance queries are done via the `api.query.system.account(<account>)` which returns a struct `{ nonce: Index, data: AccountData }` where the `data` is struct containing the free and reserved balances. As with all `api.query.*` endpoints, this is decorated based on what the chain you connect to support, via the metadata exchange.
|
||||
|
||||
It is possible that you are connecting to an older chain that has not been upgraded yet. For these chains, this storage entry won't be available (yet). To query the nonce on older chains, you can do a query to `api.query.system.accountNonce(<account>)` and balances can be retrieved via `api.query.balances.freeBalance(<account>)`.
|
||||
|
||||
Likewise, if your chain has been upgraded recently and you are still using the old `system.accountNonce` or `balances.freeBalance` queries in your code (which is now not available in the chain metadata), you need to update it to query the new location.
|
||||
|
||||
## I cannot send transactions from my node-template-based chain
|
||||
|
||||
The API always injects the default type definitions as specified by the Substrate master fully-featured node. This means that any customizations to chains needs needs to be applied as types, should there be differences in specific user-implementations.
|
||||
|
||||
The Substrate node-template has added customizations for some types in the default template, specifically around the `Address` and `Lookup` types, removing any lookups based on indices. This means that the transaction payload saves 2 bytes for a transfer and is an approach followed by other chains as well, notably Polkadot & Kusama.
|
||||
|
||||
Due to these customizations and differences that bleed through to the transaction formats, out-of-the-box chains based on the node-template will have issues when sending transactions. To fix this, you would need to add [the customized Address types into your API](types.extend.md#impact-on-extrinsics) instances (or UIs), allowing the API to have the information required to adjust the encoding.
|
||||
|
||||
## Using a non-current-master node, I have issues parsing events
|
||||
|
||||
Recently Substrate master updated the `Weight` type from `u32` -> `u64`. This type is used in the `DispatchInfo` struct in the `system.ExtrinsicSuccess` events, to return the applied call weights as well as the resulting fees. Since the API master branch tracks Substrate master, this means the change has been applied by default, with the default set to `u64`.
|
||||
|
||||
If you are on a chain that has not been upgraded yet, you need to add `Weight: 'u32'` to your types to allow for successful parsing of all events. Without this override, parsing will fail. As soon as one event in the `Vec<EventRecord>` structure from `system.events` fails to parse, all subsequent events are affected and the decoding will return an error.
|
||||
|
||||
## When querying older blocks & events, it fails on parsing
|
||||
|
||||
Upon initialization, the API is decorated with the [current on-chain metadata](basics.md#metadata) and (if [available](https://github.com/polkadot-js/api/tree/master/packages/types-known/src)) the specific types for the runtime version is added. This allows the API to decode all current (as per the on-chain info) state and extrinsics.
|
||||
|
||||
When the chain is upgraded, new metadata (indicating new events, storage and extrinsics) is added on-chain. Additionally this generally goes hand in-hand with changes in types, i.e. fields may be addedd or removed or state that was used could now be migrated to new locations. In most cases, this would mean that the current chain information cannot be used to parse older entries pre-upgrade. A typical consequence of this is that any `.at(...)` or `.range(...)` queries pre-upgrade may fail.
|
||||
|
||||
As of the current time, there is no automatic injection of older metadata (based on the runtime version at a specific block) nor decoration of older types if they are available. It can be emulated with what the API will do to handle these cases when it adds a `.historic(...)` query type -
|
||||
|
||||
- querying the runtime version at the parent of older block you wish to retrieve
|
||||
- retrieving and injecting the metadata from the parent block (if the runtime version has changed)
|
||||
- inject any specific older types for the state at that point
|
||||
- finally retrieve the actual entry via an `.at(...)` query
|
||||
|
||||
@@ -17,7 +17,7 @@ const ADDR = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE';
|
||||
const now = await api.query.timestamp.now();
|
||||
|
||||
// Retrieve the account balance & nonce via the system module
|
||||
const [nonce, balance] = await api.query.system.account(ADDR);
|
||||
const { nonce, data: balance } = await api.query.system.account(ADDR);
|
||||
|
||||
console.log(`${now}: balance of ${balance.free} and a nonce of ${nonce}`);
|
||||
```
|
||||
@@ -27,7 +27,7 @@ There have been some additions in the code above comparing with retrieving runti
|
||||
```js
|
||||
...
|
||||
// Retrieve last block timestamp, account nonce & balances
|
||||
const [now, [nonce, balances]] = await Promise.all([
|
||||
const [now, { nonce, data: balances }] = await Promise.all([
|
||||
api.query.timestamp.now(),
|
||||
api.query.system.account(ADDR)
|
||||
]);
|
||||
|
||||
@@ -11,7 +11,7 @@ Where possible, the use of multi queries are encouraged since it tracks a number
|
||||
|
||||
// Subscribe to balance changes for 2 accounts, ADDR1 & ADDR2 (already defined)
|
||||
const unsub = await api.query.system.account.multi([ADDR1, ADDR2], (balances) => {
|
||||
const [[, balance1], [, balance2]] = balances;
|
||||
const [{ data: balance1 }, { data: balance2 }] = balances;
|
||||
|
||||
console.log(`The balances are ${balance1.free} and ${balance2.free}`);
|
||||
});
|
||||
@@ -23,7 +23,7 @@ A couple of items to note in the example above: we don't call `account` directly
|
||||
...
|
||||
|
||||
// Retrieve a snapshot of the validators
|
||||
const validators = await api.query.session.validators();
|
||||
const validatorKeys = await api.query.session.validators.keys();
|
||||
|
||||
// Subscribe to the balances for these accounts
|
||||
const unsub = await api.query.balances.account.multi(validators, (balances) => {
|
||||
@@ -44,7 +44,7 @@ The previous `.multi` examples assumes that we do queries for the same types, i.
|
||||
const unsub = await api.queryMulti([
|
||||
api.query.timestamp.now,
|
||||
[api.query.system.account, ADDR]
|
||||
], ([now, [nonce, balance]]) => {
|
||||
], ([now, { nonce, data: balance }]) => {
|
||||
console.log(`${now}: balance of ${balance.free} and a nonce of ${nonce}`);
|
||||
});
|
||||
```
|
||||
|
||||
@@ -13,7 +13,7 @@ Quite often is is useful (taking pruning into account, more on this later) to re
|
||||
const lastHdr = await api.rpc.chain.getHeader();
|
||||
|
||||
// Retrieve the balance at both the current and the parent hashes
|
||||
const [[, balanceNow], [, balancePrev]] = await Promise.all([
|
||||
const [{ data: balanceNow }, { data: balancePrev }] = await Promise.all([
|
||||
api.query.system.account.at(lastHdr.hash, ADDR),
|
||||
api.query.system.account.at(lastHdr.parentHash, ADDR)
|
||||
]);
|
||||
@@ -22,7 +22,7 @@ const [[, balanceNow], [, balancePrev]] = await Promise.all([
|
||||
console.log(`The delta was ${balanceNow.free.sub(balancePrev.free)}`);
|
||||
```
|
||||
|
||||
In the above example, we introduce the `.at(<hash>[, ...params])` query. For all `.at` queries, the first parameter is always the block hash at which we want to make the query, in our example we use both the last retrieved block and the parent thereof. The params are optional as per the type of query made, for instance to retrieve the timestamp for a previous block, it would be -
|
||||
In the above example, we introduce the `.at(<hash>[, ...params]): Type` query. For all `.at` queries, the first parameter is always the block hash at which we want to make the query, in our example we use both the last retrieved block and the parent thereof. The params are optional as per the type of query made, for instance to retrieve the timestamp for a previous block, it would be -
|
||||
|
||||
```js
|
||||
...
|
||||
@@ -35,6 +35,61 @@ The `.at` queries are all single-shot, i.e. there are no subscription option to
|
||||
|
||||
An additional point to take care of (briefly mentioned above), is state pruning. By default a Polkadot/Substrate node will only keep state for the last 256 blocks, unless it is explicitly run in archive mode. This means that querying state further back than the pruning period will result in an error returned from the Node. (Generally most public RPC nodes only run with default settings, which includes aggressive state pruning)
|
||||
|
||||
## State for a range of blocks
|
||||
|
||||
In addition to the `.at` queries, you can also query state starting at a specific historic block and up to either a specified or the latest blocks. This is done via the `.range([from, to?], <...opt params>): [Hash, Type][]` query. As an example -
|
||||
|
||||
```js
|
||||
...
|
||||
// Retrieve the current block header
|
||||
const lastHdr = await api.rpc.chain.getHeader();
|
||||
const startHdr = await api.rpc.chain.getBlockHash(lastHdr.number.unwrap().subn(500));
|
||||
|
||||
// retrieve the range of changes
|
||||
const changes = await api.query.system.account.range([startHdr]);
|
||||
|
||||
changes.forEach(([hash, value]) => {
|
||||
console.log(hash.toHex(), value.toHuman());
|
||||
});
|
||||
```
|
||||
|
||||
## Map keys & entries
|
||||
|
||||
When working maps and double-maps, it is possible to retrieve a list of all the keys and entries for the map. For this we can use the `.entries(<args>): [StorageKey, Type][]` queries. For example we may want to know the current list of validator exposures at a current era in the staking module -
|
||||
|
||||
```js
|
||||
...
|
||||
// Retrieve the active era
|
||||
const activeEra = await api.query.staking.activeEra();
|
||||
|
||||
// retrieve all exposures for the active era
|
||||
const exposures = await api.query.staking.erasStakers.entries(activeEra.index);
|
||||
|
||||
exposures.forEach(([key, exposure]) => {
|
||||
console.log('key arguments:', key.args.map((k) => k.toHuman()));
|
||||
console.log(' exposure:', exposure.toHuman());
|
||||
});
|
||||
```
|
||||
|
||||
To understand the usage of the `key.args`, you need to understand that map/doublemap keys are stored alongside their lookups. This means that the raw key has hashed parts as well as the raw data. The API will decode the keys and provide the raw key arguments in args. This would mean -
|
||||
|
||||
- if we are querying `api.query.staking.validators(validatorId: AccountId)` via `entries`, the `key.args` would be `[AccountId]`
|
||||
- if we are querying `api.query.staking.erasStakers(era: EraIndex, validatorId: AccountId)` via `entries`, the `key.args` would be `[EraIndex, AccountId]`
|
||||
|
||||
the same applies to `.keys()` - here the list of keys also have the decoded args, as specified. You can think of `.args` as a tuple with the same types as the types required to retrieve a single entry in the map.
|
||||
|
||||
In the first example we are querying a double-map, so we supply 1 argument. No arguments on double-maps will be very costly, retrieving all the eras and associated entries. In the same way as above we can simply do `.keys(activeEra.index): StorageKey[]` to retrieve all the keys here, including the individual keys args (available on maps with decodable hashing functions) -
|
||||
|
||||
```js
|
||||
// retrieve all the nominator keys
|
||||
const keys = await api.query.staking.nominators.keys();
|
||||
|
||||
// extract the first key argument [AccountId] as string
|
||||
const nominatorIds = keys.map(({ args: [nominatorId] }) => nominatorId);
|
||||
|
||||
console.log('all nominators:', nominatorIds.join(', '));
|
||||
```
|
||||
|
||||
## State entries
|
||||
|
||||
In addition to using `api.query` to make actual on-chain queries, it can also be used to retrieve some information on the state entries. For instance to retrieve both the hash and size of an existing entry, we can make the following calls -
|
||||
|
||||
@@ -25,8 +25,8 @@ If we had a query with parameters, i.e. where we wish to perform a query for a s
|
||||
...
|
||||
|
||||
// Subscribe to balance changes for our account
|
||||
const unsub = await api.query.system.account(ADDR, ([nonce, balance]) => {
|
||||
console.log(`free balance is ${balance.freee} with ${balance.reserved} reserved and a nonce of ${nonce}`);
|
||||
const unsub = await api.query.system.account(ADDR, ({ nonce, data: balance }) => {
|
||||
console.log(`free balance is ${balance.free} with ${balance.reserved} reserved and a nonce of ${nonce}`);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ The result for this call (we will deal with subscriptions in a short while), is
|
||||
|
||||
Despite the single-line format of `signAndSend`, there is a lot happening under the hood (and all of this can be manually provided) -
|
||||
|
||||
- Based on the sender, the API will retrieve the `system.accountNonce` to determine the next nonce to use
|
||||
- Based on the sender, the API will query `system.account` (or `system.accountNonce` on older chains) to determine the next nonce to use
|
||||
- The API will retrieve the current block hash and use it to create a mortal transaction, i.e. the transaction will only be valid for a limited number of blocks (by default this is 5 mins at 6s block times)
|
||||
- It will construct a payload and sign this, this includes the `genesisHash`, the `blockHash` for the start of the mortal era as well as the current chain `specVersion`
|
||||
- The transaction is submitted to the node
|
||||
|
||||
@@ -18,8 +18,10 @@ const unsub = await api.tx.balances
|
||||
.signAndSend(alice, (result) => {
|
||||
console.log(`Current status is ${result.status}`);
|
||||
|
||||
if (result.status.isFinalized) {
|
||||
console.log(`Transaction included at blockHash ${result.status.asFinalized}`);
|
||||
if (result.status.isInBlock) {
|
||||
console.log(`Transaction included at blockHash ${result.status.asInBlock}`);
|
||||
} else if (result.status.isFinalized) {
|
||||
console.log(`Transaction finalized at blockHash ${result.status.asFinalized}`);
|
||||
unsub();
|
||||
}
|
||||
});
|
||||
@@ -27,7 +29,7 @@ const unsub = await api.tx.balances
|
||||
|
||||
As per all previous subscriptions, the transaction subscription returns in `unsub()` and the actual method has a subscription callback. The `result` object has 2 parts, `events` (to to covered in the next section) and the `status` enum.
|
||||
|
||||
When the `status` enum is in `Finalized` state (checked via `isFinalized`), the underlying value contains the block hash of the block where the transaction has been included. This does not mean the block is finalized, but rather applies to the transaction state, as no further updates will be received for this subscription.
|
||||
When the `status` enum is in `Finalized` state (checked via `isFinalized`), the underlying value contains the block hash of the block where the transaction has been finalized. `Finalized` will follow `InBlock`, which is the block where the transaction has been included. `InBlock` does not mean the block is finalized, but rather applies to the transaction state, where `Finalized` means that the transaction cannot be forked off the chain.
|
||||
|
||||
## Transaction events
|
||||
|
||||
@@ -60,6 +62,23 @@ const unsub = await api.tx.balances
|
||||
|
||||
Be aware that when a transaction status is `isFinalized`, it means it is included, but it may still have failed - for instance if you try to send a larger amount that you have free, the transaction is included in a block, however from a end-user perspective the transaction failed since the transfer did not occur. In these cases a `system.ExtrinsicFailed` event will be available in the events array.
|
||||
|
||||
## Payment information
|
||||
|
||||
The Polkadot/Substrate RPC endpoints exposes weight/payment information that takes an encoded extrinsic and calculates the on-chain weight fees for it. A wrapper for this is available on the tx itself, taking exactly the same parameters as you would pass to a normal `.signAndSend` operation, specifically `.paymentInfo(sender, <any options>)`. To expand on our previous example -
|
||||
|
||||
```js
|
||||
// construct a transaction
|
||||
const transfer = api.tx.balances.transfer(BOB, 12345);
|
||||
|
||||
// retrieve the payment info
|
||||
const { partialFee, weight } = await transfer.paymentInfo(alice);
|
||||
|
||||
console.log(`transaction will have a weight of ${weight}, with ${partialFee.toHuman()} weight fees`);
|
||||
|
||||
// send the tx
|
||||
transfer.signAndSend(alice, ({ events = [], status }) => { ... });
|
||||
```
|
||||
|
||||
## Complex transactions
|
||||
|
||||
In many cases transactions can carry quite complex information, be it for passing objects or proposing changes. In the next section we will take a dive [into complex transactions, including those wrapped for sudo](api.tx.wrap.md).
|
||||
|
||||
@@ -6,7 +6,7 @@ To unpack this, we will start with the Metadata and explain what it actually pro
|
||||
|
||||
## Metadata
|
||||
|
||||
When the API connects to a node, one of the first things it does is to retrieve the metadata. The metadata, effectively provides data in the form of `api.<type>.<module>.<section>` that fits into one of the following categories -
|
||||
When the API connects to a node, one of the first things it does is to retrieve the metadata and decorate the API based on the metadata information. The metadata effectively provides data in the form of `api.<type>.<module>.<section>` that fits into one of the following categories -
|
||||
|
||||
- [consts](../substrate/constants.md) - All runtime constants, e.g. `api.consts.balances.existentialDeposit`. These are not functions, rather accessing the endpoint immediately yields the result as defined.
|
||||
- [query](../substrate/storage.md) - All chain state, e.g. `api.query.system.account(<accountId>)`.
|
||||
@@ -14,6 +14,8 @@ When the API connects to a node, one of the first things it does is to retrieve
|
||||
|
||||
Additionally the metadata also provides information on [events](../substrate/events.md), these are query-able via the `api.query.system.events()` interface and also appear on transactions... both these cases are detailed later.
|
||||
|
||||
None of the information contained within the `api.{consts, query, tx}.<module>.<method>` endpoints are hard coded in the API. Rather everything is fully decorated by what the metadata exposes and is therefore completely dynamic. This means that when you connect to different chains, the metadata and API decoration will change and the API interfaces will reflect what is available on the chain you are connected to.
|
||||
|
||||
## Types
|
||||
|
||||
The metadata defines the calls with all the type names used in the various interfaces. At the moment (this is undergoing investigations and could improve in future versions of metadata), this also means that the types between the API and the node need to be aligned. For instance, by default Substrate defines a `BlockNumber` type as a `u32` and the API follows the Substrate defaults - if a chain has a different definitions, the API needs to be aware of this so it can actually decode (and encode) the type.
|
||||
|
||||
@@ -68,6 +68,12 @@ await api.isReady;
|
||||
console.log(api.genesisHash.toHex());
|
||||
```
|
||||
|
||||
## Failures
|
||||
|
||||
In all cases the API will handle reconnections automatically. This means that when you connect and the endpoint is not (yet) ready, the promise will not resolve immediately, but rather when connected. The same applies to when connection is lost, the API will manage re-connections.
|
||||
|
||||
In cases where the API does not support the chain being connected to, such as it using an unknown metadata version, the ready promise will fail to resolve and instead reject.
|
||||
|
||||
## Advanced creation
|
||||
|
||||
There are more advanced cases where you would prefer to use the longer version, for instance: if you want to explicitly listen to events emitted, you probably want to attach to the API even before connecting to the chain. All API instances implement an `EventEmitter` interface, with `on` handlers, which emit `connected`, `disconnected`, `ready` and `error` events, allowing you to listen to events on the transport layer.
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# Custom RPC
|
||||
|
||||
In previous sections we looked at the injection of types, as in use and defined in modules from the node. Another area that can be customized is RPC definitions, and like with the types, the API provides the capability to add user-defined RPCs (in addition to the Polkadot/Substrate base) to allow use of these RPCs via the API.
|
||||
|
||||
## Custom definitions
|
||||
|
||||
RPCs are exposed as a method on a specific module, this means that once available you can call any rpc via the `api.rpc.<module>.<method>(...params[])` endpoints. To extend with user-defined RPCs, the injection can happen at the time of API creation with the addition of the `rpc` key (in addition to any other params, such as `types` or `provider`) -
|
||||
|
||||
```js
|
||||
...
|
||||
const api = await ApiPromise.create({
|
||||
rpc: {
|
||||
firstModule: {
|
||||
testMethod: {
|
||||
description: 'Just a test method',
|
||||
params: [
|
||||
{
|
||||
name: 'index',
|
||||
type: 'u64'
|
||||
},
|
||||
{
|
||||
name: 'at',
|
||||
type: 'Hash',
|
||||
isOptional: true
|
||||
}
|
||||
],
|
||||
type: 'Balance'
|
||||
},
|
||||
anotherMethod: { ... },
|
||||
...
|
||||
},
|
||||
anotherModule: { ... },
|
||||
...
|
||||
},
|
||||
...
|
||||
});
|
||||
```
|
||||
|
||||
In the above example we have defined a new method, which is now available on the RPCs as `api.rpc.firstModule.testMethod(index: u64, at?: Hash) => Promise<Balance>`. In the case of optional params, we have added the `isOptional: true` flag alongside the `name` & `type` in the param definition.
|
||||
|
||||
Be aware that while defined, the method will only appear on the API if it is in the list as returned by `api.rpc.rpc.methods()`, which is the list of known RPCs the node exposes. When making changes to the node, always ensure that it does expose the RPC method correctly, otherwise it will not be decorated.
|
||||
|
||||
## Definition breakdown
|
||||
|
||||
While the above example should be self-explanatory, it is important to understand teh structure. The `rpc: { ... }` definitions are keyed first and foremost by the name of the module exposing the RPC. This means that when we have 2 modules `firstModule` & `testModule`, the first-level structure would follow the following pattern,
|
||||
|
||||
```js
|
||||
...
|
||||
const api = await ApiPromise.create({
|
||||
rpc: {
|
||||
firstModule: { ... },
|
||||
testModule: { ... }
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Inside the specific module definitions, the key is the actual expose RPC method. As we have seen in the first example, we expose a `testMethod` on `firstModule`. For the method definitions, apart from the description, we have definitions for the params and return a single result `type`.
|
||||
|
||||
Params itself, as an array, contains fields for `name`, `type` and an optional flag `isOptional` that indicates that the field is not required when making the call. (And example of this use would be in cases such as `state.getStorage(key, blockHash?)` where the last param is optional)
|
||||
|
||||
## Type creation
|
||||
|
||||
While the API always converts all the inputs into the underlying type required by the operation, be it for RPC, query or transaction, in some cases you may want to [create an instance of a type](types.create.md) yourself.
|
||||
@@ -27,7 +27,7 @@ For example:
|
||||
|
||||
```js
|
||||
const { metadata } = await api.rpc.state.getMetadata();
|
||||
const modules = metadata.asV3.modules;
|
||||
const modules = metadata.asLatest.modules;
|
||||
|
||||
// This will not work, because `name` is an instance of `Text`, not a string
|
||||
// const system = modules.find(m => m.name === 'system');
|
||||
@@ -57,7 +57,7 @@ Be aware that in the JS version naming defaults to `camelCase` where names of fi
|
||||
|
||||
Each enum has additional getters which are injected based on the fields wrapped. These take the form of `.is<Name>` and `.as<Name>` to allow you to check is the enum is a certain value or to retrieve the underlying value as a specific type.
|
||||
|
||||
As a real-world example, when an extrinsic is applied, the `Phase` enum has one of two states, `ApplyExtrinsic(u32)` or `Finalization`. In this case `.isApplyExtrinsic` would be `true` when an extrinsic is being applied, and `.asApplyExtrinsic` would return the value as a `u32` (which is the index of the extrinsic in the block, as it is being applied). When `isisApplyExtrinsic` is `false` and `asApplyExtrinsic` is called, the getter will throw.
|
||||
As a real-world example, when an extrinsic is applied, the `Phase` enum has one of two states, `ApplyExtrinsic(u32)` or `Finalization`. In this case `.isApplyExtrinsic` would be `true` when an extrinsic is being applied, and `.asApplyExtrinsic` would return the value as a `u32` (which is the index of the extrinsic in the block, as it is being applied). When `isApplyExtrinsic` is `false` and `asApplyExtrinsic` is called, the getter will throw.
|
||||
|
||||
## Working with Option<Type>
|
||||
|
||||
@@ -67,6 +67,7 @@ An `Option<Type>` attempts to mimic the Rust approach of having `None` and `Some
|
||||
- `.isSome` - this is `true` is a value is wrapped, i.e. if a `Option<u32>` has an actual underlying `u32`
|
||||
- `.unwrap()` - when `isSome`, this will return the wrapped value, i.e. for `Option<u32>`, this would return the `u32`. When the value is `isNone`, this call will throw an exception.
|
||||
- `.unwrapOr(<default value>)` - this extends `unwrap()`, returning the wrapped value when `isSome` and in the case of `isNone` it will return the `<default value>` passed.
|
||||
- `.unwrapOrDefault()` - returns either the rapped value when `isSome`, or the default for the type when `isNone`
|
||||
|
||||
## Working with Tuples
|
||||
|
||||
@@ -79,6 +80,8 @@ const [count, accountId] = tuple;
|
||||
console.log(`${accountId} has ${count.toNumber()} values`);
|
||||
```
|
||||
|
||||
When making a call that expect a `Tuple` input, pass it as an array, so to pass the example above into a call, it would be `.call([123, '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'])`
|
||||
|
||||
## Extending types
|
||||
|
||||
For customized chains, the need exists to register types so the API is aware of how to decode values for those types. The next section will provide a [walk-through for the definition of custom types](types.extend.md) allowing the definition or re-definition of any type the API is aware of.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
# Type creation
|
||||
|
||||
Circling back to metadata. There are two important things to remember when using the API to make queries or send transactions.
|
||||
|
||||
1. The functionality available, e.g. exposed on `api.query.*` is not hard-coded in the API, rather this is decorated from the chain metadata. So the metadata lets the API know which endpoints are available and what the type for those endpoints are.
|
||||
|
||||
2. When you supply a value to the API, internally it will convert that value to the correct type as expected by the chain, i.e. as determined by the metadata. This means that a function such as `balances.transfer(address: Address, value: Balance)` can take at least the following inputs, which are all converted to the correct types -
|
||||
|
||||
- `address` can be an `Address`, an `AccountId`, an `Uint8Array` publicKey, a hex publicKey or an ss58 formatted address;
|
||||
- `value` can be a `Balance`, a value encoded in hex, a `BN` object, a base-10 string, a JS `number`, a JS `BigInt` or even a SCALE-encoded `Uint8Array`
|
||||
|
||||
In cases where a value is returned such as storage queries, the response from the chain is always encoded into the correct `Codec` type. This means that while the node may return an encoded block (with encoded extrinsics) via `api.rpc.chain.getBlock()`, this is decoded into a proper `SignedBlock` by the API. Outputting this value via `.toJSON()` will yield an encoding for RPC, so if you are not using TypeScript (which adds code helpers on decoded objects), a representation via `.toHuman()` will be more representative of the actual object fields, re-formatted for human consumption.
|
||||
|
||||
## Why create types
|
||||
|
||||
With the conversions done in the API, there are limited reasons to create types "manually". However, just because there are not thousands of reasons, does not mean it is not valid. For instance, you may retrieve an `Option` and for the sake of sanity would like to use `.unwrapOr()` on it, returning a `Codec` default value where the value `.isNone`.
|
||||
|
||||
```js
|
||||
// type import for TypeScript
|
||||
import type { Balance } from '@polkadot/types/interfaces';
|
||||
|
||||
...
|
||||
// unwrap out option into a zero Balance whn not found
|
||||
// (This can be done via `.unwrapOrDefault()`, which does the same underlying)
|
||||
const balance: Balance = balanceOpt.unwrapOr(api.createType('Balance'));
|
||||
```
|
||||
|
||||
In the example above, we introduced the `api.createType(<typeName>, [<value>])`. The same format is also exposed by the `TypeRegistry` (more on this in a short while) as well as `createType(...)` from the actual `@polkadot/types` package. All doing exactly the same.
|
||||
|
||||
## Choosing how to create
|
||||
|
||||
In most cases, you would always want to use the `api.createType` helper. What this does is call the underlying `@polkadot/types` `createType`, passing through the registry that is attached to the API. Registry? Yes, registry.
|
||||
|
||||
The registry contains a listing of all internal types and their classes that have been registered. So upon creation of an API instance, a `registry` object is attached to the API and this is passed through to all created types. This allows the type definitions to not pollute the global namespace, but rather be contained and able to reference one another.
|
||||
|
||||
As mentioned, the `createType` functions all do exactly the same, and it 99.99% of the cases you would be recommended to just forget about everything and use `api.createType` if and when required. In some cases, you may just have a type object and from that want to create another type instance. For that you can access the `registry` on the type object and call `createType` on it. (If this type object was created from an API instance, the registry on the type and on the API will point to the same instance.)
|
||||
|
||||
Basically, this means that we have equivalency in creation for all the items below, all creating on the same registry (containing all injected types), and all wrapping the same value -
|
||||
|
||||
```js
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
// via API (recommended)
|
||||
api.createType('Balance', 123);
|
||||
|
||||
// via registry (`.registry` is on all API and Codec objects)
|
||||
api.registry.createType('Balance', 123n);
|
||||
|
||||
// via the low-level approach (not recommended)
|
||||
createType(api.registry, 'Balance', '123');
|
||||
```
|
||||
|
||||
## Using with TypeScript
|
||||
|
||||
The API is built with TypeScript (as are all projects in the [polkadot-js organization](https://github.com/polkadot-js/)) and as such allows developers using TS to have access to all the type interfaces defined on the chain, as well as having access to typings on interacting with the `api.*` namespaces. In the next section we will provide an overview of [what is available in terms of types and TypeScript](typescript.md).
|
||||
|
||||
@@ -10,7 +10,7 @@ There is a the [recommendation](install.md#betas) to use a `@polkadot/api@beta`
|
||||
|
||||
## Extension
|
||||
|
||||
As a blockchain toolkit, Substrate makes it easy to add your own modules and types. In most non-trivial implementations, this would mean that developers are adding specific types for their implementation as well. The API will get to know the names of these types via the metadata, however it won't understand what they are, which means it cannot encode or decode them.
|
||||
As a blockchain toolkit, Substrate makes it easy to add your own modules and types. In most non-trivial implementations, this would mean that developers are adding specific types for their implementation as well. The API will get to know the names of these types via the metadata, however it won't understand what they are, which means it cannot encode or decode them. Additionally, when a type is mismatched between the node and the API, the decoding can fail, yielding issues such as [Could not convert errors](FAQ.md#the-node-returns-a-could-not-convert-error-on-send) when submitting transactions.
|
||||
|
||||
To close this gap, the API allows for the injection of types, i.e. you can explicitly define (or override) types for the node/chain you are connecting to. In the simplest example, assuming you have a chain where your `Balance` type is a `u64` (as opposed to the default `u128`), you need to let the API know -
|
||||
|
||||
@@ -26,7 +26,16 @@ const api = await ApiPromise.create({
|
||||
|
||||
The above introduces the `types` registry, effectively allowing overrides and the definition of new types. The override above would mean that immediately the API will treat all occurrences of `Balance` not as the default, but rather as the defined size.
|
||||
|
||||
## User-defined types
|
||||
## Field ordering
|
||||
|
||||
When defining any custom structures or types, it is critical that the following rules are applied -
|
||||
|
||||
- Map exactly to what is defined in the Rust code, i.e. defining a `SaleType` cannot be `u16` on the one end and `u32` on the other end. If mismatches occur, the serialization will fail.
|
||||
- Ensure that the field order is maintained in all definitions. The SCALE serialization is binary and contains no field names in the serialization, only the encoded values. Any decoding is therefore done based on the size of the type and the order thereof in the definitions.
|
||||
|
||||
These rules apply everywhere. Always ensure that the types match exactly between the environments and that the ordering is maintained, be it for structs, tuples or enums.
|
||||
|
||||
## User-defined structs
|
||||
|
||||
Registration also applies to any type that can be found on a specific chain, i.e. we can add any types that is available on a specific node -
|
||||
|
||||
@@ -54,6 +63,30 @@ const api = await ApiPromise.create({
|
||||
|
||||
The example above defines non-primitive types (as found in the specific implementation) as structures. Additionally it also shows the user-defined types can depend on other user-defined types with `Transaction` referencing both `TransactionInput` and `TransactionOutput`. Here you can reference any known types, i.e. in the above we have referenced primitives such as `u32` and `Signature` (itself an alias for `H512`).
|
||||
|
||||
## Definition clashes
|
||||
|
||||
As explained in a previous section, the underlying API Codec types have a [number of built-in properties](type.basics.md) and in some cases it could be that your struct has a field that conflicts. These should be minimal, however it can happen. Take the following example where a defined `hash` property clashes with the same-name Codec property -
|
||||
|
||||
```js
|
||||
Document: {
|
||||
name: 'Text',
|
||||
uri: 'Text',
|
||||
hash: 'Text'
|
||||
}
|
||||
```
|
||||
|
||||
For this struct the `hash` will not be exposed, but rather be kept as the built-in `hash`. At this point it is important to know that the values "over-the-wire" for calls, queries, events and consts is in binary form, i.e. it is an encoding of the values only. So on the JS side you can apply a rename with no ill-effects. Here we rename the `hash` to `docHash`, which mean the value will be available on `<instance>.docHash`.
|
||||
|
||||
```js
|
||||
Document: {
|
||||
name: 'Text',
|
||||
uri: 'Text',
|
||||
docHash: 'Text'
|
||||
}
|
||||
```
|
||||
|
||||
## User-defined enum
|
||||
|
||||
One form of types that appear regularly is enums, these can be defined as follow -
|
||||
|
||||
```js
|
||||
@@ -109,7 +142,7 @@ In the same way `typesChain` can be used to match on the actual chain name, i.e.
|
||||
const api = await ApiPromise.create({
|
||||
...,
|
||||
typesChain: {
|
||||
'Kusama CC1': {
|
||||
Kusama: {
|
||||
BlockNumber: 'u32',
|
||||
Index: 'u32'
|
||||
}
|
||||
@@ -137,6 +170,46 @@ const api = await ApiPromise.create({
|
||||
|
||||
`Balance` would be defined as an `u128` at the end. Effectively based on the flow it is first registered as a `u32`, then overridden as a `u64` and finally overridden once more as a `u128` by the chain types.
|
||||
|
||||
## Extending extrinsics
|
||||
## Impact on extrinsics
|
||||
|
||||
On customized chains, it is possible to [extend the format of the extrinsics and extrinsic payload as customized on the chain](extrinsic.extend.md), next up we will look at this advanced use-case.
|
||||
When configuring your chain, be cognizant of the types you are using, and always ensure that any changes are replicated back to the API. In an earlier example we configured `Balance` as `u64`, in this case the same changes needs to be applied on the API, especially when there are mismatches compared to Substrate master. Not doing so means that failures will occur. The same would happen when your own types have mismatched fields or types are lacking fields on structs or enums.
|
||||
|
||||
Mismatches also applies to any other chain-specific configured types and can have impacts on transactions. For instance you can customize `Lookup` and `Address` on your chain, changing the default lookup behavior. A real example of this is the Substrate master node vs the Substrate master node-template -
|
||||
|
||||
```rust
|
||||
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
|
||||
type Lookup = Indices;
|
||||
...
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = <Indices as StaticLookup>::Source;
|
||||
```
|
||||
|
||||
And this is what is defined on the node-template -
|
||||
|
||||
```rust
|
||||
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
|
||||
type Lookup = IdentityLookup<AccountId>;
|
||||
...
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = AccountId;
|
||||
```
|
||||
|
||||
Here the template was customized from the Substrate node defaults and the API needs to know how to map these types. Failure to make adjustments means transactions will fail. With this in mind the correct types that needs to be added here would be -
|
||||
|
||||
```js
|
||||
const api = await ApiPromise.create({
|
||||
...,
|
||||
types: {
|
||||
// mapping the actual specified address format
|
||||
Address: 'AccountId',
|
||||
// mapping the lookup
|
||||
LookupSource: 'AccountId'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Always look at customization and understand the impacts, replicating these changes between the node and the API. For the above the `Address` type is used in the construction of the `UncheckedExtrinsic` type, while the lookup type is applicable on transactions such as `balances.transfer(to: LookupSource, value: Balance)`
|
||||
|
||||
## Custom RPC
|
||||
|
||||
In addition to customizing modules and types on your node, you can also add custom RPC definitions. Like the type definitions in ths section, [these can be defined and passed to the API](rpc.custom.md) for decoration.
|
||||
|
||||
@@ -23,27 +23,22 @@ In the subscription example, we explicitly define `lastHead: Header`, although t
|
||||
|
||||
As indicated, most of the Polkadot/Substrate default types are available via `types/interfaces`. However, for primitives types where there is an actual implementation, these are made available via `@polkadot/types` directly. For instance, `import { u32 } from '@polkadot/types` is valid in this context.
|
||||
|
||||
## Metadata injected
|
||||
## Storage generics
|
||||
|
||||
For any interface injected by metadata, the types are not available by default (although it may be in the future for default interfaces), but rather what the API understands is that all results need to comply to the `Codec` interface. (The base of all our types)
|
||||
For any interface injected by metadata, the types are not fully described but rather names and the API will decode all these into an instance that complies with the `Codec` interface. (The base of all our types)
|
||||
|
||||
However, to make this sane from a developer perspective the injected methods are generic, effectively making the following possible -
|
||||
However, this does allow you to perform overrides via generics, making the following possible -
|
||||
|
||||
```js
|
||||
import { AccountData, Index } from '@polkadot/types/interfaces';
|
||||
import { Balance } from '@polkadot/types/interfaces';
|
||||
|
||||
type Balance2 = Balance;
|
||||
|
||||
...
|
||||
const [nonce, balance] = await api.query.system.account<[Index, AccountData]>(ADDR);
|
||||
const total = await api.query.balances.totalIssuance<Balance2>();
|
||||
```
|
||||
|
||||
In both these case we can instruct the TypeScript compiler that the type we are expecting in `Index` and `Balance` respectively, not just pure `Codec`. This means that functions like `.toNumber()` is available on both these types - as opposed to just the [general type defaults](types.basics.md#everything-is-a-type) with `.toHex()` and friends.
|
||||
|
||||
## Future work
|
||||
|
||||
As of this writing, there are still some gray areas to type detection, specifically around the following interfaces -
|
||||
|
||||
- `.at` & `.multi` on `api.query` does not (yet) have a `<TypeOverride>` interface. This means `as <TypeOverride>` casts are presently needed for these results
|
||||
- `api.queryMulti` does not (yet) allow you to provide a hint to the types returned, this ties to the previous point
|
||||
In this example (although the query does indeed return a `Balance`) we can instruct the TypeScript compiler that we are expecting a `Balance2`, not just the interface as generated. This means that functions like `.toNumber()` is available on both these types - as opposed to just the [general type defaults](types.basics.md#everything-is-a-type) with `.toHex()` and friends.
|
||||
|
||||
## Adding user types
|
||||
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
# TypeScript user generated
|
||||
|
||||
In the previous section we looked at the TypeScript definitions that are available and is generated from both the chain and definitions. Here we will expand upon the use of the infrastructure created to define types as part of the `@polkadot/types` library and see how to use them to generate your onw defintions and chain types.
|
||||
In the previous section we looked at the TypeScript definitions that are available and is generated from both the chain and definitions. Here we will expand upon the use of the infrastructure created to define types as part of the `@polkadot/types` library and see how to use them to generate your own definitions and chain types.
|
||||
|
||||
## Definitions
|
||||
|
||||
A large part of the type definitions are defined not as classes, but rather as structures from which type definitions are extracted and that can be used as-is to let the API know how to decode a type. By now you should be familiar with [type extensions](types.extend.md), but effectively the [types library does exactly the same](https://github.com/polkadot-js/api/tree/master/packages/types/src/interfaces).
|
||||
A large part of the type definitions are defined not as classes, but rather as structures from which type definitions are extracted and that can be used as-is to let the API know how to decode a type. By now you should be familiar with [type extensions](types.extend.md) and the [rules around fields](types.extend.md#field-ordering), but effectively the [types library does exactly the same](https://github.com/polkadot-js/api/tree/master/packages/types/src/interfaces).
|
||||
|
||||
To create TypeScript-aware definitions and keep your files in a single place, you can follow the same approach. Assuming you have a package named `@MeInc/stuff` where you have the definitions in an `stuff/interfaces` folder. Each sub-folder would indicate a runtime module, e.g.
|
||||
To create TypeScript-aware definitions and keep your files in a single place, you can follow the same approach. Assuming you have a package named `@MeInc/stuff` where you have the definitions in an `stuff/interfaces` folder. Each sub-folder would indicate a runtime module, e.g.
|
||||
|
||||
- `stuff/interfaces/<module>/definitions.ts` for each module (`types.ts` & `index.ts` will be generated)
|
||||
- `stuff/interfaces/defnitions.ts` importing all sub-definitions`
|
||||
- `stuff/interfaces/definitions.ts` importing all sub-definitions`
|
||||
|
||||
With this structure setup, you can generate TypeScript defintions.
|
||||
With this structure setup, you can generate TypeScript definitions.
|
||||
|
||||
In the root of your project (with the `@polkadot/api`), you can run `yarn polkadot-types-from-defs --input ./stuff/interfaces --package @MeInc/stuff/interfaces` which will create `types.ts` and `index.ts` files with the generated types. You can use these in exactly the same way as you would use your types from `@polkadot/types/interfaces`.
|
||||
In the root of your project (with the `@polkadot/typegen` package installed), you can run `yarn polkadot-types-from-defs --input ./stuff/interfaces --package @MeInc/stuff/interfaces` which will create `types.ts` and `index.ts` files with the generated types. You can use these in exactly the same way as you would use your types from `@polkadot/types/interfaces`.
|
||||
|
||||
## Chain modules
|
||||
|
||||
In the same way as the type library provides defaults from a substrate-base chain, you can also, directly from chain from metadata, generate a complete `api.{consts,query}.*` defintion for your specific chain. The command will create 2 files, `{consts, query}.types.ts` which you can either use to augment the TypeScript defintions, or replace those in `@polkadot/api/*` with your versions (copy, TypeScript replacement or browser/node aliassing).
|
||||
In the same way as the type library provides defaults from a substrate-base chain, you can also, directly from chain from metadata, generate a complete `api.{consts,query}.*` definition for your specific chain. The command will create 2 files, `{consts, query}.types.ts` which you can either use to augment the TypeScript definitions, or replace those in `@polkadot/api/*` with your versions (copy, TypeScript replacement or browser/node aliasing).
|
||||
|
||||
In the root of your project, you can run `yarn polkadot-types-from-chain --endpoint wss://<url> --output ./stuff` and it will create the required output. (Here you can specify an optional `--package @MeInc/stuff` to read definitions for the targetted output folder with the specified package name.)
|
||||
In the root of your project, you can run `yarn polkadot-types-from-chain --endpoint wss://<url> --output ./stuff` and it will create the required output. (Here you can specify an optional `--package @MeInc/stuff` to read definitions for the targeted output folder with the specified package name.)
|
||||
|
||||
## Example of actual use
|
||||
|
||||
The [TypeScript augmentation example](../examples/promise/90_typegen/) example provides a full real-world example of these scripts in action. Additionally it shows all the configurations from a TypeScript as well as an in-use perspective, showing how the types and interfaces are fully augmented based on the provided metadata.
|
||||
|
||||
## And that's a wrap
|
||||
|
||||
|
||||
+9
-15
@@ -1,15 +1,19 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
// Copyright 2017-2020 @polkadot/api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
const config = require('@polkadot/dev/config/jest');
|
||||
|
||||
module.exports = Object.assign({}, config, {
|
||||
moduleNameMapper: {
|
||||
'@polkadot/api-contract(.*)$': '<rootDir>/packages/api-contract/src/$1',
|
||||
'@polkadot/api-derive(.*)$': '<rootDir>/packages/api-derive/src/$1',
|
||||
// eslint-disable-next-line sort-keys
|
||||
'@polkadot/api(.*)$': '<rootDir>/packages/api/src/$1',
|
||||
'@polkadot/metadata(.*)$': '<rootDir>/packages/metadata/src/$1',
|
||||
'@polkadot/rpc-(core|provider)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
|
||||
'@polkadot/jsonrpc(.*)$': '<rootDir>/packages/type-jsonrpc/src/$1',
|
||||
'@polkadot/types-known(.*)$': '<rootDir>/packages/types-known/src/$1',
|
||||
// eslint-disable-next-line sort-keys
|
||||
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
|
||||
},
|
||||
modulePathIgnorePatterns: [
|
||||
@@ -19,18 +23,8 @@ module.exports = Object.assign({}, config, {
|
||||
'<rootDir>/packages/metadata/build',
|
||||
'<rootDir>/packages/rpc-core/build',
|
||||
'<rootDir>/packages/rpc-provider/build',
|
||||
'<rootDir>/packages/type-jsonrpc/build',
|
||||
'<rootDir>/packages/types/build'
|
||||
'<rootDir>/packages/types/build',
|
||||
'<rootDir>/packages/types-known/build'
|
||||
],
|
||||
globals: {
|
||||
ws_local: 'ws://127.0.0.1:9944/',
|
||||
ws_local_substrate_master: 'ws://127.0.0.1:9945/',
|
||||
ws_local_substrate_1: 'ws://127.0.0.1:9946/',
|
||||
ws_local_substrate_2: 'ws://127.0.0.1:9947/',
|
||||
ws_local_polkadot_master: 'ws://127.0.0.1:9948/',
|
||||
ws_local_polkadot_alex: 'ws://127.0.0.1:9949/',
|
||||
ws_substrate_1: 'wss://substrate-rpc.parity.io/',
|
||||
ws_polkadot_alex: 'wss://poc3-rpc.polkadot.io/'
|
||||
},
|
||||
resolver: './jest.resolver.js'
|
||||
});
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/util authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function resolver (file, config) {
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "1.2.1"
|
||||
"version": "1.23.1"
|
||||
}
|
||||
|
||||
+21
-16
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"version": "1.2.1",
|
||||
"repository": "https://github.com/polkadot-js/api",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"yarn": "^1.10.1"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"typescript": "^3.7.5"
|
||||
"babel-core": "^7.0.0-bridge.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||
"build:interfaces": "node packages/types/src/scripts/interfacesTsWrapper.js",
|
||||
"circular": "madge --circular --extensions ts ./",
|
||||
"docs": "node packages/types/src/scripts/MetadataMdWrapper.js && polkadot-dev-build-docs",
|
||||
"chain:info": "node packages/types/src/scripts/extractChainWrapper.js",
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts && (cd packages/typegen && copyfiles scripts/* build)",
|
||||
"build:interfaces": "polkadot-types-internal-interfaces",
|
||||
"build:release": "polkadot-ci-ghact-build",
|
||||
"docs": "polkadot-types-internal-metadata && polkadot-dev-build-docs",
|
||||
"docs:release": "polkadot-ci-ghact-docs",
|
||||
"chain:info": "polkadot-types-chain-info",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
@@ -24,10 +24,15 @@
|
||||
"test:watch": "polkadot-dev-run-test --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/register": "^7.8.3",
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/dev": "^0.40.16",
|
||||
"@polkadot/ts": "^0.2.3"
|
||||
}
|
||||
"@babel/core": "^7.10.4",
|
||||
"@babel/register": "^7.10.4",
|
||||
"@babel/runtime": "^7.10.4",
|
||||
"@polkadot/dev": "^0.55.20",
|
||||
"@polkadot/ts": "^0.3.27",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^26.0.3",
|
||||
"@vuepress/plugin-search": "^1.5.2",
|
||||
"copyfiles": "^2.3.0"
|
||||
},
|
||||
"version": "1.23.1"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "1.2.1",
|
||||
"version": "1.23.1",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -26,12 +26,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/api": "^1.2.1",
|
||||
"@polkadot/rpc-core": "^1.2.1",
|
||||
"@polkadot/types": "^1.2.1",
|
||||
"@polkadot/util": "^2.3.1",
|
||||
"bn.js": "^5.1.1",
|
||||
"rxjs": "^6.5.4"
|
||||
"@babel/runtime": "^7.10.4",
|
||||
"@polkadot/api": "1.23.1",
|
||||
"@polkadot/rpc-core": "1.23.1",
|
||||
"@polkadot/types": "1.23.1",
|
||||
"@polkadot/util": "^2.17.1",
|
||||
"bn.js": "^5.1.2",
|
||||
"rxjs": "^6.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ export default class ContractAbi extends ContractRegistry implements InterfaceAb
|
||||
|
||||
constructor (registry: Registry, abi: ContractABIPre) {
|
||||
super(registry, abi);
|
||||
[this.abi, this.constructors, this.messages] = this.decodeAbi(abi);
|
||||
[this.abi, this.constructors, this.messages] = this._decodeAbi(abi);
|
||||
}
|
||||
|
||||
private decodeAbi (abiPre: ContractABIPre): [ContractABI, ContractABIFn[], AbiMessages] {
|
||||
private _decodeAbi (abiPre: ContractABIPre): [ContractABI, ContractABIFn[], AbiMessages] {
|
||||
this.validateAbi(abiPre);
|
||||
|
||||
const abi = this.convertAbi(abiPre);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { CodecArg, Constructor, Registry, TypeDef } from '@polkadot/types/types';
|
||||
import { ContractABIArgBasePre, ContractABIContract, ContractABIContractPre, ContractABIEvent, ContractABIEventPre, ContractABIFn, ContractABIFnArg, ContractABIMessage, ContractABIMessageBase, ContractABIMessagePre, ContractABI, ContractABIMessageCommon, ContractABIPre, ContractABIRange, ContractABIRangePre, ContractABIStorage, ContractABIStorageLayout, ContractABIStorageLayoutPre, ContractABIStoragePre, ContractABIStorageStruct, ContractABIStorageStructPre, ContractABITypePre } from './types';
|
||||
|
||||
import { Compact, u32, createClass, createType, encodeType } from '@polkadot/types';
|
||||
import { Compact, u32, createClass, encodeType } from '@polkadot/types';
|
||||
import { assert, hexToU8a, isNumber, isString, isNull, isObject, isUndefined, stringCamelCase, isHex, hexToNumber } from '@polkadot/util';
|
||||
|
||||
import MetaRegistry from './MetaRegistry';
|
||||
@@ -14,16 +14,16 @@ import MetaRegistry from './MetaRegistry';
|
||||
// just catch everything (since this is now non-standard for u32 anyway)
|
||||
function parseSelector (registry: Registry, fnname: string, input: ContractABIMessageCommon['selector']): u32 {
|
||||
if (isNumber(input)) {
|
||||
return createType(registry, 'u32', input);
|
||||
return registry.createType('u32', input);
|
||||
} else if (isHex(input)) {
|
||||
return createType(registry, 'u32', hexToU8a(input));
|
||||
return registry.createType('u32', hexToU8a(input));
|
||||
} else if (typeof input === 'string') {
|
||||
try {
|
||||
const array = JSON.parse(input);
|
||||
const array = JSON.parse(input) as unknown[];
|
||||
|
||||
assert(array.length === 4, `${fnname}: Invalid selector length`);
|
||||
|
||||
return createType(registry, 'u32', Uint8Array.from(
|
||||
return registry.createType('u32', Uint8Array.from(
|
||||
// the as number[] is here to pacify TS, it doesn't quite know how to handle the cb
|
||||
(array as number[]).map((value: string | number): number =>
|
||||
isHex(value)
|
||||
@@ -61,7 +61,7 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
const unknownKeys = Object.keys(arg).filter((key): boolean => !['name', 'type'].includes(key));
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI args for ${name}`);
|
||||
assert(isNumber(arg.name) && isString(this.stringAt(arg.name)), `${name} args should have valid name `);
|
||||
assert(isNumber(arg.name) && isString(this._stringAt(arg.name)), `${name} args should have valid name `);
|
||||
assert(isNumber(arg.type.ty) && isObject(this.typeDefAt(arg.type.ty)), `${name} args should have valid type`);
|
||||
});
|
||||
}
|
||||
@@ -83,9 +83,9 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI args for messages.${message.name}`);
|
||||
|
||||
const { name, selector, return_type: returnType } = message;
|
||||
const { name, return_type: returnType, selector } = message;
|
||||
|
||||
assert(isNumber(name) && isString(this.stringAt(name)), `Expected name for ${fnname}`);
|
||||
assert(isNumber(name) && isString(this._stringAt(name)), `Expected name for ${fnname}`);
|
||||
assert(isNull(returnType) || (isNumber(returnType.ty) && isObject(this.typeDefAt(returnType.ty))), `Expected return_type for ${fnname}`);
|
||||
|
||||
parseSelector(this.registry, fnname, selector);
|
||||
@@ -100,7 +100,7 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
|
||||
const { contract: { constructors, messages, name } } = abi;
|
||||
|
||||
assert(constructors && messages && isString(this.stringAt(name)), 'ABI should have constructors, messages & name sections');
|
||||
assert(constructors && messages && isString(this._stringAt(name)), 'ABI should have constructors, messages & name sections');
|
||||
|
||||
this.validateConstructors(abi);
|
||||
this.validateMessages(abi);
|
||||
@@ -108,14 +108,17 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
|
||||
public createMessage (name: string, message: Partial<ContractABIMessage> & ContractABIMessageBase): ContractABIFn {
|
||||
const args = message.args.map(({ name, type }): ContractABIFnArg => {
|
||||
assert(isObject(type), `Invalid type at index ${type}`);
|
||||
assert(isObject(type), `Invalid type at index ${type.toString()}`);
|
||||
|
||||
return {
|
||||
name: stringCamelCase(name),
|
||||
type
|
||||
};
|
||||
});
|
||||
|
||||
const Clazz = createArgClass(this.registry, args, isUndefined(message.selector) ? {} : { __selector: 'u32' });
|
||||
const baseStruct: { [index: string]: any } = { __selector: isUndefined(message.selector) ? undefined : parseSelector(this.registry, name, message.selector) };
|
||||
|
||||
const encoder = (...params: CodecArg[]): Uint8Array => {
|
||||
assert(params.length === args.length, `Expected ${args.length} arguments to contract ${name}, found ${params.length}`);
|
||||
|
||||
@@ -136,6 +139,7 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
fn.args = args;
|
||||
fn.isConstant = !(message.mutates || false);
|
||||
fn.type = message.returnType || null;
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
@@ -147,21 +151,22 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
}
|
||||
|
||||
public convertArgs (args: ContractABIArgBasePre[]): any[] {
|
||||
return args.map(({ name, type, ...arg }) => ({ ...arg, name: this.stringAt(name), type: this.convertType(type) }));
|
||||
return args.map(({ name, type, ...arg }) => ({ ...arg, name: this._stringAt(name), type: this.convertType(type) }));
|
||||
}
|
||||
|
||||
public convertType ({ ty, display_name: displayNameIndices }: ContractABITypePre): TypeDef {
|
||||
public convertType ({ display_name: displayNameIndices, ty }: ContractABITypePre): TypeDef {
|
||||
const displayName = this.stringsAt(displayNameIndices).join('::');
|
||||
|
||||
return this.typeDefAt(ty, { displayName });
|
||||
}
|
||||
|
||||
public convertContract ({ constructors, messages, name, events, ...contract }: ContractABIContractPre): ContractABIContract {
|
||||
public convertContract ({ constructors, events, messages, name, ...contract }: ContractABIContractPre): ContractABIContract {
|
||||
return {
|
||||
constructors: this.convertConstructors(constructors),
|
||||
messages: messages.map(message => this.convertMessage(message)),
|
||||
name: this.stringAt(name),
|
||||
messages: messages.map((message) => this.convertMessage(message)),
|
||||
name: this._stringAt(name),
|
||||
...(events
|
||||
? { events: events.map(event => this.convertEvent(event)) }
|
||||
? { events: events.map((event) => this.convertEvent(event)) }
|
||||
: {}),
|
||||
...contract
|
||||
};
|
||||
@@ -178,14 +183,16 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
public convertMessage ({ args, name, return_type: returnType, ...message }: ContractABIMessagePre): ContractABIMessage {
|
||||
return {
|
||||
...message,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
args: this.convertArgs(args),
|
||||
name: this.stringAt(name),
|
||||
name: this._stringAt(name),
|
||||
returnType: returnType ? this.convertType(returnType) : null
|
||||
};
|
||||
}
|
||||
|
||||
public convertEvent ({ args }: ContractABIEventPre): ContractABIEvent {
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
args: this.convertArgs(args)
|
||||
};
|
||||
}
|
||||
@@ -202,13 +209,13 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
public convertStorageStruct ({ 'struct.type': structType, 'struct.fields': structFields }: ContractABIStorageStructPre): ContractABIStorageStruct {
|
||||
public convertStorageStruct ({ 'struct.fields': structFields, 'struct.type': structType }: ContractABIStorageStructPre): ContractABIStorageStruct {
|
||||
return {
|
||||
'struct.type': this.typeDefAt(structType),
|
||||
'struct.fields': structFields.map(({ name, layout }) => ({
|
||||
name: this.stringAt(name),
|
||||
layout: this.convertStorageLayout(layout)
|
||||
}))
|
||||
'struct.fields': structFields.map(({ layout, name }) => ({
|
||||
layout: this.convertStorageLayout(layout),
|
||||
name: this._stringAt(name)
|
||||
})),
|
||||
'struct.type': this.typeDefAt(structType)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ import { MetaRegistryItem, MetaRegistryJson, MetaTypeDefClikeEnum, MetaType, Met
|
||||
import { assert } from '@polkadot/util';
|
||||
import { displayType, withTypeString } from '@polkadot/types';
|
||||
|
||||
const builtinMap: [(id: any) => boolean, MetaTypeInfo][] = [
|
||||
[(id: any): boolean => typeof id === 'string', MetaTypeInfo.BuiltinPlain],
|
||||
[(id: any): boolean => Array.isArray(id), MetaTypeInfo.BuiltinTuple],
|
||||
[(id: any): boolean => !!(id['array.type']), MetaTypeInfo.BuiltinVecFixed],
|
||||
[(id: any): boolean => !!(id['slice.type']), MetaTypeInfo.BuiltinVec]
|
||||
const builtinMap: [(id: unknown | unknown[] | { 'array.type': unknown } | { 'slice.type': unknown }) => boolean, MetaTypeInfo][] = [
|
||||
[(id: any) => typeof id === 'string', MetaTypeInfo.BuiltinPlain],
|
||||
[(id: any) => Array.isArray(id), MetaTypeInfo.BuiltinTuple],
|
||||
[(id: any) => !!((id as { 'array.type': unknown })['array.type']), MetaTypeInfo.BuiltinVecFixed],
|
||||
[(id: any) => !!((id as { 'slice.type': unknown })['slice.type']), MetaTypeInfo.BuiltinVec]
|
||||
];
|
||||
|
||||
const typeMap: [string, MetaTypeInfo][] = [
|
||||
@@ -25,8 +25,8 @@ function detectedType ({ def, id }: MetaType): MetaTypeInfo {
|
||||
assert(!(def as MetaTypeDefUnion)['union.fields'], 'Invalid union type definition found');
|
||||
|
||||
const lookup = def === 'builtin'
|
||||
? builtinMap.find(([test]): boolean => test(id))
|
||||
: typeMap.find(([test]): boolean => !!(def as any)[test]);
|
||||
? builtinMap.find(([test]) => test(id))
|
||||
: typeMap.find(([test]) => !!(def as unknown as Record<string, unknown>)[test]);
|
||||
|
||||
return lookup
|
||||
? lookup[1]
|
||||
@@ -48,7 +48,7 @@ class MetadataRegistryLookup {
|
||||
this._types = types;
|
||||
}
|
||||
|
||||
protected hasItemAt (index: number, variant: MetaRegistryItem): boolean {
|
||||
protected _hasItemAt (index: number, variant: MetaRegistryItem): boolean {
|
||||
switch (variant) {
|
||||
case MetaRegistryItem.String:
|
||||
return this._strings && !!this._strings[index - 1];
|
||||
@@ -59,8 +59,8 @@ class MetadataRegistryLookup {
|
||||
}
|
||||
}
|
||||
|
||||
protected itemAt (index: number, variant: MetaRegistryItem): any {
|
||||
assert(this.hasItemAt(index, variant), `MetaRegistry: Invalid ${variant} index ${index} found in metadata`);
|
||||
protected _itemAt (index: number, variant: MetaRegistryItem): string | MetaType | TypeDef {
|
||||
assert(this._hasItemAt(index, variant), `MetaRegistry: Invalid ${variant} index ${index} found in metadata`);
|
||||
|
||||
switch (variant) {
|
||||
case MetaRegistryItem.String:
|
||||
@@ -72,33 +72,33 @@ class MetadataRegistryLookup {
|
||||
}
|
||||
}
|
||||
|
||||
protected itemsAt (indices: number[], variant: MetaRegistryItem): any[] {
|
||||
return indices.map((index: number): string => this.itemAt(index, variant));
|
||||
protected _itemsAt (indices: number[], variant: MetaRegistryItem): (string | MetaType | TypeDef)[] {
|
||||
return indices.map((index: number) => this._itemAt(index, variant));
|
||||
}
|
||||
|
||||
protected stringAt (index: StringIndex): string {
|
||||
return this.itemAt(index, MetaRegistryItem.String);
|
||||
protected _stringAt (index: StringIndex): string {
|
||||
return this._itemAt(index, MetaRegistryItem.String) as string;
|
||||
}
|
||||
|
||||
public stringsAt (indices: StringIndex[]): string[] {
|
||||
return this.itemsAt(indices, MetaRegistryItem.String);
|
||||
return this._itemsAt(indices, MetaRegistryItem.String) as string[];
|
||||
}
|
||||
|
||||
public typeAt (index: TypeIndex): MetaType {
|
||||
return this.itemAt(index, MetaRegistryItem.Type);
|
||||
return this._itemAt(index, MetaRegistryItem.Type) as MetaType;
|
||||
}
|
||||
|
||||
public typesAt (indices: TypeIndex[]): MetaType[] {
|
||||
return this.itemsAt(indices, MetaRegistryItem.Type);
|
||||
return this._itemsAt(indices, MetaRegistryItem.Type) as MetaType[];
|
||||
}
|
||||
|
||||
public hasTypeDefAt (index: TypeIndex): boolean {
|
||||
return this.hasItemAt(index, MetaRegistryItem.TypeDef);
|
||||
return this._hasItemAt(index, MetaRegistryItem.TypeDef);
|
||||
}
|
||||
|
||||
public typeDefAt (index: TypeIndex, extra: Pick<TypeDef, never> = {}): TypeDef {
|
||||
return {
|
||||
...this.itemAt(index, MetaRegistryItem.TypeDef),
|
||||
...this._itemAt(index, MetaRegistryItem.TypeDef) as TypeDef,
|
||||
...extra
|
||||
};
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
this.typeDefs[typeIndex - 1] = this.typeDefFromMetaType(this.typeAt(typeIndex), typeIndex);
|
||||
}
|
||||
|
||||
private typeDefIdFields ({ id }: MetaType): Pick<TypeDef, never> {
|
||||
private _typeDefIdFields ({ id }: MetaType): Pick<TypeDef, never> {
|
||||
const { 'custom.name': nameIndex, 'custom.namespace': namespaceIndices, 'custom.params': paramsIndices } = id as MetaTypeIdCustom;
|
||||
|
||||
if (!nameIndex) {
|
||||
@@ -124,7 +124,7 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
}
|
||||
|
||||
return {
|
||||
name: this.stringAt(nameIndex),
|
||||
name: this._stringAt(nameIndex),
|
||||
...(namespaceIndices && namespaceIndices.length
|
||||
? { namespace: this.stringsAt(namespaceIndices).join('::') }
|
||||
: {}
|
||||
@@ -136,33 +136,33 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
};
|
||||
}
|
||||
|
||||
private typeDefDefFields (metaType: MetaType, typeIndex?: TypeIndex): Pick<TypeDef, never> {
|
||||
private _typeDefDefFields (metaType: MetaType, typeIndex: TypeIndex = -1): Pick<TypeDef, never> {
|
||||
let typeDef;
|
||||
|
||||
switch (detectedType(metaType)) {
|
||||
case MetaTypeInfo.BuiltinPlain:
|
||||
typeDef = this.typeDefForBuiltinPlain(metaType.id as string);
|
||||
typeDef = this._typeDefForBuiltinPlain(metaType.id as string);
|
||||
break;
|
||||
case MetaTypeInfo.BuiltinTuple:
|
||||
typeDef = this.typeDefForBuiltinTuple(metaType.id as TypeIndex[]);
|
||||
typeDef = this._typeDefForBuiltinTuple(metaType.id as TypeIndex[]);
|
||||
break;
|
||||
case MetaTypeInfo.BuiltinVec:
|
||||
typeDef = this.typeDefForBuiltinVec(metaType.id as MetaTypeIdVec, typeIndex);
|
||||
typeDef = this._typeDefForBuiltinVec(metaType.id as MetaTypeIdVec, typeIndex);
|
||||
break;
|
||||
case MetaTypeInfo.BuiltinVecFixed:
|
||||
typeDef = this.typeDefForBuiltinVecFixed(metaType.id as MetaTypeIdVecFixed, typeIndex);
|
||||
typeDef = this._typeDefForBuiltinVecFixed(metaType.id as MetaTypeIdVecFixed, typeIndex);
|
||||
break;
|
||||
case MetaTypeInfo.Enum:
|
||||
typeDef = this.typeDefForEnum(metaType.def as MetaTypeDefEnum, metaType.id as MetaTypeIdCustom, typeIndex);
|
||||
typeDef = this._typeDefForEnum(metaType.def as MetaTypeDefEnum, metaType.id as MetaTypeIdCustom, typeIndex);
|
||||
break;
|
||||
case MetaTypeInfo.ClikeEnum:
|
||||
typeDef = this.typeDefForClikeEnum(metaType.def as MetaTypeDefClikeEnum);
|
||||
typeDef = this._typeDefForClikeEnum(metaType.def as MetaTypeDefClikeEnum);
|
||||
break;
|
||||
case MetaTypeInfo.Struct:
|
||||
typeDef = this.typeDefForStruct(metaType.def as MetaTypeDefStruct);
|
||||
break;
|
||||
case MetaTypeInfo.TupleStruct:
|
||||
typeDef = this.typeDefForTupleStruct(metaType.def as MetaTypeDefTupleStruct);
|
||||
typeDef = this._typeDefForTupleStruct(metaType.def as MetaTypeDefTupleStruct);
|
||||
break;
|
||||
case MetaTypeInfo.Null:
|
||||
default:
|
||||
@@ -176,8 +176,8 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
return withTypeString({
|
||||
info: TypeDefInfo.Null,
|
||||
type: '',
|
||||
...this.typeDefDefFields(metaType, typeIndex),
|
||||
...this.typeDefIdFields(metaType)
|
||||
...this._typeDefDefFields(metaType, typeIndex),
|
||||
...this._typeDefIdFields(metaType)
|
||||
}) as TypeDef;
|
||||
}
|
||||
|
||||
@@ -189,13 +189,13 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
return this.typeDefAt(typeIndex);
|
||||
}
|
||||
|
||||
private typeDefForEnumVariant (variant: MetaTypeDefEnumVariant): Pick<TypeDef, any> {
|
||||
private _typeDefForEnumVariant (variant: MetaTypeDefEnumVariant): Pick<TypeDef, any> {
|
||||
const { 'unit_variant.name': unitNameIndex } = variant as MetaTypeDefEnumVariantUnit;
|
||||
|
||||
if (unitNameIndex) {
|
||||
return {
|
||||
info: TypeDefInfo.Plain,
|
||||
name: this.stringAt(unitNameIndex),
|
||||
name: this._stringAt(unitNameIndex),
|
||||
type: 'Null'
|
||||
};
|
||||
}
|
||||
@@ -203,7 +203,7 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
const { 'tuple_struct_variant.name': tupleStructVariantNameIndex } = variant as MetaTypeDefEnumVariantTupleStruct;
|
||||
|
||||
if (tupleStructVariantNameIndex) {
|
||||
return this.typeDefForTupleStruct(variant as MetaTypeDefEnumVariantTupleStruct);
|
||||
return this._typeDefForTupleStruct(variant as MetaTypeDefEnumVariantTupleStruct);
|
||||
}
|
||||
|
||||
const { 'struct_variant.name': structVariantNameIndex } = variant as MetaTypeDefEnumVariantStruct;
|
||||
@@ -218,14 +218,14 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
};
|
||||
}
|
||||
|
||||
private typeDefForBuiltinPlain (id: string): Pick<TypeDef, never> {
|
||||
private _typeDefForBuiltinPlain (id: string): Pick<TypeDef, never> {
|
||||
return {
|
||||
info: TypeDefInfo.Plain,
|
||||
type: id
|
||||
};
|
||||
}
|
||||
|
||||
private typeDefForBuiltinTuple (id: TypeIndex[]): Pick<TypeDef, never> {
|
||||
private _typeDefForBuiltinTuple (id: TypeIndex[]): Pick<TypeDef, never> {
|
||||
const sub = id.map((tupleTypeIndex: number): TypeDef => this.typeDefFromMetaTypeAt(tupleTypeIndex));
|
||||
|
||||
return {
|
||||
@@ -234,48 +234,52 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
};
|
||||
}
|
||||
|
||||
private typeDefForBuiltinVec (id: MetaTypeIdVec, typeIndex?: TypeIndex): Pick<TypeDef, never> {
|
||||
private _typeDefForBuiltinVec (id: MetaTypeIdVec, typeIndex: TypeIndex = -1): Pick<TypeDef, never> {
|
||||
const { 'slice.type': vecTypeIndex } = id;
|
||||
|
||||
assert(!typeIndex || vecTypeIndex !== typeIndex, `MetaRegistry: self-referencing registry type at index ${typeIndex}`);
|
||||
|
||||
const type = displayType(this.typeDefFromMetaTypeAt(vecTypeIndex));
|
||||
|
||||
assert(type && type.length > 0, `MetaRegistry: Invalid builtin Vec type found at index ${typeIndex}`);
|
||||
|
||||
return {
|
||||
info: TypeDefInfo.Vec,
|
||||
type: `Vec<${type}>`,
|
||||
sub: this.typeDefFromMetaTypeAt(vecTypeIndex)
|
||||
sub: this.typeDefFromMetaTypeAt(vecTypeIndex),
|
||||
type: `Vec<${type}>`
|
||||
};
|
||||
}
|
||||
|
||||
private typeDefForBuiltinVecFixed (id: MetaTypeIdVecFixed, typeIndex?: TypeIndex): Pick<TypeDef, never> {
|
||||
const { 'array.type': vecTypeIndex, 'array.len': vecLength } = id;
|
||||
private _typeDefForBuiltinVecFixed (id: MetaTypeIdVecFixed, typeIndex: TypeIndex = -1): Pick<TypeDef, never> {
|
||||
const { 'array.len': vecLength, 'array.type': vecTypeIndex } = id;
|
||||
|
||||
assert(!vecLength || vecLength <= 256, 'MetaRegistry: Only support for [Type; <length>], where length <= 256');
|
||||
assert(!typeIndex || vecTypeIndex !== typeIndex, `MetaRegistry: self-referencing registry type at index ${typeIndex}`);
|
||||
|
||||
const type = displayType(this.typeDefFromMetaTypeAt(vecTypeIndex));
|
||||
|
||||
assert(type && type.length > 0, `MetaRegistry: Invalid vector type found at index ${typeIndex}`);
|
||||
|
||||
return {
|
||||
info: TypeDefInfo.VecFixed,
|
||||
ext: { length: vecLength, type },
|
||||
type: `[${type};${vecLength}]`,
|
||||
sub: this.typeDefFromMetaTypeAt(vecTypeIndex)
|
||||
length: vecLength, // ex: { type: type }
|
||||
sub: this.typeDefFromMetaTypeAt(vecTypeIndex),
|
||||
type: `[${type};${vecLength}]`
|
||||
};
|
||||
}
|
||||
|
||||
private typeDefForEnum (def: MetaTypeDefEnum, id: MetaTypeIdCustom, typeIndex?: TypeIndex): Pick<TypeDef, any> {
|
||||
const name = id && this.stringAt(id['custom.name']);
|
||||
private _typeDefForEnum (def: MetaTypeDefEnum, id: MetaTypeIdCustom, typeIndex?: TypeIndex): Pick<TypeDef, any> {
|
||||
const name = id && this._stringAt(id['custom.name']);
|
||||
|
||||
switch (name) {
|
||||
case 'Option':
|
||||
return this.typeDefForOption(id, typeIndex);
|
||||
|
||||
case 'Result':
|
||||
return this.typeDefForResult(id, typeIndex);
|
||||
|
||||
default: {
|
||||
const sub = def['enum.variants'].map(variant => this.typeDefForEnumVariant(variant));
|
||||
const sub = def['enum.variants'].map((variant) => this._typeDefForEnumVariant(variant));
|
||||
|
||||
return {
|
||||
info: TypeDefInfo.Enum,
|
||||
@@ -285,19 +289,19 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
}
|
||||
}
|
||||
|
||||
private typeDefForClikeEnum (def: MetaTypeDefClikeEnum): Pick<TypeDef, never> {
|
||||
private _typeDefForClikeEnum (def: MetaTypeDefClikeEnum): Pick<TypeDef, never> {
|
||||
return {
|
||||
info: TypeDefInfo.Enum,
|
||||
sub: def['clike_enum.variants'].map(({ name: nameIndex, discriminant }): TypeDef => ({
|
||||
sub: def['clike_enum.variants'].map(({ discriminant, name: nameIndex }): TypeDef => ({
|
||||
ext: { discriminant },
|
||||
info: TypeDefInfo.Plain,
|
||||
name: this.stringAt(nameIndex),
|
||||
name: this._stringAt(nameIndex),
|
||||
type: 'Null'
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
public typeDefForOption (id: MetaTypeIdCustom, typeIndex?: TypeIndex): Pick<TypeDef, any> {
|
||||
public typeDefForOption (id: MetaTypeIdCustom, typeIndex: TypeIndex = -1): Pick<TypeDef, any> {
|
||||
assert(id['custom.params'] && id['custom.params'][0], `Invalid Option type defined at index ${typeIndex}`);
|
||||
|
||||
return {
|
||||
@@ -306,7 +310,7 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
};
|
||||
}
|
||||
|
||||
public typeDefForResult (id: MetaTypeIdCustom, typeIndex?: TypeIndex): Pick<TypeDef, any> {
|
||||
public typeDefForResult (id: MetaTypeIdCustom, typeIndex: TypeIndex = -1): Pick<TypeDef, any> {
|
||||
assert(id['custom.params'] && id['custom.params'][0] && id['custom.params'][1], `Invalid Result type defined at index ${typeIndex}`);
|
||||
|
||||
return {
|
||||
@@ -322,24 +326,24 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
return withTypeString({
|
||||
info: TypeDefInfo.Struct,
|
||||
...(structNameIndex
|
||||
? { name: this.stringAt(structNameIndex) }
|
||||
? { name: this._stringAt(structNameIndex) }
|
||||
: {}
|
||||
),
|
||||
sub: structFields.map((field: MetaTypeDefStructField): TypeDef => ({
|
||||
...this.typeDefFromMetaTypeAt(field.type),
|
||||
name: this.stringAt(field.name)
|
||||
name: this._stringAt(field.name)
|
||||
}))
|
||||
});
|
||||
}
|
||||
|
||||
private typeDefForTupleStruct (def: MetaTypeDefTupleStruct | MetaTypeDefEnumVariantTupleStruct): Pick<TypeDef, any> {
|
||||
private _typeDefForTupleStruct (def: MetaTypeDefTupleStruct | MetaTypeDefEnumVariantTupleStruct): Pick<TypeDef, any> {
|
||||
const tupleStructTypes = (def as MetaTypeDefTupleStruct)['tuple_struct.types'] || (def as MetaTypeDefEnumVariantTupleStruct)['tuple_struct_variant.types'];
|
||||
const tupleStructNameIndex = (def as MetaTypeDefEnumVariantTupleStruct)['tuple_struct_variant.name'];
|
||||
|
||||
return withTypeString({
|
||||
info: TypeDefInfo.Tuple,
|
||||
...(tupleStructNameIndex
|
||||
? { name: this.stringAt(tupleStructNameIndex) }
|
||||
? { name: this._stringAt(tupleStructNameIndex) }
|
||||
: {}
|
||||
),
|
||||
sub: tupleStructTypes.map((fieldIndex: number, index: number): TypeDef => ({
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiTypes, DecorateMethod, SubmittableResultImpl } from '@polkadot/api/types';
|
||||
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair } from '@polkadot/types/types';
|
||||
import { IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
|
||||
import { ApiObject, ContractABIPre } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Abi from '../Abi';
|
||||
@@ -27,7 +26,7 @@ export interface BlueprintCreate<ApiType extends ApiTypes> {
|
||||
class BlueprintCreateResult<ApiType extends ApiTypes> extends SubmittableResult {
|
||||
public readonly contract?: Contract<ApiType>;
|
||||
|
||||
constructor (result: SubmittableResultImpl, contract?: Contract<ApiType>) {
|
||||
constructor (result: ISubmittableResult, contract?: Contract<ApiType>) {
|
||||
super(result);
|
||||
|
||||
this.contract = contract;
|
||||
@@ -41,25 +40,26 @@ export default class Blueprint<ApiType extends ApiTypes> extends BaseWithTx<ApiT
|
||||
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, codeHash: string | Hash) {
|
||||
super(api, abi, decorateMethod);
|
||||
|
||||
this.codeHash = createType(this.registry, 'Hash', codeHash);
|
||||
this.codeHash = this.registry.createType('Hash', codeHash);
|
||||
}
|
||||
|
||||
public deployContract (constructorIndex = 0, endowment: number | BN, maxGas: number | BN, ...params: any[]): BlueprintCreate<ApiType> {
|
||||
assert(!!this.abi.constructors[constructorIndex], `Specified constructor index ${constructorIndex} does not exist`);
|
||||
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
signAndSend: this.decorateMethod(
|
||||
(account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription<ApiType> => {
|
||||
return this.apiContracts
|
||||
return this._apiContracts
|
||||
.create(endowment, maxGas, this.codeHash, this.abi.constructors[constructorIndex](...params))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this.createResult));
|
||||
.pipe(map(this._createResult));
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
private createResult = (result: SubmittableResult): BlueprintCreateResult<ApiType> => {
|
||||
private _createResult = (result: SubmittableResult): BlueprintCreateResult<ApiType> => {
|
||||
let contract: Contract<ApiType> | undefined;
|
||||
|
||||
if (result.isInBlock) {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiTypes, DecorateMethod, SubmittableResultImpl } from '@polkadot/api/types';
|
||||
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair } from '@polkadot/types/types';
|
||||
import { IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
|
||||
import { ApiObject, ContractABIPre } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
@@ -19,7 +19,6 @@ import { BaseWithTx } from './util';
|
||||
|
||||
type CodePutCodeResultSubscription<ApiType extends ApiTypes> = Observable<CodePutCodeResult<ApiType>>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
|
||||
export interface CodePutCode<ApiType extends ApiTypes> {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription<ApiType>;
|
||||
}
|
||||
@@ -27,7 +26,7 @@ export interface CodePutCode<ApiType extends ApiTypes> {
|
||||
class CodePutCodeResult<ApiType extends ApiTypes> extends SubmittableResult {
|
||||
public readonly blueprint?: Blueprint<ApiType>;
|
||||
|
||||
constructor (result: SubmittableResultImpl, blueprint?: Blueprint<ApiType>) {
|
||||
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>) {
|
||||
super(result);
|
||||
|
||||
this.blueprint = blueprint;
|
||||
@@ -46,16 +45,18 @@ export default class Code<ApiType extends ApiTypes> extends BaseWithTx<ApiType>
|
||||
|
||||
public createBlueprint = (maxGas: number | BN): CodePutCode<ApiType> => {
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
signAndSend: this.decorateMethod(
|
||||
(account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription<ApiType> => this.apiContracts
|
||||
.putCode(maxGas, compactAddLength(this.code))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this.createResult))
|
||||
(account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription<ApiType> =>
|
||||
this._apiContracts
|
||||
.putCode(maxGas, compactAddLength(this.code))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this._createResult))
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
private createResult = (result: SubmittableResultImpl): CodePutCodeResult<ApiType> => {
|
||||
private _createResult = (result: ISubmittableResult): CodePutCodeResult<ApiType> => {
|
||||
let blueprint: Blueprint<ApiType> | undefined;
|
||||
|
||||
if (result.isInBlock) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import { createType } from '@polkadot/types';
|
||||
import Abi from '../Abi';
|
||||
import { formatData } from '../util';
|
||||
import { BaseWithTxAndRpcCall } from './util';
|
||||
@@ -22,7 +21,6 @@ type ContractCallResultSubscription<ApiType extends ApiTypes, CallType extends C
|
||||
? Observable<ContractCallResult<CallType>>
|
||||
: Promise<ObsInnerType<ContractCallResult<CallType>>>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
|
||||
export interface ContractCall<ApiType extends ApiTypes, CallType extends ContractCallTypes> {
|
||||
send (account: IKeyringPair | string | AccountId | Address): ContractCallResultSubscription<ApiType, CallType>;
|
||||
}
|
||||
@@ -34,40 +32,42 @@ export type ContractCallResult<CallType extends ContractCallTypes> = CallType ex
|
||||
export default class Contract<ApiType extends ApiTypes> extends BaseWithTxAndRpcCall<ApiType> {
|
||||
public readonly address: Address;
|
||||
|
||||
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, address: string | AccountId | Address) {
|
||||
super(api, abi, decorateMethod);
|
||||
|
||||
this.address = this.registry.createType('Address', address);
|
||||
}
|
||||
|
||||
public call (as: 'rpc', message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, 'rpc'>;
|
||||
public call (as: 'tx', message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, 'tx'>;
|
||||
public call<CallType extends ContractCallTypes> (as: CallType, message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, CallType> {
|
||||
const { fn, def } = this.getMessage(message);
|
||||
const { def, fn } = this.getMessage(message);
|
||||
|
||||
return {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
send: this.decorateMethod(
|
||||
as === 'rpc' && this.hasRpcContractsCall
|
||||
? (account: IKeyringPair | string | AccountId | Address): ContractCallResult<'rpc'> => {
|
||||
return this.rpcContractsCall(
|
||||
createType(this.registry, 'ContractCallRequest', {
|
||||
origin: account,
|
||||
? (account: IKeyringPair | string | AccountId | Address): ContractCallResult<'rpc'> =>
|
||||
this._rpcContractsCall(
|
||||
this.registry.createType('ContractCallRequest', {
|
||||
dest: this.address.toString(),
|
||||
value,
|
||||
gasLimit,
|
||||
inputData: fn(...params)
|
||||
inputData: fn(...params),
|
||||
origin: account,
|
||||
value
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
map((result: ContractExecResult): ContractCallOutcome =>
|
||||
this.createOutcome(result, createType(this.registry, 'AccountId', account), def, params)
|
||||
)
|
||||
);
|
||||
}
|
||||
: (account: IKeyringPair | string | AccountId | Address): ContractCallResult<'tx'> => {
|
||||
return this.apiContracts
|
||||
).pipe(map((result: ContractExecResult): ContractCallOutcome =>
|
||||
this._createOutcome(result, this.registry.createType('AccountId', account), def, params)
|
||||
))
|
||||
: (account: IKeyringPair | string | AccountId | Address): ContractCallResult<'tx'> =>
|
||||
this._apiContracts
|
||||
.call(this.address, value, gasLimit, fn(...params))
|
||||
.signAndSend(account);
|
||||
}
|
||||
.signAndSend(account)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
private createOutcome (result: ContractExecResult, origin: AccountId, message: ContractABIMessage, params: any[]): ContractCallOutcome {
|
||||
private _createOutcome (result: ContractExecResult, origin: AccountId, message: ContractABIMessage, params: any[]): ContractCallOutcome {
|
||||
let output: Codec | null = null;
|
||||
|
||||
if (result.isSuccess) {
|
||||
@@ -75,23 +75,17 @@ export default class Contract<ApiType extends ApiTypes> extends BaseWithTxAndRpc
|
||||
|
||||
output = message.returnType
|
||||
? formatData(this.registry, data, message.returnType)
|
||||
: createType(this.registry, 'Raw', data);
|
||||
: this.registry.createType('Raw', data);
|
||||
}
|
||||
|
||||
return {
|
||||
time: Date.now(),
|
||||
isSuccess: result.isSuccess,
|
||||
message,
|
||||
origin,
|
||||
output,
|
||||
params,
|
||||
result,
|
||||
isSuccess: result.isSuccess,
|
||||
output
|
||||
time: Date.now()
|
||||
};
|
||||
}
|
||||
|
||||
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, address: string | AccountId | Address) {
|
||||
super(api, abi, decorateMethod);
|
||||
|
||||
this.address = createType(this.registry, 'Address', address);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,14 +29,13 @@ export abstract class Base<ApiType extends ApiTypes> implements ContractBase<Api
|
||||
}
|
||||
|
||||
public get messages (): ContractMessage[] {
|
||||
return this.abi.abi.contract.messages
|
||||
.map(
|
||||
(def: ContractABIMessage, index): ContractMessage => ({
|
||||
index,
|
||||
def,
|
||||
fn: this.abi.messages[def.name] || this.abi.messages[stringCamelCase(name)]
|
||||
})
|
||||
);
|
||||
return this.abi.abi.contract.messages.map(
|
||||
(def: ContractABIMessage, index): ContractMessage => ({
|
||||
def,
|
||||
fn: this.abi.messages[def.name] || this.abi.messages[stringCamelCase(name)],
|
||||
index
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public getMessage (nameOrIndex?: string | number): ContractMessage {
|
||||
@@ -46,15 +45,17 @@ export abstract class Base<ApiType extends ApiTypes> implements ContractBase<Api
|
||||
: this.abi.abi.contract.messages.findIndex((message): boolean => nameOrIndex === message.name || nameOrIndex === stringCamelCase(message.name))
|
||||
: 0;
|
||||
const def = this.abi.abi.contract.messages[index];
|
||||
assert(!!def, `Attempted to access a contract message that does not exist: ${typeof nameOrIndex === 'number' ? `index ${nameOrIndex}` : nameOrIndex}`);
|
||||
|
||||
assert(!!def, `Attempted to access a contract message that does not exist: ${typeof nameOrIndex === 'number' ? `index ${nameOrIndex}` : (nameOrIndex || 'unknown')}`);
|
||||
|
||||
const fn = this.abi.messages[def.name] || this.abi.messages[stringCamelCase(def.name)];
|
||||
return { index, def, fn };
|
||||
|
||||
return { def, fn, index };
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class BaseWithTx<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
protected get apiContracts (): SubmittableModuleExtrinsics<'rxjs'> {
|
||||
protected get _apiContracts (): SubmittableModuleExtrinsics<'rxjs'> {
|
||||
return this.api.rx.tx.contracts;
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ export abstract class BaseWithTxAndRpcCall<ApiType extends ApiTypes> extends Bas
|
||||
return isFunction(this.api.rx.rpc.contracts?.call);
|
||||
}
|
||||
|
||||
protected get rpcContractsCall (): DecoratedRpc<'rxjs', RpcInterface>['contracts']['call'] {
|
||||
protected get _rpcContractsCall (): DecoratedRpc<'rxjs', RpcInterface>['contracts']['call'] {
|
||||
assert(this.hasRpcContractsCall, 'You need to connect to a node with the contracts.call RPC method.');
|
||||
|
||||
return this.api.rx.rpc.contracts.call;
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import { AccountId, Address, ContractExecResult } from '@polkadot/types/interfaces';
|
||||
import { Codec, CodecArg } from '@polkadot/types/types';
|
||||
import { MetaRegistryJson, StringIndex, TypeIndex, TypeDef } from '@polkadot/types/codec/create/types';
|
||||
import { MetaRegistryJson, StringIndex, TypeIndex, TypeDef } from '@polkadot/types/create/types';
|
||||
|
||||
// import { Observable } from 'rxjs';
|
||||
import { ApiPromise, ApiRx } from '@polkadot/api';
|
||||
|
||||
export type ApiObject<ApiType extends ApiTypes> = ApiType extends 'rxjs'
|
||||
@@ -24,6 +23,7 @@ export interface ContractBase<ApiType extends ApiTypes> {
|
||||
|
||||
export interface ContractABITypePre {
|
||||
ty: TypeIndex;
|
||||
// eslint-disable-next-line camelcase
|
||||
display_name: StringIndex[];
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ export interface ContractABIMessageCommon {
|
||||
|
||||
export interface ContractABIMessagePre extends ContractABIMessageCommon, ContractABIMessageBasePre {
|
||||
name: StringIndex;
|
||||
// eslint-disable-next-line camelcase
|
||||
return_type: ContractABITypePre | null;
|
||||
}
|
||||
|
||||
@@ -188,6 +189,7 @@ export interface InterfaceAbi {
|
||||
}
|
||||
|
||||
export interface InterfaceContractCalls {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
[index: string]: Function;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec, Registry, TypeDefInfo, TypeDef } from '@polkadot/types/types';
|
||||
import { Codec, Registry, TypeDef, TypeDefInfo } from '@polkadot/types/types';
|
||||
|
||||
import { Option, Raw, createClass } from '@polkadot/types';
|
||||
import { createTypeUnsafe } from '@polkadot/types/codec';
|
||||
import { Option, Raw, createClass, createTypeUnsafe } from '@polkadot/types';
|
||||
|
||||
export function formatData (registry: Registry, data: Raw, { info, type }: TypeDef): Codec {
|
||||
if (info === TypeDefInfo.Option) {
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -71,10 +68,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -116,10 +110,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -153,10 +144,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -183,10 +171,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -223,10 +208,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -256,10 +238,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -295,10 +274,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -340,10 +316,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -381,10 +354,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -402,10 +372,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -439,10 +406,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -460,10 +424,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -506,10 +467,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -527,10 +485,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -566,10 +521,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -587,10 +539,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -628,10 +577,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -677,10 +623,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -708,10 +651,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -725,10 +665,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -757,10 +694,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -802,10 +736,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -839,10 +770,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -869,10 +797,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -909,10 +834,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -942,10 +864,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -969,10 +888,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -998,10 +914,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1047,10 +960,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1082,10 +992,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1119,10 +1026,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1149,10 +1053,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1189,10 +1090,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1230,10 +1128,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1260,10 +1155,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1300,10 +1192,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1331,10 +1220,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1361,10 +1247,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1400,10 +1283,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1445,10 +1325,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1486,10 +1363,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1507,10 +1381,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1544,10 +1415,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1565,10 +1433,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1611,10 +1476,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1632,10 +1494,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1671,10 +1530,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1692,10 +1548,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1725,10 +1578,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1746,10 +1596,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1773,10 +1620,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1814,10 +1658,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1835,10 +1676,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1872,10 +1710,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1893,10 +1728,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1939,10 +1771,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1960,10 +1789,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2007,10 +1833,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2028,10 +1851,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2065,10 +1885,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2086,10 +1903,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2132,10 +1946,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2153,10 +1964,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2190,10 +1998,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2211,10 +2016,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2248,10 +2050,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2269,10 +2068,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2305,10 +2101,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -2328,10 +2121,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
|
||||
@@ -38,10 +38,7 @@
|
||||
{
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -89,10 +86,7 @@
|
||||
{
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -130,10 +124,7 @@
|
||||
{
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -153,10 +144,7 @@
|
||||
{
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -168,10 +156,7 @@
|
||||
{
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -181,4 +166,4 @@
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
@@ -71,10 +68,7 @@
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
@@ -120,10 +114,7 @@
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
@@ -151,10 +142,7 @@
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
@@ -168,10 +156,7 @@
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
@@ -185,4 +170,4 @@
|
||||
"info": 7,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -22,10 +22,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -67,10 +64,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -104,10 +98,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -167,10 +158,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -241,10 +229,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -308,10 +293,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -381,10 +363,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -426,10 +405,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -483,10 +459,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -528,10 +501,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -565,10 +535,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -628,10 +595,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -702,10 +666,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -769,10 +730,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -830,10 +788,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -847,10 +802,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -932,10 +884,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -977,10 +926,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1008,10 +954,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1033,10 +976,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1070,10 +1010,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1133,10 +1070,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1207,10 +1141,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1282,10 +1213,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1345,10 +1273,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1419,10 +1344,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1484,10 +1406,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1547,10 +1466,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1620,10 +1536,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1665,10 +1578,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1714,10 +1624,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
|
||||
@@ -22,10 +22,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -71,10 +68,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -288,10 +282,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -337,10 +328,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -438,10 +426,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -487,10 +472,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -518,10 +500,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -535,10 +514,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -563,10 +539,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -714,10 +687,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user