Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c03068f0ec | ||
|
|
e8f352930d | ||
|
|
bf2c560db5 | ||
|
|
63189a6196 | ||
|
|
9990690332 | ||
|
|
ee163cc342 | ||
|
|
cf27f7e11b | ||
|
|
12986865c8 | ||
|
|
aac0fc741a | ||
|
|
c33f95d64b | ||
|
|
eb7255b34f | ||
|
|
3982798d5e | ||
|
|
ded1ebd4e7 | ||
|
|
c261d4e333 | ||
|
|
7b1400e238 | ||
|
|
7c2048bc6b | ||
|
|
2b1d5664fe | ||
|
|
5403686e20 | ||
|
|
e90c72fc8b | ||
|
|
1910ef54a4 | ||
|
|
45686f9482 | ||
|
|
a6b0d214af | ||
|
|
2a1a2a936b | ||
|
|
060275d1ae | ||
|
|
abb54d2538 | ||
|
|
98fc472a40 | ||
|
|
4034429042 | ||
|
|
ca212b8736 | ||
|
|
4c2593629d | ||
|
|
612d85ca2a | ||
|
|
b25b92dddc | ||
|
|
f01376ebe1 | ||
|
|
03acde19b8 | ||
|
|
1de533ca9c | ||
|
|
ce2037400c | ||
|
|
379fe12979 | ||
|
|
a285f53753 | ||
|
|
ed36eed112 | ||
|
|
ddf6f574f6 | ||
|
|
4f7c4e8b4e | ||
|
|
f2a82ddd0f | ||
|
|
3cec316683 | ||
|
|
c23b5e674b | ||
|
|
8bf8222c31 | ||
|
|
0c19e966cc | ||
|
|
9fbda5a6e0 | ||
|
|
3d7d39073f | ||
|
|
ae26aebdf8 | ||
|
|
c43f442fb9 | ||
|
|
f97a6d0418 | ||
|
|
7cd2fa5f6a | ||
|
|
6015552aab | ||
|
|
8748c02b20 | ||
|
|
6e04d4aa93 | ||
|
|
4a955f7b77 | ||
|
|
227143728d | ||
|
|
7330555c37 | ||
|
|
09831fe325 | ||
|
|
c7dda6fe85 | ||
|
|
285bbab055 | ||
|
|
b73010a506 | ||
|
|
9c951fe1cb | ||
|
|
f7dfb633d6 | ||
|
|
e32286b610 | ||
|
|
fe2687b514 | ||
|
|
1adde99e1b | ||
|
|
33dcc9c8aa | ||
|
|
db563bc131 | ||
|
|
35d2fa31e0 | ||
|
|
399637280c | ||
|
|
f46916b215 | ||
|
|
94aa79d1e5 | ||
|
|
10dacf1d16 | ||
|
|
bdaacfdd56 | ||
|
|
4fa77b3654 | ||
|
|
400e14d6c9 | ||
|
|
09f247432f | ||
|
|
fd195dd4f0 | ||
|
|
0038227680 | ||
|
|
89dec0bc0b | ||
|
|
a55a835504 | ||
|
|
c1266a6657 | ||
|
|
b78f08e2e6 | ||
|
|
298ef03787 | ||
|
|
dd80b1873c | ||
|
|
f7672e053b | ||
|
|
281e9d2dee | ||
|
|
3f0d11b026 | ||
|
|
0c997d2850 | ||
|
|
cb0beea7cd | ||
|
|
4ed783878d | ||
|
|
3846b5cc18 | ||
|
|
57b8915101 | ||
|
|
4f3f7e8dff | ||
|
|
a42c266a35 | ||
|
|
b03b2db3f8 | ||
|
|
5347db445d | ||
|
|
2a15b65385 | ||
|
|
7f1952acfc | ||
|
|
d8920b4bac | ||
|
|
3b46505027 | ||
|
|
ba3ac3f73d | ||
|
|
81d460ccc8 | ||
|
|
e6bb6c49b3 | ||
|
|
82ffa8a6e2 | ||
|
|
adc1af1f21 | ||
|
|
a05d6ad7dc | ||
|
|
be592f53b8 | ||
|
|
8e74eca435 | ||
|
|
8a28d2cf46 | ||
|
|
d36886fcbf | ||
|
|
3bbc9fbf6e | ||
|
|
1d4539f3ef | ||
|
|
215b20f7db | ||
|
|
c034b54822 | ||
|
|
261ca2149d | ||
|
|
eaa67c8ea6 | ||
|
|
db287d6997 | ||
|
|
b85bf7e41c | ||
|
|
84b82dd9b5 | ||
|
|
3df5b01375 | ||
|
|
2e6a59e2a0 | ||
|
|
2f91561166 | ||
|
|
b307772be2 | ||
|
|
d14d2ccc86 | ||
|
|
0f26ec47e2 | ||
|
|
40065e300b | ||
|
|
bbdb8a317f | ||
|
|
668085262c | ||
|
|
508400684a | ||
|
|
3273556f7b | ||
|
|
d36144bf36 | ||
|
|
444479011e | ||
|
|
8ac713abcf | ||
|
|
728bc5294f | ||
|
|
fd2f331bdf | ||
|
|
2aebbb89cb | ||
|
|
532c011495 | ||
|
|
e2802df9ce | ||
|
|
cc181e2cc3 | ||
|
|
1b8ba41715 | ||
|
|
648be9aecb | ||
|
|
292af97dc9 | ||
|
|
bcdd537214 | ||
|
|
514c5e4825 | ||
|
|
9b9581487d | ||
|
|
d443f31a9a | ||
|
|
3951da5df3 | ||
|
|
5f3a1e5b24 | ||
|
|
b1a6ccd425 | ||
|
|
adc40e581f | ||
|
|
c6b0b0c161 | ||
|
|
bf5b14580b | ||
|
|
088c02862b | ||
|
|
a05980900e | ||
|
|
77019def08 | ||
|
|
ae6a3307b1 | ||
|
|
8cb15c6a87 | ||
|
|
389dbb58a9 | ||
|
|
2d02f61fa7 | ||
|
|
7497ac723f | ||
|
|
711a145e1e | ||
|
|
05e3db01ba | ||
|
|
6158c07e0a | ||
|
|
ce505aaf62 | ||
|
|
09f9a48037 | ||
|
|
700c1cfcd4 | ||
|
|
7d2463e53f | ||
|
|
a2ecd9bd3b | ||
|
|
b0de692147 | ||
|
|
dcd53c76d7 | ||
|
|
6ed90c6111 | ||
|
|
babef6d7bc | ||
|
|
e2205a65e9 | ||
|
|
32d55dfb18 | ||
|
|
60e0d0eae4 | ||
|
|
9cef1febe1 | ||
|
|
4c9032fedc | ||
|
|
5b6f222e5e | ||
|
|
47235d01bf | ||
|
|
32efe83136 | ||
|
|
c4c099e693 | ||
|
|
f26ca0e624 | ||
|
|
5f496f1809 | ||
|
|
f1cbf8cc70 | ||
|
|
8b7fccb744 | ||
|
|
66d3486674 | ||
|
|
2dbd217f6d | ||
|
|
fea9ae8f97 | ||
|
|
4e81bbc43c | ||
|
|
83650b8f28 | ||
|
|
50a3501dd2 | ||
|
|
526a3fd139 | ||
|
|
3b996b3444 | ||
|
|
c72c9e4a5e | ||
|
|
60a71a5ac9 | ||
|
|
26c3ccccc3 | ||
|
|
963e25934d | ||
|
|
55d9f8a062 | ||
|
|
700c8ba21f | ||
|
|
cbc255b4e7 | ||
|
|
2fe1e5031e | ||
|
|
f2cdac7875 | ||
|
|
165405bdc3 | ||
|
|
f86d71524d | ||
|
|
4d6d59f1c5 | ||
|
|
7a709898e5 | ||
|
|
121bfc7913 | ||
|
|
a04ccec445 | ||
|
|
2611fc5e1a | ||
|
|
cd5c306b22 | ||
|
|
ca6a7819f6 | ||
|
|
29c0ea9856 | ||
|
|
c82ed58d68 | ||
|
|
59a3867c50 | ||
|
|
0fca4e6866 | ||
|
|
3f9e65a179 | ||
|
|
92bde9de6f | ||
|
|
9b3158599c | ||
|
|
206fb49df5 | ||
|
|
cc0ad9b04b | ||
|
|
39902dd8ac | ||
|
|
324e4ab89b | ||
|
|
68bf0a487f | ||
|
|
3acf7e0fd7 | ||
|
|
edaf13abe1 | ||
|
|
b3649a70ce | ||
|
|
80ab628643 | ||
|
|
76363c0142 | ||
|
|
80c18c2201 | ||
|
|
fcf9b86b87 | ||
|
|
1113a3d2f8 | ||
|
|
c899dbf893 | ||
|
|
be137b2a03 | ||
|
|
122d780fe8 | ||
|
|
12be027b18 | ||
|
|
dfeef40037 | ||
|
|
a7b4fe4dd0 | ||
|
|
f4ec64d6f5 | ||
|
|
9a0d39199e | ||
|
|
77d82d9511 | ||
|
|
5464b91cc6 | ||
|
|
64ff87952a | ||
|
|
0de39e4c52 | ||
|
|
60bc384d22 | ||
|
|
ca7ea0e143 | ||
|
|
23d50248de | ||
|
|
ad4e54a2f6 | ||
|
|
e659df27ae | ||
|
|
6dc3c06fe8 | ||
|
|
776956f166 | ||
|
|
4c5203acba | ||
|
|
d80070a041 | ||
|
|
1c00cb4c4e | ||
|
|
736505603e | ||
|
|
c243da79e1 | ||
|
|
2677f38090 | ||
|
|
41d05d2402 | ||
|
|
0f38584566 | ||
|
|
2b7fb8667e | ||
|
|
ca18846bfb | ||
|
|
4ba372d29b | ||
|
|
bdc2d24366 | ||
|
|
3de06c1d4c | ||
|
|
b51149d895 | ||
|
|
e0fef55366 | ||
|
|
e2aac5f94a | ||
|
|
8f44f84c7f | ||
|
|
d53a61ec86 | ||
|
|
cf18f79c14 | ||
|
|
beb8011b4c | ||
|
|
38a601b665 | ||
|
|
11a3483ce5 | ||
|
|
1db133b741 | ||
|
|
716dce0093 | ||
|
|
3b53442172 | ||
|
|
253d94a47d | ||
|
|
fb1129a49b | ||
|
|
1cc56d6e44 | ||
|
|
9e2983a735 | ||
|
|
a6fcba95de | ||
|
|
c8c535834e | ||
|
|
b8d7c2e3e3 | ||
|
|
0283d4727b | ||
|
|
a4ab732478 | ||
|
|
0dc121a796 | ||
|
|
a827131457 | ||
|
|
2174537f76 | ||
|
|
53fca2406a | ||
|
|
0eaba284ae | ||
|
|
378f359a76 | ||
|
|
5460d96b5d | ||
|
|
b1353edc84 | ||
|
|
9129fed6e5 | ||
|
|
7c4abacaca | ||
|
|
3664c7d81b | ||
|
|
f75b87c5a5 | ||
|
|
1c228216cd | ||
|
|
cec3c12795 | ||
|
|
0d0d12e85b | ||
|
|
3a16e69be5 | ||
|
|
4ae8e3909f | ||
|
|
6e18bb3b1d | ||
|
|
be153e13a6 | ||
|
|
4c01dfd0ab | ||
|
|
b57c7a1343 | ||
|
|
da62acdf50 | ||
|
|
cc95e4fc0a | ||
|
|
7f5647c6e1 | ||
|
|
c636d63bc0 | ||
|
|
30c98ef857 | ||
|
|
debecde50f | ||
|
|
cd2cdd1184 | ||
|
|
f5c25d75ff | ||
|
|
780cc62942 | ||
|
|
165568c905 | ||
|
|
976a48d8f9 | ||
|
|
35cbbbe0ed | ||
|
|
772769c981 | ||
|
|
1ba2bd1766 | ||
|
|
4afa345a7d | ||
|
|
5c03359f32 | ||
|
|
04120505f0 | ||
|
|
7bd9dd65f8 | ||
|
|
5f57ecb2e1 | ||
|
|
9123f1d805 | ||
|
|
7050c4a554 | ||
|
|
62afb0b534 | ||
|
|
5157ca5608 | ||
|
|
315617c027 | ||
|
|
7d33b4dec6 | ||
|
|
2345f69c71 | ||
|
|
3cef2fb4d5 | ||
|
|
2bbf5513b2 | ||
|
|
c146f06178 | ||
|
|
5903704b61 | ||
|
|
90d8db651b | ||
|
|
557283a3d1 | ||
|
|
88b84dcf75 | ||
|
|
45d190eaca | ||
|
|
6d32328509 | ||
|
|
ba470e7417 | ||
|
|
4a16e46f88 | ||
|
|
ada0d99a84 | ||
|
|
e486fc4316 | ||
|
|
6e5c6f4e0b | ||
|
|
21ddcaf173 | ||
|
|
6085b994f6 | ||
|
|
7c3bf05868 | ||
|
|
8bce5b4a09 | ||
|
|
7a6077301f | ||
|
|
3f2767462f | ||
|
|
ecc37d11df | ||
|
|
0589d151da | ||
|
|
47cd6c6410 | ||
|
|
65688f9e0e | ||
|
|
5eb2a95ef2 | ||
|
|
282b39d27a | ||
|
|
f21e3d317a | ||
|
|
c2af7cf8f2 | ||
|
|
0958a4c693 | ||
|
|
c687181130 | ||
|
|
685f1ec0b6 | ||
|
|
e0069b6f7d | ||
|
|
cf48762ff2 | ||
|
|
31a7545a19 | ||
|
|
5cd8e8fb97 | ||
|
|
96e4090174 | ||
|
|
0bbebab90b | ||
|
|
57dac0ef47 | ||
|
|
6c3d24551b | ||
|
|
e7dc6d7a5a | ||
|
|
a63b7f611e | ||
|
|
82e15dc36d | ||
|
|
6f96037cb5 | ||
|
|
b6da84b8b2 | ||
|
|
41209f074c | ||
|
|
c47964c942 | ||
|
|
5f13a634e5 | ||
|
|
40af520fe7 | ||
|
|
1e506e0f8c | ||
|
|
96ea5803d4 | ||
|
|
7d99459f50 | ||
|
|
8fa090f435 | ||
|
|
d3c60d197c | ||
|
|
ad8550f7f5 | ||
|
|
a899aa439d | ||
|
|
e0e075b350 | ||
|
|
34ff14547e | ||
|
|
681a80d456 | ||
|
|
ed5f2673ce | ||
|
|
43e87603e2 | ||
|
|
d056416b47 | ||
|
|
1bcf94131d | ||
|
|
17b607b6c3 | ||
|
|
5a16d1dd8b | ||
|
|
144b74306a | ||
|
|
16b9fa956d | ||
|
|
b6af4b9877 | ||
|
|
3f368e721d | ||
|
|
22b4257636 | ||
|
|
ca7a631032 | ||
|
|
da5bbd17af | ||
|
|
b58f3f5c3e | ||
|
|
8c30194f59 | ||
|
|
dc9ec37490 | ||
|
|
5175e77eec | ||
|
|
9553c5467c | ||
|
|
a1f07e3274 | ||
|
|
58deb2eb14 | ||
|
|
83caad7f1b | ||
|
|
26c3cc9126 | ||
|
|
1a231dfb0d | ||
|
|
712d0425d0 | ||
|
|
eaa5db517f | ||
|
|
88c3850d1b | ||
|
|
943df72ae9 | ||
|
|
67ab11a036 | ||
|
|
c87ef7526b | ||
|
|
bccf2d52ad | ||
|
|
be6dbdd3e4 | ||
|
|
3c34ee9897 | ||
|
|
9ad97813e3 | ||
|
|
028f04e47f | ||
|
|
4974c9247f | ||
|
|
1ffe6a11bf | ||
|
|
19699ea445 | ||
|
|
d98ccfb12a | ||
|
|
41cb056b0f | ||
|
|
48bda0bdea | ||
|
|
1b393c7b67 | ||
|
|
f52e518b7b | ||
|
|
08970cff88 | ||
|
|
6d38ca6453 | ||
|
|
60db4bc66b | ||
|
|
0661237b28 | ||
|
|
6ccac712a8 | ||
|
|
3d4877940c | ||
|
|
70fc95ef27 | ||
|
|
463f65d25c | ||
|
|
09d176c82e | ||
|
|
fce96baf3d | ||
|
|
c6785c533f | ||
|
|
64de021149 | ||
|
|
de9e17a1a0 | ||
|
|
987bccea2e | ||
|
|
1434b86b8f | ||
|
|
a398b2201f | ||
|
|
f015837c38 | ||
|
|
5b51588995 | ||
|
|
7383e521e5 | ||
|
|
b10f05786c | ||
|
|
a212351528 | ||
|
|
55c01af260 | ||
|
|
1cf6ffad2b | ||
|
|
00d0ab9de1 | ||
|
|
b38e60a9a7 | ||
|
|
29f7e46439 | ||
|
|
fa0add8564 | ||
|
|
5bec38c404 | ||
|
|
43b66b6507 | ||
|
|
7e370b3a23 | ||
|
|
2b270a3c9f | ||
|
|
cf0d9a2d3f | ||
|
|
5d70622819 | ||
|
|
fcebdb6d6f | ||
|
|
3d020b5159 | ||
|
|
530d1bcd03 | ||
|
|
a4151c2941 | ||
|
|
a801d30fb6 | ||
|
|
1fe9b605dd | ||
|
|
ecfd822d94 | ||
|
|
a5e4d68993 | ||
|
|
ca5c002d37 | ||
|
|
6e28760da4 | ||
|
|
a253c4edb5 | ||
|
|
7c96525d35 | ||
|
|
3f0457efc2 | ||
|
|
bfb241d995 | ||
|
|
314ad8c3f2 | ||
|
|
aa85371f82 | ||
|
|
d0a08dadd9 | ||
|
|
eeff764345 | ||
|
|
4870ec4f40 | ||
|
|
1c3cfbfa0c | ||
|
|
3c9b7de6c7 | ||
|
|
22e5488f16 | ||
|
|
b37887993e | ||
|
|
75361cb0ff | ||
|
|
894992bc4c | ||
|
|
d955fab169 | ||
|
|
580d225387 | ||
|
|
d48f59e48d | ||
|
|
108b49ea03 | ||
|
|
9295349886 | ||
|
|
a51658ffac | ||
|
|
47f08e9e04 | ||
|
|
7906ae63dc | ||
|
|
0e76271dba | ||
|
|
e117619e34 | ||
|
|
67b416fe80 | ||
|
|
78dbfa46fa | ||
|
|
01db9261d5 | ||
|
|
674c38b384 | ||
|
|
0700e824eb | ||
|
|
0362eaf472 | ||
|
|
696b3964e6 | ||
|
|
5d0c2eed7b | ||
|
|
e4c3289ad8 | ||
|
|
4449bdae6f | ||
|
|
064957db81 | ||
|
|
ccd89ef0a6 | ||
|
|
47beb5f41f | ||
|
|
9f205392a3 | ||
|
|
adce7ccbee | ||
|
|
b83b3a9437 | ||
|
|
147dbcf24f | ||
|
|
2afff1b41f | ||
|
|
d1a1be49c5 | ||
|
|
4b6ad647a2 | ||
|
|
04f656cafa | ||
|
|
09bbd5f6c9 | ||
|
|
dbc3df6d09 | ||
|
|
26865f92e3 | ||
|
|
73045de73d | ||
|
|
6d3491b9f1 | ||
|
|
886f3a3c08 | ||
|
|
c72f976895 | ||
|
|
ab8b381d8b | ||
|
|
443e29a3be | ||
|
|
117bb5717a | ||
|
|
5fb76baa16 | ||
|
|
274b3498d4 | ||
|
|
fa9e1c53e1 | ||
|
|
3ebf7eb424 | ||
|
|
7d11e6f9a5 | ||
|
|
a0d6384b01 | ||
|
|
47afe2cfc6 | ||
|
|
c37a2fc756 | ||
|
|
e2545276bb | ||
|
|
4219409ef8 | ||
|
|
c9e64d2a32 | ||
|
|
41db3b2e35 | ||
|
|
ebe15dada6 | ||
|
|
c2cb5dc574 | ||
|
|
ba451348c0 | ||
|
|
ec76b11666 | ||
|
|
7603f9e6c1 | ||
|
|
b50eab11c0 | ||
|
|
66d05c1771 | ||
|
|
fd7c3d7e10 | ||
|
|
28d4c7d808 | ||
|
|
43d36fbcf6 | ||
|
|
e54eef2369 | ||
|
|
296842858f | ||
|
|
ba8849a3e9 | ||
|
|
e333c3d8d9 | ||
|
|
0fe6a21624 | ||
|
|
0abedb81c6 | ||
|
|
08eda72d4b | ||
|
|
70d4126c84 | ||
|
|
dcccab705c | ||
|
|
e45ff6d026 | ||
|
|
b49c2314e7 | ||
|
|
0ac085756a | ||
|
|
542a690c89 | ||
|
|
ff23ead797 | ||
|
|
ae55e4fbf7 | ||
|
|
b17412163d | ||
|
|
46dcbf9a42 | ||
|
|
193dfcc32f | ||
|
|
a81011cf94 | ||
|
|
d43a8b2e11 | ||
|
|
dff859ba68 | ||
|
|
5169b6ee69 | ||
|
|
f4405667fe | ||
|
|
49ff636305 | ||
|
|
d77d686c76 | ||
|
|
502c6a3451 | ||
|
|
b58c77683d | ||
|
|
b9f82fc549 | ||
|
|
25b8dba607 | ||
|
|
1bc4f2c334 | ||
|
|
aee8ac6b0a | ||
|
|
aa7e30070f | ||
|
|
64b5855f65 | ||
|
|
d7ff9e706e | ||
|
|
15ba6f6261 | ||
|
|
8c88a880c6 | ||
|
|
74566cce7b | ||
|
|
16f6deed5e | ||
|
|
40edc131fe | ||
|
|
3e014b38e6 | ||
|
|
b4cfdbffab | ||
|
|
cbfb6f8f59 | ||
|
|
b5bc15ab8b | ||
|
|
0b343fc0f8 | ||
|
|
e7f9693873 | ||
|
|
a0a5c3185d | ||
|
|
151d4693a9 | ||
|
|
cdb27d8ec2 | ||
|
|
055e4d1261 | ||
|
|
bf753255ab | ||
|
|
e2230ef454 | ||
|
|
0f5b01b856 | ||
|
|
82787c96c6 | ||
|
|
f89028d5fe | ||
|
|
ba24a2e917 | ||
|
|
b549bbf46b | ||
|
|
1e87f58f36 | ||
|
|
f643426067 | ||
|
|
94d26c76ec | ||
|
|
8fe262a712 | ||
|
|
122ee968cb | ||
|
|
d2ff350db9 | ||
|
|
9100aabbac | ||
|
|
1e73f69253 | ||
|
|
7153cb4158 | ||
|
|
999dc6f8a5 | ||
|
|
724574afe7 | ||
|
|
0352a30b6b | ||
|
|
41b4cd5c55 | ||
|
|
89f16f3123 | ||
|
|
261a4eede3 | ||
|
|
f623b382f7 | ||
|
|
51537c619a | ||
|
|
3df943572f | ||
|
|
aa10804f6f | ||
|
|
981407f00f | ||
|
|
74f7098e0a | ||
|
|
c2e46bf16d | ||
|
|
78b26d2d40 | ||
|
|
e4d5be85f6 | ||
|
|
23b5601eeb | ||
|
|
859679ce09 | ||
|
|
71543c2351 | ||
|
|
edae5057c8 | ||
|
|
8dd450ded4 | ||
|
|
bc2061723e | ||
|
|
5753e37307 | ||
|
|
e74da70a9d | ||
|
|
737bbc225a | ||
|
|
9313551559 | ||
|
|
5b8f53f050 | ||
|
|
7358e4715b | ||
|
|
a9005d86d6 | ||
|
|
788c05d86e | ||
|
|
de6ba69631 | ||
|
|
4153fed250 | ||
|
|
c68b89831e | ||
|
|
01c9c5ed53 | ||
|
|
573fb135a7 | ||
|
|
0ee7256e37 | ||
|
|
9829ee558c | ||
|
|
34b563dd48 | ||
|
|
f6bb200146 | ||
|
|
af36e3a52c | ||
|
|
c50c7ae6ef | ||
|
|
61739d5ba1 | ||
|
|
34c4a6055e | ||
|
|
27dabdaf52 | ||
|
|
2ee3242f41 | ||
|
|
67ae9627af | ||
|
|
29f7e12df6 | ||
|
|
a4bb2c8268 | ||
|
|
6521c5f533 | ||
|
|
6925c18821 | ||
|
|
9269d94677 | ||
|
|
d438814ad6 | ||
|
|
bc205a350b | ||
|
|
6bf6fddd28 | ||
|
|
23f8eb9713 | ||
|
|
8ab3097328 | ||
|
|
644d0e6c2e | ||
|
|
6a69fdfbbf | ||
|
|
16e9a64941 | ||
|
|
f3cbc070ea | ||
|
|
df22526229 | ||
|
|
3739bdaa89 | ||
|
|
1f55f38bd2 | ||
|
|
c9deb0d88f | ||
|
|
eecfb39463 | ||
|
|
51bb27da42 | ||
|
|
9c0d296e87 | ||
|
|
0793e0bf8c | ||
|
|
e9ad88d50e | ||
|
|
fbe24c04b8 | ||
|
|
8a7d4d3be3 | ||
|
|
61c9a3bb93 | ||
|
|
3721a11f34 | ||
|
|
21039dec1f | ||
|
|
1393f565d8 | ||
|
|
1530e55f9d | ||
|
|
c982505f73 | ||
|
|
ec8c0d3e8b | ||
|
|
8cb0269676 | ||
|
|
27f460cfe3 | ||
|
|
e98e8d6a0d | ||
|
|
2f94662837 | ||
|
|
d46d6a9acd | ||
|
|
093d2cfa7c | ||
|
|
35b31a21dc | ||
|
|
8b9741a722 | ||
|
|
d5cfa9b0e9 | ||
|
|
129d1214fe | ||
|
|
abb3375c3a | ||
|
|
4cfa06b43f | ||
|
|
8fa80ac0f6 | ||
|
|
2d011c68df | ||
|
|
640ef4bdab | ||
|
|
cdd20c0b99 | ||
|
|
3a12123bf9 | ||
|
|
5657d5395b | ||
|
|
66b1108c5c | ||
|
|
7bf7e207c2 | ||
|
|
01098395ec | ||
|
|
3e21dfdc03 | ||
|
|
a400fb2362 | ||
|
|
44172aa359 | ||
|
|
82cab2827a | ||
|
|
a198eb1515 | ||
|
|
6e67cd6c97 | ||
|
|
e51e89df56 | ||
|
|
e46fd07d39 | ||
|
|
b2cf9aed83 | ||
|
|
c632030437 | ||
|
|
9dc683d289 | ||
|
|
6cef6190b1 | ||
|
|
75dd443d79 | ||
|
|
13dacb591d | ||
|
|
429bf5456e | ||
|
|
527c0f5015 | ||
|
|
527ab27bee | ||
|
|
7991403022 | ||
|
|
61d2e6c5e5 | ||
|
|
e005a3fc0c | ||
|
|
2dfb0fb59a | ||
|
|
70c011e7e2 | ||
|
|
8134322626 | ||
|
|
60152749bb | ||
|
|
b257e120d4 | ||
|
|
6dc75acd21 | ||
|
|
a04400170c |
+17
-2
@@ -1,4 +1,4 @@
|
|||||||
25
|
31
|
||||||
1.4.2
|
1.4.2
|
||||||
1.6.2
|
1.6.2
|
||||||
1.11.2
|
1.11.2
|
||||||
@@ -8,5 +8,20 @@
|
|||||||
2.8.2
|
2.8.2
|
||||||
3.2.2
|
3.2.2
|
||||||
3.2.3
|
3.2.3
|
||||||
|
3.3.2
|
||||||
|
3.6.2
|
||||||
|
3.6.3
|
||||||
|
3.6.4
|
||||||
|
3.7.2
|
||||||
|
3.7.3
|
||||||
|
3.9.2
|
||||||
|
3.9.3
|
||||||
|
3.10.2
|
||||||
|
4.0.2
|
||||||
|
4.0.3
|
||||||
|
4.6.2
|
||||||
|
4.7.2
|
||||||
|
4.9.2
|
||||||
|
4.11.2
|
||||||
|
|
||||||
3.3.2
|
4.16.2
|
||||||
@@ -24,8 +24,6 @@ module.exports = {
|
|||||||
...base.rules,
|
...base.rules,
|
||||||
// add override for any (a metric ton of them, initial conversion)
|
// add override for any (a metric ton of them, initial conversion)
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
// these should be removed, there are 8 of them as errors
|
|
||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
||||||
// this seems very broken atm, false positives
|
// this seems very broken atm, false positives
|
||||||
'@typescript-eslint/unbound-method': 'off'
|
'@typescript-eslint/unbound-method': 'off'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
name: 'Lock Threads'
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '30 1/2 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lock:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: dessant/lock-threads@v2
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GH_PAT_BOT }}
|
||||||
|
issue-lock-inactive-days: '7'
|
||||||
|
issue-lock-comment: >
|
||||||
|
This thread has been automatically locked since there has not been
|
||||||
|
any recent activity after it was closed. Please open a new issue
|
||||||
|
if you think you have a related problem or query.
|
||||||
|
pr-lock-inactive-days: '2'
|
||||||
|
pr-lock-comment: >
|
||||||
|
This pull request has been automatically locked since there
|
||||||
|
has not been any recent activity after it was closed.
|
||||||
|
Please open a new issue for related bugs.
|
||||||
@@ -6,11 +6,11 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
master:
|
master:
|
||||||
|
if: "! startsWith(github.event.head_commit.message, '[CI Skip]')"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
step: ['build:release']
|
step: ['build:release']
|
||||||
name: ${{ matrix.step }}
|
name: ${{ matrix.step }}
|
||||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && github.repository == 'polkadot-js/api'"
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -25,10 +25,3 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
yarn install --immutable | grep -v 'YN0013'
|
yarn install --immutable | grep -v 'YN0013'
|
||||||
yarn ${{ matrix.step }}
|
yarn ${{ matrix.step }}
|
||||||
|
|
||||||
dummy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: dummy
|
|
||||||
run: |
|
|
||||||
echo "Dummy skip step"
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
name: Semgrep
|
||||||
|
on:
|
||||||
|
pull_request: {}
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: returntocorp/semgrep-action@v1
|
||||||
|
with:
|
||||||
|
auditOn: push
|
||||||
|
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
|
||||||
|
publishDeployment: 1395
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: 'Close stale issues and PRs'
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '30 2/2 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stale:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/stale@v3
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GH_PAT_BOT }}
|
||||||
|
stale-issue-message: 'This issue has been open for 21 days with no activity and is not labelled as an enhancement. It will be closed in 7 days.'
|
||||||
|
stale-issue-label: 'stale'
|
||||||
|
exempt-issue-labels: '-size-l,-size-m,-size-s,-size-xl,-size-xs,[bug]'
|
||||||
|
days-before-stale: 21
|
||||||
|
days-before-close: 7
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
build
|
||||||
|
coverage
|
||||||
|
packages
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
module.exports = require('@polkadot/dev/config/prettier.cjs');
|
||||||
+7
-9
File diff suppressed because one or more lines are too long
+7
-9
File diff suppressed because one or more lines are too long
Vendored
-55
File diff suppressed because one or more lines are too long
+591
File diff suppressed because one or more lines are too long
+1
-1
@@ -10,4 +10,4 @@ plugins:
|
|||||||
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
||||||
spec: "@yarnpkg/plugin-version"
|
spec: "@yarnpkg/plugin-version"
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-2.4.0.cjs
|
yarnPath: .yarn/releases/yarn-3.0.0-rc.2.cjs
|
||||||
|
|||||||
+566
@@ -1,5 +1,571 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 4.16.2 Jun 27, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for Polkadot with runtime >= 9050.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Correct `CompactAssignments` & `RawSolution` types for Polkadot
|
||||||
|
|
||||||
|
|
||||||
|
## 4.16.1 Jun 26, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for full from-genesis queries on Kusama.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Adjust types for uniques (Thanks to https://github.com/Yuripetusko)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Add Kusama, Polkadot & Westend 9050 upgrade blocks
|
||||||
|
- Add Kusama & Westend 9070 upgrade blocks
|
||||||
|
- Adjust API decoration to lazy-create event and storage types
|
||||||
|
- Use TS `override` as applicable (with `--noImplicitOverrides` option)
|
||||||
|
- Add missing historic `Heartbeat: HeartbeatTo244` mapping to Kusama
|
||||||
|
- Remove duplication from contracts registry
|
||||||
|
- Add explicit check for scale-info 0.7+ (contracts index lookups)
|
||||||
|
- Align static metadata with latest Substrate
|
||||||
|
|
||||||
|
|
||||||
|
## 4.15.1 Jun 19, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Medium. Recommended for all chains where Xcm is used (addition of new `XcmOrigin`)
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Added `ChargeAssetTxPayment` extension (Thanks to https://github.com/apopiak)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Allow for type decoding of nested fixed vectors, tuples and structs
|
||||||
|
- Added `childstate_getKeysPaged` RPC
|
||||||
|
- Add `XcmOrigin` mapping for `OriginCaller` generation
|
||||||
|
- Align static metadata with latest Substrate
|
||||||
|
- Adjust error message for contracts V3 (extrinsic from runtime)
|
||||||
|
- Correct module optionality in `api.derive.balances.account`
|
||||||
|
- Add alias for `GenericAddress` -> `GenericMultiAddress`
|
||||||
|
- Adjust metadata doc generation (keep spaces between subsequent lines)
|
||||||
|
|
||||||
|
|
||||||
|
## 4.14.1 Jun 14, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Internal adjustment only, no major external usage changes.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Adjust types for uniques (Thanks to https://github.com/hamidra)
|
||||||
|
- Add `ValidationCodeHash` type (Thanks to https://github.com/andresilva)
|
||||||
|
- Extend `OriginCaller` type creation (Thanks to https://github.com/xlc)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Do strict length checking on `[u8; <length>]` type inputs
|
||||||
|
- Adjust keys/entries retrieval batch sizes
|
||||||
|
- Add upgrade block for Kusama 9040
|
||||||
|
- Use `BN` imports from `@polkadot/util`
|
||||||
|
|
||||||
|
|
||||||
|
## 4.13.1 Jun 6, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Medium. Required for users connecting to Statemine and future Kusama upgrades.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Overrides for `westmint` spec (same as `statemint`)
|
||||||
|
- Adjust `tx.session.setKeys` TS augmentation to allow `string` & `Uint8Array` keys
|
||||||
|
- Add & adjust types for latest Cumulus code
|
||||||
|
- Added 9031-9033 upgrade block for Westend
|
||||||
|
- Update static metadata to latest Substrate
|
||||||
|
- Optimize map retrieval with split page sizes for keys & values
|
||||||
|
- Sanitizing `BN` imports to `type`-only as required
|
||||||
|
|
||||||
|
|
||||||
|
## 4.12.1 May 30, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Internal adjustment only, no major external usage changes.
|
||||||
|
|
||||||
|
Changelog:
|
||||||
|
|
||||||
|
- Update `FundInfo` type with Polkadot (Thanks to https://github.com/arjanz)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Allow storage queries with default keys values
|
||||||
|
- Align identity `Data` to limit to 32 bytes in the `Raw` enum (as per Substrate)
|
||||||
|
- Align static (test & docs-only) metadata with latest Substrate master
|
||||||
|
- Added 9030 upgrade blocks for Kusama & Westend
|
||||||
|
- Cleanup of Eth pallet RPC definitions
|
||||||
|
- Cleanup README for `@polkadot/rpc-core` (recommended for internal-usage only)
|
||||||
|
- Cleanup internal tests (no dangling handles, cater for Jest 27)
|
||||||
|
|
||||||
|
|
||||||
|
## 4.11.2 May 24, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended where users are having TS mismatches with type definitions created on older versions.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Add backwards-compatible TS-only `AugmentedQueryDoubleMap` type (unused now in type generation)
|
||||||
|
|
||||||
|
|
||||||
|
## 4.11.1 May 23, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for users using staking entries on Polkadot and users of Substrate master.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Fix metadata v13 storage decoding on `NMap`
|
||||||
|
- Add augmentation & keys/entries for NMap types
|
||||||
|
- Return additional error information from internal u8a decoding failures
|
||||||
|
- Adjust Westend types for 16 nominators-only
|
||||||
|
- Add support for `DisallowSigned` (as per shell runtime) extension
|
||||||
|
- Display small hex-slice with u8a decoding failures
|
||||||
|
- Add `state_getChildReadProof` RPC
|
||||||
|
- Cleanup Rococo known types (only as used)
|
||||||
|
- Under Node.js allow for WS receiving up to 16MB messages
|
||||||
|
- Update entries/keys for max of 256 items per call
|
||||||
|
|
||||||
|
|
||||||
|
## 4.10.1 May 17, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Medium. Recommended for uses of Polkadot/Kusama 9010 runtimes.
|
||||||
|
|
||||||
|
- **Breaking change** Support for the contracts V2 compatibility has been dropped in `@polkadot/api-contract`
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Expose RPC definitions via `.meta` (Thanks to https://github.com/jiqiang90)
|
||||||
|
- Adjust staking derives for chain-specific optional fields (https://github.com/WoeOm)
|
||||||
|
- Update base Centrifuge types (Thanks to https://github.com/branan)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Allow for `Bounded*` type usage (as per latest Substrate)
|
||||||
|
- Adjust internal TS definitions for providers
|
||||||
|
- Fix `ContractRx` query result definitions (no extra Observable)
|
||||||
|
- Handle contract call RPC result directly as `Raw` (returned as hex)
|
||||||
|
- Use `BN_*` constants as non-specified defaults in contract interfaces
|
||||||
|
- Remove all type overrides for node/node-template (API tracks latest)
|
||||||
|
- Contracts ABI now supports metadata version where indexes are 0-based
|
||||||
|
- Remove support for the old-style V2 contracts from `@polkadot/api-contract`
|
||||||
|
- Adjust historic decoration, return as-at registry via `getHeader`, `getMetadata` & `getRuntimeVersion`
|
||||||
|
- Adjust `VecFixed` to allow for the handling of hex inputs
|
||||||
|
- Adjust `Compact<*>` to allow for wrapped `toBigInt()` conversions
|
||||||
|
- Fix `isPedantic` decoding to correctly handle `Text`
|
||||||
|
- Cater for new `phragmenElection` module naming
|
||||||
|
- Add Kusama & Westend 9010 upgrade blocks
|
||||||
|
- Adjust `CompactSolution` for 24 nominators
|
||||||
|
- Bump static metadata to latest Substrate
|
||||||
|
|
||||||
|
|
||||||
|
## 4.9.1 May 6, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Medium. Required for the next v0.9.0 Polkadot/Kusama chain upgrades where parachains are used.
|
||||||
|
|
||||||
|
- **Breaking change** The previously deprecated contracts interfaces, has been removed. Update to `<myContract>.query.*`, `<myContract>.tx.*` and `<myCode>.tx.*` interfaces as per the previous code usage hints.
|
||||||
|
- **Important** By default the `isPedantic` mode is now switched on for storage queries. This means that the API will fail on any types where the input/output decoding doesn't match 100%
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Re-add isPedantic check on storage decoding
|
||||||
|
- `ConsensusEngineId` now implements `[u8;4]` (mapping closer to Rust source)
|
||||||
|
- Additional Xcm types
|
||||||
|
- Adjust parachain types
|
||||||
|
- Remove error logging on createType (details passed in error)
|
||||||
|
- Adjust `ContractInfo` type as per latest Substrate
|
||||||
|
- Adjust `DigestItem` type as per latest Substrate
|
||||||
|
- Adjust re-encoding of `BitVec` based on decoded length
|
||||||
|
- Added `contracts_instantiate`, `state_traceBlock` & `system_reservedPeers` RPCs
|
||||||
|
- Prepare for auto-capability detection with historic `.at` queries
|
||||||
|
- Add known upgrade block for Westend 900 & 9000
|
||||||
|
- Remove all deprecated interfaces inside `@polkadot/api-contracts`
|
||||||
|
- Initial support for NMap storage keys
|
||||||
|
- Support metadata v13 from Substrate (upcoming upgrade)
|
||||||
|
- Optimize historic metadata retrieval from rpc core
|
||||||
|
|
||||||
|
|
||||||
|
## 4.8.1 May 2, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended when using or developing for parachains.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- De-alias xcm `Outcome` (used in multiple pallettes)
|
||||||
|
- Adjust xcm types as per latest, e.g. `XcmError`
|
||||||
|
- Fix generate of well-known storage keys (e.g. `:code`)
|
||||||
|
- Optimize metadata unknown type validation
|
||||||
|
- Allow metadata creation for `Map` or `Record`
|
||||||
|
- Expose additional camelCase `method` on `AbiMessage` (maps to decorated name)
|
||||||
|
- Added explicit double-byte ss58 `AccountId` encoding test
|
||||||
|
- Add known upgrade block for Polkadot v30
|
||||||
|
- Cleanup WebSocket handlers when close event has been received
|
||||||
|
- Update to latest Substrate metadata
|
||||||
|
|
||||||
|
|
||||||
|
## 4.7.2 Apr 26, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for users of 4.7.1 using nvm
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Update `EthBlock`/`EthHeader` types (as per Rust origin)
|
||||||
|
- Updated Xcm `OriginKind` enum
|
||||||
|
- Add derives for `membership`
|
||||||
|
- Cleanups on encodedLength calculations
|
||||||
|
- Update `.nvmrc` to reflect engines changes
|
||||||
|
|
||||||
|
|
||||||
|
## 4.7.1 Apr 25, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for users following Substrate master.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Adjust Struct decoding with better error messages on invalid input objects
|
||||||
|
- Add support for new `BoundedVec` type
|
||||||
|
- Expand `Data` type (as used in identity), with all is/as getters
|
||||||
|
- Updated `Xcm` types (with Plularity)
|
||||||
|
- Adjust `DispatchError` type as per current Substrate master
|
||||||
|
- Adjusted Statemint `Proxy` type
|
||||||
|
- Remove metadata generation dependency on well-known.json (dedupe)
|
||||||
|
- Adjust WebSocket reconnection delay from 1s to 2.5s
|
||||||
|
- Revert Beefy keys addition for Westend
|
||||||
|
- Add explicit `engines` config to `package.json`
|
||||||
|
- Support for `None` in `RewardDestination`
|
||||||
|
- Align with latest substrate metadata
|
||||||
|
|
||||||
|
|
||||||
|
## 4.6.2 Apr 19, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for users of Kusama/Polkadot.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Correct Kusama/Polkadot runtime 30 session key definitions
|
||||||
|
|
||||||
|
|
||||||
|
## 4.6.1 Apr 19, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended if used in a Node.js 15.x environment.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Assert keypair validity in signing operations
|
||||||
|
- Expose `internalError` on submittable results (e.g. event decoding errors)
|
||||||
|
- Simplify session derives for old/new
|
||||||
|
- Add Statemint to known types
|
||||||
|
- Add support for `rpc.beefy.subscribeJustifications`
|
||||||
|
- Update Xcm types
|
||||||
|
- Explicitly handle `isReadyOrError` with `Api.create`
|
||||||
|
- Add Kusama upgrade block for 2030
|
||||||
|
|
||||||
|
|
||||||
|
## 4.5.1 Apr 12, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended with usage with the Rococo testnet.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Update parachain types as per latest Polkadot
|
||||||
|
- Cater for `Keys` with `BEEFY` session keys
|
||||||
|
- Update `Keys` injection to allow for on-chain type detection
|
||||||
|
- Add `Westend` known upgrade block for runtime 50
|
||||||
|
- Align types with latest Substrate master
|
||||||
|
- Adjust keepalive `system_health` timer
|
||||||
|
|
||||||
|
|
||||||
|
## 4.4.1 Apr 5, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended with usage with the Rococo testnet.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Add `ServiceQuality` type for Cumulus
|
||||||
|
- Adjust XCM MultiLocation type (X5 to X8 junctions)
|
||||||
|
- Add Polkadot 29 upgrade block
|
||||||
|
|
||||||
|
|
||||||
|
## 4.3.1 Mar 29, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Fix documentation on ABI parameters (Thanks to https://github.com/vminkov)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Warn on usage of deprecated contract interfaces
|
||||||
|
- Update `ParaInfo` type
|
||||||
|
- Council should be optional in treasury derives
|
||||||
|
- Allow extraction of session derives indexes with no staking
|
||||||
|
|
||||||
|
|
||||||
|
## 4.2.1 Mar 22, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended when tracking the latest updates from Substrate.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Fix contract even decoding on Substrate 3 (Thanks to https://github.com/vminkov)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Adjust `Extender{Header, SignedBlock}` types to ensure at-block `Header` types are used
|
||||||
|
- Explicit definition for new Rococo triple refcount `AccountData` types
|
||||||
|
- Convert metadata private class fields to ES-private
|
||||||
|
- Adjust `SignedBlock` type for new `justifications` field
|
||||||
|
- Optimize society derive for multi accounts
|
||||||
|
- Bump metadata to latest substrate version
|
||||||
|
|
||||||
|
|
||||||
|
## 4.1.1 Mar 15, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended when tracking the latest updates from Substrate.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Fix author extraction for last block in a session
|
||||||
|
- Expand `SignerPayload` to inject/expose custom signed extensions
|
||||||
|
- `ConsensusEngineId` formats non-Ascii engines correctly
|
||||||
|
- Allow `getBlock/Header` derives to use as-at registry (instead of latest)
|
||||||
|
- Cleanup `RpcCore` augmentation (removing TS warnings on typegen chains)
|
||||||
|
- Add upgrade block for Kusama 2029
|
||||||
|
- Ensure that type alias overrides also apply to map keys
|
||||||
|
- Check type generation against fallbacks (build-time only sanity check)
|
||||||
|
- Add `mmr_generateProof` RPC
|
||||||
|
- Align types with latest substrate master
|
||||||
|
- Apply latest Polkadot auctions/crowdloan/parachains/slots types
|
||||||
|
|
||||||
|
|
||||||
|
## 4.0.3 Mar 8, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended if you use the API to sync the full chain, most notably Polkadot.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Re-add unused historical `SudoBalances` to `ProxyType` (Thanks to https://github.com/emostov)
|
||||||
|
|
||||||
|
|
||||||
|
## 4.0.2 Mar 8, 2021
|
||||||
|
|
||||||
|
Upgrade priority: High. Required if you are using 4.0.1 in a Node.js environment.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Fix import from `@polkadot/x-rxjs` in Node environments (From common)
|
||||||
|
- Add correct types for `Phase` is new validator elections module
|
||||||
|
|
||||||
|
|
||||||
|
## 4.0.1 Mar 7, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
|
||||||
|
|
||||||
|
**Important** In the 4.0 version the default package type has been changed to ESM modules by default. This should not affect usage, however since the output formats changed, a new major version is required.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Expose `unknownTypes` on the registry interface (Thanks to https://github.com/ii-ii-ii)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Build to ESM by default (with cjs versions via export map)
|
||||||
|
- Enum `.toSON()` now encodes all keys as `camelCase` (aligning with the output from Substrate)
|
||||||
|
- Add `createdAtHash?: Hash` to `Codec` interface (filled-in by storage retrievals)
|
||||||
|
- Expose the source hash as `wamHash` on Abi parsed instances
|
||||||
|
- Use `parentHash` when creating mortal era (handles frequent forks better)
|
||||||
|
- Add `AccountInfoWithTripleRefCount` to cater for latest Substrate
|
||||||
|
- Add upgrade block for Westend 49
|
||||||
|
|
||||||
|
|
||||||
|
## 3.11.1 Feb 28, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Clean Websocket states on disconnects (Thanks to https://github.com/ianhe8x)
|
||||||
|
- Support for C-like indexed enums (Thanks to https://github.com/xlc)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Adjust council derives to cater for current-generation candidate mapping
|
||||||
|
- Allow for override of codec hasher (& output type)
|
||||||
|
- Adjust submittables to submit hex-encoded addresses to queries
|
||||||
|
- Adjust initialization to always retrieve tx version from Metadata only
|
||||||
|
- Update election types as per latest Substrate
|
||||||
|
- Add types for the new gilt module
|
||||||
|
- Upgrade to the latest Substrate metadata
|
||||||
|
- Adjust package detection to check for local monorepo dependencies
|
||||||
|
- Ensure that metadata `.toJSON()` does apply type aliasses
|
||||||
|
|
||||||
|
|
||||||
|
## 3.10.2 Feb 23, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Medium. Recommended for users of chains where `MultiAddress` is in-use and blocks are decoded.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Fix decoding for `MultiAddress` enum where non-`AccountId` variable-lengths are provided as part of a stream
|
||||||
|
- Added known Polkadot 28 upgrade block
|
||||||
|
- Update for latest Substrate contracts `Schedule` types
|
||||||
|
|
||||||
|
|
||||||
|
## 3.10.1 Feb 22, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Adjust ConsumedWeight types to align with Rust module code
|
||||||
|
- Check for connection status in subscription unsubscribe
|
||||||
|
- Adjust staking reward derives ordering for better performance
|
||||||
|
- Adapt detection imports to remove `.json` dependencies (Better behavior using Node.js with ESM)
|
||||||
|
|
||||||
|
|
||||||
|
## 3.9.3 Feb 16, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for parachain builders since it contains the updated parachain types.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Adjusted parachain `PersistedValidationData` structure
|
||||||
|
|
||||||
|
|
||||||
|
## 3.9.2 Feb 15, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for parachain builders since it contains the latest parachain types.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Update README links (Thanks to https://github.com/wirednkod)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Added missing Culmulus `ParachainInherentData` & `MessageQueueChain` types
|
||||||
|
- Add alias for `system_unstable_networkState` RPC
|
||||||
|
|
||||||
|
|
||||||
|
## 3.9.1 Feb 14, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low.
|
||||||
|
|
||||||
|
- **Important** The `Result<T, E>` has been updated in the generation and the base types to follow the Rust version 100%. This means `{as, is}Error` is now available as `{as, is}Err` on the `Result` type. The older versions can still be used, but the `*Error` interfaces are now marked as deprecated.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Adjust `Result<T, E>` interface to be 100% compatible with the Rust version
|
||||||
|
- Add the `2028` upgrade to the known upgrades (optimizing certain `.at` queries)
|
||||||
|
- Adjust council derives to cater for latest Substrate & Polkadot
|
||||||
|
- Adjust Rococo know type definitions to cater for the latest update
|
||||||
|
- Update types for latest Polkadot/Substrate
|
||||||
|
- Add generic arguments for TypeScript users to `.entries/.keys` to deal with the key typings
|
||||||
|
|
||||||
|
|
||||||
|
## 3.8.1 Feb 7, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for users of the latest Substrate master, especially using contracts.
|
||||||
|
|
||||||
|
- **Important** The `api-contract` `Code` now supports deploying the code and a contract in on operation. This aligns with the latest Substrate where code cannot be uploaded with a contract. The `createBlueprint` is therefore deprecated, use `code.tx.<constructor>(...)` to deploy code. (Compatible with both old and new versions of Substrate)
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Add support for latest Frontier RPCs (Thanks to https://github.com/jnaviask)
|
||||||
|
- Fix user-supplied signed extensions type signature (Thanks to https://github.com/ntduan)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Expand `api-contract` to allow for `Code` to deploy contract alongside code. `createBlueprint` is now deprecated, replaced by `createContract` or the preferred `code.tx.<constructor>`, which uploads and deploys the code in one operation. This aligns with the current Substrate master contracts implementation.
|
||||||
|
- Allow for signed extensions to be supplied inside type bundles
|
||||||
|
- Ensure that the auto-connect state is checked on auto-connections (respecting disconnect)
|
||||||
|
- Added `CancelProxy` to `ProxyTypes on Polkadot, Kusama & Westend
|
||||||
|
- Updated to latest Substrate metadata
|
||||||
|
|
||||||
|
|
||||||
|
## 3.7.3 Feb 2, 2021
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Added Polkadot upgrade block for runtime 27 (known checkpoint optimization)
|
||||||
|
|
||||||
|
|
||||||
|
## 3.7.2 Feb 2, 2021
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Adjusted the `Keys` type for the 28 runtime on Kusama, Polkadot & Westend
|
||||||
|
|
||||||
|
|
||||||
|
## 3.7.1 Feb 1, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. However recommended for current Substrate master, Polkadot and Rococo users and those wishing to support the upcoming Polkadot 28 runtime with the new `MultiAddress`.
|
||||||
|
|
||||||
|
- **Breaking change** As indicated in the 3.5.1 release notes, the `Address`/`LookupSource` defaults have now been adjusted for `MultiAddress`. If your chain does not use these types, explicitly add the correct `Address`/`LookupSource` types. This new extensible format is mean to cater for all address types into the future, removing a lot of discrepancies between chains.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Extraction of the block author on Moonbeam (Thanks to https://github.com/joelamouche)
|
||||||
|
- Cleanup logs with HTTP providers, no subs (Thanks to https://github.com/Tbaut)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Allow `.slice` operator on the `Vec` type
|
||||||
|
- Apply `MultiAddress` as a default
|
||||||
|
- Adds support for the upcoming Polkadot 28 and Kusama 2028 runtimes
|
||||||
|
- Add checkpoint for Kusama 2027 upgrade
|
||||||
|
- Update all parachain types (as per latest Rococo)
|
||||||
|
- Correctly use relay blockNumber in parachain validation data
|
||||||
|
- remove information log for capabilities detection (creates confusion)
|
||||||
|
- Remove explicit references to `global`, use the `x-global` detection
|
||||||
|
- Remove explicit `module` in `package.json` (exports map available)
|
||||||
|
|
||||||
|
|
||||||
|
## 3.6.1 Jan 24, 2020
|
||||||
|
|
||||||
|
Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it.
|
||||||
|
|
||||||
|
- **Breaking change** To support chains with multiple tokens, such as bridges, the `ChainProperties` type now returns an array of tokens and decimals (instead of singular values) in the `token{Decimals, Symbol}` getters. Additionally, this means that the `registry` interfaces has been changes, to `registry.chainDecimals: number[]` and `registry.chainTokens: string[]`. Where used the `[0]` index will return the first value if only interested in a single, for a straight conversion.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Allow for the detection of on-chain capabilities as available (e.g. `AccountData`, `ValidatorPrefs`)
|
||||||
|
- Cater for multiple tokens and decimals in the chain the chain `system.properties` (as per the chain specification)
|
||||||
|
- Add a `instances: { [key]: [module1, module2] }` definition in teh bundle types, allowing for multiple instances (e.g. Balances)
|
||||||
|
- Adjust the `api-derive` for balances to retrieve values via `instances` as well as across multiple modules
|
||||||
|
- Ensure all types are registered for all metadata typegen steps
|
||||||
|
- Add `rpc.payment.queryFeeDetails` RPC endpoint
|
||||||
|
- Update types & metadata to latest Substrate
|
||||||
|
- Move the `@polkadot/x-rxjs` package into the common repo
|
||||||
|
- Allow doc generation for errors/events (markdown outputs)
|
||||||
|
|
||||||
|
|
||||||
|
## 3.5.1 Jan 18, 2020
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for parachain developers.
|
||||||
|
|
||||||
|
- **Important** The default for Substrate on the Address types are `MultiAddress`. It is recommended that chains add explicit definitions for `Address` and `LookupSource` in their types, instead of relying on the API-defaults. A future update will swap the API defaults to align with Substrate.
|
||||||
|
- **Important** Like the above changes in Substrate, the `AccountInfo` structure has also changed. It is recommended that chain developers explicitly add `AccountInfo: 'AccountInfoWithRefCount'` for the version with `refCount` on and `AccountInfoWithProviders` for the latest Substrate version. As per the above, the API defaults will be changed to align with Substrate.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Apply correct TypeScript type for `toBigInt()` (Thanks to https://github.com/ianhe8x)
|
||||||
|
- Expand type definitions for storage key tuples (Thanks to https://github.com/monitz87)
|
||||||
|
- Adjust bounty derive to cater for non-council chains (Thanks to https://github.com/ekowalsk)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Remove recursion in vector/struct U8a stream decoding
|
||||||
|
- Availability of staking made optional in session length calcs (era does require it)
|
||||||
|
- Updates to parachain types, ensuring it has coverage for all the latest
|
||||||
|
- Update all Rococo types to the latest (session keys, session reports, parachain indexes)
|
||||||
|
- Update known upgrade checkpoints fo WestEnd
|
||||||
|
- Add types of the lottery module in Substrate
|
||||||
|
- Add and extend types for the crowdloan module in Polkadot
|
||||||
|
- Adjust node-template to default to `MultiAddress` on specVersion >= 100
|
||||||
|
|
||||||
|
|
||||||
## 3.4.1 Jan 11, 2020
|
## 3.4.1 Jan 11, 2020
|
||||||
|
|
||||||
Upgrade priority: Low. Fixes for parachain types, `.entries()` (with no values) and `event.is(...)` checks, users of these interfaces will have benefit.
|
Upgrade priority: Low. Fixes for parachain types, `.entries()` (with no values) and `event.is(...)` checks, users of these interfaces will have benefit.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# @polkadot/api
|
# @polkadot/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/).
|
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/docs/api/).
|
||||||
|
|
||||||
If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.md) and [UPGRADING](UPGRADING.md) guides when changing versions.
|
If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.md) and [UPGRADING](UPGRADING.md) guides when changing versions.
|
||||||
|
|
||||||
@@ -21,8 +21,8 @@ The API is split up into a number of internal packages -
|
|||||||
|
|
||||||
- [@polkadot/api](packages/api/) The API library, providing both Promise and RxJS Observable-based interfaces. This is the main user-facing entry point.
|
- [@polkadot/api](packages/api/) The API library, providing both Promise and RxJS Observable-based interfaces. This is the main user-facing entry point.
|
||||||
- [@polkadot/api-derive](packages/api-derive/) Derived results that are injected into the API, allowing for combinations of various query results (only used internally and exposed on the Api instances via `api.derive.*`)
|
- [@polkadot/api-derive](packages/api-derive/) Derived results that are injected into the API, allowing for combinations of various query results (only used internally and exposed on the Api instances via `api.derive.*`)
|
||||||
- [@polkadot/api-metadata](packages/api-metadata/) Base extrinsic, storage and constant injectors for injection
|
- [@polkadot/metadata](packages/metadata/) Base extrinsic, storage and constant injectors for injection
|
||||||
- [@polkadot/rpc-core](packages/rpc-core/) Wrapper around all [JSON-RPC methods](https://polkadot.js.org/api/substrate/rpc.html) exposed by a Polkadot network client
|
- [@polkadot/rpc-core](packages/rpc-core/) Wrapper around all [JSON-RPC methods](https://polkadot.js.org/docs/substrate/rpc) exposed by a Polkadot network client
|
||||||
- [@polkadot/rpc-provider](packages/rpc-provider/) Providers for connecting to nodes, including WebSockets and Http
|
- [@polkadot/rpc-provider](packages/rpc-provider/) Providers for connecting to nodes, including WebSockets and Http
|
||||||
|
|
||||||
Type definitions for interfaces as exposed by Polkadot & Substrate clients -
|
Type definitions for interfaces as exposed by Polkadot & Substrate clients -
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
const config = require('@polkadot/dev/config/jest.cjs');
|
const config = require('@polkadot/dev/config/jest.cjs');
|
||||||
|
|
||||||
module.exports = Object.assign({}, config, {
|
module.exports = {
|
||||||
|
...config,
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'@polkadot/api-(contract|derive)(.*)$': '<rootDir>/packages/api-$1/src/$2',
|
'@polkadot/api-(contract|derive)(.*)$': '<rootDir>/packages/api-$1/src/$2',
|
||||||
// eslint-disable-next-line sort-keys
|
// eslint-disable-next-line sort-keys
|
||||||
@@ -13,8 +14,7 @@ module.exports = Object.assign({}, config, {
|
|||||||
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
|
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
|
||||||
'@polkadot/types-known(.*)$': '<rootDir>/packages/types-known/src/$1',
|
'@polkadot/types-known(.*)$': '<rootDir>/packages/types-known/src/$1',
|
||||||
// eslint-disable-next-line sort-keys
|
// eslint-disable-next-line sort-keys
|
||||||
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1',
|
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
|
||||||
'@polkadot/x-rxjs(.*)$': '<rootDir>/packages/x-rxjs/src/$1'
|
|
||||||
},
|
},
|
||||||
modulePathIgnorePatterns: [
|
modulePathIgnorePatterns: [
|
||||||
'<rootDir>/packages/api/build',
|
'<rootDir>/packages/api/build',
|
||||||
@@ -25,8 +25,8 @@ module.exports = Object.assign({}, config, {
|
|||||||
'<rootDir>/packages/rpc-provider/build',
|
'<rootDir>/packages/rpc-provider/build',
|
||||||
'<rootDir>/packages/typegen/build',
|
'<rootDir>/packages/typegen/build',
|
||||||
'<rootDir>/packages/types/build',
|
'<rootDir>/packages/types/build',
|
||||||
'<rootDir>/packages/types-known/build',
|
'<rootDir>/packages/types-known/build'
|
||||||
'<rootDir>/packages/x-rxjs/build'
|
|
||||||
],
|
],
|
||||||
resolver: '@polkadot/dev/config/jest-resolver.cjs'
|
testTimeout: 10000,
|
||||||
});
|
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
|
||||||
|
};
|
||||||
+10
-10
@@ -8,7 +8,7 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.3.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||||
@@ -20,19 +20,19 @@
|
|||||||
"lint": "polkadot-dev-run-lint",
|
"lint": "polkadot-dev-run-lint",
|
||||||
"clean": "polkadot-dev-clean-build",
|
"clean": "polkadot-dev-clean-build",
|
||||||
"postinstall": "polkadot-dev-yarn-only",
|
"postinstall": "polkadot-dev-yarn-only",
|
||||||
"test": "polkadot-dev-run-test --coverage --runInBand --testPathIgnorePatterns e2e",
|
"test": "polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e",
|
||||||
"test:one": "polkadot-dev-run-test",
|
"test:one": "polkadot-dev-run-test --detectOpenHandles --forceExit",
|
||||||
"test:watch": "polkadot-dev-run-test --watch"
|
"test:watch": "polkadot-dev-run-test --watch"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.12.10",
|
"@babel/core": "^7.14.6",
|
||||||
"@babel/register": "^7.12.10",
|
"@babel/register": "^7.14.5",
|
||||||
"@babel/runtime": "^7.12.5",
|
"@babel/runtime": "^7.14.6",
|
||||||
"@polkadot/dev": "^0.61.24",
|
"@polkadot/dev": "^0.62.43",
|
||||||
"@polkadot/ts": "^0.3.59",
|
"@polkadot/ts": "^0.4.1",
|
||||||
"@polkadot/typegen": "workspace:packages/typegen",
|
"@polkadot/typegen": "workspace:packages/typegen",
|
||||||
"@types/jest": "^26.0.20",
|
"@types/jest": "^26.0.23",
|
||||||
"copyfiles": "^2.4.1"
|
"copyfiles": "^2.4.1"
|
||||||
},
|
},
|
||||||
"version": "3.4.1"
|
"version": "4.16.2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Abi } from '@polkadot/api-contract';
|
|||||||
|
|
||||||
const wsProvider = new WsProvider(<...Node Url...>);
|
const wsProvider = new WsProvider(<...Node Url...>);
|
||||||
const api = await ApiPromise.create({ provider: wsProvider });
|
const api = await ApiPromise.create({ provider: wsProvider });
|
||||||
const abi = new Abi(api.registry, <...JSON ABI...>);
|
const abi = new Abi(<...JSON ABI...>, api.registry.getChainProperties());
|
||||||
|
|
||||||
api.tx.contracts
|
api.tx.contracts
|
||||||
.call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
|
.call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/api-contract",
|
"name": "@polkadot/api-contract",
|
||||||
"version": "3.4.1",
|
"version": "4.16.2",
|
||||||
|
"type": "module",
|
||||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "index.mjs",
|
"sideEffects": [
|
||||||
"sideEffects": false,
|
"./detectPackage.js",
|
||||||
|
"./detectPackage.cjs"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
},
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
@@ -13,11 +19,10 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.12.5",
|
"@babel/runtime": "^7.14.6",
|
||||||
"@polkadot/api": "3.4.1",
|
"@polkadot/api": "4.16.2",
|
||||||
"@polkadot/types": "3.4.1",
|
"@polkadot/types": "4.16.2",
|
||||||
"@polkadot/util": "^5.2.3",
|
"@polkadot/util": "^6.10.1",
|
||||||
"@polkadot/x-rxjs": "3.4.1",
|
"@polkadot/x-rxjs": "^6.10.1"
|
||||||
"bn.js": "^4.11.9"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { blake2AsHex } from '@polkadot/util-crypto';
|
||||||
|
|
||||||
import abis from '../test/contracts';
|
import abis from '../test/contracts';
|
||||||
import { Abi } from '.';
|
import { Abi } from '.';
|
||||||
|
|
||||||
interface JSONAbi {
|
interface JSONAbi {
|
||||||
|
source: {
|
||||||
|
compiler: string,
|
||||||
|
hash: string,
|
||||||
|
language: string,
|
||||||
|
wasm: string
|
||||||
|
},
|
||||||
spec: {
|
spec: {
|
||||||
messages: {
|
messages: {
|
||||||
name: string[] | string
|
name: string[] | string
|
||||||
@@ -27,4 +35,18 @@ describe('Abi', (): void => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('has the correct hash for the source', (): void => {
|
||||||
|
const bundle = abis.ink_flipperBundle as JSONAbi;
|
||||||
|
const abi = new Abi(bundle as any);
|
||||||
|
|
||||||
|
// manual
|
||||||
|
expect(bundle.source.hash).toEqual(blake2AsHex(bundle.source.wasm));
|
||||||
|
|
||||||
|
// the Codec hash
|
||||||
|
expect(bundle.source.hash).toEqual(abi.project.source.wasm.hash.toHex());
|
||||||
|
|
||||||
|
// the hash as per the actual Abi
|
||||||
|
expect(bundle.source.hash).toEqual(abi.project.source.wasmHash.toHex());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,12 +6,10 @@ import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, Contr
|
|||||||
import type { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
|
import type { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
|
||||||
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from './types';
|
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from './types';
|
||||||
|
|
||||||
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, u8aConcat, u8aToHex } from '@polkadot/util';
|
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||||
|
|
||||||
import { MetaRegistry } from './MetaRegistry';
|
import { MetaRegistry } from './MetaRegistry';
|
||||||
|
|
||||||
const EMPTY_U8A = new Uint8Array();
|
|
||||||
|
|
||||||
const l = logger('Abi');
|
const l = logger('Abi');
|
||||||
|
|
||||||
function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string | number): T {
|
function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string | number): T {
|
||||||
@@ -21,7 +19,7 @@ function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string
|
|||||||
? list.find(({ identifier }) => [identifier, stringCamelCase(identifier)].includes(messageOrId.toString()))
|
? list.find(({ identifier }) => [identifier, stringCamelCase(identifier)].includes(messageOrId.toString()))
|
||||||
: messageOrId;
|
: messageOrId;
|
||||||
|
|
||||||
return assertReturn(message, `Attempted to call an invalid contract interface, ${JSON.stringify(messageOrId)}`);
|
return assertReturn(message, () => `Attempted to call an invalid contract interface, ${stringify(messageOrId)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Abi {
|
export class Abi {
|
||||||
@@ -45,13 +43,13 @@ export class Abi {
|
|||||||
assert(isObject(json) && !Array.isArray(json) && json.metadataVersion && isObject(json.spec) && !Array.isArray(json.spec) && Array.isArray(json.spec.constructors) && Array.isArray(json.spec.messages), 'Invalid JSON ABI structure supplied, expected a recent metadata version');
|
assert(isObject(json) && !Array.isArray(json) && json.metadataVersion && isObject(json.spec) && !Array.isArray(json.spec) && Array.isArray(json.spec.constructors) && Array.isArray(json.spec.messages), 'Invalid JSON ABI structure supplied, expected a recent metadata version');
|
||||||
|
|
||||||
this.json = json;
|
this.json = json;
|
||||||
this.registry = new MetaRegistry(chainProperties);
|
this.registry = new MetaRegistry(json.metadataVersion as string, chainProperties);
|
||||||
this.project = this.registry.createType('ContractProject', json);
|
this.project = this.registry.createType('ContractProject', json);
|
||||||
|
|
||||||
this.registry.setMetaTypes(this.project.types);
|
this.registry.setMetaTypes(this.project.types);
|
||||||
|
|
||||||
this.project.types.forEach((_, index) =>
|
this.project.types.forEach((_, index) =>
|
||||||
this.registry.getMetaTypeDef({ type: this.registry.createType('SiLookupTypeId', index + 1) })
|
this.registry.getMetaTypeDef({ type: this.registry.createType('SiLookupTypeId', index + this.registry.typeOffset) })
|
||||||
);
|
);
|
||||||
this.constructors = this.project.spec.constructors.map((spec: ContractConstructorSpec, index) =>
|
this.constructors = this.project.spec.constructors.map((spec: ContractConstructorSpec, index) =>
|
||||||
this.#createMessage(spec, index, {
|
this.#createMessage(spec, index, {
|
||||||
@@ -81,7 +79,7 @@ export class Abi {
|
|||||||
const index = data[0];
|
const index = data[0];
|
||||||
const event = this.#events[index];
|
const event = this.#events[index];
|
||||||
|
|
||||||
assert(event, `Unable to find event with index ${index}`);
|
assert(event, () => `Unable to find event with index ${index}`);
|
||||||
|
|
||||||
return event.fromU8a(data.subarray(1));
|
return event.fromU8a(data.subarray(1));
|
||||||
}
|
}
|
||||||
@@ -118,7 +116,7 @@ export class Abi {
|
|||||||
type: this.registry.getMetaTypeDef(arg.type)
|
type: this.registry.getMetaTypeDef(arg.type)
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
l.error(`Error expanding argument ${index} in ${JSON.stringify(spec)}`);
|
l.error(`Error expanding argument ${index} in ${stringify(spec)}`);
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@@ -129,7 +127,7 @@ export class Abi {
|
|||||||
const args = this.#createArgs(spec.args, spec);
|
const args = this.#createArgs(spec.args, spec);
|
||||||
const event = {
|
const event = {
|
||||||
args,
|
args,
|
||||||
docs: spec.docs.map((doc) => doc.toString()),
|
docs: spec.docs.map((d) => d.toString()),
|
||||||
fromU8a: (data: Uint8Array): DecodedEvent => ({
|
fromU8a: (data: Uint8Array): DecodedEvent => ({
|
||||||
args: this.#decodeArgs(args, data),
|
args: this.#decodeArgs(args, data),
|
||||||
event
|
event
|
||||||
@@ -143,19 +141,21 @@ export class Abi {
|
|||||||
|
|
||||||
#createMessage = (spec: ContractMessageSpec | ContractConstructorSpec, index: number, add: Partial<AbiMessage> = {}): AbiMessage => {
|
#createMessage = (spec: ContractMessageSpec | ContractConstructorSpec, index: number, add: Partial<AbiMessage> = {}): AbiMessage => {
|
||||||
const args = this.#createArgs(spec.args, spec);
|
const args = this.#createArgs(spec.args, spec);
|
||||||
|
const identifier = spec.name.toString();
|
||||||
const message = {
|
const message = {
|
||||||
...add,
|
...add,
|
||||||
args,
|
args,
|
||||||
docs: spec.docs.map((doc) => doc.toString()),
|
docs: spec.docs.map((d) => d.toString()),
|
||||||
fromU8a: (data: Uint8Array): DecodedMessage => ({
|
fromU8a: (data: Uint8Array): DecodedMessage => ({
|
||||||
args: this.#decodeArgs(args, data),
|
args: this.#decodeArgs(args, data),
|
||||||
message
|
message
|
||||||
}),
|
}),
|
||||||
identifier: spec.name.toString(),
|
identifier,
|
||||||
index,
|
index,
|
||||||
|
method: stringCamelCase(identifier),
|
||||||
selector: spec.selector,
|
selector: spec.selector,
|
||||||
toU8a: (params: CodecArg[], additional?: Uint8Array) =>
|
toU8a: (params: CodecArg[]) =>
|
||||||
this.#encodeArgs(spec, args, params, additional)
|
this.#encodeArgs(spec, args, params)
|
||||||
};
|
};
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
@@ -185,14 +185,13 @@ export class Abi {
|
|||||||
return message.fromU8a(trimmed.subarray(4));
|
return message.fromU8a(trimmed.subarray(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: CodecArg[], additional = EMPTY_U8A): Uint8Array => {
|
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: CodecArg[]): Uint8Array => {
|
||||||
assert(data.length === args.length, `Expected ${args.length} arguments to contract message '${name.toString()}', found ${data.length}`);
|
assert(data.length === args.length, () => `Expected ${args.length} arguments to contract message '${name.toString()}', found ${data.length}`);
|
||||||
|
|
||||||
return compactAddLength(
|
return compactAddLength(
|
||||||
u8aConcat(
|
u8aConcat(
|
||||||
this.registry.createType('ContractSelector', selector).toU8a(),
|
this.registry.createType('ContractSelector', selector).toU8a(),
|
||||||
...args.map(({ type }, index) => this.registry.createType(type.type as 'Text', data[index]).toU8a()),
|
...args.map(({ type }, index) => this.registry.createType(type.type as 'Text', data[index]).toU8a())
|
||||||
additional
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ interface PartialTypeSpec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convert the offset into project-specific, index-1
|
// convert the offset into project-specific, index-1
|
||||||
export function getRegistryOffset (id: SiLookupTypeId): number {
|
export function getRegistryOffset (id: SiLookupTypeId, typeOffset: number): number {
|
||||||
return id.toNumber() - 1;
|
return id.toNumber() - typeOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRIMITIVE_ALIAS: Record<string, keyof InterfaceTypes> = {
|
const PRIMITIVE_ALIAS: Record<string, keyof InterfaceTypes> = {
|
||||||
@@ -28,11 +28,18 @@ const PRIMITIVE_ALWAYS = ['AccountId', 'AccountIndex', 'Address', 'Balance'];
|
|||||||
export class MetaRegistry extends TypeRegistry {
|
export class MetaRegistry extends TypeRegistry {
|
||||||
public readonly metaTypeDefs: TypeDef[] = [];
|
public readonly metaTypeDefs: TypeDef[] = [];
|
||||||
|
|
||||||
|
public readonly typeOffset;
|
||||||
|
|
||||||
#siTypes: SiType[] = [];
|
#siTypes: SiType[] = [];
|
||||||
|
|
||||||
constructor (chainProperties?: ChainProperties) {
|
constructor (metadataVersion: string, chainProperties?: ChainProperties) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
const [major, minor] = metadataVersion.split('.').map((n) => parseInt(n, 10));
|
||||||
|
|
||||||
|
// type indexes are 1-based pre 0.7 and 0-based post
|
||||||
|
this.typeOffset = (major === 0 && minor < 7) ? 1 : 0;
|
||||||
|
|
||||||
if (chainProperties) {
|
if (chainProperties) {
|
||||||
this.setChainProperties(chainProperties);
|
this.setChainProperties(chainProperties);
|
||||||
}
|
}
|
||||||
@@ -43,7 +50,7 @@ export class MetaRegistry extends TypeRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getMetaTypeDef (typeSpec: PartialTypeSpec): TypeDef {
|
public getMetaTypeDef (typeSpec: PartialTypeSpec): TypeDef {
|
||||||
const offset = getRegistryOffset(typeSpec.type);
|
const offset = getRegistryOffset(typeSpec.type, this.typeOffset);
|
||||||
let typeDef = this.metaTypeDefs[offset];
|
let typeDef = this.metaTypeDefs[offset];
|
||||||
|
|
||||||
if (!typeDef) {
|
if (!typeDef) {
|
||||||
@@ -78,19 +85,22 @@ export class MetaRegistry extends TypeRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#getMetaType = (id: SiLookupTypeId): SiType => {
|
#getMetaType = (id: SiLookupTypeId): SiType => {
|
||||||
const type = this.#siTypes[getRegistryOffset(id)];
|
const type = this.#siTypes[getRegistryOffset(id, this.typeOffset)];
|
||||||
|
|
||||||
assert(!isUndefined(type), `getMetaType:: Unable to find ${id.toNumber()} in type values`);
|
assert(!isUndefined(type), () => `getMetaType:: Unable to find ${id.toNumber()} in type values`);
|
||||||
|
|
||||||
return this.createType('SiType', type);
|
return this.createType('SiType', type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#extract = (type: SiType, id: SiLookupTypeId): TypeDef => {
|
#extract = (type: SiType, id: SiLookupTypeId): TypeDef => {
|
||||||
const path = [...type.path];
|
const path = [...type.path];
|
||||||
const pathFinal = path.length ? path[path.length - 1].toString() : '';
|
const isPrimitivePath = !!path.length && (
|
||||||
|
(path.length > 2 && path[0].eq('ink_env') && path[1].eq('types')) ||
|
||||||
|
PRIMITIVE_ALWAYS.includes(path[path.length - 1].toString())
|
||||||
|
);
|
||||||
let typeDef: Omit<TypeDef, 'type'>;
|
let typeDef: Omit<TypeDef, 'type'>;
|
||||||
|
|
||||||
if (type.path.join('::').startsWith('ink_env::types::') || PRIMITIVE_ALWAYS.includes(pathFinal)) {
|
if (isPrimitivePath) {
|
||||||
typeDef = this.#extractPrimitivePath(type);
|
typeDef = this.#extractPrimitivePath(type);
|
||||||
} else if (type.def.isPrimitive) {
|
} else if (type.def.isPrimitive) {
|
||||||
typeDef = this.#extractPrimitive(type);
|
typeDef = this.#extractPrimitive(type);
|
||||||
@@ -116,7 +126,7 @@ export class MetaRegistry extends TypeRegistry {
|
|||||||
: {}
|
: {}
|
||||||
),
|
),
|
||||||
...(path.length > 1
|
...(path.length > 1
|
||||||
? { namespace: path.map((segment) => segment.toString()).join('::') }
|
? { namespace: path.map((s) => s.toString()).join('::') }
|
||||||
: {}
|
: {}
|
||||||
),
|
),
|
||||||
...(type.params.length > 0
|
...(type.params.length > 0
|
||||||
@@ -128,7 +138,7 @@ export class MetaRegistry extends TypeRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#extractArray = ({ len: length, type }: SiTypeDefArray): Omit<TypeDef, 'type'> => {
|
#extractArray = ({ len: length, type }: SiTypeDefArray): Omit<TypeDef, 'type'> => {
|
||||||
assert(!length || length.toNumber() <= 256, 'MetaRegistry: Only support for [Type; <length>], where length > 256');
|
assert(!length || length.toNumber() <= 256, 'MetaRegistry: Only support for [Type; <length>], where length <= 256');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
info: TypeDefInfo.VecFixed,
|
info: TypeDefInfo.VecFixed,
|
||||||
@@ -144,27 +154,25 @@ export class MetaRegistry extends TypeRegistry {
|
|||||||
]),
|
]),
|
||||||
[true, true]);
|
[true, true]);
|
||||||
|
|
||||||
let info;
|
assert(isTuple || isStruct, 'Invalid fields type detected, expected either Tuple or Struct');
|
||||||
|
|
||||||
// check for tuple first (no fields may be available)
|
const sub = fields.map(({ name, type }) => ({
|
||||||
if (isTuple) {
|
...this.getMetaTypeDef({ type }),
|
||||||
info = TypeDefInfo.Tuple;
|
...(name.isSome
|
||||||
} else if (isStruct) {
|
? { name: name.unwrap().toString() }
|
||||||
info = TypeDefInfo.Struct;
|
: {}
|
||||||
} else {
|
)
|
||||||
throw new Error('Invalid fields type detected, expected either Tuple or Struct');
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
const sub = fields.map(({ name, type }) => {
|
|
||||||
return {
|
|
||||||
...this.getMetaTypeDef({ type }),
|
|
||||||
...(name.isSome ? { name: name.unwrap().toString() } : {})
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return isTuple && sub.length === 1
|
return isTuple && sub.length === 1
|
||||||
? sub[0]
|
? sub[0]
|
||||||
: { info, sub };
|
: {
|
||||||
|
// check for tuple first (no fields may be available)
|
||||||
|
info: isTuple
|
||||||
|
? TypeDefInfo.Tuple
|
||||||
|
: TypeDefInfo.Struct,
|
||||||
|
sub
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#extractPrimitive = (type: SiType): TypeDef => {
|
#extractPrimitive = (type: SiType): TypeDef => {
|
||||||
@@ -184,7 +192,7 @@ export class MetaRegistry extends TypeRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#extractSequence = ({ type }: SiTypeDefSequence, id: SiLookupTypeId): Omit<TypeDef, 'type'> => {
|
#extractSequence = ({ type }: SiTypeDefSequence, id: SiLookupTypeId): Omit<TypeDef, 'type'> => {
|
||||||
assert(!!type, `ContractRegistry: Invalid sequence type found at id ${id.toString()}`);
|
assert(!!type, () => `ContractRegistry: Invalid sequence type found at id ${id.toString()}`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
info: TypeDefInfo.Vec,
|
info: TypeDefInfo.Vec,
|
||||||
@@ -205,32 +213,28 @@ export class MetaRegistry extends TypeRegistry {
|
|||||||
const { params, path } = this.#getMetaType(id);
|
const { params, path } = this.#getMetaType(id);
|
||||||
const specialVariant = path[0].toString();
|
const specialVariant = path[0].toString();
|
||||||
|
|
||||||
if (specialVariant === 'Option') {
|
return specialVariant === 'Option'
|
||||||
return {
|
? {
|
||||||
info: TypeDefInfo.Option,
|
info: TypeDefInfo.Option,
|
||||||
sub: this.getMetaTypeDef({ type: params[0] })
|
sub: this.getMetaTypeDef({ type: params[0] })
|
||||||
};
|
}
|
||||||
} else if (specialVariant === 'Result') {
|
: specialVariant === 'Result'
|
||||||
return {
|
? {
|
||||||
info: TypeDefInfo.Result,
|
info: TypeDefInfo.Result,
|
||||||
sub: params.map((type, index) => ({
|
sub: params.map((type, index) => ({
|
||||||
name: ['Ok', 'Error'][index],
|
name: ['Ok', 'Error'][index],
|
||||||
...this.getMetaTypeDef({ type })
|
...this.getMetaTypeDef({ type })
|
||||||
}))
|
}))
|
||||||
};
|
}
|
||||||
}
|
: {
|
||||||
|
info: TypeDefInfo.Enum,
|
||||||
return {
|
sub: this.#extractVariantSub(variants)
|
||||||
info: TypeDefInfo.Enum,
|
};
|
||||||
sub: this.#extractVariantSub(variants)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#extractVariantSub = (variants: SiVariant[]): TypeDef[] => {
|
#extractVariantSub = (variants: SiVariant[]): TypeDef[] => {
|
||||||
const isAllUnitVariants = variants.every(({ fields }) => fields.length === 0);
|
return variants.every(({ fields }) => fields.length === 0)
|
||||||
|
? variants.map(({ discriminant, name }) => ({
|
||||||
if (isAllUnitVariants) {
|
|
||||||
return variants.map(({ discriminant, name }) => ({
|
|
||||||
...(
|
...(
|
||||||
discriminant.isSome
|
discriminant.isSome
|
||||||
? { ext: { discriminant: discriminant.unwrap().toNumber() } }
|
? { ext: { discriminant: discriminant.unwrap().toNumber() } }
|
||||||
@@ -239,14 +243,10 @@ export class MetaRegistry extends TypeRegistry {
|
|||||||
info: TypeDefInfo.Plain,
|
info: TypeDefInfo.Plain,
|
||||||
name: name.toString(),
|
name: name.toString(),
|
||||||
type: 'Null'
|
type: 'Null'
|
||||||
}));
|
}))
|
||||||
}
|
: variants.map(({ fields, name }) => withTypeString({
|
||||||
|
|
||||||
return variants.map(({ fields, name }) =>
|
|
||||||
withTypeString({
|
|
||||||
...this.#extractFields(fields),
|
...this.#extractFields(fields),
|
||||||
name: name.toString()
|
name: name.toString()
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
|||||||
import type { AnyJson, Registry } from '@polkadot/types/types';
|
import type { AnyJson, Registry } from '@polkadot/types/types';
|
||||||
|
|
||||||
import { ApiBase } from '@polkadot/api/base';
|
import { ApiBase } from '@polkadot/api/base';
|
||||||
import { assert } from '@polkadot/util';
|
import { assert, isFunction } from '@polkadot/util';
|
||||||
|
|
||||||
import { Abi } from '../Abi';
|
import { Abi } from '../Abi';
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ export abstract class Base<ApiType extends ApiTypes> {
|
|||||||
this.registry = this.abi.registry;
|
this.registry = this.abi.registry;
|
||||||
this._decorateMethod = decorateMethod;
|
this._decorateMethod = decorateMethod;
|
||||||
|
|
||||||
assert(this.api.rx.tx.contracts && this.api.rx.tx.contracts.putCode, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
|
assert(!!(api && api.isConnected && api.tx && api.tx.contracts && Object.keys(api.tx.contracts).length), 'Your API has not been initialized correctly and it not decorated with the runtime interfaces for contracts as retrieved from the on-chain runtime');
|
||||||
|
assert(isFunction(api.tx.contracts.instantiateWithCode), 'You need to connect to a chain with a runtime with a V3 contracts module. The runtime does not expose api.tx.contracts.instantiateWithCode');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,44 +6,17 @@ import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
|||||||
import type { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
|
import type { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
|
||||||
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
|
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
|
||||||
import type { AbiConstructor, BlueprintOptions } from '../types';
|
import type { AbiConstructor, BlueprintOptions } from '../types';
|
||||||
import type { BlueprintDeploy, ContractGeneric, MapConstructorExec } from './types';
|
import type { MapConstructorExec } from './types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
|
||||||
|
|
||||||
import { SubmittableResult } from '@polkadot/api';
|
import { SubmittableResult } from '@polkadot/api';
|
||||||
import { ApiBase } from '@polkadot/api/base';
|
import { ApiBase } from '@polkadot/api/base';
|
||||||
import { Bytes } from '@polkadot/types';
|
import { BN_ZERO, isUndefined } from '@polkadot/util';
|
||||||
import { compactAddLength, isUndefined, stringCamelCase, u8aToU8a } from '@polkadot/util';
|
|
||||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
|
||||||
|
|
||||||
import { Abi } from '../Abi';
|
import { Abi } from '../Abi';
|
||||||
import { applyOnEvent, extractOptions, isOptions } from '../util';
|
import { applyOnEvent } from '../util';
|
||||||
import { Base } from './Base';
|
import { Base } from './Base';
|
||||||
import { Contract } from './Contract';
|
import { Contract } from './Contract';
|
||||||
|
import { createBluePrintTx, encodeSalt } from './util';
|
||||||
const EMPTY_SALT = new Uint8Array();
|
|
||||||
|
|
||||||
function createTx <ApiType extends ApiTypes> (fn: (options: BlueprintOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>>): BlueprintDeploy<ApiType> {
|
|
||||||
return (options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> =>
|
|
||||||
isOptions(options)
|
|
||||||
? fn(options, params)
|
|
||||||
: fn(...extractOptions(options, params));
|
|
||||||
}
|
|
||||||
|
|
||||||
function createWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]) => T): ContractGeneric<BlueprintOptions, T> {
|
|
||||||
return (constructorOrId: AbiConstructor | string | number, options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): T =>
|
|
||||||
isOptions(options)
|
|
||||||
? fn(constructorOrId, options, params)
|
|
||||||
: fn(constructorOrId, ...extractOptions(options, params));
|
|
||||||
}
|
|
||||||
|
|
||||||
function encodeSalt (salt: Uint8Array | string | null = randomAsU8a()) {
|
|
||||||
return salt instanceof Bytes
|
|
||||||
? salt
|
|
||||||
: salt && salt.length
|
|
||||||
? compactAddLength(u8aToU8a(salt))
|
|
||||||
: EMPTY_SALT;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class BlueprintSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
|
export class BlueprintSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
|
||||||
public readonly contract?: Contract<ApiType>;
|
public readonly contract?: Contract<ApiType>;
|
||||||
@@ -61,25 +34,16 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
*/
|
*/
|
||||||
public readonly codeHash: Hash;
|
public readonly codeHash: Hash;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @description Deprecated. Use `.tx.<constructorName>`. Creates a contract in a non-deterministic way.
|
|
||||||
*/
|
|
||||||
public readonly createContract: ContractGeneric<BlueprintOptions, SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>>>;
|
|
||||||
|
|
||||||
readonly #tx: MapConstructorExec<ApiType> = {};
|
readonly #tx: MapConstructorExec<ApiType> = {};
|
||||||
|
|
||||||
constructor (api: ApiBase<ApiType>, abi: AnyJson | Abi, codeHash: string | Hash | Uint8Array, decorateMethod: DecorateMethod<ApiType>) {
|
constructor (api: ApiBase<ApiType>, abi: AnyJson | Abi, codeHash: string | Hash | Uint8Array, decorateMethod: DecorateMethod<ApiType>) {
|
||||||
super(api, abi, decorateMethod);
|
super(api, abi, decorateMethod);
|
||||||
|
|
||||||
this.codeHash = this.registry.createType('Hash', codeHash);
|
this.codeHash = this.registry.createType('Hash', codeHash);
|
||||||
this.createContract = createWithId(this.#deploy);
|
|
||||||
|
|
||||||
this.abi.constructors.forEach((c): void => {
|
this.abi.constructors.forEach((c): void => {
|
||||||
const messageName = stringCamelCase(c.identifier);
|
if (isUndefined(this.#tx[c.method])) {
|
||||||
|
this.#tx[c.method] = createBluePrintTx((o, p) => this.#deploy(c, o, p));
|
||||||
if (isUndefined(this.#tx[messageName])) {
|
|
||||||
this.#tx[messageName] = createTx((o, p) => this.#deploy(c, o, p));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -88,20 +52,19 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
return this.#tx;
|
return this.#tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
#deploy = (constructorOrId: AbiConstructor | string| number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
|
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
|
||||||
const encodedSalt = encodeSalt(salt);
|
return this.api.tx.contracts
|
||||||
const withSalt = this.api.tx.contracts.instantiate.meta.args.length === 5;
|
.instantiate(
|
||||||
const encoded = this.abi.findConstructor(constructorOrId).toU8a(params, withSalt ? EMPTY_SALT : encodedSalt);
|
value,
|
||||||
const tx = withSalt
|
gasLimit,
|
||||||
? this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, encoded, encodedSalt)
|
this.codeHash,
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
this.abi.findConstructor(constructorOrId).toU8a(params),
|
||||||
// @ts-ignore old style with salt included
|
encodeSalt(salt)
|
||||||
: this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, encoded);
|
)
|
||||||
|
.withResultTransform((result: ISubmittableResult) =>
|
||||||
return tx.withResultTransform((result: ISubmittableResult) =>
|
new BlueprintSubmittableResult(result, applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) =>
|
||||||
new BlueprintSubmittableResult(result, applyOnEvent(result, 'Instantiated', ([record]: EventRecord[]) =>
|
new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
|
||||||
new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
|
))
|
||||||
))
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,31 +3,39 @@
|
|||||||
|
|
||||||
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
||||||
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||||
import type { EventRecord, Hash } from '@polkadot/types/interfaces';
|
import type { EventRecord } from '@polkadot/types/interfaces';
|
||||||
import type { AnyJson, ISubmittableResult } from '@polkadot/types/types';
|
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
|
||||||
|
import type { AbiConstructor, BlueprintOptions } from '../types';
|
||||||
|
import type { MapConstructorExec } from './types';
|
||||||
|
|
||||||
import { SubmittableResult } from '@polkadot/api';
|
import { SubmittableResult } from '@polkadot/api';
|
||||||
import { ApiBase } from '@polkadot/api/base';
|
import { ApiBase } from '@polkadot/api/base';
|
||||||
import { assert, compactAddLength, isWasm, u8aToU8a } from '@polkadot/util';
|
import { assert, BN_ZERO, compactAddLength, isUndefined, isWasm, u8aToU8a } from '@polkadot/util';
|
||||||
|
|
||||||
import { Abi } from '../Abi';
|
import { Abi } from '../Abi';
|
||||||
import { applyOnEvent } from '../util';
|
import { applyOnEvent } from '../util';
|
||||||
import { Base } from './Base';
|
import { Base } from './Base';
|
||||||
import { Blueprint } from './Blueprint';
|
import { Blueprint } from './Blueprint';
|
||||||
|
import { Contract } from './Contract';
|
||||||
|
import { createBluePrintTx, encodeSalt } from './util';
|
||||||
|
|
||||||
export class CodeSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
|
export class CodeSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
|
||||||
public readonly blueprint?: Blueprint<ApiType>;
|
public readonly blueprint?: Blueprint<ApiType>;
|
||||||
|
public readonly contract?: Contract<ApiType>;
|
||||||
|
|
||||||
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>) {
|
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>, contract?: Contract<ApiType>) {
|
||||||
super(result);
|
super(result);
|
||||||
|
|
||||||
this.blueprint = blueprint;
|
this.blueprint = blueprint;
|
||||||
|
this.contract = contract;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||||
public readonly code: Uint8Array;
|
public readonly code: Uint8Array;
|
||||||
|
|
||||||
|
readonly #tx: MapConstructorExec<ApiType> = {};
|
||||||
|
|
||||||
constructor (api: ApiBase<ApiType>, abi: AnyJson | Abi, wasm: Uint8Array | string | Buffer | null | undefined, decorateMethod: DecorateMethod<ApiType>) {
|
constructor (api: ApiBase<ApiType>, abi: AnyJson | Abi, wasm: Uint8Array | string | Buffer | null | undefined, decorateMethod: DecorateMethod<ApiType>) {
|
||||||
super(api, abi, decorateMethod);
|
super(api, abi, decorateMethod);
|
||||||
|
|
||||||
@@ -36,18 +44,37 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
: u8aToU8a(wasm);
|
: u8aToU8a(wasm);
|
||||||
|
|
||||||
assert(isWasm(this.code), 'No WASM code provided');
|
assert(isWasm(this.code), 'No WASM code provided');
|
||||||
|
|
||||||
|
this.abi.constructors.forEach((c): void => {
|
||||||
|
if (isUndefined(this.#tx[c.method])) {
|
||||||
|
this.#tx[c.method] = createBluePrintTx((o, p) => this.#instantiate(c, o, p));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public get tx (): MapConstructorExec<ApiType> {
|
||||||
* @description Deploy the code bundle, creating a Blueprint.
|
return this.#tx;
|
||||||
*/
|
}
|
||||||
public createBlueprint (): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> {
|
|
||||||
|
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
|
||||||
return this.api.tx.contracts
|
return this.api.tx.contracts
|
||||||
.putCode(compactAddLength(this.code))
|
.instantiateWithCode(
|
||||||
|
value,
|
||||||
|
gasLimit,
|
||||||
|
compactAddLength(this.code),
|
||||||
|
this.abi.findConstructor(constructorOrId).toU8a(params),
|
||||||
|
encodeSalt(salt)
|
||||||
|
)
|
||||||
.withResultTransform((result: ISubmittableResult) =>
|
.withResultTransform((result: ISubmittableResult) =>
|
||||||
new CodeSubmittableResult(result, applyOnEvent(result, 'CodeStored', ([record]: EventRecord[]) =>
|
new CodeSubmittableResult(result, ...(applyOnEvent(result, ['CodeStored', 'Instantiated'], (records: EventRecord[]) =>
|
||||||
new Blueprint<ApiType>(this.api, this.abi, record.event.data[0] as Hash, this._decorateMethod)
|
records.reduce<[Blueprint<ApiType>?, Contract<ApiType>?]>(([blueprint, contract], { event }) =>
|
||||||
))
|
this.api.events.contracts.Instantiated.is(event)
|
||||||
|
? [blueprint, new Contract<ApiType>(this.api, this.abi, event.data[1], this._decorateMethod)]
|
||||||
|
: this.api.events.contracts.CodeStored.is(event)
|
||||||
|
? [new Blueprint<ApiType>(this.api, this.abi, event.data[0], this._decorateMethod), contract]
|
||||||
|
: [blueprint, contract],
|
||||||
|
[])
|
||||||
|
) || []))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,25 +4,25 @@
|
|||||||
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
||||||
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||||
import type { Bytes } from '@polkadot/types';
|
import type { Bytes } from '@polkadot/types';
|
||||||
import type { AccountId, ContractExecResult, EventRecord, Weight } from '@polkadot/types/interfaces';
|
import type { AccountId, EventRecord, Weight } from '@polkadot/types/interfaces';
|
||||||
import type { AnyJson, CodecArg, ISubmittableResult, Registry } from '@polkadot/types/types';
|
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
|
||||||
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
|
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
|
||||||
import type { ContractCallResult, ContractCallSend, ContractGeneric, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
|
import type { ContractCallResult, ContractCallSend, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
|
||||||
|
|
||||||
import { SubmittableResult } from '@polkadot/api';
|
import { SubmittableResult } from '@polkadot/api';
|
||||||
import { ApiBase } from '@polkadot/api/base';
|
import { ApiBase } from '@polkadot/api/base';
|
||||||
import { assert, bnToBn, isFunction, isUndefined, logger, stringCamelCase } from '@polkadot/util';
|
import { createTypeUnsafe } from '@polkadot/types';
|
||||||
|
import { assert, BN, BN_HUNDRED, BN_ONE, BN_ZERO, bnToBn, isFunction, isUndefined, logger } from '@polkadot/util';
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { Abi } from '../Abi';
|
import { Abi } from '../Abi';
|
||||||
import { applyOnEvent, extractOptions, formatData, isOptions } from '../util';
|
import { applyOnEvent, extractOptions, isOptions } from '../util';
|
||||||
import { Base } from './Base';
|
import { Base } from './Base';
|
||||||
|
|
||||||
// As per Rust, 5 * GAS_PER_SEC
|
// As per Rust, 5 * GAS_PER_SEC
|
||||||
const MAX_CALL_GAS = new BN(5_000_000_000_000).subn(1);
|
const MAX_CALL_GAS = new BN(5_000_000_000_000).isub(BN_ONE);
|
||||||
const ERROR_NO_CALL = 'Your node does not expose the contracts.call RPC. This is most probably due to a runtime configuration.';
|
const ERROR_NO_CALL = 'Your node does not expose the contracts.call RPC. This is most probably due to a runtime configuration.';
|
||||||
|
|
||||||
const l = logger('Contract');
|
const l = logger('Contract');
|
||||||
|
|
||||||
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: CodecArg[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
|
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: CodecArg[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
|
||||||
@@ -39,13 +39,6 @@ function createTx <ApiType extends ApiTypes> (fn: (options: ContractOptions, par
|
|||||||
: fn(...extractOptions(options, params));
|
: fn(...extractOptions(options, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWithId <T> (fn: (messageOrId: AbiMessage | string | number, options: ContractOptions, params: CodecArg[]) => T): ContractGeneric<ContractOptions, T> {
|
|
||||||
return (messageOrId: AbiMessage | string | number, options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): T =>
|
|
||||||
isOptions(options)
|
|
||||||
? fn(messageOrId, options, params)
|
|
||||||
: fn(messageOrId, ...extractOptions(options, params));
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ContractSubmittableResult extends SubmittableResult {
|
export class ContractSubmittableResult extends SubmittableResult {
|
||||||
public readonly contractEvents?: DecodedEvent[];
|
public readonly contractEvents?: DecodedEvent[];
|
||||||
|
|
||||||
@@ -56,51 +49,12 @@ export class ContractSubmittableResult extends SubmittableResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// map from a JSON result to current-style ContractExecResult
|
|
||||||
function mapExecResult (registry: Registry, json: Record<string, AnyJson>): ContractExecResult {
|
|
||||||
if (!Object.keys(json).some((key) => ['error', 'success'].includes(key))) {
|
|
||||||
return registry.createType('ContractExecResult', json);
|
|
||||||
}
|
|
||||||
|
|
||||||
const from = registry.createType('ContractExecResultTo260', json);
|
|
||||||
|
|
||||||
if (from.isSuccess) {
|
|
||||||
const s = from.asSuccess;
|
|
||||||
|
|
||||||
return registry.createType('ContractExecResult', {
|
|
||||||
gasConsumed: s.gasConsumed,
|
|
||||||
result: {
|
|
||||||
ok: {
|
|
||||||
data: s.data,
|
|
||||||
flags: s.flags
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// in the old format error has no additional information,
|
|
||||||
// map it as-is with an "unknown" error
|
|
||||||
return registry.createType('ContractExecResult', { result: { err: { other: 'unknown' } } });
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||||
/**
|
/**
|
||||||
* @description The on-chain address for this contract
|
* @description The on-chain address for this contract
|
||||||
*/
|
*/
|
||||||
public readonly address: AccountId;
|
public readonly address: AccountId;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @description Deprecated. Use `.tx.<messageName>` to send a transaction.
|
|
||||||
*/
|
|
||||||
public readonly exec: ContractGeneric<ContractOptions, SubmittableExtrinsic<ApiType>>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @description Deprecated. Use `.tx.<messageName>` to send a transaction.
|
|
||||||
*/
|
|
||||||
public readonly read: ContractGeneric<ContractOptions, ContractCallSend<ApiType>>;
|
|
||||||
|
|
||||||
readonly #query: MapMessageQuery<ApiType> = {};
|
readonly #query: MapMessageQuery<ApiType> = {};
|
||||||
|
|
||||||
readonly #tx: MapMessageTx<ApiType> = {};
|
readonly #tx: MapMessageTx<ApiType> = {};
|
||||||
@@ -109,18 +63,14 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
super(api, abi, decorateMethod);
|
super(api, abi, decorateMethod);
|
||||||
|
|
||||||
this.address = this.registry.createType('AccountId', address);
|
this.address = this.registry.createType('AccountId', address);
|
||||||
this.exec = createWithId(this.#exec);
|
|
||||||
this.read = createWithId(this.#read);
|
|
||||||
|
|
||||||
this.abi.messages.forEach((m): void => {
|
this.abi.messages.forEach((m): void => {
|
||||||
const messageName = stringCamelCase(m.identifier);
|
if (isUndefined(this.#tx[m.method])) {
|
||||||
|
this.#tx[m.method] = createTx((o, p) => this.#exec(m, o, p));
|
||||||
if (isUndefined(this.#tx[messageName])) {
|
|
||||||
this.#tx[messageName] = createTx((o, p) => this.#exec(m, o, p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUndefined(this.#query[messageName])) {
|
if (isUndefined(this.#query[m.method])) {
|
||||||
this.#query[messageName] = createQuery((f, o, p) => this.#read(m, o, p).send(f));
|
this.#query[m.method] = createQuery((f, o, p) => this.#read(m, o, p).send(f));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -142,21 +92,27 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
#getGas = (_gasLimit: BigInt | BN | string | number, isCall = false): BN => {
|
#getGas = (_gasLimit: BigInt | BN | string | number, isCall = false): BN => {
|
||||||
const gasLimit = bnToBn(_gasLimit);
|
const gasLimit = bnToBn(_gasLimit);
|
||||||
|
|
||||||
return gasLimit.lten(0)
|
return gasLimit.lte(BN_ZERO)
|
||||||
? isCall
|
? isCall
|
||||||
? MAX_CALL_GAS
|
? MAX_CALL_GAS
|
||||||
: (this.api.consts.system.blockWeights
|
: (this.api.consts.system.blockWeights
|
||||||
? this.api.consts.system.blockWeights.maxBlock
|
? this.api.consts.system.blockWeights.maxBlock
|
||||||
: this.api.consts.system.maximumBlockWeight as Weight
|
: this.api.consts.system.maximumBlockWeight as Weight
|
||||||
).muln(64).divn(100)
|
).muln(64).div(BN_HUNDRED)
|
||||||
: gasLimit;
|
: gasLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = 0, value = 0 }: ContractOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType> => {
|
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType> => {
|
||||||
return this.api.tx.contracts
|
return this.api.tx.contracts
|
||||||
.call(this.address, value, this.#getGas(gasLimit), this.abi.findMessage(messageOrId).toU8a(params))
|
.call(
|
||||||
|
this.address,
|
||||||
|
value,
|
||||||
|
this.#getGas(gasLimit),
|
||||||
|
this.abi.findMessage(messageOrId).toU8a(params)
|
||||||
|
)
|
||||||
.withResultTransform((result: ISubmittableResult) =>
|
.withResultTransform((result: ISubmittableResult) =>
|
||||||
new ContractSubmittableResult(result, applyOnEvent(result, 'ContractExecution', (records: EventRecord[]) =>
|
// ContractEmitted is the current generation, ContractExecution is the previous generation
|
||||||
|
new ContractSubmittableResult(result, applyOnEvent(result, ['ContractEmitted', 'ContractExecution'], (records: EventRecord[]) =>
|
||||||
records
|
records
|
||||||
.map(({ event: { data: [, data] } }): DecodedEvent | null => {
|
.map(({ event: { data: [, data] } }): DecodedEvent | null => {
|
||||||
try {
|
try {
|
||||||
@@ -172,7 +128,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#read = (messageOrId: AbiMessage | string | number, { gasLimit = 0, value = 0 }: ContractOptions, params: CodecArg[]): ContractCallSend<ApiType> => {
|
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: CodecArg[]): ContractCallSend<ApiType> => {
|
||||||
assert(this.hasRpcContractsCall, ERROR_NO_CALL);
|
assert(this.hasRpcContractsCall, ERROR_NO_CALL);
|
||||||
|
|
||||||
const message = this.abi.findMessage(messageOrId);
|
const message = this.abi.findMessage(messageOrId);
|
||||||
@@ -180,24 +136,24 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
|
|||||||
return {
|
return {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
send: this._decorateMethod((origin: string | AccountId | Uint8Array) =>
|
send: this._decorateMethod((origin: string | AccountId | Uint8Array) =>
|
||||||
this.api.rx.rpc.contracts.call.json({
|
this.api.rx.rpc.contracts
|
||||||
dest: this.address,
|
.call({
|
||||||
gasLimit: this.#getGas(gasLimit, true),
|
dest: this.address,
|
||||||
inputData: message.toU8a(params),
|
gasLimit: this.#getGas(gasLimit, true),
|
||||||
origin,
|
inputData: message.toU8a(params),
|
||||||
value
|
origin,
|
||||||
}).pipe(map((json): ContractCallOutcome => {
|
value
|
||||||
const { debugMessage, gasConsumed, result } = mapExecResult(this.registry, json.toJSON());
|
})
|
||||||
|
.pipe(
|
||||||
return {
|
map(({ debugMessage, gasConsumed, result }): ContractCallOutcome => ({
|
||||||
debugMessage,
|
debugMessage,
|
||||||
gasConsumed,
|
gasConsumed,
|
||||||
output: result.isOk && message.returnType
|
output: result.isOk && message.returnType
|
||||||
? formatData(this.registry, result.asOk.data, message.returnType)
|
? createTypeUnsafe(this.registry, message.returnType.type, [result.asOk.data.toU8a(true)], { isPedantic: true })
|
||||||
: null,
|
: null,
|
||||||
result
|
result
|
||||||
};
|
}))
|
||||||
}))
|
)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ import { TypeRegistry } from '@polkadot/types';
|
|||||||
const registry = new TypeRegistry();
|
const registry = new TypeRegistry();
|
||||||
|
|
||||||
export const mockApi = {
|
export const mockApi = {
|
||||||
|
isConnected: true,
|
||||||
registry,
|
registry,
|
||||||
rx: {
|
tx: {
|
||||||
tx: {
|
contracts: {
|
||||||
contracts: {
|
instantiateWithCode: (): never => {
|
||||||
putCode: (): never => {
|
throw new Error('mock');
|
||||||
throw new Error('mock');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type BN from 'bn.js';
|
|
||||||
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
||||||
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
|
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
|
||||||
import type { AccountId } from '@polkadot/types/interfaces';
|
import type { AccountId } from '@polkadot/types/interfaces';
|
||||||
import type { CodecArg } from '@polkadot/types/types';
|
import type { CodecArg } from '@polkadot/types/types';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
|
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ export interface ContractGeneric<O, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type ContractCallResult<ApiType extends ApiTypes, T> = ApiType extends 'rxjs'
|
export type ContractCallResult<ApiType extends ApiTypes, T> = ApiType extends 'rxjs'
|
||||||
? Observable<Observable<T>>
|
? Observable<T>
|
||||||
: Promise<ObsInnerType<Observable<T>>>;
|
: Promise<ObsInnerType<Observable<T>>>;
|
||||||
|
|
||||||
export interface ContractCallSend<ApiType extends ApiTypes> {
|
export interface ContractCallSend<ApiType extends ApiTypes> {
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import type { SubmittableResult } from '@polkadot/api';
|
||||||
|
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
||||||
|
import type { ApiTypes } from '@polkadot/api/types';
|
||||||
|
import type { CodecArg } from '@polkadot/types/types';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
|
import type { AbiConstructor, BlueprintOptions } from '../types';
|
||||||
|
import type { BlueprintDeploy, ContractGeneric } from './types';
|
||||||
|
|
||||||
|
import { Bytes } from '@polkadot/types';
|
||||||
|
import { compactAddLength, u8aToU8a } from '@polkadot/util';
|
||||||
|
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||||
|
|
||||||
|
import { extractOptions, isOptions } from '../util';
|
||||||
|
|
||||||
|
export const EMPTY_SALT = new Uint8Array();
|
||||||
|
|
||||||
|
export function createBluePrintTx <ApiType extends ApiTypes, R extends SubmittableResult> (fn: (options: BlueprintOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType, R>): BlueprintDeploy<ApiType> {
|
||||||
|
return (options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType, R> =>
|
||||||
|
isOptions(options)
|
||||||
|
? fn(options, params)
|
||||||
|
: fn(...extractOptions(options, params));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createBluePrintWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]) => T): ContractGeneric<BlueprintOptions, T> {
|
||||||
|
return (constructorOrId: AbiConstructor | string | number, options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): T =>
|
||||||
|
isOptions(options)
|
||||||
|
? fn(constructorOrId, options, params)
|
||||||
|
: fn(constructorOrId, ...extractOptions(options, params));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeSalt (salt: Uint8Array | string | null = randomAsU8a()): Uint8Array {
|
||||||
|
return salt instanceof Bytes
|
||||||
|
? salt
|
||||||
|
: salt && salt.length
|
||||||
|
? compactAddLength(u8aToU8a(salt))
|
||||||
|
: EMPTY_SALT;
|
||||||
|
}
|
||||||
@@ -30,14 +30,12 @@ async function checkContract (api: ApiPromise, pairs: TestKeyringMap): Promise<v
|
|||||||
// execute
|
// execute
|
||||||
await contract.tx.inc({ gasLimit: 1234 }, 123).signAndSend(pairs.eve);
|
await contract.tx.inc({ gasLimit: 1234 }, 123).signAndSend(pairs.eve);
|
||||||
await contract.tx.inc(123, 456, 69).signAndSend(pairs.eve);
|
await contract.tx.inc(123, 456, 69).signAndSend(pairs.eve);
|
||||||
|
|
||||||
// deprecated
|
|
||||||
await contract.read('get', {}).send(pairs.eve.address);
|
|
||||||
await contract.exec('inc', {}, 123).signAndSend(pairs.dave);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main (): Promise<void> {
|
async function main (): Promise<void> {
|
||||||
const api = await ApiPromise.create();
|
const api = await ApiPromise.create({
|
||||||
|
hasher: (data: Uint8Array): Uint8Array => data
|
||||||
|
});
|
||||||
const pairs = createTestPairs();
|
const pairs = createTestPairs();
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { packageInfo as apiInfo } from '@polkadot/api/packageInfo';
|
||||||
|
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
|
||||||
|
import { detectPackage } from '@polkadot/util';
|
||||||
|
|
||||||
|
import { packageInfo } from './packageInfo';
|
||||||
|
|
||||||
|
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [apiInfo, typesInfo]);
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
export { Abi } from './Abi';
|
import './detectPackage';
|
||||||
|
|
||||||
export { Blueprint as BlueprintRx, Code as CodeRx, Contract as ContractRx } from './rx';
|
export { Abi } from './Abi';
|
||||||
|
export { packageInfo } from './packageInfo';
|
||||||
export { Blueprint as BlueprintPromise, Code as CodePromise, Contract as ContractPromise } from './promise';
|
export { Blueprint as BlueprintPromise, Code as CodePromise, Contract as ContractPromise } from './promise';
|
||||||
|
export { Blueprint as BlueprintRx, Code as CodeRx, Contract as ContractRx } from './rx';
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
|
export const packageInfo = { name: '@polkadot/api-contract', version: '4.16.2' };
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type BN from 'bn.js';
|
|
||||||
import type { ApiBase } from '@polkadot/api/base';
|
import type { ApiBase } from '@polkadot/api/base';
|
||||||
import type { ApiTypes } from '@polkadot/api/types';
|
import type { ApiTypes } from '@polkadot/api/types';
|
||||||
import type { Text, u64 } from '@polkadot/types';
|
import type { Text, u64 } from '@polkadot/types';
|
||||||
import type { ContractExecResultResult, ContractSelector } from '@polkadot/types/interfaces';
|
import type { ContractExecResultResult, ContractSelector } from '@polkadot/types/interfaces';
|
||||||
import type { Codec, CodecArg, TypeDef } from '@polkadot/types/types';
|
import type { Codec, CodecArg, TypeDef } from '@polkadot/types/types';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Abi } from '.';
|
import type { Abi } from '.';
|
||||||
|
|
||||||
export interface ContractBase<ApiType extends ApiTypes> {
|
export interface ContractBase<ApiType extends ApiTypes> {
|
||||||
@@ -39,9 +39,10 @@ export interface AbiMessage {
|
|||||||
isConstructor?: boolean;
|
isConstructor?: boolean;
|
||||||
isMutating?: boolean;
|
isMutating?: boolean;
|
||||||
isPayable?: boolean;
|
isPayable?: boolean;
|
||||||
|
method: string;
|
||||||
returnType?: TypeDef | null;
|
returnType?: TypeDef | null;
|
||||||
selector: ContractSelector;
|
selector: ContractSelector;
|
||||||
toU8a: (params: CodecArg[], additional?: Uint8Array) => Uint8Array;
|
toU8a: (params: CodecArg[]) => Uint8Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AbiConstructor = AbiMessage;
|
export type AbiConstructor = AbiMessage;
|
||||||
|
|||||||
@@ -2,27 +2,20 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { SubmittableResult } from '@polkadot/api';
|
import type { SubmittableResult } from '@polkadot/api';
|
||||||
import type { Raw } from '@polkadot/types';
|
|
||||||
import type { EventRecord } from '@polkadot/types/interfaces';
|
import type { EventRecord } from '@polkadot/types/interfaces';
|
||||||
import type { Codec, CodecArg, Registry, TypeDef } from '@polkadot/types/types';
|
import type { CodecArg } from '@polkadot/types/types';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { BlueprintOptions, ContractOptions } from './types';
|
import type { BlueprintOptions, ContractOptions } from './types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
|
||||||
|
|
||||||
import { createTypeUnsafe } from '@polkadot/types/create';
|
|
||||||
import { isBigInt, isBn, isNumber, isString } from '@polkadot/util';
|
import { isBigInt, isBn, isNumber, isString } from '@polkadot/util';
|
||||||
|
|
||||||
type ContractEvents = 'CodeStored' | 'ContractExecution' | 'Instantiated';
|
type ContractEvents = 'CodeStored' | 'ContractEmitted' | 'ContractExecution' | 'Instantiated';
|
||||||
|
|
||||||
type TOptions = BlueprintOptions | ContractOptions;
|
type TOptions = BlueprintOptions | ContractOptions;
|
||||||
|
|
||||||
export function formatData (registry: Registry, data: Raw, { type }: TypeDef): Codec {
|
export function applyOnEvent <T> (result: SubmittableResult, types: ContractEvents[], fn: (records: EventRecord[]) => T): T | undefined {
|
||||||
return createTypeUnsafe(registry, type, [data], { isPedantic: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
export function applyOnEvent <T> (result: SubmittableResult, type: ContractEvents, fn: (records: EventRecord[]) => T): T | undefined {
|
|
||||||
if (result.isInBlock || result.isFinalized) {
|
if (result.isInBlock || result.isFinalized) {
|
||||||
const records = result.filterRecords('contracts', type);
|
const records = result.filterRecords('contracts', types);
|
||||||
|
|
||||||
if (records.length) {
|
if (records.length) {
|
||||||
return fn(records);
|
return fn(records);
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"info": 6,
|
||||||
|
"type": "bool"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -6,5 +6,6 @@ export { default as dns } from './dns.json';
|
|||||||
export { default as erc20 } from './erc20.json';
|
export { default as erc20 } from './erc20.json';
|
||||||
export { default as erc721 } from './erc721.json';
|
export { default as erc721 } from './erc721.json';
|
||||||
export { default as flipper } from './flipper.json';
|
export { default as flipper } from './flipper.json';
|
||||||
|
export { default as flipperBundle } from './flipper.contract.json';
|
||||||
export { default as incrementer } from './incrementer.json';
|
export { default as incrementer } from './incrementer.json';
|
||||||
export { default as multisigPlain } from './multisig_plain.json';
|
export { default as multisigPlain } from './multisig_plain.json';
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/api-derive",
|
"name": "@polkadot/api-derive",
|
||||||
"version": "3.4.1",
|
"version": "4.16.2",
|
||||||
|
"type": "module",
|
||||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "index.mjs",
|
"sideEffects": [
|
||||||
"sideEffects": false,
|
"./detectPackage.js",
|
||||||
|
"./detectPackage.cjs"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
},
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
@@ -13,17 +19,16 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.12.5",
|
"@babel/runtime": "^7.14.6",
|
||||||
"@polkadot/api": "3.4.1",
|
"@polkadot/api": "4.16.2",
|
||||||
"@polkadot/rpc-core": "3.4.1",
|
"@polkadot/rpc-core": "4.16.2",
|
||||||
"@polkadot/types": "3.4.1",
|
"@polkadot/types": "4.16.2",
|
||||||
"@polkadot/util": "^5.2.3",
|
"@polkadot/util": "^6.10.1",
|
||||||
"@polkadot/util-crypto": "^5.2.3",
|
"@polkadot/util-crypto": "^6.10.1",
|
||||||
"@polkadot/x-rxjs": "3.4.1",
|
"@polkadot/x-rxjs": "^6.10.1"
|
||||||
"bn.js": "^4.11.9"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^5.2.3",
|
"@polkadot/keyring": "^6.10.1",
|
||||||
"@polkadot/rpc-provider": "3.4.1"
|
"@polkadot/rpc-provider": "4.16.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,11 @@ function parseFlags (address: AccountId | Address | string | null | undefined, [
|
|||||||
*/
|
*/
|
||||||
export function flags (instanceId: string, api: ApiInterfaceRx): (address?: AccountId | Address | string | null) => Observable<DeriveAccountFlags> {
|
export function flags (instanceId: string, api: ApiInterfaceRx): (address?: AccountId | Address | string | null) => Observable<DeriveAccountFlags> {
|
||||||
return memo(instanceId, (address?: AccountId | Address | string | null): Observable<DeriveAccountFlags> => {
|
return memo(instanceId, (address?: AccountId | Address | string | null): Observable<DeriveAccountFlags> => {
|
||||||
const councilSection = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections';
|
const councilSection = api.query.phragmenElection
|
||||||
|
? 'phragmenElection'
|
||||||
|
: api.query.electionsPhragmen
|
||||||
|
? 'electionsPhragmen'
|
||||||
|
: 'elections';
|
||||||
|
|
||||||
return combineLatest<FlagsIntermediate>([
|
return combineLatest<FlagsIntermediate>([
|
||||||
address && api.query[councilSection]?.members
|
address && api.query[councilSection]?.members
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { AccountIndex } from '@polkadot/types/interfaces';
|
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { AccountIndexes } from '../types';
|
import type { AccountIndexes } from '../types';
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
|
|||||||
map((entries): AccountIndexes =>
|
map((entries): AccountIndexes =>
|
||||||
entries.reduce((indexes: AccountIndexes, [key, idOpt]): AccountIndexes => {
|
entries.reduce((indexes: AccountIndexes, [key, idOpt]): AccountIndexes => {
|
||||||
if (idOpt.isSome) {
|
if (idOpt.isSome) {
|
||||||
indexes[idOpt.unwrap()[0].toString()] = key.args[0] as AccountIndex;
|
indexes[idOpt.unwrap()[0].toString()] = key.args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return indexes;
|
return indexes;
|
||||||
|
|||||||
@@ -1,29 +1,54 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||||
import type { AccountData, AccountId, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
|
import type { AccountData, AccountId, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
|
||||||
import type { ITuple } from '@polkadot/types/types';
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveBalancesAccount } from '../types';
|
import type { DeriveBalancesAccount, DeriveBalancesAccountData } from '../types';
|
||||||
|
|
||||||
import { isFunction } from '@polkadot/util';
|
import { assert, isFunction } from '@polkadot/util';
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
type Result = [Balance, Balance, Balance, Balance, Index];
|
type BalanceResult = [Balance, Balance, Balance, Balance];
|
||||||
|
|
||||||
|
type Result = [Index, BalanceResult[]];
|
||||||
|
|
||||||
|
type DeriveCustomAccount = ApiInterfaceRx['derive'] & {
|
||||||
|
[custom: string]: {
|
||||||
|
customAccount?: ApiInterfaceRx['query']['balances']['account']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function zeroBalance (api: ApiInterfaceRx) {
|
||||||
|
return api.registry.createType('Balance');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenFee, frozenMisc]: BalanceResult): DeriveBalancesAccountData {
|
||||||
|
const votingBalance = api.registry.createType('Balance', freeBalance.toBn());
|
||||||
|
|
||||||
function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBalance, frozenFee, frozenMisc, accountNonce]]: [AccountId, Result]): DeriveBalancesAccount {
|
|
||||||
return {
|
return {
|
||||||
accountId,
|
|
||||||
accountNonce,
|
|
||||||
freeBalance,
|
freeBalance,
|
||||||
frozenFee,
|
frozenFee,
|
||||||
frozenMisc,
|
frozenMisc,
|
||||||
reservedBalance,
|
reservedBalance,
|
||||||
votingBalance: api.registry.createType('Balance', freeBalance.toBn())
|
votingBalance
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function calcBalances (api: ApiInterfaceRx, [accountId, [accountNonce, balances]]: [AccountId, Result]): DeriveBalancesAccount {
|
||||||
|
const primary = balances[0];
|
||||||
|
|
||||||
|
assert(primary, 'No balances retrieved for account');
|
||||||
|
|
||||||
|
return {
|
||||||
|
accountId,
|
||||||
|
accountNonce,
|
||||||
|
additional: balances.filter((_, index) => index !== 0).map((b) => getBalance(api, b)),
|
||||||
|
...getBalance(api, primary)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,33 +59,66 @@ function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observab
|
|||||||
[api.query.balances.reservedBalance, accountId],
|
[api.query.balances.reservedBalance, accountId],
|
||||||
[api.query.system.accountNonce, accountId]
|
[api.query.system.accountNonce, accountId]
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([freeBalance, reservedBalance, accountNonce]): Result =>
|
map(([freeBalance, reservedBalance, accountNonce]): Result => [
|
||||||
[freeBalance, reservedBalance, api.registry.createType('Balance'), api.registry.createType('Balance'), accountNonce]
|
accountNonce,
|
||||||
)
|
[[freeBalance, reservedBalance, zeroBalance(api), zeroBalance(api)]]
|
||||||
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
function querySystemNonce (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||||
return api.queryMulti<[AccountData, Index]>([
|
return api.query.system.accountNonce<Index>(accountId).pipe(
|
||||||
[api.query.balances.account, accountId],
|
map((accountNonce): Result => [
|
||||||
[api.query.system.accountNonce, accountId]
|
accountNonce,
|
||||||
]).pipe(
|
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
|
||||||
map(([{ feeFrozen, free, miscFrozen, reserved }, accountNonce]): Result =>
|
])
|
||||||
[free, reserved, feeFrozen, miscFrozen, accountNonce]
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
|
||||||
|
const balances = modules.map(
|
||||||
|
(m): QueryableStorageMultiArg<'rxjs'> => [
|
||||||
|
(api.derive as DeriveCustomAccount)[m]?.customAccount || api.query[m].account,
|
||||||
|
accountId
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
const extract = (data: AccountData[]) =>
|
||||||
|
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen]);
|
||||||
|
|
||||||
|
// NOTE this is for the first case where we do have instances specified
|
||||||
|
return isFunction(api.query.system.account)
|
||||||
|
? api.queryMulti<[AccountInfo, ...(AccountData[])]>([[api.query.system.account, accountId], ...balances]).pipe(
|
||||||
|
map(([{ nonce }, ...balances]): Result => [nonce, extract(balances)])
|
||||||
|
)
|
||||||
|
: api.queryMulti<[Index, ...(AccountData[])]>([[api.query.system.accountNonce, accountId], ...balances]).pipe(
|
||||||
|
map(([nonce, ...balances]): Result => [nonce, extract(balances)])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function querySystemAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||||
// AccountInfo is current, support old, eg. Edgeware
|
// AccountInfo is current, support old, eg. Edgeware
|
||||||
return api.query.system.account<AccountInfo | ITuple<[Index, AccountData]>>(accountId).pipe(
|
return api.query.system.account<AccountInfo | ITuple<[Index, AccountData]>>(accountId).pipe(
|
||||||
map((infoOrTuple): Result => {
|
map((infoOrTuple): Result => {
|
||||||
const { feeFrozen, free, miscFrozen, reserved } = (infoOrTuple as AccountInfo).nonce
|
const data = (infoOrTuple as AccountInfo).nonce
|
||||||
? (infoOrTuple as AccountInfo).data
|
? (infoOrTuple as AccountInfo).data
|
||||||
: (infoOrTuple as [Index, AccountData])[1];
|
: (infoOrTuple as [Index, AccountData])[1];
|
||||||
const accountNonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
|
|
||||||
|
|
||||||
return [free, reserved, feeFrozen, miscFrozen, accountNonce];
|
const nonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
|
||||||
|
|
||||||
|
if (!data || data.isEmpty) {
|
||||||
|
return [
|
||||||
|
nonce,
|
||||||
|
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
const { feeFrozen, free, miscFrozen, reserved } = data;
|
||||||
|
|
||||||
|
return [
|
||||||
|
nonce,
|
||||||
|
[[free, reserved, feeFrozen, miscFrozen]]
|
||||||
|
];
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -81,19 +139,31 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export function account (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAccount> {
|
export function account (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAccount> {
|
||||||
|
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
|
||||||
|
const empty: Result = [
|
||||||
|
api.registry.createType('Index'),
|
||||||
|
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
|
||||||
|
];
|
||||||
|
|
||||||
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAccount> =>
|
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAccount> =>
|
||||||
api.derive.accounts.accountId(address).pipe(
|
api.derive.accounts.accountId(address).pipe(
|
||||||
switchMap((accountId): Observable<[AccountId, Result]> =>
|
switchMap((accountId): Observable<[AccountId, Result]> =>
|
||||||
(accountId
|
(accountId
|
||||||
? combineLatest([
|
? combineLatest([
|
||||||
of(accountId),
|
of(accountId),
|
||||||
isFunction(api.query.system.account)
|
balanceInstances
|
||||||
? queryCurrent(api, accountId)
|
? queryBalancesAccount(api, accountId, balanceInstances)
|
||||||
: isFunction(api.query.balances.account)
|
: isFunction(api.query.system?.account)
|
||||||
? queryBalancesAccount(api, accountId)
|
? querySystemAccount(api, accountId)
|
||||||
: queryBalancesFree(api, accountId)
|
: isFunction(api.query.balances?.account)
|
||||||
|
? queryBalancesAccount(api, accountId)
|
||||||
|
: isFunction(api.query.balances?.freeBalance)
|
||||||
|
? queryBalancesFree(api, accountId)
|
||||||
|
: isFunction(api.query.system?.accountNonce)
|
||||||
|
? querySystemNonce(api, accountId)
|
||||||
|
: of(empty)
|
||||||
])
|
])
|
||||||
: of([api.registry.createType('AccountId'), [api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Index')]])
|
: of([api.registry.createType('AccountId'), empty])
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
map((result): DeriveBalancesAccount => calcBalances(api, result))
|
map((result): DeriveBalancesAccount => calcBalances(api, result))
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||||
import type { Option, Vec } from '@polkadot/types';
|
import type { Option, Vec } from '@polkadot/types';
|
||||||
import type { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
|
import type { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveBalancesAccount, DeriveBalancesAll } from '../types';
|
import type { DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData } from '../types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
import { BN, bnMax, isFunction } from '@polkadot/util';
|
||||||
|
|
||||||
import { bnMax, isFunction } from '@polkadot/util';
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
type ResultBalance = [VestingInfo | null, (BalanceLock | BalanceLockTo212)[]];
|
type BalanceLocksEntry = Vec<BalanceLock | BalanceLockTo212>;
|
||||||
|
type BalanceLocks = BalanceLocksEntry[];
|
||||||
|
type ResultBalance = [VestingInfo | null, ((BalanceLock | BalanceLockTo212)[])[]];
|
||||||
type Result = [DeriveBalancesAccount, BlockNumber, ResultBalance];
|
type Result = [DeriveBalancesAccount, BlockNumber, ResultBalance];
|
||||||
|
|
||||||
interface AllLocked {
|
interface AllLocked {
|
||||||
@@ -25,6 +25,12 @@ interface AllLocked {
|
|||||||
vestingLocked: Balance
|
vestingLocked: Balance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DeriveCustomLocks = ApiInterfaceRx['derive'] & {
|
||||||
|
[custom: string]: {
|
||||||
|
customLocks?: ApiInterfaceRx['query']['balances']['locks']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const VESTING_ID = '0x76657374696e6720';
|
const VESTING_ID = '0x76657374696e6720';
|
||||||
|
|
||||||
function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (BalanceLock | BalanceLockTo212)[]): AllLocked {
|
function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (BalanceLock | BalanceLockTo212)[]): AllLocked {
|
||||||
@@ -36,11 +42,11 @@ function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (Balan
|
|||||||
if (Array.isArray(locks)) {
|
if (Array.isArray(locks)) {
|
||||||
// only get the locks that are valid until passed the current block
|
// only get the locks that are valid until passed the current block
|
||||||
lockedBreakdown = (locks as BalanceLockTo212[]).filter(({ until }): boolean => !until || (bestNumber && until.gt(bestNumber)));
|
lockedBreakdown = (locks as BalanceLockTo212[]).filter(({ until }): boolean => !until || (bestNumber && until.gt(bestNumber)));
|
||||||
allLocked = lockedBreakdown.some(({ amount }) => amount.isMax());
|
allLocked = lockedBreakdown.some(({ amount }) => amount && amount.isMax());
|
||||||
vestingLocked = api.registry.createType('Balance', lockedBreakdown.filter(({ id }) => id.eq(VESTING_ID)).reduce((result: BN, { amount }) => result.iadd(amount), new BN(0)));
|
vestingLocked = api.registry.createType('Balance', lockedBreakdown.filter(({ id }) => id.eq(VESTING_ID)).reduce((result: BN, { amount }) => result.iadd(amount), new BN(0)));
|
||||||
|
|
||||||
// get the maximum of the locks according to https://github.com/paritytech/substrate/blob/master/srml/balances/src/lib.rs#L699
|
// get the maximum of the locks according to https://github.com/paritytech/substrate/blob/master/srml/balances/src/lib.rs#L699
|
||||||
const notAll = lockedBreakdown.filter(({ amount }) => !amount.isMax());
|
const notAll = lockedBreakdown.filter(({ amount }) => amount && !amount.isMax());
|
||||||
|
|
||||||
if (notAll.length) {
|
if (notAll.length) {
|
||||||
lockedBalance = api.registry.createType('Balance', bnMax(...notAll.map(({ amount }): Balance => amount)));
|
lockedBalance = api.registry.createType('Balance', bnMax(...notAll.map(({ amount }): Balance => amount)));
|
||||||
@@ -50,8 +56,20 @@ function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (Balan
|
|||||||
return { allLocked, lockedBalance, lockedBreakdown, vestingLocked };
|
return { allLocked, lockedBalance, lockedBreakdown, vestingLocked };
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBalance, frozenFee, frozenMisc, reservedBalance, votingBalance }, bestNumber, [vesting, locks]]: Result): DeriveBalancesAll {
|
function calcShared (api: ApiInterfaceRx, bestNumber: BlockNumber, data: DeriveBalancesAccountData, locks: (BalanceLock | BalanceLockTo212)[]): DeriveBalancesAllAccountData {
|
||||||
const { allLocked, lockedBalance, lockedBreakdown, vestingLocked } = calcLocked(api, bestNumber, locks);
|
const { allLocked, lockedBalance, lockedBreakdown, vestingLocked } = calcLocked(api, bestNumber, locks);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...data,
|
||||||
|
availableBalance: api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), data.freeBalance.sub(lockedBalance))),
|
||||||
|
lockedBalance,
|
||||||
|
lockedBreakdown,
|
||||||
|
vestingLocked
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function calcBalances (api: ApiInterfaceRx, [data, bestNumber, [vesting, allLocks]]: Result): DeriveBalancesAll {
|
||||||
|
const shared = calcShared(api, bestNumber, data, allLocks[0]);
|
||||||
// Calculate the vesting balances,
|
// Calculate the vesting balances,
|
||||||
// - offset = balance locked at startingBlock
|
// - offset = balance locked at startingBlock
|
||||||
// - perBlock is the unlock amount
|
// - perBlock is the unlock amount
|
||||||
@@ -59,29 +77,19 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
|
|||||||
const isStarted = bestNumber.gt(startingBlock);
|
const isStarted = bestNumber.gt(startingBlock);
|
||||||
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
|
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
|
||||||
const vestedBalance = vestedNow.gt(vestingTotal) ? vestingTotal : api.registry.createType('Balance', vestedNow);
|
const vestedBalance = vestedNow.gt(vestingTotal) ? vestingTotal : api.registry.createType('Balance', vestedNow);
|
||||||
const isVesting = isStarted && !vestingLocked.isZero();
|
const isVesting = isStarted && !shared.vestingLocked.isZero();
|
||||||
const vestedClaimable = api.registry.createType('Balance', isVesting ? vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0);
|
|
||||||
const availableBalance = api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), freeBalance.sub(lockedBalance)));
|
|
||||||
const vestingEndBlock = api.registry.createType('BlockNumber', isVesting ? vestingTotal.div(perBlock).add(startingBlock) : 0);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
accountId,
|
...shared,
|
||||||
accountNonce,
|
accountId: data.accountId,
|
||||||
availableBalance,
|
accountNonce: data.accountNonce,
|
||||||
freeBalance,
|
additional: allLocks.filter((_, index) => index !== 0).map((l, index) => calcShared(api, bestNumber, data.additional[index], l)),
|
||||||
frozenFee,
|
|
||||||
frozenMisc,
|
|
||||||
isVesting,
|
isVesting,
|
||||||
lockedBalance,
|
|
||||||
lockedBreakdown,
|
|
||||||
reservedBalance,
|
|
||||||
vestedBalance,
|
vestedBalance,
|
||||||
vestedClaimable,
|
vestedClaimable: api.registry.createType('Balance', isVesting ? shared.vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0),
|
||||||
vestingEndBlock,
|
vestingEndBlock: api.registry.createType('BlockNumber', isVesting ? vestingTotal.div(perBlock).add(startingBlock) : 0),
|
||||||
vestingLocked,
|
|
||||||
vestingPerBlock: perBlock,
|
vestingPerBlock: perBlock,
|
||||||
vestingTotal,
|
vestingTotal
|
||||||
votingBalance
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,28 +108,43 @@ function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result
|
|||||||
vestingNew = api.registry.createType('VestingInfo', { locked, perBlock, startingBlock });
|
vestingNew = api.registry.createType('VestingInfo', { locked, perBlock, startingBlock });
|
||||||
}
|
}
|
||||||
|
|
||||||
return [vestingNew, locks];
|
return [vestingNew, [locks]];
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// current (balances vesting)
|
const isNonNullable = <T>(nullable: T): nullable is NonNullable<T> => !!nullable;
|
||||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
|
|
||||||
|
// current (balances, vesting)
|
||||||
|
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
|
||||||
|
const lockCalls = balanceInstances.map(
|
||||||
|
(m): ApiInterfaceRx['query']['balances']['locks'] | undefined =>
|
||||||
|
(api.derive as DeriveCustomLocks)[m]?.customLocks || api.query[m as 'balances']?.locks
|
||||||
|
);
|
||||||
|
|
||||||
|
const lockEmpty = lockCalls.map((c) => !c);
|
||||||
|
const lockQueries = lockCalls.filter(isNonNullable).map((c): QueryableStorageMultiArg<'rxjs'> => [c, accountId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
api.query.vesting?.vesting
|
api.query.vesting?.vesting
|
||||||
? api.queryMulti<[Vec<BalanceLock>, Option<VestingInfo>]>([
|
? api.queryMulti<[Option<VestingInfo>, ...BalanceLocks]>([
|
||||||
[api.query.balances.locks, accountId],
|
[api.query.vesting.vesting, accountId],
|
||||||
[api.query.vesting.vesting, accountId]
|
...lockQueries
|
||||||
])
|
])
|
||||||
: api.query.balances.locks(accountId).pipe(
|
// TODO We need to check module instances here as well, not only the balances module
|
||||||
map((locks): [Vec<BalanceLock>, Option<VestingInfo>] =>
|
: lockQueries.length
|
||||||
[locks, api.registry.createType('Option<VestingInfo>')]
|
? api.queryMulti<[...(Vec<BalanceLock>)[]]>(lockQueries).pipe(
|
||||||
|
map((locks): [Option<VestingInfo>, ...BalanceLocks] =>
|
||||||
|
[api.registry.createType('Option<VestingInfo>'), ...locks]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
: of([api.registry.createType('Option<VestingInfo>')] as [Option<VestingInfo>])
|
||||||
).pipe(
|
).pipe(
|
||||||
map(([locks, optVesting]): ResultBalance =>
|
map(([optVesting, ...locks]): ResultBalance => {
|
||||||
[optVesting.unwrapOr(null), locks]
|
let offset = -1;
|
||||||
)
|
|
||||||
|
return [optVesting.unwrapOr(null), lockEmpty.map((e) => e ? api.registry.createType('Vec<BalanceLock>') : locks[++offset])];
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +164,8 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export function all (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAll> {
|
export function all (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAll> {
|
||||||
|
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
|
||||||
|
|
||||||
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAll> =>
|
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAll> =>
|
||||||
api.derive.balances.account(address).pipe(
|
api.derive.balances.account(address).pipe(
|
||||||
switchMap((account): Observable<Result> =>
|
switchMap((account): Observable<Result> =>
|
||||||
@@ -148,11 +173,11 @@ export function all (instanceId: string, api: ApiInterfaceRx): (address: Account
|
|||||||
? combineLatest([
|
? combineLatest([
|
||||||
of(account),
|
of(account),
|
||||||
api.derive.chain.bestNumber(),
|
api.derive.chain.bestNumber(),
|
||||||
isFunction(api.query.system.account) || isFunction(api.query.balances.account)
|
isFunction(api.query.system?.account) || isFunction(api.query.balances?.account)
|
||||||
? queryCurrent(api, account.accountId)
|
? queryCurrent(api, account.accountId, balanceInstances)
|
||||||
: queryOld(api, account.accountId)
|
: queryOld(api, account.accountId)
|
||||||
])
|
])
|
||||||
: of([account, api.registry.createType('BlockNumber'), [null, api.registry.createType('Vec<BalanceLock>')]])
|
: of([account, api.registry.createType('BlockNumber'), [null, []]])
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
map((result): DeriveBalancesAll => calcBalances(api, result))
|
map((result): DeriveBalancesAll => calcBalances(api, result))
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ describe('bounties derive', () => {
|
|||||||
let storageKey: (index: number) => StorageKey;
|
let storageKey: (index: number) => StorageKey;
|
||||||
let defaultBounty: () => Bounty;
|
let defaultBounty: () => Bounty;
|
||||||
let emptyOption: <T extends Codec> (typeName: keyof InterfaceTypes) => Option<T>;
|
let emptyOption: <T extends Codec> (typeName: keyof InterfaceTypes) => Option<T>;
|
||||||
let optionOf: <T extends Codec> (value: T)=> Option<T>;
|
let optionOf: <T extends Codec> (value: T) => Option<T>;
|
||||||
let bountyIndex: (index: number) => BountyIndex;
|
let bountyIndex: (index: number) => BountyIndex;
|
||||||
let proposalIndex: (index: number) => ProposalIndex;
|
let proposalIndex: (index: number) => ProposalIndex;
|
||||||
let bytes: (value: string) => Bytes;
|
let bytes: (value: string) => Bytes;
|
||||||
@@ -59,7 +59,7 @@ describe('bounties derive', () => {
|
|||||||
bountyDescriptions: {
|
bountyDescriptions: {
|
||||||
multi: () => of([
|
multi: () => of([
|
||||||
optionOf(bytes('make polkadot even better')),
|
optionOf(bytes('make polkadot even better')),
|
||||||
optionOf(bytes('this will be totally ignored'))
|
optionOf(bytes('some other bounty'))
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,6 +117,28 @@ describe('bounties derive', () => {
|
|||||||
expect(result[1].proposals).toHaveLength(0);
|
expect(result[1].proposals).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('when no council, returns bounties without motions', async () => {
|
||||||
|
const mockApi = {
|
||||||
|
...defaultMockApi,
|
||||||
|
query: {
|
||||||
|
...defaultMockApi.query,
|
||||||
|
council: null
|
||||||
|
}
|
||||||
|
} as unknown as ApiInterfaceRx;
|
||||||
|
|
||||||
|
const result = await bounties('', mockApi)().toPromise();
|
||||||
|
|
||||||
|
expect(result).toHaveLength(2);
|
||||||
|
expect(result[0].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
|
||||||
|
expect(result[0].description).toEqual('make polkadot even better');
|
||||||
|
expect(result[0].index.eq(0)).toBe(true);
|
||||||
|
expect(result[0].proposals).toHaveLength(0);
|
||||||
|
expect(result[1].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
|
||||||
|
expect(result[1].description).toEqual('some other bounty');
|
||||||
|
expect(result[1].index.eq(1)).toBe(true);
|
||||||
|
expect(result[1].proposals).toHaveLength(0);
|
||||||
|
});
|
||||||
|
|
||||||
it('combines bounties with motions', async () => {
|
it('combines bounties with motions', async () => {
|
||||||
const mockApi = {
|
const mockApi = {
|
||||||
...defaultMockApi,
|
...defaultMockApi,
|
||||||
|
|||||||
@@ -32,21 +32,25 @@ function parseResult ([maybeBounties, maybeDescriptions, ids, bountyProposals]:
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
|
export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
|
||||||
const bountyBase = api.query.bounties ? api.query.bounties : api.query.treasury;
|
const bountyBase = api.query.bounties || api.query.treasury;
|
||||||
|
|
||||||
return memo(instanceId, (): Observable<DeriveBounties> =>
|
return memo(instanceId, (): Observable<DeriveBounties> =>
|
||||||
combineLatest([
|
combineLatest([
|
||||||
bountyBase.bountyCount<BountyIndex>(),
|
bountyBase.bountyCount<BountyIndex>(),
|
||||||
api.query.council.proposalCount<ProposalIndex>()
|
api.query.council
|
||||||
|
? api.query.council.proposalCount<ProposalIndex>()
|
||||||
|
: of(0)
|
||||||
]).pipe(
|
]).pipe(
|
||||||
switchMap(() =>
|
switchMap(() =>
|
||||||
combineLatest([
|
combineLatest([
|
||||||
bountyBase.bounties.keys(),
|
bountyBase.bounties.keys<[BountyIndex]>(),
|
||||||
api.derive.council.proposals()
|
api.derive.council
|
||||||
|
? api.derive.council.proposals()
|
||||||
|
: of([])
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
switchMap(([keys, proposals]): Observable<Result> => {
|
switchMap(([keys, proposals]): Observable<Result> => {
|
||||||
const ids = keys.map(({ args: [id] }) => id as BountyIndex);
|
const ids = keys.map(({ args: [id] }) => id);
|
||||||
|
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
bountyBase.bounties.multi<Option<Bounty>>(ids),
|
bountyBase.bounties.multi<Option<Bounty>>(ids),
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
import type { SignedBlockExtended } from '../type/types';
|
||||||
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { catchError, map } from '@polkadot/x-rxjs/operators';
|
import { catchError, map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { SignedBlockExtended } from '../type';
|
import { createSignedBlockExtended } from '../type';
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +34,7 @@ export function getBlock (instanceId: string, api: ApiInterfaceRx): (hash: Uint8
|
|||||||
: of([])
|
: of([])
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([signedBlock, events, validators]): SignedBlockExtended =>
|
map(([signedBlock, events, validators]): SignedBlockExtended =>
|
||||||
new SignedBlockExtended(api.registry, signedBlock, events, validators)
|
createSignedBlockExtended(api.registry, signedBlock, events, validators)
|
||||||
),
|
),
|
||||||
catchError((): Observable<undefined> =>
|
catchError((): Observable<undefined> =>
|
||||||
// where rpc.chain.getHeader throws, we will land here - it can happen that
|
// where rpc.chain.getHeader throws, we will land here - it can happen that
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
import type { HeaderExtended } from '../type/types';
|
||||||
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { catchError, map } from '@polkadot/x-rxjs/operators';
|
import { catchError, map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { HeaderExtended } from '../type';
|
import { createHeaderExtended } from '../type';
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +34,7 @@ export function getHeader (instanceId: string, api: ApiInterfaceRx): (hash: Uint
|
|||||||
: of([])
|
: of([])
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([header, validators]): HeaderExtended =>
|
map(([header, validators]): HeaderExtended =>
|
||||||
new HeaderExtended(api.registry, header, validators)
|
createHeaderExtended(header.registry, header, validators)
|
||||||
),
|
),
|
||||||
catchError((): Observable<undefined> =>
|
catchError((): Observable<undefined> =>
|
||||||
// where rpc.chain.getHeader throws, we will land here - it can happen that
|
// where rpc.chain.getHeader throws, we will land here - it can happen that
|
||||||
|
|||||||
@@ -2,13 +2,15 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { AccountId, EventRecord, SignedBlock } from '@polkadot/types/interfaces';
|
import type { Vec } from '@polkadot/types';
|
||||||
|
import type { EventRecord, SignedBlock } from '@polkadot/types/interfaces';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
import type { HeaderExtended, SignedBlockExtended } from '../type/types';
|
||||||
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { SignedBlockExtended } from '../type';
|
import { createSignedBlockExtended } from '../type';
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,17 +20,17 @@ import { memo } from '../util';
|
|||||||
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<SignedBlockExtended> {
|
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<SignedBlockExtended> {
|
||||||
return memo(instanceId, (): Observable<SignedBlockExtended> =>
|
return memo(instanceId, (): Observable<SignedBlockExtended> =>
|
||||||
api.derive.chain.subscribeNewHeads().pipe(
|
api.derive.chain.subscribeNewHeads().pipe(
|
||||||
switchMap((header): Observable<[SignedBlock, EventRecord[], AccountId[] | undefined]> => {
|
switchMap((header): Observable<[SignedBlock, Vec<EventRecord>, HeaderExtended]> => {
|
||||||
const blockHash = header.hash;
|
const blockHash = header.createdAtHash || header.hash;
|
||||||
|
|
||||||
return combineLatest(
|
return combineLatest(
|
||||||
api.rpc.chain.getBlock(blockHash),
|
api.rpc.chain.getBlock(blockHash),
|
||||||
api.query.system.events.at(blockHash),
|
api.query.system.events.at(blockHash),
|
||||||
of(header.validators)
|
of(header)
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
map(([block, events, validators]) =>
|
map(([block, events, header]) =>
|
||||||
new SignedBlockExtended(api.registry, block, events, validators)
|
createSignedBlockExtended(block.registry, block, events, header.validators)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
import type { HeaderExtended } from '../type/types';
|
||||||
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { HeaderExtended } from '../type';
|
import { createHeaderExtended } from '../type';
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,10 +30,13 @@ export function subscribeNewHeads (instanceId: string, api: ApiInterfaceRx): ()
|
|||||||
api.rpc.chain.subscribeNewHeads(),
|
api.rpc.chain.subscribeNewHeads(),
|
||||||
api.query.session
|
api.query.session
|
||||||
? api.query.session.validators()
|
? api.query.session.validators()
|
||||||
: of([])
|
: of(undefined)
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([header, validators]): HeaderExtended =>
|
map(([header, validators]): HeaderExtended => {
|
||||||
new HeaderExtended(api.registry, header, validators)
|
header.createdAtHash = header.hash;
|
||||||
)
|
|
||||||
));
|
return createHeaderExtended(header.registry, header, validators);
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import { catchError, map, switchMap } from '@polkadot/x-rxjs/operators';
|
|||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
|
type Collective = 'council' | 'membership' | 'technicalCommittee';
|
||||||
|
|
||||||
type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]];
|
type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]];
|
||||||
|
|
||||||
function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] {
|
function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] {
|
||||||
@@ -29,7 +31,7 @@ function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): Derive
|
|||||||
.filter((proposal): proposal is DeriveCollectiveProposal => !!proposal);
|
.filter((proposal): proposal is DeriveCollectiveProposal => !!proposal);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): (hashes: (Hash | Uint8Array | string)[]) => Observable<DeriveCollectiveProposal[]> {
|
function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: Collective): (hashes: (Hash | Uint8Array | string)[]) => Observable<DeriveCollectiveProposal[]> {
|
||||||
return memo(instanceId, (hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> =>
|
return memo(instanceId, (hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> =>
|
||||||
(isFunction(api.query[section]?.proposals) && hashes.length
|
(isFunction(api.query[section]?.proposals) && hashes.length
|
||||||
? combineLatest<Result>([
|
? combineLatest<Result>([
|
||||||
@@ -49,19 +51,19 @@ function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: 'coun
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function proposals (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): () => Observable<DeriveCollectiveProposal[]> {
|
export function proposals (instanceId: string, api: ApiInterfaceRx, section: Collective): () => Observable<DeriveCollectiveProposal[]> {
|
||||||
const proposalsFrom = _proposalsFrom(instanceId, api, section);
|
const proposalsFrom = _proposalsFrom(instanceId, api, section);
|
||||||
|
|
||||||
return memo(instanceId, (): Observable<DeriveCollectiveProposal[]> =>
|
return memo(instanceId, (): Observable<DeriveCollectiveProposal[]> =>
|
||||||
isFunction(api.query[section]?.proposals)
|
isFunction(api.query[section]?.proposals)
|
||||||
? api.query[section].proposals().pipe(
|
? api.query[section as 'council'].proposals().pipe(
|
||||||
switchMap(proposalsFrom)
|
switchMap(proposalsFrom)
|
||||||
)
|
)
|
||||||
: of([] as DeriveCollectiveProposal[])
|
: of([] as DeriveCollectiveProposal[])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function proposal (instanceId: string, api: ApiInterfaceRx, section: 'council' | 'technicalCommittee' = 'council'): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
|
export function proposal (instanceId: string, api: ApiInterfaceRx, section: Collective): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
|
||||||
const proposalsFrom = _proposalsFrom(instanceId, api, section);
|
const proposalsFrom = _proposalsFrom(instanceId, api, section);
|
||||||
|
|
||||||
return memo(instanceId, (hash: Hash | Uint8Array | string): Observable<DeriveCollectiveProposal | null> =>
|
return memo(instanceId, (hash: Hash | Uint8Array | string): Observable<DeriveCollectiveProposal | null> =>
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveContractFees } from '../types';
|
import type { DeriveContractFees } from '../types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
|
||||||
|
|
||||||
import { of } from '@polkadot/x-rxjs';
|
import { of } from '@polkadot/x-rxjs';
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import { proposal as collectiveProposal, proposals as collectiveProposals } from
|
|||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
export function proposal (instanceId: string, api: ApiInterfaceRx): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
|
export function proposal (instanceId: string, api: ApiInterfaceRx): (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null> {
|
||||||
return memo(instanceId, collectiveProposal(instanceId, api));
|
return memo(instanceId, collectiveProposal(instanceId, api, 'council'));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCollectiveProposal[]> {
|
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCollectiveProposal[]> {
|
||||||
return memo(instanceId, collectiveProposals(instanceId, api));
|
return memo(instanceId, collectiveProposals(instanceId, api, 'council'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { Vec } from '@polkadot/types';
|
import type { Vec } from '@polkadot/types';
|
||||||
import type { AccountId, Balance } from '@polkadot/types/interfaces';
|
import type { AccountId, Balance, Voter } from '@polkadot/types/interfaces';
|
||||||
import type { ITuple } from '@polkadot/types/types';
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveCouncilVote, DeriveCouncilVotes } from '../types';
|
import type { DeriveCouncilVote, DeriveCouncilVotes } from '../types';
|
||||||
@@ -13,18 +13,25 @@ import { map } from '@polkadot/x-rxjs/operators';
|
|||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
|
// Voter is current tuple is 2.x-era
|
||||||
|
type VoteEntry = Voter | ITuple<[Balance, Vec<AccountId>]>;
|
||||||
|
|
||||||
|
function isVoter (value: VoteEntry): value is Voter {
|
||||||
|
return !Array.isArray(value);
|
||||||
|
}
|
||||||
|
|
||||||
function retrieveStakeOf (api: ApiInterfaceRx): Observable<[AccountId, Balance][]> {
|
function retrieveStakeOf (api: ApiInterfaceRx): Observable<[AccountId, Balance][]> {
|
||||||
return (api.query.electionsPhragmen || api.query.elections).stakeOf.entries<Balance>().pipe(
|
return (api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections).stakeOf.entries<Balance, [AccountId]>().pipe(
|
||||||
map((entries) =>
|
map((entries) =>
|
||||||
entries.map(([key, stake]) => [key.args[0] as AccountId, stake])
|
entries.map(([{ args: [accountId] }, stake]) => [accountId, stake])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function retrieveVoteOf (api: ApiInterfaceRx): Observable<[AccountId, AccountId[]][]> {
|
function retrieveVoteOf (api: ApiInterfaceRx): Observable<[AccountId, AccountId[]][]> {
|
||||||
return (api.query.electionsPhragmen || api.query.elections).votesOf.entries<Vec<AccountId>>().pipe(
|
return (api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections).votesOf.entries<Vec<AccountId>, [AccountId]>().pipe(
|
||||||
map((entries) =>
|
map((entries) =>
|
||||||
entries.map(([key, votes]) => [key.args[0] as AccountId, votes])
|
entries.map(([{ args: [accountId] }, votes]) => [accountId, votes])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -54,20 +61,23 @@ function retrievePrev (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function retrieveCurrent (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
|
function retrieveCurrent (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
|
||||||
const elections = (api.query.electionsPhragmen || api.query.elections);
|
const elections = (api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections);
|
||||||
|
|
||||||
return elections.voting.entries<ITuple<[Balance, Vec<AccountId>]>>().pipe(
|
return elections.voting.entries<VoteEntry, [AccountId]>().pipe(
|
||||||
map((entries): DeriveCouncilVotes =>
|
map((entries): DeriveCouncilVotes =>
|
||||||
entries.map(([key, [stake, votes]]): [AccountId, DeriveCouncilVote] =>
|
entries.map(([{ args: [accountId] }, value]): [AccountId, DeriveCouncilVote] => [
|
||||||
[key.args[0] as AccountId, { stake, votes }]
|
accountId,
|
||||||
)
|
isVoter(value)
|
||||||
|
? { stake: value.stake, votes: value.votes }
|
||||||
|
: { stake: value[0], votes: value[1] }
|
||||||
|
])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function votes (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCouncilVotes> {
|
export function votes (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCouncilVotes> {
|
||||||
return memo(instanceId, (): Observable<DeriveCouncilVotes> =>
|
return memo(instanceId, (): Observable<DeriveCouncilVotes> =>
|
||||||
(api.query.electionsPhragmen || api.query.elections).stakeOf
|
(api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections).stakeOf
|
||||||
? retrievePrev(api)
|
? retrievePrev(api)
|
||||||
: retrieveCurrent(api)
|
: retrieveCurrent(api)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], Opti
|
|||||||
api.query.scheduler.agenda.keys()
|
api.query.scheduler.agenda.keys()
|
||||||
),
|
),
|
||||||
switchMap((keys) => {
|
switchMap((keys) => {
|
||||||
const blockNumbers = keys.map((key) => key.args[0] as BlockNumber);
|
const blockNumbers = keys.map(({ args: [blockNumber] }) => blockNumber);
|
||||||
|
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
of(blockNumbers),
|
of(blockNumbers),
|
||||||
|
|||||||
@@ -4,11 +4,10 @@
|
|||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { Option } from '@polkadot/types';
|
import type { Option } from '@polkadot/types';
|
||||||
import type { AccountId, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
|
import type { AccountId, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveDemocracyLock } from '../types';
|
import type { DeriveDemocracyLock } from '../types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
|
||||||
|
|
||||||
import { BN_ZERO, isUndefined } from '@polkadot/util';
|
import { BN_ZERO, isUndefined } from '@polkadot/util';
|
||||||
import { of } from '@polkadot/x-rxjs';
|
import { of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function parse ([proposals, images, optDepositors]: Result): DeriveProposal[] {
|
|||||||
|
|
||||||
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveProposal[]> {
|
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveProposal[]> {
|
||||||
return memo(instanceId, (): Observable<DeriveProposal[]> =>
|
return memo(instanceId, (): Observable<DeriveProposal[]> =>
|
||||||
api.query.democracy?.publicProps && api.query.democracy?.preimages
|
isFunction(api.query.democracy?.publicProps) && isFunction(api.query.democracy?.preimages)
|
||||||
? api.query.democracy.publicProps<Proposals>().pipe(
|
? api.query.democracy.publicProps<Proposals>().pipe(
|
||||||
switchMap((proposals) =>
|
switchMap((proposals) =>
|
||||||
combineLatest([
|
combineLatest([
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { ReferendumIndex } from '@polkadot/types/interfaces';
|
import type { ReferendumIndex } from '@polkadot/types/interfaces';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
|
||||||
|
|
||||||
import { of } from '@polkadot/x-rxjs';
|
import { of } from '@polkadot/x-rxjs';
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,10 @@
|
|||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { Option, Vec } from '@polkadot/types';
|
import type { Option, Vec } from '@polkadot/types';
|
||||||
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
|
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
|
import type { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
|
||||||
|
|
||||||
import { isFunction } from '@polkadot/util';
|
import { isFunction } from '@polkadot/util';
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
@@ -67,9 +66,9 @@ function extractVotes (mapped: [AccountId, Voting][], referendumId: BN): DeriveR
|
|||||||
}
|
}
|
||||||
|
|
||||||
function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
|
function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
|
||||||
return api.query.democracy.votingOf.entries<Voting>().pipe(
|
return api.query.democracy.votingOf.entries<Voting, [AccountId]>().pipe(
|
||||||
map((allVoting): DeriveReferendumVote[] => {
|
map((allVoting): DeriveReferendumVote[] => {
|
||||||
const mapped = allVoting.map(([key, voting]): [AccountId, Voting] => [key.args[0] as AccountId, voting]);
|
const mapped = allVoting.map(([{ args: [accountId] }, voting]): [AccountId, Voting] => [accountId, voting]);
|
||||||
const votes = extractVotes(mapped, referendumId);
|
const votes = extractVotes(mapped, referendumId);
|
||||||
const delegations = mapped
|
const delegations = mapped
|
||||||
.filter(([, voting]) => voting.isDelegating)
|
.filter(([, voting]) => voting.isDelegating)
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
|
||||||
|
|
||||||
import { bnSqrt } from '@polkadot/util';
|
import { bnSqrt } from '@polkadot/util';
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type BN from 'bn.js';
|
|
||||||
import type { Vec } from '@polkadot/types';
|
import type { Vec } from '@polkadot/types';
|
||||||
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, ReferendumStatus, Vote, VoteThreshold } from '@polkadot/types/interfaces';
|
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, ReferendumStatus, Vote, VoteThreshold } from '@polkadot/types/interfaces';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
|
|
||||||
export interface DeriveDemocracyLock {
|
export interface DeriveDemocracyLock {
|
||||||
balance: Balance;
|
balance: Balance;
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import type { AccountId, Balance, BlockNumber, PreimageStatus, Proposal, Referen
|
|||||||
import type { ITuple } from '@polkadot/types/types';
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
|
import type { DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
import { BN, bnSqrt } from '@polkadot/util';
|
||||||
|
|
||||||
import { bnSqrt } from '@polkadot/util';
|
|
||||||
|
|
||||||
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
|
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
|
||||||
type OldPreimage = ITuple<PreimageInfo>;
|
type OldPreimage = ITuple<PreimageInfo>;
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { packageInfo as apiInfo } from '@polkadot/api/packageInfo';
|
||||||
|
import { packageInfo as coreInfo } from '@polkadot/rpc-core/packageInfo';
|
||||||
|
import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
|
||||||
|
import { detectPackage } from '@polkadot/util';
|
||||||
|
|
||||||
|
import { packageInfo } from './packageInfo';
|
||||||
|
|
||||||
|
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [apiInfo, coreInfo, typesInfo]);
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { u32, Vec } from '@polkadot/types';
|
import type { u32, Vec } from '@polkadot/types';
|
||||||
import type { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces';
|
import type { AccountId, Balance, BlockNumber, SeatHolder } from '@polkadot/types/interfaces';
|
||||||
import type { ITuple } from '@polkadot/types/types';
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveElectionsInfo } from './types';
|
import type { DeriveElectionsInfo } from './types';
|
||||||
@@ -12,14 +12,43 @@ import { map } from '@polkadot/x-rxjs/operators';
|
|||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
function sortAccounts ([, balanceA]: ITuple<[AccountId, Balance]>, [, balanceB]: ITuple<[AccountId, Balance]>): number {
|
// SeatHolder is current tuple is 2.x-era Substrate
|
||||||
|
type Member = SeatHolder | ITuple<[AccountId, Balance]>;
|
||||||
|
|
||||||
|
type Candidate = AccountId | ITuple<[AccountId, Balance]>;
|
||||||
|
|
||||||
|
function isSeatHolder (value: Member): value is SeatHolder {
|
||||||
|
return !Array.isArray(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCandidateTuple (value: Candidate): value is ITuple<[AccountId, Balance]> {
|
||||||
|
return Array.isArray(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAccountTuple (value: Member): [AccountId, Balance] {
|
||||||
|
return isSeatHolder(value)
|
||||||
|
? [value.who, value.stake]
|
||||||
|
: value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCandidate (value: Candidate): AccountId {
|
||||||
|
return isCandidateTuple(value)
|
||||||
|
? value[0]
|
||||||
|
: value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortAccounts ([, balanceA]: [AccountId, Balance], [, balanceB]: [AccountId, Balance]): number {
|
||||||
return balanceB.cmp(balanceA);
|
return balanceB.cmp(balanceA);
|
||||||
}
|
}
|
||||||
|
|
||||||
function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
|
function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
|
||||||
const section = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections';
|
const section = api.query.phragmenElection
|
||||||
|
? 'phragmenElection'
|
||||||
|
: api.query.electionsPhragmen
|
||||||
|
? 'electionsPhragmen'
|
||||||
|
: 'elections';
|
||||||
|
|
||||||
return api.queryMulti<[Vec<AccountId>, Vec<AccountId>, Vec<ITuple<[AccountId, Balance]>>, Vec<ITuple<[AccountId, Balance]>>]>([
|
return api.queryMulti<[Vec<AccountId>, Vec<Candidate>, Vec<Member>, Vec<Member>]>([
|
||||||
api.query.council.members,
|
api.query.council.members,
|
||||||
api.query[section].candidates,
|
api.query[section].candidates,
|
||||||
api.query[section].members,
|
api.query[section].members,
|
||||||
@@ -28,13 +57,13 @@ function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
|
|||||||
map(([councilMembers, candidates, members, runnersUp]): DeriveElectionsInfo => ({
|
map(([councilMembers, candidates, members, runnersUp]): DeriveElectionsInfo => ({
|
||||||
candidacyBond: api.consts[section].candidacyBond as Balance,
|
candidacyBond: api.consts[section].candidacyBond as Balance,
|
||||||
candidateCount: api.registry.createType('u32', candidates.length),
|
candidateCount: api.registry.createType('u32', candidates.length),
|
||||||
candidates,
|
candidates: candidates.map(getCandidate),
|
||||||
desiredRunnersUp: api.consts[section].desiredRunnersUp as u32,
|
desiredRunnersUp: api.consts[section].desiredRunnersUp as u32,
|
||||||
desiredSeats: api.consts[section].desiredMembers as u32,
|
desiredSeats: api.consts[section].desiredMembers as u32,
|
||||||
members: members.length
|
members: members.length
|
||||||
? members.sort(sortAccounts)
|
? members.map(getAccountTuple).sort(sortAccounts)
|
||||||
: councilMembers.map((accountId): [AccountId, Balance] => [accountId, api.registry.createType('Balance')]),
|
: councilMembers.map((accountId): [AccountId, Balance] => [accountId, api.registry.createType('Balance')]),
|
||||||
runnersUp: runnersUp.sort(sortAccounts),
|
runnersUp: runnersUp.map(getAccountTuple).sort(sortAccounts),
|
||||||
termDuration: api.consts[section].termDuration as BlockNumber,
|
termDuration: api.consts[section].termDuration as BlockNumber,
|
||||||
votingBond: api.consts[section].votingBond as Balance
|
votingBond: api.consts[section].votingBond as Balance
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ describe('derive', (): void => {
|
|||||||
api.isReady.subscribe(() => done());
|
api.isReady.subscribe(() => done());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await api.disconnect();
|
||||||
|
});
|
||||||
|
|
||||||
testFunction(api)('accounts', 'idAndIndex', []);
|
testFunction(api)('accounts', 'idAndIndex', []);
|
||||||
testFunction(api)('accounts', 'idToIndex', []);
|
testFunction(api)('accounts', 'idToIndex', []);
|
||||||
testFunction(api)('accounts', 'indexes', []);
|
testFunction(api)('accounts', 'indexes', []);
|
||||||
@@ -80,7 +84,11 @@ describe('derive', (): void => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeAll((done): void => {
|
beforeAll((done): void => {
|
||||||
api.isReady.subscribe((): void => done());
|
api.isReady.subscribe(() => done());
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await api.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
// override
|
// override
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import './detectPackage';
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { AnyFunction } from '@polkadot/types/types';
|
import type { AnyFunction } from '@polkadot/types/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
@@ -14,6 +16,7 @@ import * as council from './council';
|
|||||||
import * as democracy from './democracy';
|
import * as democracy from './democracy';
|
||||||
import * as elections from './elections';
|
import * as elections from './elections';
|
||||||
import * as imOnline from './imOnline';
|
import * as imOnline from './imOnline';
|
||||||
|
import * as membership from './membership';
|
||||||
import * as parachains from './parachains';
|
import * as parachains from './parachains';
|
||||||
import * as session from './session';
|
import * as session from './session';
|
||||||
import * as society from './society';
|
import * as society from './society';
|
||||||
@@ -22,9 +25,10 @@ import * as technicalCommittee from './technicalCommittee';
|
|||||||
import * as treasury from './treasury';
|
import * as treasury from './treasury';
|
||||||
import * as tx from './tx';
|
import * as tx from './tx';
|
||||||
|
|
||||||
|
export { packageInfo } from './packageInfo';
|
||||||
export * from './type';
|
export * from './type';
|
||||||
|
|
||||||
export const derive = { accounts, balances, bounties, chain, contracts, council, democracy, elections, imOnline, parachains, session, society, staking, technicalCommittee, treasury, tx };
|
export const derive = { accounts, balances, bounties, chain, contracts, council, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
|
||||||
|
|
||||||
type DeriveSection<Section> = {
|
type DeriveSection<Section> = {
|
||||||
[Method in keyof Section]: Section[Method] extends AnyFunction
|
[Method in keyof Section]: Section[Method] extends AnyFunction
|
||||||
@@ -44,8 +48,9 @@ const deriveAvail: Record<string, string[]> = {
|
|||||||
contracts: ['contracts'],
|
contracts: ['contracts'],
|
||||||
council: ['council'],
|
council: ['council'],
|
||||||
democracy: ['democracy'],
|
democracy: ['democracy'],
|
||||||
elections: ['electionsPhragmen', 'elections'],
|
elections: ['phragmenElection', 'electionsPhragmen', 'elections'],
|
||||||
imOnline: ['imOnline'],
|
imOnline: ['imOnline'],
|
||||||
|
membership: ['membership'],
|
||||||
parachains: ['parachains', 'registrar'],
|
parachains: ['parachains', 'registrar'],
|
||||||
session: ['session'],
|
session: ['session'],
|
||||||
society: ['society'],
|
society: ['society'],
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
export * from './proposals';
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
import type { DeriveCollectiveProposal } from '../types';
|
||||||
|
|
||||||
|
import { proposals as collectiveProposals } from '../collective';
|
||||||
|
import { memo } from '../util';
|
||||||
|
|
||||||
|
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveCollectiveProposal[]> {
|
||||||
|
return memo(instanceId, collectiveProposals(instanceId, api, 'membership'));
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
|
export const packageInfo = { name: '@polkadot/api-derive', version: '4.16.2' };
|
||||||
@@ -13,7 +13,7 @@ import { map } from '@polkadot/x-rxjs/operators';
|
|||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
// parse into Indexes
|
// parse into Indexes
|
||||||
function parse ([activeEra, activeEraStart, currentEra, currentIndex, validatorCount]: [EraIndex, Option<Moment>, EraIndex, SessionIndex, u32]): DeriveSessionIndexes {
|
function parse ([currentIndex, activeEra, activeEraStart, currentEra, validatorCount]: [SessionIndex, EraIndex, Option<Moment>, EraIndex, u32]): DeriveSessionIndexes {
|
||||||
return {
|
return {
|
||||||
activeEra,
|
activeEra,
|
||||||
activeEraStart,
|
activeEraStart,
|
||||||
@@ -24,42 +24,57 @@ function parse ([activeEra, activeEraStart, currentEra, currentIndex, validatorC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// query based on latest
|
// query based on latest
|
||||||
function query (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
|
function queryStaking (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
|
||||||
return api.queryMulti<[Option<ActiveEraInfo>, Option<EraIndex>, SessionIndex, u32]>([
|
return api.queryMulti<[SessionIndex, Option<ActiveEraInfo>, Option<EraIndex>, u32]>([
|
||||||
|
api.query.session.currentIndex,
|
||||||
api.query.staking.activeEra,
|
api.query.staking.activeEra,
|
||||||
api.query.staking.currentEra,
|
api.query.staking.currentEra,
|
||||||
api.query.session.currentIndex,
|
|
||||||
api.query.staking.validatorCount
|
api.query.staking.validatorCount
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([activeOpt, currentEra, currentIndex, validatorCount]): DeriveSessionIndexes => {
|
map(([currentIndex, activeOpt, currentEra, validatorCount]): DeriveSessionIndexes => {
|
||||||
const { index, start } = activeOpt.unwrapOrDefault();
|
const { index, start } = activeOpt.unwrapOrDefault();
|
||||||
|
|
||||||
return parse([
|
return parse([
|
||||||
|
currentIndex,
|
||||||
index,
|
index,
|
||||||
start,
|
start,
|
||||||
currentEra.unwrapOrDefault(),
|
currentEra.unwrapOrDefault(),
|
||||||
currentIndex,
|
|
||||||
validatorCount
|
validatorCount
|
||||||
]);
|
]);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// query based on latest
|
||||||
|
function querySession (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
|
||||||
|
return api.query.session.currentIndex().pipe(
|
||||||
|
map((currentIndex): DeriveSessionIndexes => parse([
|
||||||
|
currentIndex,
|
||||||
|
api.registry.createType('EraIndex'),
|
||||||
|
api.registry.createType('Option<Moment>'),
|
||||||
|
api.registry.createType('EraIndex'),
|
||||||
|
api.registry.createType('u32')
|
||||||
|
]))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// empty set when none is available
|
// empty set when none is available
|
||||||
function empty (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
|
function empty (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
|
||||||
return of(parse([
|
return of(parse([
|
||||||
|
api.registry.createType('SessionIndex', 1),
|
||||||
api.registry.createType('EraIndex'),
|
api.registry.createType('EraIndex'),
|
||||||
api.registry.createType('Option<Moment>'),
|
api.registry.createType('Option<Moment>'),
|
||||||
api.registry.createType('EraIndex'),
|
api.registry.createType('EraIndex'),
|
||||||
api.registry.createType('SessionIndex', 1),
|
|
||||||
api.registry.createType('u32')
|
api.registry.createType('u32')
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function indexes (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionIndexes> {
|
export function indexes (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionIndexes> {
|
||||||
return memo(instanceId, (): Observable<DeriveSessionIndexes> =>
|
return memo(instanceId, (): Observable<DeriveSessionIndexes> =>
|
||||||
api.query.session && api.query.staking
|
api.query.session
|
||||||
? query(api)
|
? api.query.staking
|
||||||
|
? queryStaking(api)
|
||||||
|
: querySession(api)
|
||||||
: empty(api)
|
: empty(api)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,69 +2,31 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { u64 } from '@polkadot/types';
|
|
||||||
import type { SessionIndex } from '@polkadot/types/interfaces';
|
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveSessionIndexes, DeriveSessionInfo } from '../types';
|
import type { DeriveSessionInfo } from '../types';
|
||||||
|
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
type ResultType = [boolean, u64, SessionIndex];
|
|
||||||
type Result = [ResultType, DeriveSessionIndexes];
|
|
||||||
|
|
||||||
function createDerive (api: ApiInterfaceRx, [[hasBabe, epochDuration, sessionsPerEra], { activeEra, activeEraStart, currentEra, currentIndex, validatorCount }]: Result): DeriveSessionInfo {
|
|
||||||
return {
|
|
||||||
activeEra,
|
|
||||||
activeEraStart,
|
|
||||||
currentEra,
|
|
||||||
currentIndex,
|
|
||||||
eraLength: api.registry.createType('BlockNumber', sessionsPerEra.mul(epochDuration)),
|
|
||||||
isEpoch: hasBabe,
|
|
||||||
sessionLength: epochDuration,
|
|
||||||
sessionsPerEra,
|
|
||||||
validatorCount
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function queryAura (api: ApiInterfaceRx): Observable<DeriveSessionInfo> {
|
|
||||||
return api.derive.session.indexes().pipe(
|
|
||||||
map((indexes): DeriveSessionInfo =>
|
|
||||||
createDerive(api, [
|
|
||||||
[
|
|
||||||
false,
|
|
||||||
api.registry.createType('u64', 1),
|
|
||||||
api.consts.staking?.sessionsPerEra || api.registry.createType('SessionIndex', 1)
|
|
||||||
],
|
|
||||||
indexes
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function queryBabe (api: ApiInterfaceRx): Observable<DeriveSessionInfo> {
|
|
||||||
return api.derive.session.indexes().pipe(
|
|
||||||
map((indexes) =>
|
|
||||||
createDerive(api, [
|
|
||||||
[
|
|
||||||
true,
|
|
||||||
api.consts.babe.epochDuration,
|
|
||||||
api.consts.staking.sessionsPerEra
|
|
||||||
],
|
|
||||||
indexes
|
|
||||||
])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Retrieves all the session and era query and calculates specific values on it as the length of the session and eras
|
* @description Retrieves all the session and era query and calculates specific values on it as the length of the session and eras
|
||||||
*/
|
*/
|
||||||
export function info (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionInfo> {
|
export function info (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionInfo> {
|
||||||
return memo(instanceId, (): Observable<DeriveSessionInfo> =>
|
return memo(instanceId, (): Observable<DeriveSessionInfo> =>
|
||||||
api.consts.babe
|
api.derive.session.indexes().pipe(
|
||||||
? queryBabe(api)
|
map((indexes) => {
|
||||||
: queryAura(api)
|
const sessionLength = api.consts?.babe?.epochDuration || api.registry.createType('u64', 1);
|
||||||
|
const sessionsPerEra = api.consts?.staking?.sessionsPerEra || api.registry.createType('SessionIndex', 1);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...indexes,
|
||||||
|
eraLength: api.registry.createType('BlockNumber', sessionsPerEra.mul(sessionLength)),
|
||||||
|
isEpoch: !!api.query.babe,
|
||||||
|
sessionLength,
|
||||||
|
sessionsPerEra
|
||||||
|
};
|
||||||
|
})
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
|||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
|
type ResultSlotsNoSession = [u64, u64, u64];
|
||||||
type ResultSlots = [u64, u64, u64, Option<SessionIndex>];
|
type ResultSlots = [u64, u64, u64, Option<SessionIndex>];
|
||||||
type ResultSlotsFlat = [u64, u64, u64, SessionIndex];
|
type ResultSlotsFlat = [u64, u64, u64, SessionIndex];
|
||||||
|
|
||||||
@@ -39,19 +40,26 @@ function queryAura (api: ApiInterfaceRx): Observable<DeriveSessionProgress> {
|
|||||||
|
|
||||||
function queryBabe (api: ApiInterfaceRx): Observable<[DeriveSessionInfo, ResultSlotsFlat]> {
|
function queryBabe (api: ApiInterfaceRx): Observable<[DeriveSessionInfo, ResultSlotsFlat]> {
|
||||||
return api.derive.session.info().pipe(
|
return api.derive.session.info().pipe(
|
||||||
switchMap((info): Observable<[DeriveSessionInfo, ResultSlots]> =>
|
switchMap((info): Observable<[DeriveSessionInfo, ResultSlots | ResultSlotsNoSession]> =>
|
||||||
combineLatest([
|
combineLatest([
|
||||||
of(info),
|
of(info),
|
||||||
api.queryMulti<ResultSlots>([
|
// we may have no staking, but have babe (permissioned)
|
||||||
api.query.babe.currentSlot,
|
api.query.staking?.erasStartSessionIndex
|
||||||
api.query.babe.epochIndex,
|
? api.queryMulti<ResultSlots>([
|
||||||
api.query.babe.genesisSlot,
|
api.query.babe.currentSlot,
|
||||||
[api.query.staking.erasStartSessionIndex, info.activeEra]
|
api.query.babe.epochIndex,
|
||||||
])
|
api.query.babe.genesisSlot,
|
||||||
|
[api.query.staking.erasStartSessionIndex, info.activeEra]
|
||||||
|
])
|
||||||
|
: api.queryMulti<ResultSlotsNoSession>([
|
||||||
|
api.query.babe.currentSlot,
|
||||||
|
api.query.babe.epochIndex,
|
||||||
|
api.query.babe.genesisSlot
|
||||||
|
])
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
map(([info, [currentSlot, epochIndex, genesisSlot, optStartIndex]]): [DeriveSessionInfo, ResultSlotsFlat] => [
|
map(([info, [currentSlot, epochIndex, genesisSlot, optStartIndex]]): [DeriveSessionInfo, ResultSlotsFlat] => [
|
||||||
info, [currentSlot, epochIndex, genesisSlot, optStartIndex.unwrapOr(api.registry.createType('SessionIndex', 1))]
|
info, [currentSlot, epochIndex, genesisSlot, optStartIndex && optStartIndex.isSome ? optStartIndex.unwrap() : api.registry.createType('SessionIndex', 1)]
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -61,7 +69,7 @@ function queryBabe (api: ApiInterfaceRx): Observable<[DeriveSessionInfo, ResultS
|
|||||||
*/
|
*/
|
||||||
export function progress (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionProgress> {
|
export function progress (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionProgress> {
|
||||||
return memo(instanceId, (): Observable<DeriveSessionProgress> =>
|
return memo(instanceId, (): Observable<DeriveSessionProgress> =>
|
||||||
api.consts.babe
|
api.query.babe
|
||||||
? queryBabe(api).pipe(
|
? queryBabe(api).pipe(
|
||||||
map(([info, slots]: [DeriveSessionInfo, ResultSlotsFlat]): DeriveSessionProgress =>
|
map(([info, slots]: [DeriveSessionInfo, ResultSlotsFlat]): DeriveSessionProgress =>
|
||||||
createDerive(api, info, slots)
|
createDerive(api, info, slots)
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { bool, Option, Vec } from '@polkadot/types';
|
import type { AccountId } from '@polkadot/types/interfaces';
|
||||||
import type { AccountId, Balance, BlockNumber, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces';
|
|
||||||
import type { ITuple } from '@polkadot/types/types';
|
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveSocietyMember } from '../types';
|
import type { DeriveSocietyMember } from '../types';
|
||||||
|
|
||||||
@@ -12,28 +10,13 @@ import { map } from '@polkadot/x-rxjs/operators';
|
|||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
type Result = [Vec<ITuple<[BlockNumber, Balance]>>, StrikeCount, Option<SocietyVote>, bool, Option<VouchingStatus>];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Get the member info for a society
|
* @description Get the member info for a society
|
||||||
*/
|
*/
|
||||||
export function member (instanceId: string, api: ApiInterfaceRx): (accountId: AccountId) => Observable<DeriveSocietyMember> {
|
export function member (instanceId: string, api: ApiInterfaceRx): (accountId: AccountId) => Observable<DeriveSocietyMember> {
|
||||||
return memo(instanceId, (accountId: AccountId): Observable<DeriveSocietyMember> =>
|
return memo(instanceId, (accountId: AccountId): Observable<DeriveSocietyMember> =>
|
||||||
api.queryMulti<Result>([
|
api.derive.society._members([accountId]).pipe(
|
||||||
[api.query.society.payouts, accountId],
|
map(([result]) => result)
|
||||||
[api.query.society.strikes, accountId],
|
|
||||||
[api.query.society.defenderVotes, accountId],
|
|
||||||
[api.query.society.suspendedMembers, accountId],
|
|
||||||
[api.query.society.vouching, accountId]
|
|
||||||
]).pipe(
|
|
||||||
map(([payouts, strikes, defenderVotes, suspended, vouching]: Result): DeriveSocietyMember => ({
|
|
||||||
accountId,
|
|
||||||
isSuspended: suspended.isTrue,
|
|
||||||
payouts,
|
|
||||||
strikes,
|
|
||||||
vote: defenderVotes.unwrapOr(undefined),
|
|
||||||
vouching: vouching.unwrapOr(undefined)
|
|
||||||
}))
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,28 +2,51 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { AccountId } from '@polkadot/types/interfaces';
|
import type { bool, Option, Vec } from '@polkadot/types';
|
||||||
|
import type { AccountId, Balance, BlockNumber, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces';
|
||||||
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveSocietyMember } from '../types';
|
import type { DeriveSocietyMember } from '../types';
|
||||||
|
|
||||||
import { combineLatest } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
|
type Result = [AccountId[], Vec<ITuple<[BlockNumber, Balance]>>[], StrikeCount[], Option<SocietyVote>[], bool[], Option<VouchingStatus>[]];
|
||||||
|
|
||||||
|
export function _members (instanceId: string, api: ApiInterfaceRx): (accountIds: AccountId[]) => Observable<DeriveSocietyMember[]> {
|
||||||
|
return memo(instanceId, (accountIds: AccountId[]): Observable<DeriveSocietyMember[]> =>
|
||||||
|
combineLatest<Result>([
|
||||||
|
of(accountIds),
|
||||||
|
api.query.society.payouts.multi(accountIds),
|
||||||
|
api.query.society.strikes.multi(accountIds),
|
||||||
|
api.query.society.defenderVotes.multi(accountIds),
|
||||||
|
api.query.society.suspendedMembers.multi(accountIds),
|
||||||
|
api.query.society.vouching.multi(accountIds)
|
||||||
|
]).pipe(
|
||||||
|
map(([accountIds, payouts, strikes, defenderVotes, suspended, vouching]) =>
|
||||||
|
accountIds.map((accountId, index) => ({
|
||||||
|
accountId,
|
||||||
|
isDefenderVoter: defenderVotes[index].isSome,
|
||||||
|
isSuspended: suspended[index].isTrue,
|
||||||
|
payouts: payouts[index],
|
||||||
|
strikes: strikes[index],
|
||||||
|
vote: defenderVotes[index].unwrapOr(undefined),
|
||||||
|
vouching: vouching[index].unwrapOr(undefined)
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Get the member info for a society
|
* @description Get the member info for a society
|
||||||
*/
|
*/
|
||||||
export function members (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSocietyMember[]> {
|
export function members (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSocietyMember[]> {
|
||||||
return memo(instanceId, (): Observable<DeriveSocietyMember[]> =>
|
return memo(instanceId, (): Observable<DeriveSocietyMember[]> =>
|
||||||
api.query.society.members<AccountId[]>().pipe(
|
api.query.society.members<AccountId[]>().pipe(
|
||||||
switchMap((members): Observable<DeriveSocietyMember[]> =>
|
switchMap((members) => api.derive.society._members(members))
|
||||||
combineLatest(
|
|
||||||
members.map((accountId): Observable<DeriveSocietyMember> =>
|
|
||||||
api.derive.society.member(accountId)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import type { ApiInterfaceRx } from '@polkadot/api/types';
|
|||||||
import type { Balance, StakingLedger, UnlockChunk } from '@polkadot/types/interfaces';
|
import type { Balance, StakingLedger, UnlockChunk } from '@polkadot/types/interfaces';
|
||||||
import type { DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types';
|
import type { DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
import { BN, BN_ZERO } from '@polkadot/util';
|
||||||
|
|
||||||
import { BN_ZERO } from '@polkadot/util';
|
|
||||||
import { combineLatest, Observable } from '@polkadot/x-rxjs';
|
import { combineLatest, Observable } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { StorageKey } from '@polkadot/types';
|
import type { StorageKey } from '@polkadot/types';
|
||||||
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
|
import type { AccountId, EraIndex, Exposure } from '@polkadot/types/interfaces';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveEraExposure, DeriveEraNominatorExposure, DeriveEraValidatorExposure } from '../types';
|
import type { DeriveEraExposure, DeriveEraNominatorExposure, DeriveEraValidatorExposure } from '../types';
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
|||||||
|
|
||||||
import { deriveCache, memo } from '../util';
|
import { deriveCache, memo } from '../util';
|
||||||
|
|
||||||
type KeysAndExposures = [StorageKey, Exposure][];
|
type KeysAndExposures = [StorageKey<[EraIndex, AccountId]>, Exposure][];
|
||||||
|
|
||||||
const CACHE_KEY = 'eraExposure';
|
const CACHE_KEY = 'eraExposure';
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { Option, u32 } from '@polkadot/types';
|
import type { Option, u32 } from '@polkadot/types';
|
||||||
import type { ActiveEraInfo, EraIndex } from '@polkadot/types/interfaces';
|
import type { ActiveEraInfo, EraIndex } from '@polkadot/types/interfaces';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
import { BN_ONE, BN_ZERO } from '@polkadot/util';
|
||||||
|
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
@@ -24,12 +24,12 @@ export function erasHistoric (instanceId: string, api: ApiInterfaceRx): (withAct
|
|||||||
const activeEra: BN = activeEraOpt.unwrapOrDefault().index;
|
const activeEra: BN = activeEraOpt.unwrapOrDefault().index;
|
||||||
let lastEra = activeEra;
|
let lastEra = activeEra;
|
||||||
|
|
||||||
while (lastEra.gten(0) && (result.length < max)) {
|
while (lastEra.gte(BN_ZERO) && (result.length < max)) {
|
||||||
if ((lastEra !== activeEra) || (withActive === true)) {
|
if ((lastEra !== activeEra) || (withActive === true)) {
|
||||||
result.push(api.registry.createType('EraIndex', lastEra));
|
result.push(api.registry.createType('EraIndex', lastEra));
|
||||||
}
|
}
|
||||||
|
|
||||||
lastEra = lastEra.subn(1);
|
lastEra = lastEra.sub(BN_ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// go from oldest to newest
|
// go from oldest to newest
|
||||||
|
|||||||
@@ -1,55 +1,37 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||||
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
|
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveOwnExposure } from '../types';
|
import type { DeriveOwnExposure } from '../types';
|
||||||
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { deriveCache, memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
const CACHE_KEY = 'ownExposure';
|
export function _ownExposures (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveOwnExposure[]> {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export function _ownExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex, withActive: boolean) => Observable<DeriveOwnExposure> {
|
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveOwnExposure[]> =>
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex, withActive: boolean): Observable<DeriveOwnExposure> => {
|
eras.length
|
||||||
const cacheKey = `${CACHE_KEY}-${era.toString()}-${accountId.toString()}`;
|
? api.queryMulti<Exposure[]>([
|
||||||
const cached = withActive
|
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.erasStakersClipped, [era, accountId]]),
|
||||||
? undefined
|
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.erasStakers, [era, accountId]])
|
||||||
: deriveCache.get<DeriveOwnExposure>(cacheKey);
|
|
||||||
|
|
||||||
return cached
|
|
||||||
? of(cached)
|
|
||||||
: api.queryMulti<[Exposure, Exposure]>([
|
|
||||||
[api.query.staking.erasStakersClipped, [era, accountId]],
|
|
||||||
[api.query.staking.erasStakers, [era, accountId]]
|
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([clipped, exposure]): DeriveOwnExposure => {
|
map((all): DeriveOwnExposure[] =>
|
||||||
const value = { clipped, era, exposure };
|
eras.map((era, index) => ({ clipped: all[index], era, exposure: all[eras.length + index] }))
|
||||||
|
)
|
||||||
!withActive && deriveCache.set(cacheKey, value);
|
)
|
||||||
|
: of([])
|
||||||
return value;
|
);
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ownExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex) => Observable<DeriveOwnExposure> {
|
export function ownExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex) => Observable<DeriveOwnExposure> {
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex): Observable<DeriveOwnExposure> =>
|
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex): Observable<DeriveOwnExposure> =>
|
||||||
api.derive.staking._ownExposure(accountId, era, true)
|
api.derive.staking._ownExposures(accountId, [era], true).pipe(
|
||||||
);
|
map(([first]) => first)
|
||||||
}
|
)
|
||||||
|
|
||||||
export function _ownExposures (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveOwnExposure[]> {
|
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveOwnExposure[]> =>
|
|
||||||
eras.length
|
|
||||||
? combineLatest(
|
|
||||||
eras.map((era) => api.derive.staking._ownExposure(accountId, era, withActive))
|
|
||||||
)
|
|
||||||
: of([])
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,62 +1,44 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||||
import type { Option } from '@polkadot/types';
|
import type { Option } from '@polkadot/types';
|
||||||
import type { BalanceOf, EraIndex, Perbill } from '@polkadot/types/interfaces';
|
import type { BalanceOf, EraIndex, Perbill } from '@polkadot/types/interfaces';
|
||||||
import type { ITuple } from '@polkadot/types/types';
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveStakerSlashes } from '../types';
|
import type { DeriveStakerSlashes } from '../types';
|
||||||
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { deriveCache, memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
const CACHE_KEY = 'ownSlash';
|
export function _ownSlashes (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerSlashes[]> {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export function _ownSlash (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex, withActive: boolean) => Observable<DeriveStakerSlashes> {
|
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveStakerSlashes[]> =>
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex, withActive: boolean): Observable<DeriveStakerSlashes> => {
|
eras.length
|
||||||
const cacheKey = `${CACHE_KEY}-${era.toString()}-${accountId.toString()}`;
|
? api.queryMulti<(Option<ITuple<[Perbill, BalanceOf]>> | Option<BalanceOf>)[]>([
|
||||||
const cached = withActive
|
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.validatorSlashInEra, [era, accountId]]),
|
||||||
? undefined
|
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.nominatorSlashInEra, [era, accountId]])
|
||||||
: deriveCache.get<DeriveStakerSlashes>(cacheKey);
|
|
||||||
|
|
||||||
return cached
|
|
||||||
? of(cached)
|
|
||||||
: api.queryMulti<[Option<BalanceOf>, Option<ITuple<[Perbill, BalanceOf]>>]>([
|
|
||||||
[api.query.staking.nominatorSlashInEra, [era, accountId]],
|
|
||||||
[api.query.staking.validatorSlashInEra, [era, accountId]]
|
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([optNom, optVal]): DeriveStakerSlashes => {
|
map((values): DeriveStakerSlashes[] =>
|
||||||
const value = {
|
eras.map((era, index) => ({
|
||||||
era,
|
era,
|
||||||
total: optVal.isSome
|
total: values[index].isSome
|
||||||
? optVal.unwrap()[1]
|
? (values[index].unwrap() as ITuple<[Perbill, BalanceOf]>)[1]
|
||||||
: optNom.unwrapOrDefault()
|
: (values[index + eras.length].unwrapOrDefault() as BalanceOf)
|
||||||
};
|
}))
|
||||||
|
)
|
||||||
!withActive && deriveCache.set(cacheKey, value);
|
)
|
||||||
|
: of([])
|
||||||
return value;
|
);
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ownSlash (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex) => Observable<DeriveStakerSlashes> {
|
export function ownSlash (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex) => Observable<DeriveStakerSlashes> {
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex): Observable<DeriveStakerSlashes> =>
|
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex): Observable<DeriveStakerSlashes> =>
|
||||||
api.derive.staking._ownSlash(accountId, era, true)
|
api.derive.staking._ownSlashes(accountId, [era], true).pipe(
|
||||||
);
|
map(([first]) => first)
|
||||||
}
|
)
|
||||||
|
|
||||||
export function _ownSlashes (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerSlashes[]> {
|
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerSlashes[]> =>
|
|
||||||
eras.length
|
|
||||||
? combineLatest(
|
|
||||||
eras.map((era) => api.derive.staking._ownSlash(accountId, era, withActive))
|
|
||||||
)
|
|
||||||
: of([])
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,36 +10,46 @@ import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
|||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
export function _stakerExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerExposure[]> {
|
export function _stakerExposures (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerExposure[][]> {
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerExposure[]> => {
|
return memo(instanceId, (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean): Observable<DeriveStakerExposure[][]> => {
|
||||||
const stakerId = api.registry.createType('AccountId', accountId).toString();
|
const stakerIds = accountIds.map((a) => api.registry.createType('AccountId', a).toString());
|
||||||
|
|
||||||
return api.derive.staking._erasExposure(eras, withActive).pipe(
|
return api.derive.staking._erasExposure(eras, withActive).pipe(
|
||||||
map((exposures): DeriveStakerExposure[] =>
|
map((exposures): DeriveStakerExposure[][] =>
|
||||||
exposures.map(({ era, nominators: allNominators, validators: allValidators }): DeriveStakerExposure => {
|
stakerIds.map((stakerId) =>
|
||||||
const isValidator = !!allValidators[stakerId];
|
exposures.map(({ era, nominators: allNominators, validators: allValidators }): DeriveStakerExposure => {
|
||||||
const validators: DeriveEraValidatorExposure = {};
|
const isValidator = !!allValidators[stakerId];
|
||||||
const nominating = allNominators[stakerId] || [];
|
const validators: DeriveEraValidatorExposure = {};
|
||||||
|
const nominating = allNominators[stakerId] || [];
|
||||||
|
|
||||||
if (isValidator) {
|
if (isValidator) {
|
||||||
validators[stakerId] = allValidators[stakerId];
|
validators[stakerId] = allValidators[stakerId];
|
||||||
} else if (nominating) {
|
} else if (nominating) {
|
||||||
nominating.forEach(({ validatorId }): void => {
|
nominating.forEach(({ validatorId }): void => {
|
||||||
validators[validatorId] = allValidators[validatorId];
|
validators[validatorId] = allValidators[validatorId];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return { era, isEmpty: !Object.keys(validators).length, isValidator, nominating, validators };
|
return { era, isEmpty: !Object.keys(validators).length, isValidator, nominating, validators };
|
||||||
})
|
})
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stakerExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerExposure[]> {
|
export function stakerExposures (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], withActive?: boolean) => Observable<DeriveStakerExposure[][]> {
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerExposure[]> =>
|
return memo(instanceId, (accountIds: (Uint8Array | string)[], withActive = false): Observable<DeriveStakerExposure[][]> =>
|
||||||
api.derive.staking.erasHistoric(withActive).pipe(
|
api.derive.staking.erasHistoric(withActive).pipe(
|
||||||
switchMap((eras) => api.derive.staking._stakerExposure(accountId, eras, withActive))
|
switchMap((eras) => api.derive.staking._stakerExposures(accountIds, eras, withActive))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function stakerExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerExposure[]> {
|
||||||
|
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerExposure[]> =>
|
||||||
|
api.derive.staking.stakerExposures([accountId, withActive]).pipe(
|
||||||
|
map(([first]) => first)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,45 +2,39 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { Option } from '@polkadot/types';
|
import type { AccountId, EraIndex, StakingLedger } from '@polkadot/types/interfaces';
|
||||||
import type { AccountId, EraIndex, StakingLedger, StakingLedgerTo240 } from '@polkadot/types/interfaces';
|
import type { BN } from '@polkadot/util';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { DeriveEraPoints, DeriveEraPrefs, DeriveEraRewards, DeriveEraValPrefs, DeriveStakerExposure, DeriveStakerReward, DeriveStakerRewardValidator } from '../types';
|
import type { DeriveEraPoints, DeriveEraPrefs, DeriveEraRewards, DeriveEraValPrefs, DeriveStakerExposure, DeriveStakerReward, DeriveStakerRewardValidator } from '../types';
|
||||||
import type { DeriveStakingQuery } from './types';
|
import type { DeriveStakingQuery } from './types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
import { BN_BILLION, BN_ZERO } from '@polkadot/util';
|
||||||
|
|
||||||
import { isFunction } from '@polkadot/util';
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
type ErasResult = [{ unwrapOr: (value: BN) => BN }, DeriveEraPoints[], DeriveEraPrefs[], DeriveEraRewards[]];
|
type ErasResult = [DeriveEraPoints[], DeriveEraPrefs[], DeriveEraRewards[]];
|
||||||
|
|
||||||
const ZERO = new BN(0);
|
function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [erasPoints, erasPrefs, erasRewards]: ErasResult, exposures: DeriveStakerExposure[]): DeriveStakerReward[] {
|
||||||
const MIN_ONE = new BN(-1);
|
|
||||||
const COMM_DIV = new BN(1_000_000_000);
|
|
||||||
|
|
||||||
function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [, erasPoints, erasPrefs, erasRewards]: ErasResult, exposures: DeriveStakerExposure[]): DeriveStakerReward[] {
|
|
||||||
return exposures.map(({ era, isEmpty, isValidator, nominating, validators: eraValidators }): DeriveStakerReward => {
|
return exposures.map(({ era, isEmpty, isValidator, nominating, validators: eraValidators }): DeriveStakerReward => {
|
||||||
const { eraPoints, validators: allValPoints } = erasPoints.find((p) => p.era.eq(era)) || { eraPoints: ZERO, validators: {} };
|
const { eraPoints, validators: allValPoints } = erasPoints.find((p) => p.era.eq(era)) || { eraPoints: BN_ZERO, validators: {} };
|
||||||
const { eraReward } = erasRewards.find((r) => r.era.eq(era)) || { eraReward: api.registry.createType('Balance') };
|
const { eraReward } = erasRewards.find((r) => r.era.eq(era)) || { eraReward: api.registry.createType('Balance') };
|
||||||
const { validators: allValPrefs } = erasPrefs.find((p) => p.era.eq(era)) || { validators: {} as DeriveEraValPrefs };
|
const { validators: allValPrefs } = erasPrefs.find((p) => p.era.eq(era)) || { validators: {} as DeriveEraValPrefs };
|
||||||
const validators: Record<string, DeriveStakerRewardValidator> = {};
|
const validators: Record<string, DeriveStakerRewardValidator> = {};
|
||||||
const stakerId = stashId.toString();
|
const stakerId = stashId.toString();
|
||||||
|
|
||||||
Object.entries(eraValidators).forEach(([validatorId, exposure]): void => {
|
Object.entries(eraValidators).forEach(([validatorId, exposure]): void => {
|
||||||
const valPoints = allValPoints[validatorId] || ZERO;
|
const valPoints = allValPoints[validatorId] || BN_ZERO;
|
||||||
const valComm = allValPrefs[validatorId]?.commission.unwrap() || ZERO;
|
const valComm = allValPrefs[validatorId]?.commission.unwrap() || BN_ZERO;
|
||||||
const expTotal = exposure.total.unwrap();
|
const expTotal = exposure.total?.unwrap() || BN_ZERO;
|
||||||
let avail = ZERO;
|
let avail = BN_ZERO;
|
||||||
let value: BN | undefined;
|
let value: BN | undefined;
|
||||||
|
|
||||||
if (!(expTotal.isZero() || valPoints.isZero() || eraPoints.isZero())) {
|
if (!(expTotal.isZero() || valPoints.isZero() || eraPoints.isZero())) {
|
||||||
avail = eraReward.mul(valPoints).div(eraPoints);
|
avail = eraReward.mul(valPoints).div(eraPoints);
|
||||||
|
|
||||||
const valCut = valComm.mul(avail).div(COMM_DIV);
|
const valCut = valComm.mul(avail).div(BN_BILLION);
|
||||||
let staked: BN;
|
let staked: BN;
|
||||||
|
|
||||||
if (validatorId === stakerId) {
|
if (validatorId === stakerId) {
|
||||||
@@ -50,10 +44,10 @@ function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [, erasPoints, e
|
|||||||
|
|
||||||
staked = stakerExp
|
staked = stakerExp
|
||||||
? stakerExp.value.unwrap()
|
? stakerExp.value.unwrap()
|
||||||
: ZERO;
|
: BN_ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = avail.sub(valCut).imul(staked).div(expTotal).iadd(validatorId === stakerId ? valCut : ZERO);
|
value = avail.sub(valCut).imul(staked).div(expTotal).iadd(validatorId === stakerId ? valCut : BN_ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
validators[validatorId] = {
|
validators[validatorId] = {
|
||||||
@@ -73,32 +67,25 @@ function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [, erasPoints, e
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function uniqValidators (rewards: DeriveStakerReward[]): string[] {
|
function allUniqValidators (rewards: DeriveStakerReward[][]): [string[], string[][]] {
|
||||||
const uniq: string[] = [];
|
return rewards.reduce(([all, perStash]: [string[], string[][]], rewards) => {
|
||||||
|
const uniq: string[] = [];
|
||||||
|
|
||||||
rewards.forEach(({ validators }): void => {
|
perStash.push(uniq);
|
||||||
Object.keys(validators).forEach((validatorId): void => {
|
rewards.forEach(({ validators }) =>
|
||||||
if (!uniq.includes(validatorId)) {
|
Object.keys(validators).forEach((validatorId): void => {
|
||||||
uniq.push(validatorId);
|
if (!uniq.includes(validatorId)) {
|
||||||
}
|
uniq.push(validatorId);
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return uniq;
|
if (!all.includes(validatorId)) {
|
||||||
}
|
all.push(validatorId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
function isOldLedger (ledger?: StakingLedger | StakingLedgerTo240): ledger is StakingLedgerTo240 {
|
return [all, perStash];
|
||||||
return !!(ledger as StakingLedgerTo240)?.lastReward;
|
}, [[], []]);
|
||||||
}
|
|
||||||
|
|
||||||
function filterEra (era: EraIndex, stakingLedger: StakingLedger): boolean {
|
|
||||||
return isOldLedger(stakingLedger)
|
|
||||||
? era.gt(stakingLedger.lastReward.unwrapOr(MIN_ONE))
|
|
||||||
: !stakingLedger.claimedRewards.some((e) => e.eq(era));
|
|
||||||
}
|
|
||||||
|
|
||||||
function filterEras (eras: EraIndex[], stakingLedger: StakingLedger): EraIndex[] {
|
|
||||||
return eras.filter((era) => filterEra(era, stakingLedger));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeClaimed (validators: string[], queryValidators: DeriveStakingQuery[], reward: DeriveStakerReward): void {
|
function removeClaimed (validators: string[], queryValidators: DeriveStakingQuery[], reward: DeriveStakerReward): void {
|
||||||
@@ -121,43 +108,32 @@ function removeClaimed (validators: string[], queryValidators: DeriveStakingQuer
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterRewards (api: ApiInterfaceRx, eras: EraIndex[], { migrateEra, rewards, stakingLedger }: { migrateEra: BN, rewards: DeriveStakerReward[]; stakingLedger: StakingLedger }): Observable<DeriveStakerReward[]> {
|
function filterRewards (eras: EraIndex[], valInfo: [string, DeriveStakingQuery][], { rewards, stakingLedger }: { rewards: DeriveStakerReward[]; stakingLedger: StakingLedger }): DeriveStakerReward[] {
|
||||||
const validators = uniqValidators(rewards);
|
const filter = eras.filter((era) => !stakingLedger.claimedRewards.some((e) => e.eq(era)));
|
||||||
const filter = filterEras(eras, stakingLedger);
|
const validators = valInfo.map(([v]) => v);
|
||||||
|
const queryValidators = valInfo.map(([, q]) => q);
|
||||||
|
|
||||||
return api.derive.staking.queryMulti(validators, { withLedger: true }).pipe(
|
return rewards
|
||||||
map((queryValidators): DeriveStakerReward[] =>
|
.filter(({ isEmpty }) => !isEmpty)
|
||||||
rewards
|
.filter((reward): boolean => {
|
||||||
.filter(({ isEmpty }) => !isEmpty)
|
if (!filter.some((filter) => reward.era.eq(filter))) {
|
||||||
.filter((reward): boolean => {
|
return false;
|
||||||
if (!filter.some((filter) => reward.era.eq(filter))) {
|
}
|
||||||
return false;
|
|
||||||
} else if (reward.era.lt(migrateEra)) {
|
|
||||||
// we filter again here, the actual ledger may have changed, e.g. something has been claimed
|
|
||||||
return filterEra(reward.era, stakingLedger);
|
|
||||||
}
|
|
||||||
|
|
||||||
reward.isStakerPayout = true;
|
removeClaimed(validators, queryValidators, reward);
|
||||||
|
|
||||||
removeClaimed(validators, queryValidators, reward);
|
return true;
|
||||||
|
})
|
||||||
return true;
|
.filter(({ validators }) => Object.keys(validators).length !== 0)
|
||||||
})
|
.map((reward) => ({
|
||||||
.filter(({ validators }) => Object.keys(validators).length !== 0)
|
...reward,
|
||||||
.map((reward) => ({
|
nominators: reward.nominating.filter((n) => reward.validators[n.validatorId])
|
||||||
...reward,
|
}));
|
||||||
nominators: reward.nominating.filter((n) => reward.validators[n.validatorId])
|
|
||||||
}))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _stakerRewardsEras (instanceId: string, api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<ErasResult> {
|
export function _stakerRewardsEras (instanceId: string, api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<ErasResult> {
|
||||||
return memo(instanceId, (eras: EraIndex[], withActive: boolean): Observable<ErasResult> =>
|
return memo(instanceId, (eras: EraIndex[], withActive: boolean): Observable<ErasResult> =>
|
||||||
combineLatest([
|
combineLatest([
|
||||||
isFunction(api.query.staking.migrateEra)
|
|
||||||
? api.query.staking.migrateEra<Option<EraIndex>>()
|
|
||||||
: of(api.registry.createType('Option<EraIndex>')),
|
|
||||||
api.derive.staking._erasPoints(eras, withActive),
|
api.derive.staking._erasPoints(eras, withActive),
|
||||||
api.derive.staking._erasPrefs(eras, withActive),
|
api.derive.staking._erasPrefs(eras, withActive),
|
||||||
api.derive.staking._erasRewards(eras, withActive)
|
api.derive.staking._erasRewards(eras, withActive)
|
||||||
@@ -165,23 +141,43 @@ export function _stakerRewardsEras (instanceId: string, api: ApiInterfaceRx): (e
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _stakerRewards (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerReward[]> {
|
export function _stakerRewards (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerReward[][]> {
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerReward[]> =>
|
return memo(instanceId, (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean): Observable<DeriveStakerReward[][]> =>
|
||||||
combineLatest([
|
combineLatest([
|
||||||
api.derive.staking.query(accountId, { withLedger: true }),
|
api.derive.staking.queryMulti(accountIds, { withLedger: true }),
|
||||||
api.derive.staking._stakerExposure(accountId, eras, withActive),
|
api.derive.staking._stakerExposures(accountIds, eras, withActive),
|
||||||
api.derive.staking._stakerRewardsEras(eras, withActive)
|
api.derive.staking._stakerRewardsEras(eras, withActive)
|
||||||
]).pipe(
|
]).pipe(
|
||||||
switchMap(([{ stakingLedger, stashId }, exposures, erasResult]): Observable<DeriveStakerReward[]> => {
|
switchMap(([queries, exposures, erasResult]): Observable<DeriveStakerReward[][]> => {
|
||||||
if (!stashId || !stakingLedger) {
|
const allRewards = queries.map(({ stakingLedger, stashId }, index): DeriveStakerReward[] =>
|
||||||
return of([]);
|
(!stashId || !stakingLedger)
|
||||||
|
? []
|
||||||
|
: parseRewards(api, stashId, erasResult, exposures[index])
|
||||||
|
);
|
||||||
|
|
||||||
|
if (withActive) {
|
||||||
|
return of(allRewards);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rewards = parseRewards(api, stashId, erasResult, exposures);
|
const [allValidators, stashValidators] = allUniqValidators(allRewards);
|
||||||
|
|
||||||
return withActive
|
return api.derive.staking.queryMulti(allValidators, { withLedger: true }).pipe(
|
||||||
? of(rewards)
|
map((queriedVals): DeriveStakerReward[][] =>
|
||||||
: filterRewards(api, eras, { migrateEra: erasResult[0].unwrapOr(ZERO), rewards, stakingLedger });
|
queries.map(({ stakingLedger }, index): DeriveStakerReward[] =>
|
||||||
|
filterRewards(
|
||||||
|
eras,
|
||||||
|
stashValidators[index].map((validatorId): [string, DeriveStakingQuery] => [
|
||||||
|
validatorId,
|
||||||
|
queriedVals.find((q) => q.accountId.eq(validatorId)) as DeriveStakingQuery
|
||||||
|
]),
|
||||||
|
{
|
||||||
|
rewards: allRewards[index],
|
||||||
|
stakingLedger
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -190,7 +186,8 @@ export function _stakerRewards (instanceId: string, api: ApiInterfaceRx): (accou
|
|||||||
export function stakerRewards (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerReward[]> {
|
export function stakerRewards (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerReward[]> {
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerReward[]> =>
|
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerReward[]> =>
|
||||||
api.derive.staking.erasHistoric(withActive).pipe(
|
api.derive.staking.erasHistoric(withActive).pipe(
|
||||||
switchMap((eras) => api.derive.staking._stakerRewards(accountId, eras, withActive))
|
switchMap((eras) => api.derive.staking._stakerRewards([accountId], eras, withActive)),
|
||||||
|
map(([first]) => first)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -198,7 +195,7 @@ export function stakerRewards (instanceId: string, api: ApiInterfaceRx): (accoun
|
|||||||
export function stakerRewardsMultiEras (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[]) => Observable<DeriveStakerReward[][]> {
|
export function stakerRewardsMultiEras (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[]) => Observable<DeriveStakerReward[][]> {
|
||||||
return memo(instanceId, (accountIds: (Uint8Array | string)[], eras: EraIndex[]): Observable<DeriveStakerReward[][]> =>
|
return memo(instanceId, (accountIds: (Uint8Array | string)[], eras: EraIndex[]): Observable<DeriveStakerReward[][]> =>
|
||||||
accountIds.length && eras.length
|
accountIds.length && eras.length
|
||||||
? combineLatest(accountIds.map((acc) => api.derive.staking._stakerRewards(acc, eras, false)))
|
? api.derive.staking._stakerRewards(accountIds, eras, false)
|
||||||
: of([])
|
: of([])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,17 +5,42 @@ import type { ApiInterfaceRx } from '@polkadot/api/types';
|
|||||||
import type { AccountId } from '@polkadot/types/interfaces';
|
import type { AccountId } from '@polkadot/types/interfaces';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map, startWith, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { drr, memo } from '../util';
|
||||||
|
|
||||||
|
function onBondedEvent (api: ApiInterfaceRx): Observable<number> {
|
||||||
|
let current = Date.now();
|
||||||
|
|
||||||
|
return api.query.system.events().pipe(
|
||||||
|
map((events): number => {
|
||||||
|
current = events.filter(({ event, phase }): boolean => {
|
||||||
|
try {
|
||||||
|
return phase.isApplyExtrinsic &&
|
||||||
|
event.section === 'staking' &&
|
||||||
|
event.method === 'Bonded';
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
? Date.now()
|
||||||
|
: current;
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}),
|
||||||
|
startWith(current),
|
||||||
|
drr({ skipTimeout: true })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Retrieve the list of all validator stashes
|
* @description Retrieve the list of all validator stashes
|
||||||
*/
|
*/
|
||||||
export function stashes (instanceId: string, api: ApiInterfaceRx): () => Observable<AccountId[]> {
|
export function stashes (instanceId: string, api: ApiInterfaceRx): () => Observable<AccountId[]> {
|
||||||
return memo(instanceId, (): Observable<AccountId[]> =>
|
return memo(instanceId, (): Observable<AccountId[]> =>
|
||||||
api.query.staking.validators.keys().pipe(
|
onBondedEvent(api).pipe(
|
||||||
map((keys) => keys.map((key) => key.args[0] as AccountId).filter((a) => a))
|
switchMap(() => api.query.staking.validators.keys()),
|
||||||
|
map((keys) => keys.map(({ args: [validatorId] }) => validatorId).filter((a) => a))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type BN from 'bn.js';
|
|
||||||
import type { AccountId, Balance, EraIndex, Exposure, RewardDestination, RewardPoint, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
|
import type { AccountId, Balance, EraIndex, Exposure, RewardDestination, RewardPoint, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
import type { DeriveSessionIndexes } from '../session/types';
|
import type { DeriveSessionIndexes } from '../session/types';
|
||||||
|
|
||||||
export type DeriveEraValPoints = Record<string, RewardPoint>;
|
export type DeriveEraValPoints = Record<string, RewardPoint>;
|
||||||
@@ -81,7 +81,6 @@ export interface DeriveStakerRewardValidator {
|
|||||||
export interface DeriveStakerReward {
|
export interface DeriveStakerReward {
|
||||||
era: EraIndex;
|
era: EraIndex;
|
||||||
eraReward: Balance;
|
eraReward: Balance;
|
||||||
isStakerPayout?: boolean;
|
|
||||||
isEmpty: boolean;
|
isEmpty: boolean;
|
||||||
isValidator: boolean;
|
isValidator: boolean;
|
||||||
nominating: DeriveEraExposureNominating[];
|
nominating: DeriveEraExposureNominating[];
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export function nextElected (instanceId: string, api: ApiInterfaceRx): () => Obs
|
|||||||
// only populate for next era in the last session, so track both here - entries are not
|
// only populate for next era in the last session, so track both here - entries are not
|
||||||
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
|
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
|
||||||
switchMap(({ currentEra }) => api.query.staking.erasStakers.keys(currentEra)),
|
switchMap(({ currentEra }) => api.query.staking.erasStakers.keys(currentEra)),
|
||||||
map((keys) => keys.map((key) => key.args[1] as AccountId))
|
map((keys) => keys.map(({ args: [, accountId] }) => accountId))
|
||||||
)
|
)
|
||||||
: api.query.staking.currentElected<AccountId[]>()
|
: api.query.staking.currentElected<AccountId[]>()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ function retrieveProposals (api: ApiInterfaceRx, proposalCount: ProposalIndex, a
|
|||||||
|
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
api.query.treasury.proposals.multi<Option<TreasuryProposal>>(allIds),
|
api.query.treasury.proposals.multi<Option<TreasuryProposal>>(allIds),
|
||||||
api.derive.council.proposals()
|
api.derive.council
|
||||||
|
? api.derive.council.proposals()
|
||||||
|
: of([] as DeriveCollectiveProposal[])
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([allProposals, councilProposals]: [Option<TreasuryProposal>[], DeriveCollectiveProposal[]]): DeriveTreasuryProposals =>
|
map(([allProposals, councilProposals]: [Option<TreasuryProposal>[], DeriveCollectiveProposal[]]): DeriveTreasuryProposals =>
|
||||||
parseResult(api, { allIds, allProposals, approvalIds, councilProposals, proposalCount })
|
parseResult(api, { allIds, allProposals, approvalIds, councilProposals, proposalCount })
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import BN from 'bn.js';
|
import { BN } from '@polkadot/util';
|
||||||
|
|
||||||
export const FALLBACK_MAX_HASH_COUNT = 250;
|
export const FALLBACK_MAX_HASH_COUNT = 250;
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,19 @@ function nextNonce (api: ApiInterfaceRx, address: string): Observable<Index> {
|
|||||||
function signingHeader (api: ApiInterfaceRx): Observable<Header> {
|
function signingHeader (api: ApiInterfaceRx): Observable<Header> {
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
api.rpc.chain.getHeader(),
|
api.rpc.chain.getHeader(),
|
||||||
api.rpc.chain.getFinalizedHead().pipe(
|
api.rpc.chain.getFinalizedHead()
|
||||||
switchMap((hash) => api.rpc.chain.getHeader(hash))
|
|
||||||
)
|
|
||||||
]).pipe(
|
]).pipe(
|
||||||
|
switchMap(([bestHeader, finHash]) =>
|
||||||
|
// retrieve the headers - in the case of the current block, we use the parent
|
||||||
|
// to minimize (not completely remove) the impact that forks do have on the system
|
||||||
|
// (when at genesis, just return the current header as the last known)
|
||||||
|
bestHeader.parentHash.isEmpty
|
||||||
|
? of([bestHeader, bestHeader])
|
||||||
|
: combineLatest([
|
||||||
|
api.rpc.chain.getHeader(bestHeader.parentHash),
|
||||||
|
api.rpc.chain.getHeader(finHash)
|
||||||
|
])
|
||||||
|
),
|
||||||
map(([current, finalized]) =>
|
map(([current, finalized]) =>
|
||||||
// determine the hash to use, current when lag > max, else finalized
|
// determine the hash to use, current when lag > max, else finalized
|
||||||
current.number.unwrap().sub(finalized.number.unwrap()).gt(MAX_FINALITY_LAG)
|
current.number.unwrap().sub(finalized.number.unwrap()).gt(MAX_FINALITY_LAG)
|
||||||
|
|||||||
@@ -2,43 +2,41 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { AccountId, Header } from '@polkadot/types/interfaces';
|
import type { AccountId, Header } from '@polkadot/types/interfaces';
|
||||||
import type { Constructor, Registry } from '@polkadot/types/types';
|
import type { Registry } from '@polkadot/types/types';
|
||||||
|
import type { HeaderExtended } from './types';
|
||||||
import { Struct } from '@polkadot/types';
|
|
||||||
import runtimeTypes from '@polkadot/types/interfaces/runtime/definitions';
|
|
||||||
|
|
||||||
import { extractAuthor } from './util';
|
import { extractAuthor } from './util';
|
||||||
|
|
||||||
// We can ignore the properties, added via Struct.with
|
export function createHeaderExtended (registry: Registry, header?: Header, validators?: AccountId[]): HeaderExtended {
|
||||||
const _Header = Struct.with(runtimeTypes.types.Header as any) as Constructor<Header>;
|
// an instance of the base extrinsic for us to extend
|
||||||
|
const HeaderBase = registry.createClass('Header');
|
||||||
|
|
||||||
/**
|
class Implementation extends HeaderBase implements HeaderExtended {
|
||||||
* @name HeaderExtended
|
readonly #author?: AccountId;
|
||||||
* @description
|
readonly #validators?: AccountId[];
|
||||||
* A [[Block]] header with an additional `author` field that indicates the block author
|
|
||||||
*/
|
|
||||||
export class HeaderExtended extends _Header {
|
|
||||||
readonly #author?: AccountId;
|
|
||||||
readonly #validators?: AccountId[];
|
|
||||||
|
|
||||||
constructor (registry: Registry, header?: Header, validators?: AccountId[]) {
|
constructor (registry: Registry, header?: Header, validators?: AccountId[]) {
|
||||||
super(registry, header);
|
super(registry, header);
|
||||||
|
|
||||||
this.#author = extractAuthor(this.digest, validators);
|
this.#author = extractAuthor(this.digest, validators);
|
||||||
this.#validators = validators;
|
this.#validators = validators;
|
||||||
|
this.createdAtHash = header?.createdAtHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Convenience method, returns the author for the block
|
||||||
|
*/
|
||||||
|
public get author (): AccountId | undefined {
|
||||||
|
return this.#author;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Convenience method, returns the validators for the block
|
||||||
|
*/
|
||||||
|
public get validators (): AccountId[] | undefined {
|
||||||
|
return this.#validators;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return new Implementation(registry, header, validators);
|
||||||
* @description Convenience method, returns the author for the block
|
|
||||||
*/
|
|
||||||
public get author (): AccountId | undefined {
|
|
||||||
return this.#author;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Convenience method, returns the validators for the block
|
|
||||||
*/
|
|
||||||
public get validators (): AccountId[] | undefined {
|
|
||||||
return this.#validators;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,12 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { AccountId, DispatchError, DispatchInfo, Event, EventRecord, Extrinsic, SignedBlock } from '@polkadot/types/interfaces';
|
import type { AccountId, DispatchError, DispatchInfo, EventRecord, Extrinsic, SignedBlock } from '@polkadot/types/interfaces';
|
||||||
import type { Constructor, Registry } from '@polkadot/types/types';
|
import type { Registry } from '@polkadot/types/types';
|
||||||
|
import type { SignedBlockExtended, TxWithEvent } from './types';
|
||||||
import { Struct } from '@polkadot/types';
|
|
||||||
import runtimeTypes from '@polkadot/types/interfaces/runtime/definitions';
|
|
||||||
|
|
||||||
import { extractAuthor } from './util';
|
import { extractAuthor } from './util';
|
||||||
|
|
||||||
// We can ignore the properties, added via Struct.with
|
|
||||||
const _SignedBlock = Struct.with(runtimeTypes.types.SignedBlock as any) as Constructor<SignedBlock>;
|
|
||||||
|
|
||||||
interface TxWithEvent {
|
|
||||||
dispatchError?: DispatchError;
|
|
||||||
dispatchInfo?: DispatchInfo;
|
|
||||||
events: Event[];
|
|
||||||
extrinsic: Extrinsic;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapExtrinsics (extrinsics: Extrinsic[], records: EventRecord[]): TxWithEvent[] {
|
function mapExtrinsics (extrinsics: Extrinsic[], records: EventRecord[]): TxWithEvent[] {
|
||||||
return extrinsics.map((extrinsic, index): TxWithEvent => {
|
return extrinsics.map((extrinsic, index): TxWithEvent => {
|
||||||
let dispatchError: DispatchError | undefined;
|
let dispatchError: DispatchError | undefined;
|
||||||
@@ -43,42 +31,45 @@ function mapExtrinsics (extrinsics: Extrinsic[], records: EventRecord[]): TxWith
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
export function createSignedBlockExtended (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[]): SignedBlockExtended {
|
||||||
* @name SignedBlockExtended
|
// an instance of the base extrinsic for us to extend
|
||||||
* @description
|
const SignedBlockBase = registry.createClass('SignedBlock');
|
||||||
* A [[Block]] header with an additional `author` field that indicates the block author
|
|
||||||
*/
|
|
||||||
export class SignedBlockExtended extends _SignedBlock {
|
|
||||||
readonly #author?: AccountId;
|
|
||||||
readonly #events: EventRecord[];
|
|
||||||
readonly #extrinsics: TxWithEvent[];
|
|
||||||
|
|
||||||
constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], sessionValidators?: AccountId[]) {
|
class Implementation extends SignedBlockBase implements SignedBlockExtended {
|
||||||
super(registry, block);
|
readonly #author?: AccountId;
|
||||||
|
readonly #events: EventRecord[];
|
||||||
|
readonly #extrinsics: TxWithEvent[];
|
||||||
|
|
||||||
this.#author = extractAuthor(this.block.header.digest, sessionValidators);
|
constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[]) {
|
||||||
this.#events = events || ([] as EventRecord[]);
|
super(registry, block);
|
||||||
this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events);
|
|
||||||
|
this.#author = extractAuthor(this.block.header.digest, validators);
|
||||||
|
this.#events = events || ([] as EventRecord[]);
|
||||||
|
this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events);
|
||||||
|
this.createdAtHash = block?.createdAtHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Convenience method, returns the author for the block
|
||||||
|
*/
|
||||||
|
public get author (): AccountId | undefined {
|
||||||
|
return this.#author;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Convenience method, returns the events associated with the block
|
||||||
|
*/
|
||||||
|
public get events (): EventRecord[] {
|
||||||
|
return this.#events;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Returns the extrinsics and their events, mapped
|
||||||
|
*/
|
||||||
|
public get extrinsics (): TxWithEvent[] {
|
||||||
|
return this.#extrinsics;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return new Implementation(registry, block, events, validators);
|
||||||
* @description Convenience method, returns the author for the block
|
|
||||||
*/
|
|
||||||
public get author (): AccountId | undefined {
|
|
||||||
return this.#author;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Convenience method, returns the events associated with the block
|
|
||||||
*/
|
|
||||||
public get events (): EventRecord[] {
|
|
||||||
return this.#events;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Returns the extrinsics and their events, mapped
|
|
||||||
*/
|
|
||||||
public get extrinsics (): TxWithEvent[] {
|
|
||||||
return this.#extrinsics;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
export { HeaderExtended } from './HeaderExtended';
|
export { createHeaderExtended } from './HeaderExtended';
|
||||||
export { SignedBlockExtended } from './SignedBlockExtended';
|
export { createSignedBlockExtended } from './SignedBlockExtended';
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import type { AccountId, DispatchError, DispatchInfo, Event, EventRecord, Extrinsic, Header, SignedBlock } from '@polkadot/types/interfaces';
|
||||||
|
|
||||||
|
export interface HeaderExtended extends Header {
|
||||||
|
readonly author: AccountId | undefined;
|
||||||
|
readonly validators: AccountId[] | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SignedBlockExtended extends SignedBlock {
|
||||||
|
readonly author: AccountId | undefined;
|
||||||
|
readonly events: EventRecord[];
|
||||||
|
readonly extrinsics: TxWithEvent[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TxWithEvent {
|
||||||
|
dispatchError?: DispatchError;
|
||||||
|
dispatchInfo?: DispatchInfo;
|
||||||
|
events: Event[];
|
||||||
|
extrinsic: Extrinsic;
|
||||||
|
}
|
||||||
@@ -4,23 +4,44 @@
|
|||||||
import type { AccountId, Digest } from '@polkadot/types/interfaces';
|
import type { AccountId, Digest } from '@polkadot/types/interfaces';
|
||||||
|
|
||||||
export function extractAuthor (digest: Digest, sessionValidators: AccountId[] = []): AccountId | undefined {
|
export function extractAuthor (digest: Digest, sessionValidators: AccountId[] = []): AccountId | undefined {
|
||||||
|
const [citem] = digest.logs.filter(({ type }) => type === 'Consensus');
|
||||||
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
|
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
|
||||||
|
const [sitem] = digest.logs.filter(({ type }) => type === 'Seal');
|
||||||
|
|
||||||
// extract from the substrate 2.0 PreRuntime digest
|
let accountId: AccountId | undefined;
|
||||||
|
|
||||||
|
// This is critical to be first for BABE (before Consensus)
|
||||||
|
// If not first, we end up dropping the author at session-end
|
||||||
if (pitem) {
|
if (pitem) {
|
||||||
const [engine, data] = pitem.asPreRuntime;
|
try {
|
||||||
|
const [engine, data] = pitem.asPreRuntime;
|
||||||
|
|
||||||
return engine.extractAuthor(data, sessionValidators);
|
accountId = engine.extractAuthor(data, sessionValidators);
|
||||||
} else {
|
} catch {
|
||||||
const [citem] = digest.logs.filter(({ type }) => type === 'Consensus');
|
// ignore
|
||||||
|
|
||||||
// extract author from the consensus (substrate 1.0, digest)
|
|
||||||
if (citem) {
|
|
||||||
const [engine, data] = citem.asConsensus;
|
|
||||||
|
|
||||||
return engine.extractAuthor(data, sessionValidators);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
if (!accountId && citem) {
|
||||||
|
try {
|
||||||
|
const [engine, data] = citem.asConsensus;
|
||||||
|
|
||||||
|
accountId = engine.extractAuthor(data, sessionValidators);
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SEAL, still used in e.g. Kulupu for pow
|
||||||
|
if (!accountId && sitem) {
|
||||||
|
try {
|
||||||
|
const [engine, data] = sitem.asSeal;
|
||||||
|
|
||||||
|
accountId = engine.extractAuthor(data, sessionValidators);
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return accountId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type BN from 'bn.js';
|
|
||||||
import type { u32 } from '@polkadot/types';
|
import type { u32 } from '@polkadot/types';
|
||||||
import type { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Bounty, BountyIndex, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VouchingStatus } from '@polkadot/types/interfaces';
|
import type { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Bounty, BountyIndex, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VouchingStatus } from '@polkadot/types/interfaces';
|
||||||
|
import type { BN } from '@polkadot/util';
|
||||||
|
|
||||||
export * from './accounts/types';
|
export * from './accounts/types';
|
||||||
export * from './council/types';
|
export * from './council/types';
|
||||||
@@ -12,10 +12,9 @@ export * from './elections/types';
|
|||||||
export * from './parachains/types';
|
export * from './parachains/types';
|
||||||
export * from './session/types';
|
export * from './session/types';
|
||||||
export * from './staking/types';
|
export * from './staking/types';
|
||||||
|
export * from './type/types';
|
||||||
|
|
||||||
export interface DeriveBalancesAccount {
|
export interface DeriveBalancesAccountData {
|
||||||
accountId: AccountId;
|
|
||||||
accountNonce: Index;
|
|
||||||
freeBalance: Balance;
|
freeBalance: Balance;
|
||||||
frozenFee: Balance;
|
frozenFee: Balance;
|
||||||
frozenMisc: Balance;
|
frozenMisc: Balance;
|
||||||
@@ -23,16 +22,25 @@ export interface DeriveBalancesAccount {
|
|||||||
votingBalance: Balance;
|
votingBalance: Balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeriveBalancesAll extends DeriveBalancesAccount {
|
export interface DeriveBalancesAccount extends DeriveBalancesAccountData {
|
||||||
isVesting: boolean;
|
accountId: AccountId;
|
||||||
|
accountNonce: Index;
|
||||||
|
additional: DeriveBalancesAccountData[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeriveBalancesAllAccountData extends DeriveBalancesAccountData {
|
||||||
|
availableBalance: Balance;
|
||||||
lockedBalance: Balance;
|
lockedBalance: Balance;
|
||||||
lockedBreakdown: (BalanceLock | BalanceLockTo212)[];
|
lockedBreakdown: (BalanceLock | BalanceLockTo212)[];
|
||||||
availableBalance: Balance;
|
vestingLocked: Balance;
|
||||||
votingBalance: Balance;
|
}
|
||||||
|
|
||||||
|
export interface DeriveBalancesAll extends DeriveBalancesAccount, DeriveBalancesAllAccountData {
|
||||||
|
additional: DeriveBalancesAllAccountData[];
|
||||||
|
isVesting: boolean;
|
||||||
vestedBalance: Balance;
|
vestedBalance: Balance;
|
||||||
vestedClaimable: Balance;
|
vestedClaimable: Balance;
|
||||||
vestingEndBlock: BlockNumber;
|
vestingEndBlock: BlockNumber;
|
||||||
vestingLocked: Balance;
|
|
||||||
vestingPerBlock: Balance;
|
vestingPerBlock: Balance;
|
||||||
vestingTotal: Balance;
|
vestingTotal: Balance;
|
||||||
}
|
}
|
||||||
@@ -100,6 +108,7 @@ export interface DeriveSocietyCandidate {
|
|||||||
|
|
||||||
export interface DeriveSocietyMember {
|
export interface DeriveSocietyMember {
|
||||||
accountId: AccountId;
|
accountId: AccountId;
|
||||||
|
isDefenderVoter: boolean;
|
||||||
isSuspended: boolean;
|
isSuspended: boolean;
|
||||||
payouts: [BlockNumber, Balance][];
|
payouts: [BlockNumber, Balance][];
|
||||||
strikes: StrikeCount;
|
strikes: StrikeCount;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type { DeriveCache } from './types';
|
|||||||
|
|
||||||
const mapCache = new Map<string, any>();
|
const mapCache = new Map<string, any>();
|
||||||
|
|
||||||
const deriveMapCache: DeriveCache = {
|
export const deriveMapCache: DeriveCache = {
|
||||||
del: (key: string): void => {
|
del: (key: string): void => {
|
||||||
mapCache.delete(key);
|
mapCache.delete(key);
|
||||||
},
|
},
|
||||||
@@ -24,11 +24,9 @@ const deriveMapCache: DeriveCache = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deriveNoopCache: DeriveCache = {
|
export const deriveNoopCache: DeriveCache = {
|
||||||
del: (): void => undefined,
|
del: (): void => undefined,
|
||||||
forEach: () => undefined,
|
forEach: () => undefined,
|
||||||
get: (): undefined => undefined,
|
get: (): undefined => undefined,
|
||||||
set: (_: string, value: unknown): unknown => value
|
set: (_: string, value: unknown): unknown => value
|
||||||
};
|
};
|
||||||
|
|
||||||
export { deriveMapCache, deriveNoopCache };
|
|
||||||
|
|||||||
+17
-15
@@ -1,13 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/api",
|
"name": "@polkadot/api",
|
||||||
"version": "3.4.1",
|
"version": "4.16.2",
|
||||||
|
"type": "module",
|
||||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "index.mjs",
|
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
},
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
@@ -16,18 +19,17 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.12.5",
|
"@babel/runtime": "^7.14.6",
|
||||||
"@polkadot/api-derive": "3.4.1",
|
"@polkadot/api-derive": "4.16.2",
|
||||||
"@polkadot/keyring": "^5.2.3",
|
"@polkadot/keyring": "^6.10.1",
|
||||||
"@polkadot/metadata": "3.4.1",
|
"@polkadot/metadata": "4.16.2",
|
||||||
"@polkadot/rpc-core": "3.4.1",
|
"@polkadot/rpc-core": "4.16.2",
|
||||||
"@polkadot/rpc-provider": "3.4.1",
|
"@polkadot/rpc-provider": "4.16.2",
|
||||||
"@polkadot/types": "3.4.1",
|
"@polkadot/types": "4.16.2",
|
||||||
"@polkadot/types-known": "3.4.1",
|
"@polkadot/types-known": "4.16.2",
|
||||||
"@polkadot/util": "^5.2.3",
|
"@polkadot/util": "^6.10.1",
|
||||||
"@polkadot/util-crypto": "^5.2.3",
|
"@polkadot/util-crypto": "^6.10.1",
|
||||||
"@polkadot/x-rxjs": "3.4.1",
|
"@polkadot/x-rxjs": "^6.10.1",
|
||||||
"bn.js": "^4.11.9",
|
|
||||||
"eventemitter3": "^4.0.7"
|
"eventemitter3": "^4.0.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
import type { Vec, u16, u32, u64, u8 } from '@polkadot/types';
|
import type { Vec, u16, u32, u64 } from '@polkadot/types';
|
||||||
import type { Codec } from '@polkadot/types/types';
|
import type { Codec } from '@polkadot/types/types';
|
||||||
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, ModuleId, Moment, Perbill, Percent, Permill, RuntimeDbWeight } from '@polkadot/types/interfaces/runtime';
|
import type { Schedule } from '@polkadot/types/interfaces/contracts';
|
||||||
|
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, Moment, PalletId, Perbill, Percent, Permill, RuntimeDbWeight, Weight } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { SessionIndex } from '@polkadot/types/interfaces/session';
|
import type { SessionIndex } from '@polkadot/types/interfaces/session';
|
||||||
import type { EraIndex } from '@polkadot/types/interfaces/staking';
|
import type { EraIndex } from '@polkadot/types/interfaces/staking';
|
||||||
|
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
|
||||||
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||||
import type { BlockWeights } from '@polkadot/types/interfaces/system';
|
import type { BlockLength, BlockWeights } from '@polkadot/types/interfaces/system';
|
||||||
import type { ApiTypes } from '@polkadot/api/types';
|
import type { ApiTypes } from '@polkadot/api/types';
|
||||||
|
|
||||||
declare module '@polkadot/api/types/consts' {
|
declare module '@polkadot/api/types/consts' {
|
||||||
export interface AugmentedConsts<ApiType> {
|
export interface AugmentedConsts<ApiType> {
|
||||||
babe: {
|
babe: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The number of **slots** that an epoch takes. We couple sessions to
|
* The amount of time, in slots, that each epoch should last.
|
||||||
* epochs, i.e. we start a new session once the new epoch begins.
|
* NOTE: Currently it is not possible to change the epoch duration after
|
||||||
|
* the chain has started. Attempting to do so will brick block production.
|
||||||
**/
|
**/
|
||||||
epochDuration: u64 & AugmentedConst<ApiType>;
|
epochDuration: u64 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
@@ -27,16 +29,22 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* the probability of a slot being empty).
|
* the probability of a slot being empty).
|
||||||
**/
|
**/
|
||||||
expectedBlockTime: Moment & AugmentedConst<ApiType>;
|
expectedBlockTime: Moment & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
balances: {
|
balances: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The minimum amount required to keep an account open.
|
* The minimum amount required to keep an account open.
|
||||||
**/
|
**/
|
||||||
existentialDeposit: Balance & AugmentedConst<ApiType>;
|
existentialDeposit: Balance & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
bounties: {
|
bounties: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* Percentage of the curator fee that will be reserved upfront as deposit for bounty curator.
|
* Percentage of the curator fee that will be reserved upfront as deposit for bounty curator.
|
||||||
**/
|
**/
|
||||||
@@ -49,6 +57,10 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* The delay period for which a bounty beneficiary need to wait before claim the payout.
|
* The delay period for which a bounty beneficiary need to wait before claim the payout.
|
||||||
**/
|
**/
|
||||||
bountyDepositPayoutDelay: BlockNumber & AugmentedConst<ApiType>;
|
bountyDepositPayoutDelay: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Bounty duration in blocks.
|
||||||
|
**/
|
||||||
|
bountyUpdatePeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Minimum value for a bounty.
|
* Minimum value for a bounty.
|
||||||
**/
|
**/
|
||||||
@@ -61,32 +73,58 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* Maximum acceptable reason length.
|
* Maximum acceptable reason length.
|
||||||
**/
|
**/
|
||||||
maximumReasonLength: u32 & AugmentedConst<ApiType>;
|
maximumReasonLength: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
contracts: {
|
contracts: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The maximum nesting level of a call/instantiate stack. A reasonable default
|
* The maximum number of tries that can be queued for deletion.
|
||||||
* value is 100.
|
|
||||||
**/
|
**/
|
||||||
maxDepth: u32 & AugmentedConst<ApiType>;
|
deletionQueueDepth: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The maximum size of a storage value in bytes. A reasonable default is 16 KiB.
|
* The maximum amount of weight that can be consumed per block for lazy trie removal.
|
||||||
**/
|
**/
|
||||||
maxValueSize: u32 & AugmentedConst<ApiType>;
|
deletionWeightLimit: Weight & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Price of a byte of storage per one block interval. Should be greater than 0.
|
* The balance every contract needs to deposit to stay alive indefinitely.
|
||||||
|
*
|
||||||
|
* This is different from the [`Self::TombstoneDeposit`] because this only needs to be
|
||||||
|
* deposited while the contract is alive. Costs for additional storage are added to
|
||||||
|
* this base cost.
|
||||||
|
*
|
||||||
|
* This is a simple way to ensure that contracts with empty storage eventually get deleted by
|
||||||
|
* making them pay rent. This creates an incentive to remove them early in order to save rent.
|
||||||
**/
|
**/
|
||||||
rentByteFee: BalanceOf & AugmentedConst<ApiType>;
|
depositPerContract: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The amount of funds a contract should deposit in order to offset
|
* The balance a contract needs to deposit per storage byte to stay alive indefinitely.
|
||||||
* the cost of one byte.
|
|
||||||
*
|
*
|
||||||
* Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day,
|
* Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day,
|
||||||
* then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent.
|
* then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent.
|
||||||
* But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000,
|
* But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000,
|
||||||
* then it would pay 500 BU/day.
|
* then it would pay 500 BU/day.
|
||||||
**/
|
**/
|
||||||
rentDepositOffset: BalanceOf & AugmentedConst<ApiType>;
|
depositPerStorageByte: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The balance a contract needs to deposit per storage item to stay alive indefinitely.
|
||||||
|
*
|
||||||
|
* It works the same as [`Self::DepositPerStorageByte`] but for storage items.
|
||||||
|
**/
|
||||||
|
depositPerStorageItem: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The fraction of the deposit that should be used as rent per block.
|
||||||
|
*
|
||||||
|
* When a contract hasn't enough balance deposited to stay alive indefinitely it needs
|
||||||
|
* to pay per block for the storage it consumes that is not covered by the deposit.
|
||||||
|
* This determines how high this rent payment is per block as a fraction of the deposit.
|
||||||
|
**/
|
||||||
|
rentFraction: Perbill & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Cost schedule and limits.
|
||||||
|
**/
|
||||||
|
schedule: Schedule & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Number of block delay an extrinsic claim surcharge has.
|
* Number of block delay an extrinsic claim surcharge has.
|
||||||
*
|
*
|
||||||
@@ -94,15 +132,6 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* for current_block - delay
|
* for current_block - delay
|
||||||
**/
|
**/
|
||||||
signedClaimHandicap: BlockNumber & AugmentedConst<ApiType>;
|
signedClaimHandicap: BlockNumber & AugmentedConst<ApiType>;
|
||||||
/**
|
|
||||||
* A size offset for an contract. A just created account with untouched storage will have that
|
|
||||||
* much of storage from the perspective of the state rent.
|
|
||||||
*
|
|
||||||
* This is a simple way to ensure that contracts with empty storage eventually get deleted
|
|
||||||
* by making them pay rent. This creates an incentive to remove them early in order to save
|
|
||||||
* rent.
|
|
||||||
**/
|
|
||||||
storageSizeOffset: u32 & AugmentedConst<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Reward that is received by the party whose touch has led
|
* Reward that is received by the party whose touch has led
|
||||||
* to removal of a contract.
|
* to removal of a contract.
|
||||||
@@ -112,9 +141,12 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* The minimum amount required to generate a tombstone.
|
* The minimum amount required to generate a tombstone.
|
||||||
**/
|
**/
|
||||||
tombstoneDeposit: BalanceOf & AugmentedConst<ApiType>;
|
tombstoneDeposit: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
democracy: {
|
democracy: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* Period in blocks where an external proposal may not be re-submitted after being vetoed.
|
* Period in blocks where an external proposal may not be re-submitted after being vetoed.
|
||||||
**/
|
**/
|
||||||
@@ -128,7 +160,7 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
**/
|
**/
|
||||||
enactmentPeriod: BlockNumber & AugmentedConst<ApiType>;
|
enactmentPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Minimum voting period allowed for an emergency referendum.
|
* Minimum voting period allowed for a fast-track referendum.
|
||||||
**/
|
**/
|
||||||
fastTrackVotingPeriod: BlockNumber & AugmentedConst<ApiType>;
|
fastTrackVotingPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
@@ -137,6 +169,9 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
launchPeriod: BlockNumber & AugmentedConst<ApiType>;
|
launchPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The maximum number of votes for an account.
|
* The maximum number of votes for an account.
|
||||||
|
*
|
||||||
|
* Also used to compute weight, an overly big value can
|
||||||
|
* lead to extrinsic with very big weight: see `delegate` for instance.
|
||||||
**/
|
**/
|
||||||
maxVotes: u32 & AugmentedConst<ApiType>;
|
maxVotes: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
@@ -151,20 +186,128 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* How often (in blocks) to check for new votes.
|
* How often (in blocks) to check for new votes.
|
||||||
**/
|
**/
|
||||||
votingPeriod: BlockNumber & AugmentedConst<ApiType>;
|
votingPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
|
};
|
||||||
|
electionProviderMultiPhase: {
|
||||||
|
/**
|
||||||
|
* The repeat threshold of the offchain worker.
|
||||||
|
*
|
||||||
|
* For example, if it is 5, that means that at least 5 blocks will elapse between attempts
|
||||||
|
* to submit the worker's solution.
|
||||||
|
**/
|
||||||
|
offchainRepeat: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Duration of the signed phase.
|
||||||
|
**/
|
||||||
|
signedPhase: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The minimum amount of improvement to the solution score that defines a solution as
|
||||||
|
* "better" (in any phase).
|
||||||
|
**/
|
||||||
|
solutionImprovementThreshold: Perbill & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Duration of the unsigned phase.
|
||||||
|
**/
|
||||||
|
unsignedPhase: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
elections: {
|
elections: {
|
||||||
[key: string]: Codec;
|
/**
|
||||||
|
* How much should be locked up in order to submit one's candidacy.
|
||||||
|
**/
|
||||||
candidacyBond: BalanceOf & AugmentedConst<ApiType>;
|
candidacyBond: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Number of members to elect.
|
||||||
|
**/
|
||||||
desiredMembers: u32 & AugmentedConst<ApiType>;
|
desiredMembers: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Number of runners_up to keep.
|
||||||
|
**/
|
||||||
desiredRunnersUp: u32 & AugmentedConst<ApiType>;
|
desiredRunnersUp: u32 & AugmentedConst<ApiType>;
|
||||||
moduleId: LockIdentifier & AugmentedConst<ApiType>;
|
/**
|
||||||
|
* Identifier for the elections-phragmen pallet's lock
|
||||||
|
**/
|
||||||
|
palletId: LockIdentifier & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* How long each seat is kept. This defines the next block number at which an election
|
||||||
|
* round will happen. If set to zero, no elections are ever triggered and the module will
|
||||||
|
* be in passive mode.
|
||||||
|
**/
|
||||||
termDuration: BlockNumber & AugmentedConst<ApiType>;
|
termDuration: BlockNumber & AugmentedConst<ApiType>;
|
||||||
votingBond: BalanceOf & AugmentedConst<ApiType>;
|
/**
|
||||||
|
* Base deposit associated with voting.
|
||||||
|
*
|
||||||
|
* This should be sensibly high to economically ensure the pallet cannot be attacked by
|
||||||
|
* creating a gigantic number of votes.
|
||||||
|
**/
|
||||||
|
votingBondBase: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The amount of bond that need to be locked for each vote (32 bytes).
|
||||||
|
**/
|
||||||
|
votingBondFactor: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
|
};
|
||||||
|
gilt: {
|
||||||
|
/**
|
||||||
|
* Portion of the queue which is free from ordering and just a FIFO.
|
||||||
|
*
|
||||||
|
* Must be no greater than `MaxQueueLen`.
|
||||||
|
**/
|
||||||
|
fifoQueueLen: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The number of blocks between consecutive attempts to issue more gilts in an effort to
|
||||||
|
* get to the target amount to be frozen.
|
||||||
|
*
|
||||||
|
* A larger value results in fewer storage hits each block, but a slower period to get to
|
||||||
|
* the target.
|
||||||
|
**/
|
||||||
|
intakePeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The maximum amount of bids that can be turned into issued gilts each block. A larger
|
||||||
|
* value here means less of the block available for transactions should there be a glut of
|
||||||
|
* bids to make into gilts to reach the target.
|
||||||
|
**/
|
||||||
|
maxIntakeBids: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Maximum number of items that may be in each duration queue.
|
||||||
|
**/
|
||||||
|
maxQueueLen: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The minimum amount of funds that may be offered to freeze for a gilt. Note that this
|
||||||
|
* does not actually limit the amount which may be frozen in a gilt since gilts may be
|
||||||
|
* split up in order to satisfy the desired amount of funds under gilts.
|
||||||
|
*
|
||||||
|
* It should be at least big enough to ensure that there is no possible storage spam attack
|
||||||
|
* or queue-filling attack.
|
||||||
|
**/
|
||||||
|
minFreeze: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The base period for the duration queues. This is the common multiple across all
|
||||||
|
* supported freezing durations that can be bid upon.
|
||||||
|
**/
|
||||||
|
period: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Number of duration queues in total. This sets the maximum duration supported, which is
|
||||||
|
* this value multiplied by `Period`.
|
||||||
|
**/
|
||||||
|
queueCount: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
identity: {
|
identity: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The amount held on deposit for a registered identity.
|
* The amount held on deposit for a registered identity
|
||||||
**/
|
**/
|
||||||
basicDeposit: BalanceOf & AugmentedConst<ApiType>;
|
basicDeposit: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
@@ -191,65 +334,114 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* another trie item whose value is the size of an account ID plus 32 bytes.
|
* another trie item whose value is the size of an account ID plus 32 bytes.
|
||||||
**/
|
**/
|
||||||
subAccountDeposit: BalanceOf & AugmentedConst<ApiType>;
|
subAccountDeposit: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
indices: {
|
indices: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The deposit needed for reserving an index.
|
* The deposit needed for reserving an index.
|
||||||
**/
|
**/
|
||||||
deposit: BalanceOf & AugmentedConst<ApiType>;
|
deposit: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
|
};
|
||||||
|
lottery: {
|
||||||
|
/**
|
||||||
|
* The max number of calls available in a single lottery.
|
||||||
|
**/
|
||||||
|
maxCalls: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The Lottery's pallet id
|
||||||
|
**/
|
||||||
|
palletId: PalletId & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
multisig: {
|
multisig: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The base amount of currency needed to reserve for creating a multisig execution or to store
|
* The base amount of currency needed to reserve for creating a multisig execution or to store
|
||||||
* a dispatch call for later.
|
* a dispatch call for later.
|
||||||
|
*
|
||||||
|
* This is held for an additional storage item whose value size is
|
||||||
|
* `4 + sizeof((BlockNumber, Balance, AccountId))` bytes and whose key size is
|
||||||
|
* `32 + sizeof(AccountId)` bytes.
|
||||||
**/
|
**/
|
||||||
depositBase: BalanceOf & AugmentedConst<ApiType>;
|
depositBase: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The amount of currency needed per unit threshold when creating a multisig execution.
|
* The amount of currency needed per unit threshold when creating a multisig execution.
|
||||||
|
*
|
||||||
|
* This is held for adding 32 bytes more into a pre-existing storage value.
|
||||||
**/
|
**/
|
||||||
depositFactor: BalanceOf & AugmentedConst<ApiType>;
|
depositFactor: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The maximum amount of signatories allowed for a given multisig.
|
* The maximum amount of signatories allowed in the multisig.
|
||||||
**/
|
**/
|
||||||
maxSignatories: u16 & AugmentedConst<ApiType>;
|
maxSignatories: u16 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
proxy: {
|
proxy: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* `AnnouncementDepositBase` metadata shadow.
|
* The base amount of currency needed to reserve for creating an announcement.
|
||||||
|
*
|
||||||
|
* This is held when a new storage item holding a `Balance` is created (typically 16 bytes).
|
||||||
**/
|
**/
|
||||||
announcementDepositBase: BalanceOf & AugmentedConst<ApiType>;
|
announcementDepositBase: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* `AnnouncementDepositFactor` metadata shadow.
|
* The amount of currency needed per announcement made.
|
||||||
|
*
|
||||||
|
* This is held for adding an `AccountId`, `Hash` and `BlockNumber` (typically 68 bytes)
|
||||||
|
* into a pre-existing storage value.
|
||||||
**/
|
**/
|
||||||
announcementDepositFactor: BalanceOf & AugmentedConst<ApiType>;
|
announcementDepositFactor: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* `MaxPending` metadata shadow.
|
* The maximum amount of time-delayed announcements that are allowed to be pending.
|
||||||
**/
|
**/
|
||||||
maxPending: u32 & AugmentedConst<ApiType>;
|
maxPending: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The maximum amount of proxies allowed for a single account.
|
* The maximum amount of proxies allowed for a single account.
|
||||||
**/
|
**/
|
||||||
maxProxies: u16 & AugmentedConst<ApiType>;
|
maxProxies: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The base amount of currency needed to reserve for creating a proxy.
|
* The base amount of currency needed to reserve for creating a proxy.
|
||||||
|
*
|
||||||
|
* This is held for an additional storage item whose value size is
|
||||||
|
* `sizeof(Balance)` bytes and whose key size is `sizeof(AccountId)` bytes.
|
||||||
**/
|
**/
|
||||||
proxyDepositBase: BalanceOf & AugmentedConst<ApiType>;
|
proxyDepositBase: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The amount of currency needed per proxy added.
|
* The amount of currency needed per proxy added.
|
||||||
|
*
|
||||||
|
* This is held for adding 32 bytes plus an instance of `ProxyType` more into a pre-existing
|
||||||
|
* storage value. Thus, when configuring `ProxyDepositFactor` one should take into account
|
||||||
|
* `32 + proxy_type.encode().len()` bytes of data.
|
||||||
**/
|
**/
|
||||||
proxyDepositFactor: BalanceOf & AugmentedConst<ApiType>;
|
proxyDepositFactor: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
recovery: {
|
recovery: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The base amount of currency needed to reserve for creating a recovery configuration.
|
* The base amount of currency needed to reserve for creating a recovery configuration.
|
||||||
|
*
|
||||||
|
* This is held for an additional storage item whose value size is
|
||||||
|
* `2 + sizeof(BlockNumber, Balance)` bytes.
|
||||||
**/
|
**/
|
||||||
configDepositBase: BalanceOf & AugmentedConst<ApiType>;
|
configDepositBase: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The amount of currency needed per additional user when creating a recovery configuration.
|
* The amount of currency needed per additional user when creating a recovery configuration.
|
||||||
|
*
|
||||||
|
* This is held for adding `sizeof(AccountId)` bytes more into a pre-existing storage value.
|
||||||
**/
|
**/
|
||||||
friendDepositFactor: BalanceOf & AugmentedConst<ApiType>;
|
friendDepositFactor: BalanceOf & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
@@ -258,11 +450,20 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
maxFriends: u16 & AugmentedConst<ApiType>;
|
maxFriends: u16 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The base amount of currency needed to reserve for starting a recovery.
|
* The base amount of currency needed to reserve for starting a recovery.
|
||||||
|
*
|
||||||
|
* This is primarily held for deterring malicious recovery attempts, and should
|
||||||
|
* have a value large enough that a bad actor would choose not to place this
|
||||||
|
* deposit. It also acts to fund additional storage item whose value size is
|
||||||
|
* `sizeof(BlockNumber, Balance + T * AccountId)` bytes. Where T is a configurable
|
||||||
|
* threshold.
|
||||||
**/
|
**/
|
||||||
recoveryDeposit: BalanceOf & AugmentedConst<ApiType>;
|
recoveryDeposit: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
society: {
|
society: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The minimum amount of a deposit required for a bid to be made.
|
* The minimum amount of a deposit required for a bid to be made.
|
||||||
**/
|
**/
|
||||||
@@ -271,6 +472,10 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* The number of blocks between membership challenges.
|
* The number of blocks between membership challenges.
|
||||||
**/
|
**/
|
||||||
challengePeriod: BlockNumber & AugmentedConst<ApiType>;
|
challengePeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Maximum candidate intake per round.
|
||||||
|
**/
|
||||||
|
maxCandidateIntake: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The number of times a member may vote the wrong way (or not at all, when they are a skeptic)
|
* The number of times a member may vote the wrong way (or not at all, when they are a skeptic)
|
||||||
* before they become suspended.
|
* before they become suspended.
|
||||||
@@ -279,7 +484,7 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
/**
|
/**
|
||||||
* The societies's module id
|
* The societies's module id
|
||||||
**/
|
**/
|
||||||
moduleId: ModuleId & AugmentedConst<ApiType>;
|
palletId: PalletId & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The amount of incentive paid within each period. Doesn't include VoterTip.
|
* The amount of incentive paid within each period. Doesn't include VoterTip.
|
||||||
**/
|
**/
|
||||||
@@ -293,29 +498,17 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* doesn't vote or someone votes in the wrong way.
|
* doesn't vote or someone votes in the wrong way.
|
||||||
**/
|
**/
|
||||||
wrongSideDeduction: BalanceOf & AugmentedConst<ApiType>;
|
wrongSideDeduction: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
staking: {
|
staking: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* Number of eras that staked funds must remain bonded for.
|
* Number of eras that staked funds must remain bonded for.
|
||||||
**/
|
**/
|
||||||
bondingDuration: EraIndex & AugmentedConst<ApiType>;
|
bondingDuration: EraIndex & AugmentedConst<ApiType>;
|
||||||
/**
|
maxNominations: u32 & AugmentedConst<ApiType>;
|
||||||
* The number of blocks before the end of the era from which election submissions are allowed.
|
|
||||||
*
|
|
||||||
* Setting this to zero will disable the offchain compute and only on-chain seq-phragmen will
|
|
||||||
* be used.
|
|
||||||
*
|
|
||||||
* This is bounded by being within the last session. Hence, setting it to a value more than the
|
|
||||||
* length of a session will be pointless.
|
|
||||||
**/
|
|
||||||
electionLookahead: BlockNumber & AugmentedConst<ApiType>;
|
|
||||||
/**
|
|
||||||
* Maximum number of balancing iterations to run in the offchain submission.
|
|
||||||
*
|
|
||||||
* If set to 0, balance_solution will not be executed at all.
|
|
||||||
**/
|
|
||||||
maxIterations: u32 & AugmentedConst<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The maximum number of nominators rewarded for each validator.
|
* The maximum number of nominators rewarded for each validator.
|
||||||
*
|
*
|
||||||
@@ -323,10 +516,6 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* their reward. This used to limit the i/o cost for the nominator payout.
|
* their reward. This used to limit the i/o cost for the nominator payout.
|
||||||
**/
|
**/
|
||||||
maxNominatorRewardedPerValidator: u32 & AugmentedConst<ApiType>;
|
maxNominatorRewardedPerValidator: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
|
||||||
* The threshold of improvement that should be provided for a new solution to be accepted.
|
|
||||||
**/
|
|
||||||
minSolutionScoreBump: Perbill & AugmentedConst<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Number of sessions per era.
|
* Number of sessions per era.
|
||||||
**/
|
**/
|
||||||
@@ -334,20 +523,26 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
/**
|
/**
|
||||||
* Number of eras that slashes are deferred by, after computation.
|
* Number of eras that slashes are deferred by, after computation.
|
||||||
*
|
*
|
||||||
* This should be less than the bonding duration.
|
* This should be less than the bonding duration. Set to 0 if slashes
|
||||||
* Set to 0 if slashes should be applied immediately, without opportunity for
|
* should be applied immediately, without opportunity for intervention.
|
||||||
* intervention.
|
|
||||||
**/
|
**/
|
||||||
slashDeferDuration: EraIndex & AugmentedConst<ApiType>;
|
slashDeferDuration: EraIndex & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
system: {
|
system: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The maximum number of blocks to allow in mortal eras.
|
* Maximum number of block number to block hash mappings to keep (oldest pruned first).
|
||||||
**/
|
**/
|
||||||
blockHashCount: BlockNumber & AugmentedConst<ApiType>;
|
blockHashCount: BlockNumber & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The weight configuration (limits & base values) for each class of extrinsics and block.
|
* The maximum length of a block (in bytes).
|
||||||
|
**/
|
||||||
|
blockLength: BlockLength & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Block & extrinsics weights: base values and limits.
|
||||||
**/
|
**/
|
||||||
blockWeights: BlockWeights & AugmentedConst<ApiType>;
|
blockWeights: BlockWeights & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
@@ -361,10 +556,17 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* that the runtime should know about the prefix in order to make use of it as
|
* that the runtime should know about the prefix in order to make use of it as
|
||||||
* an identifier of the chain.
|
* an identifier of the chain.
|
||||||
**/
|
**/
|
||||||
ss58Prefix: u8 & AugmentedConst<ApiType>;
|
ss58Prefix: u16 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Get the chain's current version.
|
||||||
|
**/
|
||||||
|
version: RuntimeVersion & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
timestamp: {
|
timestamp: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The minimum period between blocks. Beware that this is different to the *expected* period
|
* 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
|
* that the block production apparatus provides. Your chosen consensus system will generally
|
||||||
@@ -372,9 +574,12 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* period on default settings.
|
* period on default settings.
|
||||||
**/
|
**/
|
||||||
minimumPeriod: Moment & AugmentedConst<ApiType>;
|
minimumPeriod: Moment & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
tips: {
|
tips: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The amount held on deposit per byte within the tip report reason.
|
* The amount held on deposit per byte within the tip report reason.
|
||||||
**/
|
**/
|
||||||
@@ -395,9 +600,12 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* The amount held on deposit for placing a tip report.
|
* The amount held on deposit for placing a tip report.
|
||||||
**/
|
**/
|
||||||
tipReportDepositBase: BalanceOf & AugmentedConst<ApiType>;
|
tipReportDepositBase: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
transactionPayment: {
|
transactionPayment: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The fee to be paid for making a transaction; the per-byte portion.
|
* The fee to be paid for making a transaction; the per-byte portion.
|
||||||
**/
|
**/
|
||||||
@@ -406,9 +614,12 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* The polynomial that is applied in order to derive fee from weight.
|
* The polynomial that is applied in order to derive fee from weight.
|
||||||
**/
|
**/
|
||||||
weightToFee: Vec<WeightToFeeCoefficient> & AugmentedConst<ApiType>;
|
weightToFee: Vec<WeightToFeeCoefficient> & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
treasury: {
|
treasury: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* Percentage of spare funds (if any) that are burnt per spend period.
|
* Percentage of spare funds (if any) that are burnt per spend period.
|
||||||
**/
|
**/
|
||||||
@@ -416,7 +627,7 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
/**
|
/**
|
||||||
* The treasury's module id, used for deriving its sovereign account ID.
|
* The treasury's module id, used for deriving its sovereign account ID.
|
||||||
**/
|
**/
|
||||||
moduleId: ModuleId & AugmentedConst<ApiType>;
|
palletId: PalletId & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Fraction of a proposal's value that should be bonded in order to place the proposal.
|
* 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.
|
* An accepted proposal gets these back. A rejected proposal does not.
|
||||||
@@ -430,13 +641,20 @@ declare module '@polkadot/api/types/consts' {
|
|||||||
* Period between successive spends.
|
* Period between successive spends.
|
||||||
**/
|
**/
|
||||||
spendPeriod: BlockNumber & AugmentedConst<ApiType>;
|
spendPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
vesting: {
|
vesting: {
|
||||||
[key: string]: Codec;
|
|
||||||
/**
|
/**
|
||||||
* The minimum amount to be transferred to create a new vesting schedule.
|
* The minimum amount transferred to call `vested_transfer`.
|
||||||
**/
|
**/
|
||||||
minVestedTransfer: BalanceOf & AugmentedConst<ApiType>;
|
minVestedTransfer: BalanceOf & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic const
|
||||||
|
**/
|
||||||
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+478
-117
@@ -6,11 +6,10 @@ import type { ApiTypes } from '@polkadot/api/types';
|
|||||||
declare module '@polkadot/api/types/errors' {
|
declare module '@polkadot/api/types/errors' {
|
||||||
export interface AugmentedErrors<ApiType> {
|
export interface AugmentedErrors<ApiType> {
|
||||||
assets: {
|
assets: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Transfer amount should be non-zero.
|
* Invalid metadata given.
|
||||||
**/
|
**/
|
||||||
AmountZero: AugmentedError<ApiType>;
|
BadMetadata: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Invalid witness data given.
|
* Invalid witness data given.
|
||||||
**/
|
**/
|
||||||
@@ -40,24 +39,27 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
**/
|
**/
|
||||||
NoPermission: AugmentedError<ApiType>;
|
NoPermission: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* A mint operation lead to an overflow.
|
* No provider reference exists to allow a non-zero balance of a non-self-sufficient asset.
|
||||||
**/
|
**/
|
||||||
Overflow: AugmentedError<ApiType>;
|
NoProvider: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Attempt to destroy an asset class when non-zombie, reference-bearing accounts exist.
|
* No approval exists that would allow the transfer.
|
||||||
**/
|
**/
|
||||||
RefsLeft: AugmentedError<ApiType>;
|
Unapproved: AugmentedError<ApiType>;
|
||||||
/**
|
|
||||||
* Too many zombie accounts in use.
|
|
||||||
**/
|
|
||||||
TooManyZombies: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The given asset ID is unknown.
|
* The given asset ID is unknown.
|
||||||
**/
|
**/
|
||||||
Unknown: AugmentedError<ApiType>;
|
Unknown: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The source account would not survive the transfer and it needs to stay alive.
|
||||||
|
**/
|
||||||
|
WouldDie: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
authorship: {
|
authorship: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The uncle is genesis.
|
* The uncle is genesis.
|
||||||
**/
|
**/
|
||||||
@@ -86,9 +88,30 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Uncles already set in the block.
|
* Uncles already set in the block.
|
||||||
**/
|
**/
|
||||||
UnclesAlreadySet: AugmentedError<ApiType>;
|
UnclesAlreadySet: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
|
babe: {
|
||||||
|
/**
|
||||||
|
* A given equivocation report is valid but already previously reported.
|
||||||
|
**/
|
||||||
|
DuplicateOffenceReport: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* An equivocation proof provided as part of an equivocation report is invalid.
|
||||||
|
**/
|
||||||
|
InvalidEquivocationProof: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A key ownership proof provided as part of an equivocation report is invalid.
|
||||||
|
**/
|
||||||
|
InvalidKeyOwnershipProof: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
balances: {
|
balances: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Beneficiary account must pre-exist
|
* Beneficiary account must pre-exist
|
||||||
**/
|
**/
|
||||||
@@ -114,16 +137,19 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
**/
|
**/
|
||||||
LiquidityRestrictions: AugmentedError<ApiType>;
|
LiquidityRestrictions: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Got an overflow after adding
|
* Number of named reserves exceed MaxReserves
|
||||||
**/
|
**/
|
||||||
Overflow: AugmentedError<ApiType>;
|
TooManyReserves: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Vesting balance too high to send value
|
* Vesting balance too high to send value
|
||||||
**/
|
**/
|
||||||
VestingBalance: AugmentedError<ApiType>;
|
VestingBalance: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
bounties: {
|
bounties: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Proposer's balance is too low.
|
* Proposer's balance is too low.
|
||||||
**/
|
**/
|
||||||
@@ -161,9 +187,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The bounty status is unexpected.
|
* The bounty status is unexpected.
|
||||||
**/
|
**/
|
||||||
UnexpectedStatus: AugmentedError<ApiType>;
|
UnexpectedStatus: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
contracts: {
|
contracts: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Performing the requested transfer would have brought the contract below
|
* Performing the requested transfer would have brought the contract below
|
||||||
* the subsistence threshold. No transfer is allowed to do this in order to allow
|
* the subsistence threshold. No transfer is allowed to do this in order to allow
|
||||||
@@ -176,25 +205,60 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
**/
|
**/
|
||||||
CodeNotFound: AugmentedError<ApiType>;
|
CodeNotFound: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The code supplied to `put_code` exceeds the limit specified in the current schedule.
|
* The code supplied to `instantiate_with_code` exceeds the limit specified in the
|
||||||
|
* current schedule.
|
||||||
**/
|
**/
|
||||||
CodeTooLarge: AugmentedError<ApiType>;
|
CodeTooLarge: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A tombstone exist at the specified address.
|
||||||
|
*
|
||||||
|
* Tombstone cannot be called. Anyone can use `seal_restore_to` in order to revive
|
||||||
|
* the contract, though.
|
||||||
|
**/
|
||||||
|
ContractIsTombstone: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A contract could not be evicted because it has enough balance to pay rent.
|
||||||
|
*
|
||||||
|
* This can be returned from [`Pallet::claim_surcharge`] because the target
|
||||||
|
* contract has enough balance to pay for its rent.
|
||||||
|
**/
|
||||||
|
ContractNotEvictable: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* No contract was found at the specified address.
|
||||||
|
**/
|
||||||
|
ContractNotFound: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Contract trapped during execution.
|
* Contract trapped during execution.
|
||||||
**/
|
**/
|
||||||
ContractTrapped: AugmentedError<ApiType>;
|
ContractTrapped: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The debug message specified to `seal_debug_message` does contain invalid UTF-8.
|
||||||
|
**/
|
||||||
|
DebugMessageInvalidUTF8: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Input passed to a contract API function failed to decode as expected type.
|
* Input passed to a contract API function failed to decode as expected type.
|
||||||
**/
|
**/
|
||||||
DecodingFailed: AugmentedError<ApiType>;
|
DecodingFailed: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Removal of a contract failed because the deletion queue is full.
|
||||||
|
*
|
||||||
|
* This can happen when either calling [`Pallet::claim_surcharge`] or `seal_terminate`.
|
||||||
|
* The queue is filled by deleting contracts and emptied by a fixed amount each block.
|
||||||
|
* Trying again during another block is the only way to resolve this issue.
|
||||||
|
**/
|
||||||
|
DeletionQueueFull: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A contract with the same AccountId already exists.
|
||||||
|
**/
|
||||||
|
DuplicateContract: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The topics passed to `seal_deposit_events` contains at least one duplicate.
|
* The topics passed to `seal_deposit_events` contains at least one duplicate.
|
||||||
**/
|
**/
|
||||||
DuplicateTopics: AugmentedError<ApiType>;
|
DuplicateTopics: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* `seal_input` was called twice from the same contract execution context.
|
* `seal_call` forwarded this contracts input. It therefore is no longer available.
|
||||||
**/
|
**/
|
||||||
InputAlreadyRead: AugmentedError<ApiType>;
|
InputForwarded: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* An origin TrieId written in the current block.
|
* An origin TrieId written in the current block.
|
||||||
**/
|
**/
|
||||||
@@ -230,10 +294,11 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
**/
|
**/
|
||||||
NewContractNotFunded: AugmentedError<ApiType>;
|
NewContractNotFunded: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The contract that was called is either no contract at all (a plain account)
|
* The chain does not provide a chain extension. Calling the chain extension results
|
||||||
* or is a tombstone.
|
* in this error. Note that this usually shouldn't happen as deploying such contracts
|
||||||
|
* is rejected.
|
||||||
**/
|
**/
|
||||||
NotCallable: AugmentedError<ApiType>;
|
NoChainExtension: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* A buffer outside of sandbox memory was passed to a contract API function.
|
* A buffer outside of sandbox memory was passed to a contract API function.
|
||||||
**/
|
**/
|
||||||
@@ -251,11 +316,36 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
**/
|
**/
|
||||||
RandomSubjectTooLong: AugmentedError<ApiType>;
|
RandomSubjectTooLong: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The action performed is not allowed while the contract performing it is already
|
* A call tried to invoke a contract that is flagged as non-reentrant.
|
||||||
* on the call stack. Those actions are contract self destruction and restoration
|
|
||||||
* of a tombstone.
|
|
||||||
**/
|
**/
|
||||||
ReentranceDenied: AugmentedError<ApiType>;
|
ReentranceDenied: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The called contract does not have enough balance to pay for its storage.
|
||||||
|
*
|
||||||
|
* The contract ran out of balance and is therefore eligible for eviction into a
|
||||||
|
* tombstone. Anyone can evict the contract by submitting a `claim_surcharge`
|
||||||
|
* extrinsic. Alternatively, a plain balance transfer can be used in order to
|
||||||
|
* increase the contracts funds so that it can be called again.
|
||||||
|
**/
|
||||||
|
RentNotPaid: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A storage modification exhausted the 32bit type that holds the storage size.
|
||||||
|
*
|
||||||
|
* This can either happen when the accumulated storage in bytes is too large or
|
||||||
|
* when number of storage items is too large.
|
||||||
|
**/
|
||||||
|
StorageExhausted: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A contract self destructed in its constructor.
|
||||||
|
*
|
||||||
|
* This can be triggered by a call to `seal_terminate` or `seal_restore_to`.
|
||||||
|
**/
|
||||||
|
TerminatedInConstructor: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Termination of a contract is not allowed while the contract is already
|
||||||
|
* on the call stack. Can be triggered by `seal_terminate` or `seal_restore_to.
|
||||||
|
**/
|
||||||
|
TerminatedWhileReentrant: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The amount of topics passed to `seal_deposit_events` exceeds the limit.
|
* The amount of topics passed to `seal_deposit_events` exceeds the limit.
|
||||||
**/
|
**/
|
||||||
@@ -270,9 +360,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The size defined in `T::MaxValueSize` was exceeded.
|
* The size defined in `T::MaxValueSize` was exceeded.
|
||||||
**/
|
**/
|
||||||
ValueTooLarge: AugmentedError<ApiType>;
|
ValueTooLarge: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
council: {
|
council: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Members are already initialized!
|
* Members are already initialized!
|
||||||
**/
|
**/
|
||||||
@@ -313,9 +406,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The given weight bound for the proposal was too low.
|
* The given weight bound for the proposal was too low.
|
||||||
**/
|
**/
|
||||||
WrongProposalWeight: AugmentedError<ApiType>;
|
WrongProposalWeight: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
democracy: {
|
democracy: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Cannot cancel the same proposal twice
|
* Cannot cancel the same proposal twice
|
||||||
**/
|
**/
|
||||||
@@ -408,10 +504,6 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The given account did not vote on the referendum.
|
* The given account did not vote on the referendum.
|
||||||
**/
|
**/
|
||||||
NotVoter: AugmentedError<ApiType>;
|
NotVoter: AugmentedError<ApiType>;
|
||||||
/**
|
|
||||||
* An unexpected integer overflow occurred.
|
|
||||||
**/
|
|
||||||
Overflow: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Invalid preimage
|
* Invalid preimage
|
||||||
**/
|
**/
|
||||||
@@ -440,10 +532,6 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Maximum number of proposals reached.
|
* Maximum number of proposals reached.
|
||||||
**/
|
**/
|
||||||
TooManyProposals: AugmentedError<ApiType>;
|
TooManyProposals: AugmentedError<ApiType>;
|
||||||
/**
|
|
||||||
* An unexpected integer underflow occurred.
|
|
||||||
**/
|
|
||||||
Underflow: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Value too low
|
* Value too low
|
||||||
**/
|
**/
|
||||||
@@ -457,9 +545,38 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Invalid upper bound.
|
* Invalid upper bound.
|
||||||
**/
|
**/
|
||||||
WrongUpperBound: AugmentedError<ApiType>;
|
WrongUpperBound: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
|
electionProviderMultiPhase: {
|
||||||
|
/**
|
||||||
|
* The call is not allowed at this point.
|
||||||
|
**/
|
||||||
|
CallNotAllowed: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* OCW submitted solution for wrong round
|
||||||
|
**/
|
||||||
|
OcwCallWrongEra: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Submission was too early.
|
||||||
|
**/
|
||||||
|
PreDispatchEarlySubmission: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Submission was too weak, score-wise.
|
||||||
|
**/
|
||||||
|
PreDispatchWeakSubmission: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Wrong number of winners presented.
|
||||||
|
**/
|
||||||
|
PreDispatchWrongWinnerCount: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
elections: {
|
elections: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Duplicated candidate submission.
|
* Duplicated candidate submission.
|
||||||
**/
|
**/
|
||||||
@@ -468,10 +585,6 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Candidate does not have enough funds.
|
* Candidate does not have enough funds.
|
||||||
**/
|
**/
|
||||||
InsufficientCandidateFunds: AugmentedError<ApiType>;
|
InsufficientCandidateFunds: AugmentedError<ApiType>;
|
||||||
/**
|
|
||||||
* The provided count of number of candidates is incorrect.
|
|
||||||
**/
|
|
||||||
InvalidCandidateCount: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The renouncing origin presented a wrong `Renouncing` parameter.
|
* The renouncing origin presented a wrong `Renouncing` parameter.
|
||||||
**/
|
**/
|
||||||
@@ -484,6 +597,10 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The provided count of number of votes is incorrect.
|
* The provided count of number of votes is incorrect.
|
||||||
**/
|
**/
|
||||||
InvalidVoteCount: AugmentedError<ApiType>;
|
InvalidVoteCount: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The provided count of number of candidates is incorrect.
|
||||||
|
**/
|
||||||
|
InvalidWitnessData: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Cannot vote with stake less than minimum balance.
|
* Cannot vote with stake less than minimum balance.
|
||||||
**/
|
**/
|
||||||
@@ -515,7 +632,7 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
/**
|
/**
|
||||||
* Runner cannot re-submit candidacy.
|
* Runner cannot re-submit candidacy.
|
||||||
**/
|
**/
|
||||||
RunnerSubmit: AugmentedError<ApiType>;
|
RunnerUpSubmit: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Cannot vote more than candidates.
|
* Cannot vote more than candidates.
|
||||||
**/
|
**/
|
||||||
@@ -528,9 +645,51 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Cannot vote when no candidates or members exist.
|
* Cannot vote when no candidates or members exist.
|
||||||
**/
|
**/
|
||||||
UnableToVote: AugmentedError<ApiType>;
|
UnableToVote: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
|
gilt: {
|
||||||
|
/**
|
||||||
|
* The amount of the bid is less than the minimum allowed.
|
||||||
|
**/
|
||||||
|
AmountTooSmall: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The queue for the bid's duration is full and the amount bid is too low to get in through
|
||||||
|
* replacing an existing bid.
|
||||||
|
**/
|
||||||
|
BidTooLow: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The duration is the bid is greater than the number of queues.
|
||||||
|
**/
|
||||||
|
DurationTooBig: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The duration of the bid is less than one.
|
||||||
|
**/
|
||||||
|
DurationTooSmall: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Gilt not yet at expiry date.
|
||||||
|
**/
|
||||||
|
NotExpired: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The given bid for retraction is not found.
|
||||||
|
**/
|
||||||
|
NotFound: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Not the owner of the gilt.
|
||||||
|
**/
|
||||||
|
NotOwner: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Gilt index is unknown.
|
||||||
|
**/
|
||||||
|
Unknown: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
grandpa: {
|
grandpa: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Attempt to signal GRANDPA change with one already pending.
|
* Attempt to signal GRANDPA change with one already pending.
|
||||||
**/
|
**/
|
||||||
@@ -561,9 +720,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Cannot signal forced change so soon after last.
|
* Cannot signal forced change so soon after last.
|
||||||
**/
|
**/
|
||||||
TooSoon: AugmentedError<ApiType>;
|
TooSoon: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
identity: {
|
identity: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Account ID is already named.
|
* Account ID is already named.
|
||||||
**/
|
**/
|
||||||
@@ -628,9 +790,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Too many subs-accounts.
|
* Too many subs-accounts.
|
||||||
**/
|
**/
|
||||||
TooManySubAccounts: AugmentedError<ApiType>;
|
TooManySubAccounts: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
imOnline: {
|
imOnline: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Duplicated heartbeat.
|
* Duplicated heartbeat.
|
||||||
**/
|
**/
|
||||||
@@ -639,9 +804,72 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Non existent public key.
|
* Non existent public key.
|
||||||
**/
|
**/
|
||||||
InvalidKey: AugmentedError<ApiType>;
|
InvalidKey: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
|
indices: {
|
||||||
|
/**
|
||||||
|
* The index was not available.
|
||||||
|
**/
|
||||||
|
InUse: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The index was not already assigned.
|
||||||
|
**/
|
||||||
|
NotAssigned: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The index is assigned to another account.
|
||||||
|
**/
|
||||||
|
NotOwner: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The source and destination accounts are identical.
|
||||||
|
**/
|
||||||
|
NotTransfer: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The index is permanent and may not be freed/changed.
|
||||||
|
**/
|
||||||
|
Permanent: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
|
lottery: {
|
||||||
|
/**
|
||||||
|
* A lottery has already ended.
|
||||||
|
**/
|
||||||
|
AlreadyEnded: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* You are already participating in the lottery with this call.
|
||||||
|
**/
|
||||||
|
AlreadyParticipating: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Failed to encode calls
|
||||||
|
**/
|
||||||
|
EncodingFailed: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A lottery is already in progress.
|
||||||
|
**/
|
||||||
|
InProgress: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The call is not valid for an open lottery.
|
||||||
|
**/
|
||||||
|
InvalidCall: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A lottery has not been configured.
|
||||||
|
**/
|
||||||
|
NotConfigured: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Too many calls for a single lottery.
|
||||||
|
**/
|
||||||
|
TooManyCalls: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
multisig: {
|
multisig: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Call is already approved by this signatory.
|
* Call is already approved by this signatory.
|
||||||
**/
|
**/
|
||||||
@@ -650,6 +878,10 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The data to be stored is already stored.
|
* The data to be stored is already stored.
|
||||||
**/
|
**/
|
||||||
AlreadyStored: AugmentedError<ApiType>;
|
AlreadyStored: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The maximum weight information provided was too low.
|
||||||
|
**/
|
||||||
|
MaxWeightTooLow: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Threshold must be 2 or greater.
|
* Threshold must be 2 or greater.
|
||||||
**/
|
**/
|
||||||
@@ -690,17 +922,16 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* A timepoint was given, yet no multisig operation is underway.
|
* A timepoint was given, yet no multisig operation is underway.
|
||||||
**/
|
**/
|
||||||
UnexpectedTimepoint: AugmentedError<ApiType>;
|
UnexpectedTimepoint: AugmentedError<ApiType>;
|
||||||
/**
|
|
||||||
* The maximum weight information provided was too low.
|
|
||||||
**/
|
|
||||||
WeightTooLow: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A different timepoint was given to the multisig operation that is underway.
|
* A different timepoint was given to the multisig operation that is underway.
|
||||||
**/
|
**/
|
||||||
WrongTimepoint: AugmentedError<ApiType>;
|
WrongTimepoint: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
proxy: {
|
proxy: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Account is already a proxy.
|
* Account is already a proxy.
|
||||||
**/
|
**/
|
||||||
@@ -733,9 +964,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* A call which is incompatible with the proxy type's filter was attempted.
|
* A call which is incompatible with the proxy type's filter was attempted.
|
||||||
**/
|
**/
|
||||||
Unproxyable: AugmentedError<ApiType>;
|
Unproxyable: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
recovery: {
|
recovery: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* This account is already set up for recovery
|
* This account is already set up for recovery
|
||||||
**/
|
**/
|
||||||
@@ -752,6 +986,10 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* This user has already vouched for this recovery
|
* This user has already vouched for this recovery
|
||||||
**/
|
**/
|
||||||
AlreadyVouched: AugmentedError<ApiType>;
|
AlreadyVouched: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Some internal state is broken.
|
||||||
|
**/
|
||||||
|
BadState: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The friend must wait until the delay period to vouch for this recovery
|
* The friend must wait until the delay period to vouch for this recovery
|
||||||
**/
|
**/
|
||||||
@@ -784,10 +1022,6 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* A recovery process has not started for this rescuer
|
* A recovery process has not started for this rescuer
|
||||||
**/
|
**/
|
||||||
NotStarted: AugmentedError<ApiType>;
|
NotStarted: AugmentedError<ApiType>;
|
||||||
/**
|
|
||||||
* There was an overflow in a calculation
|
|
||||||
**/
|
|
||||||
Overflow: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* There are still active recovery attempts that need to be closed
|
* There are still active recovery attempts that need to be closed
|
||||||
**/
|
**/
|
||||||
@@ -800,9 +1034,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Threshold must be greater than zero
|
* Threshold must be greater than zero
|
||||||
**/
|
**/
|
||||||
ZeroThreshold: AugmentedError<ApiType>;
|
ZeroThreshold: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
scheduler: {
|
scheduler: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Failed to schedule a call
|
* Failed to schedule a call
|
||||||
**/
|
**/
|
||||||
@@ -819,9 +1056,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Given target block number is in the past.
|
* Given target block number is in the past.
|
||||||
**/
|
**/
|
||||||
TargetBlockNumberInPast: AugmentedError<ApiType>;
|
TargetBlockNumberInPast: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
session: {
|
session: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Registered duplicate key.
|
* Registered duplicate key.
|
||||||
**/
|
**/
|
||||||
@@ -830,6 +1070,10 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* Invalid ownership proof.
|
* Invalid ownership proof.
|
||||||
**/
|
**/
|
||||||
InvalidProof: AugmentedError<ApiType>;
|
InvalidProof: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Key setting account is not live, so it's impossible to associate keys.
|
||||||
|
**/
|
||||||
|
NoAccount: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* No associated validator ID for account.
|
* No associated validator ID for account.
|
||||||
**/
|
**/
|
||||||
@@ -838,9 +1082,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* No keys are associated with this account.
|
* No keys are associated with this account.
|
||||||
**/
|
**/
|
||||||
NoKeys: AugmentedError<ApiType>;
|
NoKeys: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
society: {
|
society: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* User has already made a bid.
|
* User has already made a bid.
|
||||||
**/
|
**/
|
||||||
@@ -913,9 +1160,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* User is suspended.
|
* User is suspended.
|
||||||
**/
|
**/
|
||||||
Suspended: AugmentedError<ApiType>;
|
Suspended: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
staking: {
|
staking: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Stash is already bonded.
|
* Stash is already bonded.
|
||||||
**/
|
**/
|
||||||
@@ -929,9 +1179,17 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
**/
|
**/
|
||||||
AlreadyPaired: AugmentedError<ApiType>;
|
AlreadyPaired: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The call is not allowed at the given time due to restrictions of election period.
|
* Internal state has become somehow corrupted and the operation cannot continue.
|
||||||
**/
|
**/
|
||||||
CallNotAllowed: AugmentedError<ApiType>;
|
BadState: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A nomination target was supplied that was blocked or otherwise not a validator.
|
||||||
|
**/
|
||||||
|
BadTarget: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The user has enough bond and thus cannot be chilled forcefully by an external person.
|
||||||
|
**/
|
||||||
|
CannotChillOther: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Duplicate index.
|
* Duplicate index.
|
||||||
**/
|
**/
|
||||||
@@ -953,9 +1211,9 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
**/
|
**/
|
||||||
IncorrectSlashingSpans: AugmentedError<ApiType>;
|
IncorrectSlashingSpans: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Can not bond with value less than minimum balance.
|
* Can not bond with value less than minimum required.
|
||||||
**/
|
**/
|
||||||
InsufficientValue: AugmentedError<ApiType>;
|
InsufficientBond: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Invalid era to reward.
|
* Invalid era to reward.
|
||||||
**/
|
**/
|
||||||
@@ -989,70 +1247,35 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
**/
|
**/
|
||||||
NoUnlockChunk: AugmentedError<ApiType>;
|
NoUnlockChunk: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Error while building the assignment type from the compact. This can happen if an index
|
* There are too many nominators in the system. Governance needs to adjust the staking settings
|
||||||
* is invalid, or if the weights _overflow_.
|
* to keep things safe for the runtime.
|
||||||
**/
|
**/
|
||||||
OffchainElectionBogusCompact: AugmentedError<ApiType>;
|
TooManyNominators: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The submitted result has unknown edges that are not among the presented winners.
|
* Too many nomination targets supplied.
|
||||||
**/
|
**/
|
||||||
OffchainElectionBogusEdge: AugmentedError<ApiType>;
|
TooManyTargets: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The election size is invalid.
|
* There are too many validators in the system. Governance needs to adjust the staking settings
|
||||||
|
* to keep things safe for the runtime.
|
||||||
**/
|
**/
|
||||||
OffchainElectionBogusElectionSize: AugmentedError<ApiType>;
|
TooManyValidators: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* One of the submitted nominators has an edge to which they have not voted on chain.
|
* Generic error
|
||||||
**/
|
**/
|
||||||
OffchainElectionBogusNomination: AugmentedError<ApiType>;
|
[key: string]: AugmentedError<ApiType>;
|
||||||
/**
|
|
||||||
* One of the submitted nominators is not an active nominator on chain.
|
|
||||||
**/
|
|
||||||
OffchainElectionBogusNominator: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The claimed score does not match with the one computed from the data.
|
|
||||||
**/
|
|
||||||
OffchainElectionBogusScore: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* A self vote must only be originated from a validator to ONLY themselves.
|
|
||||||
**/
|
|
||||||
OffchainElectionBogusSelfVote: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* One of the submitted winners is not an active candidate on chain (index is out of range
|
|
||||||
* in snapshot).
|
|
||||||
**/
|
|
||||||
OffchainElectionBogusWinner: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Incorrect number of winners were presented.
|
|
||||||
**/
|
|
||||||
OffchainElectionBogusWinnerCount: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The submitted result is received out of the open window.
|
|
||||||
**/
|
|
||||||
OffchainElectionEarlySubmission: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* One of the submitted nominators has an edge which is submitted before the last non-zero
|
|
||||||
* slash of the target.
|
|
||||||
**/
|
|
||||||
OffchainElectionSlashedNomination: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The submitted result is not as good as the one stored on chain.
|
|
||||||
**/
|
|
||||||
OffchainElectionWeakSubmission: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The snapshot data of the current window is missing.
|
|
||||||
**/
|
|
||||||
SnapshotUnavailable: AugmentedError<ApiType>;
|
|
||||||
};
|
};
|
||||||
sudo: {
|
sudo: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Sender must be the Sudo account
|
* Sender must be the Sudo account
|
||||||
**/
|
**/
|
||||||
RequireSudo: AugmentedError<ApiType>;
|
RequireSudo: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
system: {
|
system: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Failed to extract the runtime version from the new runtime.
|
* Failed to extract the runtime version from the new runtime.
|
||||||
*
|
*
|
||||||
@@ -1077,9 +1300,12 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* and the new runtime.
|
* and the new runtime.
|
||||||
**/
|
**/
|
||||||
SpecVersionNeedsToIncrease: AugmentedError<ApiType>;
|
SpecVersionNeedsToIncrease: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
technicalCommittee: {
|
technicalCommittee: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Members are already initialized!
|
* Members are already initialized!
|
||||||
**/
|
**/
|
||||||
@@ -1120,9 +1346,26 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The given weight bound for the proposal was too low.
|
* The given weight bound for the proposal was too low.
|
||||||
**/
|
**/
|
||||||
WrongProposalWeight: AugmentedError<ApiType>;
|
WrongProposalWeight: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
|
technicalMembership: {
|
||||||
|
/**
|
||||||
|
* Already a member.
|
||||||
|
**/
|
||||||
|
AlreadyMember: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Not a member.
|
||||||
|
**/
|
||||||
|
NotMember: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
tips: {
|
tips: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The tip was already found/started.
|
* The tip was already found/started.
|
||||||
**/
|
**/
|
||||||
@@ -1147,9 +1390,70 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The tip hash is unknown.
|
* The tip hash is unknown.
|
||||||
**/
|
**/
|
||||||
UnknownTip: AugmentedError<ApiType>;
|
UnknownTip: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
|
transactionStorage: {
|
||||||
|
/**
|
||||||
|
* Attempted to call `store` outside of block execution.
|
||||||
|
**/
|
||||||
|
BadContext: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Double proof check in the block.
|
||||||
|
**/
|
||||||
|
DoubleCheck: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Attempting to store empty transaction
|
||||||
|
**/
|
||||||
|
EmptyTransaction: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Insufficient account balance.
|
||||||
|
**/
|
||||||
|
InsufficientFunds: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Proof failed verification.
|
||||||
|
**/
|
||||||
|
InvalidProof: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Missing storage proof.
|
||||||
|
**/
|
||||||
|
MissingProof: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Unable to verify proof becasue state data is missing.
|
||||||
|
**/
|
||||||
|
MissingStateData: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Invalid configuration.
|
||||||
|
**/
|
||||||
|
NotConfigured: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Storage proof was not checked in the block.
|
||||||
|
**/
|
||||||
|
ProofNotChecked: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Renewed extrinsic is not found.
|
||||||
|
**/
|
||||||
|
RenewedNotFound: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Too many transactions in the block.
|
||||||
|
**/
|
||||||
|
TooManyTransactions: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Transaction is too large.
|
||||||
|
**/
|
||||||
|
TransactionTooLarge: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Proof was not expected in this block.
|
||||||
|
**/
|
||||||
|
UnexpectedProof: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
treasury: {
|
treasury: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Proposer's balance is too low.
|
* Proposer's balance is too low.
|
||||||
**/
|
**/
|
||||||
@@ -1158,9 +1462,62 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* No proposal or bounty at that index.
|
* No proposal or bounty at that index.
|
||||||
**/
|
**/
|
||||||
InvalidIndex: AugmentedError<ApiType>;
|
InvalidIndex: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Too many approvals in the queue.
|
||||||
|
**/
|
||||||
|
TooManyApprovals: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
|
uniques: {
|
||||||
|
/**
|
||||||
|
* The asset instance ID has already been used for an asset.
|
||||||
|
**/
|
||||||
|
AlreadyExists: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Invalid witness data given.
|
||||||
|
**/
|
||||||
|
BadWitness: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The asset instance or class is frozen.
|
||||||
|
**/
|
||||||
|
Frozen: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The asset ID is already taken.
|
||||||
|
**/
|
||||||
|
InUse: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* There is no delegate approved.
|
||||||
|
**/
|
||||||
|
NoDelegate: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The signing account has no permission to do the operation.
|
||||||
|
**/
|
||||||
|
NoPermission: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* No approval exists that would allow the transfer.
|
||||||
|
**/
|
||||||
|
Unapproved: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The given asset ID is unknown.
|
||||||
|
**/
|
||||||
|
Unknown: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The delegate turned out to be different to what was expected.
|
||||||
|
**/
|
||||||
|
WrongDelegate: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The owner turned out to be different to what was expected.
|
||||||
|
**/
|
||||||
|
WrongOwner: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
vesting: {
|
vesting: {
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Amount being transferred is too low to create a vesting schedule.
|
* Amount being transferred is too low to create a vesting schedule.
|
||||||
**/
|
**/
|
||||||
@@ -1173,6 +1530,10 @@ declare module '@polkadot/api/types/errors' {
|
|||||||
* The account given is not vesting.
|
* The account given is not vesting.
|
||||||
**/
|
**/
|
||||||
NotVesting: AugmentedError<ApiType>;
|
NotVesting: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
import type { Bytes, Option, Vec, bool, u16, u32 } from '@polkadot/types';
|
import type { Bytes, Option, Vec, bool, u16, u32, u8 } from '@polkadot/types';
|
||||||
import type { ITuple } from '@polkadot/types/types';
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { TAssetBalance } from '@polkadot/types/interfaces/assets';
|
import type { TAssetBalance } from '@polkadot/types/interfaces/assets';
|
||||||
import type { BalanceStatus } from '@polkadot/types/interfaces/balances';
|
import type { BalanceStatus } from '@polkadot/types/interfaces/balances';
|
||||||
@@ -9,23 +9,48 @@ import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/coll
|
|||||||
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||||
import type { PropIndex, ReferendumIndex } from '@polkadot/types/interfaces/democracy';
|
import type { PropIndex, ReferendumIndex } from '@polkadot/types/interfaces/democracy';
|
||||||
import type { VoteThreshold } from '@polkadot/types/interfaces/elections';
|
import type { VoteThreshold } from '@polkadot/types/interfaces/elections';
|
||||||
|
import type { ActiveIndex } from '@polkadot/types/interfaces/gilt';
|
||||||
import type { AuthorityList } from '@polkadot/types/interfaces/grandpa';
|
import type { AuthorityList } from '@polkadot/types/interfaces/grandpa';
|
||||||
import type { RegistrarIndex } from '@polkadot/types/interfaces/identity';
|
import type { RegistrarIndex } from '@polkadot/types/interfaces/identity';
|
||||||
|
import type { CallIndex } from '@polkadot/types/interfaces/lottery';
|
||||||
import type { Kind, OpaqueTimeSlot } from '@polkadot/types/interfaces/offences';
|
import type { Kind, OpaqueTimeSlot } from '@polkadot/types/interfaces/offences';
|
||||||
import type { ProxyType } from '@polkadot/types/interfaces/proxy';
|
import type { ProxyType } from '@polkadot/types/interfaces/proxy';
|
||||||
import type { AccountId, AccountIndex, AssetId, Balance, BlockNumber, CallHash, Hash, PhantomData } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, CallHash, Hash, PhantomData } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
import type { TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
||||||
import type { IdentificationTuple, SessionIndex } from '@polkadot/types/interfaces/session';
|
import type { IdentificationTuple, SessionIndex } from '@polkadot/types/interfaces/session';
|
||||||
import type { ElectionCompute, EraIndex } from '@polkadot/types/interfaces/staking';
|
import type { ElectionCompute, EraIndex } from '@polkadot/types/interfaces/staking';
|
||||||
import type { DispatchError, DispatchInfo, DispatchResult } from '@polkadot/types/interfaces/system';
|
import type { DispatchError, DispatchInfo, DispatchResult } from '@polkadot/types/interfaces/system';
|
||||||
import type { BountyIndex } from '@polkadot/types/interfaces/treasury';
|
import type { BountyIndex } from '@polkadot/types/interfaces/treasury';
|
||||||
|
import type { ClassId, InstanceId } from '@polkadot/types/interfaces/uniques';
|
||||||
import type { Timepoint } from '@polkadot/types/interfaces/utility';
|
import type { Timepoint } from '@polkadot/types/interfaces/utility';
|
||||||
import type { ApiTypes } from '@polkadot/api/types';
|
import type { ApiTypes } from '@polkadot/api/types';
|
||||||
|
|
||||||
declare module '@polkadot/api/types/events' {
|
declare module '@polkadot/api/types/events' {
|
||||||
export interface AugmentedEvents<ApiType> {
|
export interface AugmentedEvents<ApiType> {
|
||||||
assets: {
|
assets: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
/**
|
||||||
|
* An approval for account `delegate` was cancelled by `owner`.
|
||||||
|
* \[id, owner, delegate\]
|
||||||
|
**/
|
||||||
|
ApprovalCancelled: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* (Additional) funds have been approved for transfer to a destination account.
|
||||||
|
* \[asset_id, source, delegate, amount\]
|
||||||
|
**/
|
||||||
|
ApprovedTransfer: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
|
||||||
|
/**
|
||||||
|
* Some asset `asset_id` was frozen. \[asset_id\]
|
||||||
|
**/
|
||||||
|
AssetFrozen: AugmentedEvent<ApiType, [AssetId]>;
|
||||||
|
/**
|
||||||
|
* An asset has had its attributes changed by the `Force` origin.
|
||||||
|
* \[id\]
|
||||||
|
**/
|
||||||
|
AssetStatusChanged: AugmentedEvent<ApiType, [AssetId]>;
|
||||||
|
/**
|
||||||
|
* Some asset `asset_id` was thawed. \[asset_id\]
|
||||||
|
**/
|
||||||
|
AssetThawed: AugmentedEvent<ApiType, [AssetId]>;
|
||||||
/**
|
/**
|
||||||
* Some assets were destroyed. \[asset_id, owner, balance\]
|
* Some assets were destroyed. \[asset_id, owner, balance\]
|
||||||
**/
|
**/
|
||||||
@@ -42,10 +67,6 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* Some asset class was force-created. \[asset_id, owner\]
|
* Some asset class was force-created. \[asset_id, owner\]
|
||||||
**/
|
**/
|
||||||
ForceCreated: AugmentedEvent<ApiType, [AssetId, AccountId]>;
|
ForceCreated: AugmentedEvent<ApiType, [AssetId, AccountId]>;
|
||||||
/**
|
|
||||||
* Some assets was transferred by an admin. \[asset_id, from, to, amount\]
|
|
||||||
**/
|
|
||||||
ForceTransferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
|
|
||||||
/**
|
/**
|
||||||
* Some account `who` was frozen. \[asset_id, who\]
|
* Some account `who` was frozen. \[asset_id, who\]
|
||||||
**/
|
**/
|
||||||
@@ -55,9 +76,13 @@ declare module '@polkadot/api/types/events' {
|
|||||||
**/
|
**/
|
||||||
Issued: AugmentedEvent<ApiType, [AssetId, AccountId, TAssetBalance]>;
|
Issued: AugmentedEvent<ApiType, [AssetId, AccountId, TAssetBalance]>;
|
||||||
/**
|
/**
|
||||||
* The maximum amount of zombies allowed has changed. \[asset_id, max_zombies\]
|
* Metadata has been cleared for an asset. \[asset_id\]
|
||||||
**/
|
**/
|
||||||
MaxZombiesChanged: AugmentedEvent<ApiType, [AssetId, u32]>;
|
MetadataCleared: AugmentedEvent<ApiType, [AssetId]>;
|
||||||
|
/**
|
||||||
|
* New metadata has been set for an asset. \[asset_id, name, symbol, decimals, is_frozen\]
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [AssetId, Bytes, Bytes, u8, bool]>;
|
||||||
/**
|
/**
|
||||||
* The owner changed \[asset_id, owner\]
|
* The owner changed \[asset_id, owner\]
|
||||||
**/
|
**/
|
||||||
@@ -74,9 +99,18 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* Some assets were transferred. \[asset_id, from, to, amount\]
|
* Some assets were transferred. \[asset_id, from, to, amount\]
|
||||||
**/
|
**/
|
||||||
Transferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
|
Transferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
|
||||||
|
/**
|
||||||
|
* An `amount` was transferred in its entirety from `owner` to `destination` by
|
||||||
|
* the approved `delegate`.
|
||||||
|
* \[id, owner, delegate, destination\]
|
||||||
|
**/
|
||||||
|
TransferredApproved: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, AccountId, TAssetBalance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
balances: {
|
balances: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A balance was set by root. \[who, free, reserved\]
|
* A balance was set by root. \[who, free, reserved\]
|
||||||
**/
|
**/
|
||||||
@@ -112,9 +146,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* Some balance was unreserved (moved from reserved to free). \[who, value\]
|
* Some balance was unreserved (moved from reserved to free). \[who, value\]
|
||||||
**/
|
**/
|
||||||
Unreserved: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
Unreserved: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
bounties: {
|
bounties: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A bounty is awarded to a beneficiary. \[index, beneficiary\]
|
* A bounty is awarded to a beneficiary. \[index, beneficiary\]
|
||||||
**/
|
**/
|
||||||
@@ -143,52 +180,84 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* A bounty proposal was rejected; funds were slashed. \[index, bond\]
|
* A bounty proposal was rejected; funds were slashed. \[index, bond\]
|
||||||
**/
|
**/
|
||||||
BountyRejected: AugmentedEvent<ApiType, [BountyIndex, Balance]>;
|
BountyRejected: AugmentedEvent<ApiType, [BountyIndex, Balance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
contracts: {
|
contracts: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Code with the specified hash has been stored.
|
* A code with the specified hash was removed.
|
||||||
* \[code_hash\]
|
* \[code_hash\]
|
||||||
|
*
|
||||||
|
* This happens when the last contract that uses this code hash was removed or evicted.
|
||||||
|
**/
|
||||||
|
CodeRemoved: AugmentedEvent<ApiType, [Hash]>;
|
||||||
|
/**
|
||||||
|
* Code with the specified hash has been stored. \[code_hash\]
|
||||||
**/
|
**/
|
||||||
CodeStored: AugmentedEvent<ApiType, [Hash]>;
|
CodeStored: AugmentedEvent<ApiType, [Hash]>;
|
||||||
/**
|
/**
|
||||||
* An event deposited upon execution of a contract from the account.
|
* A custom event emitted by the contract.
|
||||||
* \[account, data\]
|
* \[contract, data\]
|
||||||
**/
|
|
||||||
ContractExecution: AugmentedEvent<ApiType, [AccountId, Bytes]>;
|
|
||||||
/**
|
|
||||||
* Contract has been evicted and is now in tombstone state.
|
|
||||||
* \[contract, tombstone\]
|
|
||||||
*
|
*
|
||||||
* # Params
|
* # Params
|
||||||
*
|
*
|
||||||
* - `contract`: `AccountId`: The account ID of the evicted contract.
|
* - `contract`: The contract that emitted the event.
|
||||||
* - `tombstone`: `bool`: True if the evicted contract left behind a tombstone.
|
* - `data`: Data supplied by the contract. Metadata generated during contract
|
||||||
|
* compilation is needed to decode it.
|
||||||
**/
|
**/
|
||||||
Evicted: AugmentedEvent<ApiType, [AccountId, bool]>;
|
ContractEmitted: AugmentedEvent<ApiType, [AccountId, Bytes]>;
|
||||||
/**
|
/**
|
||||||
* Contract deployed by address at the specified address. \[owner, contract\]
|
* Contract has been evicted and is now in tombstone state. \[contract\]
|
||||||
|
**/
|
||||||
|
Evicted: AugmentedEvent<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Contract deployed by address at the specified address. \[deployer, contract\]
|
||||||
**/
|
**/
|
||||||
Instantiated: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
Instantiated: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* Restoration for a contract has been successful.
|
* Restoration of a contract has been successful.
|
||||||
* \[donor, dest, code_hash, rent_allowance\]
|
* \[restorer, dest, code_hash, rent_allowance\]
|
||||||
*
|
*
|
||||||
* # Params
|
* # Params
|
||||||
*
|
*
|
||||||
* - `donor`: `AccountId`: Account ID of the restoring contract
|
* - `restorer`: Account ID of the restoring contract.
|
||||||
* - `dest`: `AccountId`: Account ID of the restored contract
|
* - `dest`: Account ID of the restored contract.
|
||||||
* - `code_hash`: `Hash`: Code hash of the restored contract
|
* - `code_hash`: Code hash of the restored contract.
|
||||||
* - `rent_allowance: `Balance`: Rent allowance of the restored contract
|
* - `rent_allowance`: Rent allowance of the restored contract.
|
||||||
**/
|
**/
|
||||||
Restored: AugmentedEvent<ApiType, [AccountId, AccountId, Hash, Balance]>;
|
Restored: AugmentedEvent<ApiType, [AccountId, AccountId, Hash, Balance]>;
|
||||||
/**
|
/**
|
||||||
* Triggered when the current \[schedule\] is updated.
|
* Triggered when the current schedule is updated.
|
||||||
|
* \[version\]
|
||||||
|
*
|
||||||
|
* # Params
|
||||||
|
*
|
||||||
|
* - `version`: The version of the newly set schedule.
|
||||||
**/
|
**/
|
||||||
ScheduleUpdated: AugmentedEvent<ApiType, [u32]>;
|
ScheduleUpdated: AugmentedEvent<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Contract has been terminated without leaving a tombstone.
|
||||||
|
* \[contract, beneficiary\]
|
||||||
|
*
|
||||||
|
* # Params
|
||||||
|
*
|
||||||
|
* - `contract`: The contract that was terminated.
|
||||||
|
* - `beneficiary`: The account that received the contracts remaining balance.
|
||||||
|
*
|
||||||
|
* # Note
|
||||||
|
*
|
||||||
|
* The only way for a contract to be removed without a tombstone and emitting
|
||||||
|
* this event is by calling `seal_terminate`.
|
||||||
|
**/
|
||||||
|
Terminated: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
council: {
|
council: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A motion was approved by the required threshold.
|
* A motion was approved by the required threshold.
|
||||||
* \[proposal_hash\]
|
* \[proposal_hash\]
|
||||||
@@ -226,9 +295,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* \[account, proposal_hash, voted, yes, no\]
|
* \[account, proposal_hash, voted, yes, no\]
|
||||||
**/
|
**/
|
||||||
Voted: AugmentedEvent<ApiType, [AccountId, Hash, bool, MemberCount, MemberCount]>;
|
Voted: AugmentedEvent<ApiType, [AccountId, Hash, bool, MemberCount, MemberCount]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
democracy: {
|
democracy: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A proposal \[hash\] has been blacklisted permanently.
|
* A proposal \[hash\] has been blacklisted permanently.
|
||||||
**/
|
**/
|
||||||
@@ -305,11 +377,51 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* An external proposal has been vetoed. \[who, proposal_hash, until\]
|
* An external proposal has been vetoed. \[who, proposal_hash, until\]
|
||||||
**/
|
**/
|
||||||
Vetoed: AugmentedEvent<ApiType, [AccountId, Hash, BlockNumber]>;
|
Vetoed: AugmentedEvent<ApiType, [AccountId, Hash, BlockNumber]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
|
};
|
||||||
|
electionProviderMultiPhase: {
|
||||||
|
/**
|
||||||
|
* The election has been finalized, with `Some` of the given computation, or else if the
|
||||||
|
* election failed, `None`.
|
||||||
|
**/
|
||||||
|
ElectionFinalized: AugmentedEvent<ApiType, [Option<ElectionCompute>]>;
|
||||||
|
/**
|
||||||
|
* An account has been rewarded for their signed submission being finalized.
|
||||||
|
**/
|
||||||
|
Rewarded: AugmentedEvent<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* The signed phase of the given round has started.
|
||||||
|
**/
|
||||||
|
SignedPhaseStarted: AugmentedEvent<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* An account has been slashed for submitting an invalid signed submission.
|
||||||
|
**/
|
||||||
|
Slashed: AugmentedEvent<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* A solution was stored with the given compute.
|
||||||
|
*
|
||||||
|
* If the solution is signed, this means that it hasn't yet been processed. If the
|
||||||
|
* solution is unsigned, this means that it has also been processed.
|
||||||
|
**/
|
||||||
|
SolutionStored: AugmentedEvent<ApiType, [ElectionCompute]>;
|
||||||
|
/**
|
||||||
|
* The unsigned phase of the given round has started.
|
||||||
|
**/
|
||||||
|
UnsignedPhaseStarted: AugmentedEvent<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
elections: {
|
elections: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A candidate was slashed due to failing to obtain a seat as member or runner-up
|
* A \[candidate\] was slashed by \[amount\] due to failing to obtain a seat as member or
|
||||||
|
* runner-up.
|
||||||
|
*
|
||||||
|
* Note that old members and runners-up are also candidates.
|
||||||
**/
|
**/
|
||||||
CandidateSlashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
CandidateSlashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||||
/**
|
/**
|
||||||
@@ -327,28 +439,53 @@ declare module '@polkadot/api/types/events' {
|
|||||||
**/
|
**/
|
||||||
MemberKicked: AugmentedEvent<ApiType, [AccountId]>;
|
MemberKicked: AugmentedEvent<ApiType, [AccountId]>;
|
||||||
/**
|
/**
|
||||||
* A \[member\] has renounced their candidacy.
|
* A new term with \[new_members\]. This indicates that enough candidates existed to run
|
||||||
**/
|
* the election, not that enough have has been elected. The inner value must be examined
|
||||||
MemberRenounced: AugmentedEvent<ApiType, [AccountId]>;
|
* for this purpose. A `NewTerm(\[\])` indicates that some candidates got their bond
|
||||||
/**
|
* slashed and none were elected, whilst `EmptyTerm` means that no candidates existed to
|
||||||
* A new term with \[new_members\]. This indicates that enough candidates existed to run the
|
* begin with.
|
||||||
* election, not that enough have has been elected. The inner value must be examined for
|
|
||||||
* this purpose. A `NewTerm(\[\])` indicates that some candidates got their bond slashed and
|
|
||||||
* none were elected, whilst `EmptyTerm` means that no candidates existed to begin with.
|
|
||||||
**/
|
**/
|
||||||
NewTerm: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId, Balance]>>]>;
|
NewTerm: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId, Balance]>>]>;
|
||||||
/**
|
/**
|
||||||
* A seat holder (member or runner-up) was slashed due to failing to retaining their position.
|
* Someone has renounced their candidacy.
|
||||||
|
**/
|
||||||
|
Renounced: AugmentedEvent<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* A \[seat holder\] was slashed by \[amount\] by being forcefully removed from the set.
|
||||||
**/
|
**/
|
||||||
SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||||
/**
|
/**
|
||||||
* A voter was reported with the the report being successful or not.
|
* Generic event
|
||||||
* \[voter, reporter, success\]
|
|
||||||
**/
|
**/
|
||||||
VoterReported: AugmentedEvent<ApiType, [AccountId, AccountId, bool]>;
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
|
};
|
||||||
|
gilt: {
|
||||||
|
/**
|
||||||
|
* A bid was successfully placed.
|
||||||
|
* \[ who, amount, duration \]
|
||||||
|
**/
|
||||||
|
BidPlaced: AugmentedEvent<ApiType, [AccountId, BalanceOf, u32]>;
|
||||||
|
/**
|
||||||
|
* A bid was successfully removed (before being accepted as a gilt).
|
||||||
|
* \[ who, amount, duration \]
|
||||||
|
**/
|
||||||
|
BidRetracted: AugmentedEvent<ApiType, [AccountId, BalanceOf, u32]>;
|
||||||
|
/**
|
||||||
|
* A bid was accepted as a gilt. The balance may not be released until expiry.
|
||||||
|
* \[ index, expiry, who, amount \]
|
||||||
|
**/
|
||||||
|
GiltIssued: AugmentedEvent<ApiType, [ActiveIndex, BlockNumber, AccountId, BalanceOf]>;
|
||||||
|
/**
|
||||||
|
* An expired gilt has been thawed.
|
||||||
|
* \[ index, who, original_amount, additional_amount \]
|
||||||
|
**/
|
||||||
|
GiltThawed: AugmentedEvent<ApiType, [ActiveIndex, AccountId, BalanceOf, BalanceOf]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
grandpa: {
|
grandpa: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* New authority set has been applied. \[authority_set\]
|
* New authority set has been applied. \[authority_set\]
|
||||||
**/
|
**/
|
||||||
@@ -361,9 +498,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* Current authority set has been resumed.
|
* Current authority set has been resumed.
|
||||||
**/
|
**/
|
||||||
Resumed: AugmentedEvent<ApiType, []>;
|
Resumed: AugmentedEvent<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
identity: {
|
identity: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A name was cleared, and the given balance returned. \[who, deposit\]
|
* A name was cleared, and the given balance returned. \[who, deposit\]
|
||||||
**/
|
**/
|
||||||
@@ -406,9 +546,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* main identity account to the sub-identity account. \[sub, main, deposit\]
|
* main identity account to the sub-identity account. \[sub, main, deposit\]
|
||||||
**/
|
**/
|
||||||
SubIdentityRevoked: AugmentedEvent<ApiType, [AccountId, AccountId, Balance]>;
|
SubIdentityRevoked: AugmentedEvent<ApiType, [AccountId, AccountId, Balance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
imOnline: {
|
imOnline: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* At the end of the session, no offence was committed.
|
* At the end of the session, no offence was committed.
|
||||||
**/
|
**/
|
||||||
@@ -421,9 +564,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* At the end of the session, at least one validator was found to be \[offline\].
|
* At the end of the session, at least one validator was found to be \[offline\].
|
||||||
**/
|
**/
|
||||||
SomeOffline: AugmentedEvent<ApiType, [Vec<IdentificationTuple>]>;
|
SomeOffline: AugmentedEvent<ApiType, [Vec<IdentificationTuple>]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
indices: {
|
indices: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A account index was assigned. \[index, who\]
|
* A account index was assigned. \[index, who\]
|
||||||
**/
|
**/
|
||||||
@@ -436,9 +582,34 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* A account index has been frozen to its current account ID. \[index, who\]
|
* A account index has been frozen to its current account ID. \[index, who\]
|
||||||
**/
|
**/
|
||||||
IndexFrozen: AugmentedEvent<ApiType, [AccountIndex, AccountId]>;
|
IndexFrozen: AugmentedEvent<ApiType, [AccountIndex, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
|
};
|
||||||
|
lottery: {
|
||||||
|
/**
|
||||||
|
* A new set of calls have been set!
|
||||||
|
**/
|
||||||
|
CallsUpdated: AugmentedEvent<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* A lottery has been started!
|
||||||
|
**/
|
||||||
|
LotteryStarted: AugmentedEvent<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* A ticket has been bought!
|
||||||
|
**/
|
||||||
|
TicketBought: AugmentedEvent<ApiType, [AccountId, CallIndex]>;
|
||||||
|
/**
|
||||||
|
* A winner has been chosen!
|
||||||
|
**/
|
||||||
|
Winner: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
multisig: {
|
multisig: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A multisig operation has been approved by someone.
|
* A multisig operation has been approved by someone.
|
||||||
* \[approving, timepoint, multisig, call_hash\]
|
* \[approving, timepoint, multisig, call_hash\]
|
||||||
@@ -456,19 +627,24 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* A new multisig operation has begun. \[approving, multisig, call_hash\]
|
* A new multisig operation has begun. \[approving, multisig, call_hash\]
|
||||||
**/
|
**/
|
||||||
NewMultisig: AugmentedEvent<ApiType, [AccountId, AccountId, CallHash]>;
|
NewMultisig: AugmentedEvent<ApiType, [AccountId, AccountId, CallHash]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
offences: {
|
offences: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* There is an offence reported of the given `kind` happened at the `session_index` and
|
* There is an offence reported of the given `kind` happened at the `session_index` and
|
||||||
* (kind-specific) time slot. This event is not deposited for duplicate slashes. last
|
* (kind-specific) time slot. This event is not deposited for duplicate slashes.
|
||||||
* element indicates of the offence was applied (true) or queued (false)
|
* \[kind, timeslot\].
|
||||||
* \[kind, timeslot, applied\].
|
|
||||||
**/
|
**/
|
||||||
Offence: AugmentedEvent<ApiType, [Kind, OpaqueTimeSlot, bool]>;
|
Offence: AugmentedEvent<ApiType, [Kind, OpaqueTimeSlot]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
proxy: {
|
proxy: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* An announcement was placed to make a call in the future. \[real, proxy, call_hash\]
|
* An announcement was placed to make a call in the future. \[real, proxy, call_hash\]
|
||||||
**/
|
**/
|
||||||
@@ -482,9 +658,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* A proxy was executed correctly, with the given \[result\].
|
* A proxy was executed correctly, with the given \[result\].
|
||||||
**/
|
**/
|
||||||
ProxyExecuted: AugmentedEvent<ApiType, [DispatchResult]>;
|
ProxyExecuted: AugmentedEvent<ApiType, [DispatchResult]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
recovery: {
|
recovery: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Lost account has been successfully recovered by rescuer account.
|
* Lost account has been successfully recovered by rescuer account.
|
||||||
* \[lost, rescuer\]
|
* \[lost, rescuer\]
|
||||||
@@ -513,9 +692,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* \[lost, rescuer, sender\]
|
* \[lost, rescuer, sender\]
|
||||||
**/
|
**/
|
||||||
RecoveryVouched: AugmentedEvent<ApiType, [AccountId, AccountId, AccountId]>;
|
RecoveryVouched: AugmentedEvent<ApiType, [AccountId, AccountId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
scheduler: {
|
scheduler: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Canceled some task. \[when, index\]
|
* Canceled some task. \[when, index\]
|
||||||
**/
|
**/
|
||||||
@@ -528,17 +710,23 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* Scheduled some task. \[when, index\]
|
* Scheduled some task. \[when, index\]
|
||||||
**/
|
**/
|
||||||
Scheduled: AugmentedEvent<ApiType, [BlockNumber, u32]>;
|
Scheduled: AugmentedEvent<ApiType, [BlockNumber, u32]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
session: {
|
session: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* New session has happened. Note that the argument is the \[session_index\], not the block
|
* New session has happened. Note that the argument is the \[session_index\], not the block
|
||||||
* number as the type might suggest.
|
* number as the type might suggest.
|
||||||
**/
|
**/
|
||||||
NewSession: AugmentedEvent<ApiType, [SessionIndex]>;
|
NewSession: AugmentedEvent<ApiType, [SessionIndex]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
society: {
|
society: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A \[candidate\] was dropped (due to an excess of bids in the system).
|
* A \[candidate\] was dropped (due to an excess of bids in the system).
|
||||||
**/
|
**/
|
||||||
@@ -606,9 +794,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* their offer is the second. The vouching party is the third. \[candidate_id, offer, vouching\]
|
* their offer is the second. The vouching party is the third. \[candidate_id, offer, vouching\]
|
||||||
**/
|
**/
|
||||||
Vouch: AugmentedEvent<ApiType, [AccountId, Balance, AccountId]>;
|
Vouch: AugmentedEvent<ApiType, [AccountId, Balance, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
staking: {
|
staking: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* An account has bonded this amount. \[stash, amount\]
|
* An account has bonded this amount. \[stash, amount\]
|
||||||
*
|
*
|
||||||
@@ -622,6 +813,10 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* \[era_index, validator_payout, remainder\]
|
* \[era_index, validator_payout, remainder\]
|
||||||
**/
|
**/
|
||||||
EraPayout: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
|
EraPayout: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
|
||||||
|
/**
|
||||||
|
* A nominator has been kicked from a validator. \[nominator, stash\]
|
||||||
|
**/
|
||||||
|
Kicked: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* An old slashing report from a prior era was discarded because it could
|
* An old slashing report from a prior era was discarded because it could
|
||||||
* not be processed. \[session_index\]
|
* not be processed. \[session_index\]
|
||||||
@@ -637,13 +832,13 @@ declare module '@polkadot/api/types/events' {
|
|||||||
**/
|
**/
|
||||||
Slash: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
Slash: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||||
/**
|
/**
|
||||||
* A new solution for the upcoming election has been stored. \[compute\]
|
* A new set of stakers was elected.
|
||||||
**/
|
**/
|
||||||
SolutionStored: AugmentedEvent<ApiType, [ElectionCompute]>;
|
StakingElection: AugmentedEvent<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* A new set of stakers was elected with the given \[compute\].
|
* The election failed. No new era is planned.
|
||||||
**/
|
**/
|
||||||
StakingElection: AugmentedEvent<ApiType, [ElectionCompute]>;
|
StakingElectionFailed: AugmentedEvent<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* An account has unbonded this amount. \[stash, amount\]
|
* An account has unbonded this amount. \[stash, amount\]
|
||||||
**/
|
**/
|
||||||
@@ -653,9 +848,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* from the unlocking queue. \[stash, amount\]
|
* from the unlocking queue. \[stash, amount\]
|
||||||
**/
|
**/
|
||||||
Withdrawn: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
Withdrawn: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
sudo: {
|
sudo: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The \[sudoer\] just switched identity; the old key is supplied.
|
* The \[sudoer\] just switched identity; the old key is supplied.
|
||||||
**/
|
**/
|
||||||
@@ -668,9 +866,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* A sudo just took place. \[result\]
|
* A sudo just took place. \[result\]
|
||||||
**/
|
**/
|
||||||
SudoAsDone: AugmentedEvent<ApiType, [DispatchResult]>;
|
SudoAsDone: AugmentedEvent<ApiType, [DispatchResult]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
system: {
|
system: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* `:code` was updated.
|
* `:code` was updated.
|
||||||
**/
|
**/
|
||||||
@@ -691,9 +892,16 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* A new \[account\] was created.
|
* A new \[account\] was created.
|
||||||
**/
|
**/
|
||||||
NewAccount: AugmentedEvent<ApiType, [AccountId]>;
|
NewAccount: AugmentedEvent<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* On on-chain remark happened. \[origin, remark_hash\]
|
||||||
|
**/
|
||||||
|
Remarked: AugmentedEvent<ApiType, [AccountId, Hash]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
technicalCommittee: {
|
technicalCommittee: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A motion was approved by the required threshold.
|
* A motion was approved by the required threshold.
|
||||||
* \[proposal_hash\]
|
* \[proposal_hash\]
|
||||||
@@ -731,9 +939,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* \[account, proposal_hash, voted, yes, no\]
|
* \[account, proposal_hash, voted, yes, no\]
|
||||||
**/
|
**/
|
||||||
Voted: AugmentedEvent<ApiType, [AccountId, Hash, bool, MemberCount, MemberCount]>;
|
Voted: AugmentedEvent<ApiType, [AccountId, Hash, bool, MemberCount, MemberCount]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
technicalMembership: {
|
technicalMembership: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Phantom member, never used.
|
* Phantom member, never used.
|
||||||
**/
|
**/
|
||||||
@@ -758,9 +969,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* Two members were swapped; see the transaction for who.
|
* Two members were swapped; see the transaction for who.
|
||||||
**/
|
**/
|
||||||
MembersSwapped: AugmentedEvent<ApiType, []>;
|
MembersSwapped: AugmentedEvent<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
tips: {
|
tips: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A new tip suggestion has been opened. \[tip_hash\]
|
* A new tip suggestion has been opened. \[tip_hash\]
|
||||||
**/
|
**/
|
||||||
@@ -781,9 +995,30 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* A tip suggestion has been slashed. \[tip_hash, finder, deposit\]
|
* A tip suggestion has been slashed. \[tip_hash, finder, deposit\]
|
||||||
**/
|
**/
|
||||||
TipSlashed: AugmentedEvent<ApiType, [Hash, AccountId, Balance]>;
|
TipSlashed: AugmentedEvent<ApiType, [Hash, AccountId, Balance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
|
};
|
||||||
|
transactionStorage: {
|
||||||
|
/**
|
||||||
|
* Storage proof was successfully checked.
|
||||||
|
**/
|
||||||
|
ProofChecked: AugmentedEvent<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Renewed data under specified index.
|
||||||
|
**/
|
||||||
|
Renewed: AugmentedEvent<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Stored data under specified index.
|
||||||
|
**/
|
||||||
|
Stored: AugmentedEvent<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
treasury: {
|
treasury: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Some funds have been allocated. \[proposal_index, award, beneficiary\]
|
* Some funds have been allocated. \[proposal_index, award, beneficiary\]
|
||||||
**/
|
**/
|
||||||
@@ -813,9 +1048,114 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* We have ended a spend period and will now allocate funds. \[budget_remaining\]
|
* We have ended a spend period and will now allocate funds. \[budget_remaining\]
|
||||||
**/
|
**/
|
||||||
Spending: AugmentedEvent<ApiType, [Balance]>;
|
Spending: AugmentedEvent<ApiType, [Balance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
|
};
|
||||||
|
uniques: {
|
||||||
|
/**
|
||||||
|
* An approval for a `delegate` account to transfer the `instance` of an asset `class` was
|
||||||
|
* cancelled by its `owner`.
|
||||||
|
* \[ class, instance, owner, delegate \]
|
||||||
|
**/
|
||||||
|
ApprovalCancelled: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* An `instance` of an asset `class` has been approved by the `owner` for transfer by a
|
||||||
|
* `delegate`.
|
||||||
|
* \[ class, instance, owner, delegate \]
|
||||||
|
**/
|
||||||
|
ApprovedTransfer: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* An asset `class` has had its attributes changed by the `Force` origin.
|
||||||
|
* \[ class \]
|
||||||
|
**/
|
||||||
|
AssetStatusChanged: AugmentedEvent<ApiType, [ClassId]>;
|
||||||
|
/**
|
||||||
|
* Attribute metadata has been cleared for an asset class or instance.
|
||||||
|
* \[ class, maybe_instance, key, maybe_value \]
|
||||||
|
**/
|
||||||
|
AttributeCleared: AugmentedEvent<ApiType, [ClassId, Option<InstanceId>, Bytes]>;
|
||||||
|
/**
|
||||||
|
* New attribute metadata has been set for an asset class or instance.
|
||||||
|
* \[ class, maybe_instance, key, value \]
|
||||||
|
**/
|
||||||
|
AttributeSet: AugmentedEvent<ApiType, [ClassId, Option<InstanceId>, Bytes, Bytes]>;
|
||||||
|
/**
|
||||||
|
* An asset `instance` was destroyed. \[ class, instance, owner \]
|
||||||
|
**/
|
||||||
|
Burned: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Some asset `class` was frozen. \[ class \]
|
||||||
|
**/
|
||||||
|
ClassFrozen: AugmentedEvent<ApiType, [ClassId]>;
|
||||||
|
/**
|
||||||
|
* Metadata has been cleared for an asset class. \[ class \]
|
||||||
|
**/
|
||||||
|
ClassMetadataCleared: AugmentedEvent<ApiType, [ClassId]>;
|
||||||
|
/**
|
||||||
|
* New metadata has been set for an asset class. \[ class, data, is_frozen \]
|
||||||
|
**/
|
||||||
|
ClassMetadataSet: AugmentedEvent<ApiType, [ClassId, Bytes, bool]>;
|
||||||
|
/**
|
||||||
|
* Some asset `class` was thawed. \[ class \]
|
||||||
|
**/
|
||||||
|
ClassThawed: AugmentedEvent<ApiType, [ClassId]>;
|
||||||
|
/**
|
||||||
|
* An asset class was created. \[ class, creator, owner \]
|
||||||
|
**/
|
||||||
|
Created: AugmentedEvent<ApiType, [ClassId, AccountId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* An asset `class` was destroyed. \[ class \]
|
||||||
|
**/
|
||||||
|
Destroyed: AugmentedEvent<ApiType, [ClassId]>;
|
||||||
|
/**
|
||||||
|
* An asset class was force-created. \[ class, owner \]
|
||||||
|
**/
|
||||||
|
ForceCreated: AugmentedEvent<ApiType, [ClassId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Some asset `instance` was frozen. \[ class, instance \]
|
||||||
|
**/
|
||||||
|
Frozen: AugmentedEvent<ApiType, [ClassId, InstanceId]>;
|
||||||
|
/**
|
||||||
|
* An asset `instace` was issued. \[ class, instance, owner \]
|
||||||
|
**/
|
||||||
|
Issued: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Metadata has been cleared for an asset instance. \[ class, instance \]
|
||||||
|
**/
|
||||||
|
MetadataCleared: AugmentedEvent<ApiType, [ClassId, InstanceId]>;
|
||||||
|
/**
|
||||||
|
* New metadata has been set for an asset instance.
|
||||||
|
* \[ class, instance, data, is_frozen \]
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [ClassId, InstanceId, Bytes, bool]>;
|
||||||
|
/**
|
||||||
|
* The owner changed \[ class, new_owner \]
|
||||||
|
**/
|
||||||
|
OwnerChanged: AugmentedEvent<ApiType, [ClassId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Metadata has been cleared for an asset instance. \[ class, successful_instances \]
|
||||||
|
**/
|
||||||
|
Redeposited: AugmentedEvent<ApiType, [ClassId, Vec<InstanceId>]>;
|
||||||
|
/**
|
||||||
|
* The management team changed \[ class, issuer, admin, freezer \]
|
||||||
|
**/
|
||||||
|
TeamChanged: AugmentedEvent<ApiType, [ClassId, AccountId, AccountId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Some asset `instance` was thawed. \[ class, instance \]
|
||||||
|
**/
|
||||||
|
Thawed: AugmentedEvent<ApiType, [ClassId, InstanceId]>;
|
||||||
|
/**
|
||||||
|
* An asset `instace` was transferred. \[ class, instance, from, to \]
|
||||||
|
**/
|
||||||
|
Transferred: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
utility: {
|
utility: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Batch of dispatches completed fully with no error.
|
* Batch of dispatches completed fully with no error.
|
||||||
**/
|
**/
|
||||||
@@ -825,9 +1165,12 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* well as the error. \[index, error\]
|
* well as the error. \[index, error\]
|
||||||
**/
|
**/
|
||||||
BatchInterrupted: AugmentedEvent<ApiType, [u32, DispatchError]>;
|
BatchInterrupted: AugmentedEvent<ApiType, [u32, DispatchError]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
vesting: {
|
vesting: {
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* An \[account\] has become fully vested. No further vesting can happen.
|
* An \[account\] has become fully vested. No further vesting can happen.
|
||||||
**/
|
**/
|
||||||
@@ -838,6 +1181,10 @@ declare module '@polkadot/api/types/events' {
|
|||||||
* \[account, unvested\]
|
* \[account, unvested\]
|
||||||
**/
|
**/
|
||||||
VestingUpdated: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
VestingUpdated: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+444
-109
@@ -3,29 +3,32 @@
|
|||||||
|
|
||||||
import type { Bytes, Data, Option, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
|
import type { Bytes, Data, Option, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
|
||||||
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
|
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
|
||||||
import type { AssetBalance, AssetDetails } from '@polkadot/types/interfaces/assets';
|
import type { AssetApproval, AssetBalance, AssetDetails, AssetMetadata } from '@polkadot/types/interfaces/assets';
|
||||||
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||||
import type { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
|
import type { BabeAuthorityWeight, BabeEpochConfiguration, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
|
||||||
import type { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
|
import type { AccountData, BalanceLock, ReserveData } from '@polkadot/types/interfaces/balances';
|
||||||
import type { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
|
import type { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
|
||||||
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||||
import type { CodeHash, ContractInfo, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
|
import type { CodeHash, ContractInfo, DeletedContract, PrefabWasmModule } from '@polkadot/types/interfaces/contracts';
|
||||||
import type { PreimageStatus, PropIndex, Proposal, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy';
|
import type { PreimageStatus, PropIndex, Proposal, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy';
|
||||||
import type { VoteThreshold } from '@polkadot/types/interfaces/elections';
|
import type { VoteThreshold } from '@polkadot/types/interfaces/elections';
|
||||||
|
import type { ActiveGilt, ActiveGiltsTotal, ActiveIndex, GiltBid } from '@polkadot/types/interfaces/gilt';
|
||||||
import type { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
|
import type { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
|
||||||
import type { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
|
import type { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
|
||||||
import type { AuthIndex } from '@polkadot/types/interfaces/imOnline';
|
import type { AuthIndex } from '@polkadot/types/interfaces/imOnline';
|
||||||
import type { DeferredOffenceOf, Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
|
import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lottery';
|
||||||
|
import type { Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
|
||||||
import type { ProxyAnnouncement, ProxyDefinition } from '@polkadot/types/interfaces/proxy';
|
import type { ProxyAnnouncement, ProxyDefinition } from '@polkadot/types/interfaces/proxy';
|
||||||
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
|
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
|
||||||
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, Releases, ValidatorId } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, Releases, Slot, TransactionInfo, ValidatorId } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
import type { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
||||||
import type { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
|
import type { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
|
||||||
import type { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
|
import type { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
|
||||||
import type { ActiveEraInfo, ElectionResult, ElectionScore, ElectionStatus, EraIndex, EraRewardPoints, Exposure, Forcing, Nominations, RewardDestination, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
import type { ActiveEraInfo, ElectionPhase, ElectionScore, EraIndex, EraRewardPoints, Exposure, Forcing, Nominations, ReadySolution, RewardDestination, RoundSnapshot, SeatHolder, SlashingSpans, SolutionOrSnapshotSize, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs, Voter } from '@polkadot/types/interfaces/staking';
|
||||||
import type { AccountInfo, ConsumedWeight, DigestOf, EventIndex, EventRecord, LastRuntimeUpgradeInfo, Phase } from '@polkadot/types/interfaces/system';
|
import type { AccountInfo, ConsumedWeight, DigestOf, EventIndex, EventRecord, LastRuntimeUpgradeInfo, Phase } from '@polkadot/types/interfaces/system';
|
||||||
import type { Bounty, BountyIndex, OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
import type { Bounty, BountyIndex, OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
||||||
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||||
|
import type { ClassDetails, ClassId, ClassMetadata, DepositBalanceOf, InstanceDetails, InstanceId, InstanceMetadata } from '@polkadot/types/interfaces/uniques';
|
||||||
import type { Multisig } from '@polkadot/types/interfaces/utility';
|
import type { Multisig } from '@polkadot/types/interfaces/utility';
|
||||||
import type { VestingInfo } from '@polkadot/types/interfaces/vesting';
|
import type { VestingInfo } from '@polkadot/types/interfaces/vesting';
|
||||||
import type { ApiTypes } from '@polkadot/api/types';
|
import type { ApiTypes } from '@polkadot/api/types';
|
||||||
@@ -33,18 +36,30 @@ import type { ApiTypes } from '@polkadot/api/types';
|
|||||||
declare module '@polkadot/api/types/storage' {
|
declare module '@polkadot/api/types/storage' {
|
||||||
export interface AugmentedQueries<ApiType> {
|
export interface AugmentedQueries<ApiType> {
|
||||||
assets: {
|
assets: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The number of units of assets held by any given account.
|
* The number of units of assets held by any given account.
|
||||||
**/
|
**/
|
||||||
account: AugmentedQueryDoubleMap<ApiType, (key1: AssetId | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<AssetBalance>, [AssetId, AccountId]> & QueryableStorageEntry<ApiType, [AssetId, AccountId]>;
|
account: AugmentedQuery<ApiType, (arg1: AssetId | AnyNumber | Uint8Array, arg2: AccountId | string | Uint8Array) => Observable<AssetBalance>, [AssetId, AccountId]> & QueryableStorageEntry<ApiType, [AssetId, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Approved balance transfers. First balance is the amount approved for transfer. Second
|
||||||
|
* is the amount of `T::Currency` reserved for storing this.
|
||||||
|
* First key is the asset ID, second key is the owner and third key is the delegate.
|
||||||
|
**/
|
||||||
|
approvals: AugmentedQuery<ApiType, (arg1: AssetId | AnyNumber | Uint8Array, arg2: AccountId | string | Uint8Array, arg3: AccountId | string | Uint8Array) => Observable<Option<AssetApproval>>, [AssetId, AccountId, AccountId]> & QueryableStorageEntry<ApiType, [AssetId, AccountId, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* Details of an asset.
|
* Details of an asset.
|
||||||
**/
|
**/
|
||||||
asset: AugmentedQuery<ApiType, (arg: AssetId | AnyNumber | Uint8Array) => Observable<Option<AssetDetails>>, [AssetId]> & QueryableStorageEntry<ApiType, [AssetId]>;
|
asset: AugmentedQuery<ApiType, (arg: AssetId | AnyNumber | Uint8Array) => Observable<Option<AssetDetails>>, [AssetId]> & QueryableStorageEntry<ApiType, [AssetId]>;
|
||||||
|
/**
|
||||||
|
* Metadata of an asset.
|
||||||
|
**/
|
||||||
|
metadata: AugmentedQuery<ApiType, (arg: AssetId | AnyNumber | Uint8Array) => Observable<AssetMetadata>, [AssetId]> & QueryableStorageEntry<ApiType, [AssetId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
authorship: {
|
authorship: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Author of current block.
|
* Author of current block.
|
||||||
**/
|
**/
|
||||||
@@ -57,9 +72,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Uncles
|
* Uncles
|
||||||
**/
|
**/
|
||||||
uncles: AugmentedQuery<ApiType, () => Observable<Vec<UncleEntryItem>>, []> & QueryableStorageEntry<ApiType, []>;
|
uncles: AugmentedQuery<ApiType, () => Observable<Vec<UncleEntryItem>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
babe: {
|
babe: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Current epoch authorities.
|
* Current epoch authorities.
|
||||||
**/
|
**/
|
||||||
@@ -73,16 +91,28 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
/**
|
/**
|
||||||
* Current slot number.
|
* Current slot number.
|
||||||
**/
|
**/
|
||||||
currentSlot: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
|
currentSlot: AugmentedQuery<ApiType, () => Observable<Slot>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The configuration for the current epoch. Should never be `None` as it is initialized in genesis.
|
||||||
|
**/
|
||||||
|
epochConfig: AugmentedQuery<ApiType, () => Observable<Option<BabeEpochConfiguration>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* Current epoch index.
|
* Current epoch index.
|
||||||
**/
|
**/
|
||||||
epochIndex: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
|
epochIndex: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The block numbers when the last and current epoch have started, respectively `N-1` and
|
||||||
|
* `N`.
|
||||||
|
* NOTE: We track this is in order to annotate the block number when a given pool of
|
||||||
|
* entropy was fixed (i.e. it was known to chain observers). Since epochs are defined in
|
||||||
|
* slots, which may be skipped, the block numbers may not line up with the slot numbers.
|
||||||
|
**/
|
||||||
|
epochStart: AugmentedQuery<ApiType, () => Observable<ITuple<[BlockNumber, BlockNumber]>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The slot at which the first epoch actually started. This is 0
|
* The slot at which the first epoch actually started. This is 0
|
||||||
* until the first block of the chain.
|
* until the first block of the chain.
|
||||||
**/
|
**/
|
||||||
genesisSlot: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
|
genesisSlot: AugmentedQuery<ApiType, () => Observable<Slot>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* Temporary value (cleared at block finalization) which is `Some`
|
* Temporary value (cleared at block finalization) which is `Some`
|
||||||
* if per-block initialization has already been called for current block.
|
* if per-block initialization has already been called for current block.
|
||||||
@@ -97,13 +127,22 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
**/
|
**/
|
||||||
lateness: AugmentedQuery<ApiType, () => Observable<BlockNumber>, []> & QueryableStorageEntry<ApiType, []>;
|
lateness: AugmentedQuery<ApiType, () => Observable<BlockNumber>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* Next epoch configuration, if changed.
|
* Next epoch authorities.
|
||||||
**/
|
**/
|
||||||
nextEpochConfig: AugmentedQuery<ApiType, () => Observable<Option<NextConfigDescriptor>>, []> & QueryableStorageEntry<ApiType, []>;
|
nextAuthorities: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AuthorityId, BabeAuthorityWeight]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The configuration for the next epoch, `None` if the config will not change
|
||||||
|
* (you can fallback to `EpochConfig` instead in that case).
|
||||||
|
**/
|
||||||
|
nextEpochConfig: AugmentedQuery<ApiType, () => Observable<Option<BabeEpochConfiguration>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* Next epoch randomness.
|
* Next epoch randomness.
|
||||||
**/
|
**/
|
||||||
nextRandomness: AugmentedQuery<ApiType, () => Observable<Randomness>, []> & QueryableStorageEntry<ApiType, []>;
|
nextRandomness: AugmentedQuery<ApiType, () => Observable<Randomness>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Pending epoch configuration change that will be applied when the next epoch is enacted.
|
||||||
|
**/
|
||||||
|
pendingEpochConfigChange: AugmentedQuery<ApiType, () => Observable<Option<NextConfigDescriptor>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The epoch randomness for the *current* epoch.
|
* The epoch randomness for the *current* epoch.
|
||||||
*
|
*
|
||||||
@@ -133,13 +172,16 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
|
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
|
||||||
**/
|
**/
|
||||||
underConstruction: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Randomness>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
underConstruction: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Randomness>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
balances: {
|
balances: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The balance of an account.
|
* The balance of an account.
|
||||||
*
|
*
|
||||||
* NOTE: This is only used in the case that this module is used to store balances.
|
* NOTE: This is only used in the case that this pallet is used to store balances.
|
||||||
**/
|
**/
|
||||||
account: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<AccountData>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
account: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<AccountData>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
/**
|
/**
|
||||||
@@ -147,6 +189,10 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* NOTE: Should only be accessed when setting, changing and freeing a lock.
|
* NOTE: Should only be accessed when setting, changing and freeing a lock.
|
||||||
**/
|
**/
|
||||||
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<BalanceLock>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<BalanceLock>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Named reserves on some account balances.
|
||||||
|
**/
|
||||||
|
reserves: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<ReserveData>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
/**
|
/**
|
||||||
* Storage version of the pallet.
|
* Storage version of the pallet.
|
||||||
*
|
*
|
||||||
@@ -157,9 +203,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* The total units issued in the system.
|
* The total units issued in the system.
|
||||||
**/
|
**/
|
||||||
totalIssuance: AugmentedQuery<ApiType, () => Observable<Balance>, []> & QueryableStorageEntry<ApiType, []>;
|
totalIssuance: AugmentedQuery<ApiType, () => Observable<Balance>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
bounties: {
|
bounties: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Bounties that have been made.
|
* Bounties that have been made.
|
||||||
**/
|
**/
|
||||||
@@ -176,9 +225,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* The description of each bounty.
|
* The description of each bounty.
|
||||||
**/
|
**/
|
||||||
bountyDescriptions: AugmentedQuery<ApiType, (arg: BountyIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>, [BountyIndex]> & QueryableStorageEntry<ApiType, [BountyIndex]>;
|
bountyDescriptions: AugmentedQuery<ApiType, (arg: BountyIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>, [BountyIndex]> & QueryableStorageEntry<ApiType, [BountyIndex]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
contracts: {
|
contracts: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The subtrie counter.
|
* The subtrie counter.
|
||||||
**/
|
**/
|
||||||
@@ -194,16 +246,22 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
**/
|
**/
|
||||||
contractInfoOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ContractInfo>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
contractInfoOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ContractInfo>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
/**
|
/**
|
||||||
* Current cost schedule for contracts.
|
* Evicted contracts that await child trie deletion.
|
||||||
|
*
|
||||||
|
* Child trie deletion is a heavy operation depending on the amount of storage items
|
||||||
|
* stored in said trie. Therefore this operation is performed lazily in `on_initialize`.
|
||||||
**/
|
**/
|
||||||
currentSchedule: AugmentedQuery<ApiType, () => Observable<Schedule>, []> & QueryableStorageEntry<ApiType, []>;
|
deletionQueue: AugmentedQuery<ApiType, () => Observable<Vec<DeletedContract>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* A mapping from an original code hash to the original code, untouched by instrumentation.
|
* A mapping from an original code hash to the original code, untouched by instrumentation.
|
||||||
**/
|
**/
|
||||||
pristineCode: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<Bytes>>, [CodeHash]> & QueryableStorageEntry<ApiType, [CodeHash]>;
|
pristineCode: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<Bytes>>, [CodeHash]> & QueryableStorageEntry<ApiType, [CodeHash]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
council: {
|
council: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The current members of the collective. This is stored sorted (just by value).
|
* The current members of the collective. This is stored sorted (just by value).
|
||||||
**/
|
**/
|
||||||
@@ -228,9 +286,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Votes on a given proposal, if it is ongoing.
|
* Votes on a given proposal, if it is ongoing.
|
||||||
**/
|
**/
|
||||||
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>, [Hash]> & QueryableStorageEntry<ApiType, [Hash]>;
|
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>, [Hash]> & QueryableStorageEntry<ApiType, [Hash]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
democracy: {
|
democracy: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A record of who vetoed what. Maps proposal hash to a possible existent block number
|
* 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.
|
* (until when it may not be resubmitted) and who vetoed it.
|
||||||
@@ -306,35 +367,124 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* TWOX-NOTE: SAFE as `AccountId`s are crypto hashes anyway.
|
* TWOX-NOTE: SAFE as `AccountId`s are crypto hashes anyway.
|
||||||
**/
|
**/
|
||||||
votingOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Voting>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
votingOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Voting>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
|
};
|
||||||
|
electionProviderMultiPhase: {
|
||||||
|
/**
|
||||||
|
* Current phase.
|
||||||
|
**/
|
||||||
|
currentPhase: AugmentedQuery<ApiType, () => Observable<ElectionPhase>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Desired number of targets to elect for this round.
|
||||||
|
*
|
||||||
|
* Only exists when [`Snapshot`] is present.
|
||||||
|
**/
|
||||||
|
desiredTargets: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The minimum score that each 'untrusted' solution must attain in order to be considered
|
||||||
|
* feasible.
|
||||||
|
*
|
||||||
|
* Can be set via `set_minimum_untrusted_score`.
|
||||||
|
**/
|
||||||
|
minimumUntrustedScore: AugmentedQuery<ApiType, () => Observable<Option<ElectionScore>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Current best solution, signed or unsigned, queued to be returned upon `elect`.
|
||||||
|
**/
|
||||||
|
queuedSolution: AugmentedQuery<ApiType, () => Observable<Option<ReadySolution>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Internal counter for the number of rounds.
|
||||||
|
*
|
||||||
|
* This is useful for de-duplication of transactions submitted to the pool, and general
|
||||||
|
* diagnostics of the pallet.
|
||||||
|
*
|
||||||
|
* This is merely incremented once per every time that an upstream `elect` is called.
|
||||||
|
**/
|
||||||
|
round: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Snapshot data of the round.
|
||||||
|
*
|
||||||
|
* This is created at the beginning of the signed phase and cleared upon calling `elect`.
|
||||||
|
**/
|
||||||
|
snapshot: AugmentedQuery<ApiType, () => Observable<Option<RoundSnapshot>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The metadata of the [`RoundSnapshot`]
|
||||||
|
*
|
||||||
|
* Only exists when [`Snapshot`] is present.
|
||||||
|
**/
|
||||||
|
snapshotMetadata: AugmentedQuery<ApiType, () => Observable<Option<SolutionOrSnapshotSize>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
elections: {
|
elections: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The present candidate list. Sorted based on account-id. A current member or runner-up
|
* The present candidate list. A current member or runner-up can never enter this vector
|
||||||
* can never enter this vector and is always implicitly assumed to be a candidate.
|
* and is always implicitly assumed to be a candidate.
|
||||||
|
*
|
||||||
|
* Second element is the deposit.
|
||||||
|
*
|
||||||
|
* Invariant: Always sorted based on account id.
|
||||||
**/
|
**/
|
||||||
candidates: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>, []> & QueryableStorageEntry<ApiType, []>;
|
candidates: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The total number of vote rounds that have happened, excluding the upcoming one.
|
* The total number of vote rounds that have happened, excluding the upcoming one.
|
||||||
**/
|
**/
|
||||||
electionRounds: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
electionRounds: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The current elected membership. Sorted based on account id.
|
* The current elected members.
|
||||||
|
*
|
||||||
|
* Invariant: Always sorted based on account id.
|
||||||
**/
|
**/
|
||||||
members: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
members: AugmentedQuery<ApiType, () => Observable<Vec<SeatHolder>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The current runners_up. Sorted based on low to high merit (worse to best).
|
* The current reserved runners-up.
|
||||||
|
*
|
||||||
|
* Invariant: Always sorted based on rank (worse to best). Upon removal of a member, the
|
||||||
|
* last (i.e. _best_) runner-up will be replaced.
|
||||||
**/
|
**/
|
||||||
runnersUp: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
runnersUp: AugmentedQuery<ApiType, () => Observable<Vec<SeatHolder>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* Votes and locked stake of a particular voter.
|
* Votes and locked stake of a particular voter.
|
||||||
*
|
*
|
||||||
* TWOX-NOTE: SAFE as `AccountId` is a crypto hash
|
* TWOX-NOTE: SAFE as `AccountId` is a crypto hash.
|
||||||
**/
|
**/
|
||||||
voting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
voting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Voter>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
|
};
|
||||||
|
gilt: {
|
||||||
|
/**
|
||||||
|
* The currently active gilts, indexed according to the order of creation.
|
||||||
|
**/
|
||||||
|
active: AugmentedQuery<ApiType, (arg: ActiveIndex | AnyNumber | Uint8Array) => Observable<Option<ActiveGilt>>, [ActiveIndex]> & QueryableStorageEntry<ApiType, [ActiveIndex]>;
|
||||||
|
/**
|
||||||
|
* Information relating to the gilts currently active.
|
||||||
|
**/
|
||||||
|
activeTotal: AugmentedQuery<ApiType, () => Observable<ActiveGiltsTotal>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The queues of bids ready to become gilts. Indexed by duration (in `Period`s).
|
||||||
|
**/
|
||||||
|
queues: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<GiltBid>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* The totals of items and balances within each queue. Saves a lot of storage reads in the
|
||||||
|
* case of sparsely packed queues.
|
||||||
|
*
|
||||||
|
* The vector is indexed by duration in `Period`s, offset by one, so information on the queue
|
||||||
|
* whose duration is one `Period` would be storage `0`.
|
||||||
|
**/
|
||||||
|
queueTotals: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[u32, BalanceOf]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
grandpa: {
|
grandpa: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The number of changes (both in terms of keys and underlying economic responsibilities)
|
* The number of changes (both in terms of keys and underlying economic responsibilities)
|
||||||
* in the "set" of Grandpa validators from genesis.
|
* in the "set" of Grandpa validators from genesis.
|
||||||
@@ -363,9 +513,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* State of the current authority set.
|
* State of the current authority set.
|
||||||
**/
|
**/
|
||||||
state: AugmentedQuery<ApiType, () => Observable<StoredState>, []> & QueryableStorageEntry<ApiType, []>;
|
state: AugmentedQuery<ApiType, () => Observable<StoredState>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
identity: {
|
identity: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Information that is pertinent to identify the entity behind an account.
|
* Information that is pertinent to identify the entity behind an account.
|
||||||
*
|
*
|
||||||
@@ -392,21 +545,29 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* context. If the account is not some other account's sub-identity, then just `None`.
|
* 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]>>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
superOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[AccountId, Data]>>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
imOnline: {
|
imOnline: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* For each session index, we keep a mapping of `T::ValidatorId` to the
|
* For each session index, we keep a mapping of `ValidatorId<T>` to the
|
||||||
* number of blocks authored by the given authority.
|
* number of blocks authored by the given authority.
|
||||||
**/
|
**/
|
||||||
authoredBlocks: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>, [SessionIndex, ValidatorId]> & QueryableStorageEntry<ApiType, [SessionIndex, ValidatorId]>;
|
authoredBlocks: AugmentedQuery<ApiType, (arg1: SessionIndex | AnyNumber | Uint8Array, arg2: ValidatorId | string | Uint8Array) => Observable<u32>, [SessionIndex, ValidatorId]> & QueryableStorageEntry<ApiType, [SessionIndex, ValidatorId]>;
|
||||||
/**
|
/**
|
||||||
* The block number after which it's ok to send heartbeats in current session.
|
* The block number after which it's ok to send heartbeats in the current
|
||||||
|
* session.
|
||||||
*
|
*
|
||||||
* At the beginning of each session we set this to a value that should
|
* At the beginning of each session we set this to a value that should fall
|
||||||
* fall roughly in the middle of the session duration.
|
* roughly in the middle of the session duration. The idea is to first wait for
|
||||||
* The idea is to first wait for the validators to produce a block
|
* the validators to produce a block in the current session, so that the
|
||||||
* in the current session, so that the heartbeat later on will not be necessary.
|
* heartbeat later on will not be necessary.
|
||||||
|
*
|
||||||
|
* This value will only be used as a fallback if we fail to get a proper session
|
||||||
|
* progress estimate from `NextSessionRotation`, as those estimates should be
|
||||||
|
* more accurate then the value we calculate for `HeartbeatAfter`.
|
||||||
**/
|
**/
|
||||||
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>, []> & QueryableStorageEntry<ApiType, []>;
|
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
@@ -417,17 +578,54 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* For each session index, we keep a mapping of `AuthIndex` to
|
* For each session index, we keep a mapping of `AuthIndex` to
|
||||||
* `offchain::OpaqueNetworkState`.
|
* `offchain::OpaqueNetworkState`.
|
||||||
**/
|
**/
|
||||||
receivedHeartbeats: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: AuthIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>, [SessionIndex, AuthIndex]> & QueryableStorageEntry<ApiType, [SessionIndex, AuthIndex]>;
|
receivedHeartbeats: AugmentedQuery<ApiType, (arg1: SessionIndex | AnyNumber | Uint8Array, arg2: AuthIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>, [SessionIndex, AuthIndex]> & QueryableStorageEntry<ApiType, [SessionIndex, AuthIndex]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
indices: {
|
indices: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The lookup from index to account.
|
* The lookup from index to account.
|
||||||
**/
|
**/
|
||||||
accounts: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[AccountId, BalanceOf, bool]>>>, [AccountIndex]> & QueryableStorageEntry<ApiType, [AccountIndex]>;
|
accounts: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[AccountId, BalanceOf, bool]>>>, [AccountIndex]> & QueryableStorageEntry<ApiType, [AccountIndex]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
|
};
|
||||||
|
lottery: {
|
||||||
|
/**
|
||||||
|
* The calls stored in this pallet to be used in an active lottery if configured
|
||||||
|
* by `Config::ValidateCall`.
|
||||||
|
**/
|
||||||
|
callIndices: AugmentedQuery<ApiType, () => Observable<Vec<CallIndex>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The configuration for the current lottery.
|
||||||
|
**/
|
||||||
|
lottery: AugmentedQuery<ApiType, () => Observable<Option<LotteryConfig>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
lotteryIndex: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Users who have purchased a ticket. (Lottery Index, Tickets Purchased)
|
||||||
|
**/
|
||||||
|
participants: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[u32, Vec<CallIndex>]>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Each ticket's owner.
|
||||||
|
*
|
||||||
|
* May have residual storage from previous lotteries. Use `TicketsCount` to see which ones
|
||||||
|
* are actually valid ticket mappings.
|
||||||
|
**/
|
||||||
|
tickets: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<AccountId>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Total number of tickets sold.
|
||||||
|
**/
|
||||||
|
ticketsCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
mmr: {
|
mmr: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Hashes of the nodes in the MMR.
|
* Hashes of the nodes in the MMR.
|
||||||
*
|
*
|
||||||
@@ -443,26 +641,27 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Latest MMR Root hash.
|
* Latest MMR Root hash.
|
||||||
**/
|
**/
|
||||||
rootHash: AugmentedQuery<ApiType, () => Observable<Hash>, []> & QueryableStorageEntry<ApiType, []>;
|
rootHash: AugmentedQuery<ApiType, () => Observable<Hash>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
multisig: {
|
multisig: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
calls: AugmentedQuery<ApiType, (arg: U8aFixed | string | Uint8Array) => Observable<Option<ITuple<[OpaqueCall, AccountId, BalanceOf]>>>, [U8aFixed]> & QueryableStorageEntry<ApiType, [U8aFixed]>;
|
calls: AugmentedQuery<ApiType, (arg: U8aFixed | string | Uint8Array) => Observable<Option<ITuple<[OpaqueCall, AccountId, BalanceOf]>>>, [U8aFixed]> & QueryableStorageEntry<ApiType, [U8aFixed]>;
|
||||||
/**
|
/**
|
||||||
* The set of open multisig operations.
|
* The set of open multisig operations.
|
||||||
**/
|
**/
|
||||||
multisigs: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: U8aFixed | string | Uint8Array) => Observable<Option<Multisig>>, [AccountId, U8aFixed]> & QueryableStorageEntry<ApiType, [AccountId, U8aFixed]>;
|
multisigs: AugmentedQuery<ApiType, (arg1: AccountId | string | Uint8Array, arg2: U8aFixed | string | Uint8Array) => Observable<Option<Multisig>>, [AccountId, U8aFixed]> & QueryableStorageEntry<ApiType, [AccountId, U8aFixed]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
offences: {
|
offences: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* A vector of reports of the same kind that happened at the same time slot.
|
* 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>>, [Kind, OpaqueTimeSlot]> & QueryableStorageEntry<ApiType, [Kind, OpaqueTimeSlot]>;
|
concurrentReportsIndex: AugmentedQuery<ApiType, (arg1: Kind | string | Uint8Array, arg2: OpaqueTimeSlot | string | Uint8Array) => Observable<Vec<ReportIdOf>>, [Kind, OpaqueTimeSlot]> & QueryableStorageEntry<ApiType, [Kind, OpaqueTimeSlot]>;
|
||||||
/**
|
|
||||||
* Deferred reports that have been rejected by the offence handler and need to be submitted
|
|
||||||
* at a later time.
|
|
||||||
**/
|
|
||||||
deferredOffences: AugmentedQuery<ApiType, () => Observable<Vec<DeferredOffenceOf>>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
/**
|
||||||
* The primary structure that holds all offence records keyed by report identifiers.
|
* The primary structure that holds all offence records keyed by report identifiers.
|
||||||
**/
|
**/
|
||||||
@@ -476,9 +675,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* different types are not supported at the moment so we are doing the manual serialization.
|
* different types are not supported at the moment so we are doing the manual serialization.
|
||||||
**/
|
**/
|
||||||
reportsByKindIndex: AugmentedQuery<ApiType, (arg: Kind | string | Uint8Array) => Observable<Bytes>, [Kind]> & QueryableStorageEntry<ApiType, [Kind]>;
|
reportsByKindIndex: AugmentedQuery<ApiType, (arg: Kind | string | Uint8Array) => Observable<Bytes>, [Kind]> & QueryableStorageEntry<ApiType, [Kind]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
proxy: {
|
proxy: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The announcements made by the proxy (key).
|
* The announcements made by the proxy (key).
|
||||||
**/
|
**/
|
||||||
@@ -488,25 +690,31 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* which are being delegated to, together with the amount held on deposit.
|
* which are being delegated to, together with the amount held on deposit.
|
||||||
**/
|
**/
|
||||||
proxies: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[Vec<ProxyDefinition>, BalanceOf]>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
proxies: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[Vec<ProxyDefinition>, BalanceOf]>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
randomnessCollectiveFlip: {
|
randomnessCollectiveFlip: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Series of block headers from the last 81 blocks that acts as random seed material. This
|
* 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
|
* is arranged as a ring buffer with `block_number % 81` being the index into the `Vec` of
|
||||||
* the oldest hash.
|
* the oldest hash.
|
||||||
**/
|
**/
|
||||||
randomMaterial: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>, []> & QueryableStorageEntry<ApiType, []>;
|
randomMaterial: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
recovery: {
|
recovery: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Active recovery attempts.
|
* Active recovery attempts.
|
||||||
*
|
*
|
||||||
* First account is the account to be recovered, and the second account
|
* First account is the account to be recovered, and the second account
|
||||||
* is the user trying to recover the account.
|
* is the user trying to recover the account.
|
||||||
**/
|
**/
|
||||||
activeRecoveries: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ActiveRecovery>>, [AccountId, AccountId]> & QueryableStorageEntry<ApiType, [AccountId, AccountId]>;
|
activeRecoveries: AugmentedQuery<ApiType, (arg1: AccountId | string | Uint8Array, arg2: AccountId | string | Uint8Array) => Observable<Option<ActiveRecovery>>, [AccountId, AccountId]> & QueryableStorageEntry<ApiType, [AccountId, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* The list of allowed proxy accounts.
|
* The list of allowed proxy accounts.
|
||||||
*
|
*
|
||||||
@@ -517,9 +725,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* The set of recoverable accounts and their recovery configuration.
|
* The set of recoverable accounts and their recovery configuration.
|
||||||
**/
|
**/
|
||||||
recoverable: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<RecoveryConfig>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
recoverable: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<RecoveryConfig>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
scheduler: {
|
scheduler: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Items to be executed, indexed by the block number that they should be executed on.
|
* Items to be executed, indexed by the block number that they should be executed on.
|
||||||
**/
|
**/
|
||||||
@@ -534,9 +745,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* New networks start with last version.
|
* New networks start with last version.
|
||||||
**/
|
**/
|
||||||
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
|
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
session: {
|
session: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Current index of the session.
|
* Current index of the session.
|
||||||
**/
|
**/
|
||||||
@@ -569,9 +783,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* The current set of validators.
|
* The current set of validators.
|
||||||
**/
|
**/
|
||||||
validators: AugmentedQuery<ApiType, () => Observable<Vec<ValidatorId>>, []> & QueryableStorageEntry<ApiType, []>;
|
validators: AugmentedQuery<ApiType, () => Observable<Vec<ValidatorId>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
society: {
|
society: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The current bids, stored ordered by the value of the bid.
|
* The current bids, stored ordered by the value of the bid.
|
||||||
**/
|
**/
|
||||||
@@ -632,14 +849,17 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
/**
|
/**
|
||||||
* Double map from Candidate -> Voter -> (Maybe) Vote.
|
* Double map from Candidate -> Voter -> (Maybe) Vote.
|
||||||
**/
|
**/
|
||||||
votes: AugmentedQueryDoubleMap<ApiType, (key1: AccountId | string | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<SocietyVote>>, [AccountId, AccountId]> & QueryableStorageEntry<ApiType, [AccountId, AccountId]>;
|
votes: AugmentedQuery<ApiType, (arg1: AccountId | string | Uint8Array, arg2: AccountId | string | Uint8Array) => Observable<Option<SocietyVote>>, [AccountId, AccountId]> & QueryableStorageEntry<ApiType, [AccountId, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* Members currently vouching or banned from vouching again
|
* Members currently vouching or banned from vouching again
|
||||||
**/
|
**/
|
||||||
vouching: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VouchingStatus>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
vouching: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VouchingStatus>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
staking: {
|
staking: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The active era information, it holds index and start.
|
* The active era information, it holds index and start.
|
||||||
*
|
*
|
||||||
@@ -663,6 +883,14 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* canceled by extraordinary circumstances (e.g. governance).
|
* canceled by extraordinary circumstances (e.g. governance).
|
||||||
**/
|
**/
|
||||||
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* A tracker to keep count of the number of items in the `Nominators` map.
|
||||||
|
**/
|
||||||
|
counterForNominators: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* A tracker to keep count of the number of items in the `Validators` map.
|
||||||
|
**/
|
||||||
|
counterForValidators: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The current era index.
|
* The current era index.
|
||||||
*
|
*
|
||||||
@@ -670,15 +898,16 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* set, it might be active or not.
|
* set, it might be active or not.
|
||||||
**/
|
**/
|
||||||
currentEra: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>, []> & QueryableStorageEntry<ApiType, []>;
|
currentEra: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The last planned session scheduled by the session pallet.
|
||||||
|
*
|
||||||
|
* This is basically in sync with the call to [`SessionManager::new_session`].
|
||||||
|
**/
|
||||||
|
currentPlannedSession: AugmentedQuery<ApiType, () => Observable<SessionIndex>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The earliest era for which we have a pending, unapplied slash.
|
* The earliest era for which we have a pending, unapplied slash.
|
||||||
**/
|
**/
|
||||||
earliestUnappliedSlash: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>, []> & QueryableStorageEntry<ApiType, []>;
|
earliestUnappliedSlash: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
|
||||||
* Flag to control the execution of the offchain election. When `Open(_)`, we accept
|
|
||||||
* solutions to be submitted.
|
|
||||||
**/
|
|
||||||
eraElectionStatus: AugmentedQuery<ApiType, () => Observable<ElectionStatus>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
/**
|
||||||
* Rewards for the last `HISTORY_DEPTH` eras.
|
* Rewards for the last `HISTORY_DEPTH` eras.
|
||||||
* If reward hasn't been set or has been removed then 0 reward is returned.
|
* If reward hasn't been set or has been removed then 0 reward is returned.
|
||||||
@@ -692,7 +921,7 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Is it removed after `HISTORY_DEPTH` eras.
|
* Is it removed after `HISTORY_DEPTH` eras.
|
||||||
* If stakers hasn't been set or has been removed then empty exposure is returned.
|
* If stakers hasn't been set or has been removed then empty exposure is returned.
|
||||||
**/
|
**/
|
||||||
erasStakers: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Exposure>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
erasStakers: AugmentedQuery<ApiType, (arg1: EraIndex | AnyNumber | Uint8Array, arg2: AccountId | string | Uint8Array) => Observable<Exposure>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* Clipped Exposure of validator at era.
|
* Clipped Exposure of validator at era.
|
||||||
*
|
*
|
||||||
@@ -706,7 +935,7 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Is it removed after `HISTORY_DEPTH` eras.
|
* Is it removed after `HISTORY_DEPTH` eras.
|
||||||
* If stakers hasn't been set or has been removed then empty exposure is returned.
|
* If stakers hasn't been set or has been removed then empty exposure is returned.
|
||||||
**/
|
**/
|
||||||
erasStakersClipped: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Exposure>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
erasStakersClipped: AugmentedQuery<ApiType, (arg1: EraIndex | AnyNumber | Uint8Array, arg2: AccountId | string | Uint8Array) => Observable<Exposure>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* The session index at which the era start for the last `HISTORY_DEPTH` eras.
|
* The session index at which the era start for the last `HISTORY_DEPTH` eras.
|
||||||
*
|
*
|
||||||
@@ -726,7 +955,7 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
*
|
*
|
||||||
* Is it removed after `HISTORY_DEPTH` eras.
|
* Is it removed after `HISTORY_DEPTH` eras.
|
||||||
**/
|
**/
|
||||||
erasValidatorPrefs: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
erasValidatorPrefs: AugmentedQuery<ApiType, (arg1: EraIndex | AnyNumber | Uint8Array, arg2: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* The total validator era payout for the last `HISTORY_DEPTH` eras.
|
* The total validator era payout for the last `HISTORY_DEPTH` eras.
|
||||||
*
|
*
|
||||||
@@ -753,41 +982,48 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* invulnerables) and restricted to testnets.
|
* invulnerables) and restricted to testnets.
|
||||||
**/
|
**/
|
||||||
invulnerables: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>, []> & QueryableStorageEntry<ApiType, []>;
|
invulnerables: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
|
||||||
* True if the current **planned** session is final. Note that this does not take era
|
|
||||||
* forcing into account.
|
|
||||||
**/
|
|
||||||
isCurrentSessionFinal: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
/**
|
||||||
* Map from all (unlocked) "controller" accounts to the info regarding the staking.
|
* Map from all (unlocked) "controller" accounts to the info regarding the staking.
|
||||||
**/
|
**/
|
||||||
ledger: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<StakingLedger>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
ledger: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<StakingLedger>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* The maximum nominator count before we stop allowing new validators to join.
|
||||||
|
*
|
||||||
|
* When this value is not set, no limits are enforced.
|
||||||
|
**/
|
||||||
|
maxNominatorsCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The maximum validator count before we stop allowing new validators to join.
|
||||||
|
*
|
||||||
|
* When this value is not set, no limits are enforced.
|
||||||
|
**/
|
||||||
|
maxValidatorsCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* Minimum number of staking participants before emergency conditions are imposed.
|
* Minimum number of staking participants before emergency conditions are imposed.
|
||||||
**/
|
**/
|
||||||
minimumValidatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
minimumValidatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The minimum active bond to become and maintain the role of a nominator.
|
||||||
|
**/
|
||||||
|
minNominatorBond: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* The minimum active bond to become and maintain the role of a validator.
|
||||||
|
**/
|
||||||
|
minValidatorBond: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The map from nominator stash key to the set of stash keys of all validators to nominate.
|
* The map from nominator stash key to the set of stash keys of all validators to nominate.
|
||||||
|
*
|
||||||
|
* When updating this storage item, you must also update the `CounterForNominators`.
|
||||||
**/
|
**/
|
||||||
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Nominations>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Nominations>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
/**
|
/**
|
||||||
* All slashing events on nominators, mapped by era to the highest slash value of the era.
|
* 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>>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
nominatorSlashInEra: AugmentedQuery<ApiType, (arg1: EraIndex | AnyNumber | Uint8Array, arg2: AccountId | string | Uint8Array) => Observable<Option<BalanceOf>>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
||||||
/**
|
/**
|
||||||
* Where the reward payment should be made. Keyed by stash.
|
* Where the reward payment should be made. Keyed by stash.
|
||||||
**/
|
**/
|
||||||
payee: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<RewardDestination>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
payee: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<RewardDestination>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
/**
|
|
||||||
* The next validator set. At the end of an era, if this is available (potentially from the
|
|
||||||
* result of an offchain worker), it is immediately used. Otherwise, the on-chain election
|
|
||||||
* is executed.
|
|
||||||
**/
|
|
||||||
queuedElected: AugmentedQuery<ApiType, () => Observable<Option<ElectionResult>>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
|
||||||
* The score of the current [`QueuedElected`].
|
|
||||||
**/
|
|
||||||
queuedScore: AugmentedQuery<ApiType, () => Observable<Option<ElectionScore>>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
/**
|
||||||
* Slashing spans for stash accounts.
|
* Slashing spans for stash accounts.
|
||||||
**/
|
**/
|
||||||
@@ -798,16 +1034,6 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* The rest of the slashed value is handled by the `Slash`.
|
* The rest of the slashed value is handled by the `Slash`.
|
||||||
**/
|
**/
|
||||||
slashRewardFraction: AugmentedQuery<ApiType, () => Observable<Perbill>, []> & QueryableStorageEntry<ApiType, []>;
|
slashRewardFraction: AugmentedQuery<ApiType, () => Observable<Perbill>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
|
||||||
* Snapshot of nominators at the beginning of the current election window. This should only
|
|
||||||
* have a value when [`EraElectionStatus`] == `ElectionStatus::Open(_)`.
|
|
||||||
**/
|
|
||||||
snapshotNominators: AugmentedQuery<ApiType, () => Observable<Option<Vec<AccountId>>>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
|
||||||
* Snapshot of validators at the beginning of the current election window. This should only
|
|
||||||
* have a value when [`EraElectionStatus`] == `ElectionStatus::Open(_)`.
|
|
||||||
**/
|
|
||||||
snapshotValidators: AugmentedQuery<ApiType, () => Observable<Option<Vec<AccountId>>>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
/**
|
||||||
* Records information about the maximum slash of a stash within a slashing span,
|
* Records information about the maximum slash of a stash within a slashing span,
|
||||||
* as well as how much reward has been paid out.
|
* as well as how much reward has been paid out.
|
||||||
@@ -817,7 +1043,7 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* True if network has been upgraded to this version.
|
* True if network has been upgraded to this version.
|
||||||
* Storage version of the pallet.
|
* Storage version of the pallet.
|
||||||
*
|
*
|
||||||
* This is set to v3.0.0 for new networks.
|
* This is set to v6.0.0 for new networks.
|
||||||
**/
|
**/
|
||||||
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
|
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
@@ -830,23 +1056,31 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
validatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
validatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* The map from (wannabe) validator stash key to the preferences of that validator.
|
* The map from (wannabe) validator stash key to the preferences of that validator.
|
||||||
|
*
|
||||||
|
* When updating this storage item, you must also update the `CounterForValidators`.
|
||||||
**/
|
**/
|
||||||
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
/**
|
/**
|
||||||
* All slashing events on validators, mapped by era to the highest slash proportion
|
* All slashing events on validators, mapped by era to the highest slash proportion
|
||||||
* and slash value of the era.
|
* and slash value of the era.
|
||||||
**/
|
**/
|
||||||
validatorSlashInEra: AugmentedQueryDoubleMap<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
validatorSlashInEra: AugmentedQuery<ApiType, (arg1: EraIndex | AnyNumber | Uint8Array, arg2: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>, [EraIndex, AccountId]> & QueryableStorageEntry<ApiType, [EraIndex, AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
sudo: {
|
sudo: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The `AccountId` of the sudo key.
|
* The `AccountId` of the sudo key.
|
||||||
**/
|
**/
|
||||||
key: AugmentedQuery<ApiType, () => Observable<AccountId>, []> & QueryableStorageEntry<ApiType, []>;
|
key: AugmentedQuery<ApiType, () => Observable<AccountId>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
system: {
|
system: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The full account information for a particular account ID.
|
* The full account information for a particular account ID.
|
||||||
**/
|
**/
|
||||||
@@ -912,13 +1146,21 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Hash of the previous block.
|
* Hash of the previous block.
|
||||||
**/
|
**/
|
||||||
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>, []> & QueryableStorageEntry<ApiType, []>;
|
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* True if we have upgraded so that AccountInfo contains three types of `RefCount`. False
|
||||||
|
* (default) if not.
|
||||||
|
**/
|
||||||
|
upgradedToTripleRefCount: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* True if we have upgraded so that `type RefCount` is `u32`. False (default) if not.
|
* True if we have upgraded so that `type RefCount` is `u32`. False (default) if not.
|
||||||
**/
|
**/
|
||||||
upgradedToU32RefCount: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
upgradedToU32RefCount: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
technicalCommittee: {
|
technicalCommittee: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The current members of the collective. This is stored sorted (just by value).
|
* The current members of the collective. This is stored sorted (just by value).
|
||||||
**/
|
**/
|
||||||
@@ -943,9 +1185,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Votes on a given proposal, if it is ongoing.
|
* Votes on a given proposal, if it is ongoing.
|
||||||
**/
|
**/
|
||||||
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>, [Hash]> & QueryableStorageEntry<ApiType, [Hash]>;
|
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>, [Hash]> & QueryableStorageEntry<ApiType, [Hash]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
technicalMembership: {
|
technicalMembership: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* The current membership, stored as an ordered Vec.
|
* The current membership, stored as an ordered Vec.
|
||||||
**/
|
**/
|
||||||
@@ -954,9 +1199,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* The current prime member, if one exists.
|
* The current prime member, if one exists.
|
||||||
**/
|
**/
|
||||||
prime: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>, []> & QueryableStorageEntry<ApiType, []>;
|
prime: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
timestamp: {
|
timestamp: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Did the timestamp get updated in this block?
|
* Did the timestamp get updated in this block?
|
||||||
**/
|
**/
|
||||||
@@ -965,9 +1213,12 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Current time for the current block.
|
* Current time for the current block.
|
||||||
**/
|
**/
|
||||||
now: AugmentedQuery<ApiType, () => Observable<Moment>, []> & QueryableStorageEntry<ApiType, []>;
|
now: AugmentedQuery<ApiType, () => Observable<Moment>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
tips: {
|
tips: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Simple preimage lookup from the reason's hash to the original data. Again, has an
|
* 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.
|
* insecure enumerable hash since the key is guaranteed to be the result of a secure hash.
|
||||||
@@ -979,14 +1230,60 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* guaranteed to be a secure hash.
|
* guaranteed to be a secure hash.
|
||||||
**/
|
**/
|
||||||
tips: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<OpenTip>>, [Hash]> & QueryableStorageEntry<ApiType, [Hash]>;
|
tips: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<OpenTip>>, [Hash]> & QueryableStorageEntry<ApiType, [Hash]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
transactionPayment: {
|
transactionPayment: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
nextFeeMultiplier: AugmentedQuery<ApiType, () => Observable<Multiplier>, []> & QueryableStorageEntry<ApiType, []>;
|
nextFeeMultiplier: AugmentedQuery<ApiType, () => Observable<Multiplier>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
|
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
|
};
|
||||||
|
transactionStorage: {
|
||||||
|
blockTransactions: AugmentedQuery<ApiType, () => Observable<Vec<TransactionInfo>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Storage fee per byte.
|
||||||
|
**/
|
||||||
|
byteFee: AugmentedQuery<ApiType, () => Observable<Option<BalanceOf>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Count indexed chunks for each block.
|
||||||
|
**/
|
||||||
|
chunkCount: AugmentedQuery<ApiType, (arg: BlockNumber | AnyNumber | Uint8Array) => Observable<u32>, [BlockNumber]> & QueryableStorageEntry<ApiType, [BlockNumber]>;
|
||||||
|
/**
|
||||||
|
* Storage fee per transaction.
|
||||||
|
**/
|
||||||
|
entryFee: AugmentedQuery<ApiType, () => Observable<Option<BalanceOf>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Maximum number of indexed transactions in the block.
|
||||||
|
**/
|
||||||
|
maxBlockTransactions: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Maximum data set in a single transaction in bytes.
|
||||||
|
**/
|
||||||
|
maxTransactionSize: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Was the proof checked in this block?
|
||||||
|
**/
|
||||||
|
proofChecked: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Storage period for data in blocks. Should match `sp_storage_proof::DEFAULT_STORAGE_PERIOD`
|
||||||
|
* for block authoring.
|
||||||
|
**/
|
||||||
|
storagePeriod: AugmentedQuery<ApiType, () => Observable<BlockNumber>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Collection of transaction metadata by block number.
|
||||||
|
**/
|
||||||
|
transactions: AugmentedQuery<ApiType, (arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Option<Vec<TransactionInfo>>>, [BlockNumber]> & QueryableStorageEntry<ApiType, [BlockNumber]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
treasury: {
|
treasury: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Proposal indices that have been approved but not yet awarded.
|
* Proposal indices that have been approved but not yet awarded.
|
||||||
**/
|
**/
|
||||||
@@ -999,13 +1296,51 @@ declare module '@polkadot/api/types/storage' {
|
|||||||
* Proposals that have been made.
|
* Proposals that have been made.
|
||||||
**/
|
**/
|
||||||
proposals: AugmentedQuery<ApiType, (arg: ProposalIndex | AnyNumber | Uint8Array) => Observable<Option<TreasuryProposal>>, [ProposalIndex]> & QueryableStorageEntry<ApiType, [ProposalIndex]>;
|
proposals: AugmentedQuery<ApiType, (arg: ProposalIndex | AnyNumber | Uint8Array) => Observable<Option<TreasuryProposal>>, [ProposalIndex]> & QueryableStorageEntry<ApiType, [ProposalIndex]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
|
};
|
||||||
|
uniques: {
|
||||||
|
/**
|
||||||
|
* The assets held by any given account; set out this way so that assets owned by a single
|
||||||
|
* account can be enumerated.
|
||||||
|
**/
|
||||||
|
account: AugmentedQuery<ApiType, (arg1: AccountId | string | Uint8Array, arg2: ClassId | AnyNumber | Uint8Array, arg3: InstanceId | AnyNumber | Uint8Array) => Observable<Option<ITuple<[]>>>, [AccountId, ClassId, InstanceId]> & QueryableStorageEntry<ApiType, [AccountId, ClassId, InstanceId]>;
|
||||||
|
/**
|
||||||
|
* The assets in existence and their ownership details.
|
||||||
|
**/
|
||||||
|
asset: AugmentedQuery<ApiType, (arg1: ClassId | AnyNumber | Uint8Array, arg2: InstanceId | AnyNumber | Uint8Array) => Observable<Option<InstanceDetails>>, [ClassId, InstanceId]> & QueryableStorageEntry<ApiType, [ClassId, InstanceId]>;
|
||||||
|
/**
|
||||||
|
* Metadata of an asset class.
|
||||||
|
**/
|
||||||
|
attribute: AugmentedQuery<ApiType, (arg1: ClassId | AnyNumber | Uint8Array, arg2: Option<InstanceId> | null | object | string | Uint8Array, arg3: Bytes | string | Uint8Array) => Observable<Option<ITuple<[Bytes, DepositBalanceOf]>>>, [ClassId, Option<InstanceId>, Bytes]> & QueryableStorageEntry<ApiType, [ClassId, Option<InstanceId>, Bytes]>;
|
||||||
|
/**
|
||||||
|
* Details of an asset class.
|
||||||
|
**/
|
||||||
|
class: AugmentedQuery<ApiType, (arg: ClassId | AnyNumber | Uint8Array) => Observable<Option<ClassDetails>>, [ClassId]> & QueryableStorageEntry<ApiType, [ClassId]>;
|
||||||
|
/**
|
||||||
|
* Metadata of an asset class.
|
||||||
|
**/
|
||||||
|
classMetadataOf: AugmentedQuery<ApiType, (arg: ClassId | AnyNumber | Uint8Array) => Observable<Option<ClassMetadata>>, [ClassId]> & QueryableStorageEntry<ApiType, [ClassId]>;
|
||||||
|
/**
|
||||||
|
* Metadata of an asset instance.
|
||||||
|
**/
|
||||||
|
instanceMetadataOf: AugmentedQuery<ApiType, (arg1: ClassId | AnyNumber | Uint8Array, arg2: InstanceId | AnyNumber | Uint8Array) => Observable<Option<InstanceMetadata>>, [ClassId, InstanceId]> & QueryableStorageEntry<ApiType, [ClassId, InstanceId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
vesting: {
|
vesting: {
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Information regarding the vesting of a given account.
|
* Information regarding the vesting of a given account.
|
||||||
**/
|
**/
|
||||||
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingInfo>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingInfo>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,19 +6,21 @@ import type { Bytes, HashMap, Json, Null, Option, StorageKey, Text, U256, U64, V
|
|||||||
import type { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';
|
import type { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';
|
||||||
import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
|
import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
|
||||||
import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';
|
import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';
|
||||||
|
import type { BeefySignedCommitment } from '@polkadot/types/interfaces/beefy';
|
||||||
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
||||||
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
||||||
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||||
import type { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
|
import type { ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';
|
||||||
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
|
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
|
||||||
import type { EthAccount, EthCallRequest, EthFilter, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
|
import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
|
||||||
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
|
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
|
||||||
import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
|
import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
|
||||||
|
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
|
||||||
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
|
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
|
||||||
import type { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
|
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
|
||||||
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
|
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
|
||||||
import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { ReadProof, RuntimeVersion } from '@polkadot/types/interfaces/state';
|
import type { ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state';
|
||||||
import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system';
|
import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system';
|
||||||
|
|
||||||
declare module '@polkadot/rpc-core/types.jsonrpc' {
|
declare module '@polkadot/rpc-core/types.jsonrpc' {
|
||||||
@@ -63,6 +65,12 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
**/
|
**/
|
||||||
epochAuthorship: AugmentedRpc<() => Observable<HashMap<AuthorityId, EpochAuthorship>>>;
|
epochAuthorship: AugmentedRpc<() => Observable<HashMap<AuthorityId, EpochAuthorship>>>;
|
||||||
};
|
};
|
||||||
|
beefy: {
|
||||||
|
/**
|
||||||
|
* Returns the block most recently finalized by BEEFY, alongside side its justification.
|
||||||
|
**/
|
||||||
|
subscribeJustifications: AugmentedRpc<() => Observable<BeefySignedCommitment>>;
|
||||||
|
};
|
||||||
chain: {
|
chain: {
|
||||||
/**
|
/**
|
||||||
* Get header and body of a relay chain block
|
* Get header and body of a relay chain block
|
||||||
@@ -98,6 +106,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
* Returns the keys with prefix from a child storage, leave empty to get all the keys
|
* Returns the keys with prefix from a child storage, leave empty to get all the keys
|
||||||
**/
|
**/
|
||||||
getKeys: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;
|
getKeys: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;
|
||||||
|
/**
|
||||||
|
* Returns the keys with prefix from a child storage with pagination support
|
||||||
|
**/
|
||||||
|
getKeysPaged: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, count: u32 | AnyNumber | Uint8Array, startKey?: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;
|
||||||
/**
|
/**
|
||||||
* Returns a child storage entry at a specific block state
|
* Returns a child storage entry at a specific block state
|
||||||
**/
|
**/
|
||||||
@@ -120,6 +132,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
* Returns the value under a specified storage key in a contract
|
* Returns the value under a specified storage key in a contract
|
||||||
**/
|
**/
|
||||||
getStorage: AugmentedRpc<(address: AccountId | string | Uint8Array, key: H256 | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Option<Bytes>>>;
|
getStorage: AugmentedRpc<(address: AccountId | string | Uint8Array, key: H256 | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Option<Bytes>>>;
|
||||||
|
/**
|
||||||
|
* Instantiate a new contract
|
||||||
|
**/
|
||||||
|
instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; endowment?: any; gasLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;
|
||||||
/**
|
/**
|
||||||
* Returns the projected time a given contract will be able to sustain paying its rent
|
* Returns the projected time a given contract will be able to sustain paying its rent
|
||||||
**/
|
**/
|
||||||
@@ -133,7 +149,7 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
/**
|
/**
|
||||||
* Instructs the manual-seal authorship task to finalize a block
|
* Instructs the manual-seal authorship task to finalize a block
|
||||||
**/
|
**/
|
||||||
finalizeBlock: AugmentedRpc<(hash: BlockHash | string | Uint8Array, justification?: Justification | string | Uint8Array) => Observable<bool>>;
|
finalizeBlock: AugmentedRpc<(hash: BlockHash | string | Uint8Array, justification?: Justification) => Observable<bool>>;
|
||||||
};
|
};
|
||||||
eth: {
|
eth: {
|
||||||
/**
|
/**
|
||||||
@@ -141,7 +157,7 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
**/
|
**/
|
||||||
accounts: AugmentedRpc<() => Observable<Vec<H160>>>;
|
accounts: AugmentedRpc<() => Observable<Vec<H160>>>;
|
||||||
/**
|
/**
|
||||||
* Returns balance of the given account.
|
* Returns the blockNumber
|
||||||
**/
|
**/
|
||||||
blockNumber: AugmentedRpc<() => Observable<U256>>;
|
blockNumber: AugmentedRpc<() => Observable<U256>>;
|
||||||
/**
|
/**
|
||||||
@@ -188,6 +204,14 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
* Returns the code at given address at given time (block number).
|
* Returns the code at given address at given time (block number).
|
||||||
**/
|
**/
|
||||||
getCode: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<Bytes>>;
|
getCode: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<Bytes>>;
|
||||||
|
/**
|
||||||
|
* Returns filter changes since last poll.
|
||||||
|
**/
|
||||||
|
getFilterChanges: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<EthFilterChanges>>;
|
||||||
|
/**
|
||||||
|
* Returns all logs matching given filter (in a range 'from' - 'to').
|
||||||
|
**/
|
||||||
|
getFilterLogs: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<Vec<EthLog>>>;
|
||||||
/**
|
/**
|
||||||
* Returns logs matching given filter object.
|
* Returns logs matching given filter object.
|
||||||
**/
|
**/
|
||||||
@@ -248,6 +272,18 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
* Returns true if client is actively mining new blocks.
|
* Returns true if client is actively mining new blocks.
|
||||||
**/
|
**/
|
||||||
mining: AugmentedRpc<() => Observable<bool>>;
|
mining: AugmentedRpc<() => Observable<bool>>;
|
||||||
|
/**
|
||||||
|
* Returns id of new block filter.
|
||||||
|
**/
|
||||||
|
newBlockFilter: AugmentedRpc<() => Observable<U256>>;
|
||||||
|
/**
|
||||||
|
* Returns id of new filter.
|
||||||
|
**/
|
||||||
|
newFilter: AugmentedRpc<(filter: EthFilter | { fromBlock?: any; toBlock?: any; blockHash?: any; address?: any; topics?: any } | string | Uint8Array) => Observable<U256>>;
|
||||||
|
/**
|
||||||
|
* Returns id of new block filter.
|
||||||
|
**/
|
||||||
|
newPendingTransactionFilter: AugmentedRpc<() => Observable<U256>>;
|
||||||
/**
|
/**
|
||||||
* Returns protocol version encoded as a string (quotes are necessary).
|
* Returns protocol version encoded as a string (quotes are necessary).
|
||||||
**/
|
**/
|
||||||
@@ -276,6 +312,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
* Returns an object with data about the sync status or false.
|
* Returns an object with data about the sync status or false.
|
||||||
**/
|
**/
|
||||||
syncing: AugmentedRpc<() => Observable<EthSyncStatus>>;
|
syncing: AugmentedRpc<() => Observable<EthSyncStatus>>;
|
||||||
|
/**
|
||||||
|
* Uninstalls filter.
|
||||||
|
**/
|
||||||
|
uninstallFilter: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<bool>>;
|
||||||
};
|
};
|
||||||
grandpa: {
|
grandpa: {
|
||||||
/**
|
/**
|
||||||
@@ -291,6 +331,12 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
**/
|
**/
|
||||||
subscribeJustifications: AugmentedRpc<() => Observable<JustificationNotification>>;
|
subscribeJustifications: AugmentedRpc<() => Observable<JustificationNotification>>;
|
||||||
};
|
};
|
||||||
|
mmr: {
|
||||||
|
/**
|
||||||
|
* Generate MMR proof for given leaf index.
|
||||||
|
**/
|
||||||
|
generateProof: AugmentedRpc<(leafIndex: u64 | AnyNumber | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<MmrLeafProof>>;
|
||||||
|
};
|
||||||
net: {
|
net: {
|
||||||
/**
|
/**
|
||||||
* Returns true if client is actively listening for network connections. Otherwise false.
|
* Returns true if client is actively listening for network connections. Otherwise false.
|
||||||
@@ -309,13 +355,17 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
/**
|
/**
|
||||||
* Get offchain local storage under given key and prefix
|
* Get offchain local storage under given key and prefix
|
||||||
**/
|
**/
|
||||||
localStorageGet: AugmentedRpc<(kind: StorageKind | '__UNUSED' | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Option<Bytes>>>;
|
localStorageGet: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Option<Bytes>>>;
|
||||||
/**
|
/**
|
||||||
* Set offchain local storage under given key and prefix
|
* Set offchain local storage under given key and prefix
|
||||||
**/
|
**/
|
||||||
localStorageSet: AugmentedRpc<(kind: StorageKind | '__UNUSED' | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>;
|
localStorageSet: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>;
|
||||||
};
|
};
|
||||||
payment: {
|
payment: {
|
||||||
|
/**
|
||||||
|
* Query the detailed fee of a given encoded extrinsic
|
||||||
|
**/
|
||||||
|
queryFeeDetails: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<FeeDetails>>;
|
||||||
/**
|
/**
|
||||||
* Retrieves the fee information for an encoded extrinsic
|
* Retrieves the fee information for an encoded extrinsic
|
||||||
**/
|
**/
|
||||||
@@ -336,6 +386,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
* Retrieves the keys with prefix of a specific child storage
|
* Retrieves the keys with prefix of a specific child storage
|
||||||
**/
|
**/
|
||||||
getChildKeys: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;
|
getChildKeys: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;
|
||||||
|
/**
|
||||||
|
* Returns proof of storage for child key entries at a specific block state.
|
||||||
|
**/
|
||||||
|
getChildReadProof: AugmentedRpc<(childStorageKey: PrefixedStorageKey | string | Uint8Array, keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: BlockHash | string | Uint8Array) => Observable<ReadProof>>;
|
||||||
/**
|
/**
|
||||||
* Retrieves the child storage for a key
|
* Retrieves the child storage for a key
|
||||||
**/
|
**/
|
||||||
@@ -400,6 +454,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
* Subscribes to storage changes for the provided keys
|
* Subscribes to storage changes for the provided keys
|
||||||
**/
|
**/
|
||||||
subscribeStorage: AugmentedRpc<<T = Codec[]>(keys?: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[]) => Observable<T>>;
|
subscribeStorage: AugmentedRpc<<T = Codec[]>(keys?: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[]) => Observable<T>>;
|
||||||
|
/**
|
||||||
|
* Provides a way to trace the re-execution of a single block
|
||||||
|
**/
|
||||||
|
traceBlock: AugmentedRpc<(block: Hash | string | Uint8Array, targets: Option<Text> | null | object | string | Uint8Array, storageKeys: Option<Text> | null | object | string | Uint8Array) => Observable<TraceBlockResponse>>;
|
||||||
};
|
};
|
||||||
syncstate: {
|
syncstate: {
|
||||||
/**
|
/**
|
||||||
@@ -468,6 +526,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
|||||||
* Remove a reserved peer
|
* Remove a reserved peer
|
||||||
**/
|
**/
|
||||||
removeReservedPeer: AugmentedRpc<(peerId: Text | string) => Observable<Text>>;
|
removeReservedPeer: AugmentedRpc<(peerId: Text | string) => Observable<Text>>;
|
||||||
|
/**
|
||||||
|
* Returns the list of reserved peers
|
||||||
|
**/
|
||||||
|
reservedPeers: AugmentedRpc<() => Observable<Vec<Text>>>;
|
||||||
/**
|
/**
|
||||||
* Resets the log filter to Substrate defaults
|
* Resets the log filter to Substrate defaults
|
||||||
**/
|
**/
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user