Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbfc15ba88 | ||
|
|
2d40d370f9 | ||
|
|
0728e40bfb | ||
|
|
1a50298ffe | ||
|
|
68f2cb5bb2 | ||
|
|
8598002801 | ||
|
|
333ff8528b | ||
|
|
c17f93a3ec | ||
|
|
67841a9212 | ||
|
|
6be6b027cb | ||
|
|
6943c9b36d | ||
|
|
253e48f7bb | ||
|
|
eeaf6118a5 | ||
|
|
c3c77ffe43 | ||
|
|
71e82aece8 | ||
|
|
a7132b4e9c | ||
|
|
8acb65931e | ||
|
|
dcf053633b | ||
|
|
015ade79e6 | ||
|
|
a4f56d3d38 | ||
|
|
73d10a55f1 | ||
|
|
2d0ce2ddff | ||
|
|
775697f51e | ||
|
|
9690777acb | ||
|
|
e7d38a5e59 | ||
|
|
c6355fb147 | ||
|
|
d85d9ca930 | ||
|
|
af643401b8 | ||
|
|
fcea797c8a | ||
|
|
cbc14cc291 | ||
|
|
64aa4dcc1c | ||
|
|
429ea4ca99 | ||
|
|
86ce696808 | ||
|
|
57ca9a9c32 | ||
|
|
70a26e33a7 | ||
|
|
c487094aa7 | ||
|
|
bab79b6473 | ||
|
|
586e838788 | ||
|
|
51cb64ade7 | ||
|
|
d09dcb8282 | ||
|
|
869f9b7af9 | ||
|
|
a938cb545a | ||
|
|
553b3df0b2 | ||
|
|
1fd157364b | ||
|
|
fa7ae72c59 | ||
|
|
443706a6e0 | ||
|
|
ba462aae8b | ||
|
|
a35da085d6 | ||
|
|
3d8d2e4988 | ||
|
|
6c5ef6ecd6 | ||
|
|
3bae45a331 | ||
|
|
196a0891b8 | ||
|
|
2a16b04420 | ||
|
|
790deca695 | ||
|
|
4ec87dc51c | ||
|
|
51686f0cd4 | ||
|
|
deddc6dc79 | ||
|
|
3bf4c3fac5 | ||
|
|
ccf32a6289 | ||
|
|
4540495a44 | ||
|
|
429b797b23 | ||
|
|
a3d5ef790c | ||
|
|
b548277c05 | ||
|
|
2de9317b30 | ||
|
|
877aa33efa | ||
|
|
8a9e523b84 | ||
|
|
19743d6634 | ||
|
|
85ec141b56 | ||
|
|
cb175b4bde | ||
|
|
8672a2e30e | ||
|
|
17936f849b | ||
|
|
3b9f348223 | ||
|
|
b5ff0434d9 | ||
|
|
877a339353 | ||
|
|
716f473887 | ||
|
|
1c1bfb295d | ||
|
|
dd0a31803f | ||
|
|
e04e5577ed | ||
|
|
09617aad2e | ||
|
|
3d8a57a7d5 | ||
|
|
feff458cbf | ||
|
|
543b4846f9 | ||
|
|
09ab373b54 | ||
|
|
bec6dba14a | ||
|
|
e80bea6680 | ||
|
|
9119e791d1 | ||
|
|
46b99ae83d | ||
|
|
92129746dc | ||
|
|
4a8a36d284 | ||
|
|
2b8ce1b3b7 | ||
|
|
0e1e0c0d37 | ||
|
|
427f821430 | ||
|
|
07307f8374 | ||
|
|
cc5b5c81c9 | ||
|
|
efbc017940 | ||
|
|
849972f7b0 | ||
|
|
01758229eb | ||
|
|
add9b59402 | ||
|
|
c8af75088a | ||
|
|
d4b45921fd | ||
|
|
30f5baa906 | ||
|
|
7150bdcbea | ||
|
|
d041c0abb2 | ||
|
|
524e694b90 | ||
|
|
bdd1e4c917 | ||
|
|
7233d7c754 | ||
|
|
aee09c48b9 | ||
|
|
7edbc58129 | ||
|
|
ad2939cc4f | ||
|
|
e984c74ca6 | ||
|
|
a5c8e3c4e1 | ||
|
|
1e5191d695 | ||
|
|
b46093e5d3 | ||
|
|
64f0d7b2a6 | ||
|
|
4a1e504ca2 | ||
|
|
ebf3f4491e | ||
|
|
849f519efe | ||
|
|
accc2b4f7d | ||
|
|
01abc030f9 | ||
|
|
e041946de5 | ||
|
|
502e54ce5c | ||
|
|
12986f0cda | ||
|
|
83d780220c | ||
|
|
ec7848ae92 | ||
|
|
2b5be7eaab | ||
|
|
21f4e3107a | ||
|
|
8a152ea4c0 | ||
|
|
fd7b38e781 | ||
|
|
5df22835f6 | ||
|
|
6a828eb11a | ||
|
|
ad2b1abdc9 | ||
|
|
d3dc2cb00a | ||
|
|
921e55a82e | ||
|
|
fde076152a | ||
|
|
6e535b0502 | ||
|
|
1ddad84d7e | ||
|
|
1e975c68ee | ||
|
|
5c962cf093 | ||
|
|
07f55af202 | ||
|
|
6c8dd4be3b | ||
|
|
a339491d07 | ||
|
|
ea87472354 | ||
|
|
0ed156e5d9 | ||
|
|
59590540d8 | ||
|
|
c465252e69 | ||
|
|
0822d4d8c6 | ||
|
|
2c3eee4c67 | ||
|
|
b069710008 | ||
|
|
9a7e0bf82d | ||
|
|
4f520f5de6 | ||
|
|
79ee2ede3d | ||
|
|
f6b02e1de1 | ||
|
|
c11b0dffc5 | ||
|
|
0935c39906 | ||
|
|
ee622f3d2b | ||
|
|
ae350aae6f | ||
|
|
26c59f6d6e | ||
|
|
51c6262327 | ||
|
|
07ed405610 | ||
|
|
cd5d7b10c3 | ||
|
|
8e5b43bf62 | ||
|
|
49f3e36c46 | ||
|
|
7e25145fbf | ||
|
|
b5bc2ccfaf | ||
|
|
0e7c508d7f | ||
|
|
4e1c377ceb | ||
|
|
5c4920db6f | ||
|
|
679e31668e | ||
|
|
00e567b662 | ||
|
|
503193d6c2 | ||
|
|
5e82c97c8a | ||
|
|
8c12c227b4 | ||
|
|
d72456fb26 | ||
|
|
ca6d78e7ec | ||
|
|
8210c708ac | ||
|
|
41764562e1 | ||
|
|
66c8e5b4e8 | ||
|
|
ca7fe86089 | ||
|
|
cf2fbfce26 | ||
|
|
d69113ca5a | ||
|
|
d7eb40caf5 | ||
|
|
2eda438eac | ||
|
|
beddc3e0a5 | ||
|
|
ac1ae34e37 | ||
|
|
52953f248b | ||
|
|
e027f865aa | ||
|
|
d4e3e546dc | ||
|
|
6cb5476c80 | ||
|
|
52ffa175a9 | ||
|
|
ba2cd0cff5 | ||
|
|
fefcc2e0dc | ||
|
|
c8fbed2a12 | ||
|
|
6581d779c7 | ||
|
|
cab5b8bff7 | ||
|
|
480c0abda8 | ||
|
|
866c5769bb | ||
|
|
d8141198e1 | ||
|
|
a6a1a52d61 | ||
|
|
b6534d2958 | ||
|
|
3645cde156 | ||
|
|
2ac3640900 | ||
|
|
e379e7fabd | ||
|
|
69dae84a42 | ||
|
|
fe52484547 | ||
|
|
faa12a68f7 | ||
|
|
f6490217ec | ||
|
|
601cc62d70 | ||
|
|
201480be56 | ||
|
|
519823bc0e | ||
|
|
0b134c1eb8 | ||
|
|
e6e96aa9c9 | ||
|
|
84d0d8594e | ||
|
|
6be25966d8 | ||
|
|
a5eb11e5f3 | ||
|
|
19f87aac4d | ||
|
|
b217a59310 | ||
|
|
2de7a3c130 | ||
|
|
deecf4853e | ||
|
|
8889e69341 | ||
|
|
14194a363e | ||
|
|
9c50e81ab9 | ||
|
|
6505e73355 | ||
|
|
cefeb37ae6 | ||
|
|
9e29e89baf | ||
|
|
b82c90679d | ||
|
|
eeb8d20e58 | ||
|
|
b891edbd37 | ||
|
|
2ee3afcd61 | ||
|
|
328630fb17 | ||
|
|
325080cf71 | ||
|
|
549a536328 | ||
|
|
23f41a0bab | ||
|
|
5e0c0ba91a | ||
|
|
812a077e63 | ||
|
|
6ba28c8ad2 | ||
|
|
6cd0074ce4 | ||
|
|
b3d592357f | ||
|
|
f499946f1f | ||
|
|
56e28bed7f | ||
|
|
c76fb20a83 | ||
|
|
9d4b0ea56a | ||
|
|
f9d569ddd1 | ||
|
|
7221a3637c | ||
|
|
438c830366 | ||
|
|
3d0fd5a6a8 | ||
|
|
de57876c7f | ||
|
|
b24a1ff350 | ||
|
|
5f8c623179 | ||
|
|
00026a173f | ||
|
|
8da895efd4 | ||
|
|
89d029eca3 | ||
|
|
ac2a7eea67 | ||
|
|
4f0e573adf | ||
|
|
8417eff2b3 | ||
|
|
4aa5693906 | ||
|
|
982665c337 | ||
|
|
6dce57b394 | ||
|
|
ca7edf1593 | ||
|
|
59e069f091 | ||
|
|
65ff5c8f30 | ||
|
|
1c327c60d9 | ||
|
|
de9f033d99 | ||
|
|
9c913fb482 | ||
|
|
e19e530c1c | ||
|
|
aa91e0b8b5 | ||
|
|
9a6ba2fe0f | ||
|
|
de853d9cc0 | ||
|
|
07063134b8 | ||
|
|
20b8cd762d | ||
|
|
bd3338c3df | ||
|
|
4c328964d5 | ||
|
|
70e5e2b60a | ||
|
|
4329c0a411 | ||
|
|
0713afa0e0 | ||
|
|
8b518a909b | ||
|
|
794f1fe398 | ||
|
|
51423e20b5 | ||
|
|
d4b27ba670 | ||
|
|
8ca194a3d2 | ||
|
|
5fd2c70924 | ||
|
|
d36ee7de2f | ||
|
|
3683f9e5ff | ||
|
|
18c302d2cf | ||
|
|
1686f8b357 | ||
|
|
15158b763c | ||
|
|
f5f338a9ae | ||
|
|
458dec53dc | ||
|
|
ab05045686 | ||
|
|
b2c84eb461 | ||
|
|
1ee1d70d55 | ||
|
|
7de647ec0b | ||
|
|
cedbd8fa06 | ||
|
|
cba34b4b65 | ||
|
|
1a99d67c77 | ||
|
|
2a5c5ce3fe | ||
|
|
e4ca0a1c64 | ||
|
|
e6018f2f75 | ||
|
|
a9b4f8d841 | ||
|
|
7fe68857a0 | ||
|
|
4f63fc77a3 | ||
|
|
6e2ad7789e | ||
|
|
edb856c94f | ||
|
|
2f215fe2de | ||
|
|
ffa1279c64 | ||
|
|
83aca87dac | ||
|
|
bf782f6f65 | ||
|
|
7adad82786 | ||
|
|
693cf855f0 | ||
|
|
854a520517 | ||
|
|
6e6fc98cd1 | ||
|
|
3db15e73a5 | ||
|
|
215b659a9a | ||
|
|
7ef945d15b | ||
|
|
73ec345fcc | ||
|
|
c1c537a3b5 | ||
|
|
dc64076c79 | ||
|
|
da8ff51615 | ||
|
|
60b1bc87a4 | ||
|
|
7ed1857589 | ||
|
|
4c0e60f3d6 | ||
|
|
20ed3bb5fe | ||
|
|
be3f9c8fe8 | ||
|
|
e850955e55 | ||
|
|
eb5ee9860b | ||
|
|
f31bbdde02 | ||
|
|
f67c435378 | ||
|
|
bf9a60a202 | ||
|
|
9c3c07fa9b | ||
|
|
11786ca102 | ||
|
|
ffaea83e3e | ||
|
|
954540b944 | ||
|
|
204cf6769d | ||
|
|
f319bc4c50 | ||
|
|
7b9a11ac25 | ||
|
|
5d2feca2d4 | ||
|
|
dd97e9daee | ||
|
|
be258a1f7c | ||
|
|
72e9474f6f | ||
|
|
d1f63a7864 | ||
|
|
07ca18502b | ||
|
|
cddbe411f7 | ||
|
|
ffa60d1cfa | ||
|
|
88193b6a75 | ||
|
|
cc4a4607f1 | ||
|
|
6c25d0ab0d | ||
|
|
fbbbcd2612 | ||
|
|
dd57b1a007 | ||
|
|
47d0e68f7d | ||
|
|
7b6397215d | ||
|
|
5739b69757 | ||
|
|
2ca79f2f70 | ||
|
|
8fb64f77cd | ||
|
|
d1f86ce78e | ||
|
|
64ff226535 | ||
|
|
e762746ff0 | ||
|
|
ce5c8f7443 | ||
|
|
fc4cbb608c | ||
|
|
7ac3043f83 | ||
|
|
44b56fb0cb | ||
|
|
758ce567e5 | ||
|
|
cb5308b476 | ||
|
|
a9211690be | ||
|
|
a7db14a261 | ||
|
|
3a1f284fa8 | ||
|
|
a0b6c42629 | ||
|
|
f77ae4d99f | ||
|
|
5fa9af8fd3 | ||
|
|
1ff029dc11 | ||
|
|
4c8c9fbb07 | ||
|
|
7057cf365b | ||
|
|
d1bc48e936 | ||
|
|
2dee50f019 | ||
|
|
fa76378702 | ||
|
|
e855da1f13 | ||
|
|
adffde368c | ||
|
|
5278138cc3 | ||
|
|
98249a282e | ||
|
|
b7eeb992cd | ||
|
|
01daf32646 | ||
|
|
51a866fd35 | ||
|
|
53401e29ea | ||
|
|
774f41e6db | ||
|
|
1ca3b295a4 | ||
|
|
82828d8e09 | ||
|
|
131055c1d5 | ||
|
|
bd2e690261 | ||
|
|
1a2ca8ea38 | ||
|
|
0c98593aee | ||
|
|
416e2fbc96 | ||
|
|
c04fb9073e | ||
|
|
4f85ceb2c3 | ||
|
|
9196ce85a0 | ||
|
|
26734bf8bf | ||
|
|
53959d482d | ||
|
|
0a0f110c42 | ||
|
|
47f1350652 | ||
|
|
3c3b7290c2 | ||
|
|
006c686c18 | ||
|
|
44d4a07005 | ||
|
|
6e61be960c | ||
|
|
bd57359dc5 | ||
|
|
10bc6b4060 | ||
|
|
9e681c0666 | ||
|
|
e969382fd0 | ||
|
|
1949a13810 | ||
|
|
362262c4e1 | ||
|
|
ddd5eab7f5 | ||
|
|
1da6193f34 | ||
|
|
c4e553ad80 | ||
|
|
0b83a61600 | ||
|
|
382f7d75c8 | ||
|
|
88e4518f64 | ||
|
|
b1a657d68a | ||
|
|
067f17b28b | ||
|
|
99073e2a88 | ||
|
|
f9a42e47e7 | ||
|
|
b80d72edbd | ||
|
|
1f7b9f7f3a | ||
|
|
843efb2146 | ||
|
|
3619fabe5f | ||
|
|
bf598e392e | ||
|
|
f026137545 | ||
|
|
2264f53a43 | ||
|
|
8ba4029633 | ||
|
|
05cb2cef5a | ||
|
|
3a70594594 | ||
|
|
019cb58dd1 | ||
|
|
d487490ca0 | ||
|
|
b9fad61da0 | ||
|
|
77bf33b4e4 | ||
|
|
7ed7c9d3a8 | ||
|
|
0d2896630d | ||
|
|
74dbff32df | ||
|
|
4653cc0d84 | ||
|
|
50e115f6a1 | ||
|
|
8a5a86e8b3 | ||
|
|
48ef5af93f | ||
|
|
e5c20be666 | ||
|
|
6bf0d5eea9 | ||
|
|
21c57b60a1 | ||
|
|
b1dff22954 | ||
|
|
a3d0cb0999 | ||
|
|
bf946c20db | ||
|
|
664d2c8ab6 | ||
|
|
01a4d6b4a9 | ||
|
|
18454083db | ||
|
|
191abe4e08 | ||
|
|
97fbb4732d | ||
|
|
01f3666cc7 | ||
|
|
468fcdccaa | ||
|
|
c8dd26b0da | ||
|
|
61d5dec63a | ||
|
|
64a4bb2e17 | ||
|
|
f78bf9dde1 | ||
|
|
b7ba654e48 | ||
|
|
532a252fe0 | ||
|
|
614cf4e484 | ||
|
|
c576c689d0 | ||
|
|
d86cd94fe2 | ||
|
|
762b16ea13 | ||
|
|
09a72c0f31 | ||
|
|
eded5fede2 | ||
|
|
704df82b1d | ||
|
|
46efc10939 | ||
|
|
74cf8aa30c | ||
|
|
7a60ab81f8 | ||
|
|
c1d7ca67d5 | ||
|
|
7e1eb0fab0 | ||
|
|
af76d7fb04 | ||
|
|
afbe072ad5 | ||
|
|
d86c5be413 | ||
|
|
a695d2a5b5 | ||
|
|
1c087967d3 | ||
|
|
906732bcdc | ||
|
|
c9352af81c | ||
|
|
e2e8e3fedd | ||
|
|
3ca07a5bc8 | ||
|
|
89700f98c5 | ||
|
|
0cae3cf0fa | ||
|
|
eade586044 | ||
|
|
c227c6625c | ||
|
|
4cb8462d50 | ||
|
|
1d671d531c | ||
|
|
a49cd799dd | ||
|
|
8ed2bda3a8 | ||
|
|
2aabbe3cce | ||
|
|
7b37cc79a3 | ||
|
|
34a719e443 | ||
|
|
b440c9b0ea | ||
|
|
03e9a9676f | ||
|
|
094d6f7a1c | ||
|
|
33fd1b1c78 | ||
|
|
9968aa4606 | ||
|
|
9c337422a5 | ||
|
|
cc432e2291 | ||
|
|
aaff64404a | ||
|
|
bfe788cd31 | ||
|
|
883b191ae7 | ||
|
|
fa46debb90 | ||
|
|
ed4af1d04b | ||
|
|
4cea617b13 | ||
|
|
26b6a59725 | ||
|
|
35c63a52c8 | ||
|
|
61bc20aa7b | ||
|
|
db59fbff25 | ||
|
|
49b3104d04 | ||
|
|
2338ecc2d7 | ||
|
|
bab8c852a4 | ||
|
|
cba17aeb55 | ||
|
|
deca8ad216 | ||
|
|
fb4c840549 | ||
|
|
610234c1a1 | ||
|
|
7f39c573ce | ||
|
|
114c437671 | ||
|
|
e12f2f67c6 | ||
|
|
0c61850ad6 | ||
|
|
8b1a7a8584 | ||
|
|
4b6b0305e6 | ||
|
|
3b758a0d64 | ||
|
|
ea2c320f33 | ||
|
|
306857ae07 | ||
|
|
448ecd13bb | ||
|
|
011e24bd49 | ||
|
|
099992627b | ||
|
|
74e20864a6 | ||
|
|
d006f051a3 | ||
|
|
f1fe498801 | ||
|
|
1f2cd5a6f7 | ||
|
|
d6239cbe56 | ||
|
|
d82bb63acb | ||
|
|
a3ae4cf5d2 | ||
|
|
6b74ea39c2 | ||
|
|
87aab2eca5 | ||
|
|
1c6a2582f3 | ||
|
|
ea49095334 | ||
|
|
b2daf7482f | ||
|
|
b0165e41e7 | ||
|
|
0a27f63423 | ||
|
|
20d8a31258 | ||
|
|
ca186a4b2c | ||
|
|
7bd593c8f7 | ||
|
|
75220eb54f | ||
|
|
dde7d49598 | ||
|
|
a31921b88e | ||
|
|
a4c5ca45b2 | ||
|
|
c44cb1858e | ||
|
|
f89867a9ae | ||
|
|
be4b9a4133 | ||
|
|
46b1429da9 | ||
|
|
a70af20eba | ||
|
|
09dc78d6b1 | ||
|
|
921e329d18 | ||
|
|
f86aebf7e1 | ||
|
|
eef1c5327b | ||
|
|
2c25936e2c | ||
|
|
734213a2f9 | ||
|
|
16e0ea9315 | ||
|
|
c87ba33893 | ||
|
|
2875fdf2cf | ||
|
|
e73c147275 | ||
|
|
f080d6ed1c | ||
|
|
8ea07727ba | ||
|
|
3c47c3fdc3 | ||
|
|
06418913e5 | ||
|
|
188363d407 | ||
|
|
ec79087bab | ||
|
|
155fd0f8b1 | ||
|
|
05b7def1a0 | ||
|
|
5671af8db7 | ||
|
|
6aebeec028 | ||
|
|
5b5d0a3fb8 | ||
|
|
d405ed1005 | ||
|
|
2be97310d3 | ||
|
|
1f44e4473f | ||
|
|
022c7ea645 | ||
|
|
fe078ca67c | ||
|
|
479c742471 | ||
|
|
a52c629ecf | ||
|
|
c077d0f2e7 | ||
|
|
679994a6fb | ||
|
|
8cc256fdcf | ||
|
|
b6b2f2beec | ||
|
|
6075a21efb | ||
|
|
fa98f8f06d | ||
|
|
ad570cac5a | ||
|
|
cb32acc409 | ||
|
|
3998b1bcbd | ||
|
|
3fd03b2498 | ||
|
|
cba5710fec | ||
|
|
1ffdba03b3 | ||
|
|
fcf89d1501 | ||
|
|
56dc116d92 | ||
|
|
2371d6a29c | ||
|
|
d39878c875 | ||
|
|
287ceb2ded | ||
|
|
7c04be6abc | ||
|
|
e601ae27a1 | ||
|
|
487ad475c7 | ||
|
|
506b042f8c | ||
|
|
0e037de1b1 | ||
|
|
8d3cb72189 | ||
|
|
f8b9615e6b | ||
|
|
7cc961f789 | ||
|
|
1d92b7bead | ||
|
|
2c44b5ca8a | ||
|
|
8d9b50a004 | ||
|
|
d41f6ec3ef | ||
|
|
6aff7db89a | ||
|
|
dc105e6b31 | ||
|
|
f41ad2eee7 | ||
|
|
276da86dbe | ||
|
|
5aa64dddf3 | ||
|
|
cf01c41b33 | ||
|
|
64bc3fbffa | ||
|
|
453aacb669 | ||
|
|
2f350e3bc2 | ||
|
|
8379689eaa | ||
|
|
2676909cd0 | ||
|
|
a53c924248 | ||
|
|
a044a959b6 | ||
|
|
7555a3a7ce | ||
|
|
0fac973645 | ||
|
|
f533f51003 | ||
|
|
b4c0875ebf | ||
|
|
8cab499a83 | ||
|
|
f2daae3986 | ||
|
|
41cf32c808 | ||
|
|
b0e970a815 | ||
|
|
fed9e8f7de | ||
|
|
d2e2d3be76 | ||
|
|
07b9cb1a16 | ||
|
|
4f24af6d8a | ||
|
|
a30d467618 | ||
|
|
3daf44bac2 | ||
|
|
b69d8ec789 | ||
|
|
d1b2664071 | ||
|
|
8d0f20c2a7 | ||
|
|
f200a348de | ||
|
|
fae67e72ee | ||
|
|
a23e71bfb0 | ||
|
|
6e96fd6a55 | ||
|
|
3ba2bbd581 | ||
|
|
f8084c2d12 | ||
|
|
1ad552f03d | ||
|
|
6b8d0207a6 |
+1
-1
@@ -1 +1 @@
|
||||
6
|
||||
19
|
||||
|
||||
+4
-2
@@ -4,6 +4,8 @@ exclude_patterns:
|
||||
- "**/*.test.js"
|
||||
- "**/*.test.ts"
|
||||
- "docs/**/*.js"
|
||||
- "packages/api/src/query.types.ts"
|
||||
- "packages/api/src/augment/"
|
||||
- "packages/typegen/scripts"
|
||||
- "packages/typegen/src"
|
||||
- "packages/types/src/interfaces/"
|
||||
- "packages/types/src/scripts/"
|
||||
- "packages/types/src/augment/"
|
||||
|
||||
@@ -14,6 +14,16 @@ jobs:
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Config yarn cache
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: lint
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
@@ -31,6 +41,16 @@ jobs:
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Config yarn cache
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: test
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
@@ -48,6 +68,16 @@ jobs:
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Config yarn cache
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: build
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
@@ -65,6 +95,16 @@ jobs:
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Config yarn cache
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: build
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
|
||||
@@ -14,10 +14,22 @@ jobs:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Config yarn cache
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: build
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
@@ -27,7 +39,7 @@ jobs:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
CI_NO_BETA=true yarn polkadot-dev-ghact-build
|
||||
yarn polkadot-ci-ghact-build
|
||||
|
||||
build_docs:
|
||||
name: Build Docs
|
||||
@@ -42,6 +54,16 @@ jobs:
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Config yarn cache
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- uses: actions/cache@v1
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: build
|
||||
env:
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
@@ -50,4 +72,16 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn polkadot-dev-ghact-docs
|
||||
yarn polkadot-ci-ghact-docs
|
||||
|
||||
dummy:
|
||||
name: Dummy
|
||||
if: "contains(github.event.head_commit.message, '[CI Skip]')"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- name: dummy
|
||||
run: |
|
||||
echo "Dummy skip step"
|
||||
|
||||
@@ -3,6 +3,7 @@ build/
|
||||
build-docs/
|
||||
coverage/
|
||||
docs/.vuepress/dist/
|
||||
docs/substrate/*.md
|
||||
node_modules/
|
||||
tmp/
|
||||
.DS_Store
|
||||
@@ -12,6 +13,7 @@ tmp/
|
||||
.env.production.local
|
||||
.npmrc
|
||||
.rpt2_cache
|
||||
.vscode/
|
||||
cc-test-reporter
|
||||
lerna-debug.log*
|
||||
npm-debug.log*
|
||||
|
||||
+217
-37
@@ -1,4 +1,144 @@
|
||||
# 0.95.1
|
||||
# 1.4.1 Feb 26, 2020
|
||||
|
||||
- **Breaking change** (TypeScript only) The `*.d.ts` files now contain TypeScript 3.8 features (specifically `#private`), which is not usable in TS versions < 3.8
|
||||
- **Breaking change** - `api.derive.staking.*` has updated result types and detects support for lazy payouts queries
|
||||
- Rework type generation for `api.{query, tx}` to properly handle complex type inputs (Thanks to https://github.com/monitz87)
|
||||
- Rework metadata `--strict` mode to effectively decorate chain metadata (Thanks to https://github.com/monitz87)
|
||||
- Add `api.rpc.chain.subscribeAllHeads` (not just best) (Thanks to https://github.com/jak-pan)
|
||||
- Add `api.rpc.engine.*` for manual seal support
|
||||
- Add `api.injectMetadata(metadata)` to initialize API with a specific metadata version
|
||||
- The api now checks for runtime upgrades, augmenting the interfaces with new metadata when found
|
||||
- Support types & interfaces required for lazy reaping, lazy payouts & offchain phragmen
|
||||
- `Option` types now has an `.unwrapOrDefault` as an complement to `.unwrap` & `.unwrapOr`
|
||||
- Support JS `BigInt` inputs in any derived `UInt` and `Int` object, e.g. `api.tx.balances.transfer(..., 9876543210123456789n)`
|
||||
- `UInt` & `Int` now does source bitLength checks upon construction
|
||||
- Registry now exposes `.createType(<type>, ...args)` as an additional helper (like the API)
|
||||
- Expand `.toHuman` on `ExtrinsicEra`, `SubmittableResult` & `Vote`
|
||||
- Move `DigestItem`, `Fixed64`, `H160`, `H256` & `H512` to interfaces in `@polkadot/types/interfaces`
|
||||
- Align construction of unknown types in `registry.get` consistently warn on detection, throw on use
|
||||
- Support for arbitrary UInt types via `UInt<bitLength>` type definitions
|
||||
- Expose static `.with` on `UInt`, `Int` & `U8aFixed` classes with optional type name override
|
||||
- Remove [11 Jan 2019](https://github.com/polkadot-js/api/issues/574) extrinsic length hack
|
||||
- Use ES `#field` on private class fields as applicable
|
||||
- Move `types/primitive/{extrinsics, generic}` to `types/{extrinsics, generic}`
|
||||
- Cleanup augmentation and generation scripts for type definitions, aligning with api augmentation
|
||||
- Bump to `@polkadot/{util, util-crypto, keyring}` 2.5.1
|
||||
|
||||
# 1.3.1 Feb 18, 2020
|
||||
|
||||
- Add `@types/bn.js` as a normal dependency, exposed in `*.d.ts` (Thanks to https://github.com/monitz87)
|
||||
- Type generation scripts (including `polkadot-types-from-{chain,defs}`) has been moved to the `@polkadot/typegen` package
|
||||
- The `@polkadot/types/codec/create` has been moved to `@polkadot/types/create`, imports from `@polkadot/types` are unaffected
|
||||
- Expose chain properties on registry (and use for API type formatting)
|
||||
- Add `toHuman(isExtended?: boolean)` to all codec types, formatting into a human-readable structure
|
||||
|
||||
# 1.2.1 Feb 16, 2020
|
||||
|
||||
- **Important** Update RPC status codes (latest Substrate 2), with the `isInBlock` (`isFinalized` now indicates finality)
|
||||
- Storage `.entries(arg?: any)` now has the correct argument type for DoubleMap (Thanks to https://github.com/monitz87)
|
||||
- Swap Kusama and Polkadot aliases for `Address` to `AccountId` (future update)
|
||||
- Add `LookupSource` and `LookupTarget` types instead of mapping these directly for aliasing
|
||||
- Add `BitVec` type primitive
|
||||
- Add support for `system.account` for balance & nonce queries in derives as well as Submittables (Substrate composites)
|
||||
- Add `rpc.author.hasKey` and `rpc.author.hasSessionKeys` RPCs
|
||||
- Add derives for the parachains interfaces
|
||||
- Applied the latest types for Polkadot parachains
|
||||
- `registry.findMetaError` now can take in a `DispatchErrorModule` object for error lookups (from `asModule` in `DispatchError`)
|
||||
- Metadata now correctly serializes to the original input data via `toHex()` & `toU8a()`
|
||||
- Metadata documentation generation rework, including the output of errors from metadata
|
||||
- Update all examples and comments to use latest `system.account` queries (instead of `system.accountNonce` and `balances.freeBalance`/`balances.reservedBalance`)
|
||||
- Cleanup `codec/Date` tests to make it run properly on all timezones
|
||||
- Add explicit dependencies to all packages and move TypeScript `@types/*` to dev deps
|
||||
|
||||
# 1.1.1 Feb 06, 2020
|
||||
|
||||
- **Important** Chains without `balances.account` or `system.account` should supply `"BalanceLock": "BalanceLockTo212"` to their types to use the previous-generation `BalanceLock` (when querying locks)
|
||||
- Add support for `balances.account` in all applicable derives (incl. `vesting` module)
|
||||
- Inject and use SignedExtensions by name from V11 metadata (V4 extrinsics only)
|
||||
- Add typings for `api.tx.*.*` - the `polkadot-types-from-chain` now also generates these
|
||||
- Remove additional V1-only derives `(staking.recentlyOffline`, `balances.nominatorsFor`)
|
||||
- Add `.isMax()` on int values, an opposite of `isZero()` (e.g. `u128`, as well as derived, e.g. `Balances`)
|
||||
- Add `.keyPrefix()` to all `api.query.*` complementing the `.key()` call, both returning a hex string
|
||||
- Council derives now takes bootstrapping (member, no elections) into account
|
||||
- Account derives now allow for an optional indices module (not required)
|
||||
- Adjust balances fees derivation with optional transfer and creation fees (removed in Substrate)
|
||||
- Adjust enum `.toJSON()` to return type name as specified
|
||||
|
||||
# 1.0.1 Jan 30, 2020
|
||||
|
||||
- **Breaking change** Drop support for Substrate v1 chain in all derives
|
||||
- Return unsub functions from provider .on emitters (Thanks to https://github.com/jak-pan)
|
||||
- `ApiPromise.isReady` now rejects on unrecoverable errors (Thanks to https://github.com/laec)
|
||||
- Add `polkadot-types-from-chain` & `polkadot-types-from-defs` TypeScript generators to `@polkadot/types`
|
||||
- Only decorate derives where relevant parent `api.query.*` is available
|
||||
- Support `.entries(arg?: any)` lookups on DoubleMaps (in addition to previously supported maps)
|
||||
- Allow v9 metadata to parse even in cases where it was wrongly deployed pre-v10
|
||||
- Allow type-aliases on a per-module basis (e.g. `Judgement` in identity as well as society)
|
||||
- Allow passing `{ signer }` to both `api.tx.*` and `api.sign` (in addition to `api.setSigner`)
|
||||
- Add derives for the society module
|
||||
- Don't map empty tuples, e.g. `()` to `Null`, rather keep them empty
|
||||
- Add lookups to the metadata errors via `findMetaError`
|
||||
- Update metadata and types for the latest Substrate & Polkadot versions
|
||||
- Support metadata V11 as per latest Substrate
|
||||
- Remove support for un-deployed metadata
|
||||
- Remove old known types for Substrate V1
|
||||
|
||||
# 0.100.1 Jan 13, 2020
|
||||
|
||||
- **Important** This will the the last API version with Substrate 1.x support. Although you will still be able to use subsequent versions with older chains, dependent libraries such as sr25519 may not be compatible.
|
||||
- Add support for the Substrate identity module
|
||||
- Remove the `codec/Data` type, to remove a conflict with Substrate. This type is now named `Raw`
|
||||
- Fix for linked maps using `Option`
|
||||
- Add support for `BTreeSet` (Thanks to https://github.com/satellitex)
|
||||
- Add support for Metadata v10
|
||||
- Add support for latest Polkadot/Substrate types
|
||||
- Add `paymentInfo` to submittables to calculate fees
|
||||
|
||||
# 0.99.1 Dec 13, 2019
|
||||
|
||||
- **Breaking change** The `Data` and `U8a` type has been renamed and just replaced with the `Raw` type
|
||||
- **Breaking change** The `api.derive.staking.info` has been split into 2 - `staking.query` for non-balance related information (more effective) and `staking.account` that enhances query for all the information previously found `.info`
|
||||
- Cleanup `DoubleMap` hashing to always hash over the full value (in the case of `Vec<T>`, this includes the length)
|
||||
- Update democracy derives to take care of nextTally and lowestUnbaked
|
||||
- Add additional derives for both council & treasury
|
||||
- Alignment with latest Polkadot/Substrate master branch types
|
||||
|
||||
# 0.98.1 Dec 04, 2019
|
||||
|
||||
- Make the TypeScript generation script mor re-usable (Thanks to https://github.com/xlc)
|
||||
- Add `.entries()` for all map-types, returning storage keys and values
|
||||
- Add `.signAsync` to submittable extrinsics (Thanks to https://github.com/c410-f3r)
|
||||
- Cleanup circular references between internal dependencies
|
||||
- Support for new Substrate democracy with preimages in derive
|
||||
- Alignment of types with Substrate/Polkadot master branches
|
||||
|
||||
# 0.97.1 Nov 29, 2019
|
||||
|
||||
- **Breaking change** Add the passing on an explicit `Registry` to all calls to `createType` as well as all codec classes. If you are upgrading form an older version, use the [migration guide](UPGRADING.md) to walk through the changes required.
|
||||
- **Breaking change** The metadata classes have been moved from `@polkadot/types` into `@polkadot/metadata`. If you explicitly create `Metadata` classes, you now would need to do so with the `import Metadata from '@polkadot/metadata';` This is a decorated class, where the previous metadata is now available on `Metadata.metadata`, alongside decorated `consts.*`', `tx.*` and `query.*`.
|
||||
- **Breaking change** Session `Keys` defaults to 4 keys now (Substrate master), depending on your node config, you would want to override with e.g. `Keys: 'SessionKeys3'` (1, 2, 3, 4, 5 & 6)
|
||||
- **Breaking change** `ValidatorPrefs` now default to the new percentage commission model, to use the previous `validatorPayment`, you can override with `ValidatorPrefs: 'ValidatorPrefsTo196'`
|
||||
- `api.derive.*` now has built-in memomization
|
||||
- Various fixes and cleanups to `api.derive.*` including era length progress and vesting calculations
|
||||
- Aligned all types with the latest Polkadot & Substrate, including Kusama CC3
|
||||
- Support for Metadata V9, which adjusts the hashing methods of storage entries
|
||||
- Support for Metadata V10 (still un-released), which includes prefixed map support
|
||||
|
||||
# 0.96.1 Nov 09, 2019
|
||||
|
||||
- Updated types for latest Kusama
|
||||
- Add `filterRecords` (in addition to `findRecord`) on submittable results
|
||||
- Various ABI v2 contract fixes
|
||||
- Update derive for elections (incl. RunnersUp) and heartbeat derives (with blocks & messages)
|
||||
- Add vesting totals & locked breakdowns to derive balances
|
||||
- Update council derives for the latest Substrate master support (with constants)
|
||||
- Derive cleanups, including sharing of instances between the API and internal to derives
|
||||
|
||||
# 0.95.2 Oct 25, 2019
|
||||
|
||||
- Temporary removal of `account_nextIndex` use, will be re-added in a future release
|
||||
|
||||
# 0.95.1 Oct 25, 2019
|
||||
|
||||
- Support Extrinsic V4 with additional signature indicator (Latest Polkadot/Substrate/Kusama)
|
||||
- Adjust subscription update checks to avoid duplicated data updates
|
||||
@@ -8,19 +148,19 @@
|
||||
- All latest Polkadot & Substrate types (as per master branches)
|
||||
- **Breaking change** `Call.injectMethods` is moved to `Call.injectMetadata` to align with `Events` (This _should_ not be used externally, however mentioned as breaking here)
|
||||
|
||||
# 0.94.1
|
||||
# 0.94.1 Oct 07, 2019
|
||||
|
||||
- Add handling of `Result<Ok, Error>` definitions
|
||||
- Adjust API cloning now takes RPC filters from source into account
|
||||
- Simplification of isPedantic checks and less overhead on StorageData types
|
||||
- Cleanups and fixes around RPC and derive type definitions
|
||||
- Fix `derive.imOnline.receivedHeatbeats` to query via indexes
|
||||
- Fix `derive.imOnline.receivedHeartbeats` to query via indexes
|
||||
- Adjustment of `api.derive.elections.{approvalsOf|approvalsOfAt}` to allow ss58 address input
|
||||
- Cleanup `Enum` `.eq` handling to be more exhaustive
|
||||
- Add documentation for custom extrinsic formats (advanced chains)
|
||||
- Update to latest substrate master metadata
|
||||
|
||||
# 0.93.1
|
||||
# 0.93.1 Sep 26, 2019
|
||||
|
||||
- Support for Kusama CC2
|
||||
- In extrinsic submission, use `rpc.account.nextIndex` to retrieve the nonce when available
|
||||
@@ -30,7 +170,7 @@
|
||||
- Support recursive type registration (self-referencing via `Box`) in addition to better sanitation of user-defined-types
|
||||
- Documentation and example updates (thanks mostly to contributions)
|
||||
|
||||
# 0.92.1
|
||||
# 0.92.1 Sep 12, 2019
|
||||
|
||||
- The API now correctly sets the ss58 prefix as retrieved from the chain properties via `ss58Format`
|
||||
- Bump to `@polkadot/util` 1.4.1, removing use of `ExtError`
|
||||
@@ -38,7 +178,7 @@
|
||||
- Support the latest Polkadot & Substrate master branches (incl. metadata updates)
|
||||
- Getting started documentation has been made available
|
||||
|
||||
# 0.91.1
|
||||
# 0.91.1 Sep 09, 2019
|
||||
|
||||
- This release was focussed on stability, with a number of cleanups and bug-fixes
|
||||
- Adjustments for Substrate 1.x chain detection (with auto-types) and Substrate 2.x support has been extended with all latest types
|
||||
@@ -48,11 +188,11 @@
|
||||
- Redeemed balance calculation if `api.derive` now returns the correct values again (bug fix)
|
||||
- added the `yarn chain:info [--ws URL]` utility to extract a calls-only metadata version
|
||||
- Missing types are now logged via a `console.warn`, not via `.error`
|
||||
- `Extrinsic`, `ExtrinsicPayload` & `SignerPayload` is registered in the type registry and can be overriden now
|
||||
- `Extrinsic`, `ExtrinsicPayload` & `SignerPayload` is registered in the type registry and can be overridden now
|
||||
- **Breaking change** `SignerPayload` is renamed to `SignerPayloadJSON`
|
||||
- **Breaking change** `SignerPayloadJSON`, `SignerPayloadRawBase` and `SignerPayloadRaw` are all moved to `@polkadot/types`
|
||||
|
||||
# 0.90.1
|
||||
# 0.90.1 Aug 24, 2019
|
||||
|
||||
If you are upgrading form an older version, use the CHANGELOG hand-in-hand with the [migration guide](UPGRADING.md).
|
||||
|
||||
@@ -70,11 +210,11 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- The `types/codec/createType` has been moved to `types/codec/create` with the same exports. If you explicitly imported from here (and not doing the suggested `import { createType } from '@polkadot/types`), the reference needs to be updated
|
||||
|
||||
|
||||
# 0.82.0-beta.x
|
||||
# 0.82.0-beta.x Jul 28, 2019
|
||||
|
||||
- Support for substrate 2.x (master) has been extended,
|
||||
- Additional types have been addedd for the modules
|
||||
- `api.derive.contract` is now `api.derive.contracts` to align with the substrate 2.x rename. (Feture detection is used so it supports both 1.x and 2.x chains)
|
||||
- `api.derive.contract` is now `api.derive.contracts` to align with the substrate 2.x rename. (Feature detection is used so it supports both 1.x and 2.x chains)
|
||||
- Addition of `api.derive.elections`
|
||||
|
||||
- Support latest substrate 2 v6 metadata with module constants using `api.consts`.
|
||||
@@ -89,7 +229,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- The `ContractsAbi` type has been moved from `@polkadot/types` to `import { Abi } from '@polkadot/api-contract`. This paves the way for an enhanced contracts interface, instead of dealing with low-level API calls.
|
||||
|
||||
|
||||
# 0.81.1
|
||||
# 0.81.1 Jun 14, 2019
|
||||
|
||||
- The dependency on `@polkadot/keyring` has been removed - if you relied on the API to provide this, you would now need to manually add it
|
||||
- `createType` allows for the creation of `[u8; <length>]` types (opening the door for contract support)
|
||||
@@ -109,7 +249,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Add `off` method to `Api` (Base, for both `ApiPromise` & `ApiRx`) to remove an event listener
|
||||
|
||||
|
||||
# 0.80.1
|
||||
# 0.80.1 Jun 04, 2019
|
||||
|
||||
- Support for mortal transactions
|
||||
- Better DoubleMap storage support
|
||||
@@ -119,7 +259,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Misc. cleanups and fixes
|
||||
|
||||
|
||||
# 0.79.1
|
||||
# 0.79.1 May 22, 2019
|
||||
|
||||
- DoubleMap query support
|
||||
- Support latest EventRecord metadata (substrate master)
|
||||
@@ -131,7 +271,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Add `toRawType` on all type classes (breakdown into primitive types)
|
||||
|
||||
|
||||
# 0.78.1
|
||||
# 0.78.1 May 08, 2019
|
||||
|
||||
- Fix linked-maps (not working since 0.77.1)
|
||||
- Convert Usize to U32 (as found in WASM environments)
|
||||
@@ -142,13 +282,13 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Metadata updates for substrate (WithdrawReasons, ContractInfo)
|
||||
|
||||
|
||||
# 0.77.1
|
||||
# 0.77.1 Apr 25, 2019
|
||||
|
||||
- Support Metadata v4, which introduces the use of a custom hasher to hash storage map keys.
|
||||
- Add TreasuryProposal (not the same as democracy, type aliased)
|
||||
|
||||
|
||||
# 0.76.1
|
||||
# 0.76.1 Apr 03, 2019
|
||||
|
||||
- Caching improvements (duplicate queries, no duplicate subscriptions)
|
||||
- Experimental contract API
|
||||
@@ -156,12 +296,12 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Update @polkadot/util-crypto with smaller footprint
|
||||
|
||||
|
||||
# 0.75.1
|
||||
# 0.75.1 Mar 29, 2019
|
||||
|
||||
- Start journey to 1.0
|
||||
|
||||
|
||||
# 0.53.1
|
||||
# 0.53.1 Mar 29, 2019
|
||||
|
||||
- Change spelling to US English as per substrate master (1.0-rc1). Breaking changes as a result:
|
||||
- For extrinsic status results, if you have checked the type returns, i.e. `result.type === 'Finalised'` now check on the status for `result.status.isFinalized` or `result.status.isBroadcast`, ... (the `type` property is now accessible only on `result.status.type`)
|
||||
@@ -172,7 +312,7 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- All examples have been updated with sr25519 addresses (with the new checksums)
|
||||
|
||||
|
||||
# 0.52.1
|
||||
# 0.52.1 Mar 28, 2019
|
||||
|
||||
- Support queries to linked mapped storage (found in new staking interfaces)
|
||||
- Add `derive.staking.controllers` to retrieve all active staking controllers
|
||||
@@ -182,42 +322,42 @@ If you are upgrading form an older version, use the CHANGELOG hand-in-hand with
|
||||
- Check for single instances for api and types as they are loaded (assertSingletonPackage)
|
||||
|
||||
|
||||
# 0.51.1
|
||||
# 0.51.1 Mar 25, 2019
|
||||
|
||||
- Support metadata V2 as per latest substrate master
|
||||
- Update metadata with new types as per latest substrate master
|
||||
|
||||
|
||||
# 0.50.1
|
||||
# 0.50.1 Mar 23, 2019
|
||||
|
||||
- Latest util-crypto (usage of WASM with JS fallbacks if not available)
|
||||
- Update upstream @polkadot dependencies (for new crypto)
|
||||
|
||||
|
||||
# 0.49.1
|
||||
# 0.49.1 Mar 20, 2019
|
||||
|
||||
- Fix large message signing on non-known nodes (default is now hashing, there has been enough time between upgrades)
|
||||
|
||||
|
||||
# 0.48.1
|
||||
# 0.48.1 Mar 18, 2019
|
||||
|
||||
- Pull in new sr25519 capable keyring for dev nodes
|
||||
- When using dev mode, it assumes that the node is the latest with derived sr25519 keys
|
||||
|
||||
|
||||
# 0.47.1
|
||||
# 0.47.1 Mar 14, 2019
|
||||
|
||||
- Swap to publishing -beta.x on merge (non-breaking testing)
|
||||
|
||||
|
||||
# 0.46.1
|
||||
# 0.46.1 Mar 01, 2019
|
||||
|
||||
- Extended type registration to now handle internal types as well. Additionally the built-in Extrinsic type can now we overridden with a custom version.
|
||||
- Where `Extrinsic` and `Method` is used as types, consider importing `{ IMethod, IExtrinsic }` from `@polkadot/types/types`, especially in the cases where this is used from a `SubmittableExtrinsic`
|
||||
- The `typeRegistry` constant is now `getTypeRegistry()` as a function
|
||||
|
||||
|
||||
# 0.45.1
|
||||
# 0.45.1 Feb 19, 2019
|
||||
|
||||
- Storage with option values now correctly return `Option<Type>` and is indicated as such in the documentation
|
||||
|
||||
@@ -234,7 +374,7 @@ console.log('llo', llo.unwrapOr('not set') /* Option<BlockNumber> */)
|
||||
```
|
||||
|
||||
|
||||
# 0.44.1
|
||||
# 0.44.1 Feb 19, 2019
|
||||
|
||||
- Split primitives and types into separate folders. This should not affect external use since the exports remain the same, however does have an impact where classes are referenced directly. e.g.
|
||||
|
||||
@@ -252,45 +392,45 @@ import { Method, Signature } from '@polkadot/types';
|
||||
```
|
||||
|
||||
|
||||
# 0.43.1
|
||||
# 0.43.1 Feb 14, 2019
|
||||
|
||||
- Introduces support for the new keyring with sr25519 support in addition to ed25519. While this does not change the exposed API, it is considered breaking since @polkadot/keyring has interface changes. (Unless needed, don't rush the upgrade)
|
||||
|
||||
|
||||
# 0.42.1
|
||||
# 0.42.1 Jan 31, 2019
|
||||
|
||||
- Support for substrate hash signing with implVersion >= 18
|
||||
- Changed signatures for Extrinsic signing, this should not have (much) of an impact since it is generally not used directly. SubmittableExtrinsic (as exposed by the API), supports the old-style use.
|
||||
|
||||
|
||||
# 0.41.1
|
||||
# 0.41.1 Jan 26, 2019
|
||||
|
||||
- Support the V1 metadata specification from Substrate in addition to the currently testnet active V0 version
|
||||
|
||||
|
||||
# 0.40.1
|
||||
# 0.40.1 Jan 16, 2019
|
||||
|
||||
- The API interfaces now require a WS-compatible provider, e.g. subscription support is a must. Previously the HTTPProvider could be use (although it was very limited in the interactions).
|
||||
|
||||
|
||||
# 0.39.1
|
||||
# 0.39.1 Jan 11, 2019
|
||||
|
||||
- The Promise API now returns a `Promise<UnsubFunction>` instead of `UnsubFunction` when making subscriptions.
|
||||
|
||||
|
||||
# 0.38.1
|
||||
# 0.38.1 Jan 08, 2019
|
||||
|
||||
Substrate has been updated with a breaking new transaction format where the Index/Nonce is now encoded as a Compact. This change is being rolled out to both Alexander (Polkadot testnet) as well as Charred Cherry (Substrate testnet) - transactions between old and new are not compatible.
|
||||
|
||||
|
||||
# 0.37.1
|
||||
# 0.37.1 Jan 04, 2019
|
||||
|
||||
api-observable has been removed. This was only used in /apps and inconsistent with the api/rx and api/promise APIs. Future work will include derives like was included in api-observable into the base.
|
||||
|
||||
Tuples now return single types when only one type is available, i.e. `(AccountId)` would now resolve as `AccountId`. The extra type wrapper adds no benefit to users here.
|
||||
|
||||
|
||||
# 0.36.1
|
||||
# 0.36.1 Jan 03, 2019
|
||||
|
||||
Api Promise has been updated in the way we deal with subscriptions. Previously a subscription returned `Promise<number>` where the caller was to keep track of the id and use it in subsequent unsubscribes. Now any subscriptions return an unsubscribe/destroy function `(): void`, that is use for removing the subscriptions, e.g.
|
||||
|
||||
@@ -301,11 +441,51 @@ unsubscribe(); // here we destroy the subscription
|
||||
```
|
||||
|
||||
|
||||
# 0.35.1
|
||||
# 0.35.1 Dec 20, 2018
|
||||
|
||||
Swapped to new metadata structures from Substrate. If the API is not working with your node, update Substrate to latest master branch. (Or 0.9.1 for Charred Cherry). Dropped support for old metadata as found as far back as BBQ Birch.
|
||||
|
||||
|
||||
# 0.34.1
|
||||
# 0.34.1 Dec 18, 2018
|
||||
|
||||
Changed the send signature (for future expansion of eg. events) to return `result: { status: ExtrinsicStatus }` instead of `status: ExtrinsicStatus`. For most cases where only status `type` checks are used, i.e. `status.type === 'Finalised'` this should not be a breaking change. Deep inspection of the status object however will need to adapt.
|
||||
|
||||
# 0.33.1 Dec 06, 2018
|
||||
|
||||
# 0.32.1 Nov 21, 2018
|
||||
|
||||
# 0.31.1 Oct 10, 2018
|
||||
|
||||
# 0.30.1 Sep 27, 2018
|
||||
|
||||
# 0.29.1 Sep 14, 2018
|
||||
|
||||
# 0.28.1 Aug 11, 2018
|
||||
|
||||
# 0.15.1 Aug 07, 2018
|
||||
|
||||
# 0.14.1 Jun 23, 2018
|
||||
|
||||
# 0.13.1 May 29, 2018
|
||||
|
||||
# 0.12.1 May 18, 2018
|
||||
|
||||
# 0.11.1 May 16, 2018
|
||||
|
||||
# 0.10.1 May 07, 2018
|
||||
|
||||
# 0.9.1 Apr 24, 2018
|
||||
|
||||
# 0.8.1 Mar 15, 2018
|
||||
|
||||
# 0.7.1 Jan 25, 2018
|
||||
|
||||
# 0.6.1 Dec 03, 2017
|
||||
|
||||
# 0.5.1 Nov 28, 2017
|
||||
|
||||
# 0.4.1 Nov 19, 2017
|
||||
|
||||
# 0.3.1 Nov 19, 2017
|
||||
|
||||
# 0.2.1 Nov 18, 2017
|
||||
|
||||
@@ -27,7 +27,7 @@ The API is split up into a number of internal packages -
|
||||
|
||||
Type definitions for interfaces as exposed by Polkadot & Substrate clients -
|
||||
|
||||
- [@polkadot/jsonrpc](packages/type-jsonrpc/) Definitions for JSONRPC endpoints
|
||||
- [@polkadot/jsonrpc](packages/jsonrpc/) Definitions for JSONRPC endpoints
|
||||
- [@polkadot/types](packages/types/) Codecs for all Polkadot and Substrate primitives
|
||||
|
||||
## development
|
||||
|
||||
+90
-6
@@ -2,7 +2,91 @@
|
||||
|
||||
This is an upgrade guide for users of the API. It does not attempt to detail each version (the [CHANGELOG](CHANGELOG.md) has all the changes between versions), but rather tries to explain the rationale behind major breaking changes and how users of the API should handle this.
|
||||
|
||||
While we try to keep the user-facing interfaces as stable as possible, sometimes you just need to make additions to move forward and improve things down the road, as painful as they may be. Like you, we are also users of the API, and eat our own dogfood - and as such, feel any pains introduced first.
|
||||
While we try to keep the user-facing interfaces as stable as possible, sometimes you just need to make additions to move forward and improve things down the road, as painful as they may be. Like you, we are also users of the API, and eat our own dog food - and as such, feel any pains introduced first.
|
||||
|
||||
|
||||
## 0.97.1 (and newer)
|
||||
|
||||
The 0.97 series lays the groundwork to allow type registration to be ties to a specific chain and a specific Api instance. In the past, 2 Api instances in the same process would share types, which mean that you could not connect to 2 independent chains with different types. This is very problematic for Polkadot chains, where the idea is to connect to multiple chains.
|
||||
|
||||
When using the Api, a new `Registry` will be created on using `new Api(...)` or `Api.create(...)` and this will be transparently passed when creating types. In the cases where you create type instances explicitly or create type classes for injection, you would need to make adjustments.
|
||||
|
||||
### Type classes
|
||||
|
||||
In a number of instances, developers are creating classes and making these available for interacting with their chains. For instance, an example of a custom type could be -
|
||||
|
||||
```js
|
||||
import { Struct, Text, u32 } from '@polkadot/types';
|
||||
|
||||
export class Preferences extends Struct {
|
||||
constructor (value?: ahy) {
|
||||
super({
|
||||
name: Text,
|
||||
id: u32
|
||||
}, value);
|
||||
}
|
||||
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
In the current iteration, the underlying `@polkadot/types` bases structures now require a `Registry` to be passed as the first parameter. This means that the above signature would be adjusted to -
|
||||
|
||||
```js
|
||||
// the next import is only required for TypeScript
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { Struct, Text, u32 } from '@polkadot/types';
|
||||
|
||||
export class Preferences extends Struct {
|
||||
constructor (registry: Registry, value?: ahy) {
|
||||
super(registry, {
|
||||
name: Text,
|
||||
id: u32
|
||||
}, value);
|
||||
}
|
||||
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Where the type is used or returned from the API, the `Registry` will be automatically passed to class creation.
|
||||
|
||||
### createType
|
||||
|
||||
Previously, when creating a type instance such as `BlockNumber`, you would do `api.createType('BlockNumber', <initValue>)`, this is unchanged. In the cases where you directly import from `@polkadot/types`, the following pattern is required -
|
||||
|
||||
```js
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
...
|
||||
const blockNumber = createType(api.registry, 'BlockNumber', 12345);
|
||||
```
|
||||
|
||||
In some cases, you would want to explicitly pass a `Registry` interface to the API, instead of relying on it explicitly. This is generally applicable in the cases where you want to use the `createType` independently from the API -
|
||||
|
||||
```js
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { TypeRegistry, createType } from '@polkadot/types';
|
||||
|
||||
...
|
||||
const registry = new TypeRegistry();
|
||||
const blockNumber = createType(registry, 'BlockNumber', 12345);
|
||||
const api = await ApiPromise.create({ registry });
|
||||
```
|
||||
|
||||
### Extrinsic metadata
|
||||
|
||||
In some applications, the undocumented `findFunction` has been used to determine the Api has the metadata for a specific extrinsic. The has been exposed on top of `GenericCall`, and it typically used in applications such as signers. Along with the compulsory registry, the above functions have been moved to the `Registry` itself, so if you previously had -
|
||||
|
||||
```js
|
||||
const { meta, method, section } = GenericCall.findFunction(extrinsic.callIndex);
|
||||
```
|
||||
|
||||
You need to change it to -
|
||||
|
||||
```js
|
||||
const { meta, method, section } = registry.findMetaCall(extrinsic.callIndex);
|
||||
```
|
||||
|
||||
## 0.90.1 (and newer), from 0.81.1 (and older)
|
||||
|
||||
@@ -29,10 +113,10 @@ To better align with the actual types from the metadata, and avoid (too much) co
|
||||
|
||||
The [@polkadot/api](packages/api) has always handled the conversion of types for parameters when making calls or queries. For example, when making a transfer to `BOB` (address), any of the following is valid -
|
||||
|
||||
- `api.tx.balances.transfer(BOB, 12345)` - value specied as a number
|
||||
- `api.tx.balances.transfer(BOB, '12345')` - value specied as a string
|
||||
- `api.tx.balances.transfer(BOB, '0x3039')` - value specied as a hex
|
||||
- `api.tx.balances.transfer(BOB, new BN(12345))` - value specied as a [BN](https://github.com/indutny/bn.js/)
|
||||
- `api.tx.balances.transfer(BOB, 12345)` - value specified as a number
|
||||
- `api.tx.balances.transfer(BOB, '12345')` - value specified as a string
|
||||
- `api.tx.balances.transfer(BOB, '0x3039')` - value specified as a hex
|
||||
- `api.tx.balances.transfer(BOB, new BN(12345))` - value specified as a [BN](https://github.com/indutny/bn.js/)
|
||||
|
||||
Internally the API will take the input and convert the value into a `Balance`, serialize it using the SCALE codec and transfer it to the node. In some cases users would construct the `Balance` type manually, by importing the class and calling `new` on it. This last approach has now been removed, and where classes are still available (limited reach), discouraged.
|
||||
|
||||
@@ -108,7 +192,7 @@ export class MyStruct extends Struct {
|
||||
}
|
||||
```
|
||||
|
||||
Internally the [@polkadot/types](packages/types) package now only defines classes where there are specific encoding logic applied. For all other types, the definitions are done via a JSON-like format and then the TypeScript definitions are generated from these. (In a world where nodes inject types and the type definitions are not needed, this functionality will be useful to allow TS devs to auto-generate type definitions based on what the node defines.)
|
||||
Internally the [@polkadot/types](packages/types) package now only defines classes where there are specific encoding logic applied. For all other types, the definitions are done via a JSON-like format and then the TypeScript definitions are generated from these. (In a world where nodes inject types and the type definitions are not needed, this functionality will be useful to allow TS developers to auto-generate type definitions based on what the node defines.)
|
||||
|
||||
### Signing transactions (Signer interface)
|
||||
|
||||
|
||||
+1
-3
@@ -1,3 +1 @@
|
||||
module.exports = {
|
||||
extends: '@polkadot/dev/config/babel'
|
||||
};
|
||||
module.exports = require('@polkadot/dev/config/babel');
|
||||
|
||||
+10
-9
@@ -2,7 +2,7 @@
|
||||
|
||||
function copy_folder () {
|
||||
SRC="packages/$1/build"
|
||||
DST="../apps/node_modules/@polkadot/$2"
|
||||
DST="../apps/node_modules/@polkadot/$1"
|
||||
|
||||
echo "** Copying $SRC to $DST"
|
||||
|
||||
@@ -12,11 +12,12 @@ function copy_folder () {
|
||||
|
||||
yarn polkadot-dev-build-ts
|
||||
|
||||
copy_folder "api" "api"
|
||||
copy_folder "api-contract" "api-contract"
|
||||
copy_folder "api-derive" "api-derive"
|
||||
copy_folder "api-metadata" "api-metadata"
|
||||
copy_folder "rpc-core" "rpc-core"
|
||||
copy_folder "rpc-provider" "rpc-provider"
|
||||
copy_folder "type-jsonrpc" "jsonrpc"
|
||||
copy_folder "types" "types"
|
||||
copy_folder "api"
|
||||
copy_folder "api-contract"
|
||||
copy_folder "api-derive"
|
||||
copy_folder "metadata"
|
||||
copy_folder "rpc-core"
|
||||
copy_folder "rpc-provider"
|
||||
copy_folder "jsonrpc"
|
||||
copy_folder "types"
|
||||
copy_folder "typegen"
|
||||
|
||||
@@ -43,8 +43,10 @@ module.exports = {
|
||||
['start/api.tx.wrap.md', 'Complex transactions'],
|
||||
['start/types.basics.md', 'Type basics'],
|
||||
['start/types.extend.md', 'Extending types'],
|
||||
['start/types.create.md', 'Creating types'],
|
||||
['start/extrinsic.extend.md', 'Extending extrinsics'],
|
||||
['start/typescript.md', 'TypeScript interfaces'],
|
||||
['start/typescript.user.md', 'TypeScript user generated'],
|
||||
['start/FAQ.md', 'FAQ']
|
||||
]
|
||||
},
|
||||
@@ -67,6 +69,7 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
title: 'Substrate defaults',
|
||||
path: '/substrate/',
|
||||
collapsable: false,
|
||||
sidebarDepth: 0,
|
||||
children: [
|
||||
@@ -74,7 +77,8 @@ module.exports = {
|
||||
['substrate/constants.md', 'Constants'],
|
||||
['substrate/storage.md', 'State storage'],
|
||||
['substrate/extrinsics.md', 'Extrinsics'],
|
||||
['substrate/events.md', 'System events']
|
||||
['substrate/events.md', 'System events'],
|
||||
['substrate/errors.md', 'Errors']
|
||||
]
|
||||
},
|
||||
['/api/', '@polkadot/api'],
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
- [Type basics](start/types.basics.md)
|
||||
- [Type extension](start/types.extend.md)
|
||||
- [TypeScript interfaces](start/typescript.md)
|
||||
- [TypeScript user generated](start/typescript.user.md)
|
||||
|
||||
## Packages
|
||||
|
||||
|
||||
@@ -13,21 +13,23 @@ async function main () {
|
||||
|
||||
// Retrieve the initial balance. Since the call has no callback, it is simply a promise
|
||||
// that resolves to the current on-chain value
|
||||
let previous = await api.query.balances.freeBalance(Alice);
|
||||
let { nonce: previousNonce, data: { free: previousFree } } = await api.query.system.account(Alice);
|
||||
|
||||
console.log(`${Alice} has a balance of ${previous}`);
|
||||
console.log(`${Alice} has a balance of ${previousFree}, nonce ${previousNonce}`);
|
||||
console.log(`You may leave this example running and start example 06 or transfer any value to ${Alice}`);
|
||||
|
||||
// Here we subscribe to any balance changes and update the on-screen value
|
||||
api.query.balances.freeBalance(Alice, (current) => {
|
||||
api.query.system.account(Alice, ({ nonce: currentNonce, data: { free: currentFree } }) => {
|
||||
// Calculate the delta
|
||||
const change = current.sub(previous);
|
||||
const change = currentFree.sub(previousFree);
|
||||
|
||||
// Only display positive value changes (Since we are pulling `previous` above already,
|
||||
// the initial balance change will also be zero)
|
||||
if (!change.isZero()) {
|
||||
previous = current;
|
||||
console.log(`New balance change of: ${change}`);
|
||||
console.log(`New balance change of ${change}, nonce ${currentNonce}`);
|
||||
|
||||
previousFree = currentFree;
|
||||
previousNonce = currentNonce;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ async function main () {
|
||||
console.log('Tracking balances for:', [ALICE, BOB]);
|
||||
|
||||
// Subscribe and listen to several balance changes
|
||||
api.query.balances.freeBalance.multi([ALICE, BOB], (balances) => {
|
||||
console.log('Change detected, new balances: ', balances);
|
||||
api.query.system.account.multi([ALICE, BOB], (balances) => {
|
||||
console.log('Change detected, new balances: ', balances.map(({ data: { free } }) => free));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ async function main () {
|
||||
const api = await ApiPromise.create();
|
||||
|
||||
// Make our basic chain state/storage queries, all in one go
|
||||
const [accountNonce, now, validators] = await Promise.all([
|
||||
api.query.system.accountNonce(ALICE),
|
||||
const [{ nonce: accountNonce }, now, validators] = await Promise.all([
|
||||
api.query.system.account(ALICE),
|
||||
api.query.timestamp.now(),
|
||||
api.query.session.validators()
|
||||
]);
|
||||
@@ -25,14 +25,15 @@ async function main () {
|
||||
// Retrieve the balances for all validators
|
||||
const validatorBalances = await Promise.all(
|
||||
validators.map(authorityId =>
|
||||
api.query.balances.freeBalance(authorityId)
|
||||
api.query.system.account(authorityId)
|
||||
)
|
||||
);
|
||||
|
||||
// Print out the authorityIds and balances of all validators
|
||||
console.log('validators', validators.map((authorityId, index) => ({
|
||||
address: authorityId.toString(),
|
||||
balance: validatorBalances[index].toString()
|
||||
balance: validatorBalances[index].data.free.toHuman(),
|
||||
nonce: validatorBalances[index].nonce.toHuman()
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@ async function main () {
|
||||
|
||||
// Retrieve the balance at the preceding block for Alice. For at queries
|
||||
// the format is always `.at(<blockhash>, ...params)`
|
||||
const balance = await api.query.balances.freeBalance.at(parentHash, ALICE);
|
||||
const balance = await api.query.system.account.at(parentHash, ALICE);
|
||||
|
||||
console.log(`Alice's balance at ${parentHash.toHex()} was ${balance}`);
|
||||
console.log(`Alice's balance at ${parentHash.toHex()} was ${balance.data.free}`);
|
||||
|
||||
// Now perform a multi query, returning multiple balances at once
|
||||
const balances = await api.query.balances.freeBalance.multi([ALICE, BOB]);
|
||||
const balances = await api.query.system.account.multi([ALICE, BOB]);
|
||||
|
||||
console.log(`Current balances for Alice and Bob are ${balances[0]} and ${balances[1]}`);
|
||||
console.log(`Current balances for Alice and Bob are ${balances[0].data.free} and ${balances[1].data.free}`);
|
||||
}
|
||||
|
||||
main().catch(console.error).finally(() => process.exit());
|
||||
|
||||
@@ -19,7 +19,7 @@ async function main () {
|
||||
const alice = keyring.addFromUri('//Alice');
|
||||
|
||||
// Get nonce for account
|
||||
const nonce = await api.query.system.accountNonce(alice.address);
|
||||
const { nonce } = await api.query.system.account(alice.address);
|
||||
|
||||
// Get current block
|
||||
const signedBlock = await api.rpc.chain.getBlock();
|
||||
|
||||
@@ -24,7 +24,7 @@ async function main () {
|
||||
const keyring = testKeyring.default();
|
||||
|
||||
// Get the nonce for the admin key
|
||||
const nonce = await api.query.system.accountNonce(ALICE);
|
||||
const { nonce } = await api.query.system.account(ALICE);
|
||||
|
||||
// Find the actual keypair in the keyring
|
||||
const alicePair = keyring.getPair(ALICE);
|
||||
@@ -40,13 +40,15 @@ async function main () {
|
||||
.signAndSend(alicePair, { nonce }, ({ events = [], status }) => {
|
||||
console.log('Transaction status:', status.type);
|
||||
|
||||
if (status.isFinalized) {
|
||||
console.log('Completed at block hash', status.asFinalized.toHex());
|
||||
if (status.isInBlock) {
|
||||
console.log('Included at block hash', status.asInBlock.toHex());
|
||||
console.log('Events:');
|
||||
|
||||
events.forEach(({ phase, event: { data, method, section } }) => {
|
||||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
|
||||
});
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -39,15 +39,15 @@ async function main () {
|
||||
.signAndSend(adminPair, ({ events = [], status }) => {
|
||||
console.log('Proposal status:', status.type);
|
||||
|
||||
if (status.isFinalized) {
|
||||
if (status.isInBlock) {
|
||||
console.error('You have just upgraded your chain');
|
||||
|
||||
console.log('Completed at block hash', status.asFinalized.toHex());
|
||||
console.log('Included at block hash', status.asInBlock.toHex());
|
||||
console.log('Events:');
|
||||
|
||||
events.forEach(({ phase, event: { data, method, section } }) => {
|
||||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
|
||||
});
|
||||
console.log(JSON.stringify(events.toHuman(), null, 2));
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ async function main () {
|
||||
|
||||
// Here we subscribe to any balance changes and update the on-screen value.
|
||||
// We're using RxJs pairwise() operator to get the previous and current values as an array.
|
||||
api.query.balances.freeBalance(Alice)
|
||||
api.query.system.account(Alice)
|
||||
.pipe(
|
||||
// since pairwise only starts emitting values on the second emission, we prepend an
|
||||
// initial value with the startWith() operator to be able to also receive the first value
|
||||
@@ -25,12 +25,13 @@ async function main () {
|
||||
if (balance[0] === 'first') {
|
||||
// Now we know that if the previous value emitted as balance[0] is `first`,
|
||||
// then balance[1] is the initial value of Alice account.
|
||||
console.log(`Alice ${Alice} has a balance of ${balance[1]}`);
|
||||
console.log(`Alice ${Alice} has a balance of ${balance[1].data.free}`);
|
||||
console.log('You may leave this example running and start the "Make a transfer" example or transfer any value to Alice address');
|
||||
return;
|
||||
}
|
||||
|
||||
const change = balance[1].sub(balance[0]);
|
||||
const change = balance[1].data.free.sub(balance[0].date.free);
|
||||
|
||||
// Only display value changes
|
||||
if (!change.isZero()) {
|
||||
console.log(`New balance change of: ${change}`);
|
||||
|
||||
@@ -22,13 +22,13 @@ function main () {
|
||||
// In the next step, we're checking if the node has active validators.
|
||||
// If it does, we're making another call to the api to get the balances for all validators
|
||||
const balances = (validators && validators.length > 0)
|
||||
? combineLatest(validators.map(authorityId => api.query.balances.freeBalance(authorityId).pipe(first())))
|
||||
? combineLatest(validators.map(authorityId => api.query.system.account(authorityId).pipe(first())))
|
||||
: of(null);
|
||||
|
||||
// We're combining the results together with the emitted value 'validators',
|
||||
// which we're turning back into an observable using of()
|
||||
return combineLatest(
|
||||
api.query.system.accountNonce(Alice).pipe(first()),
|
||||
api.query.system.account(Alice).pipe(first()),
|
||||
api.query.timestamp.blockPeriod().pipe(first()),
|
||||
of(validators),
|
||||
balances
|
||||
@@ -36,15 +36,16 @@ function main () {
|
||||
})
|
||||
)
|
||||
// Then we're subscribing to the emitted results
|
||||
.subscribe(([accountNonce, blockPeriod, validators, validatorBalances]) => {
|
||||
console.log(`accountNonce(${Alice}) ${accountNonce}`);
|
||||
.subscribe(([{ nonce }, blockPeriod, validators, validatorBalances]) => {
|
||||
console.log(`accountNonce(${Alice}) ${nonce}`);
|
||||
console.log(`blockPeriod ${blockPeriod.toNumber()} seconds`);
|
||||
|
||||
if (validatorBalances) {
|
||||
// And lastly we print out the authorityIds and balances of all validators
|
||||
console.log('validators', validators.map((authorityId, index) => ({
|
||||
address: authorityId.toString(),
|
||||
balance: validatorBalances[index].toString()
|
||||
balance: validatorBalances[index].data.free.toString(),
|
||||
nonce: validatorBalances[index].data.toString()
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -25,9 +25,14 @@ async function main () {
|
||||
.signAndSend(alice)
|
||||
// Subscribe to the status updates of the transfer
|
||||
.subscribe(({ status }) => {
|
||||
if (status.isFinalized) {
|
||||
console.log(`Successful transfer of 12345 from Alice to Bob with hash ${status.asFinalized.toHex()}`);
|
||||
if (status.isInBlock) {
|
||||
console.log(`Successful transfer of 12345 from Alice to Bob at block ${status.asInBlock.toHex()}`);
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
subscription.unsubscribe();
|
||||
|
||||
process.exit(0);
|
||||
} else {
|
||||
console.log(`Status of transfer: ${status.type}`);
|
||||
}
|
||||
|
||||
@@ -44,13 +44,17 @@ async function main () {
|
||||
console.log('Transfer status:', status.type);
|
||||
|
||||
// Log system events once the transfer is finalised
|
||||
if (status.isFinalized) {
|
||||
console.log('Completed at block hash', status.asFinalized.toHex());
|
||||
if (status.isInBlock) {
|
||||
console.log('Included at block hash', status.asInBlock.toHex());
|
||||
console.log('Events:');
|
||||
|
||||
events.forEach(({ phase, event: { data, method, section } }) => {
|
||||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
|
||||
});
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,16 +40,16 @@ async function main () {
|
||||
// Log transfer events
|
||||
console.log('Proposal status:', status.type);
|
||||
|
||||
if (status.isFinalized) {
|
||||
if (status.isInBlock) {
|
||||
console.error('You have just upgraded your chain');
|
||||
|
||||
console.log('Completed at block hash', status.asFinalized.toHex());
|
||||
console.log('Included at block hash', status.asInBlock.toHex());
|
||||
console.log('Events:');
|
||||
|
||||
// Log system events once the chain update is finalised
|
||||
events.forEach(({ phase, event: { data, method, section } }) => {
|
||||
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
|
||||
});
|
||||
console.log(JSON.stringify(events.toHuman(), null, 2));
|
||||
} else if (status.isFinalized) {
|
||||
console.log('Finalized block hash', status.asFinalized.toHex());
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@@ -33,3 +33,11 @@ Tuples, as defined in the Polkadot/Substrate types appear as `(TypeA, TypeB)`. F
|
||||
Polkadot/Substrate supports both immortal and mortal transactions. For immortal, this means that the transaction has an infinite lifetime, for mortals, the transactions expire after a defined period. By default the API sends mortal transactions when no explicit extrinsic era has been specified. This means that all transaction has a limited lifetime and will expire if not included in the period set.
|
||||
|
||||
The length for this transaction validity is set to 50 blocks, which translates to 5 minutes assuming a default of 6 second blocktimes. (10 blocks per minute in this default configuration).
|
||||
|
||||
## My chain does not support system.account queries
|
||||
|
||||
The API always tracks the latest Substrate master in terms of examples. This means that nonce & balance queries are done via the `api.query.system.account(<account>)` which returns a struct `{ nonce: Index, data: AccountData }` where the `data` is struct containing the free and reserved balances. As with all `api.query.*` endpoints, this is decorated based on what the chain you connect to support, via the metadata exchange.
|
||||
|
||||
It is possible that you are connecting to an older chain that has not been upgraded yet. For these chains, this storage entry won't be available (yet). To query the nonce on older chains, you can do a query to `api.query.system.accountNonce(<account>)` and balances can be retrieved via `api.query.balances.freeBalance(<account>)`.
|
||||
|
||||
Likewise, if your chain has been upgraded recently and you are still using the old `system.accountNonce` or `balances.freeBalance` queries in your code (which is now not available in the chain metadata), you need to update it to query the new location.
|
||||
|
||||
+6
-10
@@ -16,24 +16,20 @@ const ADDR = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE';
|
||||
// Retrieve the last timestamp
|
||||
const now = await api.query.timestamp.now();
|
||||
|
||||
// Retrieve the account nonce via the system module
|
||||
const nonce = await api.query.system.accountNonce(ADDR);
|
||||
// Retrieve the account balance & nonce via the system module
|
||||
const { nonce, data: balance } = await api.query.system.account(ADDR);
|
||||
|
||||
// Retrieve the account balance via the balances module
|
||||
const balance = await api.query.balances.freeBalance(ADDR);
|
||||
|
||||
console.log(`${now}: balance of ${balance} and a nonce of ${nonce}`);
|
||||
console.log(`${now}: balance of ${balance.free} and a nonce of ${nonce}`);
|
||||
```
|
||||
|
||||
There have been some additions in the code above comparing with retrieving runtime constants. In these cases, since we are making a query to the actual chain, we use the `await` syntax to retrieve the information. Since the API is Promise-based, this means we can also rewrite the above to follow a Promise pattern,
|
||||
|
||||
```js
|
||||
...
|
||||
// Retrieve last block timestamp, account nonce & balance
|
||||
const [now, nonce, balance] = await Promise.all([
|
||||
// Retrieve last block timestamp, account nonce & balances
|
||||
const [now, { nonce, data: balances }] = await Promise.all([
|
||||
api.query.timestamp.now(),
|
||||
api.query.system.accountNonce(ADDR),
|
||||
api.query.balances.freeBalance(ADDR)
|
||||
api.query.system.account(ADDR)
|
||||
]);
|
||||
```
|
||||
|
||||
|
||||
@@ -10,14 +10,14 @@ Where possible, the use of multi queries are encouraged since it tracks a number
|
||||
...
|
||||
|
||||
// Subscribe to balance changes for 2 accounts, ADDR1 & ADDR2 (already defined)
|
||||
const unsub = await api.query.balances.freeBalance.multi([ADDR1, ADDR2], (balances) => {
|
||||
const [balance1, balance2] = balances;
|
||||
const unsub = await api.query.system.account.multi([ADDR1, ADDR2], (balances) => {
|
||||
const [{ data: balance1 }, { data: balance2 }] = balances;
|
||||
|
||||
console.log(`The balances are ${balance1} and ${balance2}`);
|
||||
console.log(`The balances are ${balance1.free} and ${balance2.free}`);
|
||||
});
|
||||
```
|
||||
|
||||
A couple of items to note in the example above: we don't call `freeBalance` directly, but rather `freeBalance.multi`. We pass the addresses we want to query as an array, and the length thereof would depend on the number of addresses we want to query. As an extended example, we can track the balances of a list of validators,
|
||||
A couple of items to note in the example above: we don't call `account` directly, but rather `account.multi`. We pass the addresses we want to query as an array, and the length thereof would depend on the number of addresses we want to query. As an extended example, we can track the balances of a list of validators,
|
||||
|
||||
```js
|
||||
...
|
||||
@@ -26,8 +26,8 @@ A couple of items to note in the example above: we don't call `freeBalance` dire
|
||||
const validators = await api.query.session.validators();
|
||||
|
||||
// Subscribe to the balances for these accounts
|
||||
const unsub = await api.query.balances.freeBalance.multi(validators, (balances) => {
|
||||
console.log(`The balances are: ${balances}`);
|
||||
const unsub = await api.query.balances.account.multi(validators, (balances) => {
|
||||
console.log(`The nonce and free balances are: ${balances.map(([nonce, { free }]) => [nonce, free])}`);
|
||||
});
|
||||
```
|
||||
|
||||
@@ -43,17 +43,16 @@ The previous `.multi` examples assumes that we do queries for the same types, i.
|
||||
// Subscribe to the timestamp, our index and balance
|
||||
const unsub = await api.queryMulti([
|
||||
api.query.timestamp.now,
|
||||
[api.query.system.accountNonce, ADDR],
|
||||
[api.query.balances.freeBalance, ADDR]
|
||||
], ([now, nonce, balance]) => {
|
||||
console.log(`${now}: balance of ${balance} and a nonce of ${nonce}`);
|
||||
[api.query.system.account, ADDR]
|
||||
], ([now, { nonce, data: balance }]) => {
|
||||
console.log(`${now}: balance of ${balance.free} and a nonce of ${nonce}`);
|
||||
});
|
||||
```
|
||||
|
||||
The above example certainly does not quite look as ergonomic and clean, but the API needs to understand (a) which are all the calls we need to make and (b) the calls and their params (if required). So breaking it down -
|
||||
|
||||
- `api.query.timestamp.now` - the timestamp is passed naked without any params. Also note that we do not call it while passing, but rather only provides a reference to the function, i.e. we do not have the expected `()` at the end. (This could also be of the form `[api.query.timestamp.now]`, aligning with subsequent entries)
|
||||
- `[api.query.system.accountNonce, ADDR]` - the nonce query is passed as an array containing the function (once again naked), followed by the parameters that apply.
|
||||
- `[api.query.system.account, ADDR]` - the nonce & balance query is passed as an array containing the function (once again naked), followed by the parameters that apply.
|
||||
|
||||
## Rounding out queries
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ Quite often is is useful (taking pruning into account, more on this later) to re
|
||||
const lastHdr = await api.rpc.chain.getHeader();
|
||||
|
||||
// Retrieve the balance at both the current and the parent hashes
|
||||
const [balanceNow, balancePrev] = await Promise.all([
|
||||
api.query.balances.freeBalance.at(lastHdr.hash, ADDR),
|
||||
api.query.balances.freeBalance.at(lastHdr.parentHash, ADDR)
|
||||
const [{ data: balanceNow }, { data: balancePrev }] = await Promise.all([
|
||||
api.query.system.account.at(lastHdr.hash, ADDR),
|
||||
api.query.system.account.at(lastHdr.parentHash, ADDR)
|
||||
]);
|
||||
|
||||
// Display the difference
|
||||
console.log(`The delta was ${balanceNow.sub(balancePrev)}`);
|
||||
console.log(`The delta was ${balanceNow.free.sub(balancePrev.free)}`);
|
||||
```
|
||||
|
||||
In the above example, we introduce the `.at(<hash>[, ...params])` query. For all `.at` queries, the first parameter is always the block hash at which we want to make the query, in our example we use both the last retrieved block and the parent thereof. The params are optional as per the type of query made, for instance to retrieve the timestamp for a previous block, it would be -
|
||||
@@ -44,8 +44,8 @@ In addition to using `api.query` to make actual on-chain queries, it can also be
|
||||
|
||||
// Retrieve the hash & size of the entry as stored on-chain
|
||||
const [entryHash, entrySize] = await Promise.all([
|
||||
api.query.balances.freeBalance.hash(ADDR),
|
||||
api.query.balances.freeBalance.size(ADDR)
|
||||
api.query.system.account.hash(ADDR),
|
||||
api.query.system.account.size(ADDR)
|
||||
]);
|
||||
|
||||
// Output the info
|
||||
@@ -60,11 +60,11 @@ It has been explained that the `api.query` interfaces are decorated from the met
|
||||
|
||||
```js
|
||||
// Extract the info
|
||||
const { meta, method, section } = api.query.balances.freeBalance;
|
||||
const { meta, method, section } = api.query.system.account;
|
||||
|
||||
// Display some info on a specific entry
|
||||
console.log(`${section}.${method}: ${meta.documentation.join(' ')}`);
|
||||
console.log(`query key: ${api.query.balances.freeBalance.key(ADDR)}`);
|
||||
console.log(`query key: ${api.query.system.account.key(ADDR)}`);
|
||||
```
|
||||
|
||||
The `section` & `method` is an indication of where it is exposed on the API. In addition the `meta` holds an array with the metadata documentation for the entry.
|
||||
|
||||
@@ -25,8 +25,8 @@ If we had a query with parameters, i.e. where we wish to perform a query for a s
|
||||
...
|
||||
|
||||
// Subscribe to balance changes for our account
|
||||
const unsub = await api.query.balances.freeBalance(ADDR, (balance) => {
|
||||
console.log(`Your account balance is ${balance}`);
|
||||
const unsub = await api.query.system.account(ADDR, ({ nonce, data: balance }) => {
|
||||
console.log(`free balance is ${balance.freee} with ${balance.reserved} reserved and a nonce of ${nonce}`);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ The result for this call (we will deal with subscriptions in a short while), is
|
||||
|
||||
Despite the single-line format of `signAndSend`, there is a lot happening under the hood (and all of this can be manually provided) -
|
||||
|
||||
- Based on the sender, the API will retrieve the `system.accountNonce` to determine the next nonce to use
|
||||
- Based on the sender, the API will query `system.account` (or `system.accountNonce` on older chains) to determine the next nonce to use
|
||||
- The API will retrieve the current block hash and use it to create a mortal transaction, i.e. the transaction will only be valid for a limited number of blocks (by default this is 5 mins at 6s block times)
|
||||
- It will construct a payload and sign this, this includes the `genesisHash`, the `blockHash` for the start of the mortal era as well as the current chain `specVersion`
|
||||
- The transaction is submitted to the node
|
||||
|
||||
@@ -18,8 +18,10 @@ const unsub = await api.tx.balances
|
||||
.signAndSend(alice, (result) => {
|
||||
console.log(`Current status is ${result.status}`);
|
||||
|
||||
if (result.status.isFinalized) {
|
||||
console.log(`Transaction included at blockHash ${result.status.asFinalized}`);
|
||||
if (result.status.isInBlock) {
|
||||
console.log(`Transaction included at blockHash ${result.status.asInBlock}`);
|
||||
} else if (result.status.isFinalized) {
|
||||
console.log(`Transaction finalized at blockHash ${result.status.asFinalized}`);
|
||||
unsub();
|
||||
}
|
||||
});
|
||||
@@ -27,7 +29,7 @@ const unsub = await api.tx.balances
|
||||
|
||||
As per all previous subscriptions, the transaction subscription returns in `unsub()` and the actual method has a subscription callback. The `result` object has 2 parts, `events` (to to covered in the next section) and the `status` enum.
|
||||
|
||||
When the `status` enum is in `Finalized` state (checked via `isFinalized`), the underlying value contains the block hash of the block where the transaction has been included. This does not mean the block is finalized, but rather applies to the transaction state, as no further updates will be received for this subscription.
|
||||
When the `status` enum is in `Finalized` state (checked via `isFinalized`), the underlying value contains the block hash of the block where the transaction has been finalized. `Finalized` will follow `InBlock`, which is the block where the transaction has been included. `InBlock` does not mean the block is finalized, but rather applies to the transaction state, where `Finalized` means that the transaction cannot be forked off the chain.
|
||||
|
||||
## Transaction events
|
||||
|
||||
|
||||
@@ -6,14 +6,16 @@ To unpack this, we will start with the Metadata and explain what it actually pro
|
||||
|
||||
## Metadata
|
||||
|
||||
When the API connects to a node, one of the first things it does is to retrieve the metadata. The metadata, effectively provides data in the form of `api.<type>.<module>.<section>` that fits into one of the following categories -
|
||||
When the API connects to a node, one of the first things it does is to retrieve the metadata and decorate the API based on the metadata information. The metadata effectively provides data in the form of `api.<type>.<module>.<section>` that fits into one of the following categories -
|
||||
|
||||
- [consts](../substrate/constants.md) - All runtime constants, e.g. `api.consts.balances.creationFee`. These are not functions, rather accessing the endpoint immediately yields the result as defined.
|
||||
- [query](../substrate/storage.md) - All chain state, e.g. `api.query.balances.freeBalance(<accountId>)`.
|
||||
- [consts](../substrate/constants.md) - All runtime constants, e.g. `api.consts.balances.existentialDeposit`. These are not functions, rather accessing the endpoint immediately yields the result as defined.
|
||||
- [query](../substrate/storage.md) - All chain state, e.g. `api.query.system.account(<accountId>)`.
|
||||
- [tx](../substrate/extrinsics.md) - All extrinsics, e.g. `api.tx.balances.transfer(<accountId>, <value>)`.
|
||||
|
||||
Additionally the metadata also provides information on [events](../substrate/events.md), these are query-able via the `api.query.system.events()` interface and also appear on transactions... both these cases are detailed later.
|
||||
|
||||
None of the information contained within the `api.{consts, query, tx}.<module>.<method>` endpoints are hard coded in the API. Rather everything is fully decorated by what the metadata exposes and is therefore completely dynamic. This means that when you connect to different chains, the metadata and API decoration will change and the API interfaces will reflect what is available on the chain you are connected to.
|
||||
|
||||
## Types
|
||||
|
||||
The metadata defines the calls with all the type names used in the various interfaces. At the moment (this is undergoing investigations and could improve in future versions of metadata), this also means that the types between the API and the node need to be aligned. For instance, by default Substrate defines a `BlockNumber` type as a `u32` and the API follows the Substrate defaults - if a chain has a different definitions, the API needs to be aware of this so it can actually decode (and encode) the type.
|
||||
|
||||
@@ -68,6 +68,12 @@ await api.isReady;
|
||||
console.log(api.genesisHash.toHex());
|
||||
```
|
||||
|
||||
## Failures
|
||||
|
||||
In all cases the API will handle reconnections automatically. This means that when you connect and the endpoint is not (yet) ready, the promise will not resolve immediately, but rather when connected. The same applies to when connection is lost, the API will manage re-connections.
|
||||
|
||||
In cases where the API does not support the chain being connected to, such as it using an unknown metadata version, the ready promise will fail to resolve and instead reject.
|
||||
|
||||
## Advanced creation
|
||||
|
||||
There are more advanced cases where you would prefer to use the longer version, for instance: if you want to explicitly listen to events emitted, you probably want to attach to the API even before connecting to the chain. All API instances implement an `EventEmitter` interface, with `on` handlers, which emit `connected`, `disconnected`, `ready` and `error` events, allowing you to listen to events on the transport layer.
|
||||
|
||||
@@ -27,7 +27,7 @@ For example:
|
||||
|
||||
```js
|
||||
const { metadata } = await api.rpc.state.getMetadata();
|
||||
const modules = metadata.asV3.modules;
|
||||
const modules = metadata.asLatest.modules;
|
||||
|
||||
// This will not work, because `name` is an instance of `Text`, not a string
|
||||
// const system = modules.find(m => m.name === 'system');
|
||||
@@ -79,6 +79,8 @@ const [count, accountId] = tuple;
|
||||
console.log(`${accountId} has ${count.toNumber()} values`);
|
||||
```
|
||||
|
||||
When making a call that expect a `Tuple` input, pass it as an array, so to pass the example above into a call, it would be `.call([123, '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'])`
|
||||
|
||||
## Extending types
|
||||
|
||||
For customized chains, the need exists to register types so the API is aware of how to decode values for those types. The next section will provide a [walk-through for the definition of custom types](types.extend.md) allowing the definition or re-definition of any type the API is aware of.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# Type creation
|
||||
|
||||
Circling back to metadata. There are two important things to remember when using the API to make queries or send transactions.
|
||||
|
||||
1. The functionality available, e.g. exposed on `api.query.*` is not hard-coded in the API, rather this is decorated from the chain metadata. So the metadata lets the API know which endpoints are available and what the type for those endpoints are.
|
||||
|
||||
2. When you supply a value to the API, internally it will convert that value to the correct type as expected by the chain, i.e. as determined by the metadata. This means that a function such as `balances.transfer(address: Address, value: Balance)` can take at least the following inputs, which are all converted to the correct types -
|
||||
|
||||
- `address` can be an `Address`, an `AccountId`, an `Uint8Array` publicKey, a hex publicKey or an ss58 formatted address;
|
||||
- `value` can be a `Balance`, a value encoded in hex, a `BN` object, a base-10 string, a JS `number`, a JS `BigInt` or even a SCALE-encoded `Uint8Array`
|
||||
|
||||
In cases where a value is returned such as storage queries, the response from the chain is always encoded into the correct `Codec` type. This means that while the node may return an encoded block (with encoded extrinsics) via `api.rpc.chain.getBlock()`, this is decoded into a proper `SignedBlock` by the API. Outputting this value via `.toJSON()` will yield an encoding for RPC, so if you are not using TypeScript (which adds code helpers on decoded objects), a representation via `.toHuman()` will be more representative of the actual object fields, re-formatted for human consumption.
|
||||
|
||||
## Why create types
|
||||
|
||||
With the conversions done in the API, there are limited reasons to create types "manually". However, just because there are not thousands of reasons, does not mean it is not valid. For instance, you may retrieve an `Option` and for the sake of sanity would like to use `.unwrapOr()` on it, returning a `Codec` default value where the value `.isNone`.
|
||||
|
||||
```js
|
||||
// type import for TypeScript
|
||||
import type { Balance } from '@polkadot/types/interfaces';
|
||||
|
||||
...
|
||||
// unwrap out option into a zero Balance whn not found
|
||||
const balance: Balance = balanceOpt.unwrapOr(api.createType('Balance'));
|
||||
```
|
||||
|
||||
In the example above, we introduced the `api.createType(<typeName>, [<value>])`. The same format is also exposed by the `TypeRegistry` (more on this in a short while) as well as `createType(...)` from the actual `@polkadot/types` package. All doing exactly the same.
|
||||
|
||||
## Choosing how to create
|
||||
|
||||
In most cases, you would always want to use the `api.createType` helper. What this does is call the underlying `@polkadot/types` `createType`, passing through the registry that is attached to the API. Registry? Yes, registry.
|
||||
|
||||
The registry contains a listing of all internal types and their classes that have been registered. So upon creation of an API instance, a `registry` object is attached to the API and this is passed through to all created types. This allows the type definitions to not pollute the global namespace, but rather be contained and able to reference one another.
|
||||
|
||||
As mentioned, the `createType` functions all do exactly the same, and it 99.99% of the cases you would be recommended to just forget about everything and use `api.createType` if and when required. In some cases, you may just have a type object and from that want to create another type instance. For that you can access the `registry` on the type object and call `createType` on it. (If this type object was created from an API instance, the registry on the type and on the API will point to the same instance.)
|
||||
|
||||
Basically, this means that we have equivalency in creation for all the items below, all creating on the same registry (containing all injected types), and all wrapping the same value -
|
||||
|
||||
```js
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
// via API (recommended)
|
||||
api.createType('Balance', 123);
|
||||
|
||||
// via registry (`.registry` is on all API and Codec objects)
|
||||
api.registry.createType('Balance', 123n);
|
||||
|
||||
// via the low-level approach
|
||||
createType(api.registry, 'Balance', '123');
|
||||
```
|
||||
|
||||
## Extending extrinsics
|
||||
|
||||
On customized chains, it is possible to [extend the format of the extrinsics and extrinsic payload for the chain](extrinsic.extend.md), next up we will look at this advanced use-case.
|
||||
@@ -137,6 +137,6 @@ const api = await ApiPromise.create({
|
||||
|
||||
`Balance` would be defined as an `u128` at the end. Effectively based on the flow it is first registered as a `u32`, then overridden as a `u64` and finally overridden once more as a `u128` by the chain types.
|
||||
|
||||
## Extending extrinsics
|
||||
## Type creation
|
||||
|
||||
On customized chains, it is possible to [extend the format of the extrinsics and extrinsic payload as customized on the chain](extrinsic.extend.md), next up we will look at this advanced use-case.
|
||||
While the API always converts all the inputs into the underlying type required by the operation, in some cases you may want to [cret an instance of a type](types.create.md) yourself.
|
||||
|
||||
@@ -30,27 +30,14 @@ For any interface injected by metadata, the types are not available by default (
|
||||
However, to make this sane from a developer perspective the injected methods are generic, effectively making the following possible -
|
||||
|
||||
```js
|
||||
import { Balance, Index } from '@polkadot/types/interfaces';
|
||||
import { AccountData, Index } from '@polkadot/types/interfaces';
|
||||
|
||||
...
|
||||
const nonce = await api.query.system.accountNonce<Index>(ADDR);
|
||||
const balance = await api.query.balances.freeBalance<Balance>(ADDR);
|
||||
const { nonce, data: balances } = await api.query.system.account<[Index, AccountData]>(ADDR);
|
||||
```
|
||||
|
||||
In both these case we can instruct the TypeScript compiler that the type we are expecting in `Index` and `Balance` respectively, not just pure `Codec`. This means that functions like `.toNumber()` is available on both these types - as opposed to just the [general type defaults](types.basics.md#everything-is-a-type) with `.toHex()` and friends.
|
||||
|
||||
## Future work
|
||||
## Adding user types
|
||||
|
||||
As of this writing, there are still some gray areas to type detection, specifically around the following interfaces -
|
||||
|
||||
- `.at` & `.multi` on `api.query` does not (yet) have a `<TypeOverride>` interface. This means `as <TypeOverride>` casts are presently needed for these results
|
||||
- `api.queryMulti` does not (yet) allow you to provide a hint to the types returned, this ties to the previous point
|
||||
|
||||
In addition to expanding the type coverage, we wish to make the actual generation script for the types from `@polkadot/types/interfaces` available in 2 ways -
|
||||
|
||||
- allowing you to point to a folder of types and auto-generate the TypeScript typings from those. (Which is akin to what we do internally). This would allow a reduction in type classes explicitly written and injected.
|
||||
- once the metadata itself supports full type definitions, the script can be used to generate interface definitions specifically tailored for a chain
|
||||
|
||||
## And that's a wrap
|
||||
|
||||
This brings us to the end of our overview and jump through the API. While the documentation is still very much and ever evolving item, we can encourage you to try out what you have learned with some [examples](../examples). As we [indicated right at the start of this journey](README.md#help-us-help-others), if there are areas for improvement, let us know.
|
||||
In addition to the generated and available interfaces, there is also the ability to [create TypeScript interfaces from your own definitions and well as your on-chain modules](typescript.user.md).
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# TypeScript user generated
|
||||
|
||||
In the previous section we looked at the TypeScript definitions that are available and is generated from both the chain and definitions. Here we will expand upon the use of the infrastructure created to define types as part of the `@polkadot/types` library and see how to use them to generate your onw defintions and chain types.
|
||||
|
||||
## Definitions
|
||||
|
||||
A large part of the type definitions are defined not as classes, but rather as structures from which type definitions are extracted and that can be used as-is to let the API know how to decode a type. By now you should be familiar with [type extensions](types.extend.md), but effectively the [types library does exactly the same](https://github.com/polkadot-js/api/tree/master/packages/types/src/interfaces).
|
||||
|
||||
To create TypeScript-aware definitions and keep your files in a single place, you can follow the same approach. Assuming you have a package named `@MeInc/stuff` where you have the definitions in an `stuff/interfaces` folder. Each sub-folder would indicate a runtime module, e.g.
|
||||
|
||||
- `stuff/interfaces/<module>/definitions.ts` for each module (`types.ts` & `index.ts` will be generated)
|
||||
- `stuff/interfaces/defnitions.ts` importing all sub-definitions`
|
||||
|
||||
With this structure setup, you can generate TypeScript defintions.
|
||||
|
||||
In the root of your project (with the `@polkadot/typegen` package installed), you can run `yarn polkadot-types-from-defs --input ./stuff/interfaces --package @MeInc/stuff/interfaces` which will create `types.ts` and `index.ts` files with the generated types. You can use these in exactly the same way as you would use your types from `@polkadot/types/interfaces`.
|
||||
|
||||
## Chain modules
|
||||
|
||||
In the same way as the type library provides defaults from a substrate-base chain, you can also, directly from chain from metadata, generate a complete `api.{consts,query}.*` defintion for your specific chain. The command will create 2 files, `{consts, query}.types.ts` which you can either use to augment the TypeScript defintions, or replace those in `@polkadot/api/*` with your versions (copy, TypeScript replacement or browser/node aliassing).
|
||||
|
||||
In the root of your project, you can run `yarn polkadot-types-from-chain --endpoint wss://<url> --output ./stuff` and it will create the required output. (Here you can specify an optional `--package @MeInc/stuff` to read definitions for the targetted output folder with the specified package name.)
|
||||
|
||||
## And that's a wrap
|
||||
|
||||
This brings us to the end of our overview and jump through the API. While the documentation is still very much and ever evolving item, we can encourage you to try out what you have learned with some [examples](../examples). As we [indicated right at the start of this journey](README.md#help-us-help-others), if there are areas for improvement, let us know.
|
||||
@@ -1,225 +0,0 @@
|
||||
## Constants
|
||||
|
||||
The following sections contain the module constants, also known as parameter types. These can only be changed as part of a runtime upgrade. On the api, these are exposed via `api.consts.<module>.<method>`.
|
||||
|
||||
(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)
|
||||
- **[babe](#babe)**
|
||||
|
||||
- **[balances](#balances)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
|
||||
- **[elections](#elections)**
|
||||
|
||||
- **[finalityTracker](#finalityTracker)**
|
||||
|
||||
- **[session](#session)**
|
||||
|
||||
- **[staking](#staking)**
|
||||
|
||||
- **[timestamp](#timestamp)**
|
||||
|
||||
- **[treasury](#treasury)**
|
||||
|
||||
|
||||
___
|
||||
|
||||
|
||||
### babe
|
||||
|
||||
▸ **epochDuration**: `u64`
|
||||
- **summary**: The number of **slots** that an epoch takes. We couple sessions to epochs, i.e. we start a new session once the new epoch begins.
|
||||
|
||||
▸ **expectedBlockTime**: `Moment`
|
||||
- **summary**: The expected average block time at which BABE should be creating blocks. Since BABE is probabilistic it is not trivial to figure out what the expected average block time should be based on the slot duration and the security parameter `c` (where `1 - c` represents the probability of a slot being empty).
|
||||
|
||||
___
|
||||
|
||||
|
||||
### balances
|
||||
|
||||
▸ **creationFee**: `Balance`
|
||||
- **summary**: The fee required to create an account.
|
||||
|
||||
▸ **existentialDeposit**: `Balance`
|
||||
- **summary**: The minimum amount required to keep an account open.
|
||||
|
||||
▸ **transactionBaseFee**: `Balance`
|
||||
- **summary**: The fee to be paid for making a transaction; the base.
|
||||
|
||||
▸ **transactionByteFee**: `Balance`
|
||||
- **summary**: The fee to be paid for making a transaction; the per-byte portion.
|
||||
|
||||
▸ **transferFee**: `Balance`
|
||||
- **summary**: The fee required to make a transfer.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
|
||||
▸ **blockGasLimit**: `Gas`
|
||||
- **summary**: The maximum amount of gas that could be expended per block. A reasonable default value is 10_000_000.
|
||||
|
||||
▸ **callBaseFee**: `Gas`
|
||||
- **summary**: The base fee charged for calling into a contract. A reasonable default value is 135.
|
||||
|
||||
▸ **contractFee**: `BalanceOf`
|
||||
- **summary**: The fee required to instantiate a contract instance. A reasonable default value is 21.
|
||||
|
||||
▸ **creationFee**: `BalanceOf`
|
||||
- **summary**: The fee required to create an account.
|
||||
|
||||
▸ **instantiateBaseFee**: `Gas`
|
||||
- **summary**: The base fee charged for instantiating a contract. A reasonable default value is 175.
|
||||
|
||||
▸ **maxDepth**: `u32`
|
||||
- **summary**: The maximum nesting level of a call/instantiate stack. A reasonable default value is 100.
|
||||
|
||||
▸ **maxValueSize**: `u32`
|
||||
- **summary**: The maximum size of a storage value in bytes. A reasonable default is 16 KiB.
|
||||
|
||||
▸ **rentByteFee**: `BalanceOf`
|
||||
- **summary**: Price of a byte of storage per one block interval. Should be greater than 0.
|
||||
|
||||
▸ **rentDepositOffset**: `BalanceOf`
|
||||
- **summary**: The amount of funds a contract should deposit in order to offset 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, 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, then it would pay 500 BU/day.
|
||||
|
||||
▸ **signedClaimHandicap**: `BlockNumber`
|
||||
- **summary**: Number of block delay an extrinsic claim surcharge has. When claim surcharge is called by an extrinsic the rent is checked for current_block - delay
|
||||
|
||||
▸ **storageSizeOffset**: `u32`
|
||||
- **summary**: Size of a contract at the time of instantiaion. This is a simple way to ensure that empty contracts eventually gets deleted.
|
||||
|
||||
▸ **surchargeReward**: `BalanceOf`
|
||||
- **summary**: Reward that is received by the party whose touch has led to removal of a contract.
|
||||
|
||||
▸ **tombstoneDeposit**: `BalanceOf`
|
||||
- **summary**: The minimum amount required to generate a tombstone.
|
||||
|
||||
▸ **transactionBaseFee**: `BalanceOf`
|
||||
- **summary**: The fee to be paid for making a transaction; the base.
|
||||
|
||||
▸ **transactionByteFee**: `BalanceOf`
|
||||
- **summary**: The fee to be paid for making a transaction; the per-byte portion.
|
||||
|
||||
▸ **transferFee**: `BalanceOf`
|
||||
- **summary**: The fee required to make a transfer.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### democracy
|
||||
|
||||
▸ **cooloffPeriod**: `BlockNumber`
|
||||
- **summary**: Period in blocks where an external proposal may not be re-submitted after being vetoed.
|
||||
|
||||
▸ **emergencyVotingPeriod**: `BlockNumber`
|
||||
- **summary**: Minimum voting period allowed for an emergency referendum.
|
||||
|
||||
▸ **enactmentPeriod**: `BlockNumber`
|
||||
- **summary**: The minimum period of locking and the period between a proposal being approved and enacted. It should generally be a little more than the unstake period to ensure that voting stakers have an opportunity to remove themselves from the system in the case where they are on the losing side of a vote.
|
||||
|
||||
▸ **launchPeriod**: `BlockNumber`
|
||||
- **summary**: How often (in blocks) new public referenda are launched.
|
||||
|
||||
▸ **minimumDeposit**: `BalanceOf`
|
||||
- **summary**: The minimum amount to be used as a deposit for a public referendum proposal.
|
||||
|
||||
▸ **votingPeriod**: `BlockNumber`
|
||||
- **summary**: How often (in blocks) to check for new votes.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### elections
|
||||
|
||||
▸ **approvalSetSize**: `u32`
|
||||
- **summary**: The chunk size of the approval vector.
|
||||
|
||||
▸ **candidacyBond**: `BalanceOf`
|
||||
- **summary**: How much should be locked up in order to submit one's candidacy. A reasonable default value is 9.
|
||||
|
||||
▸ **carryCount**: `u32`
|
||||
- **summary**: How many runners-up should have their approvals persist until the next vote. A reasonable default value is 2.
|
||||
|
||||
▸ **decayRatio**: `u32`
|
||||
- **summary**: Decay factor of weight when being accumulated. It should typically be set to __at least__ `membership_size -1` to keep the collective secure. When set to `N`, it indicates `(1/N)^t` of staked is decayed at weight increment step `t`. 0 will result in no weight being added at all (normal approval voting). A reasonable default value is 24.
|
||||
|
||||
▸ **inactiveGracePeriod**: `VoteIndex`
|
||||
- **summary**: How many vote indices need to go by after a target voter's last vote before they can be reaped if their approvals are moot. A reasonable default value is 1.
|
||||
|
||||
▸ **minimumVotingLock**: `BalanceOf`
|
||||
- **summary**: Minimum about that can be used as the locked value for voting.
|
||||
|
||||
▸ **presentSlashPerVoter**: `BalanceOf`
|
||||
- **summary**: The punishment, per voter, if you provide an invalid presentation. A reasonable default value is 1.
|
||||
|
||||
▸ **voterSetSize**: `u32`
|
||||
- **summary**: The chunk size of the voter vector.
|
||||
|
||||
▸ **votingBond**: `BalanceOf`
|
||||
- **summary**: How much should be locked up in order to be able to submit votes.
|
||||
|
||||
▸ **votingFee**: `BalanceOf`
|
||||
- **summary**: The amount of fee paid upon each vote submission, unless if they submit a _hole_ index and replace it.
|
||||
|
||||
▸ **votingPeriod**: `BlockNumber`
|
||||
- **summary**: How often (in blocks) to check for new votes. A reasonable default value is 1000.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### finalityTracker
|
||||
|
||||
▸ **reportLatency**: `BlockNumber`
|
||||
- **summary**: The delay after which point things become suspicious. Default is 1000.
|
||||
|
||||
▸ **windowSize**: `BlockNumber`
|
||||
- **summary**: The number of recent samples to keep from this chain. Default is 101.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### session
|
||||
|
||||
▸ **dedupKeyPrefix**: `Bytes`
|
||||
- **summary**: Used as first key for `NextKeys` and `KeyOwner` to put all the data into the same branch of the trie.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### staking
|
||||
|
||||
▸ **bondingDuration**: `EraIndex`
|
||||
- **summary**: Number of eras that staked funds must remain bonded for.
|
||||
|
||||
▸ **sessionsPerEra**: `SessionIndex`
|
||||
- **summary**: Number of sessions per era.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### timestamp
|
||||
|
||||
▸ **minimumPeriod**: `Moment`
|
||||
- **summary**: 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 work with this to determine a sensible block time. e.g. For Aura, it will be double this period on default settings.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### treasury
|
||||
|
||||
▸ **burn**: `Permill`
|
||||
- **summary**: Percentage of spare funds (if any) that are burnt per spend period.
|
||||
|
||||
▸ **proposalBond**: `Permill`
|
||||
- **summary**: 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.
|
||||
|
||||
▸ **proposalBondMinimum**: `BalanceOf`
|
||||
- **summary**: Minimum amount of funds that should be placed in a deposit for making a proposal.
|
||||
|
||||
▸ **spendPeriod**: `BlockNumber`
|
||||
- **summary**: Period between successive spends.
|
||||
@@ -1,298 +0,0 @@
|
||||
## Events
|
||||
|
||||
Events are emitted for certain operations on the runtime. The following sections describe the events that are part of the default Substrate runtime.
|
||||
|
||||
(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)
|
||||
- **[balances](#balances)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
|
||||
- **[council](#council)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
|
||||
- **[elections](#elections)**
|
||||
|
||||
- **[grandpa](#grandpa)**
|
||||
|
||||
- **[imOnline](#imOnline)**
|
||||
|
||||
- **[indices](#indices)**
|
||||
|
||||
- **[offences](#offences)**
|
||||
|
||||
- **[session](#session)**
|
||||
|
||||
- **[staking](#staking)**
|
||||
|
||||
- **[sudo](#sudo)**
|
||||
|
||||
- **[system](#system)**
|
||||
|
||||
- **[technicalCommittee](#technicalCommittee)**
|
||||
|
||||
- **[technicalMembership](#technicalMembership)**
|
||||
|
||||
- **[treasury](#treasury)**
|
||||
|
||||
- **[utility](#utility)**
|
||||
|
||||
|
||||
___
|
||||
|
||||
|
||||
### balances
|
||||
|
||||
▸ **NewAccount**(`AccountId`, `Balance`)
|
||||
- **summary**: A new account was created.
|
||||
|
||||
▸ **ReapedAccount**(`AccountId`)
|
||||
- **summary**: An account was reaped.
|
||||
|
||||
▸ **Transfer**(`AccountId`, `AccountId`, `Balance`, `Balance`)
|
||||
- **summary**: Transfer succeeded (from, to, value, fees).
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
|
||||
▸ **CodeStored**(`Hash`)
|
||||
- **summary**: Code with the specified hash has been stored.
|
||||
|
||||
▸ **Contract**(`AccountId`, `Bytes`)
|
||||
- **summary**: An event from contract of account.
|
||||
|
||||
▸ **Dispatched**(`AccountId`, `bool`)
|
||||
- **summary**: A call was dispatched from the given account. The bool signals whether it was successful execution or not.
|
||||
|
||||
▸ **Instantiated**(`AccountId`, `AccountId`)
|
||||
- **summary**: Contract deployed by address at the specified address.
|
||||
|
||||
▸ **ScheduleUpdated**(`u32`)
|
||||
- **summary**: Triggered when the current schedule is updated.
|
||||
|
||||
▸ **Transfer**(`AccountId`, `AccountId`, `Balance`)
|
||||
- **summary**: Transfer happened `from` to `to` with given `value` as part of a `call` or `instantiate`.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### council
|
||||
|
||||
▸ **Approved**(`Hash`)
|
||||
- **summary**: A motion was approved by the required threshold.
|
||||
|
||||
▸ **Disapproved**(`Hash`)
|
||||
- **summary**: A motion was not approved by the required threshold.
|
||||
|
||||
▸ **Executed**(`Hash`, `bool`)
|
||||
- **summary**: A motion was executed; `bool` is true if returned without error.
|
||||
|
||||
▸ **MemberExecuted**(`Hash`, `bool`)
|
||||
- **summary**: A single member did some action; `bool` is true if returned without error.
|
||||
|
||||
▸ **Proposed**(`AccountId`, `ProposalIndex`, `Hash`, `MemberCount`)
|
||||
- **summary**: A motion (given hash) has been proposed (by given account) with a threshold (given `MemberCount`).
|
||||
|
||||
▸ **Voted**(`AccountId`, `Hash`, `bool`, `MemberCount`, `MemberCount`)
|
||||
- **summary**: A motion (given hash) has been voted on by given account, leaving a tally (yes votes and no votes given respectively as `MemberCount`).
|
||||
|
||||
___
|
||||
|
||||
|
||||
### democracy
|
||||
|
||||
▸ **Cancelled**(`ReferendumIndex`)
|
||||
|
||||
▸ **Delegated**(`AccountId`, `AccountId`)
|
||||
|
||||
▸ **Executed**(`ReferendumIndex`, `bool`)
|
||||
|
||||
▸ **ExternalTabled**()
|
||||
|
||||
▸ **NotPassed**(`ReferendumIndex`)
|
||||
|
||||
▸ **Passed**(`ReferendumIndex`)
|
||||
|
||||
▸ **Proposed**(`PropIndex`, `Balance`)
|
||||
|
||||
▸ **Started**(`ReferendumIndex`, `VoteThreshold`)
|
||||
|
||||
▸ **Tabled**(`PropIndex`, `Balance`, `Vec<AccountId>`)
|
||||
|
||||
▸ **Undelegated**(`AccountId`)
|
||||
|
||||
▸ **Vetoed**(`AccountId`, `Hash`, `BlockNumber`)
|
||||
|
||||
___
|
||||
|
||||
|
||||
### elections
|
||||
|
||||
▸ **BadReaperSlashed**(`AccountId`)
|
||||
- **summary**: slashed reaper
|
||||
|
||||
▸ **TallyFinalized**(`Vec<AccountId>`, `Vec<AccountId>`)
|
||||
- **summary**: A tally (for approval votes of seat(s)) has ended (with one or more new members).
|
||||
|
||||
▸ **TallyStarted**(`u32`)
|
||||
- **summary**: A tally (for approval votes of seat(s)) has started.
|
||||
|
||||
▸ **VoterReaped**(`AccountId`, `AccountId`)
|
||||
- **summary**: reaped voter, reaper
|
||||
|
||||
___
|
||||
|
||||
|
||||
### grandpa
|
||||
|
||||
▸ **NewAuthorities**(`Vec<(AuthorityId,AuthorityWeight)>`)
|
||||
- **summary**: New authority set has been applied.
|
||||
|
||||
▸ **Paused**()
|
||||
- **summary**: Current authority set has been paused.
|
||||
|
||||
▸ **Resumed**()
|
||||
- **summary**: Current authority set has been resumed.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### imOnline
|
||||
|
||||
▸ **HeartbeatReceived**(`AuthorityId`)
|
||||
- **summary**: A new heartbeat was received from `AuthorityId`
|
||||
|
||||
___
|
||||
|
||||
|
||||
### indices
|
||||
|
||||
▸ **NewAccountIndex**(`AccountId`, `AccountIndex`)
|
||||
- **summary**: A new account index was assigned. This event is not triggered when an existing index is reassigned to another `AccountId`.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### offences
|
||||
|
||||
▸ **Offence**(`Kind`, `OpaqueTimeSlot`)
|
||||
- **summary**: 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.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### session
|
||||
|
||||
▸ **NewSession**(`SessionIndex`)
|
||||
- **summary**: New session has happened. Note that the argument is the session index, not the block number as the type might suggest.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### staking
|
||||
|
||||
▸ **OldSlashingReportDiscarded**(`SessionIndex`)
|
||||
- **summary**: An old slashing report from a prior era was discarded because it could not be processed.
|
||||
|
||||
▸ **Reward**(`Balance`)
|
||||
- **summary**: All validators have been rewarded by the given balance.
|
||||
|
||||
▸ **Slash**(`AccountId`, `Balance`)
|
||||
- **summary**: One validator (and its nominators) has been slashed by the given amount.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### sudo
|
||||
|
||||
▸ **KeyChanged**(`AccountId`)
|
||||
- **summary**: The sudoer just switched identity; the old key is supplied.
|
||||
|
||||
▸ **Sudid**(`bool`)
|
||||
- **summary**: A sudo just took place.
|
||||
|
||||
▸ **SudoAsDone**(`bool`)
|
||||
- **summary**: A sudo just took place.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### system
|
||||
|
||||
▸ **ExtrinsicFailed**(`DispatchError`)
|
||||
- **summary**: An extrinsic failed.
|
||||
|
||||
▸ **ExtrinsicSuccess**()
|
||||
- **summary**: An extrinsic completed successfully.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalCommittee
|
||||
|
||||
▸ **Approved**(`Hash`)
|
||||
- **summary**: A motion was approved by the required threshold.
|
||||
|
||||
▸ **Disapproved**(`Hash`)
|
||||
- **summary**: A motion was not approved by the required threshold.
|
||||
|
||||
▸ **Executed**(`Hash`, `bool`)
|
||||
- **summary**: A motion was executed; `bool` is true if returned without error.
|
||||
|
||||
▸ **MemberExecuted**(`Hash`, `bool`)
|
||||
- **summary**: A single member did some action; `bool` is true if returned without error.
|
||||
|
||||
▸ **Proposed**(`AccountId`, `ProposalIndex`, `Hash`, `MemberCount`)
|
||||
- **summary**: A motion (given hash) has been proposed (by given account) with a threshold (given `MemberCount`).
|
||||
|
||||
▸ **Voted**(`AccountId`, `Hash`, `bool`, `MemberCount`, `MemberCount`)
|
||||
- **summary**: A motion (given hash) has been voted on by given account, leaving a tally (yes votes and no votes given respectively as `MemberCount`).
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalMembership
|
||||
|
||||
▸ **Dummy**(`PhantomData`)
|
||||
- **summary**: Phantom member, never used.
|
||||
|
||||
▸ **MemberAdded**()
|
||||
- **summary**: The given member was added; see the transaction for who.
|
||||
|
||||
▸ **MemberRemoved**()
|
||||
- **summary**: The given member was removed; see the transaction for who.
|
||||
|
||||
▸ **MembersReset**()
|
||||
- **summary**: The membership was reset; see the transaction for who the new set is.
|
||||
|
||||
▸ **MembersSwapped**()
|
||||
- **summary**: Two members were swapped; see the transaction for who.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### treasury
|
||||
|
||||
▸ **Awarded**(`ProposalIndex`, `Balance`, `AccountId`)
|
||||
- **summary**: Some funds have been allocated.
|
||||
|
||||
▸ **Burnt**(`Balance`)
|
||||
- **summary**: Some of our funds have been burnt.
|
||||
|
||||
▸ **Proposed**(`ProposalIndex`)
|
||||
- **summary**: New proposal.
|
||||
|
||||
▸ **Rollover**(`Balance`)
|
||||
- **summary**: Spending has finished; this is the amount that rolls over until next spend.
|
||||
|
||||
▸ **Spending**(`Balance`)
|
||||
- **summary**: We have ended a spend period and will now allocate funds.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### utility
|
||||
|
||||
▸ **BatchExecuted**(`Vec<DispatchResult>`)
|
||||
@@ -1,370 +0,0 @@
|
||||
## Extrinsics
|
||||
|
||||
The following sections contain Extrinsics methods are part of the default Substrate runtime. On the api, these are exposed via `api.tx.<module>.<method>`.
|
||||
|
||||
(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)
|
||||
- **[authorship](#authorship)**
|
||||
|
||||
- **[balances](#balances)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
|
||||
- **[council](#council)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
|
||||
- **[elections](#elections)**
|
||||
|
||||
- **[finalityTracker](#finalityTracker)**
|
||||
|
||||
- **[grandpa](#grandpa)**
|
||||
|
||||
- **[imOnline](#imOnline)**
|
||||
|
||||
- **[session](#session)**
|
||||
|
||||
- **[staking](#staking)**
|
||||
|
||||
- **[sudo](#sudo)**
|
||||
|
||||
- **[system](#system)**
|
||||
|
||||
- **[technicalCommittee](#technicalCommittee)**
|
||||
|
||||
- **[technicalMembership](#technicalMembership)**
|
||||
|
||||
- **[timestamp](#timestamp)**
|
||||
|
||||
- **[treasury](#treasury)**
|
||||
|
||||
- **[utility](#utility)**
|
||||
|
||||
|
||||
___
|
||||
|
||||
|
||||
### authorship
|
||||
|
||||
▸ **setUncles**(new_uncles: `Vec<Header>`)
|
||||
- **summary**: Provide a set of uncles.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### balances
|
||||
|
||||
▸ **forceTransfer**(source: `Address`, dest: `Address`, value: `Compact<Balance>`)
|
||||
- **summary**: Exactly as `transfer`, except the origin must be root and the source account may be specified.
|
||||
|
||||
▸ **setBalance**(who: `Address`, new_free: `Compact<Balance>`, new_reserved: `Compact<Balance>`)
|
||||
- **summary**: Set the balances of a given account. This will alter `FreeBalance` and `ReservedBalance` in storage. it will also decrease the total issuance of the system (`TotalIssuance`). If the new free or reserved balance is below the existential deposit, it will reset the account nonce (`system::AccountNonce`). The dispatch origin for this call is `root`. # <weight> - Independent of the arguments. - Contains a limited number of reads and writes. # </weight>
|
||||
|
||||
▸ **transfer**(dest: `Address`, value: `Compact<Balance>`)
|
||||
- **summary**: Transfer some liquid free balance to another account. `transfer` will set the `FreeBalance` of the sender and receiver. It will decrease the total issuance of the system by the `TransferFee`. If the sender's account is below the existential deposit as a result of the transfer, the account will be reaped. The dispatch origin for this call must be `Signed` by the transactor. # <weight> - Dependent on arguments but not critical, given proper implementations for input config types. See related functions below. - It contains a limited number of reads and writes internally and no complex computation. Related functions: - `ensure_can_withdraw` is always called internally but has a bounded complexity. - Transferring balances to accounts that did not exist before will cause `T::OnNewAccount::on_new_account` to be called. - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced` and `T::OnFreeBalanceZero::on_free_balance_zero`. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
|
||||
▸ **call**(dest: `Address`, value: `Compact<BalanceOf>`, gas_limit: `Compact<Gas>`, data: `Bytes`)
|
||||
- **summary**: Makes a call to an account, optionally transferring some balance. * If the account is a smart-contract account, the associated code will be executed and any value will be transferred. * If the account is a regular account, any value will be transferred. * If no account exists and the call value is not less than `existential_deposit`, a regular account will be created and any value will be transferred.
|
||||
|
||||
▸ **claimSurcharge**(dest: `AccountId`, aux_sender: `Option<AccountId>`)
|
||||
- **summary**: Allows block producers to claim a small reward for evicting a contract. If a block producer fails to do so, a regular users will be allowed to claim the reward. If contract is not evicted as a result of this call, no actions are taken and the sender is not eligible for the reward.
|
||||
|
||||
▸ **instantiate**(endowment: `Compact<BalanceOf>`, gas_limit: `Compact<Gas>`, code_hash: `CodeHash`, data: `Bytes`)
|
||||
- **summary**: Instantiates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance. Instantiation is executed as follows: - The destination address is computed based on the sender and hash of the code. - The smart-contract account is created at the computed address. - The `ctor_code` is executed in the context of the newly-created account. Buffer returned after the execution is saved as the `code` of the account. That code will be invoked upon any call received by this account. - The contract is initialized.
|
||||
|
||||
▸ **putCode**(gas_limit: `Compact<Gas>`, code: `Bytes`)
|
||||
- **summary**: Stores the given binary Wasm code into the chain's storage and returns its `codehash`. You can instantiate contracts only with stored code.
|
||||
|
||||
▸ **updateSchedule**(schedule: `Schedule`)
|
||||
- **summary**: Updates the schedule for metering contracts. The schedule must have a greater version than the stored schedule.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### council
|
||||
|
||||
▸ **execute**(proposal: `Proposal`)
|
||||
- **summary**: Dispatch a proposal from a member using the `Member` origin. Origin must be a member of the collective.
|
||||
|
||||
▸ **propose**(threshold: `Compact<MemberCount>`, proposal: `Proposal`)
|
||||
- **summary**: # <weight> - Bounded storage reads and writes. - Argument `threshold` has bearing on weight. # </weight>
|
||||
|
||||
▸ **setMembers**(new_members: `Vec<AccountId>`)
|
||||
- **summary**: Set the collective's membership manually to `new_members`. Be nice to the chain and provide it pre-sorted. Requires root origin.
|
||||
|
||||
▸ **vote**(proposal: `Hash`, index: `Compact<ProposalIndex>`, approve: `bool`)
|
||||
- **summary**: # <weight> - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### democracy
|
||||
|
||||
▸ **cancelQueued**(when: `Compact<BlockNumber>`, which: `Compact<u32>`, what: `Compact<ReferendumIndex>`)
|
||||
- **summary**: Cancel a proposal queued for enactment.
|
||||
|
||||
▸ **cancelReferendum**(ref_index: `Compact<ReferendumIndex>`)
|
||||
- **summary**: Remove a referendum.
|
||||
|
||||
▸ **delegate**(to: `AccountId`, conviction: `Conviction`)
|
||||
- **summary**: Delegate vote. # <weight> - One extra DB entry. # </weight>
|
||||
|
||||
▸ **emergencyCancel**(ref_index: `ReferendumIndex`)
|
||||
- **summary**: Schedule an emergency cancellation of a referendum. Cannot happen twice to the same referendum.
|
||||
|
||||
▸ **externalPropose**(proposal: `Proposal`)
|
||||
- **summary**: Schedule a referendum to be tabled once it is legal to schedule an external referendum.
|
||||
|
||||
▸ **externalProposeDefault**(proposal: `Proposal`)
|
||||
- **summary**: Schedule a negative-turnout-bias referendum to be tabled next once it is legal to schedule an external referendum. Unlike `external_propose`, blacklisting has no effect on this and it may replace a pre-scheduled `external_propose` call.
|
||||
|
||||
▸ **externalProposeMajority**(proposal: `Proposal`)
|
||||
- **summary**: Schedule a majority-carries referendum to be tabled next once it is legal to schedule an external referendum. Unlike `external_propose`, blacklisting has no effect on this and it may replace a pre-scheduled `external_propose` call.
|
||||
|
||||
▸ **fastTrack**(proposal_hash: `Hash`, voting_period: `BlockNumber`, delay: `BlockNumber`)
|
||||
- **summary**: Schedule the currently externally-proposed majority-carries referendum to be tabled immediately. If there is no externally-proposed referendum currently, or if there is one but it is not a majority-carries referendum then it fails. - `proposal_hash`: The hash of the current external proposal. - `voting_period`: The period that is allowed for voting on this proposal. - `delay`: The number of block after voting has ended in approval and this should be enacted. Increased to `EmergencyVotingPeriod` if too low.
|
||||
|
||||
▸ **propose**(proposal: `Proposal`, value: `Compact<BalanceOf>`)
|
||||
- **summary**: Propose a sensitive action to be taken. # <weight> - O(1). - Two DB changes, one DB entry. # </weight>
|
||||
|
||||
▸ **proxyVote**(ref_index: `Compact<ReferendumIndex>`, vote: `Vote`)
|
||||
- **summary**: Vote in a referendum on behalf of a stash. If `vote.is_aye()`, the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # <weight> - O(1). - One DB change, one DB entry. # </weight>
|
||||
|
||||
▸ **removeProxy**(proxy: `AccountId`)
|
||||
- **summary**: Clear the proxy. Called by the stash. # <weight> - One DB clear. # </weight>
|
||||
|
||||
▸ **resignProxy**()
|
||||
- **summary**: Clear the proxy. Called by the proxy. # <weight> - One DB clear. # </weight>
|
||||
|
||||
▸ **second**(proposal: `Compact<PropIndex>`)
|
||||
- **summary**: Propose a sensitive action to be taken. # <weight> - O(1). - One DB entry. # </weight>
|
||||
|
||||
▸ **setProxy**(proxy: `AccountId`)
|
||||
- **summary**: Specify a proxy. Called by the stash. # <weight> - One extra DB entry. # </weight>
|
||||
|
||||
▸ **undelegate**()
|
||||
- **summary**: Undelegate vote. # <weight> - O(1). # </weight>
|
||||
|
||||
▸ **vetoExternal**(proposal_hash: `Hash`)
|
||||
- **summary**: Veto and blacklist the external proposal hash.
|
||||
|
||||
▸ **vote**(ref_index: `Compact<ReferendumIndex>`, vote: `Vote`)
|
||||
- **summary**: Vote in a referendum. If `vote.is_aye()`, the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # <weight> - O(1). - One DB change, one DB entry. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### elections
|
||||
|
||||
▸ **presentWinner**(candidate: `Address`, total: `Compact<BalanceOf>`, index: `Compact<VoteIndex>`)
|
||||
- **summary**: Claim that `candidate` is one of the top `carry_count + desired_seats` candidates. Only works iff the presentation period is active. `candidate` should have at least collected some non-zero `total` votes and `origin` must have enough funds to pay for a potential slash. # <weight> - O(voters) compute. - One DB change. # </weight>
|
||||
|
||||
▸ **proxySetApprovals**(votes: `Vec<bool>`, index: `Compact<VoteIndex>`, hint: `SetIndex`, value: `Compact<BalanceOf>`)
|
||||
- **summary**: Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in those slots are registered. # <weight> - Same as `set_approvals` with one additional storage read. # </weight>
|
||||
|
||||
▸ **reapInactiveVoter**(reporter_index: `Compact<u32>`, who: `Address`, who_index: `Compact<u32>`, assumed_vote_index: `Compact<VoteIndex>`)
|
||||
- **summary**: Remove a voter. For it not to be a bond-consuming no-op, all approved candidate indices must now be either unregistered or registered to a candidate that registered the slot after the voter gave their last approval set. Both indices must be provided as explained in [`voter_at`] function. May be called by anyone. Returns the voter deposit to `signed`. # <weight> - O(1). - Two fewer DB entries, one DB change. # </weight>
|
||||
|
||||
▸ **removeMember**(who: `Address`)
|
||||
- **summary**: Remove a particular member from the set. This is effective immediately. Note: A tally should happen instantly (if not already in a presentation period) to fill the seat if removal means that the desired members are not met.
|
||||
|
||||
▸ **retractVoter**(index: `Compact<u32>`)
|
||||
- **summary**: Remove a voter. All votes are cancelled and the voter deposit is returned. The index must be provided as explained in [`voter_at`] function. Also removes the lock on the balance of the voter. See [`do_set_approvals()`]. # <weight> - O(1). - Two fewer DB entries, one DB change. # </weight>
|
||||
|
||||
▸ **setApprovals**(votes: `Vec<bool>`, index: `Compact<VoteIndex>`, hint: `SetIndex`, value: `Compact<BalanceOf>`)
|
||||
- **summary**: Set candidate approvals. Approval slots stay valid as long as candidates in those slots are registered. Locks `value` from the balance of `origin` indefinitely. Only [`retract_voter`] or [`reap_inactive_voter`] can unlock the balance. `hint` argument is interpreted differently based on: - if `origin` is setting approvals for the first time: The index will be checked for being a valid _hole_ in the voter list. - if the hint is correctly pointing to a hole, no fee is deducted from `origin`. - Otherwise, the call will succeed but the index is ignored and simply a push to the last chunk with free space happens. If the new push causes a new chunk to be created, a fee indicated by [`VotingFee`] is deducted. - if `origin` is already a voter: the index __must__ be valid and point to the correct position of the `origin` in the current voters list. Note that any trailing `false` votes in `votes` is ignored; In approval voting, not voting for a candidate and voting false, are equal. # <weight> - O(1). - Two extra DB entries, one DB change. - Argument `votes` is limited in length to number of candidates. # </weight>
|
||||
|
||||
▸ **setDesiredSeats**(count: `Compact<u32>`)
|
||||
- **summary**: Set the desired member count; if lower than the current count, then seats will not be up election when they expire. If more, then a new vote will be started if one is not already in progress.
|
||||
|
||||
▸ **setPresentationDuration**(count: `Compact<BlockNumber>`)
|
||||
- **summary**: Set the presentation duration. If there is currently a vote being presented for, will invoke `finalize_vote`.
|
||||
|
||||
▸ **setTermDuration**(count: `Compact<BlockNumber>`)
|
||||
- **summary**: Set the presentation duration. If there is current a vote being presented for, will invoke `finalize_vote`.
|
||||
|
||||
▸ **submitCandidacy**(slot: `Compact<u32>`)
|
||||
- **summary**: Submit oneself for candidacy. Account must have enough transferrable funds in it to pay the bond. NOTE: if `origin` has already assigned approvals via [`set_approvals`], it will NOT have any usable funds to pass candidacy bond and must first retract. Note that setting approvals will lock the entire balance of the voter until retraction or being reported. # <weight> - Independent of input. - Three DB changes. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### finalityTracker
|
||||
|
||||
▸ **finalHint**(hint: `Compact<BlockNumber>`)
|
||||
- **summary**: Hint that the author of this block thinks the best finalized block is the given number.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### grandpa
|
||||
|
||||
▸ **reportMisbehavior**(_report: `Bytes`)
|
||||
- **summary**: Report some misbehavior.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### imOnline
|
||||
|
||||
▸ **heartbeat**(heartbeat: `Heartbeat`, signature: `Signature`)
|
||||
|
||||
___
|
||||
|
||||
|
||||
### session
|
||||
|
||||
▸ **setKeys**(keys: `Keys`, proof: `Bytes`)
|
||||
- **summary**: Sets the session key(s) of the function caller to `key`. Allows an account to set its session key prior to becoming a validator. This doesn't take effect until the next session. The dispatch origin of this function must be signed. # <weight> - O(log n) in number of accounts. - One extra DB entry. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### staking
|
||||
|
||||
▸ **bond**(controller: `Address`, value: `Compact<BalanceOf>`, payee: `RewardDestination`)
|
||||
- **summary**: Take the origin account as a stash and lock up `value` of its balance. `controller` will be the account that controls it. `value` must be more than the `minimum_balance` specified by `T::Currency`. The dispatch origin for this call must be _Signed_ by the stash account. # <weight> - Independent of the arguments. Moderate complexity. - O(1). - Three extra DB entries. NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned unless the `origin` falls below _existential deposit_ and gets removed as dust. # </weight>
|
||||
|
||||
▸ **bondExtra**(max_additional: `Compact<BalanceOf>`)
|
||||
- **summary**: Add some extra amount that have appeared in the stash `free_balance` into the balance up for staking. Use this if there are additional funds in your stash account that you wish to bond. Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount that can be added. The dispatch origin for this call must be _Signed_ by the stash, not the controller. # <weight> - Independent of the arguments. Insignificant complexity. - O(1). - One DB entry. # </weight>
|
||||
|
||||
▸ **chill**()
|
||||
- **summary**: Declare no desire to either validate or nominate. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash. # <weight> - Independent of the arguments. Insignificant complexity. - Contains one read. - Writes are limited to the `origin` account key. # </weight>
|
||||
|
||||
▸ **forceNewEra**()
|
||||
- **summary**: Force there to be a new era at the end of the next session. After this, it will be reset to normal (non-forced) behaviour. # <weight> - No arguments. # </weight>
|
||||
|
||||
▸ **forceNoEras**()
|
||||
- **summary**: Force there to be no new eras indefinitely. # <weight> - No arguments. # </weight>
|
||||
|
||||
▸ **nominate**(targets: `Vec<Address>`)
|
||||
- **summary**: Declare the desire to nominate `targets` for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash. # <weight> - The transaction's complexity is proportional to the size of `targets`, which is capped at `MAX_NOMINATIONS`. - Both the reads and writes follow a similar pattern. # </weight>
|
||||
|
||||
▸ **setController**(controller: `Address`)
|
||||
- **summary**: (Re-)set the controller of a stash. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the stash, not the controller. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
|
||||
|
||||
▸ **setInvulnerables**(validators: `Vec<AccountId>`)
|
||||
- **summary**: Set the validators who cannot be slashed (if any).
|
||||
|
||||
▸ **setPayee**(payee: `RewardDestination`)
|
||||
- **summary**: (Re-)set the payment target for a controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
|
||||
|
||||
▸ **setValidatorCount**(new: `Compact<u32>`)
|
||||
- **summary**: The ideal number of validators.
|
||||
|
||||
▸ **unbond**(value: `Compact<BalanceOf>`)
|
||||
- **summary**: Schedule a portion of the stash to be unlocked ready for transfer out after the bond period ends. If this leaves an amount actively bonded less than T::Currency::minimum_balance(), then it is increased to the full amount. Once the unlock period is done, you can call `withdraw_unbonded` to actually move the funds out of management ready for transfer. No more than a limited number of unlocking chunks (see `MAX_UNLOCKING_CHUNKS`) can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need to be called first to remove some of the chunks (if possible). The dispatch origin for this call must be _Signed_ by the controller, not the stash. See also [`Call::withdraw_unbonded`]. # <weight> - Independent of the arguments. Limited but potentially exploitable complexity. - Contains a limited number of reads. - Each call (requires the remainder of the bonded balance to be above `minimum_balance`) will cause a new entry to be inserted into a vector (`Ledger.unlocking`) kept in storage. The only way to clean the aforementioned storage item is also user-controlled via `withdraw_unbonded`. - One DB entry. </weight>
|
||||
|
||||
▸ **validate**(prefs: `ValidatorPrefs`)
|
||||
- **summary**: Declare the desire to validate for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be _Signed_ by the controller, not the stash. # <weight> - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the `origin` account key. # </weight>
|
||||
|
||||
▸ **withdrawUnbonded**()
|
||||
- **summary**: Remove any unlocked chunks from the `unlocking` queue from our management. This essentially frees up that balance to be used by the stash account to do whatever it wants. The dispatch origin for this call must be _Signed_ by the controller, not the stash. See also [`Call::unbond`]. # <weight> - Could be dependent on the `origin` argument and how much `unlocking` chunks exist. It implies `consolidate_unlocked` which loops over `Ledger.unlocking`, which is indirectly user-controlled. See [`unbond`] for more detail. - Contains a limited number of reads, yet the size of which could be large based on `ledger`. - Writes are limited to the `origin` account key. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### sudo
|
||||
|
||||
▸ **setKey**(new: `Address`)
|
||||
- **summary**: Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key. The dispatch origin for this call must be _Signed_. # <weight> - O(1). - Limited storage reads. - One DB change. # </weight>
|
||||
|
||||
▸ **sudo**(proposal: `Proposal`)
|
||||
- **summary**: Authenticates the sudo key and dispatches a function call with `Root` origin. The dispatch origin for this call must be _Signed_. # <weight> - O(1). - Limited storage reads. - One DB write (event). - Unknown weight of derivative `proposal` execution. # </weight>
|
||||
|
||||
▸ **sudoAs**(who: `Address`, proposal: `Proposal`)
|
||||
- **summary**: Authenticates the sudo key and dispatches a function call with `Signed` origin from a given account. The dispatch origin for this call must be _Signed_. # <weight> - O(1). - Limited storage reads. - One DB write (event). - Unknown weight of derivative `proposal` execution. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### system
|
||||
|
||||
▸ **fillBlock**()
|
||||
- **summary**: A big dispatch that will disallow any other transaction to be included.
|
||||
|
||||
▸ **killPrefix**(prefix: `Key`)
|
||||
- **summary**: Kill all storage items with a key that starts with the given prefix.
|
||||
|
||||
▸ **killStorage**(keys: `Vec<Key>`)
|
||||
- **summary**: Kill some items from storage.
|
||||
|
||||
▸ **remark**(_remark: `Bytes`)
|
||||
- **summary**: Make some on-chain remark.
|
||||
|
||||
▸ **setCode**(new: `Bytes`)
|
||||
- **summary**: Set the new code.
|
||||
|
||||
▸ **setHeapPages**(pages: `u64`)
|
||||
- **summary**: Set the number of pages in the WebAssembly environment's heap.
|
||||
|
||||
▸ **setStorage**(items: `Vec<KeyValue>`)
|
||||
- **summary**: Set some items of storage.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalCommittee
|
||||
|
||||
▸ **execute**(proposal: `Proposal`)
|
||||
- **summary**: Dispatch a proposal from a member using the `Member` origin. Origin must be a member of the collective.
|
||||
|
||||
▸ **propose**(threshold: `Compact<MemberCount>`, proposal: `Proposal`)
|
||||
- **summary**: # <weight> - Bounded storage reads and writes. - Argument `threshold` has bearing on weight. # </weight>
|
||||
|
||||
▸ **setMembers**(new_members: `Vec<AccountId>`)
|
||||
- **summary**: Set the collective's membership manually to `new_members`. Be nice to the chain and provide it pre-sorted. Requires root origin.
|
||||
|
||||
▸ **vote**(proposal: `Hash`, index: `Compact<ProposalIndex>`, approve: `bool`)
|
||||
- **summary**: # <weight> - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalMembership
|
||||
|
||||
▸ **addMember**(who: `AccountId`)
|
||||
- **summary**: Add a member `who` to the set. May only be called from `AddOrigin` or root.
|
||||
|
||||
▸ **removeMember**(who: `AccountId`)
|
||||
- **summary**: Remove a member `who` from the set. May only be called from `RemoveOrigin` or root.
|
||||
|
||||
▸ **resetMembers**(members: `Vec<AccountId>`)
|
||||
- **summary**: Change the membership to a new set, disregarding the existing membership. Be nice and pass `members` pre-sorted. May only be called from `ResetOrigin` or root.
|
||||
|
||||
▸ **swapMember**(remove: `AccountId`, add: `AccountId`)
|
||||
- **summary**: Swap out one member `remove` for another `add`. May only be called from `SwapOrigin` or root.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### timestamp
|
||||
|
||||
▸ **set**(now: `Compact<Moment>`)
|
||||
- **summary**: Set the current time. This call should be invoked exactly once per block. It will panic at the finalization phase, if this call hasn't been invoked by that time. The timestamp should be greater than the previous one by the amount specified by `MinimumPeriod`. The dispatch origin for this call must be `Inherent`.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### treasury
|
||||
|
||||
▸ **approveProposal**(proposal_id: `Compact<ProposalIndex>`)
|
||||
- **summary**: Approve a proposal. At a later time, the proposal will be allocated to the beneficiary and the original deposit will be returned. # <weight> - O(1). - Limited storage reads. - One DB change. # </weight>
|
||||
|
||||
▸ **proposeSpend**(value: `Compact<BalanceOf>`, beneficiary: `Address`)
|
||||
- **summary**: Put forward a suggestion for spending. A deposit proportional to the value is reserved and slashed if the proposal is rejected. It is returned once the proposal is awarded. # <weight> - O(1). - Limited storage reads. - One DB change, one extra DB entry. # </weight>
|
||||
|
||||
▸ **rejectProposal**(proposal_id: `Compact<ProposalIndex>`)
|
||||
- **summary**: Reject a proposed spend. The original deposit will be slashed. # <weight> - O(1). - Limited storage reads. - One DB clear. # </weight>
|
||||
|
||||
___
|
||||
|
||||
|
||||
### utility
|
||||
|
||||
▸ **batch**(calls: `Vec<Call>`)
|
||||
- **summary**: Send a batch of dispatch calls (only root).
|
||||
@@ -1,175 +0,0 @@
|
||||
## JSON-RPC
|
||||
|
||||
The following sections contain RPC methods that are Remote Calls available by default and allow you to interact with the actual node, query, and submit.
|
||||
|
||||
- **[account](#account)**
|
||||
|
||||
- **[author](#author)**
|
||||
|
||||
- **[chain](#chain)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
|
||||
- **[rpc](#rpc)**
|
||||
|
||||
- **[state](#state)**
|
||||
|
||||
- **[system](#system)**
|
||||
|
||||
|
||||
___
|
||||
|
||||
|
||||
### account
|
||||
|
||||
_(Optional) Methods that retrieves account-specific information_
|
||||
|
||||
▸ **nextIndex**(accountId: `AccountId`): `Index`
|
||||
- **summary**: Retrieves the next accountIndex as available on the node
|
||||
|
||||
___
|
||||
|
||||
|
||||
### author
|
||||
|
||||
_Authoring of network items_
|
||||
|
||||
▸ **insertKey**(keyType: `Text`, suri: `Text`, publicKey: `Bytes`): `Bytes`
|
||||
- **summary**: Insert a key into the keystore.
|
||||
|
||||
▸ **pendingExtrinsics**(): `Vec<Extrinsic>`
|
||||
- **summary**: Returns all pending extrinsics, potentially grouped by sender
|
||||
|
||||
▸ **removeExtrinsic**(bytesOrHash: `Vec<ExtrinsicOrHash>`): `Vec<Hash>`
|
||||
- **summary**: Remove given extrinsic from the pool and temporarily ban it to prevent reimporting
|
||||
|
||||
▸ **rotateKeys**(): `Bytes`
|
||||
- **summary**: Generate new session keys and returns the corresponding public keys
|
||||
|
||||
▸ **submitAndWatchExtrinsic**(extrinsic: `Extrinsic`): `ExtrinsicStatus`
|
||||
- **summary**: Submit and subscribe to watch an extrinsic until unsubscribed
|
||||
|
||||
▸ **submitExtrinsic**(extrinsic: `Extrinsic`): `Hash`
|
||||
- **summary**: Submit a fully formatted extrinsic for block inclusion
|
||||
|
||||
___
|
||||
|
||||
|
||||
### chain
|
||||
|
||||
_Retrieval of chain data_
|
||||
|
||||
▸ **getBlock**(hash?: `Hash`): `SignedBlock`
|
||||
- **summary**: Get header and body of a relay chain block
|
||||
|
||||
▸ **getBlockHash**(blockNumber?: `BlockNumber`): `Hash`
|
||||
- **summary**: Get the block hash for a specific block
|
||||
|
||||
▸ **getFinalizedHead**(): `Hash`
|
||||
- **summary**: Get hash of the last finalized block in the canon chain
|
||||
|
||||
▸ **getHeader**(hash?: `Hash`): `Header`
|
||||
- **summary**: Retrieves the header for a specific block
|
||||
|
||||
▸ **subscribeFinalizedHeads**(): `Header`
|
||||
- **summary**: Retrieves the best finalized header via subscription
|
||||
|
||||
▸ **subscribeNewHeads**(): `Header`
|
||||
- **summary**: Retrieves the best header via subscription
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
|
||||
_(Optional) Methods that performs actions on contracts_
|
||||
|
||||
▸ **call**(callRequest: `ContractCallRequest`, at?: `Hash`): `ContractExecResult`
|
||||
- **summary**: Executes a call to a contract
|
||||
|
||||
___
|
||||
|
||||
|
||||
### rpc
|
||||
|
||||
_Retrieves information about the RPC endpoints_
|
||||
|
||||
▸ **methods**(): `RpcMethods`
|
||||
- **summary**: Retrieves the list of RPC methods that are exposed by the node
|
||||
|
||||
___
|
||||
|
||||
|
||||
### state
|
||||
|
||||
_Query of state_
|
||||
|
||||
▸ **call**(method: `Text`, data: `Bytes`, block?: `Hash`): `Bytes`
|
||||
- **summary**: Perform a call to a builtin on the chain
|
||||
|
||||
▸ **getChildKeys**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `Vec<StorageKey>`
|
||||
- **summary**: Retrieves the keys with prefix of a specific child storage
|
||||
|
||||
▸ **getChildStorage**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `StorageData`
|
||||
- **summary**: Retrieves the child storage for a key
|
||||
|
||||
▸ **getChildStorageHash**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `Hash`
|
||||
- **summary**: Retrieves the child storage hash
|
||||
|
||||
▸ **getChildStorageSize**(childStorageKey: `StorageKey`, key: `StorageKey`, block?: `Hash`): `u64`
|
||||
- **summary**: Retrieves the child storage size
|
||||
|
||||
▸ **getKeys**(key: `StorageKey`, block?: `Hash`): `Vec<StorageKey>`
|
||||
- **summary**: Retrieves the keys with a certain prefix
|
||||
|
||||
▸ **getMetadata**(block?: `Hash`): `Metadata`
|
||||
- **summary**: Returns the runtime metadata
|
||||
|
||||
▸ **getRuntimeVersion**(hash?: `Hash`): `RuntimeVersion`
|
||||
- **summary**: Get the runtime version
|
||||
|
||||
▸ **getStorage**(key: `StorageKey`, block?: `Hash`): `StorageData`
|
||||
- **summary**: Retrieves the storage for a key
|
||||
|
||||
▸ **getStorageHash**(key: `StorageKey`, block?: `Hash`): `Hash`
|
||||
- **summary**: Retrieves the storage hash
|
||||
|
||||
▸ **getStorageSize**(key: `StorageKey`, block?: `Hash`): `u64`
|
||||
- **summary**: Retrieves the storage size
|
||||
|
||||
▸ **queryStorage**(keys: `Vec<StorageKey>`, startBlock: `Hash`, block?: `Hash`): `Vec<StorageChangeSet>`
|
||||
- **summary**: Query historical storage entries (by key) starting from a start block
|
||||
|
||||
▸ **subscribeRuntimeVersion**(): `RuntimeVersion`
|
||||
- **summary**: Retrieves the runtime version via subscription
|
||||
|
||||
▸ **subscribeStorage**(keys: `Vec<StorageKey>`): `StorageChangeSet`
|
||||
- **summary**: Subscribes to storage changes for the provided keys
|
||||
|
||||
___
|
||||
|
||||
|
||||
### system
|
||||
|
||||
_Calls to retrieve system info_
|
||||
|
||||
▸ **chain**(): `Text`
|
||||
- **summary**: Retrieves the chain
|
||||
|
||||
▸ **health**(): `Health`
|
||||
- **summary**: Return health status of the node
|
||||
|
||||
▸ **name**(): `Text`
|
||||
- **summary**: Retrieves the node name
|
||||
|
||||
▸ **networkState**(): `NetworkState`
|
||||
- **summary**: Returns current state of the network
|
||||
|
||||
▸ **peers**(): `Vec<PeerInfo>`
|
||||
- **summary**: Returns the currently connected peers
|
||||
|
||||
▸ **properties**(): `ChainProperties`
|
||||
- **summary**: Get a custom set of properties as a JSON object, defined in the chain spec
|
||||
|
||||
▸ **version**(): `Text`
|
||||
- **summary**: Retrieves the version of the node
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "substrate",
|
||||
"description": "These are keys that are always available to the runtime implementation",
|
||||
"items": [
|
||||
{
|
||||
"name": "changesTrieConfig(): `u32`",
|
||||
"summary": "Changes trie configuration is stored under this key."
|
||||
},
|
||||
{
|
||||
"name": "childStorageKeyPrefix(): `u32`",
|
||||
"summary": "Prefix of child storage keys."
|
||||
},
|
||||
{
|
||||
"name": "code(): `Bytes`",
|
||||
"summary": "Wasm code of the runtime."
|
||||
},
|
||||
{
|
||||
"name": "extrinsicIndex(): `u32`",
|
||||
"summary": "Current extrinsic index (u32) is stored under this key."
|
||||
},
|
||||
{
|
||||
"name": "heapPages(): `u64`",
|
||||
"summary": "Number of wasm linear memory pages required for execution of the runtime."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
---
|
||||
|
||||
### substrate
|
||||
|
||||
_These are keys that are always available to the runtime implementation_
|
||||
|
||||
▸ **changesTrieConfig**(): `u32`
|
||||
- **summary**: Changes trie configuration is stored under this key.
|
||||
|
||||
▸ **childStorageKeyPrefix**(): `u32`
|
||||
- **summary**: Prefix of child storage keys.
|
||||
|
||||
▸ **code**(): `Bytes`
|
||||
- **summary**: Wasm code of the runtime.
|
||||
|
||||
▸ **extrinsicIndex**(): `u32`
|
||||
- **summary**: Current extrinsic index (u32) is stored under this key.
|
||||
|
||||
▸ **heapPages**(): `u64`
|
||||
- **summary**: Number of wasm linear memory pages required for execution of the runtime.
|
||||
|
||||
---
|
||||
@@ -1,545 +0,0 @@
|
||||
## Storage
|
||||
|
||||
The following sections contain Storage methods are part of the default Substrate runtime. On the api, these are exposed via `api.query.<module>.<method>`.
|
||||
|
||||
(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)
|
||||
- **[authorship](#authorship)**
|
||||
|
||||
- **[babe](#babe)**
|
||||
|
||||
- **[balances](#balances)**
|
||||
|
||||
- **[contracts](#contracts)**
|
||||
|
||||
- **[council](#council)**
|
||||
|
||||
- **[democracy](#democracy)**
|
||||
|
||||
- **[elections](#elections)**
|
||||
|
||||
- **[grandpa](#grandpa)**
|
||||
|
||||
- **[imOnline](#imOnline)**
|
||||
|
||||
- **[indices](#indices)**
|
||||
|
||||
- **[offences](#offences)**
|
||||
|
||||
- **[session](#session)**
|
||||
|
||||
- **[staking](#staking)**
|
||||
|
||||
- **[sudo](#sudo)**
|
||||
|
||||
- **[system](#system)**
|
||||
|
||||
- **[technicalCommittee](#technicalCommittee)**
|
||||
|
||||
- **[technicalMembership](#technicalMembership)**
|
||||
|
||||
- **[timestamp](#timestamp)**
|
||||
|
||||
- **[treasury](#treasury)**
|
||||
|
||||
- **[substrate](#substrate)**
|
||||
|
||||
|
||||
___
|
||||
|
||||
|
||||
### authorship
|
||||
|
||||
▸ **author**(): `Option<AccountId>`
|
||||
- **summary**: Author of current block.
|
||||
|
||||
▸ **didSetUncles**(): `bool`
|
||||
- **summary**: Whether uncles were already set in this block.
|
||||
|
||||
▸ **uncles**(): `Vec<UncleEntryItem>`
|
||||
- **summary**: Uncles
|
||||
|
||||
___
|
||||
|
||||
|
||||
### babe
|
||||
|
||||
▸ **authorities**(): `Vec<(AuthorityId,BabeAuthorityWeight)>`
|
||||
- **summary**: Current epoch authorities.
|
||||
|
||||
▸ **currentSlot**(): `u64`
|
||||
- **summary**: Current slot number.
|
||||
|
||||
▸ **epochIndex**(): `u64`
|
||||
- **summary**: Current epoch index.
|
||||
|
||||
▸ **genesisSlot**(): `u64`
|
||||
- **summary**: The slot at which the first epoch actually started. This is 0 until the first block of the chain.
|
||||
|
||||
▸ **initialized**(): `Option<MaybeVrf>`
|
||||
- **summary**: Temporary value (cleared at block finalization) which is `Some` if per-block initialization has already been called for current block.
|
||||
|
||||
▸ **nextRandomness**(): `[u8;32]`
|
||||
- **summary**: Next epoch randomness.
|
||||
|
||||
▸ **randomness**(): `[u8;32]`
|
||||
- **summary**: The epoch randomness for the *current* epoch. # Security This MUST NOT be used for gambling, as it can be influenced by a malicious validator in the short term. It MAY be used in many cryptographic protocols, however, so long as one remembers that this (like everything else on-chain) it is public. For example, it can be used where a number is needed that cannot have been chosen by an adversary, for purposes such as public-coin zero-knowledge proofs.
|
||||
|
||||
▸ **segmentIndex**(): `u32`
|
||||
- **summary**: Randomness under construction. We make a tradeoff between storage accesses and list length. We store the under-construction randomness in segments of up to `UNDER_CONSTRUCTION_SEGMENT_LENGTH`. Once a segment reaches this length, we begin the next one. We reset all segments and return to `0` at the beginning of every epoch.
|
||||
|
||||
▸ **underConstruction**(`u32`): `Vec<[u8;32]>`
|
||||
|
||||
___
|
||||
|
||||
|
||||
### balances
|
||||
|
||||
▸ **freeBalance**(`AccountId`): `Balance`
|
||||
- **summary**: The 'free' balance of a given account. This is the only balance that matters in terms of most operations on tokens. It alone is used to determine the balance when in the contract execution environment. When this balance falls below the value of `ExistentialDeposit`, then the 'current account' is deleted: specifically `FreeBalance`. Further, the `OnFreeBalanceZero` callback is invoked, giving a chance to external modules to clean up data associated with the deleted account. `system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets collapsed to zero if it ever becomes less than `ExistentialDeposit`.
|
||||
|
||||
▸ **locks**(`AccountId`): `Vec<BalanceLock>`
|
||||
- **summary**: Any liquidity locks on some account balances.
|
||||
|
||||
▸ **reservedBalance**(`AccountId`): `Balance`
|
||||
- **summary**: The amount of the balance of a given account that is externally reserved; this can still get slashed, but gets slashed last of all. This balance is a 'reserve' balance that other subsystems use in order to set aside tokens that are still 'owned' by the account holder, but which are suspendable. When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account' is deleted: specifically, `ReservedBalance`. `system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets collapsed to zero if it ever becomes less than `ExistentialDeposit`.)
|
||||
|
||||
▸ **totalIssuance**(): `Balance`
|
||||
- **summary**: The total units issued in the system.
|
||||
|
||||
▸ **vesting**(`AccountId`): `Option<VestingSchedule>`
|
||||
- **summary**: Information regarding the vesting of a given account.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### contracts
|
||||
|
||||
▸ **accountCounter**(): `u64`
|
||||
- **summary**: The subtrie counter.
|
||||
|
||||
▸ **codeStorage**(`CodeHash`): `Option<PrefabWasmModule>`
|
||||
- **summary**: A mapping between an original code hash and instrumented wasm code, ready for execution.
|
||||
|
||||
▸ **contractInfoOf**(`AccountId`): `Option<ContractInfo>`
|
||||
- **summary**: The code associated with a given account.
|
||||
|
||||
▸ **currentSchedule**(): `Schedule`
|
||||
- **summary**: Current cost schedule for contracts.
|
||||
|
||||
▸ **gasPrice**(): `BalanceOf`
|
||||
- **summary**: The price of one unit of gas.
|
||||
|
||||
▸ **gasSpent**(): `Gas`
|
||||
- **summary**: Gas spent so far in this block.
|
||||
|
||||
▸ **pristineCode**(`CodeHash`): `Option<Bytes>`
|
||||
- **summary**: A mapping from an original code hash to the original code, untouched by instrumentation.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### council
|
||||
|
||||
▸ **members**(): `Vec<AccountId>`
|
||||
- **summary**: The current members of the collective. This is stored sorted (just by value).
|
||||
|
||||
▸ **proposalCount**(): `u32`
|
||||
- **summary**: Proposals so far.
|
||||
|
||||
▸ **proposalOf**(`Hash`): `Option<Proposal>`
|
||||
- **summary**: Actual proposal for a given hash, if it's current.
|
||||
|
||||
▸ **proposals**(): `Vec<Hash>`
|
||||
- **summary**: The hashes of the active proposals.
|
||||
|
||||
▸ **voting**(`Hash`): `Option<Votes>`
|
||||
- **summary**: Votes on a given proposal, if it is ongoing.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### democracy
|
||||
|
||||
▸ **blacklist**(`Hash`): `Option<(BlockNumber,Vec<AccountId>)>`
|
||||
- **summary**: 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.
|
||||
|
||||
▸ **cancellations**(`Hash`): `bool`
|
||||
- **summary**: Record of all proposals that have been subject to emergency cancellation.
|
||||
|
||||
▸ **delegations**(`AccountId`): `((AccountId,Conviction), Linkage<AccountId>)`
|
||||
- **summary**: Get the account (and lock periods) to which another account is delegating vote.
|
||||
|
||||
▸ **depositOf**(`PropIndex`): `Option<(BalanceOf,Vec<AccountId>)>`
|
||||
- **summary**: Those who have locked a deposit.
|
||||
|
||||
▸ **dispatchQueue**(`BlockNumber`): `Vec<Option<(Proposal,ReferendumIndex)>>`
|
||||
- **summary**: Queue of successful referenda to be dispatched.
|
||||
|
||||
▸ **lastTabledWasExternal**(): `bool`
|
||||
- **summary**: True if the last referendum tabled was submitted externally. False if it was a public proposal.
|
||||
|
||||
▸ **nextExternal**(): `Option<(Proposal,VoteThreshold)>`
|
||||
- **summary**: The referendum to be tabled whenever it would be valid to table an external proposal. This happens when a referendum needs to be tabled and one of two conditions are met: - `LastTabledWasExternal` is `false`; or - `PublicProps` is empty.
|
||||
|
||||
▸ **nextTally**(): `ReferendumIndex`
|
||||
- **summary**: The next referendum index that should be tallied.
|
||||
|
||||
▸ **proxy**(`AccountId`): `Option<AccountId>`
|
||||
- **summary**: Who is able to vote for whom. Value is the fund-holding account, key is the vote-transaction-sending account.
|
||||
|
||||
▸ **publicPropCount**(): `PropIndex`
|
||||
- **summary**: The number of (public) proposals that have been made so far.
|
||||
|
||||
▸ **publicProps**(): `Vec<(PropIndex,Proposal,AccountId)>`
|
||||
- **summary**: The public proposals. Unsorted.
|
||||
|
||||
▸ **referendumCount**(): `ReferendumIndex`
|
||||
- **summary**: The next free referendum index, aka the number of referenda started so far.
|
||||
|
||||
▸ **referendumInfoOf**(`ReferendumIndex`): `Option<ReferendumInfo>`
|
||||
- **summary**: Information concerning any given referendum.
|
||||
|
||||
▸ **voteOf**(`(ReferendumIndex,AccountId)`): `Vote`
|
||||
- **summary**: Get the vote in a given referendum of a particular voter. The result is meaningful only if `voters_for` includes the voter when called with the referendum (you'll get the default `Vote` value otherwise). If you don't want to check `voters_for`, then you can also check for simple existence with `VoteOf::exists` first.
|
||||
|
||||
▸ **votersFor**(`ReferendumIndex`): `Vec<AccountId>`
|
||||
- **summary**: Get the voters for the current proposal.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### elections
|
||||
|
||||
▸ **approvalsOf**(`(AccountId,SetIndex)`): `Vec<ApprovalFlag>`
|
||||
|
||||
▸ **candidateCount**(): `u32`
|
||||
- **summary**: Current number of active candidates
|
||||
|
||||
▸ **candidates**(): `Vec<AccountId>`
|
||||
- **summary**: The present candidate list.
|
||||
|
||||
▸ **desiredSeats**(): `u32`
|
||||
- **summary**: Number of accounts that should constitute the collective.
|
||||
|
||||
▸ **leaderboard**(): `Option<Vec<(BalanceOf,AccountId)>>`
|
||||
- **summary**: Get the leaderboard if we're in the presentation phase. The first element is the weight of each entry; It may be the direct summed approval stakes, or a weighted version of it. Sorted from low to high.
|
||||
|
||||
▸ **members**(): `Vec<(AccountId,BlockNumber)>`
|
||||
- **summary**: The current membership. When there's a vote going on, this should still be used for executive matters. The block number (second element in the tuple) is the block that their position is active until (calculated by the sum of the block number when the member was elected and their term duration).
|
||||
|
||||
▸ **nextFinalize**(): `Option<(BlockNumber,u32,Vec<AccountId>)>`
|
||||
- **summary**: The accounts holding the seats that will become free on the next tally.
|
||||
|
||||
▸ **nextVoterSet**(): `SetIndex`
|
||||
- **summary**: the next free set to store a voter in. This will keep growing.
|
||||
|
||||
▸ **presentationDuration**(): `BlockNumber`
|
||||
- **summary**: How long to give each top candidate to present themselves after the vote ends.
|
||||
|
||||
▸ **proxy**(`AccountId`): `Option<AccountId>`
|
||||
- **summary**: Who is able to vote for whom. Value is the fund-holding account, key is the vote-transaction-sending account.
|
||||
|
||||
▸ **registerInfoOf**(`AccountId`): `Option<(VoteIndex,u32)>`
|
||||
- **summary**: The vote index and list slot that the candidate `who` was registered or `None` if they are not currently registered.
|
||||
|
||||
▸ **termDuration**(): `BlockNumber`
|
||||
- **summary**: How long each position is active for.
|
||||
|
||||
▸ **voteCount**(): `VoteIndex`
|
||||
- **summary**: The total number of vote rounds that have happened or are in progress.
|
||||
|
||||
▸ **voterCount**(): `SetIndex`
|
||||
- **summary**: Current number of Voters.
|
||||
|
||||
▸ **voterInfoOf**(`AccountId`): `Option<VoterInfo>`
|
||||
- **summary**: Basic information about a voter.
|
||||
|
||||
▸ **voters**(`SetIndex`): `Vec<Option<AccountId>>`
|
||||
- **summary**: The present voter list (chunked and capped at [`VOTER_SET_SIZE`]).
|
||||
|
||||
___
|
||||
|
||||
|
||||
### grandpa
|
||||
|
||||
▸ **authorities**(): `Vec<(AuthorityId,AuthorityWeight)>`
|
||||
- **summary**: The current authority set.
|
||||
|
||||
▸ **currentSetId**(): `SetId`
|
||||
- **summary**: The number of changes (both in terms of keys and underlying economic responsibilities) in the "set" of Grandpa validators from genesis.
|
||||
|
||||
▸ **nextForced**(): `Option<BlockNumber>`
|
||||
- **summary**: next block number where we can force a change.
|
||||
|
||||
▸ **pendingChange**(): `Option<StoredPendingChange>`
|
||||
- **summary**: Pending change: (signaled at, scheduled change).
|
||||
|
||||
▸ **setIdSession**(`SetId`): `Option<SessionIndex>`
|
||||
- **summary**: A mapping from grandpa set ID to the index of the *most recent* session for which its members were responsible.
|
||||
|
||||
▸ **stalled**(): `Option<(BlockNumber,BlockNumber)>`
|
||||
- **summary**: `true` if we are currently stalled.
|
||||
|
||||
▸ **state**(): `StoredState`
|
||||
- **summary**: State of the current authority set.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### imOnline
|
||||
|
||||
▸ **gossipAt**(): `BlockNumber`
|
||||
- **summary**: The block number when we should gossip.
|
||||
|
||||
▸ **keys**(): `Vec<AuthorityId>`
|
||||
- **summary**: The current set of keys that may issue a heartbeat.
|
||||
|
||||
▸ **receivedHeartbeats**(`SessionIndex, AuthIndex`): `Bytes`
|
||||
- **summary**: For each session index we keep a mapping of `AuthorityId` to `offchain::OpaqueNetworkState`.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### indices
|
||||
|
||||
▸ **enumSet**(`AccountIndex`): `Vec<AccountId>`
|
||||
- **summary**: The enumeration sets.
|
||||
|
||||
▸ **nextEnumSet**(): `AccountIndex`
|
||||
- **summary**: The next free enumeration set.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### offences
|
||||
|
||||
▸ **concurrentReportsIndex**(`Kind, OpaqueTimeSlot`): `Vec<ReportIdOf>`
|
||||
- **summary**: A vector of reports of the same kind that happened at the same time slot.
|
||||
|
||||
▸ **reports**(`ReportIdOf`): `Option<OffenceDetails>`
|
||||
- **summary**: The primary structure that holds all offence records keyed by report identifiers.
|
||||
|
||||
▸ **reportsByKindIndex**(`Kind`): `Bytes`
|
||||
- **summary**: Enumerates all reports of a kind along with the time they happened. All reports are sorted by the time of offence. Note that the actual type of this mapping is `Vec<u8>`, this is because values of different types are not supported at the moment so we are doing the manual serialization.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### session
|
||||
|
||||
▸ **currentIndex**(): `SessionIndex`
|
||||
- **summary**: Current index of the session.
|
||||
|
||||
▸ **disabledValidators**(): `Vec<u32>`
|
||||
- **summary**: Indices of disabled validators. The set is cleared when `on_session_ending` returns a new set of identities.
|
||||
|
||||
▸ **keyOwner**(`Bytes, (KeyTypeId,Bytes)`): `Option<ValidatorId>`
|
||||
- **summary**: The owner of a key. The second key is the `KeyTypeId` + the encoded key. The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of the trie. Having all data in the same branch should prevent slowing down other queries.
|
||||
|
||||
▸ **nextKeys**(`Bytes, ValidatorId`): `Option<Keys>`
|
||||
- **summary**: The next session keys for a validator. The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of the trie. Having all data in the same branch should prevent slowing down other queries.
|
||||
|
||||
▸ **queuedChanged**(): `bool`
|
||||
- **summary**: True if the underlying economic identities or weighting behind the validators has changed in the queued validator set.
|
||||
|
||||
▸ **queuedKeys**(): `Vec<(ValidatorId,Keys)>`
|
||||
- **summary**: The queued keys for the next session. When the next session begins, these keys will be used to determine the validator's session keys.
|
||||
|
||||
▸ **validators**(): `Vec<ValidatorId>`
|
||||
- **summary**: The current set of validators.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### staking
|
||||
|
||||
▸ **bonded**(`AccountId`): `Option<AccountId>`
|
||||
- **summary**: Map from all locked "stash" accounts to the controller account.
|
||||
|
||||
▸ **bondedEras**(): `Vec<(EraIndex,SessionIndex)>`
|
||||
- **summary**: A mapping from still-bonded eras to the first session index of that era.
|
||||
|
||||
▸ **currentElected**(): `Vec<AccountId>`
|
||||
- **summary**: The currently elected validator set keyed by stash account ID.
|
||||
|
||||
▸ **currentEra**(): `EraIndex`
|
||||
- **summary**: The current era index.
|
||||
|
||||
▸ **currentEraPointsEarned**(): `EraPoints`
|
||||
- **summary**: Rewards for the current era. Using indices of current elected set.
|
||||
|
||||
▸ **currentEraStart**(): `MomentOf`
|
||||
- **summary**: The start of the current era.
|
||||
|
||||
▸ **currentEraStartSessionIndex**(): `SessionIndex`
|
||||
- **summary**: The session index at which the current era started.
|
||||
|
||||
▸ **eraSlashJournal**(`EraIndex`): `Vec<SlashJournalEntry>`
|
||||
- **summary**: All slashes that have occurred in a given era.
|
||||
|
||||
▸ **forceEra**(): `Forcing`
|
||||
- **summary**: True if the next session change will be a new era regardless of index.
|
||||
|
||||
▸ **invulnerables**(): `Vec<AccountId>`
|
||||
- **summary**: Any validators that may never be slashed or forcibly kicked. It's a Vec since they're easy to initialize and the performance hit is minimal (we expect no more than four invulnerables) and restricted to testnets.
|
||||
|
||||
▸ **ledger**(`AccountId`): `Option<StakingLedger>`
|
||||
- **summary**: Map from all (unlocked) "controller" accounts to the info regarding the staking.
|
||||
|
||||
▸ **minimumValidatorCount**(): `u32`
|
||||
- **summary**: Minimum number of staking participants before emergency conditions are imposed.
|
||||
|
||||
▸ **nominators**(`AccountId`): `(Vec<AccountId>, Linkage<AccountId>)`
|
||||
- **summary**: The map from nominator stash key to the set of stash keys of all validators to nominate.
|
||||
|
||||
▸ **payee**(`AccountId`): `RewardDestination`
|
||||
- **summary**: Where the reward payment should be made. Keyed by stash.
|
||||
|
||||
▸ **slashRewardFraction**(): `Perbill`
|
||||
- **summary**: The percentage of the slash that is distributed to reporters. The rest of the slashed value is handled by the `Slash`.
|
||||
|
||||
▸ **slotStake**(): `BalanceOf`
|
||||
- **summary**: The amount of balance actively at stake for each validator slot, currently. This is used to derive rewards and punishments.
|
||||
|
||||
▸ **stakers**(`AccountId`): `Exposure`
|
||||
- **summary**: Nominators for a particular account that is in action right now. You can't iterate through validators here, but you can find them in the Session module. This is keyed by the stash account.
|
||||
|
||||
▸ **validatorCount**(): `u32`
|
||||
- **summary**: The ideal number of staking participants.
|
||||
|
||||
▸ **validators**(`AccountId`): `(ValidatorPrefs, Linkage<AccountId>)`
|
||||
- **summary**: The map from (wannabe) validator stash key to the preferences of that validator.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### sudo
|
||||
|
||||
▸ **key**(): `AccountId`
|
||||
- **summary**: The `AccountId` of the sudo key.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### system
|
||||
|
||||
▸ **accountNonce**(`AccountId`): `Index`
|
||||
- **summary**: Extrinsics nonce for accounts.
|
||||
|
||||
▸ **allExtrinsicsLen**(): `Option<u32>`
|
||||
- **summary**: Total length (in bytes) for all extrinsics put together, for the current block.
|
||||
|
||||
▸ **allExtrinsicsWeight**(): `Option<Weight>`
|
||||
- **summary**: Total weight for all extrinsics put together, for the current block.
|
||||
|
||||
▸ **blockHash**(`BlockNumber`): `Hash`
|
||||
- **summary**: Map of block numbers to block hashes.
|
||||
|
||||
▸ **digest**(): `DigestOf`
|
||||
- **summary**: Digest of the current block, also part of the block header.
|
||||
|
||||
▸ **eventCount**(): `EventIndex`
|
||||
- **summary**: The number of events in the `Events<T>` list.
|
||||
|
||||
▸ **events**(): `Vec<EventRecord>`
|
||||
- **summary**: Events deposited for the current block.
|
||||
|
||||
▸ **eventTopics**(`Null, Hash`): `Vec<(BlockNumber,EventIndex)>`
|
||||
- **summary**: Mapping between a topic (represented by T::Hash) and a vector of indexes of events in the `<Events<T>>` list. The first key serves no purpose. This field is declared as double_map just for convenience of using `remove_prefix`. All topic vectors have deterministic storage locations depending on the topic. This allows light-clients to leverage the changes trie storage tracking mechanism and in case of changes fetch the list of events of interest. The value has the type `(T::BlockNumber, EventIndex)` because if we used only just the `EventIndex` then in case if the topic has the same contents on the next block no notification will be triggered thus the event might be lost.
|
||||
|
||||
▸ **extrinsicCount**(): `Option<u32>`
|
||||
- **summary**: Total extrinsics count for the current block.
|
||||
|
||||
▸ **extrinsicData**(`u32`): `Bytes`
|
||||
- **summary**: Extrinsics data for the current block (maps an extrinsic's index to its data).
|
||||
|
||||
▸ **extrinsicsRoot**(): `Hash`
|
||||
- **summary**: Extrinsics root of the current block, also part of the block header.
|
||||
|
||||
▸ **nextWeightMultiplier**(): `WeightMultiplier`
|
||||
- **summary**: The next weight multiplier. This should be updated at the end of each block based on the saturation level (weight).
|
||||
|
||||
▸ **number**(): `BlockNumber`
|
||||
- **summary**: The current block number being processed. Set by `execute_block`.
|
||||
|
||||
▸ **parentHash**(): `Hash`
|
||||
- **summary**: Hash of the previous block.
|
||||
|
||||
▸ **randomMaterial**(): `(i8,Vec<Hash>)`
|
||||
- **summary**: Series of block headers from the last 81 blocks that acts as random seed material. This is arranged as a ring buffer with the `i8` prefix being the index into the `Vec` of the oldest hash.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalCommittee
|
||||
|
||||
▸ **members**(): `Vec<AccountId>`
|
||||
- **summary**: The current members of the collective. This is stored sorted (just by value).
|
||||
|
||||
▸ **proposalCount**(): `u32`
|
||||
- **summary**: Proposals so far.
|
||||
|
||||
▸ **proposalOf**(`Hash`): `Option<Proposal>`
|
||||
- **summary**: Actual proposal for a given hash, if it's current.
|
||||
|
||||
▸ **proposals**(): `Vec<Hash>`
|
||||
- **summary**: The hashes of the active proposals.
|
||||
|
||||
▸ **voting**(`Hash`): `Option<Votes>`
|
||||
- **summary**: Votes on a given proposal, if it is ongoing.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### technicalMembership
|
||||
|
||||
▸ **members**(): `Vec<AccountId>`
|
||||
- **summary**: The current membership, stored as an ordered Vec.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### timestamp
|
||||
|
||||
▸ **didUpdate**(): `bool`
|
||||
- **summary**: Did the timestamp get updated in this block?
|
||||
|
||||
▸ **now**(): `Moment`
|
||||
- **summary**: Current time for the current block.
|
||||
|
||||
___
|
||||
|
||||
|
||||
### treasury
|
||||
|
||||
▸ **approvals**(): `Vec<ProposalIndex>`
|
||||
- **summary**: Proposal indices that have been approved but not yet awarded.
|
||||
|
||||
▸ **proposalCount**(): `ProposalIndex`
|
||||
- **summary**: Number of proposals that have been made.
|
||||
|
||||
▸ **proposals**(`ProposalIndex`): `Option<TreasuryProposal>`
|
||||
- **summary**: Proposals that have been made.
|
||||
|
||||
---
|
||||
|
||||
### substrate
|
||||
|
||||
_These are keys that are always available to the runtime implementation_
|
||||
|
||||
▸ **changesTrieConfig**(): `u32`
|
||||
- **summary**: Changes trie configuration is stored under this key.
|
||||
|
||||
▸ **childStorageKeyPrefix**(): `u32`
|
||||
- **summary**: Prefix of child storage keys.
|
||||
|
||||
▸ **code**(): `Bytes`
|
||||
- **summary**: Wasm code of the runtime.
|
||||
|
||||
▸ **extrinsicIndex**(): `u32`
|
||||
- **summary**: Current extrinsic index (u32) is stored under this key.
|
||||
|
||||
▸ **heapPages**(): `u64`
|
||||
- **summary**: Number of wasm linear memory pages required for execution of the runtime.
|
||||
|
||||
---
|
||||
+6
-5
@@ -6,20 +6,20 @@ module.exports = Object.assign({}, config, {
|
||||
moduleNameMapper: {
|
||||
'@polkadot/api-contract(.*)$': '<rootDir>/packages/api-contract/src/$1',
|
||||
'@polkadot/api-derive(.*)$': '<rootDir>/packages/api-derive/src/$1',
|
||||
'@polkadot/api-metadata(.*)$': '<rootDir>/packages/api-metadata/src/$1',
|
||||
'@polkadot/api(.*)$': '<rootDir>/packages/api/src/$1',
|
||||
'@polkadot/jsonrpc(.*)$': '<rootDir>/packages/jsonrpc/src/$1',
|
||||
'@polkadot/metadata(.*)$': '<rootDir>/packages/metadata/src/$1',
|
||||
'@polkadot/rpc-(core|provider)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
|
||||
'@polkadot/jsonrpc(.*)$': '<rootDir>/packages/type-jsonrpc/src/$1',
|
||||
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
|
||||
},
|
||||
modulePathIgnorePatterns: [
|
||||
'<rootDir>/packages/api/build',
|
||||
'<rootDir>/packages/api-derive/build',
|
||||
'<rootDir>/packages/api-contract/build',
|
||||
'<rootDir>/packages/api-metadata/build',
|
||||
'<rootDir>/packages/jsonrpc/build',
|
||||
'<rootDir>/packages/metadata/build',
|
||||
'<rootDir>/packages/rpc-core/build',
|
||||
'<rootDir>/packages/rpc-provider/build',
|
||||
'<rootDir>/packages/type-jsonrpc/build',
|
||||
'<rootDir>/packages/types/build'
|
||||
],
|
||||
globals: {
|
||||
@@ -31,5 +31,6 @@ module.exports = Object.assign({}, config, {
|
||||
ws_local_polkadot_alex: 'ws://127.0.0.1:9949/',
|
||||
ws_substrate_1: 'wss://substrate-rpc.parity.io/',
|
||||
ws_polkadot_alex: 'wss://poc3-rpc.polkadot.io/'
|
||||
}
|
||||
},
|
||||
resolver: './jest.resolver.js'
|
||||
});
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright 2017-2020 @polkadot/util authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function resolver (file, config) {
|
||||
if (file.includes('package.json')) {
|
||||
return path.join(config.basedir.replace('/src', '/'), file);
|
||||
}
|
||||
|
||||
return config.defaultResolver(file, config);
|
||||
};
|
||||
+1
-1
@@ -9,5 +9,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "0.95.2"
|
||||
"version": "1.4.1"
|
||||
}
|
||||
|
||||
+16
-20
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.95.2",
|
||||
"version": "1.4.1",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"yarn": "^1.10.1"
|
||||
@@ -8,30 +8,26 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"typescript": "^3.6.4"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||
"build:interfaces": "node packages/types/src/scripts/interfacesTsWrapper.js",
|
||||
"docs": "node packages/types/src/scripts/MetadataMdWrapper.js && polkadot-dev-build-docs",
|
||||
"chain:info": "node packages/types/src/scripts/extractChainWrapper.js",
|
||||
"lint": "eslint --ext .js,.jsx,.ts,.tsx . && tsc --noEmit --pretty",
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts && (cd packages/typegen && copyfiles scripts/* build)",
|
||||
"build:interfaces": "polkadot-types-internal-interfaces",
|
||||
"docs": "polkadot-types-internal-metadata && polkadot-dev-build-docs",
|
||||
"chain:info": "polkadot-types-chain-info",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
"test": "jest --coverage --runInBand --testPathIgnorePatterns e2e",
|
||||
"test:all": "jest",
|
||||
"test:e2e": "jest packages/api/test/e2e",
|
||||
"test:e2e-docker": "TEST_DOCKER=1 jest packages/api/test/e2e",
|
||||
"test:e2e-remote": "TEST_REMOTE=1 jest packages/api/test/e2e",
|
||||
"test:one": "jest",
|
||||
"test:watch": "jest --coverage --watch"
|
||||
"test": "polkadot-dev-run-test --coverage --runInBand --testPathIgnorePatterns e2e",
|
||||
"test:one": "polkadot-dev-run-test",
|
||||
"test:watch": "polkadot-dev-run-test --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.6.4",
|
||||
"@babel/register": "^7.6.2",
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/dev": "^0.32.0-beta.11",
|
||||
"@polkadot/ts": "^0.1.82"
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/register": "^7.8.3",
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/dev": "^0.41.4",
|
||||
"@polkadot/ts": "^0.2.3",
|
||||
"copyfiles": "^2.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
Interfaces to allow for the encoding and decoding of Substrate contract ABIs.
|
||||
|
||||
```js
|
||||
import {ApiPromise, WsProvider } from '@polkadot/api';
|
||||
import { Abi } from '@polkadot/api-contract';
|
||||
|
||||
const abi = new Abi(<...JSON ABI...>);
|
||||
const wsProvider = new WsProvider(<...Node Url...>);
|
||||
const api = await ApiPromise.create({ provider: wsProvider });
|
||||
const abi = new Abi(api.registry, <...JSON ABI...>);
|
||||
|
||||
api.tx.contracts
|
||||
.call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "0.95.2",
|
||||
"version": "1.4.1",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -26,7 +26,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/types": "^0.95.2"
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/api": "1.4.1",
|
||||
"@polkadot/rpc-core": "1.4.1",
|
||||
"@polkadot/types": "1.4.1",
|
||||
"@polkadot/util": "^2.5.1",
|
||||
"bn.js": "^5.1.1",
|
||||
"rxjs": "^6.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import erc20Abi from '../test/contracts/Erc20.json';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
|
||||
import incrementerAbi from '../test/contracts/incrementer.json';
|
||||
import { Abi } from '.';
|
||||
|
||||
describe('Abi', (): void => {
|
||||
describe('erc20', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
describe('incrementer', (): void => {
|
||||
let abi: Abi;
|
||||
|
||||
beforeEach((): void => {
|
||||
abi = new Abi(erc20Abi);
|
||||
abi = new Abi(registry, incrementerAbi);
|
||||
});
|
||||
|
||||
it('has the attached methods', (): void => {
|
||||
expect(Object.keys(abi.messages)).toEqual(
|
||||
['totalSupply', 'balanceOf', 'allowance', 'transfer', 'approve', 'transferFrom']
|
||||
expect(Object.values(abi.abi.contract.messages).map(({ name }): string => name)).toEqual(
|
||||
['inc', 'get', 'compare']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ContractABI, ContractABIPre, ContractABIFn, InterfaceAbi, AbiMessages } from './types';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { AbiConstructors, AbiMessages, ContractABI, ContractABIPre, ContractABIFn, InterfaceAbi } from './types';
|
||||
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import ContractRegistry from './ContractRegistry';
|
||||
@@ -10,12 +12,12 @@ import ContractRegistry from './ContractRegistry';
|
||||
export default class ContractAbi extends ContractRegistry implements InterfaceAbi {
|
||||
public readonly abi: ContractABI;
|
||||
|
||||
public readonly constructors: ContractABIFn[];
|
||||
public readonly constructors: AbiConstructors;
|
||||
|
||||
public readonly messages: AbiMessages = {};
|
||||
public readonly messages: AbiMessages;
|
||||
|
||||
public constructor (abi: ContractABIPre) {
|
||||
super(abi);
|
||||
constructor (registry: Registry, abi: ContractABIPre) {
|
||||
super(registry, abi);
|
||||
[this.abi, this.constructors, this.messages] = this.decodeAbi(abi);
|
||||
}
|
||||
|
||||
@@ -25,16 +27,21 @@ export default class ContractAbi extends ContractRegistry implements InterfaceAb
|
||||
const abi = this.convertAbi(abiPre);
|
||||
const constructors = abi.contract.constructors.map(
|
||||
(constructor, index): ContractABIFn => {
|
||||
return this.createMethod(`constructor ${index}`, constructor);
|
||||
return this.createMessage(`constructor ${index}`, constructor);
|
||||
}
|
||||
);
|
||||
|
||||
const messages: AbiMessages = {};
|
||||
abi.contract.messages.forEach((method): void => {
|
||||
const name = stringCamelCase(method.name);
|
||||
const messages: AbiMessages = abi.contract.messages.reduce(
|
||||
(result: AbiMessages, message): AbiMessages => {
|
||||
const name = stringCamelCase(message.name);
|
||||
|
||||
messages[name] = this.createMethod(`messages.${name}`, method);
|
||||
});
|
||||
return {
|
||||
...result,
|
||||
[name]: this.createMessage(`messages.${name}`, message)
|
||||
};
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
return [abi, constructors, messages];
|
||||
}
|
||||
|
||||
@@ -1,15 +1,56 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { CodecArg, TypeDef } from '@polkadot/types/types';
|
||||
import { ContractABIArgBasePre, ContractABIContract, ContractABIContractPre, ContractABIEvent, ContractABIEventPre, ContractABIFn, ContractABIFnArg, ContractABIMethod, ContractABIMethodBase, ContractABIMethodPre, ContractABI, ContractABIPre, ContractABIRange, ContractABIRangePre, ContractABIStorage, ContractABIStorageLayout, ContractABIStorageLayoutPre, ContractABIStoragePre, ContractABIStorageStruct, ContractABIStorageStructPre, ContractABITypePre } from './types';
|
||||
import { Compact } from '@polkadot/types';
|
||||
import { CodecArg, Constructor, Registry, TypeDef } from '@polkadot/types/types';
|
||||
import { ContractABIArgBasePre, ContractABIContract, ContractABIContractPre, ContractABIEvent, ContractABIEventPre, ContractABIFn, ContractABIFnArg, ContractABIMessage, ContractABIMessageBase, ContractABIMessagePre, ContractABI, ContractABIMessageCommon, ContractABIPre, ContractABIRange, ContractABIRangePre, ContractABIStorage, ContractABIStorageLayout, ContractABIStorageLayoutPre, ContractABIStoragePre, ContractABIStorageStruct, ContractABIStorageStructPre, ContractABITypePre } from './types';
|
||||
|
||||
import { assert, isNumber, isString, isNull, isObject, isUndefined, stringCamelCase } from '@polkadot/util';
|
||||
import { Compact, u32, createClass, encodeType } from '@polkadot/types';
|
||||
import { assert, hexToU8a, isNumber, isString, isNull, isObject, isUndefined, stringCamelCase, isHex, hexToNumber } from '@polkadot/util';
|
||||
|
||||
import MetaRegistry from './MetaRegistry';
|
||||
import { createArgClass } from './method';
|
||||
|
||||
// parse a selector, this can be a number (older) or of [<hex>, <hex>, ...]. However,
|
||||
// just catch everything (since this is now non-standard for u32 anyway)
|
||||
function parseSelector (registry: Registry, fnname: string, input: ContractABIMessageCommon['selector']): u32 {
|
||||
if (isNumber(input)) {
|
||||
return registry.createType('u32', input);
|
||||
} else if (isHex(input)) {
|
||||
return registry.createType('u32', hexToU8a(input));
|
||||
} else if (typeof input === 'string') {
|
||||
try {
|
||||
const array = JSON.parse(input);
|
||||
|
||||
assert(array.length === 4, `${fnname}: Invalid selector length`);
|
||||
|
||||
return registry.createType('u32', Uint8Array.from(
|
||||
// the as number[] is here to pacify TS, it doesn't quite know how to handle the cb
|
||||
(array as number[]).map((value: string | number): number =>
|
||||
isHex(value)
|
||||
? hexToNumber(value.toString())
|
||||
: value
|
||||
)
|
||||
));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`${fnname}: Unable to parse selector`);
|
||||
}
|
||||
|
||||
function createArgClass (registry: Registry, args: ContractABIFnArg[], baseDef: Record<string, string>): Constructor {
|
||||
return createClass(
|
||||
registry,
|
||||
JSON.stringify(
|
||||
args.reduce((base: Record<string, any>, { name, type }): Record<string, any> => {
|
||||
base[name] = type.displayName || encodeType(type);
|
||||
|
||||
return base;
|
||||
}, baseDef)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default class ContractRegistry extends MetaRegistry {
|
||||
// Contract ABI helpers
|
||||
@@ -26,7 +67,7 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
}
|
||||
|
||||
public validateConstructors ({ contract: { constructors } }: ContractABIPre): void {
|
||||
constructors.forEach((constructor: ContractABIMethodPre, index): void => {
|
||||
constructors.forEach((constructor: ContractABIMessagePre, index): void => {
|
||||
const unknownKeys = Object.keys(constructor).filter((key): boolean => !['args', 'docs', 'name', 'selector'].includes(key));
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI constructor`);
|
||||
@@ -35,45 +76,51 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
});
|
||||
}
|
||||
|
||||
public validateMethods ({ contract: { messages } }: ContractABIPre): void {
|
||||
messages.forEach((method): void => {
|
||||
const unknownKeys = Object.keys(method).filter((key): boolean => !['args', 'docs', 'mutates', 'name', 'selector', 'return_type'].includes(key));
|
||||
public validateMessages ({ contract: { messages } }: ContractABIPre): void {
|
||||
messages.forEach((message): void => {
|
||||
const unknownKeys = Object.keys(message).filter((key): boolean => !['args', 'docs', 'mutates', 'name', 'selector', 'return_type'].includes(key));
|
||||
const fnname = `messages.${message.name}`;
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI args for messages.${method.name}`);
|
||||
const { name, selector, return_type: returnType } = method;
|
||||
assert(isNumber(name) && isString(this.stringAt(name)), `Expected name for messages.${method.name}`);
|
||||
assert(isNumber(selector), `Expected selector for messages.${method.name}`);
|
||||
assert(isNull(returnType) || (isNumber(returnType.ty) && isObject(this.typeDefAt(returnType.ty))), `Expected return_type for messages.${method.name}`);
|
||||
assert(unknownKeys.length === 0, `Unknown keys ${unknownKeys.join(', ')} found in ABI args for messages.${message.name}`);
|
||||
|
||||
this.validateArgs(`messages.${method.name}`, method.args);
|
||||
const { name, selector, return_type: returnType } = message;
|
||||
|
||||
assert(isNumber(name) && isString(this.stringAt(name)), `Expected name for ${fnname}`);
|
||||
assert(isNull(returnType) || (isNumber(returnType.ty) && isObject(this.typeDefAt(returnType.ty))), `Expected return_type for ${fnname}`);
|
||||
|
||||
parseSelector(this.registry, fnname, selector);
|
||||
this.validateArgs(fnname, message.args);
|
||||
});
|
||||
}
|
||||
|
||||
public validateAbi (abi: ContractABIPre): void {
|
||||
const unknownKeys = Object.keys(abi.contract).filter((key): boolean => !['constructors', 'docs', 'events', 'messages', 'name'].includes(key));
|
||||
|
||||
assert(unknownKeys.length === 0, `Unknown fields ${unknownKeys.join(', ')} found in ABI`);
|
||||
|
||||
const { contract: { constructors, messages, name } } = abi;
|
||||
|
||||
assert(constructors && messages && isString(this.stringAt(name)), 'ABI should have constructors, messages & name sections');
|
||||
|
||||
this.validateConstructors(abi);
|
||||
this.validateMethods(abi);
|
||||
this.validateMessages(abi);
|
||||
}
|
||||
|
||||
public createMethod (name: string, method: Partial<ContractABIMethod> & ContractABIMethodBase): ContractABIFn {
|
||||
const args = method.args.map(({ name, type }): ContractABIFnArg => {
|
||||
public createMessage (name: string, message: Partial<ContractABIMessage> & ContractABIMessageBase): ContractABIFn {
|
||||
const args = message.args.map(({ name, type }): ContractABIFnArg => {
|
||||
assert(isObject(type), `Invalid type at index ${type}`);
|
||||
return {
|
||||
name: stringCamelCase(name),
|
||||
type
|
||||
};
|
||||
});
|
||||
const Clazz = createArgClass(args, isUndefined(method.selector) ? {} : { __selector: 'u32' });
|
||||
const baseStruct: { [index: string]: any } = { __selector: method.selector };
|
||||
const Clazz = createArgClass(this.registry, args, isUndefined(message.selector) ? {} : { __selector: 'u32' });
|
||||
const baseStruct: { [index: string]: any } = { __selector: isUndefined(message.selector) ? undefined : parseSelector(this.registry, name, message.selector) };
|
||||
const encoder = (...params: CodecArg[]): Uint8Array => {
|
||||
assert(params.length === args.length, `Expected ${args.length} arguments to contract ${name}, found ${params.length}`);
|
||||
|
||||
const u8a = new Clazz(
|
||||
this.registry,
|
||||
args.reduce((mapped, { name }, index): Record<string, CodecArg> => {
|
||||
mapped[name] = params[index];
|
||||
|
||||
@@ -87,9 +134,8 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
const fn = (encoder as ContractABIFn);
|
||||
|
||||
fn.args = args;
|
||||
fn.isConstant = !(method.mutates || false);
|
||||
fn.type = method.returnType || null;
|
||||
|
||||
fn.isConstant = !(message.mutates || false);
|
||||
fn.type = message.returnType || null;
|
||||
return fn;
|
||||
}
|
||||
|
||||
@@ -112,7 +158,7 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
public convertContract ({ constructors, messages, name, events, ...contract }: ContractABIContractPre): ContractABIContract {
|
||||
return {
|
||||
constructors: this.convertConstructors(constructors),
|
||||
messages: messages.map(method => this.convertMethod(method)),
|
||||
messages: messages.map(message => this.convertMessage(message)),
|
||||
name: this.stringAt(name),
|
||||
...(events
|
||||
? { events: events.map(event => this.convertEvent(event)) }
|
||||
@@ -121,17 +167,17 @@ export default class ContractRegistry extends MetaRegistry {
|
||||
};
|
||||
}
|
||||
|
||||
public convertConstructors (constructors: ContractABIMethodPre[]): ContractABIMethod[] {
|
||||
public convertConstructors (constructors: ContractABIMessagePre[]): ContractABIMessage[] {
|
||||
return constructors.map(
|
||||
(constructor: ContractABIMethodPre): ContractABIMethod => {
|
||||
return this.convertMethod(constructor);
|
||||
(constructor: ContractABIMessagePre): ContractABIMessage => {
|
||||
return this.convertMessage(constructor);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public convertMethod ({ args, name, return_type: returnType, ...method }: ContractABIMethodPre): ContractABIMethod {
|
||||
public convertMessage ({ args, name, return_type: returnType, ...message }: ContractABIMessagePre): ContractABIMessage {
|
||||
return {
|
||||
...method,
|
||||
...message,
|
||||
args: this.convertArgs(args),
|
||||
name: this.stringAt(name),
|
||||
returnType: returnType ? this.convertType(returnType) : null
|
||||
|
||||
@@ -1,33 +1,42 @@
|
||||
// Copyright 2017-2019 @polkadot/types authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
|
||||
import MetaRegistry from './MetaRegistry';
|
||||
|
||||
import erc20Abi from '../test/contracts/Erc20.json';
|
||||
import erc20Cmp from '../test/compare/erc20.test.json';
|
||||
import sharedVecAbi from '../test/contracts/SharedVecV2.json';
|
||||
import sharedVecCmp from '../test/compare/shared-vec.test.json';
|
||||
import test001Abi from '../test/abi/test001.json';
|
||||
import test001Cmp from '../test/compare/test001.cmp.json';
|
||||
|
||||
function compare (meta: MetaRegistry, other: any): void {
|
||||
try {
|
||||
expect(meta.typeDefs).toEqual(other);
|
||||
} catch (error) {
|
||||
console.error(JSON.stringify(meta.typeDefs));
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
describe('MetaRegistry', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
describe('construction', (): void => {
|
||||
it('initializes from a contract ABI (ERC20)', (): void => {
|
||||
const metaRegistry = new MetaRegistry(erc20Abi);
|
||||
fs.writeFile(path.join(__dirname, '../test/compare/erc20.test.json'), JSON.stringify(metaRegistry.typeDefs, null, 2), function (err): void {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
expect(true).toBe(true);
|
||||
compare(new MetaRegistry(registry, erc20Abi), erc20Cmp);
|
||||
});
|
||||
|
||||
it('initializes from a contract ABI (SharedVec)', (): void => {
|
||||
const metaRegistry = new MetaRegistry(sharedVecAbi);
|
||||
fs.writeFile(path.join(__dirname, '../test/compare/shared-vec.test.json'), JSON.stringify(metaRegistry.typeDefs, null, 2), function (err): void {
|
||||
if (err) throw err;
|
||||
});
|
||||
compare(new MetaRegistry(registry, sharedVecAbi), sharedVecCmp);
|
||||
});
|
||||
|
||||
expect(true).toBe(true);
|
||||
it('initializes from a contract ABI (Other, test001)', (): void => {
|
||||
compare(new MetaRegistry(registry, test001Abi), test001Cmp);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetaRegistryItem, MetaRegistryJson, MetaTypeDefClikeEnum, MetaType, MetaTypeDefEnum, MetaTypeDefEnumVariant, MetaTypeDefEnumVariantStruct, MetaTypeDefEnumVariantTupleStruct, MetaTypeDefEnumVariantUnit, MetaTypeDefStruct, MetaTypeDefStructField, MetaTypeDefTupleStruct, MetaTypeDefUnion, MetaTypeIdCustom, MetaTypeIdVec, MetaTypeIdVecFixed, MetaTypeInfo, StringIndex, TypeDef, TypeDefInfo, TypeIndex } from '@polkadot/types/types';
|
||||
import { MetaRegistryItem, MetaRegistryJson, MetaTypeDefClikeEnum, MetaType, MetaTypeDefEnum, MetaTypeDefEnumVariant, MetaTypeDefEnumVariantStruct, MetaTypeDefEnumVariantTupleStruct, MetaTypeDefEnumVariantUnit, MetaTypeDefStruct, MetaTypeDefStructField, MetaTypeDefTupleStruct, MetaTypeDefUnion, MetaTypeIdCustom, MetaTypeIdVec, MetaTypeIdVecFixed, MetaTypeInfo, Registry, StringIndex, TypeDef, TypeDefInfo, TypeIndex } from '@polkadot/types/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
import { displayType, withTypeString } from '@polkadot/types';
|
||||
@@ -34,13 +34,16 @@ function detectedType ({ def, id }: MetaType): MetaTypeInfo {
|
||||
}
|
||||
|
||||
class MetadataRegistryLookup {
|
||||
public readonly registry: Registry;
|
||||
|
||||
protected _strings: string[] = [];
|
||||
|
||||
protected _types: MetaType[] = [];
|
||||
|
||||
public typeDefs: TypeDef[] = [];
|
||||
|
||||
public constructor ({ registry: { strings, types } }: MetaRegistryJson) {
|
||||
constructor (registry: Registry, { registry: { strings, types } }: MetaRegistryJson) {
|
||||
this.registry = registry;
|
||||
this._strings = strings;
|
||||
this._types = types;
|
||||
}
|
||||
@@ -102,8 +105,8 @@ class MetadataRegistryLookup {
|
||||
}
|
||||
|
||||
export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
public constructor (json: MetaRegistryJson) {
|
||||
super(json);
|
||||
constructor (registry: Registry, json: MetaRegistryJson) {
|
||||
super(registry, json);
|
||||
|
||||
// Generate TypeDefs for each provided registry type
|
||||
this._types.forEach((_, index: number): void => this.setTypeDefAtIndex(index + 1));
|
||||
@@ -257,7 +260,7 @@ export default class MetaRegistry extends MetadataRegistryLookup {
|
||||
|
||||
return {
|
||||
info: TypeDefInfo.VecFixed,
|
||||
ext: { length: vecLength, type },
|
||||
length: vecLength, // ex: { type: type }
|
||||
type: `[${type};${vecLength}]`,
|
||||
sub: this.typeDefFromMetaTypeAt(vecTypeIndex)
|
||||
};
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableModuleExtrinsics } from '@polkadot/api/types';
|
||||
import { ApiObject, ContractABIPre, ContractBase } from './types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Abi from './Abi';
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default abstract class RxBase implements ContractBase<'rxjs'> {
|
||||
public readonly abi: Abi;
|
||||
|
||||
public readonly api: ApiObject<'rxjs'>;
|
||||
|
||||
public readonly apiContracts: SubmittableModuleExtrinsics<'rxjs'>;
|
||||
|
||||
public constructor (api: ApiObject<'rxjs'>, abi: ContractABIPre | Abi) {
|
||||
this.abi = abi instanceof Abi
|
||||
? abi
|
||||
: new Abi(abi);
|
||||
this.api = api;
|
||||
|
||||
// cater for substrate 2.x & 1.x (in order)
|
||||
this.apiContracts = api.tx.contracts || api.tx.contract;
|
||||
|
||||
assert(this.apiContracts && this.apiContracts.putCode, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableResultImpl } from '@polkadot/api/types';
|
||||
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair } from '@polkadot/types/types';
|
||||
import { ContractABIPre } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiRx, SubmittableResult } from '@polkadot/api';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Abi from './Abi';
|
||||
import RxBase from './RxBase';
|
||||
import RxContract from './RxContract';
|
||||
|
||||
type BlueprintCreateResultSubscription = Observable<BlueprintCreateResult>;
|
||||
|
||||
export interface BlueprintCreate {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription;
|
||||
}
|
||||
|
||||
class BlueprintCreateResult extends SubmittableResult {
|
||||
public readonly contract?: RxContract;
|
||||
|
||||
public constructor (result: SubmittableResultImpl, contract?: RxContract) {
|
||||
super(result);
|
||||
|
||||
this.contract = contract;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default class Blueprint extends RxBase {
|
||||
public readonly codeHash: Hash;
|
||||
|
||||
public constructor (api: ApiRx, abi: ContractABIPre | Abi, codeHash: string | Hash) {
|
||||
super(api, abi);
|
||||
|
||||
this.codeHash = createType('Hash', codeHash);
|
||||
}
|
||||
|
||||
public deployContract (constructorIndex = 0, endowment: number | BN, maxGas: number | BN, ...params: any[]): BlueprintCreate {
|
||||
assert(!!this.abi.constructors[constructorIndex], `Specified constructor index ${constructorIndex} does not exist`);
|
||||
const signAndSend = (account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription => {
|
||||
return this.apiContracts
|
||||
.create(endowment, maxGas, this.codeHash, this.abi.constructors[constructorIndex](...params))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this.createResult));
|
||||
};
|
||||
|
||||
return { signAndSend };
|
||||
}
|
||||
|
||||
private createResult = (result: SubmittableResult): BlueprintCreateResult => {
|
||||
let contract: RxContract | undefined;
|
||||
|
||||
if (result.isFinalized) {
|
||||
const record = result.findRecord('contract', 'Instantiated');
|
||||
|
||||
if (record) {
|
||||
contract = new RxContract(this.api, this.abi, record.event.data[1] as Address);
|
||||
}
|
||||
}
|
||||
|
||||
return new BlueprintCreateResult(result, contract);
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableResultImpl } from '@polkadot/api/types';
|
||||
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair } from '@polkadot/types/types';
|
||||
import { ContractABIPre } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiRx, SubmittableResult } from '@polkadot/api';
|
||||
import { compactAddLength, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import Abi from './Abi';
|
||||
import RxBase from './RxBase';
|
||||
import RxBlueprint from './RxBlueprint';
|
||||
|
||||
// Ok, tried, failed, eventually ... well, we are only trying with RxJs as a
|
||||
// start, so take a big fat shortcut with this version, real intended version
|
||||
// follows this and is commented out
|
||||
type CodePutCodeResultSubscription = Observable<CodePutCodeResult>;
|
||||
// type ICodePutCodeResultSubscription<ApiType> =
|
||||
// ApiType extends 'rxjs'
|
||||
// ? Observable<CodePutCodeResult>
|
||||
// : Promise<() => void>;
|
||||
|
||||
// unlike the ISubmittableExtrinsic, it doesn't extend IExtrinsic and only
|
||||
// implements one var iant of signAndSend - this is purely done to see what
|
||||
// is hanging where, with the bare-mainimum from a simplicity perspective
|
||||
// Very obvious is that it supports only 1 version of signAndSend
|
||||
// (we need to revisit this, but probably ok for initial?)
|
||||
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
|
||||
export interface CodePutCode {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription;
|
||||
}
|
||||
|
||||
class CodePutCodeResult extends SubmittableResult {
|
||||
public readonly blueprint?: RxBlueprint;
|
||||
|
||||
public constructor (result: SubmittableResultImpl, blueprint?: RxBlueprint) {
|
||||
super(result);
|
||||
|
||||
this.blueprint = blueprint;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default class RxCode extends RxBase {
|
||||
public readonly code: Uint8Array;
|
||||
|
||||
public constructor (api: ApiRx, abi: ContractABIPre | Abi, wasm: string | Uint8Array) {
|
||||
super(api, abi);
|
||||
|
||||
this.code = u8aToU8a(wasm);
|
||||
}
|
||||
|
||||
public createBlueprint (maxGas: number | BN): CodePutCode {
|
||||
const signAndSend = (account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription => {
|
||||
return this.apiContracts
|
||||
.putCode(maxGas, compactAddLength(this.code))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this.createResult));
|
||||
};
|
||||
|
||||
return { signAndSend };
|
||||
}
|
||||
|
||||
private createResult = (result: SubmittableResultImpl): CodePutCodeResult => {
|
||||
let blueprint: RxBlueprint | undefined;
|
||||
|
||||
if (result.isFinalized) {
|
||||
const record = result.findRecord('contract', 'CodeStored');
|
||||
|
||||
if (record) {
|
||||
blueprint = new RxBlueprint(this.api, this.abi, record.event.data[0] as Hash);
|
||||
}
|
||||
}
|
||||
|
||||
return new CodePutCodeResult(result, blueprint);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, Address } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair } from '@polkadot/types/types';
|
||||
import { ContractABIPre, ContractABIFn, InterfaceContract, InterfaceContractCalls } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ApiRx, SubmittableResult } from '@polkadot/api';
|
||||
import { createType } from '@polkadot/types';
|
||||
import Abi from './Abi';
|
||||
import RxBase from './RxBase';
|
||||
|
||||
export type ContractCallResultSubscription = Observable<SubmittableResult>;
|
||||
|
||||
export interface ContractCall {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): ContractCallResultSubscription;
|
||||
}
|
||||
|
||||
type CallResult = (value: BN | number, maxGas: BN | number, ...params: any[]) => ContractCall;
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default class RxContract extends RxBase implements InterfaceContract {
|
||||
public readonly address: Address;
|
||||
|
||||
public readonly calls: InterfaceContractCalls = {};
|
||||
|
||||
public constructor (api: ApiRx, abi: ContractABIPre | Abi, address: string | AccountId | Address) {
|
||||
super(api, abi);
|
||||
|
||||
this.address = createType('Address', address);
|
||||
|
||||
Object.entries(this.abi.messages).forEach(([name]): void => {
|
||||
this.calls[name] = (fn: ContractABIFn): CallResult =>
|
||||
(value: BN | number, maxGas: BN | number, ...params: any[]): ContractCall =>
|
||||
this.apiContracts.call(this.address, value, maxGas, fn(...params));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
|
||||
import { ApiObject, ContractABIPre } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Abi from '../Abi';
|
||||
import Contract from './Contract';
|
||||
import { BaseWithTx } from './util';
|
||||
|
||||
type BlueprintCreateResultSubscription<ApiType extends ApiTypes> = Observable<BlueprintCreateResult<ApiType>>;
|
||||
|
||||
export interface BlueprintCreate<ApiType extends ApiTypes> {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription<ApiType>;
|
||||
}
|
||||
|
||||
class BlueprintCreateResult<ApiType extends ApiTypes> extends SubmittableResult {
|
||||
public readonly contract?: Contract<ApiType>;
|
||||
|
||||
constructor (result: ISubmittableResult, contract?: Contract<ApiType>) {
|
||||
super(result);
|
||||
|
||||
this.contract = contract;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default class Blueprint<ApiType extends ApiTypes> extends BaseWithTx<ApiType> {
|
||||
public readonly codeHash: Hash;
|
||||
|
||||
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, codeHash: string | Hash) {
|
||||
super(api, abi, decorateMethod);
|
||||
|
||||
this.codeHash = this.registry.createType('Hash', codeHash);
|
||||
}
|
||||
|
||||
public deployContract (constructorIndex = 0, endowment: number | BN, maxGas: number | BN, ...params: any[]): BlueprintCreate<ApiType> {
|
||||
assert(!!this.abi.constructors[constructorIndex], `Specified constructor index ${constructorIndex} does not exist`);
|
||||
|
||||
return {
|
||||
signAndSend: this.decorateMethod(
|
||||
(account: IKeyringPair | string | AccountId | Address): BlueprintCreateResultSubscription<ApiType> => {
|
||||
return this.apiContracts
|
||||
.create(endowment, maxGas, this.codeHash, this.abi.constructors[constructorIndex](...params))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this.createResult));
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
private createResult = (result: SubmittableResult): BlueprintCreateResult<ApiType> => {
|
||||
let contract: Contract<ApiType> | undefined;
|
||||
|
||||
if (result.isInBlock) {
|
||||
const record = result.findRecord('contract', 'Instantiated');
|
||||
|
||||
if (record) {
|
||||
contract = new Contract<ApiType>(this.api, this.abi, this.decorateMethod, record.event.data[1] as Address);
|
||||
}
|
||||
}
|
||||
|
||||
return new BlueprintCreateResult(result, contract);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import { AccountId, Address, Hash } from '@polkadot/types/interfaces';
|
||||
import { IKeyringPair, ISubmittableResult } from '@polkadot/types/types';
|
||||
import { ApiObject, ContractABIPre } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import { compactAddLength, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import Abi from '../Abi';
|
||||
import Blueprint from './Blueprint';
|
||||
import { BaseWithTx } from './util';
|
||||
|
||||
type CodePutCodeResultSubscription<ApiType extends ApiTypes> = Observable<CodePutCodeResult<ApiType>>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
|
||||
export interface CodePutCode<ApiType extends ApiTypes> {
|
||||
signAndSend (account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription<ApiType>;
|
||||
}
|
||||
|
||||
class CodePutCodeResult<ApiType extends ApiTypes> extends SubmittableResult {
|
||||
public readonly blueprint?: Blueprint<ApiType>;
|
||||
|
||||
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>) {
|
||||
super(result);
|
||||
|
||||
this.blueprint = blueprint;
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE Experimental, POC, bound to change
|
||||
export default class Code<ApiType extends ApiTypes> extends BaseWithTx<ApiType> {
|
||||
public readonly code: Uint8Array;
|
||||
|
||||
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, wasm: string | Uint8Array) {
|
||||
super(api, abi, decorateMethod);
|
||||
|
||||
this.code = u8aToU8a(wasm);
|
||||
}
|
||||
|
||||
public createBlueprint = (maxGas: number | BN): CodePutCode<ApiType> => {
|
||||
return {
|
||||
signAndSend: this.decorateMethod(
|
||||
(account: IKeyringPair | string | AccountId | Address): CodePutCodeResultSubscription<ApiType> => this.apiContracts
|
||||
.putCode(maxGas, compactAddLength(this.code))
|
||||
.signAndSend(account)
|
||||
.pipe(map(this.createResult))
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
private createResult = (result: ISubmittableResult): CodePutCodeResult<ApiType> => {
|
||||
let blueprint: Blueprint<ApiType> | undefined;
|
||||
|
||||
if (result.isInBlock) {
|
||||
const record = result.findRecord('contract', 'CodeStored');
|
||||
|
||||
if (record) {
|
||||
blueprint = new Blueprint<ApiType>(this.api, this.abi, this.decorateMethod, record.event.data[0] as Hash);
|
||||
}
|
||||
}
|
||||
|
||||
return new CodePutCodeResult(result, blueprint);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiTypes, DecorateMethod, ObsInnerType } from '@polkadot/api/types';
|
||||
import { AccountId, Address, ContractExecResult } from '@polkadot/types/interfaces';
|
||||
import { Codec, IKeyringPair } from '@polkadot/types/types';
|
||||
import { ApiObject, ContractABIMessage, ContractABIPre, ContractCallOutcome } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import Abi from '../Abi';
|
||||
import { formatData } from '../util';
|
||||
import { BaseWithTxAndRpcCall } from './util';
|
||||
|
||||
type ContractCallTypes = 'tx' | 'rpc';
|
||||
|
||||
type ContractCallResultSubscription<ApiType extends ApiTypes, CallType extends ContractCallTypes> = ApiType extends 'rxjs'
|
||||
? Observable<ContractCallResult<CallType>>
|
||||
: Promise<ObsInnerType<ContractCallResult<CallType>>>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
|
||||
export interface ContractCall<ApiType extends ApiTypes, CallType extends ContractCallTypes> {
|
||||
send (account: IKeyringPair | string | AccountId | Address): ContractCallResultSubscription<ApiType, CallType>;
|
||||
}
|
||||
|
||||
export type ContractCallResult<CallType extends ContractCallTypes> = CallType extends 'rpc'
|
||||
? Observable<ContractCallOutcome>
|
||||
: Observable<SubmittableResult>;
|
||||
|
||||
export default class Contract<ApiType extends ApiTypes> extends BaseWithTxAndRpcCall<ApiType> {
|
||||
public readonly address: Address;
|
||||
|
||||
public call (as: 'rpc', message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, 'rpc'>;
|
||||
public call (as: 'tx', message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, 'tx'>;
|
||||
public call<CallType extends ContractCallTypes> (as: CallType, message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, CallType> {
|
||||
const { fn, def } = this.getMessage(message);
|
||||
|
||||
return {
|
||||
send: this.decorateMethod(
|
||||
as === 'rpc' && this.hasRpcContractsCall
|
||||
? (account: IKeyringPair | string | AccountId | Address): ContractCallResult<'rpc'> => {
|
||||
return this.rpcContractsCall(
|
||||
this.registry.createType('ContractCallRequest', {
|
||||
origin: account,
|
||||
dest: this.address.toString(),
|
||||
value,
|
||||
gasLimit,
|
||||
inputData: fn(...params)
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
map((result: ContractExecResult): ContractCallOutcome =>
|
||||
this.createOutcome(result, this.registry.createType('AccountId', account), def, params)
|
||||
)
|
||||
);
|
||||
}
|
||||
: (account: IKeyringPair | string | AccountId | Address): ContractCallResult<'tx'> => {
|
||||
return this.apiContracts
|
||||
.call(this.address, value, gasLimit, fn(...params))
|
||||
.signAndSend(account);
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
private createOutcome (result: ContractExecResult, origin: AccountId, message: ContractABIMessage, params: any[]): ContractCallOutcome {
|
||||
let output: Codec | null = null;
|
||||
|
||||
if (result.isSuccess) {
|
||||
const { data } = result.asSuccess;
|
||||
|
||||
output = message.returnType
|
||||
? formatData(this.registry, data, message.returnType)
|
||||
: this.registry.createType('Raw', data);
|
||||
}
|
||||
|
||||
return {
|
||||
time: Date.now(),
|
||||
message,
|
||||
origin,
|
||||
params,
|
||||
result,
|
||||
isSuccess: result.isSuccess,
|
||||
output
|
||||
};
|
||||
}
|
||||
|
||||
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>, address: string | AccountId | Address) {
|
||||
super(api, abi, decorateMethod);
|
||||
|
||||
this.address = this.registry.createType('Address', address);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as Blueprint } from './Blueprint';
|
||||
export { default as Code } from './Code';
|
||||
export { default as Contract } from './Contract';
|
||||
@@ -0,0 +1,78 @@
|
||||
// Copyright 2017-2020 @polkadot/api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiTypes, DecorateMethod, DecoratedRpc, SubmittableModuleExtrinsics } from '@polkadot/api/types';
|
||||
import { RpcInterface } from '@polkadot/rpc-core/types';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { ApiObject, ContractABIMessage, ContractABIPre, ContractBase, ContractMessage } from '../types';
|
||||
|
||||
import { assert, isFunction, stringCamelCase } from '@polkadot/util';
|
||||
import Abi from '../Abi';
|
||||
|
||||
export abstract class Base<ApiType extends ApiTypes> implements ContractBase<ApiType> {
|
||||
public readonly abi: Abi;
|
||||
|
||||
public readonly api: ApiObject<ApiType>;
|
||||
|
||||
public readonly decorateMethod: DecorateMethod<ApiType>;
|
||||
|
||||
public readonly registry: Registry;
|
||||
|
||||
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>) {
|
||||
this.abi = abi instanceof Abi
|
||||
? abi
|
||||
: new Abi(api.registry, abi);
|
||||
this.registry = api.registry;
|
||||
this.api = api;
|
||||
this.decorateMethod = decorateMethod;
|
||||
}
|
||||
|
||||
public get messages (): ContractMessage[] {
|
||||
return this.abi.abi.contract.messages
|
||||
.map(
|
||||
(def: ContractABIMessage, index): ContractMessage => ({
|
||||
index,
|
||||
def,
|
||||
fn: this.abi.messages[def.name] || this.abi.messages[stringCamelCase(name)]
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public getMessage (nameOrIndex?: string | number): ContractMessage {
|
||||
const index = nameOrIndex
|
||||
? typeof nameOrIndex === 'number'
|
||||
? nameOrIndex
|
||||
: this.abi.abi.contract.messages.findIndex((message): boolean => nameOrIndex === message.name || nameOrIndex === stringCamelCase(message.name))
|
||||
: 0;
|
||||
const def = this.abi.abi.contract.messages[index];
|
||||
assert(!!def, `Attempted to access a contract message that does not exist: ${typeof nameOrIndex === 'number' ? `index ${nameOrIndex}` : nameOrIndex}`);
|
||||
|
||||
const fn = this.abi.messages[def.name] || this.abi.messages[stringCamelCase(def.name)];
|
||||
return { index, def, fn };
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class BaseWithTx<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
protected get apiContracts (): SubmittableModuleExtrinsics<'rxjs'> {
|
||||
return this.api.rx.tx.contracts;
|
||||
}
|
||||
|
||||
constructor (api: ApiObject<ApiType>, abi: ContractABIPre | Abi, decorateMethod: DecorateMethod<ApiType>) {
|
||||
super(api, abi, 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');
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class BaseWithTxAndRpcCall<ApiType extends ApiTypes> extends BaseWithTx<ApiType> {
|
||||
public get hasRpcContractsCall (): boolean {
|
||||
return isFunction(this.api.rx.rpc.contracts?.call);
|
||||
}
|
||||
|
||||
protected get rpcContractsCall (): DecoratedRpc<'rxjs', RpcInterface>['contracts']['call'] {
|
||||
assert(this.hasRpcContractsCall, 'You need to connect to a node with the contracts.call RPC method.');
|
||||
|
||||
return this.api.rx.rpc.contracts.call;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as Abi } from './Abi';
|
||||
export { default as RxBlueprint } from './RxBlueprint';
|
||||
export { default as RxCode } from './RxCode';
|
||||
export { default as RxContract } from './RxContract';
|
||||
export * from './rx';
|
||||
export * from './promise';
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Constructor } from '@polkadot/types/types';
|
||||
import { ContractABIFnArg } from './types';
|
||||
|
||||
import { createClass, encodeType } from '@polkadot/types';
|
||||
|
||||
export function createArgClass (args: ContractABIFnArg[], baseDef: Record<string, string>): Constructor {
|
||||
return createClass(
|
||||
JSON.stringify(
|
||||
args.reduce((base: Record<string, any>, { name, type }): Record<string, any> => {
|
||||
base[name] = encodeType(type);
|
||||
|
||||
return base;
|
||||
}, baseDef)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '@polkadot/types/interfaces';
|
||||
import { ContractABIPre } from '../types';
|
||||
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { decorateMethod } from '@polkadot/api/promise';
|
||||
|
||||
import Abi from '../Abi';
|
||||
import Blueprint from '../base/Blueprint';
|
||||
|
||||
export default class PromiseBlueprint extends Blueprint<'promise'> {
|
||||
constructor (api: ApiPromise, abi: ContractABIPre | Abi, codeHash: string | Hash) {
|
||||
super(api, abi, decorateMethod, codeHash);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ContractABIPre } from '../types';
|
||||
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { decorateMethod } from '@polkadot/api/promise';
|
||||
|
||||
import Abi from '../Abi';
|
||||
import Code from '../base/Code';
|
||||
|
||||
export default class PromiseCode extends Code<'promise'> {
|
||||
constructor (api: ApiPromise, abi: ContractABIPre | Abi, wasm: string | Uint8Array) {
|
||||
super(api, abi, decorateMethod, wasm);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
import { ContractABIPre } from '../types';
|
||||
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { decorateMethod } from '@polkadot/api/promise';
|
||||
|
||||
import Abi from '../Abi';
|
||||
import Contract from '../base/Contract';
|
||||
|
||||
export default class PromiseContract extends Contract<'promise'> {
|
||||
constructor (api: ApiPromise, abi: ContractABIPre | Abi, address: string | AccountId) {
|
||||
super(api, abi, decorateMethod, address);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as PromiseBlueprint } from './PromiseBlueprint';
|
||||
export { default as PromiseCode } from './PromiseCode';
|
||||
export { default as PromiseContract } from './PromiseContract';
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Hash } from '@polkadot/types/interfaces';
|
||||
import { ContractABIPre } from '../types';
|
||||
|
||||
import { ApiRx } from '@polkadot/api';
|
||||
import { decorateMethod } from '@polkadot/api/rx';
|
||||
|
||||
import Abi from '../Abi';
|
||||
import Blueprint from '../base/Blueprint';
|
||||
|
||||
export default class RxBlueprint extends Blueprint<'rxjs'> {
|
||||
constructor (api: ApiRx, abi: ContractABIPre | Abi, codeHash: string | Hash) {
|
||||
super(api, abi, decorateMethod, codeHash);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ContractABIPre } from '../types';
|
||||
|
||||
import { ApiRx } from '@polkadot/api';
|
||||
import { decorateMethod } from '@polkadot/api/rx';
|
||||
|
||||
import Abi from '../Abi';
|
||||
import Code from '../base/Code';
|
||||
|
||||
export default class RxCode extends Code<'rxjs'> {
|
||||
constructor (api: ApiRx, abi: ContractABIPre | Abi, wasm: string | Uint8Array) {
|
||||
super(api, abi, decorateMethod, wasm);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
import { ContractABIPre } from '../types';
|
||||
|
||||
import { ApiRx } from '@polkadot/api';
|
||||
import { decorateMethod } from '@polkadot/api/rx';
|
||||
|
||||
import Abi from '../Abi';
|
||||
import Contract from '../base/Contract';
|
||||
|
||||
export default class RxContract extends Contract<'rxjs'> {
|
||||
constructor (api: ApiRx, abi: ContractABIPre | Abi, address: string | AccountId) {
|
||||
super(api, abi, decorateMethod, address);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { default as RxBlueprint } from './RxBlueprint';
|
||||
export { default as RxCode } from './RxCode';
|
||||
export { default as RxContract } from './RxContract';
|
||||
@@ -1,18 +1,27 @@
|
||||
// Copyright 2017-2019 @polkadot/api-contract authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-contract authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubmittableModuleExtrinsics } from '@polkadot/api/types';
|
||||
import { Address } from '@polkadot/types/interfaces';
|
||||
import { CodecArg } from '@polkadot/types/types';
|
||||
import { MetaRegistryJson, StringIndex, TypeIndex, TypeDef } from '@polkadot/types/codec/create/types';
|
||||
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import { AccountId, Address, ContractExecResult } from '@polkadot/types/interfaces';
|
||||
import { Codec, CodecArg } from '@polkadot/types/types';
|
||||
import { MetaRegistryJson, StringIndex, TypeIndex, TypeDef } from '@polkadot/types/create/types';
|
||||
|
||||
// import { Observable } from 'rxjs';
|
||||
import { ApiPromise, ApiRx } from '@polkadot/api';
|
||||
|
||||
export type ApiObject<ApiType> = ApiType extends 'rxjs'
|
||||
export type ApiObject<ApiType extends ApiTypes> = ApiType extends 'rxjs'
|
||||
? ApiRx
|
||||
: ApiPromise;
|
||||
|
||||
export interface ContractBase<ApiType extends ApiTypes> {
|
||||
readonly abi: InterfaceAbi;
|
||||
readonly api: ApiObject<ApiType>;
|
||||
readonly decorateMethod: DecorateMethod<ApiType>;
|
||||
getMessage: (name: string) => ContractMessage;
|
||||
messages: ContractMessage[];
|
||||
}
|
||||
|
||||
export interface ContractABITypePre {
|
||||
ty: TypeIndex;
|
||||
display_name: StringIndex[];
|
||||
@@ -28,31 +37,31 @@ export interface ContractABIArgBase {
|
||||
type: TypeDef;
|
||||
}
|
||||
|
||||
export type ContractABIMethodArgPre = ContractABIArgBasePre;
|
||||
export type ContractABIMessageArgPre = ContractABIArgBasePre;
|
||||
|
||||
export type ContractABIMethodArg = ContractABIArgBase;
|
||||
export type ContractABIMessageArg = ContractABIArgBase;
|
||||
|
||||
export interface ContractABIMethodBase {
|
||||
args: ContractABIMethodArg[];
|
||||
export interface ContractABIMessageBase {
|
||||
args: ContractABIMessageArg[];
|
||||
}
|
||||
|
||||
export interface ContractABIMethodBasePre {
|
||||
args: ContractABIMethodArgPre[];
|
||||
export interface ContractABIMessageBasePre {
|
||||
args: ContractABIMessageArgPre[];
|
||||
}
|
||||
|
||||
export interface ContractABIMethodCommon {
|
||||
export interface ContractABIMessageCommon {
|
||||
docs?: ContractABIDocs;
|
||||
mutates?: boolean;
|
||||
selector: number;
|
||||
selector: string | number;
|
||||
}
|
||||
|
||||
export interface ContractABIMethodPre extends ContractABIMethodCommon, ContractABIMethodBasePre {
|
||||
export interface ContractABIMessagePre extends ContractABIMessageCommon, ContractABIMessageBasePre {
|
||||
name: StringIndex;
|
||||
return_type: ContractABITypePre | null;
|
||||
}
|
||||
|
||||
export interface ContractABIMethod extends ContractABIMethodCommon {
|
||||
args: ContractABIMethodArg[];
|
||||
export interface ContractABIMessage extends ContractABIMessageCommon {
|
||||
args: ContractABIMessageArg[];
|
||||
name: string;
|
||||
returnType: TypeDef | null;
|
||||
}
|
||||
@@ -62,16 +71,16 @@ export interface ContractABIContractCommon {
|
||||
}
|
||||
|
||||
export interface ContractABIContractPre extends ContractABIContractCommon {
|
||||
constructors: ContractABIMethodPre[];
|
||||
messages: ContractABIMethodPre[];
|
||||
constructors: ContractABIMessagePre[];
|
||||
messages: ContractABIMessagePre[];
|
||||
name: StringIndex;
|
||||
events?: ContractABIEventPre[];
|
||||
docs?: ContractABIDocs;
|
||||
}
|
||||
|
||||
export interface ContractABIContract extends ContractABIContractCommon {
|
||||
constructors: ContractABIMethod[];
|
||||
messages: ContractABIMethod[];
|
||||
constructors: ContractABIMessage[];
|
||||
messages: ContractABIMessage[];
|
||||
name: string;
|
||||
events?: ContractABIEvent[];
|
||||
docs?: ContractABIDocs;
|
||||
@@ -121,7 +130,8 @@ export interface ContractABIEvent {
|
||||
}
|
||||
|
||||
export interface ContractABIRangeBase {
|
||||
'range.offset': number[];
|
||||
// can be number[] (old) or hex (new)
|
||||
'range.offset': number[] | string;
|
||||
'range.len': number;
|
||||
}
|
||||
|
||||
@@ -161,20 +171,22 @@ export type ContractABIStoragePre = ContractABIStorageStructPre;
|
||||
|
||||
export type ContractABIStorage = ContractABIStorageStruct;
|
||||
|
||||
export interface ContractMessage {
|
||||
index: number;
|
||||
fn: ContractABIFn;
|
||||
def: ContractABIMessage;
|
||||
}
|
||||
|
||||
export type AbiConstructors = ContractABIFn[];
|
||||
|
||||
export type AbiMessages = Record<string, ContractABIFn>;
|
||||
|
||||
export interface InterfaceAbi {
|
||||
readonly abi: ContractABI;
|
||||
readonly constructors: ContractABIFn[];
|
||||
readonly constructors: AbiConstructors;
|
||||
readonly messages: AbiMessages;
|
||||
}
|
||||
|
||||
export interface ContractBase<ApiType> {
|
||||
readonly abi: InterfaceAbi;
|
||||
readonly api: ApiObject<ApiType>;
|
||||
readonly apiContracts: SubmittableModuleExtrinsics<ApiType>;
|
||||
}
|
||||
|
||||
export interface InterfaceContractCalls {
|
||||
[index: string]: Function;
|
||||
}
|
||||
@@ -183,3 +195,13 @@ export interface InterfaceContract {
|
||||
readonly address: Address;
|
||||
readonly calls: InterfaceContractCalls;
|
||||
}
|
||||
|
||||
export interface ContractCallOutcome {
|
||||
time: number;
|
||||
result: ContractExecResult;
|
||||
origin: AccountId;
|
||||
output: Codec | null;
|
||||
params: any[];
|
||||
isSuccess: boolean;
|
||||
message: ContractABIMessage;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright 2017-2020 @polkadot/rpc-core authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec, Registry, TypeDefInfo, TypeDef } from '@polkadot/types/types';
|
||||
|
||||
import { Option, Raw, createClass, createTypeUnsafe } from '@polkadot/types';
|
||||
|
||||
export function formatData (registry: Registry, data: Raw, { info, type }: TypeDef): Codec {
|
||||
if (info === TypeDefInfo.Option) {
|
||||
return new Option(
|
||||
registry,
|
||||
createClass(registry, type),
|
||||
createTypeUnsafe(registry, type, [data], true)
|
||||
);
|
||||
}
|
||||
|
||||
return createTypeUnsafe(registry, type, [data], true);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,467 @@
|
||||
{
|
||||
"registry": {
|
||||
"strings": [
|
||||
"StorageAndEnv",
|
||||
"app",
|
||||
"__ink_private",
|
||||
"__ink_storage",
|
||||
"__storage",
|
||||
"Storage",
|
||||
"value",
|
||||
"Value",
|
||||
"ink_core",
|
||||
"storage",
|
||||
"cell",
|
||||
"SyncCell",
|
||||
"sync_cell",
|
||||
"Key",
|
||||
"key",
|
||||
"name",
|
||||
"vec",
|
||||
"Vec",
|
||||
"elems",
|
||||
"__env",
|
||||
"EnvAccess",
|
||||
"env2",
|
||||
"env_access",
|
||||
"immutable",
|
||||
"TestEnv",
|
||||
"test",
|
||||
"accessor",
|
||||
"DefaultSrmlTypes",
|
||||
"types",
|
||||
"access",
|
||||
"EnvAccessMut",
|
||||
"mutable",
|
||||
"env",
|
||||
"PhantomData",
|
||||
"buffer",
|
||||
"has_interacted",
|
||||
"has_returned_value",
|
||||
"new",
|
||||
"init_value",
|
||||
"bool",
|
||||
"default",
|
||||
"flip",
|
||||
"get"
|
||||
],
|
||||
"types": [
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 1,
|
||||
"custom.namespace": [
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"custom.params": []
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 5,
|
||||
"type": 2
|
||||
},
|
||||
{
|
||||
"name": 20,
|
||||
"type": 14
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 6,
|
||||
"custom.namespace": [
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"custom.params": []
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 7,
|
||||
"type": 3
|
||||
},
|
||||
{
|
||||
"name": 16,
|
||||
"type": 9
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 8,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
10,
|
||||
7
|
||||
],
|
||||
"custom.params": [
|
||||
4
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 11,
|
||||
"type": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "bool",
|
||||
"def": "builtin"
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 12,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
13
|
||||
],
|
||||
"custom.params": [
|
||||
4
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 11,
|
||||
"type": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 14,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
10,
|
||||
15
|
||||
],
|
||||
"custom.params": []
|
||||
},
|
||||
"def": {
|
||||
"tuple_struct.types": [
|
||||
7
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"array.len": 32,
|
||||
"array.type": 8
|
||||
},
|
||||
"def": "builtin"
|
||||
},
|
||||
{
|
||||
"id": "u8",
|
||||
"def": "builtin"
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 8,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
10,
|
||||
7
|
||||
],
|
||||
"custom.params": [
|
||||
10
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 11,
|
||||
"type": 13
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "str",
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 17,
|
||||
"type": 11
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 18,
|
||||
"custom.namespace": [],
|
||||
"custom.params": [
|
||||
8
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 19,
|
||||
"type": 12
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"slice.type": 8
|
||||
},
|
||||
"def": "builtin"
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 12,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
13
|
||||
],
|
||||
"custom.params": [
|
||||
10
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 11,
|
||||
"type": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 21,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
22,
|
||||
23,
|
||||
24
|
||||
],
|
||||
"custom.params": [
|
||||
15
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 30,
|
||||
"type": 17
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 25,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
22,
|
||||
26,
|
||||
27
|
||||
],
|
||||
"custom.params": [
|
||||
16
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 28,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
22,
|
||||
29
|
||||
],
|
||||
"custom.params": []
|
||||
},
|
||||
"def": {
|
||||
"clike_enum.variants": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 31,
|
||||
"custom.namespace": [
|
||||
9,
|
||||
22,
|
||||
23,
|
||||
32
|
||||
],
|
||||
"custom.params": [
|
||||
15
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 33,
|
||||
"type": 18
|
||||
},
|
||||
{
|
||||
"name": 35,
|
||||
"type": 11
|
||||
},
|
||||
{
|
||||
"name": 36,
|
||||
"type": 4
|
||||
},
|
||||
{
|
||||
"name": 37,
|
||||
"type": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 34,
|
||||
"custom.namespace": [],
|
||||
"custom.params": [
|
||||
15
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"tuple_struct.types": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"storage": {
|
||||
"struct.type": 1,
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 10,
|
||||
"layout": {
|
||||
"struct.type": 2,
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 7,
|
||||
"layout": {
|
||||
"struct.type": 3,
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 11,
|
||||
"layout": {
|
||||
"range.offset": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"range.len": 1,
|
||||
"range.elem_type": 4
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": 16,
|
||||
"layout": {
|
||||
"struct.type": 9,
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 11,
|
||||
"layout": {
|
||||
"range.offset": "0x0000000000000000000000000000000000000000000000000000000000000001",
|
||||
"range.len": 1,
|
||||
"range.elem_type": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"contract": {
|
||||
"name": 2,
|
||||
"constructors": [
|
||||
{
|
||||
"name": 38,
|
||||
"selector": "[\"0x5E\",\"0xBD\",\"0x88\",\"0xD6\"]",
|
||||
"args": [
|
||||
{
|
||||
"name": 16,
|
||||
"type": {
|
||||
"ty": 11,
|
||||
"display_name": [
|
||||
18
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": 39,
|
||||
"type": {
|
||||
"ty": 4,
|
||||
"display_name": [
|
||||
40
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
"Constructor that initializes the `bool` value to the given `init_value`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": 41,
|
||||
"selector": "[\"0x02\",\"0x22\",\"0xFF\",\"0x18\"]",
|
||||
"args": [],
|
||||
"docs": [
|
||||
"Constructor that initializes the `bool` value to `false`.",
|
||||
"",
|
||||
"Constructors can delegate to other constructors."
|
||||
]
|
||||
}
|
||||
],
|
||||
"messages": [
|
||||
{
|
||||
"name": 42,
|
||||
"selector": "[\"0x8C\",\"0x97\",\"0xDB\",\"0x39\"]",
|
||||
"mutates": true,
|
||||
"args": [],
|
||||
"return_type": null,
|
||||
"docs": [
|
||||
"A message that can be called on instantiated contracts.",
|
||||
"This one flips the value of the stored `bool` from `true`",
|
||||
"to `false` and vice versa."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": 43,
|
||||
"selector": "[\"0x25\",\"0x44\",\"0x4A\",\"0xFE\"]",
|
||||
"mutates": false,
|
||||
"args": [],
|
||||
"return_type": {
|
||||
"ty": 4,
|
||||
"display_name": [
|
||||
40
|
||||
]
|
||||
},
|
||||
"docs": [
|
||||
"Simply returns the current value of our `bool`."
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [],
|
||||
"docs": []
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,49 +1,46 @@
|
||||
[
|
||||
{
|
||||
"info": 7,
|
||||
"info": 8,
|
||||
"type": "{\"value\": {\"cell\": {\"cell\": ([u8;32])}}}",
|
||||
"name": "Flipper",
|
||||
"namespace": "flipper::normal",
|
||||
"sub": [
|
||||
{
|
||||
"info": 7,
|
||||
"info": 8,
|
||||
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
|
||||
"name": "value",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"sub": [
|
||||
{
|
||||
"info": 7,
|
||||
"info": 8,
|
||||
"type": "{\"cell\": ([u8;32])}",
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"sub": [
|
||||
{
|
||||
"info": 8,
|
||||
"info": 9,
|
||||
"type": "([u8;32])",
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
@@ -57,44 +54,41 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 7,
|
||||
"info": 8,
|
||||
"type": "{\"cell\": {\"cell\": ([u8;32])}}",
|
||||
"name": "Value",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"sub": [
|
||||
{
|
||||
"info": 7,
|
||||
"info": 8,
|
||||
"type": "{\"cell\": ([u8;32])}",
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"sub": [
|
||||
{
|
||||
"info": 8,
|
||||
"info": 9,
|
||||
"type": "([u8;32])",
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
@@ -106,36 +100,33 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"info": 7,
|
||||
"info": 8,
|
||||
"type": "{\"cell\": ([u8;32])}",
|
||||
"name": "SyncCell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"sub": [
|
||||
{
|
||||
"info": 8,
|
||||
"info": 9,
|
||||
"type": "([u8;32])",
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
@@ -145,20 +136,17 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 8,
|
||||
"info": 9,
|
||||
"type": "([u8;32])",
|
||||
"name": "Key",
|
||||
"namespace": "ink_core::storage::key",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
@@ -166,19 +154,16 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
"info": 11,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": ""
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info": 5,
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
[
|
||||
{
|
||||
"info": 10,
|
||||
"type": "{ \"value\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\"} }",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 7,
|
||||
"type": "u32"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "value",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 7,
|
||||
"type": "u32"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "Incrementer",
|
||||
"namespace": "incrementer::normal"
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 7,
|
||||
"type": "u32"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "Value",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 7,
|
||||
"type": "u32"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 7,
|
||||
"type": "u32"
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "SyncCell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 7,
|
||||
"type": "u32"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 11,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "Key",
|
||||
"namespace": "ink_core::storage::key"
|
||||
},
|
||||
{
|
||||
"info": 13,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info": 7,
|
||||
"type": "u8"
|
||||
},
|
||||
{
|
||||
"info": 7,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
@@ -1,19 +1,19 @@
|
||||
[
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"mutators\": \"{ \"len\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\", \"entries\": \"{ \"cells_key\": \"([u8;32])\"} }<{ \"_enum\": { \"Occupied\": \"({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)\", \"Removed\": \"Null\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>>\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>\", \"vec\": \"{ \"len\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\", \"cells\": \"{ \"cells_key\": \"([u8;32])\"} }<i32>\"} }<i32>\"} }",
|
||||
"type": "{\"mutators\":\"{\\\"len\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"cell\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"([u8;32])\\\\\\\\\\\\\\\"}\\\\\\\"}\\\",\\\"entries\\\":\\\"{\\\\\\\"cells_key\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"vec\":\"{\\\"len\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"cell\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"([u8;32])\\\\\\\\\\\\\\\"}\\\\\\\"}\\\",\\\"cells\\\":\\\"{\\\\\\\"cells_key\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"len\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\", \"entries\": \"{ \"cells_key\": \"([u8;32])\"} }<{ \"_enum\": { \"Occupied\": \"({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)\", \"Removed\": \"Null\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>>\"} }",
|
||||
"type": "{\"len\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"entries\":\"{\\\"cells_key\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -22,10 +22,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -58,7 +55,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cells_key\": \"([u8;32])\"} }",
|
||||
"type": "{\"cells_key\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -67,10 +64,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -87,7 +81,7 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "{ \"_enum\": { \"Occupied\": \"({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)\", \"Removed\": \"Null\"} }",
|
||||
"type": "{\"_enum\":{\"Occupied\":\"({\\\"key\\\":\\\"([u8;32])\\\",\\\"val\\\":\\\"{\\\\\\\"begin\\\\\\\":\\\\\\\"Option<u32>\\\\\\\",\\\\\\\"end\\\\\\\":\\\\\\\"Option<u32>\\\\\\\"}\\\"})\",\"Removed\":\"Null\"}}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -95,19 +89,16 @@
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }",
|
||||
"type": "{\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -120,7 +111,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -162,15 +153,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -183,7 +171,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -223,7 +211,7 @@
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"type": "({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)"
|
||||
"type": "({\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"})"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
@@ -236,15 +224,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -257,7 +242,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -303,15 +288,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -324,7 +306,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -364,15 +346,15 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"len\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\", \"cells\": \"{ \"cells_key\": \"([u8;32])\"} }<i32>\"} }",
|
||||
"type": "{\"len\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"cells\":\"{\\\"cells_key\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -381,10 +363,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -417,7 +396,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cells_key\": \"([u8;32])\"} }",
|
||||
"type": "{\"cells_key\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -426,10 +405,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -466,15 +442,15 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"len\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\", \"entries\": \"{ \"cells_key\": \"([u8;32])\"} }<{ \"_enum\": { \"Occupied\": \"({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)\", \"Removed\": \"Null\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>>\"} }",
|
||||
"type": "{\"len\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"entries\":\"{\\\"cells_key\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -483,10 +459,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -519,7 +492,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cells_key\": \"([u8;32])\"} }",
|
||||
"type": "{\"cells_key\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -528,10 +501,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -548,7 +518,7 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "{ \"_enum\": { \"Occupied\": \"({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)\", \"Removed\": \"Null\"} }",
|
||||
"type": "{\"_enum\":{\"Occupied\":\"({\\\"key\\\":\\\"([u8;32])\\\",\\\"val\\\":\\\"{\\\\\\\"begin\\\\\\\":\\\\\\\"Option<u32>\\\\\\\",\\\\\\\"end\\\\\\\":\\\\\\\"Option<u32>\\\\\\\"}\\\"})\",\"Removed\":\"Null\"}}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -556,19 +526,16 @@
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }",
|
||||
"type": "{\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -581,7 +548,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -623,15 +590,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -644,7 +608,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -684,7 +648,7 @@
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"type": "({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)"
|
||||
"type": "({\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"})"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
@@ -697,15 +661,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -718,7 +679,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -764,15 +725,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -785,7 +743,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -825,15 +783,12 @@
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -847,10 +802,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -862,7 +814,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -919,11 +871,11 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -932,10 +884,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -968,7 +917,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -977,10 +926,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1008,10 +954,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1024,7 +967,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cells_key\": \"([u8;32])\"} }",
|
||||
"type": "{\"cells_key\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -1033,10 +976,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1053,7 +993,7 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "{ \"_enum\": { \"Occupied\": \"({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)\", \"Removed\": \"Null\"} }",
|
||||
"type": "{\"_enum\":{\"Occupied\":\"({\\\"key\\\":\\\"([u8;32])\\\",\\\"val\\\":\\\"{\\\\\\\"begin\\\\\\\":\\\\\\\"Option<u32>\\\\\\\",\\\\\\\"end\\\\\\\":\\\\\\\"Option<u32>\\\\\\\"}\\\"})\",\"Removed\":\"Null\"}}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -1061,19 +1001,16 @@
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }",
|
||||
"type": "{\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1086,7 +1023,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -1128,15 +1065,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1149,7 +1083,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -1189,7 +1123,7 @@
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"type": "({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)"
|
||||
"type": "({\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"})"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
@@ -1202,15 +1136,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1223,7 +1154,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -1265,7 +1196,7 @@
|
||||
},
|
||||
{
|
||||
"info": 3,
|
||||
"type": "{ \"_enum\": { \"Occupied\": \"({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)\", \"Removed\": \"Null\"} }",
|
||||
"type": "{\"_enum\":{\"Occupied\":\"({\\\"key\\\":\\\"([u8;32])\\\",\\\"val\\\":\\\"{\\\\\\\"begin\\\\\\\":\\\\\\\"Option<u32>\\\\\\\",\\\\\\\"end\\\\\\\":\\\\\\\"Option<u32>\\\\\\\"}\\\"})\",\"Removed\":\"Null\"}}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -1273,19 +1204,16 @@
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }",
|
||||
"type": "{\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1298,7 +1226,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -1340,15 +1268,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1361,7 +1286,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -1401,7 +1326,7 @@
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"type": "({ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }<([u8;32]), { \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }>)"
|
||||
"type": "({\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"})"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
@@ -1414,15 +1339,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1435,7 +1357,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -1475,19 +1397,16 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"key\": \"AccountId\", \"val\": \"{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }\"} }",
|
||||
"type": "{\"key\":\"([u8;32])\",\"val\":\"{\\\"begin\\\":\\\"Option<u32>\\\",\\\"end\\\":\\\"Option<u32>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1500,7 +1419,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -1542,15 +1461,12 @@
|
||||
"params": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "AccountId",
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1563,7 +1479,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"begin\": \"Option<u32><u32>\", \"end\": \"Option<u32><u32>\"} }",
|
||||
"type": "{\"begin\":\"Option<u32>\",\"end\":\"Option<u32>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 5,
|
||||
@@ -1603,15 +1519,15 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"len\": \"{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }<u32>\", \"cells\": \"{ \"cells_key\": \"([u8;32])\"} }<i32>\"} }",
|
||||
"type": "{\"len\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"cells\":\"{\\\"cells_key\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"{ \"cell\": \"([u8;32])\"} }<u32>\"} }",
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cell\": \"([u8;32])\"} }",
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -1620,10 +1536,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1656,7 +1569,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cells_key\": \"([u8;32])\"} }",
|
||||
"type": "{\"cells_key\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -1665,10 +1578,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1705,7 +1615,7 @@
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{ \"cells_key\": \"([u8;32])\"} }",
|
||||
"type": "{\"cells_key\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
@@ -1714,10 +1624,7 @@
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"ext": {
|
||||
"length": 32,
|
||||
"type": "u8"
|
||||
},
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
@@ -1810,4 +1717,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -0,0 +1,972 @@
|
||||
[
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"__storage\":\"{\\\"value\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"cell\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"([u8;32])\\\\\\\\\\\\\\\"}\\\\\\\"}\\\",\\\"name\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"cell\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"([u8;32])\\\\\\\\\\\\\\\"}\\\\\\\"}\\\"}\",\"__env\":\"{\\\"access\\\":\\\"{\\\\\\\"env\\\\\\\":\\\\\\\"()\\\\\\\",\\\\\\\"buffer\\\\\\\":\\\\\\\"{\\\\\\\\\\\\\\\"elems\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"Vec<u8>\\\\\\\\\\\\\\\"}\\\\\\\",\\\\\\\"has_interacted\\\\\\\":\\\\\\\"bool\\\\\\\",\\\\\\\"has_returned_value\\\\\\\":\\\\\\\"bool\\\\\\\"}\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"value\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"name\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "value",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "name",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "__storage",
|
||||
"namespace": "app::app::__ink_private::__ink_storage"
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"access\":\"{\\\"env\\\":\\\"()\\\",\\\"buffer\\\":\\\"{\\\\\\\"elems\\\\\\\":\\\\\\\"Vec<u8>\\\\\\\"}\\\",\\\"has_interacted\\\":\\\"bool\\\",\\\"has_returned_value\\\":\\\"bool\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"env\":\"()\",\"buffer\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\",\"has_interacted\":\"bool\",\"has_returned_value\":\"bool\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "()",
|
||||
"sub": [],
|
||||
"name": "env",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "buffer",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool",
|
||||
"name": "has_interacted"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool",
|
||||
"name": "has_returned_value"
|
||||
}
|
||||
],
|
||||
"name": "access",
|
||||
"namespace": "ink_core::env2::env_access::mutable",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "__env",
|
||||
"namespace": "ink_core::env2::env_access::immutable",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "StorageAndEnv",
|
||||
"namespace": "app::app::__ink_private::__ink_storage"
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"value\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\",\"name\":\"{\\\"cell\\\":\\\"{\\\\\\\"cell\\\\\\\":\\\\\\\"([u8;32])\\\\\\\"}\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "value",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "name",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "Storage",
|
||||
"namespace": "app::app::__ink_private::__ink_storage"
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "Value",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "SyncCell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "Key",
|
||||
"namespace": "ink_core::storage::key"
|
||||
},
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"{\\\"cell\\\":\\\"([u8;32])\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "Value",
|
||||
"namespace": "ink_core::storage::value",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "Vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"cell\":\"([u8;32])\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "([u8;32])",
|
||||
"sub": [
|
||||
{
|
||||
"info": 12,
|
||||
"type": "[u8;32]",
|
||||
"length": 32,
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
"name": "cell",
|
||||
"namespace": "ink_core::storage::key"
|
||||
}
|
||||
],
|
||||
"name": "SyncCell",
|
||||
"namespace": "ink_core::storage::cell::sync_cell",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"vec\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "vec",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"access\":\"{\\\"env\\\":\\\"()\\\",\\\"buffer\\\":\\\"{\\\\\\\"elems\\\\\\\":\\\\\\\"Vec<u8>\\\\\\\"}\\\",\\\"has_interacted\\\":\\\"bool\\\",\\\"has_returned_value\\\":\\\"bool\\\"}\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"env\":\"()\",\"buffer\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\",\"has_interacted\":\"bool\",\"has_returned_value\":\"bool\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "()",
|
||||
"sub": [],
|
||||
"name": "env",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "buffer",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool",
|
||||
"name": "has_interacted"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool",
|
||||
"name": "has_returned_value"
|
||||
}
|
||||
],
|
||||
"name": "access",
|
||||
"namespace": "ink_core::env2::env_access::mutable",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "EnvAccess",
|
||||
"namespace": "ink_core::env2::env_access::immutable",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"env\":\"()\",\"buffer\":\"{\\\"elems\\\":\\\"Vec<u8>\\\"}\",\"has_interacted\":\"bool\",\"has_returned_value\":\"bool\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 10,
|
||||
"type": "()",
|
||||
"sub": [],
|
||||
"name": "env",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{\"elems\":\"Vec<u8>\"}",
|
||||
"sub": [
|
||||
{
|
||||
"info": 11,
|
||||
"type": "Vec<u8>",
|
||||
"sub": {
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
},
|
||||
"name": "elems"
|
||||
}
|
||||
],
|
||||
"name": "buffer",
|
||||
"params": [
|
||||
{
|
||||
"info": 6,
|
||||
"type": "u8"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool",
|
||||
"name": "has_interacted"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
"type": "bool",
|
||||
"name": "has_returned_value"
|
||||
}
|
||||
],
|
||||
"name": "EnvAccessMut",
|
||||
"namespace": "ink_core::env2::env_access::mutable",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
"type": "()",
|
||||
"sub": [],
|
||||
"name": "PhantomData",
|
||||
"params": [
|
||||
{
|
||||
"info": 9,
|
||||
"type": "{}",
|
||||
"sub": [],
|
||||
"name": "TestEnv",
|
||||
"namespace": "ink_core::env2::test::accessor",
|
||||
"params": [
|
||||
{
|
||||
"info": 3,
|
||||
"type": "[]",
|
||||
"sub": [],
|
||||
"name": "DefaultSrmlTypes",
|
||||
"namespace": "ink_core::env2::types"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1 +0,0 @@
|
||||
{"name":"Incrementer","deploy":{"args":[{"name":"init_value","type":"u32"}]},"messages":[{"name":"inc","selector":257544423,"mutates":true,"args":[{"name":"by","type":"u32"}],"return_type":null},{"name":"get","selector":4266279973,"mutates":false,"args":[],"return_type":"u32"},{"name":"compare","selector":363906316,"mutates":false,"args":[{"name":"with","type":"u32"}],"return_type":"bool"}]}
|
||||
@@ -0,0 +1,233 @@
|
||||
{
|
||||
"registry": {
|
||||
"strings": [
|
||||
"Incrementer",
|
||||
"incrementer",
|
||||
"normal",
|
||||
"value",
|
||||
"Value",
|
||||
"ink_core",
|
||||
"storage",
|
||||
"cell",
|
||||
"SyncCell",
|
||||
"sync_cell",
|
||||
"Key",
|
||||
"key",
|
||||
"on_deploy",
|
||||
"init_value",
|
||||
"u32",
|
||||
"inc",
|
||||
"by",
|
||||
"get",
|
||||
"compare",
|
||||
"with",
|
||||
"bool"
|
||||
],
|
||||
"types": [
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 1,
|
||||
"custom.namespace": [
|
||||
2,
|
||||
3
|
||||
],
|
||||
"custom.params": []
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 4,
|
||||
"type": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 5,
|
||||
"custom.namespace": [
|
||||
6,
|
||||
7,
|
||||
4
|
||||
],
|
||||
"custom.params": [
|
||||
3
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 8,
|
||||
"type": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "u32",
|
||||
"def": "builtin"
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 9,
|
||||
"custom.namespace": [
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
10
|
||||
],
|
||||
"custom.params": [
|
||||
3
|
||||
]
|
||||
},
|
||||
"def": {
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 8,
|
||||
"type": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"custom.name": 11,
|
||||
"custom.namespace": [
|
||||
6,
|
||||
7,
|
||||
12
|
||||
],
|
||||
"custom.params": []
|
||||
},
|
||||
"def": {
|
||||
"tuple_struct.types": [
|
||||
6
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": {
|
||||
"array.len": 32,
|
||||
"array.type": 7
|
||||
},
|
||||
"def": "builtin"
|
||||
},
|
||||
{
|
||||
"id": "u8",
|
||||
"def": "builtin"
|
||||
},
|
||||
{
|
||||
"id": "bool",
|
||||
"def": "builtin"
|
||||
}
|
||||
]
|
||||
},
|
||||
"storage": {
|
||||
"struct.type": 1,
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 4,
|
||||
"layout": {
|
||||
"struct.type": 2,
|
||||
"struct.fields": [
|
||||
{
|
||||
"name": 8,
|
||||
"layout": {
|
||||
"range.offset": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"range.len": 1,
|
||||
"range.elem_type": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"contract": {
|
||||
"name": 1,
|
||||
"constructors": [
|
||||
{
|
||||
"name": 13,
|
||||
"selector": "[\"0x00\",\"0x00\",\"0x00\",\"0x00\"]",
|
||||
"args": [
|
||||
{
|
||||
"name": 14,
|
||||
"type": {
|
||||
"ty": 3,
|
||||
"display_name": [
|
||||
15
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"docs": [
|
||||
"Initializes the value to the initial value."
|
||||
]
|
||||
}
|
||||
],
|
||||
"messages": [
|
||||
{
|
||||
"name": 16,
|
||||
"selector": "[\"0x0F\",\"0x59\",\"0xD0\",\"0xE7\"]",
|
||||
"mutates": true,
|
||||
"args": [
|
||||
{
|
||||
"name": 17,
|
||||
"type": {
|
||||
"ty": 3,
|
||||
"display_name": [
|
||||
15
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"return_type": null,
|
||||
"docs": [
|
||||
"Flips the current state of our smart contract."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": 18,
|
||||
"selector": "[\"0xFE\",\"0x4A\",\"0x44\",\"0x25\"]",
|
||||
"mutates": false,
|
||||
"args": [],
|
||||
"return_type": {
|
||||
"ty": 3,
|
||||
"display_name": [
|
||||
15
|
||||
]
|
||||
},
|
||||
"docs": [
|
||||
"Returns the current state."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": 19,
|
||||
"selector": "[\"0x15\",\"0xB0\",\"0xC5\",\"0x0C\"]",
|
||||
"mutates": false,
|
||||
"args": [
|
||||
{
|
||||
"name": 20,
|
||||
"type": {
|
||||
"ty": 3,
|
||||
"display_name": [
|
||||
15
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"return_type": {
|
||||
"ty": 8,
|
||||
"display_name": [
|
||||
21
|
||||
]
|
||||
},
|
||||
"docs": [
|
||||
"Returns `true` if the internal value is greater than or equal to the provided value."
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [],
|
||||
"docs": []
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "0.95.2",
|
||||
"version": "1.4.1",
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -27,11 +27,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/api": "^0.95.2",
|
||||
"@polkadot/types": "^0.95.2"
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/api": "1.4.1",
|
||||
"@polkadot/rpc-core": "1.4.1",
|
||||
"@polkadot/rpc-provider": "1.4.1",
|
||||
"@polkadot/types": "1.4.1",
|
||||
"@polkadot/util": "^2.5.1",
|
||||
"@polkadot/util-crypto": "^2.5.1",
|
||||
"bn.js": "^5.1.1",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^1.6.1"
|
||||
"@polkadot/keyring": "^2.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,45 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
|
||||
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map, startWith } from 'rxjs/operators';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { isU8a } from '@polkadot/util';
|
||||
import { decodeAddress } from '@polkadot/util-crypto';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { idToIndex } from './idToIndex';
|
||||
import { indexToId } from './indexToId';
|
||||
import { drr } from '../util/drr';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
export type AccountIdAndIndex = [AccountId?, AccountIndex?];
|
||||
|
||||
function retrieve (api: ApiInterfaceRx, address: Address | AccountId | AccountIndex | string | null | undefined): Observable<AccountIdAndIndex> {
|
||||
try {
|
||||
// yes, this can fail, don't care too much, catch will catch it
|
||||
const decoded = isU8a(address)
|
||||
? address
|
||||
: decodeAddress((address || '').toString());
|
||||
|
||||
if (decoded.length === 32) {
|
||||
const accountId = createType(api.registry, 'AccountId', decoded);
|
||||
|
||||
return api.derive.accounts.idToIndex(accountId).pipe(
|
||||
map((accountIndex): AccountIdAndIndex => [accountId, accountIndex] as AccountIdAndIndex)
|
||||
);
|
||||
}
|
||||
|
||||
const accountIndex = createType(api.registry, 'AccountIndex', decoded);
|
||||
|
||||
return api.derive.accounts.indexToId(accountIndex).pipe(
|
||||
map((accountId): AccountIdAndIndex => [accountId, accountIndex] as AccountIdAndIndex)
|
||||
);
|
||||
} catch (error) {
|
||||
return of([undefined, undefined] as AccountIdAndIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name idAndIndex
|
||||
* @param {(Address | AccountId | AccountIndex | string | null)} address - An accounts address in various formats.
|
||||
@@ -30,32 +54,6 @@ export type AccountIdAndIndex = [AccountId?, AccountIndex?];
|
||||
* ```
|
||||
*/
|
||||
export function idAndIndex (api: ApiInterfaceRx): (address?: Address | AccountId | AccountIndex | string | null) => Observable<AccountIdAndIndex> {
|
||||
return (address?: Address | AccountId | AccountIndex | string | null): Observable<AccountIdAndIndex> => {
|
||||
try {
|
||||
// yes, this can fail, don't care too much, catch will catch it
|
||||
const decoded = isU8a(address)
|
||||
? address
|
||||
: decodeAddress((address || '').toString());
|
||||
|
||||
if (decoded.length === 32) {
|
||||
const accountId = createType('AccountId', decoded);
|
||||
|
||||
return idToIndex(api)(accountId).pipe(
|
||||
startWith(undefined),
|
||||
map((accountIndex): AccountIdAndIndex => [accountId, accountIndex] as AccountIdAndIndex),
|
||||
drr()
|
||||
);
|
||||
}
|
||||
|
||||
const accountIndex = createType('AccountIndex', decoded);
|
||||
|
||||
return indexToId(api)(accountIndex).pipe(
|
||||
startWith(undefined),
|
||||
map((accountId): AccountIdAndIndex => [accountId, accountIndex] as AccountIdAndIndex),
|
||||
drr()
|
||||
);
|
||||
} catch (error) {
|
||||
return of([undefined, undefined] as AccountIdAndIndex).pipe(drr());
|
||||
}
|
||||
};
|
||||
return memo((address?: Address | AccountId | AccountIndex | string | null): Observable<AccountIdAndIndex> =>
|
||||
retrieve(api, address));
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
|
||||
import { AccountIndexes } from '../types';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, startWith } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
|
||||
import { indexes, AccountIndexes } from './indexes';
|
||||
import { drr } from '../util/drr';
|
||||
import { memo } from '../util';
|
||||
|
||||
/**
|
||||
* @name idToIndex
|
||||
@@ -26,13 +26,11 @@ import { drr } from '../util/drr';
|
||||
* ```
|
||||
*/
|
||||
export function idToIndex (api: ApiInterfaceRx): (accountId: AccountId | string) => Observable<AccountIndex | undefined> {
|
||||
return (accountId: AccountId | string): Observable<AccountIndex | undefined> =>
|
||||
indexes(api)()
|
||||
.pipe(
|
||||
startWith({}),
|
||||
map((indexes: AccountIndexes): AccountIndex | undefined =>
|
||||
(indexes || {})[accountId.toString()]
|
||||
),
|
||||
drr()
|
||||
);
|
||||
return memo((accountId: AccountId | string): Observable<AccountIndex | undefined> =>
|
||||
api.derive.accounts.indexes().pipe(
|
||||
startWith({}),
|
||||
map((indexes: AccountIndexes): AccountIndex | undefined =>
|
||||
(indexes || {})[accountId.toString()]
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -6,3 +6,4 @@ export * from './idAndIndex';
|
||||
export * from './idToIndex';
|
||||
export * from './indexToId';
|
||||
export * from './indexes';
|
||||
export * from './info';
|
||||
|
||||
@@ -1,16 +1,39 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
|
||||
import { AccountId, AccountIndex, BalanceOf } from '@polkadot/types/interfaces';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map, startWith } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { ENUMSET_SIZE } from '@polkadot/types/primitive/Generic/AccountIndex';
|
||||
import { createType, ClassOf, Vec } from '@polkadot/types';
|
||||
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
|
||||
import { ClassOf, Option, Vec, createType } from '@polkadot/types';
|
||||
|
||||
import { drr } from '../util/drr';
|
||||
import { memo } from '../util';
|
||||
|
||||
function queryEnumSet (api: ApiInterfaceRx, _accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
|
||||
const accountIndex = _accountIndex instanceof ClassOf(api.registry, 'AccountIndex')
|
||||
? _accountIndex
|
||||
: createType(api.registry, 'AccountIndex', _accountIndex);
|
||||
|
||||
return api.query.indices.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)).pipe(
|
||||
startWith([]),
|
||||
map((accounts): AccountId | undefined =>
|
||||
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// current
|
||||
function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Observable<AccountId | undefined> {
|
||||
return api.query.indices.accounts<Option<ITuple<[AccountId, BalanceOf]>>>(accountIndex).pipe(
|
||||
map((optResult): AccountId | undefined =>
|
||||
optResult.unwrapOr([])[0]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name indexToId
|
||||
@@ -26,19 +49,11 @@ import { drr } from '../util/drr';
|
||||
* ```
|
||||
*/
|
||||
export function indexToId (api: ApiInterfaceRx): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined> {
|
||||
return (_accountIndex: AccountIndex | string): Observable<AccountId | undefined> => {
|
||||
const querySection = api.query.indices || api.query.balances;
|
||||
const accountIndex = _accountIndex instanceof ClassOf('AccountIndex')
|
||||
? _accountIndex
|
||||
: createType('AccountIndex', _accountIndex);
|
||||
|
||||
return (querySection.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)))
|
||||
.pipe(
|
||||
startWith([]),
|
||||
map((accounts): AccountId | undefined =>
|
||||
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
|
||||
),
|
||||
drr()
|
||||
);
|
||||
};
|
||||
return memo((accountIndex: AccountIndex | string): Observable<AccountId | undefined> =>
|
||||
api.query.indices
|
||||
? api.query.indices.accounts
|
||||
? query(api, accountIndex)
|
||||
: queryEnumSet(api, accountIndex)
|
||||
: of(undefined)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,50 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { ENUMSET_SIZE } from '@polkadot/types/primitive/Generic/AccountIndex';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
|
||||
import { AccountIndexes } from '../types';
|
||||
|
||||
import { drr } from '../util/drr';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
|
||||
import { Vec, createType } from '@polkadot/types';
|
||||
|
||||
export type AccountIndexes = Record<string, AccountIndex>;
|
||||
import { memo } from '../util';
|
||||
|
||||
const enumsetSize = ENUMSET_SIZE.toNumber();
|
||||
|
||||
function queryEnumSet (api: ApiInterfaceRx): Observable<AccountIndexes> {
|
||||
return api.query.indices.nextEnumSet<AccountIndex>().pipe(
|
||||
// use the nextEnumSet (which is a counter of the number of sets) to construct
|
||||
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
|
||||
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
|
||||
// containing an AccountId
|
||||
switchMap((next: AccountIndex): Observable<Vec<AccountId>[]> =>
|
||||
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
|
||||
),
|
||||
map((all: AccountId[][]): AccountIndexes =>
|
||||
all.reduce((result: AccountIndexes, list, outerIndex): AccountIndexes => {
|
||||
(list || []).forEach((accountId, innerIndex): void => {
|
||||
// re-create the index based on position 0 is [0][0] and likewise
|
||||
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
|
||||
const index = (outerIndex * enumsetSize) + innerIndex;
|
||||
|
||||
result[accountId.toString()] = createType(api.registry, 'AccountIndex', index);
|
||||
});
|
||||
|
||||
return result;
|
||||
}, {})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// TODO Reverse lookup (via query keys)
|
||||
function query (): Observable<AccountIndexes> {
|
||||
return of({} as AccountIndexes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name indexes
|
||||
* @returns Returns all the indexes on the system.
|
||||
@@ -32,29 +61,11 @@ const enumsetSize = ENUMSET_SIZE.toNumber();
|
||||
* ```
|
||||
*/
|
||||
export function indexes (api: ApiInterfaceRx): () => Observable<AccountIndexes> {
|
||||
return (): Observable<AccountIndexes> => {
|
||||
return (api.query.indices.nextEnumSet<AccountIndex>())
|
||||
.pipe(
|
||||
// use the nextEnumSet (which is a counter of the number of sets) to construct
|
||||
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
|
||||
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
|
||||
// containing an AccountId
|
||||
switchMap((next: AccountIndex): Observable<any> =>
|
||||
api.query.indices.enumSet.multi([...Array(next.toNumber() + 1).keys()]) as Observable<any>
|
||||
),
|
||||
map((all: (AccountId[] | undefined)[]): AccountIndexes =>
|
||||
(all || []).reduce((result, list, outerIndex): AccountIndexes => {
|
||||
(list || []).forEach((accountId, innerIndex): void => {
|
||||
// re-create the index based on position 0 is [0][0] and likewise
|
||||
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
|
||||
const index = (outerIndex * enumsetSize) + innerIndex;
|
||||
|
||||
result[accountId.toString()] = createType('AccountIndex', index);
|
||||
});
|
||||
|
||||
return result;
|
||||
}, {} as AccountIndexes)),
|
||||
drr()
|
||||
);
|
||||
};
|
||||
return memo((): Observable<AccountIndexes> =>
|
||||
api.query.indices
|
||||
? api.query.indices.accounts
|
||||
? query()
|
||||
: queryEnumSet(api)
|
||||
: of({} as AccountIndexes)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { AccountId, AccountIndex, Address, Balance, Registration } from '@polkadot/types/interfaces';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { DeriveAccountInfo, DeriveAccountRegistration } from '../types';
|
||||
|
||||
import { Observable, combineLatest, of } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { Bytes, Data, Option, u32 } from '@polkadot/types';
|
||||
import { u8aToString } from '@polkadot/util';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
function dataAsString (data: Data): string | undefined {
|
||||
return data.isRaw
|
||||
? u8aToString(data.asRaw.toU8a(true))
|
||||
: data.isSha256
|
||||
? data.asSha256.toHex()
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function retrieveNick (api: ApiInterfaceRx, accountId?: AccountId): Observable<string | undefined> {
|
||||
return ((
|
||||
accountId && api.query.nicks?.nameOf
|
||||
? api.query.nicks.nameOf<Option<ITuple<[Bytes, Balance]>>>(accountId)
|
||||
: of(undefined)
|
||||
) as Observable<Option<ITuple<[Bytes, Balance]>> | undefined>).pipe(
|
||||
map((nameOf): string | undefined =>
|
||||
nameOf?.isSome
|
||||
? u8aToString(nameOf.unwrap()[0]).substr(0, (api.consts.nicks.maxLength as u32).toNumber())
|
||||
: undefined
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function extractIdentity (identityOfOpt?: Option<Registration>, superOf?: [AccountId, Data]): DeriveAccountRegistration {
|
||||
if (!identityOfOpt?.isSome) {
|
||||
return { judgements: [] };
|
||||
}
|
||||
|
||||
const { info, judgements } = identityOfOpt.unwrap();
|
||||
const topDisplay = dataAsString(info.display);
|
||||
|
||||
return {
|
||||
display: superOf
|
||||
? dataAsString(superOf[1]) || topDisplay
|
||||
: topDisplay,
|
||||
displayParent: superOf
|
||||
? topDisplay
|
||||
: undefined,
|
||||
email: dataAsString(info.email),
|
||||
image: dataAsString(info.image),
|
||||
legal: dataAsString(info.legal),
|
||||
other: info.additional.reduce((other: Record<string, string>, [_key, _value]): Record<string, string> => {
|
||||
const key = dataAsString(_key);
|
||||
const value = dataAsString(_value);
|
||||
|
||||
if (key && value) {
|
||||
other[key] = value;
|
||||
}
|
||||
|
||||
return other;
|
||||
}, {}),
|
||||
parent: superOf
|
||||
? superOf[0]
|
||||
: undefined,
|
||||
pgp: info.pgpFingerprint.isSome
|
||||
? info.pgpFingerprint.unwrap().toHex()
|
||||
: undefined,
|
||||
riot: dataAsString(info.riot),
|
||||
twitter: dataAsString(info.twitter),
|
||||
web: dataAsString(info.web),
|
||||
judgements
|
||||
};
|
||||
}
|
||||
|
||||
function retrieveIdentity (api: ApiInterfaceRx, accountId?: AccountId): Observable<DeriveAccountRegistration> {
|
||||
return ((
|
||||
accountId && api.query.identity?.identityOf
|
||||
? api.queryMulti([
|
||||
[api.query.identity.identityOf, accountId],
|
||||
[api.query.identity.superOf, accountId]
|
||||
])
|
||||
: of([undefined, undefined])
|
||||
) as Observable<[Option<Registration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]>).pipe(
|
||||
switchMap(([identityOfOpt, superOfOpt]): Observable<[Option<Registration> | undefined, [AccountId, Data] | undefined]> => {
|
||||
if (identityOfOpt?.isSome) {
|
||||
// this identity has something set
|
||||
return of([identityOfOpt, undefined]);
|
||||
} else if (superOfOpt?.isSome) {
|
||||
const superOf = superOfOpt.unwrap();
|
||||
|
||||
// we have a super
|
||||
return combineLatest([
|
||||
api.query.identity.identityOf<Option<Registration>>(superOf[0]),
|
||||
of(superOf)
|
||||
]);
|
||||
}
|
||||
|
||||
// nothing of value returned
|
||||
return of([undefined, undefined]);
|
||||
}),
|
||||
map(([identityOfOpt, superOf]): DeriveAccountRegistration =>
|
||||
extractIdentity(identityOfOpt, superOf)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name info
|
||||
* @description Returns aux. info with regards to an account, current that includes the accountId, accountIndex and nickname
|
||||
*/
|
||||
export function info (api: ApiInterfaceRx): (address?: AccountIndex | AccountId | Address | string | null) => Observable<DeriveAccountInfo> {
|
||||
return memo((address?: AccountIndex | AccountId | Address | string | null): Observable<DeriveAccountInfo> =>
|
||||
api.derive.accounts.idAndIndex(address).pipe(
|
||||
switchMap(([accountId, accountIndex]): Observable<[Partial<DeriveAccountInfo>, DeriveAccountRegistration, string?]> =>
|
||||
combineLatest([
|
||||
of({ accountId, accountIndex }),
|
||||
retrieveIdentity(api, accountId),
|
||||
retrieveNick(api, accountId)
|
||||
])
|
||||
),
|
||||
map(([{ accountId, accountIndex }, identity, nickname]): DeriveAccountInfo => ({
|
||||
accountId, accountIndex, identity, nickname
|
||||
}))
|
||||
));
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, AccountData, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { DerivedBalancesAccount } from '../types';
|
||||
|
||||
import { combineLatest, of, Observable } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
type Result = [Balance, Balance, Balance, Balance, Index];
|
||||
|
||||
function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBalance, frozenFee, frozenMisc, accountNonce]]: [AccountId, Result]): DerivedBalancesAccount {
|
||||
return {
|
||||
accountId,
|
||||
accountNonce,
|
||||
freeBalance,
|
||||
frozenFee,
|
||||
frozenMisc,
|
||||
reservedBalance,
|
||||
votingBalance: createType(api.registry, 'Balance', freeBalance.add(reservedBalance))
|
||||
};
|
||||
}
|
||||
|
||||
// old
|
||||
function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
return api.queryMulti<[Balance, Balance, Index]>([
|
||||
[api.query.balances.freeBalance, accountId],
|
||||
[api.query.balances.reservedBalance, accountId],
|
||||
[api.query.system.accountNonce, accountId]
|
||||
]).pipe(
|
||||
map(([freeBalance, reservedBalance, accountNonce]): Result =>
|
||||
[freeBalance, reservedBalance, createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), accountNonce]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
return api.queryMulti<[AccountData, Index]>([
|
||||
[api.query.balances.account, accountId],
|
||||
[api.query.system.accountNonce, accountId]
|
||||
]).pipe(
|
||||
map(([{ free, reserved, miscFrozen, feeFrozen }, accountNonce]): Result =>
|
||||
[free, reserved, feeFrozen, miscFrozen, accountNonce]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
// AccountInfo is current, support old, eg. Edgeware
|
||||
return api.query.system.account<AccountInfo | ITuple<[Index, AccountData]>>(accountId).pipe(
|
||||
map((infoOrTuple): Result => {
|
||||
const { free, reserved, miscFrozen, feeFrozen } = (infoOrTuple as AccountInfo).nonce
|
||||
? (infoOrTuple as AccountInfo).data
|
||||
: (infoOrTuple as [Index, AccountData])[1];
|
||||
const accountNonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
|
||||
|
||||
return [free, reserved, feeFrozen, miscFrozen, accountNonce];
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name account
|
||||
* @param {( AccountIndex | AccountId | Address | string )} address - An accounts Id in different formats.
|
||||
* @returns An object containing the results of various balance queries
|
||||
* @example
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* const ALICE = 'F7Hs';
|
||||
*
|
||||
* api.derive.balances.all(ALICE, ({ accountId, lockedBalance }) => {
|
||||
* console.log(`The account ${accountId} has a locked balance ${lockedBalance} units.`);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function account (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalancesAccount> {
|
||||
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalancesAccount> =>
|
||||
api.derive.accounts.info(address).pipe(
|
||||
switchMap(({ accountId }): Observable<[AccountId, Result]> =>
|
||||
(accountId
|
||||
? combineLatest([
|
||||
of(accountId),
|
||||
api.query.system.account
|
||||
? queryCurrent(api, accountId)
|
||||
: api.query.balances.account
|
||||
? queryBalancesAccount(api, accountId)
|
||||
: queryBalancesFree(api, accountId)
|
||||
])
|
||||
: of([createType(api.registry, 'AccountId'), [createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Index')]])
|
||||
)
|
||||
),
|
||||
map((result): DerivedBalancesAccount => calcBalances(api, result))
|
||||
));
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, AccountIndex, Address, Balance, BalanceLock, BlockNumber, Index, VestingSchedule } from '@polkadot/types/interfaces';
|
||||
import { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
|
||||
import { DerivedBalancesAccount, DerivedBalancesAll } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { combineLatest, of, Observable } from 'rxjs';
|
||||
@@ -11,60 +12,101 @@ import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { Option, Vec, createType } from '@polkadot/types';
|
||||
import { bnMax } from '@polkadot/util';
|
||||
|
||||
import { idAndIndex } from '../accounts/idAndIndex';
|
||||
import { bestNumber } from '../chain/bestNumber';
|
||||
import { DerivedBalances } from '../types';
|
||||
import { drr } from '../util/drr';
|
||||
import { memo } from '../util';
|
||||
|
||||
type ResultBalance = [Balance, Balance, BalanceLock[], Option<VestingSchedule>];
|
||||
type Result = [AccountId, BlockNumber, ResultBalance, Index];
|
||||
type ResultBalance = [VestingInfo | null, (BalanceLock | BalanceLockTo212)[]];
|
||||
type Result = [DerivedBalancesAccount, BlockNumber, ResultBalance];
|
||||
|
||||
function calcBalances ([accountId, bestNumber, [freeBalance, reservedBalance, locks, vesting], accountNonce]: Result): DerivedBalances {
|
||||
let lockedBalance = createType('Balance');
|
||||
function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBalance, frozenFee, frozenMisc, reservedBalance, votingBalance }, bestNumber, [vesting, locks]]: Result): DerivedBalancesAll {
|
||||
let lockedBalance = createType(api.registry, 'Balance');
|
||||
let lockedBreakdown: (BalanceLock | BalanceLockTo212)[] = [];
|
||||
|
||||
if (Array.isArray(locks)) {
|
||||
// only get the locks that are valid until passed the current block
|
||||
const totals = locks.filter((value): boolean => bestNumber && value.until.gt(bestNumber));
|
||||
lockedBreakdown = (locks as BalanceLockTo212[]).filter(({ until }): boolean => !until || (bestNumber && until.gt(bestNumber)));
|
||||
|
||||
const notAll = lockedBreakdown.filter(({ amount }): boolean => !amount.isMax());
|
||||
|
||||
// get the maximum of the locks according to https://github.com/paritytech/substrate/blob/master/srml/balances/src/lib.rs#L699
|
||||
lockedBalance = totals[0]
|
||||
? createType('Balance', bnMax(...totals.map(({ amount }): Balance => amount)))
|
||||
: createType('Balance');
|
||||
if (notAll.length) {
|
||||
lockedBalance = createType(api.registry, 'Balance', bnMax(...notAll.map(({ amount }): Balance => amount)));
|
||||
}
|
||||
}
|
||||
|
||||
// offset = balance locked at genesis, perBlock is the unlock amount
|
||||
const { offset, perBlock } = vesting.unwrapOr(createType('VestingSchedule'));
|
||||
const vestedNow = createType('Balance', perBlock.mul(bestNumber));
|
||||
const vestedBalance = vestedNow.gt(offset)
|
||||
? freeBalance
|
||||
: createType('Balance', freeBalance.sub(offset).add(vestedNow));
|
||||
// Calculate the vesting balances,
|
||||
// - offset = balance locked at startingBlock
|
||||
// - perBlock is the unlock amount
|
||||
const { locked: vestingTotal, perBlock, startingBlock } = vesting || createType(api.registry, 'VestingInfo');
|
||||
const isStarted = bestNumber.gt(startingBlock);
|
||||
const vestedBalance = createType(api.registry, 'Balance', isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : 0);
|
||||
const isVesting = isStarted && vestedBalance.lt(vestingTotal);
|
||||
|
||||
// NOTE Workaround for this account on Alex (one of a couple reported) -
|
||||
// 5F7BJL6Z4m8RLtK7nXEqqpEqhBbd535Z3CZeYF6ccvaQAY6N
|
||||
// The locked is > the vested and ended up with the locked > free,
|
||||
// i.e. related to https://github.com/paritytech/polkadot/issues/225
|
||||
// (most probably due to movements from stash -> controller -> free)
|
||||
const availableBalance = createType('Balance', bnMax(new BN(0), vestedBalance.sub(lockedBalance)));
|
||||
// The available balance & vested has an interplay here
|
||||
// "
|
||||
// vesting is a guarantee that the account's balance will never go below a certain amount. so it functions in the opposite way, a bit like a lock that is monotonically decreasing rather than a liquid amount that is monotonically increasing.
|
||||
// locks function as the same guarantee - that a balance will not be lower than a particular amount.
|
||||
// because of this you can see that if there is a "vesting lock" that guarantees the balance cannot go below 200, and a "staking lock" that guarantees the balance cannot drop below 300, then we just have two guarantees of which the first is irrelevant.
|
||||
// i.e. (balance >= 200 && balance >= 300) == (balance >= 300)
|
||||
// ""
|
||||
const floating = freeBalance.sub(lockedBalance);
|
||||
const extraReceived = isVesting ? freeBalance.sub(vestingTotal) : new BN(0);
|
||||
const availableBalance = createType(api.registry, 'Balance', bnMax(new BN(0), isVesting && floating.gt(vestedBalance) ? vestedBalance.add(extraReceived) : floating));
|
||||
|
||||
return {
|
||||
accountId,
|
||||
accountNonce,
|
||||
availableBalance,
|
||||
freeBalance,
|
||||
frozenFee,
|
||||
frozenMisc,
|
||||
isVesting,
|
||||
lockedBalance,
|
||||
lockedBreakdown,
|
||||
reservedBalance,
|
||||
vestedBalance,
|
||||
votingBalance: createType('Balance', freeBalance.add(reservedBalance))
|
||||
vestingTotal,
|
||||
votingBalance
|
||||
};
|
||||
}
|
||||
|
||||
function queryBalances (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
|
||||
return api.queryMulti<[Balance, Balance, Vec<BalanceLock>, Option<VestingSchedule>]>([
|
||||
[api.query.balances.freeBalance, accountId],
|
||||
[api.query.balances.reservedBalance, accountId],
|
||||
// old
|
||||
function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
|
||||
return api.queryMulti<[Vec<BalanceLock>, Option<VestingSchedule>]>([
|
||||
[api.query.balances.locks, accountId],
|
||||
[api.query.balances.vesting, accountId]
|
||||
]);
|
||||
]).pipe(
|
||||
map(([locks, optVesting]): ResultBalance => {
|
||||
let vestingNew = null;
|
||||
|
||||
if (optVesting.isSome) {
|
||||
const { offset: locked, perBlock, startingBlock } = optVesting.unwrap();
|
||||
|
||||
vestingNew = createType(api.registry, 'VestingInfo', { locked, perBlock, startingBlock });
|
||||
}
|
||||
|
||||
return [vestingNew, locks];
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// current (balances vesting)
|
||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
|
||||
return (
|
||||
api.query.vesting.vesting
|
||||
? api.queryMulti<[Vec<BalanceLock>, Option<VestingInfo>]>([
|
||||
[api.query.balances.locks, accountId],
|
||||
[api.query.vesting.vesting, accountId]
|
||||
])
|
||||
: api.query.balances.locks(accountId).pipe(
|
||||
map((locks): [Vec<BalanceLock>, Option<VestingInfo>] =>
|
||||
[locks, createType(api.registry, 'Option<VestingInfo>')]
|
||||
)
|
||||
)
|
||||
).pipe(
|
||||
map(([locks, optVesting]): ResultBalance =>
|
||||
[optVesting.unwrapOr(null), locks]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,27 +124,21 @@ function queryBalances (api: ApiInterfaceRx, accountId: AccountId): Observable<R
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function all (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalances> {
|
||||
return (address: AccountIndex | AccountId | Address | string): Observable<DerivedBalances> => {
|
||||
return idAndIndex(api)(address).pipe(
|
||||
switchMap(([accountId]): Observable<Result> =>
|
||||
(accountId
|
||||
export function all (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalancesAll> {
|
||||
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalancesAll> =>
|
||||
api.derive.balances.account(address).pipe(
|
||||
switchMap((account): Observable<Result> =>
|
||||
(!account.accountId.isEmpty
|
||||
? combineLatest([
|
||||
of(accountId),
|
||||
bestNumber(api)(),
|
||||
queryBalances(api, accountId),
|
||||
// FIXME This is having issues with Kusama, only use accountNonce atm
|
||||
// api.rpc.account && api.rpc.account.nextIndex
|
||||
// ? api.rpc.account.nextIndex(accountId)
|
||||
// // otherwise we end up with this: type 'Codec | Index' is not assignable to type 'Index'.
|
||||
// : api.query.system.accountNonce<Index>(accountId)
|
||||
api.query.system.accountNonce<Index>(accountId)
|
||||
of(account),
|
||||
api.derive.chain.bestNumber(),
|
||||
api.query.balances.account
|
||||
? queryCurrent(api, account.accountId)
|
||||
: queryOld(api, account.accountId)
|
||||
])
|
||||
: of([createType('AccountId'), createType('BlockNumber'), [createType('Balance'), createType('Balance'), createType('Vec<BalanceLock>'), createType('Option<VestingSchedule>', null)], createType('Index')])
|
||||
: of([account, createType(api.registry, 'BlockNumber'), [null, createType(api.registry, 'Vec<BalanceLock>')]])
|
||||
)
|
||||
),
|
||||
map(calcBalances),
|
||||
drr()
|
||||
);
|
||||
};
|
||||
map((result): DerivedBalancesAll => calcBalances(api, result))
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
@@ -8,35 +8,9 @@ import { DerivedFees } from '../types';
|
||||
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
import { drr } from '../util/drr';
|
||||
|
||||
type Result = [Balance, Balance, Balance, Balance, Balance];
|
||||
|
||||
function queryV2 (api: ApiInterfaceRx): Observable<Result> {
|
||||
const paymentBase = api.consts.transactionPayment || api.consts.balances;
|
||||
|
||||
return of([
|
||||
// get values from api.const for substrate versions post spec_version: 101
|
||||
// https://github.com/paritytech/substrate/pull/2883/files#diff-5e5e1c3aec9ddfde0a9054d062ab3db9R131
|
||||
api.consts.balances.creationFee as Balance,
|
||||
api.consts.balances.existentialDeposit as Balance,
|
||||
api.consts.balances.transferFee as Balance,
|
||||
paymentBase.transactionBaseFee as Balance,
|
||||
paymentBase.transactionByteFee as Balance
|
||||
]);
|
||||
}
|
||||
|
||||
function queryV1 (api: ApiInterfaceRx): Observable<Result> {
|
||||
return api.queryMulti<Result>([
|
||||
// Support older versions and get values from storage
|
||||
api.query.balances.creationFee,
|
||||
api.query.balances.existentialDeposit,
|
||||
api.query.balances.transferFee,
|
||||
api.query.balances.transactionBaseFee,
|
||||
api.query.balances.transactionByteFee
|
||||
]);
|
||||
}
|
||||
import { memo } from '../util';
|
||||
|
||||
/**
|
||||
* @name fees
|
||||
@@ -52,20 +26,23 @@ function queryV1 (api: ApiInterfaceRx): Observable<Result> {
|
||||
* ```
|
||||
*/
|
||||
export function fees (api: ApiInterfaceRx): () => Observable<DerivedFees> {
|
||||
return (): Observable<DerivedFees> => {
|
||||
return (
|
||||
api.consts.balances
|
||||
? queryV2(api)
|
||||
: queryV1(api)
|
||||
).pipe(
|
||||
map(([creationFee, existentialDeposit, transferFee, transactionBaseFee, transactionByteFee]): DerivedFees => ({
|
||||
return memo((): Observable<DerivedFees> =>
|
||||
of([
|
||||
// deprecated - remove
|
||||
(api.consts.balances.creationFee as Balance) || createType(api.registry, 'Balance'),
|
||||
(api.consts.balances.transferFee as Balance) || createType(api.registry, 'Balance'),
|
||||
|
||||
// current
|
||||
api.consts.balances.existentialDeposit,
|
||||
api.consts.transactionPayment.transactionBaseFee,
|
||||
api.consts.transactionPayment.transactionByteFee
|
||||
]).pipe(
|
||||
map(([creationFee, transferFee, existentialDeposit, transactionBaseFee, transactionByteFee]): DerivedFees => ({
|
||||
creationFee,
|
||||
existentialDeposit,
|
||||
transactionBaseFee,
|
||||
transactionByteFee,
|
||||
transferFee
|
||||
})),
|
||||
drr()
|
||||
);
|
||||
};
|
||||
}))
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { all } from './all';
|
||||
|
||||
export * from './account';
|
||||
export * from './fees';
|
||||
export * from './votingBalances';
|
||||
export * from './votingBalancesNominatorsFor';
|
||||
|
||||
const votingBalance = all;
|
||||
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
|
||||
import { DerivedBalancesAccount } from '../types';
|
||||
|
||||
import { combineLatest, Observable, of } from 'rxjs';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
|
||||
import { DerivedBalances } from '../types';
|
||||
import { drr } from '../util/drr';
|
||||
import { all } from './all';
|
||||
import { memo } from '../util';
|
||||
|
||||
export function votingBalances (api: ApiInterfaceRx): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DerivedBalances[]> {
|
||||
return (addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DerivedBalances[]> => {
|
||||
return (
|
||||
!addresses || !addresses.length
|
||||
? of([] as DerivedBalances[])
|
||||
: combineLatest(addresses.map(all(api)))
|
||||
).pipe(
|
||||
drr()
|
||||
);
|
||||
};
|
||||
export function votingBalances (api: ApiInterfaceRx): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DerivedBalancesAccount[]> {
|
||||
return memo((addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DerivedBalancesAccount[]> =>
|
||||
!addresses || !addresses.length
|
||||
? of([] as DerivedBalancesAccount[])
|
||||
: combineLatest(
|
||||
addresses.map((accountId): Observable<DerivedBalancesAccount> =>
|
||||
api.derive.balances.account(accountId))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
|
||||
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { Vec } from '@polkadot/types';
|
||||
|
||||
import { idAndIndex } from '../accounts/idAndIndex';
|
||||
import { DerivedBalances } from '../types';
|
||||
import { drr } from '../util/drr';
|
||||
import { votingBalances } from './votingBalances';
|
||||
|
||||
export function votingBalancesNominatorsFor (api: ApiInterfaceRx): (address: AccountId | AccountIndex | Address | string) => Observable<DerivedBalances[]> {
|
||||
return (address: AccountId | AccountIndex | Address | string): Observable<DerivedBalances[]> => {
|
||||
return idAndIndex(api)(address).pipe(
|
||||
switchMap(([accountId]): Observable<AccountId[]> =>
|
||||
accountId
|
||||
? (api.query.staking.nominatorsFor<Vec<AccountId>>(accountId))
|
||||
: of([] as AccountId[])
|
||||
),
|
||||
switchMap(votingBalances(api)),
|
||||
drr()
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { BlockNumber } from '@polkadot/types/interfaces';
|
||||
import { BlockNumber, Header } from '@polkadot/types/interfaces';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
|
||||
import { drr } from '../util/drr';
|
||||
import { memo } from '../util';
|
||||
|
||||
/**
|
||||
* @name bestNumber
|
||||
@@ -23,9 +23,8 @@ import { drr } from '../util/drr';
|
||||
* ```
|
||||
*/
|
||||
export function bestNumber (api: ApiInterfaceRx): () => Observable<BlockNumber> {
|
||||
return (): Observable<BlockNumber> =>
|
||||
api.rpc.chain.subscribeNewHeads().pipe(
|
||||
map((header): BlockNumber => header.number.unwrap()),
|
||||
drr()
|
||||
);
|
||||
return memo((): Observable<BlockNumber> =>
|
||||
api.derive.chain.subscribeNewHeads().pipe(
|
||||
map((header: Header): BlockNumber => header.number.unwrap())
|
||||
));
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user