Compare commits

...
192 Commits
Author SHA1 Message Date
github-actions[bot] ef54cfb29b [CI Skip] release/stable 8.4.2
skip-checks: true
2022-05-15 08:53:15 +00:00
Jaco 23c23a81b3 8.4.2 (#4828) 2022-05-15 11:45:18 +03:00
github-actions[bot] 3d8ba0f1bf [CI Skip] release/stable 8.4.1
skip-checks: true
2022-05-14 12:37:18 +00:00
Jaco b39efbeaf2 8.4.1 (#4827) 2022-05-14 15:28:45 +03:00
github-actions[bot] b305caee6e [CI Skip] release/beta 8.3.3-16
skip-checks: true
2022-05-13 19:41:22 +00:00
Jaco 143a149628 Bump common (#4825) 2022-05-13 22:33:31 +03:00
github-actions[bot] 8f80c0391d [CI Skip] release/beta 8.3.3-15
skip-checks: true
2022-05-13 14:51:31 +00:00
Jaco 1364cb8264 Upgrade blocks (#4824) 2022-05-13 17:42:56 +03:00
github-actions[bot] 0e12ebad1d [CI Skip] release/beta 8.3.3-14
skip-checks: true
2022-05-13 14:03:36 +00:00
Jaco 8dc0f0486d Small decoding cleanups (#4823)
* Small decoding cleanups

* isHex

* Adjust struct

* Additional
2022-05-13 16:55:13 +03:00
github-actions[bot] 6159270465 [CI Skip] release/beta 8.3.3-13
skip-checks: true
2022-05-13 11:33:21 +00:00
Jaco 40b3c54916 Bump common (#4822) 2022-05-13 14:24:45 +03:00
github-actions[bot] 85e7e3c11c [CI Skip] release/beta 8.3.3-12
skip-checks: true
2022-05-12 12:33:11 +00:00
Jaco 3ad01d27b2 Add Vote override for conviction-voting (#4821) 2022-05-12 15:24:39 +03:00
github-actions[bot] 05b0ff2aba [CI Skip] release/beta 8.3.3-11
skip-checks: true
2022-05-12 09:39:49 +00:00
Jaco 84c9da8374 Bump beta @polkadot/util (#4820)
* Bump beta @polkadot/util

* Bump common
2022-05-12 12:28:27 +03:00
github-actions[bot] 6222672faa [CI Skip] release/beta 8.3.3-10
skip-checks: true
2022-05-12 05:22:23 +00:00
Jaco 96f2f83cd5 Bump deps (#4819) 2022-05-12 08:13:00 +03:00
github-actions[bot] f444d9ed75 [CI Skip] release/beta 8.3.3-9
skip-checks: true
2022-05-11 08:36:53 +00:00
Jaco d93a127d88 Create linkage compatible types in V14 conversion (#4816)
* Create linkage compatible types in V14 conversion

* Handle Linkage in extractTypes

* Linkage fallback type

* CHANGELOG
2022-05-11 11:25:30 +03:00
github-actions[bot] 3a9a35a392 [CI Skip] release/beta 8.3.3-8
skip-checks: true
2022-05-10 11:47:01 +00:00
Jaco 5c655ca029 Use I* interfaces for extrinsic payload getters (#4814)
* Use `I*` interfaces for extrinsic payload getters

* Adjust with IText

* Text extends IText

* Adjust
2022-05-10 14:38:58 +03:00
github-actions[bot] 1808cb0a9d [CI Skip] release/beta 8.3.3-7
skip-checks: true
2022-05-10 07:48:04 +00:00
Jaco 54e94ec6bc Change all usages of .substr to .substring (#4809) 2022-05-10 10:39:15 +03:00
github-actions[bot] 22db4f1c3d [CI Skip] release/beta 8.3.3-6
skip-checks: true
2022-05-10 07:35:27 +00:00
Jaco e514a59e63 Bump deps (#4812) 2022-05-10 10:27:03 +03:00
github-actions[bot] 3318a7566f [CI Skip] release/beta 8.3.3-5
skip-checks: true
2022-05-09 10:27:35 +00:00
Jaco fd568c0341 Optimize Compact decoding in Uint8Array streams (#4808)
* Optimize Compact decoding in Uint8Array streams

* Adjust test

* Adjust
2022-05-09 13:19:05 +03:00
github-actions[bot] 2edcef6ff5 [CI Skip] release/beta 8.3.3-4
skip-checks: true
2022-05-09 08:05:51 +00:00
Jaco 264cc9365e Bump metadata (#4806) 2022-05-09 10:55:51 +03:00
github-actions[bot] 6e23a27ce1 [CI Skip] release/beta 8.3.3-3
skip-checks: true
2022-05-09 06:59:58 +00:00
Jaco 38d39a4d13 Allow for optional definitions in typegen (#4805)
* Allow for optional definitions in typegen

* Adjust

* Adjust
2022-05-09 09:51:35 +03:00
github-actions[bot] 6954ec794c [CI Skip] release/beta 8.3.3-2
skip-checks: true
2022-05-09 06:11:08 +00:00
Jaco 3ee6eb5a13 Dedupe wss:// handling in polkadot-types-from-{chain, defs} (#4804) 2022-05-09 09:01:07 +03:00
github-actions[bot] 9d1c848f28 [CI Skip] release/beta 8.3.3-1
skip-checks: true
2022-05-09 05:42:43 +00:00
Jaco 1d3258f537 Add explicit support for Call typegen (inclusive of non-defaults) (#4803) 2022-05-09 08:31:48 +03:00
github-actions[bot] e8d7013172 [CI Skip] release/beta 8.3.3-0
skip-checks: true
2022-05-09 05:14:07 +00:00
Jaco 55ccdd2fbc Add support for Range/RangeInclusive typegen (#4802) 2022-05-09 08:03:17 +03:00
github-actions[bot] 0449dd7b51 [CI Skip] release/stable 8.3.2
skip-checks: true
2022-05-08 16:23:38 +00:00
Jaco 4d44c1187b 8.3.2 (#4800) 2022-05-08 19:15:30 +03:00
github-actions[bot] f2eff6628b [CI Skip] release/beta 8.3.2-2
skip-checks: true
2022-05-06 11:22:58 +00:00
Nikos KontakisandPierre Krieger 4923bc3e35 Bump @substrate/connect in rpc-provider to 0.7.4 (#4796)
* Bump @substrate/connect in rpc-provider to 0.7.4

* Add new optional param config in ScProvider's connect() where user can alter the log level

* Satisfy linter

* Update packages/rpc-provider/src/substrate-connect/ScProvider.ts

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Address PRs comments

* Fix build error

* remove config feature

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2022-05-06 14:11:37 +03:00
github-actions[bot] 47da005bee [CI Skip] release/beta 8.3.2-1
skip-checks: true
2022-05-06 03:51:19 +00:00
Jaco 7e82ab3d43 Adjust BTreeSet in typegen top-level generation (#4794) 2022-05-06 06:42:22 +03:00
github-actions[bot] 8df9642e04 [CI Skip] release/beta 8.3.2-0
skip-checks: true
2022-05-05 06:17:33 +00:00
Jaco 6f76e1c4cc Bump @polkadot/dev (#4792) 2022-05-05 09:07:55 +03:00
github-actions[bot] 1d65cc5642 [CI Skip] release/stable 8.3.1
skip-checks: true
2022-05-01 07:01:27 +00:00
Jaco 722bb5222e 8.3.1 (#4789) 2022-05-01 09:52:47 +03:00
github-actions[bot] 49e2daf8f2 [CI Skip] release/beta 8.2.2-11
skip-checks: true
2022-05-01 06:43:57 +00:00
Jaco 88e3c900b7 Bump metadata (#4788) 2022-05-01 09:35:49 +03:00
github-actions[bot] a127dea5e4 [CI Skip] release/beta 8.2.2-10
skip-checks: true
2022-04-30 19:44:53 +00:00
Jaco d29660dc4e Adjust size-assert for U8Fixed (#4787) 2022-04-30 22:35:23 +03:00
github-actions[bot] 1870ad26d5 [CI Skip] release/beta 8.2.2-9
skip-checks: true
2022-04-30 11:29:05 +00:00
Jaco 558a42c6ed Correct BTreeSet extraction (#4785) 2022-04-30 14:18:45 +03:00
github-actions[bot] 6708264688 [CI Skip] release/beta 8.2.2-8
skip-checks: true
2022-04-30 06:09:26 +00:00
Jaco abac14f983 Bump @polkadot/util (#4784) 2022-04-30 09:01:02 +03:00
github-actions[bot] 3cf9040115 [CI Skip] release/beta 8.2.2-7
skip-checks: true
2022-04-29 11:47:32 +00:00
Jaco 37dcd78c4a Bump TS (#4782) 2022-04-29 14:37:50 +03:00
github-actions[bot] 6b3e4cc90e [CI Skip] release/beta 8.2.2-6
skip-checks: true
2022-04-27 09:54:17 +00:00
Jaco 79ab347cbe Westend 9200 upgrade block (#4777) 2022-04-27 12:43:28 +03:00
github-actions[bot] bc302c5cb7 [CI Skip] release/beta 8.2.2-5
skip-checks: true
2022-04-27 07:05:38 +00:00
Jaco 9972776afb Bump @polkadot/dev (#4776) 2022-04-27 09:56:13 +03:00
github-actions[bot] 0b2a3c4e74 [CI Skip] release/beta 8.2.2-4
skip-checks: true
2022-04-26 17:36:22 +00:00
Jaco ccac72fece Remove outdated contract docs (#4774) 2022-04-26 20:27:48 +03:00
github-actions[bot] 8d5209d7dc [CI Skip] release/beta 8.2.2-3
skip-checks: true
2022-04-26 17:23:03 +00:00
Alex DandAlex D 5c2bd9dfa7 fetch metadata via websocket in polkadot-types-from-defs (#4773)
* add ability to fetch metadata from websocket connection as stated in usage https://github.com/polkadot-js/api/blob/master/packages/typegen/src/fromDefs.ts\#L20

* exit after websocket

Co-authored-by: Alex D <pr0fedt@gmail.com>
2022-04-26 20:13:29 +03:00
github-actions[bot] b2e71be983 [CI Skip] release/beta 8.2.2-2
skip-checks: true
2022-04-26 14:59:52 +00:00
Jaco d2f3672f2c Metadata for nomination pools (#4753)
* Metadata for nomination pools

* Update

* Adjust

* Bump meta

* Re-add pool meta

* Latest pools metadata

* Rerun
2022-04-26 17:48:49 +03:00
github-actions[bot] 6fb7849091 [CI Skip] release/beta 8.2.2-1
skip-checks: true
2022-04-26 13:23:48 +00:00
Jaco 983c77fe61 Adjustment for paymentInfo (#4771)
* Adjustment for paymentInfo

* Bump dev
2022-04-26 16:12:17 +03:00
github-actions[bot] 256e35386a [CI Skip] release/beta 8.2.2-0
skip-checks: true
2022-04-25 09:08:14 +00:00
Jaco 8beb03b177 Kusama 9190 upgrade block (#4769) 2022-04-25 12:00:39 +03:00
github-actions[bot] 967f5e980a [CI Skip] release/stable 8.2.1
skip-checks: true
2022-04-24 08:59:23 +00:00
Jaco 00a27efaee 8.2.1 (#4766) 2022-04-24 11:51:42 +03:00
github-actions[bot] a7163fb1ba [CI Skip] release/beta 8.1.2-6
skip-checks: true
2022-04-24 07:32:16 +00:00
Jaco 4c6dd53c3b Bump dev (w/ lint fixes) (#4765) 2022-04-24 10:23:58 +03:00
github-actions[bot] 61199ffb2b [CI Skip] release/beta 8.1.2-5
skip-checks: true
2022-04-24 07:11:13 +00:00
Jaco dbfb03760c Bump static metadata (#4764)
* Bump static metadata

* Redo Kusama
2022-04-24 10:02:48 +03:00
github-actions[bot] c9b1fcdb0a [CI Skip] release/beta 8.1.2-4
skip-checks: true
2022-04-22 13:30:54 +00:00
Jaco 29953edd24 api.derive.balances.fees (#4761)
* api.derive.balances.fees

* Adjust for removal

* Adjust
2022-04-22 16:22:36 +03:00
github-actions[bot] 96a23bda50 [CI Skip] release/beta 8.1.2-3
skip-checks: true
2022-04-22 05:14:41 +00:00
serge 09a8d80144 make WS provider timeout configurable (#4758)
* make WS provider timeout configurable

* minor
2022-04-22 08:05:42 +03:00
github-actions[bot] 5637579879 [CI Skip] release/beta 8.1.2-2
skip-checks: true
2022-04-21 19:43:07 +00:00
Jaco 448ce0a76e Re-bump dev 2022-04-21 22:34:33 +03:00
Jaco a6a062378d Bump dev (#4763) 2022-04-21 22:26:03 +03:00
github-actions[bot] 40c78f95d2 [CI Skip] release/beta 8.1.2-1
skip-checks: true
2022-04-19 14:10:30 +00:00
Jaco b0e135c5ca Bump deps (#4757) 2022-04-19 16:59:27 +03:00
github-actions[bot] 22218bd9b0 [CI Skip] release/beta 8.1.2-0
skip-checks: true
2022-04-19 10:10:08 +00:00
Jaco 149b7d9ee6 Don't fake sign if already signed (#4756) 2022-04-19 13:02:20 +03:00
github-actions[bot] 9a7b91a6f5 [CI Skip] release/stable 8.1.1
skip-checks: true
2022-04-17 11:40:27 +00:00
Jaco 80b165ba34 8.1.1 (#4750)
* 8.1.1

* CHANGELOG
2022-04-17 14:31:59 +03:00
github-actions[bot] 95a4512530 [CI Skip] release/beta 8.0.3-6
skip-checks: true
2022-04-17 10:52:54 +00:00
Jaco 15a315dede Bump static metadata (#4749) 2022-04-17 13:44:21 +03:00
github-actions[bot] 32548a34a4 [CI Skip] release/beta 8.0.3-5
skip-checks: true
2022-04-17 05:39:22 +00:00
Jaco 50142d7e63 Pull typegen __dirname from packageInfo (#4748)
* Pull ty[pegen __dirname from packageInfo

* CHANGELOG
2022-04-17 08:31:04 +03:00
github-actions[bot] 1ed6117e3f [CI Skip] release/beta 8.0.3-4
skip-checks: true
2022-04-14 13:51:48 +00:00
Jaco a392025a15 Adjust default "no RPC response" timeout to 60s (#4746) 2022-04-14 16:43:53 +03:00
github-actions[bot] fbeb478602 [CI Skip] release/beta 8.0.3-3
skip-checks: true
2022-04-14 12:17:31 +00:00
Jaco 2cdd24445c Adjust entriesPages w/ & w/o at (#4745)
* Adjust entriesPages w/ & w/o at

* Adjust

* Update packages/api/src/base/Decorate.ts

* s/keyset/keys/

* CHANGELOG
2022-04-14 15:07:55 +03:00
github-actions[bot] e545f6f2b3 [CI Skip] release/beta 8.0.3-2
skip-checks: true
2022-04-14 09:51:19 +00:00
Zannis Kalampoukis 1aa2b7e1ff fix: Typegen handles structs and vectors of structs without erroring (#4743) 2022-04-14 12:39:57 +03:00
github-actions[bot] 677d0c9969 [CI Skip] release/beta 8.0.3-1
skip-checks: true
2022-04-14 05:22:37 +00:00
Jaco 775fff5333 Apply wildcard type matches (renamed pallets) (#4741)
* Apply wildcard type matches (renamed pallets)

* typo
2022-04-14 08:14:04 +03:00
github-actions[bot] 9345a18de0 [CI Skip] release/beta 8.0.3-0
skip-checks: true
2022-04-12 05:07:29 +00:00
Jaco a4256396ee Bump deps (#4739) 2022-04-12 07:59:13 +03:00
github-actions[bot] 776600ef00 [CI Skip] release/stable 8.0.2
skip-checks: true
2022-04-11 18:09:09 +00:00
Jaco 1a31043cc4 Detect typegen template location for commonjs execution (#4738) 2022-04-11 21:01:00 +03:00
github-actions[bot] 66159955ac [CI Skip] release/stable 8.0.1
skip-checks: true
2022-04-10 10:34:25 +00:00
Jaco 03c725f637 8.0.1 (#4734) 2022-04-10 13:26:19 +03:00
github-actions[bot] e5708a7e7e [CI Skip] release/beta 7.15.2-15
skip-checks: true
2022-04-09 13:13:27 +00:00
Jaco fb5ce83f74 Add support for apiAt.tx(...) (#4696)
* Add support for apiAt.tx(...)

* CHANGELOG
2022-04-09 16:05:36 +03:00
github-actions[bot] 6c3bd2f408 [CI Skip] release/beta 7.15.2-14
skip-checks: true
2022-04-09 10:11:21 +00:00
Jaco 66e01afe26 Bump metadata (#4732) 2022-04-09 13:02:46 +03:00
github-actions[bot] 71f9bdf368 [CI Skip] release/beta 7.15.2-13
skip-checks: true
2022-04-09 09:26:26 +00:00
Jaco 7af9330026 Add bagList expand(bag: Bag) (#4731) 2022-04-09 12:17:58 +03:00
github-actions[bot] d5aff171e4 [CI Skip] release/beta 7.15.2-12
skip-checks: true
2022-04-09 09:15:46 +00:00
Jaco 543de63af8 Re-use bagList types (#4730) 2022-04-09 12:05:33 +03:00
github-actions[bot] cdcdf589dd [CI Skip] release/beta 7.15.2-11
skip-checks: true
2022-04-09 08:49:12 +00:00
Jaco 1330b58afd Align derive.bagsList.all with multi (#4729) 2022-04-09 11:40:48 +03:00
github-actions[bot] 0b2ec65e88 [CI Skip] release/beta 7.15.2-10
skip-checks: true
2022-04-09 08:37:51 +00:00
Jaco 8840e29063 Bump util to 9.0.1 (#4728) 2022-04-09 11:29:42 +03:00
github-actions[bot] b9925b569d [CI Skip] release/beta 7.15.2-9
skip-checks: true
2022-04-09 06:41:34 +00:00
Jaco 2640b65be9 Fix typegen for cjs imports (#4727) 2022-04-09 09:33:05 +03:00
github-actions[bot] d64a0ca295 [CI Skip] release/beta 7.15.2-8
skip-checks: true
2022-04-08 18:54:24 +00:00
Jaco 79eeed3f9a Return sorted names for api.registry.lookup.names (#4726) 2022-04-08 21:46:03 +03:00
github-actions[bot] d154b535e6 [CI Skip] release/beta 7.15.2-7
skip-checks: true
2022-04-08 15:43:31 +00:00
Jaco 87c2690fc2 Bagslist derive sorted (#4725) 2022-04-08 18:35:14 +03:00
github-actions[bot] 8f0ca37c60 [CI Skip] release/beta 7.15.2-6
skip-checks: true
2022-04-08 13:04:36 +00:00
Jaco f7dd4a3552 Add basic derive.bagsList support (#4723) 2022-04-08 15:56:14 +03:00
github-actions[bot] abcad05a91 [CI Skip] release/beta 7.15.2-5
skip-checks: true
2022-04-08 05:59:53 +00:00
Jaco ba188dcc0d JSONRPC request/response handler opts (#4722)
* JSONRPC request/response handler opts

* Fix test

* CHANGELOG
2022-04-08 08:51:44 +03:00
github-actions[bot] ae2422f350 [CI Skip] release/beta 7.15.2-4
skip-checks: true
2022-04-08 05:45:27 +00:00
Zannis KalampoukisandJaco 576efc0239 fix: typegen supports vectors of slices (#4720)
* fix: typegen supports vectors of slices

* fix linting

* Update packages/typegen/src/util/derived.ts

Co-authored-by: Jaco <jacogr@gmail.com>
2022-04-08 08:37:31 +03:00
github-actions[bot] 111540177f [CI Skip] release/beta 7.15.2-3
skip-checks: true
2022-04-06 10:54:35 +00:00
Josep M Sobrepere 43ee566669 docs: improve rpc-provider README (#4719) 2022-04-06 13:44:56 +03:00
github-actions[bot] 39299188b0 [CI Skip] release/beta 7.15.2-2
skip-checks: true
2022-04-06 09:15:26 +00:00
Jaco 5d13bfb925 Bump @polkadot/* (#4718)
* Bump @polkadot/*

* Bump @substrate/connect

* Adjust
2022-04-06 12:06:42 +03:00
github-actions[bot] c759ff0c12 [CI Skip] release/beta 7.15.2-1
skip-checks: true
2022-04-05 12:29:28 +00:00
Jaco 0cc34dff85 Polkadot 9180 block (#4717) 2022-04-05 15:20:36 +03:00
github-actions[bot] 1682a8f096 [CI Skip] release/beta 7.15.2-0
skip-checks: true
2022-04-05 06:22:59 +00:00
Jaco be572aabf0 Bump @polkadot/dev (#4715) 2022-04-05 09:14:32 +03:00
github-actions[bot] 7a6d19d241 [CI Skip] release/stable 7.15.1
skip-checks: true
2022-04-03 06:07:54 +00:00
Jaco f4a590d7f8 7.15.1 (#4714) 2022-04-03 08:59:31 +03:00
github-actions[bot] 771e5f3bcf [CI Skip] release/beta 7.14.4-9
skip-checks: true
2022-04-02 16:32:54 +00:00
Jaco 1ba427356d Kusama & Westend upgrade blocks (#4713) 2022-04-02 19:24:34 +03:00
github-actions[bot] aad497e9d2 [CI Skip] release/beta 7.14.4-8
skip-checks: true
2022-04-02 10:38:12 +00:00
Jaco 95fc2b2c99 Bump static metadata (#4712) 2022-04-02 13:28:40 +03:00
github-actions[bot] b7b707249b [CI Skip] release/beta 7.14.4-7
skip-checks: true
2022-04-01 08:00:13 +00:00
Jaco ce95e305f3 Bump dev deps (#4711) 2022-04-01 10:50:46 +03:00
github-actions[bot] 4ea793f55e [CI Skip] release/beta 7.14.4-6
skip-checks: true
2022-03-31 13:52:55 +00:00
Jaco bb0b365dfe Lazy crypto init (#4709) 2022-03-31 16:45:09 +03:00
github-actions[bot] 756f817d93 [CI Skip] release/beta 7.14.4-5
skip-checks: true
2022-03-31 07:56:48 +00:00
Jaco df4bda1fc8 Promise cache for metadata from version (improves parallel) (#4708)
* Cache for metadata from version (improves parallel)

* Ordering

* Single waiting placeholder

* Dedupe

* Sprinkle in await

* Tighten up with HexString

* CHANGELOG
2022-03-31 10:46:46 +03:00
github-actions[bot] a98e9543b8 [CI Skip] release/beta 7.14.4-4
skip-checks: true
2022-03-30 15:07:08 +00:00
Jaco 84abaff414 DispatchError.error as [u8; 4] (#4570)
* DispatchError.error as [u8; 4]

* Adjust Error.is

* Adjust

* Adjust

* U8a applies to error only

* CHANGELOG
2022-03-30 17:57:41 +03:00
github-actions[bot] 29d5460cdd [CI Skip] release/beta 7.14.4-3
skip-checks: true
2022-03-30 14:51:41 +00:00
HackFisher e2d0de4f6c Update maxExtrinsic definition (#4703)
Related https://github.com/polkadot-js/api/pull/4702

Sorry thatI shouldn't modify the auto-generated file `types.ts` which was later get reverted by `[CI Skip] release/beta 7.14.4-1`:

https://github.com/polkadot-js/api/commit/6fb6c40c7dd073b7715f9a7fa7628f4b62ab99a8
2022-03-30 17:41:28 +03:00
github-actions[bot] 8e32777efa [CI Skip] release/beta 7.14.4-2
skip-checks: true
2022-03-30 08:26:59 +00:00
Xiliang Chen 39b1de326c implement entriesPaged and keysPages for query at (#4701)
* implement entriesPaged and keysPages for query at

* remove redudent declaration
2022-03-30 11:17:54 +03:00
github-actions[bot] 6fb6c40c7d [CI Skip] release/beta 7.14.4-1
skip-checks: true
2022-03-30 05:02:17 +00:00
HackFisher badb10bdd9 Fix types for maxExtrinsic (#4702)
Ref: https://github.com/paritytech/substrate/blob/41567c30da77a2546a90c1049042ebd7b0b09bc4/frame/system/src/limits.rs#L99-L102
2022-03-30 07:52:05 +03:00
github-actions[bot] 235a7b1aa9 [CI Skip] release/beta 7.14.4-0
skip-checks: true
2022-03-29 04:34:42 +00:00
Josep M Sobrepere b7d65fb506 fix: export substrate-connect WellKnownChain (#4700) 2022-03-29 07:24:57 +03:00
github-actions[bot] 8eb0524fed [CI Skip] release/stable 7.14.3
skip-checks: true
2022-03-28 10:10:02 +00:00
Jaco bab50b2d74 7.14.3 (#4699) 2022-03-28 13:02:22 +03:00
github-actions[bot] bb75b42273 [CI Skip] release/stable 7.14.2
skip-checks: true
2022-03-28 05:23:21 +00:00
Jaco 949e429d04 Don't export ScProvider top-level in @polkadot/rpc-provider (#4694)
* Don't export `ScProvider` top-level in `@polkadot/rpc-provider`

* 7.14.2
2022-03-28 08:12:33 +03:00
github-actions[bot] 0b1c20efd7 [CI Skip] release/stable 7.14.1
skip-checks: true
2022-03-27 08:29:36 +00:00
Jaco 0536998766 Correct release to 7.14.1 (#4691) 2022-03-27 11:19:58 +03:00
Jaco 22651eb4b8 8.14.1 (#4690) 2022-03-27 11:00:19 +03:00
github-actions[bot] 48414bdb34 [CI Skip] release/beta 7.13.2-10
skip-checks: true
2022-03-27 06:34:39 +00:00
Jaco 2ff6a85fb3 Bump TypeScript (#4689) 2022-03-27 09:27:11 +03:00
github-actions[bot] 8be1f337a8 [CI Skip] release/beta 7.13.2-9
skip-checks: true
2022-03-25 16:31:07 +00:00
Jaco 2c7056da25 Bump dev (& update CHANGELOG) (#4687) 2022-03-25 18:20:15 +02:00
github-actions[bot] b53c22d6d3 [CI Skip] release/beta 7.13.2-8
skip-checks: true
2022-03-25 15:56:15 +00:00
Josep M SobrepereandJaco 17f316b7c7 Add smoldot rpc provider (#4672)
* Add smoldot rpc provider

* remove smoldot references and fix lint issues

* fix wrong export

* Update packages/rpc-provider/src/substrate-connect/createScClient.ts

Co-authored-by: Jaco <jacogr@gmail.com>

* Update packages/rpc-provider/src/substrate-connect/createScClient.ts

Co-authored-by: Jaco <jacogr@gmail.com>

* Update packages/rpc-provider/src/substrate-connect/Health.ts

Co-authored-by: Jaco <jacogr@gmail.com>

* fix linting on `createScClient.ts`

* fix linting on `Health.ts`

* use @polkadotjs/utils

* remove @substrate/connect

* add @substrate/connect

* fixt linting issues

* export `ScProvider` class

* fix connecting to dependency

* make ScProvider lazy

* dendency -> sharedSandbox

* use @substrate/connect@0.7.0-alpha.0

* fix bundle.ts export

Co-authored-by: Jaco <jacogr@gmail.com>
2022-03-25 17:46:24 +02:00
github-actions[bot] b44fcc90b2 [CI Skip] release/beta 7.13.2-7
skip-checks: true
2022-03-24 18:19:20 +00:00
Jaco b4e477a8c1 Remove all README links (#4685) 2022-03-24 20:09:16 +02:00
github-actions[bot] 4b921c8a55 [CI Skip] release/beta 7.13.2-6
skip-checks: true
2022-03-24 10:13:45 +00:00
Yaroslav Bolyukin e53231b70a Support BTreeMap/BTreeSet in typegen (#4682) 2022-03-24 12:04:14 +02:00
github-actions[bot] afd1db58ac [CI Skip] release/beta 7.13.2-5
skip-checks: true
2022-03-23 14:18:04 +00:00
Jaco 63ba84a641 Clear connection timeout on disconnect (#4681) 2022-03-23 16:09:25 +02:00
github-actions[bot] 044aecbfc3 [CI Skip] release/beta 7.13.2-4
skip-checks: true
2022-03-23 05:29:10 +00:00
Jaco e573c26df3 Bump dev (#4679) 2022-03-23 07:19:33 +02:00
github-actions[bot] 31e7de31f3 [CI Skip] release/beta 7.13.2-3
skip-checks: true
2022-03-22 14:26:51 +00:00
Jaco 7cd9c16eae Add dev_getBlockStats RPC (#4677)
* Add dev_getBlockStats RPC

* CHANGELOG
2022-03-22 16:18:13 +02:00
github-actions[bot] 2b1a7da446 [CI Skip] release/beta 7.13.2-2
skip-checks: true
2022-03-22 07:49:36 +00:00
Jaco 9399c8d24f Output BitVec toHuman to LSB (limit support) (#4676) 2022-03-22 09:41:17 +02:00
github-actions[bot] 798e5fcc78 [CI Skip] release/beta 7.13.2-1
skip-checks: true
2022-03-22 07:05:38 +00:00
Jaco d8ad237b00 Add total.bytes{Recv, Sent} to provider stats (#4671) 2022-03-22 08:54:42 +02:00
github-actions[bot] 550cb10766 [CI Skip] release/beta 7.13.2-0
skip-checks: true
2022-03-22 06:52:53 +00:00
Jaco a44108c3f3 Exatra BitVec namespaces top-level (#4674) 2022-03-22 08:43:08 +02:00
178 changed files with 19210 additions and 13323 deletions
+6
View File
@@ -48,3 +48,9 @@
6.10.3
7.0.2
7.14.2
7.14.3
8.0.2
8.3.2
8.4.2
+2
View File
@@ -1,5 +1,7 @@
_book/
build/
build-cjs/
build-esm/
build-docs/
coverage/
docs/.vuepress/dist/
+153
View File
@@ -1,5 +1,158 @@
# CHANGELOG
## 8.4.2 May 15, 2022
Changes:
- Expand/fix TS typings for `MortalEra.{birth, death}(...)`
## 8.4.1 May 14, 2022
Changes:
- Added support for typegen over `Range/RangeInclusive` types
- Add explicit support for `Call` typegen (inclusive of non-defaults)
- Deupe `wss://` handling in `polkadot-types-from-{chain, defs}`
- Allow for optional `definitions.ts` in typegen (only use chain)
- Optimize `Compact<*>` decoding in Uint8Array streams
- Use `I*` interfaces for extrinsic payload getters
- Re-add support for historic linked-map queries
- Update to latest Substrate, Kusama & Polkadot static metadata
- Add latest upgrade blocks for Polkadot, Kusama & Westend
## 8.3.2 May 8, 2022
Contributed:
- Bump `@substrate/connect` to 0.7.4 (Thanks to https://github.com/wirednkod)
Changes:
- Adjust `BTreeSet` in typegen top-level generation
## 8.3.1 May 1, 2022
Contributed:
- Fetch metadata via WS for `types-from-defs` (Thanks to https://github.com/alex-nax)
Changes:
- Extract metadata v14 `BTreeSet` types into correct type
- Assert to ensure that `[u8; <size>]` has exact sizes (non-u8a inputs)
- Adjust `tx.paymentInfo` signing process for existing signature
- Add Kusama 9190 upgrade block
- Add Westend 9200 upgrade block
- Update to latest Substrate, Kusama & Polkadot static metadata
## 8.2.1 Apr 24, 2022
Contributed:
- Make WS timeout check configurable (Thanks to https://github.com/isSerge)
Changes:
- Don't fake signature for `paymentInfo` if already signed
- Remove `api.derive.balances.fees` (use direct constants as applicable)
- Add Westend 9190 upgrade block
- Update to latest Substrate, Kusama & Polkadot static metadata
## 8.1.1 Apr 17, 2022
Contributed:
- Adjust typegen for `Vec<{ struct: <type> }>` (Thanks to https://github.com/zannis)
- Adjust typegen __dirname for ESM (Thanks to https://github.com/drewstone)
Changes:
- Fix `entriesPaged` where no `at?: BlockHash` is specified
- Apply windcard matches for `democracy::vote::Vote` and `identity::type::Data`
- Adjust default "no RPC response" timeout to 60s
- Update to latest Substrate, Kusama & Polkadot static metadata
## 8.0.2 Apr 11, 2022
Changes:
- Detect typegen template location for commonjs execution
## 8.0.1 Apr 10, 2022
- **Breaking change** In this major version the commonjs outputs are moved to a sub-folder. Since the export map and main field in package.json does reflect this change, there should be no usage changes. However the packages here will all need to be on the same version for internal linkage.
Contributed:
- Improve `rpc-provider` README (Thanks to https://github.com/josepot)
- Add handling for `Vec<[<Type>;<length>]>` in typegen (Thanks to https://github.com/zannis)
Changes:
- Add support for `apiAt.tx(...)` to construct at a specific point
- Add basic `api.derive.bagsList.*` support
- Return sorted names for `api.registry.lookup.names`
- Optimize JSONRPC requests/response handling
- Output commonjs files under the `cjs/**` root
- Update to latest Substrate, Kusama & Polkadot static metadata
- Add latest Polkadot 9180 upgrade block
- Update to `@polkadot/util` 9.0.1
## 7.15.1 Apr 3, 2022
Contributed:
- Export `WellKnownChain` for `substrate-connect` (Thanks to https://github.com/josepot)
- Add support for `{entries, keys}Paged` in `.at` (Thanks to https://github.com/xlc)
- Align `WeightsPerClass` interface on `maxExtrinsic` (Thanks to https://github.com/HackFisher)
Changes:
- Cater for `DispatchError` with `error` as `[u8; 4]`
- Add in-flight cache for parallel same-version metadata queries
- Cater for lazy `@polkadot/util-crypto` init (adjustment for React Native)
- Update to latest Substrate, Kusama & Polkadot static metadata
- Update latest Westend & Kusama (up to 9180) upgrade blocks
## 7.14.3 Mar 28, 2022
Changes:
- Ensure `BitVec` with MSB does not fail (used in Polkadot `DeliveredMessages`)
## 7.14.2 Mar 28, 2022
Changes:
- Don't export `ScProvider` top-level in `@polkadot/rpc-provider`
## 7.14.1 Mar 27, 2022
Contributed:
- Add `ScProvider` for `@substrate/substrate-connect` (Thanks to https://github.com/josepot)
- Add support for `BTree{Map, Set}` in typegen (Thanks to https://github.com/CertainLach)
Changes:
- Only explicitly support LSB on `BitVec` types
- Change `toHuman()` on `BitVec` to output default LSB
- Add `bytes{Sent, Recv}` to provider stats
- Clear connection timout on provider `disconnect()`
- Add support for `dev_getBlockStats` RPC
## 7.13.1 Mar 19, 2022
**Important** This contains an upgraded version of `@polkadot/wasm-crypto`. For users of asm.js, e.g. React Native, there are some additional upgrade instructions in the release notes for this version https://github.com/polkadot-js/wasm/releases/tag/v5.0.1
+9 -4
View File
@@ -1,44 +1,47 @@
2873 Jaco 7.13.1 (#4670)
2958 Jaco 8.4.2 (#4828)
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
37 Keith Ingram Update contract types and rpc (#4541)
35 Stefanie Doll Updated child storage parameters (#1709)
20 Luke Schoen fix: Fixes TypeError: Cannot read property 'vesting' of undefined (#1970)
16 Xiliang Chen implement entriesPaged and keysPages for query at (#4701)
15 Jeremías Díaz feat(types): add correct tuple type to storage key (#3054)
15 Xiliang Chen add Authority origin (#3645)
11 Ian He HttpProvider support clone() (#3949)
10 Axel Chalon Make Enum/Tuple constructor use value directly if instance (#1954)
5 Chevdor Fix metadata package link (#3458)
5 Jake Naviasky Fixing approvalFlagsToBools. (#1250)
4 Alex D Use derive customAccount and customLocks for balance overrides (#3248)
4 Alex Wang fix issue that creates duplicate providers (#983)
4 Alexander Popiak Add asset id in signing (#4009)
4 Joshy Orndorff spelling; efect -> effect (#2295)
4 Nantian fix bigint type (#3869)
4 Scott Twiname Add support for historical BlockNumber rpc methods (#4574)
4 Thibaut Sardan no subscription for http (#3127)
3 Alex D Use derive customAccount and customLocks for balance overrides (#3248)
3 André Silva add support for ValidationCodeHash (#3640)
3 Antoine Estienne Adapted to display moonbeam author (#3108)
3 Arjan Zijderveld Added `Emergency` to `ElectionPhase` (#3707)
3 Ewa Kowalska Handle no council for bounties proposals (#3062)
3 hamidra add support for n key entries for NMaps (#3886)
3 Hamza Tokuchi more typos (#2532)
3 Josep M Sobrepere docs: improve rpc-provider README (#4719)
3 Julien Eluard Fixed typos about module balances (#1402)
3 KarishmaBothara Backward compatibility thing (#3511)
3 Miguel Hervas Adding RT4 Types (#3007)
3 Nikos Kontakis Bump @substrate/connect in rpc-provider to 0.7.4 (#4796)
3 Shawn Tabrizi Add `isReadyOrError` when connecting to API (#2577)
3 YJ feat: Vote interface as U8a (#1061)
2 Alexander Krupenkin Add [u8; 33] type width for U8aFixed type (#2391)
2 Branan Riley Add proxy type for Centrifuge (#3940)
2 Caio Add `Range` and `RangeInclusive` types (#3791)
2 HackFisher Update maxExtrinsic definition (#4703)
2 Jakub Pánik All heads subscription (#1899)
2 James Lefrère Add `.eq()` usage to docs and fix docs typos (#1405)
2 Keith Yeung Allow keyPrefix to accept an additional argument for double maps (#2230)
2 MOZGIII Follow-up fix after #4665 (#4666)
2 Nikos Kontakis Add auction in shared types (#4085)
2 Paweł Nguyen Fix a minor typo in cookbook blocks docs (#2294)
2 sung wu Update tx.md (#2485)
2 Veliko Abi constructor takes different parameters (#3347)
2 Wei Tang Use /usr/bin/env bash instead of /bin/bash (#2053)
2 Zannis Kalampoukis fix: Typegen handles structs and vectors of structs without erroring (#4743)
2 扩散性百万甜面包 Typo, deocrateMethod -> decorateMethod (#1594)
1 Andreea Eftene Add storage deposit support (#4304)
1 Brad Larson [NEW] Support for custom headers with providers (#2423)
@@ -90,9 +93,11 @@
1 satellitex Add traits replace rules. for invalid cases `::<type>` and `<type>::`. (#885)
1 Satyam Agrawal update as per the 0.97.0-beta.38 release (#1617)
1 Sean Young Solang requires u256 and i256 types (#2752)
1 serge make WS provider timeout configurable (#4758)
1 Sergei Pepyakin INK! -> ink! (#1347)
1 WoeOm adapt Darwinia, Crab Network types (#3498)
1 Xat_MassacrE Fix packages/types/src/codec/utils/encodeTypes.ts encodeSubTypes bug (#1544)
1 Yaroslav Bolyukin Support BTreeMap/BTreeSet in typegen (#4682)
1 yjh fix MetadataVersioned.asV12 (#2983)
1 Yuri fixes #3693 Fix uniques return types (#3694)
1 Zeke Mostov fix: Allow sudo for polkadot indexed proxy enum (#3286)
-14
View File
@@ -14,17 +14,3 @@ If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.m
## tutorials
Looking for tutorials to get started? Look at [examples](https://polkadot.js.org/docs/api/examples/promise/) for guides on how to use the API to make queries and submit transactions.
## overview
The API is split up into a number of internal packages -
- [@polkadot/api](packages/api/) The API library, providing both Promise and RxJS Observable-based interfaces. This is the main user-facing entry point.
- [@polkadot/api-derive](packages/api-derive/) Derived results that are injected into the API, allowing for combinations of various query results (only used internally and exposed on the Api instances via `api.derive.*`)
- [@polkadot/metadata](packages/metadata/) Base extrinsic, storage and constant injectors for injection
- [@polkadot/rpc-core](packages/rpc-core/) Wrapper around all [JSON-RPC methods](https://polkadot.js.org/docs/substrate/rpc) exposed by a Polkadot network client
- [@polkadot/rpc-provider](packages/rpc-provider/) Providers for connecting to nodes, including WebSockets and Http
Type definitions for interfaces as exposed by Polkadot & Substrate clients -
- [@polkadot/types](packages/types/) Codecs for all Polkadot and Substrate primitives
+6 -6
View File
@@ -11,7 +11,7 @@
},
"sideEffects": false,
"type": "commonjs",
"version": "7.13.1",
"version": "8.4.2",
"workspaces": [
"packages/*"
],
@@ -31,15 +31,15 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.17.8",
"@babel/core": "^7.17.10",
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.17.8",
"@polkadot/dev": "^0.65.97",
"@babel/runtime": "^7.17.9",
"@polkadot/dev": "^0.66.23",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^27.4.1",
"@types/jest": "^27.5.1",
"copyfiles": "^2.4.1"
},
"resolutions": {
"typescript": "^4.6.2"
"typescript": "^4.6.4"
}
}
+9 -9
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/api-base": "7.13.1",
"@polkadot/rpc-augment": "7.13.1",
"@polkadot/types": "7.13.1",
"@polkadot/types-augment": "7.13.1",
"@polkadot/types-codec": "7.13.1",
"@polkadot/util": "^8.6.1"
"@babel/runtime": "^7.17.9",
"@polkadot/api-base": "8.4.2",
"@polkadot/rpc-augment": "8.4.2",
"@polkadot/types": "8.4.2",
"@polkadot/types-augment": "8.4.2",
"@polkadot/types-codec": "8.4.2",
"@polkadot/util": "^9.2.1"
},
"devDependencies": {
"@polkadot/types-support": "7.13.1"
"@polkadot/types-support": "8.4.2"
}
}
+44 -29
View File
@@ -135,11 +135,6 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
bounties: {
/**
* Percentage of the curator fee that will be reserved upfront as deposit for bounty
* curator.
**/
bountyCuratorDeposit: Permill & AugmentedConst<ApiType>;
/**
* The amount held on deposit for placing a bounty proposal.
**/
@@ -156,6 +151,21 @@ declare module '@polkadot/api-base/types/consts' {
* Minimum value for a bounty.
**/
bountyValueMinimum: u128 & AugmentedConst<ApiType>;
/**
* Maximum amount of funds that should be placed in a deposit for making a proposal.
**/
curatorDepositMax: Option<u128> & AugmentedConst<ApiType>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
curatorDepositMin: Option<u128> & AugmentedConst<ApiType>;
/**
* The curator deposit is calculated as a percentage of the curator fee.
*
* This deposit has optional upper and lower bounds with `CuratorDepositMax` and
* `CuratorDepositMin`.
**/
curatorDepositMultiplier: Permill & AugmentedConst<ApiType>;
/**
* The amount held on deposit per byte within the tip report reason or bounty description.
**/
@@ -172,17 +182,12 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
childBounties: {
/**
* Percentage of child-bounty value to be reserved as curator deposit
* when curator fee is zero.
**/
childBountyCuratorDepositBase: Permill & AugmentedConst<ApiType>;
/**
* Minimum value for a child-bounty.
**/
childBountyValueMinimum: u128 & AugmentedConst<ApiType>;
/**
* Maximum number of child-bounties that can be added to a parent bounty.
* Maximum number of child bounties that can be added to a parent bounty.
**/
maxActiveChildBountyCount: u32 & AugmentedConst<ApiType>;
/**
@@ -279,6 +284,26 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
electionProviderMultiPhase: {
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" in the Signed phase.
**/
betterSignedThreshold: Perbill & AugmentedConst<ApiType>;
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" in the Unsigned phase.
**/
betterUnsignedThreshold: Perbill & AugmentedConst<ApiType>;
/**
* The maximum number of electable targets to put in the snapshot.
**/
maxElectableTargets: u16 & AugmentedConst<ApiType>;
/**
* The maximum number of electing voters to put in the snapshot. At the moment, snapshots
* are only over a single block, but once multi-block elections are introduced they will
* take place over multiple blocks.
**/
maxElectingVoters: u32 & AugmentedConst<ApiType>;
/**
* Maximum length (bytes) that the mined solution should consume.
*
@@ -316,6 +341,10 @@ declare module '@polkadot/api-base/types/consts' {
* Per-weight deposit for a signed solution.
**/
signedDepositWeight: u128 & AugmentedConst<ApiType>;
/**
* The maximum amount of unchecked solutions to refund the call fee for.
**/
signedMaxRefunds: u32 & AugmentedConst<ApiType>;
/**
* Maximum number of signed submissions that can be queued.
*
@@ -340,24 +369,10 @@ declare module '@polkadot/api-base/types/consts' {
* Base reward for a signed solution
**/
signedRewardBase: u128 & AugmentedConst<ApiType>;
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" (in any phase).
**/
solutionImprovementThreshold: Perbill & AugmentedConst<ApiType>;
/**
* Duration of the unsigned phase.
**/
unsignedPhase: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of voters to put in the snapshot. At the moment, snapshots are only
* over a single block, but once multi-block elections are introduced they will take place
* over multiple blocks.
*
* Also, note the data type: If the voters are represented by a `u32` in `type
* CompactSolution`, the same `u32` is used here to ensure bounds are respected.
**/
voterSnapshotPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
@@ -835,6 +850,10 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
transactionPayment: {
/**
* The polynomial that is applied in order to derive fee from length.
**/
lengthToFee: Vec<FrameSupportWeightsWeightToFeeCoefficient> & AugmentedConst<ApiType>;
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
@@ -859,10 +878,6 @@ declare module '@polkadot/api-base/types/consts' {
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: u128 & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
+8 -12
View File
@@ -93,17 +93,9 @@ declare module '@polkadot/api-base/types/errors' {
};
bagsList: {
/**
* Id not found in list.
* A error in the list interface implementation.
**/
IdNotFound: AugmentedError<ApiType>;
/**
* An Id does not have a greater score than another Id.
**/
NotHeavier: AugmentedError<ApiType>;
/**
* Attempted to place node in front of a node in another bag.
**/
NotInSameBag: AugmentedError<ApiType>;
List: AugmentedError<ApiType>;
/**
* Generic error
**/
@@ -149,7 +141,7 @@ declare module '@polkadot/api-base/types/errors' {
};
bounties: {
/**
* The bounty cannot be closed because it has active child-bounties.
* The bounty cannot be closed because it has active child bounties.
**/
HasActiveChildBounty: AugmentedError<ApiType>;
/**
@@ -208,7 +200,7 @@ declare module '@polkadot/api-base/types/errors' {
**/
ParentBountyNotActive: AugmentedError<ApiType>;
/**
* Number of child-bounties exceeds limit `MaxActiveChildBountyCount`.
* Number of child bounties exceeds limit `MaxActiveChildBountyCount`.
**/
TooManyChildBounties: AugmentedError<ApiType>;
/**
@@ -1802,6 +1794,10 @@ declare module '@polkadot/api-base/types/errors' {
* No proposal or bounty at that index.
**/
InvalidIndex: AugmentedError<ApiType>;
/**
* Proposal has not been approved.
**/
ProposalNotApproved: AugmentedError<ApiType>;
/**
* Too many approvals in the queue.
**/
+17 -1
View File
@@ -6,7 +6,7 @@ import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32,
import type { ITuple } from '@polkadot/types-codec/types';
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, KusamaRuntimeProxyType, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2CandidateReceipt, PolkadotRuntimeParachainsDisputesDisputeLocation, PolkadotRuntimeParachainsDisputesDisputeResult, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError, XcmV1MultiLocation, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, KusamaRuntimeProxyType, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, PalletStakingValidatorPrefs, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2CandidateReceipt, PolkadotRuntimeParachainsDisputesDisputeLocation, PolkadotRuntimeParachainsDisputesDisputeResult, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError, XcmV1MultiLocation, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/events' {
export interface AugmentedEvents<ApiType extends ApiTypes> {
@@ -722,6 +722,10 @@ declare module '@polkadot/api-base/types/events' {
* A proxy was executed correctly, with the given.
**/
ProxyExecuted: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
/**
* A proxy was removed.
**/
ProxyRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, KusamaRuntimeProxyType, u32]>;
/**
* Generic event
**/
@@ -942,6 +946,10 @@ declare module '@polkadot/api-base/types/events' {
* An account has unbonded this amount. \[stash, amount\]
**/
Unbonded: AugmentedEvent<ApiType, [AccountId32, u128]>;
/**
* A validator has set their preferences.
**/
ValidatorPrefsSet: AugmentedEvent<ApiType, [AccountId32, PalletStakingValidatorPrefs]>;
/**
* An account has called `withdraw_unbonded` and removed unbonding chunks worth `Balance`
* from the unlocking queue. \[stash, amount\]
@@ -1160,6 +1168,10 @@ declare module '@polkadot/api-base/types/events' {
* Batch of dispatches completed fully with no error.
**/
BatchCompleted: AugmentedEvent<ApiType, []>;
/**
* Batch of dispatches completed but has errors.
**/
BatchCompletedWithErrors: AugmentedEvent<ApiType, []>;
/**
* Batch of dispatches did not complete fully. Index of first failing dispatch given, as
* well as the error.
@@ -1173,6 +1185,10 @@ declare module '@polkadot/api-base/types/events' {
* A single item within a Batch of dispatches has completed with no error.
**/
ItemCompleted: AugmentedEvent<ApiType, []>;
/**
* A single item within a Batch of dispatches has completed with error.
**/
ItemFailed: AugmentedEvent<ApiType, [SpRuntimeDispatchError]>;
/**
* Generic event
**/
+10 -13
View File
@@ -7,7 +7,7 @@ import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, W
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, KusamaRuntimeSessionKeys, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletMultisigMultisig, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerScheduledV3, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2AssignmentAppPublic, PolkadotPrimitivesV2CandidateCommitments, PolkadotPrimitivesV2CoreOccupied, PolkadotPrimitivesV2DisputeState, PolkadotPrimitivesV2ScrapedOnChainVotes, PolkadotPrimitivesV2SessionInfo, PolkadotPrimitivesV2UpgradeGoAhead, PolkadotPrimitivesV2UpgradeRestriction, PolkadotPrimitivesV2ValidatorAppPublic, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsConfigurationMigrationV1HostConfiguration, PolkadotRuntimeParachainsHrmpHrmpChannel, PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest, PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord, PolkadotRuntimeParachainsInclusionCandidatePendingAvailability, PolkadotRuntimeParachainsInitializerBufferedSessionChange, PolkadotRuntimeParachainsParasParaGenesisArgs, PolkadotRuntimeParachainsParasParaLifecycle, PolkadotRuntimeParachainsParasParaPastCodeMeta, PolkadotRuntimeParachainsParasPvfCheckActiveVoteState, PolkadotRuntimeParachainsSchedulerCoreAssignment, PolkadotRuntimeParachainsSchedulerParathreadClaimQueue, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, KusamaRuntimeSessionKeys, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletMultisigMultisig, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerScheduledV3, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2AssignmentAppPublic, PolkadotPrimitivesV2CandidateCommitments, PolkadotPrimitivesV2CoreOccupied, PolkadotPrimitivesV2DisputeState, PolkadotPrimitivesV2ScrapedOnChainVotes, PolkadotPrimitivesV2SessionInfo, PolkadotPrimitivesV2UpgradeGoAhead, PolkadotPrimitivesV2UpgradeRestriction, PolkadotPrimitivesV2ValidatorAppPublic, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsHrmpHrmpChannel, PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest, PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord, PolkadotRuntimeParachainsInclusionCandidatePendingAvailability, PolkadotRuntimeParachainsInitializerBufferedSessionChange, PolkadotRuntimeParachainsParasParaGenesisArgs, PolkadotRuntimeParachainsParasParaLifecycle, PolkadotRuntimeParachainsParasParaPastCodeMeta, PolkadotRuntimeParachainsParasPvfCheckActiveVoteState, PolkadotRuntimeParachainsSchedulerCoreAssignment, PolkadotRuntimeParachainsSchedulerParathreadClaimQueue, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';
declare module '@polkadot/api-base/types/storage' {
@@ -68,7 +68,7 @@ declare module '@polkadot/api-base/types/storage' {
* This field should always be populated during block processing unless
* secondary plain slots are enabled (which don't contain a VRF output).
*
* It is set in `on_initialize`, before it will contain the value from the last block.
* It is set in `on_finalize`, before it will contain the value from the last block.
**/
authorVrfRandomness: AugmentedQuery<ApiType, () => Observable<Option<U8aFixed>>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -101,7 +101,7 @@ declare module '@polkadot/api-base/types/storage' {
* Temporary value (cleared at block finalization) which is `Some`
* if per-block initialization has already been called for current block.
**/
initialized: AugmentedQuery<ApiType, () => Observable<Option<Option<U8aFixed>>>, []> & QueryableStorageEntry<ApiType, []>;
initialized: AugmentedQuery<ApiType, () => Observable<Option<Option<SpConsensusBabeDigestsPreDigest>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* How late the current block is compared to its parent.
*
@@ -259,7 +259,7 @@ declare module '@polkadot/api-base/types/storage' {
};
childBounties: {
/**
* Child-bounties that have been added.
* Child bounties that have been added.
**/
childBounties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletChildBountiesChildBounty>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
@@ -275,7 +275,7 @@ declare module '@polkadot/api-base/types/storage' {
**/
childrenCuratorFees: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u128>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Number of child-bounties per parent bounty.
* Number of child bounties per parent bounty.
* Map of parent bounty index to number of child bounties.
**/
parentChildBounties: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
@@ -317,12 +317,6 @@ declare module '@polkadot/api-base/types/storage' {
* is meant to be used only as the last resort.
**/
bypassConsistencyCheck: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Pending configuration (if any) for the next session.
*
* DEPRECATED: This is no longer used, and will be removed in the future.
**/
pendingConfig: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PolkadotRuntimeParachainsConfigurationMigrationV1HostConfiguration>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Pending configuration changes.
*
@@ -1680,8 +1674,11 @@ declare module '@polkadot/api-base/types/storage' {
/**
* Events deposited for the current block.
*
* NOTE: This storage item is explicitly unbounded since it is never intended to be read
* from within the runtime.
* NOTE: The item is unbound and should therefore never be read on chain.
* It could otherwise inflate the PoV size of a block.
*
* Events have a large in-memory size. Box the events to not go out-of-memory
* just in case someone still reads them from within the runtime.
**/
events: AugmentedQuery<ApiType, () => Observable<Vec<FrameSystemEventRecord>>, []> & QueryableStorageEntry<ApiType, []>;
/**
+73 -110
View File
@@ -4,7 +4,7 @@
import type { ApiTypes } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportScheduleMaybeHashed, KusamaRuntimeOriginCaller, KusamaRuntimeProxyType, KusamaRuntimeSessionKeys, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU128, PalletStakingPalletConfigOpU32, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletVestingVestingInfo, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2InherentData, PolkadotPrimitivesV2PvfCheckStatement, PolkadotPrimitivesV2ValidatorAppSignature, PolkadotRuntimeCommonClaimsEcdsaSignature, PolkadotRuntimeCommonClaimsStatementKind, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpFinalityGrandpaEquivocationProof, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeHeader, SpRuntimeMultiSignature, SpRuntimeMultiSigner, SpSessionMembershipProof, XcmV1MultiLocation, XcmV2WeightLimit, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
@@ -367,7 +367,7 @@ declare module '@polkadot/api-base/types/submittable' {
* parent bounty to child-bounty account, if parent bounty has enough
* funds, else the call fails.
*
* Upper bound to maximum number of active child-bounties that can be
* Upper bound to maximum number of active child bounties that can be
* added are managed via runtime trait config
* [`Config::MaxActiveChildBountyCount`].
*
@@ -384,7 +384,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The beneficiary will be able to claim the funds after a delay.
*
* The dispatch origin for this call must be the master curator or
* The dispatch origin for this call must be the parent curator or
* curator of this child-bounty.
*
* Parent bounty must be in active state, for this child-bounty call to
@@ -468,12 +468,12 @@ declare module '@polkadot/api-base/types/submittable' {
* the curator of the parent bounty, or any signed origin.
*
* For the origin other than T::RejectOrigin and the child-bounty
* curator, parent-bounty must be in active state, for this call to
* curator, parent bounty must be in active state, for this call to
* work. We allow child-bounty curator and T::RejectOrigin to execute
* this call irrespective of the parent-bounty state.
* this call irrespective of the parent bounty state.
*
* If this function is called by the `RejectOrigin` or the
* parent-bounty curator, we assume that the child-bounty curator is
* parent bounty curator, we assume that the child-bounty curator is
* malicious or inactive. As a result, child-bounty curator deposit is
* slashed.
*
@@ -862,7 +862,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
execute: AugmentedSubmittable<(proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
execute: AugmentedSubmittable<(proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
/**
* Add a new proposal to either be voted on or executed directly.
*
@@ -892,7 +892,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
/**
* Set the collective's membership.
*
@@ -2102,7 +2102,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Plus Call Weight
* # </weight>
**/
asMultiThreshold1: AugmentedSubmittable<(otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Call]>;
asMultiThreshold1: AugmentedSubmittable<(otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Call]>;
/**
* Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously
* for this operation will be unreserved on success.
@@ -2469,7 +2469,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight is a function of the number of proxies the user has (P).
* # </weight>
**/
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<KusamaRuntimeProxyType> | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<KusamaRuntimeProxyType>, Call]>;
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<KusamaRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<KusamaRuntimeProxyType>, Call]>;
/**
* Dispatch the given `call` from an account that the sender is authorized for through
* `add_proxy`.
@@ -2489,7 +2489,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - P: the number of proxies the user has.
* # </weight>
**/
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<KusamaRuntimeProxyType> | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<KusamaRuntimeProxyType>, Call]>;
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<KusamaRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<KusamaRuntimeProxyType>, Call]>;
/**
* Remove the given announcement of a delegate.
*
@@ -2570,13 +2570,8 @@ declare module '@polkadot/api-base/types/submittable' {
* Parameters:
* - `account`: The recovered account you want to make a call on-behalf-of.
* - `call`: The call you want to make with the recovered account.
*
* # <weight>
* - The weight of the `call` + 10,000.
* - One storage lookup to check account is recovered by `who`. O(1)
* # </weight>
**/
asRecovered: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Call]>;
asRecovered: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Call]>;
/**
* Cancel the ability to use `as_recovered` for `account`.
*
@@ -2585,10 +2580,6 @@ declare module '@polkadot/api-base/types/submittable' {
*
* Parameters:
* - `account`: The recovered account you are able to call on-behalf-of.
*
* # <weight>
* - One storage mutation to check account is recovered by `who`. O(1)
* # </weight>
**/
cancelRecovered: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
@@ -2601,17 +2592,6 @@ declare module '@polkadot/api-base/types/submittable' {
* Parameters:
* - `account`: The lost account that you want to claim has been successfully recovered by
* you.
*
* # <weight>
* Key: F (len of friends in config), V (len of vouching friends)
* - One storage read to get the recovery configuration. O(1), Codec O(F)
* - One storage read to get the active recovery process. O(1), Codec O(V)
* - One storage read to get the current block number. O(1)
* - One storage write. O(1), Codec O(V).
* - One event.
*
* Total Complexity: O(F + V)
* # </weight>
**/
claimRecovery: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
@@ -2626,15 +2606,6 @@ declare module '@polkadot/api-base/types/submittable' {
*
* Parameters:
* - `rescuer`: The account trying to rescue this recoverable account.
*
* # <weight>
* Key: V (len of vouching friends)
* - One storage read/remove to get the active recovery process. O(1), Codec O(V)
* - One balance call to repatriate reserved. O(X)
* - One event.
*
* Total Complexity: O(V + X)
* # </weight>
**/
closeRecovery: AugmentedSubmittable<(rescuer: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
@@ -2654,17 +2625,6 @@ declare module '@polkadot/api-base/types/submittable' {
* friends.
* - `delay_period`: The number of blocks after a recovery attempt is initialized that
* needs to pass before the account can be recovered.
*
* # <weight>
* - Key: F (len of friends)
* - One storage read to check that account is not already recoverable. O(1).
* - A check that the friends list is sorted and unique. O(F)
* - One currency reserve operation. O(X)
* - One storage write. O(1). Codec O(F).
* - One event.
*
* Total Complexity: O(F + X)
* # </weight>
**/
createRecovery: AugmentedSubmittable<(friends: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], threshold: u16 | AnyNumber | Uint8Array, delayPeriod: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, u16, u32]>;
/**
@@ -2679,17 +2639,6 @@ declare module '@polkadot/api-base/types/submittable' {
* Parameters:
* - `account`: The lost account that you want to recover. This account needs to be
* recoverable (i.e. have a recovery configuration).
*
* # <weight>
* - One storage read to check that account is recoverable. O(F)
* - One storage read to check that this recovery process hasn't already started. O(1)
* - One currency reserve operation. O(X)
* - One storage read to get the current block number. O(1)
* - One storage write. O(1).
* - One event.
*
* Total Complexity: O(F + X)
* # </weight>
**/
initiateRecovery: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
@@ -2704,16 +2653,6 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The dispatch origin for this call must be _Signed_ and must be a
* recoverable account (i.e. has a recovery configuration).
*
* # <weight>
* Key: F (len of friends)
* - One storage read to get the prefix iterator for active recoveries. O(1)
* - One storage read/remove to get the recovery configuration. O(1), Codec O(F)
* - One balance call to unreserved. O(X)
* - One event.
*
* Total Complexity: O(F + X)
* # </weight>
**/
removeRecovery: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
/**
@@ -2725,11 +2664,6 @@ declare module '@polkadot/api-base/types/submittable' {
* Parameters:
* - `lost`: The "lost account" to be recovered.
* - `rescuer`: The "rescuer account" which can call as the lost account.
*
* # <weight>
* - One storage write O(1)
* - One event
* # </weight>
**/
setRecovered: AugmentedSubmittable<(lost: AccountId32 | string | Uint8Array, rescuer: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32]>;
/**
@@ -2745,18 +2679,6 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The combination of these two parameters must point to an active recovery
* process.
*
* # <weight>
* Key: F (len of friends in config), V (len of vouching friends)
* - One storage read to get the recovery configuration. O(1), Codec O(F)
* - One storage read to get the active recovery process. O(1), Codec O(V)
* - One binary search to confirm caller is a friend. O(logF)
* - One binary search to confirm caller has not already vouched. O(logV)
* - One storage write. O(1), Codec O(V).
* - One event.
*
* Total Complexity: O(F + logF + V + logV)
* # </weight>
**/
vouchRecovery: AugmentedSubmittable<(lost: AccountId32 | string | Uint8Array, rescuer: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32]>;
/**
@@ -3529,7 +3451,7 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* (Re-)set the controller of a stash.
*
* Effects will be felt at the beginning of the next era.
* Effects will be felt instantly (as soon as this function is completed successfully).
*
* The dispatch origin for this call must be _Signed_ by the stash, not the controller.
*
@@ -3579,7 +3501,7 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* (Re-)set the payment target for a controller.
*
* Effects will be felt at the beginning of the next era.
* Effects will be felt instantly (as soon as this function is completed successfully).
*
* The dispatch origin for this call must be _Signed_ by the controller, not the stash.
*
@@ -3813,7 +3735,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
execute: AugmentedSubmittable<(proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
execute: AugmentedSubmittable<(proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
/**
* Add a new proposal to either be voted on or executed directly.
*
@@ -3843,7 +3765,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
/**
* Set the collective's membership.
*
@@ -4154,6 +4076,24 @@ declare module '@polkadot/api-base/types/submittable' {
* # </weight>
**/
rejectProposal: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Force a previously approved proposal to be removed from the approval queue.
* The original deposit will no longer be returned.
*
* May only be called from `T::RejectOrigin`.
* - `proposal_id`: The index of a proposal
*
* # <weight>
* - Complexity: O(A) where `A` is the number of approvals
* - Db reads and writes: `Approvals`
* # </weight>
*
* Errors:
* - `ProposalNotApproved`: The `proposal_id` supplied was not found in the approval queue,
* i.e., the proposal has not been approved. This could also mean the proposal does not
* exist altogether, thus there is no way it would have been approved in the first place.
**/
removeApproval: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Generic tx
**/
@@ -4196,7 +4136,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The dispatch origin for this call must be _Signed_.
**/
asDerivative: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Call]>;
asDerivative: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Call]>;
/**
* Send a batch of dispatch calls.
*
@@ -4218,7 +4158,7 @@ declare module '@polkadot/api-base/types/submittable' {
* and the error of the failed call. If all were successful, then the `BatchCompleted`
* event is deposited.
**/
batch: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
batch: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Send a batch of dispatch calls and atomically execute them.
* The whole transaction will rollback and fail if any of the calls failed.
@@ -4235,7 +4175,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Complexity: O(C) where C is the number of calls to be batched.
* # </weight>
**/
batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Dispatches a function call with a provided origin.
*
@@ -4248,7 +4188,24 @@ declare module '@polkadot/api-base/types/submittable' {
* - Weight of derivative `call` execution + T::WeightInfo::dispatch_as().
* # </weight>
**/
dispatchAs: AugmentedSubmittable<(asOrigin: KusamaRuntimeOriginCaller | { system: any } | { Void: any } | { Council: any } | { TechnicalCommittee: any } | { ParachainsOrigin: any } | { XcmPallet: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [KusamaRuntimeOriginCaller, Call]>;
dispatchAs: AugmentedSubmittable<(asOrigin: KusamaRuntimeOriginCaller | { system: any } | { Void: any } | { Council: any } | { TechnicalCommittee: any } | { ParachainsOrigin: any } | { XcmPallet: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [KusamaRuntimeOriginCaller, Call]>;
/**
* Send a batch of dispatch calls.
* Unlike `batch`, it allows errors and won't interrupt.
*
* May be called from any origin.
*
* - `calls`: The calls to be dispatched from the same origin. The number of call must not
* exceed the constant: `batched_calls_limit` (available in constant metadata).
*
* If origin is root then call are dispatch without checking origin filter. (This includes
* bypassing `frame_system::Config::BaseCallFilter`).
*
* # <weight>
* - Complexity: O(C) where C is the number of calls to be batched.
* # </weight>
**/
forceBatch: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Generic tx
**/
@@ -4408,10 +4365,13 @@ declare module '@polkadot/api-base/types/submittable' {
**/
forceXcmVersion: AugmentedSubmittable<(location: XcmV1MultiLocation | { parents?: any; interior?: any } | string | Uint8Array, xcmVersion: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmV1MultiLocation, u32]>;
/**
* Transfer some assets from the local chain to the sovereign account of a destination chain and forward
* a notification XCM.
* Transfer some assets from the local chain to the sovereign account of a destination
* chain and forward a notification XCM.
*
* Fee payment on the destination side is made from the first asset listed in the `assets` vector.
* Fee payment on the destination side is made from the asset in the `assets` vector of
* index `fee_asset_item`, up to enough to pay for `weight_limit` of weight. If more weight
* is needed than `weight_limit`, then the operation will fail and the assets send may be
* at risk.
*
* - `origin`: Must be capable of withdrawing the `assets` and executing XCM.
* - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send
@@ -4428,7 +4388,10 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* Teleport some assets from the local chain to some destination chain.
*
* Fee payment on the destination side is made from the first asset listed in the `assets` vector.
* Fee payment on the destination side is made from the asset in the `assets` vector of
* index `fee_asset_item`, up to enough to pay for `weight_limit` of weight. If more weight
* is needed than `weight_limit`, then the operation will fail and the assets send may be
* at risk.
*
* - `origin`: Must be capable of withdrawing the `assets` and executing XCM.
* - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send
@@ -4443,12 +4406,12 @@ declare module '@polkadot/api-base/types/submittable' {
**/
limitedTeleportAssets: AugmentedSubmittable<(dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, beneficiary: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, assets: XcmVersionedMultiAssets | { V0: any } | { V1: any } | string | Uint8Array, feeAssetItem: u32 | AnyNumber | Uint8Array, weightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation, XcmVersionedMultiLocation, XcmVersionedMultiAssets, u32, XcmV2WeightLimit]>;
/**
* Transfer some assets from the local chain to the sovereign account of a destination chain and forward
* a notification XCM.
* Transfer some assets from the local chain to the sovereign account of a destination
* chain and forward a notification XCM.
*
* Fee payment on the destination side is made from the first asset listed in the `assets` vector and
* fee-weight is calculated locally and thus remote weights are assumed to be equal to
* local weights.
* Fee payment on the destination side is made from the asset in the `assets` vector of
* index `fee_asset_item`. The weight limit for fees is not provided and thus is unlimited,
* with all fees taken as needed from the asset.
*
* - `origin`: Must be capable of withdrawing the `assets` and executing XCM.
* - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send
@@ -4465,9 +4428,9 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* Teleport some assets from the local chain to some destination chain.
*
* Fee payment on the destination side is made from the first asset listed in the `assets` vector and
* fee-weight is calculated locally and thus remote weights are assumed to be equal to
* local weights.
* Fee payment on the destination side is made from the asset in the `assets` vector of
* index `fee_asset_item`. The weight limit for fees is not provided and thus is unlimited,
* with all fees taken as needed from the asset.
*
* - `origin`: Must be capable of withdrawing the `assets` and executing XCM.
* - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.4.2' };
+44 -29
View File
@@ -135,11 +135,6 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
bounties: {
/**
* Percentage of the curator fee that will be reserved upfront as deposit for bounty
* curator.
**/
bountyCuratorDeposit: Permill & AugmentedConst<ApiType>;
/**
* The amount held on deposit for placing a bounty proposal.
**/
@@ -156,6 +151,21 @@ declare module '@polkadot/api-base/types/consts' {
* Minimum value for a bounty.
**/
bountyValueMinimum: u128 & AugmentedConst<ApiType>;
/**
* Maximum amount of funds that should be placed in a deposit for making a proposal.
**/
curatorDepositMax: Option<u128> & AugmentedConst<ApiType>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
curatorDepositMin: Option<u128> & AugmentedConst<ApiType>;
/**
* The curator deposit is calculated as a percentage of the curator fee.
*
* This deposit has optional upper and lower bounds with `CuratorDepositMax` and
* `CuratorDepositMin`.
**/
curatorDepositMultiplier: Permill & AugmentedConst<ApiType>;
/**
* The amount held on deposit per byte within the tip report reason or bounty description.
**/
@@ -172,17 +182,12 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
childBounties: {
/**
* Percentage of child-bounty value to be reserved as curator deposit
* when curator fee is zero.
**/
childBountyCuratorDepositBase: Permill & AugmentedConst<ApiType>;
/**
* Minimum value for a child-bounty.
**/
childBountyValueMinimum: u128 & AugmentedConst<ApiType>;
/**
* Maximum number of child-bounties that can be added to a parent bounty.
* Maximum number of child bounties that can be added to a parent bounty.
**/
maxActiveChildBountyCount: u32 & AugmentedConst<ApiType>;
/**
@@ -279,6 +284,26 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
electionProviderMultiPhase: {
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" in the Signed phase.
**/
betterSignedThreshold: Perbill & AugmentedConst<ApiType>;
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" in the Unsigned phase.
**/
betterUnsignedThreshold: Perbill & AugmentedConst<ApiType>;
/**
* The maximum number of electable targets to put in the snapshot.
**/
maxElectableTargets: u16 & AugmentedConst<ApiType>;
/**
* The maximum number of electing voters to put in the snapshot. At the moment, snapshots
* are only over a single block, but once multi-block elections are introduced they will
* take place over multiple blocks.
**/
maxElectingVoters: u32 & AugmentedConst<ApiType>;
/**
* Maximum length (bytes) that the mined solution should consume.
*
@@ -316,6 +341,10 @@ declare module '@polkadot/api-base/types/consts' {
* Per-weight deposit for a signed solution.
**/
signedDepositWeight: u128 & AugmentedConst<ApiType>;
/**
* The maximum amount of unchecked solutions to refund the call fee for.
**/
signedMaxRefunds: u32 & AugmentedConst<ApiType>;
/**
* Maximum number of signed submissions that can be queued.
*
@@ -340,24 +369,10 @@ declare module '@polkadot/api-base/types/consts' {
* Base reward for a signed solution
**/
signedRewardBase: u128 & AugmentedConst<ApiType>;
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" (in any phase).
**/
solutionImprovementThreshold: Perbill & AugmentedConst<ApiType>;
/**
* Duration of the unsigned phase.
**/
unsignedPhase: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of voters to put in the snapshot. At the moment, snapshots are only
* over a single block, but once multi-block elections are introduced they will take place
* over multiple blocks.
*
* Also, note the data type: If the voters are represented by a `u32` in `type
* CompactSolution`, the same `u32` is used here to ensure bounds are respected.
**/
voterSnapshotPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
@@ -702,6 +717,10 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
transactionPayment: {
/**
* The polynomial that is applied in order to derive fee from length.
**/
lengthToFee: Vec<FrameSupportWeightsWeightToFeeCoefficient> & AugmentedConst<ApiType>;
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
@@ -726,10 +745,6 @@ declare module '@polkadot/api-base/types/consts' {
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: u128 & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
+8 -12
View File
@@ -93,17 +93,9 @@ declare module '@polkadot/api-base/types/errors' {
};
bagsList: {
/**
* Id not found in list.
* A error in the list interface implementation.
**/
IdNotFound: AugmentedError<ApiType>;
/**
* An Id does not have a greater score than another Id.
**/
NotHeavier: AugmentedError<ApiType>;
/**
* Attempted to place node in front of a node in another bag.
**/
NotInSameBag: AugmentedError<ApiType>;
List: AugmentedError<ApiType>;
/**
* Generic error
**/
@@ -149,7 +141,7 @@ declare module '@polkadot/api-base/types/errors' {
};
bounties: {
/**
* The bounty cannot be closed because it has active child-bounties.
* The bounty cannot be closed because it has active child bounties.
**/
HasActiveChildBounty: AugmentedError<ApiType>;
/**
@@ -208,7 +200,7 @@ declare module '@polkadot/api-base/types/errors' {
**/
ParentBountyNotActive: AugmentedError<ApiType>;
/**
* Number of child-bounties exceeds limit `MaxActiveChildBountyCount`.
* Number of child bounties exceeds limit `MaxActiveChildBountyCount`.
**/
TooManyChildBounties: AugmentedError<ApiType>;
/**
@@ -1615,6 +1607,10 @@ declare module '@polkadot/api-base/types/errors' {
* No proposal or bounty at that index.
**/
InvalidIndex: AugmentedError<ApiType>;
/**
* Proposal has not been approved.
**/
ProposalNotApproved: AugmentedError<ApiType>;
/**
* Too many approvals in the queue.
**/
+17 -1
View File
@@ -6,7 +6,7 @@ import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32,
import type { ITuple } from '@polkadot/types-codec/types';
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2CandidateReceipt, PolkadotRuntimeParachainsDisputesDisputeLocation, PolkadotRuntimeParachainsDisputesDisputeResult, PolkadotRuntimeProxyType, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError, XcmV1MultiLocation, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, PalletStakingValidatorPrefs, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2CandidateReceipt, PolkadotRuntimeParachainsDisputesDisputeLocation, PolkadotRuntimeParachainsDisputesDisputeResult, PolkadotRuntimeProxyType, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError, XcmV1MultiLocation, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/events' {
export interface AugmentedEvents<ApiType extends ApiTypes> {
@@ -700,6 +700,10 @@ declare module '@polkadot/api-base/types/events' {
* A proxy was executed correctly, with the given.
**/
ProxyExecuted: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
/**
* A proxy was removed.
**/
ProxyRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, PolkadotRuntimeProxyType, u32]>;
/**
* Generic event
**/
@@ -817,6 +821,10 @@ declare module '@polkadot/api-base/types/events' {
* An account has unbonded this amount. \[stash, amount\]
**/
Unbonded: AugmentedEvent<ApiType, [AccountId32, u128]>;
/**
* A validator has set their preferences.
**/
ValidatorPrefsSet: AugmentedEvent<ApiType, [AccountId32, PalletStakingValidatorPrefs]>;
/**
* An account has called `withdraw_unbonded` and removed unbonding chunks worth `Balance`
* from the unlocking queue. \[stash, amount\]
@@ -1035,6 +1043,10 @@ declare module '@polkadot/api-base/types/events' {
* Batch of dispatches completed fully with no error.
**/
BatchCompleted: AugmentedEvent<ApiType, []>;
/**
* Batch of dispatches completed but has errors.
**/
BatchCompletedWithErrors: AugmentedEvent<ApiType, []>;
/**
* Batch of dispatches did not complete fully. Index of first failing dispatch given, as
* well as the error.
@@ -1048,6 +1060,10 @@ declare module '@polkadot/api-base/types/events' {
* A single item within a Batch of dispatches has completed with no error.
**/
ItemCompleted: AugmentedEvent<ApiType, []>;
/**
* A single item within a Batch of dispatches has completed with error.
**/
ItemFailed: AugmentedEvent<ApiType, [SpRuntimeDispatchError]>;
/**
* Generic event
**/
+10 -13
View File
@@ -7,7 +7,7 @@ import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, W
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletMultisigMultisig, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletSchedulerScheduledV3, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2AssignmentAppPublic, PolkadotPrimitivesV2CandidateCommitments, PolkadotPrimitivesV2CoreOccupied, PolkadotPrimitivesV2DisputeState, PolkadotPrimitivesV2ScrapedOnChainVotes, PolkadotPrimitivesV2SessionInfo, PolkadotPrimitivesV2UpgradeGoAhead, PolkadotPrimitivesV2UpgradeRestriction, PolkadotPrimitivesV2ValidatorAppPublic, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsConfigurationMigrationV1HostConfiguration, PolkadotRuntimeParachainsHrmpHrmpChannel, PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest, PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord, PolkadotRuntimeParachainsInclusionCandidatePendingAvailability, PolkadotRuntimeParachainsInitializerBufferedSessionChange, PolkadotRuntimeParachainsParasParaGenesisArgs, PolkadotRuntimeParachainsParasParaLifecycle, PolkadotRuntimeParachainsParasParaPastCodeMeta, PolkadotRuntimeParachainsParasPvfCheckActiveVoteState, PolkadotRuntimeParachainsSchedulerCoreAssignment, PolkadotRuntimeParachainsSchedulerParathreadClaimQueue, PolkadotRuntimeSessionKeys, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletMultisigMultisig, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletSchedulerScheduledV3, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2AssignmentAppPublic, PolkadotPrimitivesV2CandidateCommitments, PolkadotPrimitivesV2CoreOccupied, PolkadotPrimitivesV2DisputeState, PolkadotPrimitivesV2ScrapedOnChainVotes, PolkadotPrimitivesV2SessionInfo, PolkadotPrimitivesV2UpgradeGoAhead, PolkadotPrimitivesV2UpgradeRestriction, PolkadotPrimitivesV2ValidatorAppPublic, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsHrmpHrmpChannel, PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest, PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord, PolkadotRuntimeParachainsInclusionCandidatePendingAvailability, PolkadotRuntimeParachainsInitializerBufferedSessionChange, PolkadotRuntimeParachainsParasParaGenesisArgs, PolkadotRuntimeParachainsParasParaLifecycle, PolkadotRuntimeParachainsParasParaPastCodeMeta, PolkadotRuntimeParachainsParasPvfCheckActiveVoteState, PolkadotRuntimeParachainsSchedulerCoreAssignment, PolkadotRuntimeParachainsSchedulerParathreadClaimQueue, PolkadotRuntimeSessionKeys, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';
declare module '@polkadot/api-base/types/storage' {
@@ -68,7 +68,7 @@ declare module '@polkadot/api-base/types/storage' {
* This field should always be populated during block processing unless
* secondary plain slots are enabled (which don't contain a VRF output).
*
* It is set in `on_initialize`, before it will contain the value from the last block.
* It is set in `on_finalize`, before it will contain the value from the last block.
**/
authorVrfRandomness: AugmentedQuery<ApiType, () => Observable<Option<U8aFixed>>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -101,7 +101,7 @@ declare module '@polkadot/api-base/types/storage' {
* Temporary value (cleared at block finalization) which is `Some`
* if per-block initialization has already been called for current block.
**/
initialized: AugmentedQuery<ApiType, () => Observable<Option<Option<U8aFixed>>>, []> & QueryableStorageEntry<ApiType, []>;
initialized: AugmentedQuery<ApiType, () => Observable<Option<Option<SpConsensusBabeDigestsPreDigest>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* How late the current block is compared to its parent.
*
@@ -259,7 +259,7 @@ declare module '@polkadot/api-base/types/storage' {
};
childBounties: {
/**
* Child-bounties that have been added.
* Child bounties that have been added.
**/
childBounties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletChildBountiesChildBounty>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
@@ -275,7 +275,7 @@ declare module '@polkadot/api-base/types/storage' {
**/
childrenCuratorFees: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u128>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Number of child-bounties per parent bounty.
* Number of child bounties per parent bounty.
* Map of parent bounty index to number of child bounties.
**/
parentChildBounties: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
@@ -317,12 +317,6 @@ declare module '@polkadot/api-base/types/storage' {
* is meant to be used only as the last resort.
**/
bypassConsistencyCheck: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Pending configuration (if any) for the next session.
*
* DEPRECATED: This is no longer used, and will be removed in the future.
**/
pendingConfig: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PolkadotRuntimeParachainsConfigurationMigrationV1HostConfiguration>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Pending configuration changes.
*
@@ -1560,8 +1554,11 @@ declare module '@polkadot/api-base/types/storage' {
/**
* Events deposited for the current block.
*
* NOTE: This storage item is explicitly unbounded since it is never intended to be read
* from within the runtime.
* NOTE: The item is unbound and should therefore never be read on chain.
* It could otherwise inflate the PoV size of a block.
*
* Events have a large in-memory size. Box the events to not go out-of-memory
* just in case someone still reads them from within the runtime.
**/
events: AugmentedQuery<ApiType, () => Observable<Vec<FrameSystemEventRecord>>, []> & QueryableStorageEntry<ApiType, []>;
/**
+72 -31
View File
@@ -4,7 +4,7 @@
import type { ApiTypes } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportScheduleMaybeHashed, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU128, PalletStakingPalletConfigOpU32, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletVestingVestingInfo, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2InherentData, PolkadotPrimitivesV2PvfCheckStatement, PolkadotPrimitivesV2ValidatorAppSignature, PolkadotRuntimeCommonClaimsEcdsaSignature, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeOriginCaller, PolkadotRuntimeProxyType, PolkadotRuntimeSessionKeys, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpFinalityGrandpaEquivocationProof, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeHeader, SpRuntimeMultiSignature, SpRuntimeMultiSigner, SpSessionMembershipProof, XcmV1MultiLocation, XcmV2WeightLimit, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
@@ -367,7 +367,7 @@ declare module '@polkadot/api-base/types/submittable' {
* parent bounty to child-bounty account, if parent bounty has enough
* funds, else the call fails.
*
* Upper bound to maximum number of active child-bounties that can be
* Upper bound to maximum number of active child bounties that can be
* added are managed via runtime trait config
* [`Config::MaxActiveChildBountyCount`].
*
@@ -384,7 +384,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The beneficiary will be able to claim the funds after a delay.
*
* The dispatch origin for this call must be the master curator or
* The dispatch origin for this call must be the parent curator or
* curator of this child-bounty.
*
* Parent bounty must be in active state, for this child-bounty call to
@@ -468,12 +468,12 @@ declare module '@polkadot/api-base/types/submittable' {
* the curator of the parent bounty, or any signed origin.
*
* For the origin other than T::RejectOrigin and the child-bounty
* curator, parent-bounty must be in active state, for this call to
* curator, parent bounty must be in active state, for this call to
* work. We allow child-bounty curator and T::RejectOrigin to execute
* this call irrespective of the parent-bounty state.
* this call irrespective of the parent bounty state.
*
* If this function is called by the `RejectOrigin` or the
* parent-bounty curator, we assume that the child-bounty curator is
* parent bounty curator, we assume that the child-bounty curator is
* malicious or inactive. As a result, child-bounty curator deposit is
* slashed.
*
@@ -862,7 +862,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
execute: AugmentedSubmittable<(proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
execute: AugmentedSubmittable<(proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
/**
* Add a new proposal to either be voted on or executed directly.
*
@@ -892,7 +892,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
/**
* Set the collective's membership.
*
@@ -2051,7 +2051,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Plus Call Weight
* # </weight>
**/
asMultiThreshold1: AugmentedSubmittable<(otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Call]>;
asMultiThreshold1: AugmentedSubmittable<(otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Call]>;
/**
* Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously
* for this operation will be unreserved on success.
@@ -2418,7 +2418,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight is a function of the number of proxies the user has (P).
* # </weight>
**/
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<PolkadotRuntimeProxyType> | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<PolkadotRuntimeProxyType>, Call]>;
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<PolkadotRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<PolkadotRuntimeProxyType>, Call]>;
/**
* Dispatch the given `call` from an account that the sender is authorized for through
* `add_proxy`.
@@ -2438,7 +2438,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - P: the number of proxies the user has.
* # </weight>
**/
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<PolkadotRuntimeProxyType> | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<PolkadotRuntimeProxyType>, Call]>;
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<PolkadotRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<PolkadotRuntimeProxyType>, Call]>;
/**
* Remove the given announcement of a delegate.
*
@@ -2947,7 +2947,7 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* (Re-)set the controller of a stash.
*
* Effects will be felt at the beginning of the next era.
* Effects will be felt instantly (as soon as this function is completed successfully).
*
* The dispatch origin for this call must be _Signed_ by the stash, not the controller.
*
@@ -2997,7 +2997,7 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* (Re-)set the payment target for a controller.
*
* Effects will be felt at the beginning of the next era.
* Effects will be felt instantly (as soon as this function is completed successfully).
*
* The dispatch origin for this call must be _Signed_ by the controller, not the stash.
*
@@ -3231,7 +3231,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
execute: AugmentedSubmittable<(proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
execute: AugmentedSubmittable<(proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
/**
* Add a new proposal to either be voted on or executed directly.
*
@@ -3261,7 +3261,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
/**
* Set the collective's membership.
*
@@ -3572,6 +3572,24 @@ declare module '@polkadot/api-base/types/submittable' {
* # </weight>
**/
rejectProposal: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Force a previously approved proposal to be removed from the approval queue.
* The original deposit will no longer be returned.
*
* May only be called from `T::RejectOrigin`.
* - `proposal_id`: The index of a proposal
*
* # <weight>
* - Complexity: O(A) where `A` is the number of approvals
* - Db reads and writes: `Approvals`
* # </weight>
*
* Errors:
* - `ProposalNotApproved`: The `proposal_id` supplied was not found in the approval queue,
* i.e., the proposal has not been approved. This could also mean the proposal does not
* exist altogether, thus there is no way it would have been approved in the first place.
**/
removeApproval: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Generic tx
**/
@@ -3614,7 +3632,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The dispatch origin for this call must be _Signed_.
**/
asDerivative: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Call]>;
asDerivative: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Call]>;
/**
* Send a batch of dispatch calls.
*
@@ -3636,7 +3654,7 @@ declare module '@polkadot/api-base/types/submittable' {
* and the error of the failed call. If all were successful, then the `BatchCompleted`
* event is deposited.
**/
batch: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
batch: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Send a batch of dispatch calls and atomically execute them.
* The whole transaction will rollback and fail if any of the calls failed.
@@ -3653,7 +3671,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Complexity: O(C) where C is the number of calls to be batched.
* # </weight>
**/
batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Dispatches a function call with a provided origin.
*
@@ -3666,7 +3684,24 @@ declare module '@polkadot/api-base/types/submittable' {
* - Weight of derivative `call` execution + T::WeightInfo::dispatch_as().
* # </weight>
**/
dispatchAs: AugmentedSubmittable<(asOrigin: PolkadotRuntimeOriginCaller | { system: any } | { Void: any } | { Council: any } | { TechnicalCommittee: any } | { ParachainsOrigin: any } | { XcmPallet: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PolkadotRuntimeOriginCaller, Call]>;
dispatchAs: AugmentedSubmittable<(asOrigin: PolkadotRuntimeOriginCaller | { system: any } | { Void: any } | { Council: any } | { TechnicalCommittee: any } | { ParachainsOrigin: any } | { XcmPallet: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PolkadotRuntimeOriginCaller, Call]>;
/**
* Send a batch of dispatch calls.
* Unlike `batch`, it allows errors and won't interrupt.
*
* May be called from any origin.
*
* - `calls`: The calls to be dispatched from the same origin. The number of call must not
* exceed the constant: `batched_calls_limit` (available in constant metadata).
*
* If origin is root then call are dispatch without checking origin filter. (This includes
* bypassing `frame_system::Config::BaseCallFilter`).
*
* # <weight>
* - Complexity: O(C) where C is the number of calls to be batched.
* # </weight>
**/
forceBatch: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Generic tx
**/
@@ -3826,10 +3861,13 @@ declare module '@polkadot/api-base/types/submittable' {
**/
forceXcmVersion: AugmentedSubmittable<(location: XcmV1MultiLocation | { parents?: any; interior?: any } | string | Uint8Array, xcmVersion: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmV1MultiLocation, u32]>;
/**
* Transfer some assets from the local chain to the sovereign account of a destination chain and forward
* a notification XCM.
* Transfer some assets from the local chain to the sovereign account of a destination
* chain and forward a notification XCM.
*
* Fee payment on the destination side is made from the first asset listed in the `assets` vector.
* Fee payment on the destination side is made from the asset in the `assets` vector of
* index `fee_asset_item`, up to enough to pay for `weight_limit` of weight. If more weight
* is needed than `weight_limit`, then the operation will fail and the assets send may be
* at risk.
*
* - `origin`: Must be capable of withdrawing the `assets` and executing XCM.
* - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send
@@ -3846,7 +3884,10 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* Teleport some assets from the local chain to some destination chain.
*
* Fee payment on the destination side is made from the first asset listed in the `assets` vector.
* Fee payment on the destination side is made from the asset in the `assets` vector of
* index `fee_asset_item`, up to enough to pay for `weight_limit` of weight. If more weight
* is needed than `weight_limit`, then the operation will fail and the assets send may be
* at risk.
*
* - `origin`: Must be capable of withdrawing the `assets` and executing XCM.
* - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send
@@ -3861,12 +3902,12 @@ declare module '@polkadot/api-base/types/submittable' {
**/
limitedTeleportAssets: AugmentedSubmittable<(dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, beneficiary: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, assets: XcmVersionedMultiAssets | { V0: any } | { V1: any } | string | Uint8Array, feeAssetItem: u32 | AnyNumber | Uint8Array, weightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation, XcmVersionedMultiLocation, XcmVersionedMultiAssets, u32, XcmV2WeightLimit]>;
/**
* Transfer some assets from the local chain to the sovereign account of a destination chain and forward
* a notification XCM.
* Transfer some assets from the local chain to the sovereign account of a destination
* chain and forward a notification XCM.
*
* Fee payment on the destination side is made from the first asset listed in the `assets` vector and
* fee-weight is calculated locally and thus remote weights are assumed to be equal to
* local weights.
* Fee payment on the destination side is made from the asset in the `assets` vector of
* index `fee_asset_item`. The weight limit for fees is not provided and thus is unlimited,
* with all fees taken as needed from the asset.
*
* - `origin`: Must be capable of withdrawing the `assets` and executing XCM.
* - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send
@@ -3883,9 +3924,9 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* Teleport some assets from the local chain to some destination chain.
*
* Fee payment on the destination side is made from the first asset listed in the `assets` vector and
* fee-weight is calculated locally and thus remote weights are assumed to be equal to
* local weights.
* Fee payment on the destination side is made from the asset in the `assets` vector of
* index `fee_asset_item`. The weight limit for fees is not provided and thus is unlimited,
* with all fees taken as needed from the asset.
*
* - `origin`: Must be capable of withdrawing the `assets` and executing XCM.
* - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send
+55 -40
View File
@@ -5,7 +5,7 @@ import type { ApiTypes } from '@polkadot/api-base/types';
import type { Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { Codec } from '@polkadot/types-codec/types';
import type { Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, PalletContractsSchedule, PalletStateTrieMigrationMigrationLimits, SpVersionRuntimeVersion } from '@polkadot/types/lookup';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, PalletContractsSchedule, SpVersionRuntimeVersion } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/consts' {
export interface AugmentedConsts<ApiType extends ApiTypes> {
@@ -149,11 +149,6 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
bounties: {
/**
* Percentage of the curator fee that will be reserved upfront as deposit for bounty
* curator.
**/
bountyCuratorDeposit: Permill & AugmentedConst<ApiType>;
/**
* The amount held on deposit for placing a bounty proposal.
**/
@@ -170,6 +165,21 @@ declare module '@polkadot/api-base/types/consts' {
* Minimum value for a bounty.
**/
bountyValueMinimum: u128 & AugmentedConst<ApiType>;
/**
* Maximum amount of funds that should be placed in a deposit for making a proposal.
**/
curatorDepositMax: Option<u128> & AugmentedConst<ApiType>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
curatorDepositMin: Option<u128> & AugmentedConst<ApiType>;
/**
* The curator deposit is calculated as a percentage of the curator fee.
*
* This deposit has optional upper and lower bounds with `CuratorDepositMax` and
* `CuratorDepositMin`.
**/
curatorDepositMultiplier: Permill & AugmentedConst<ApiType>;
/**
* The amount held on deposit per byte within the tip report reason or bounty description.
**/
@@ -186,17 +196,12 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
childBounties: {
/**
* Percentage of child-bounty value to be reserved as curator deposit
* when curator fee is zero.
**/
childBountyCuratorDepositBase: Permill & AugmentedConst<ApiType>;
/**
* Minimum value for a child-bounty.
**/
childBountyValueMinimum: u128 & AugmentedConst<ApiType>;
/**
* Maximum number of child-bounties that can be added to a parent bounty.
* Maximum number of child bounties that can be added to a parent bounty.
**/
maxActiveChildBountyCount: u32 & AugmentedConst<ApiType>;
/**
@@ -340,6 +345,26 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
electionProviderMultiPhase: {
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" in the Signed phase.
**/
betterSignedThreshold: Perbill & AugmentedConst<ApiType>;
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" in the Unsigned phase.
**/
betterUnsignedThreshold: Perbill & AugmentedConst<ApiType>;
/**
* The maximum number of electable targets to put in the snapshot.
**/
maxElectableTargets: u16 & AugmentedConst<ApiType>;
/**
* The maximum number of electing voters to put in the snapshot. At the moment, snapshots
* are only over a single block, but once multi-block elections are introduced they will
* take place over multiple blocks.
**/
maxElectingVoters: u32 & AugmentedConst<ApiType>;
/**
* Maximum length (bytes) that the mined solution should consume.
*
@@ -377,6 +402,10 @@ declare module '@polkadot/api-base/types/consts' {
* Per-weight deposit for a signed solution.
**/
signedDepositWeight: u128 & AugmentedConst<ApiType>;
/**
* The maximum amount of unchecked solutions to refund the call fee for.
**/
signedMaxRefunds: u32 & AugmentedConst<ApiType>;
/**
* Maximum number of signed submissions that can be queued.
*
@@ -401,24 +430,10 @@ declare module '@polkadot/api-base/types/consts' {
* Base reward for a signed solution
**/
signedRewardBase: u128 & AugmentedConst<ApiType>;
/**
* The minimum amount of improvement to the solution score that defines a solution as
* "better" (in any phase).
**/
solutionImprovementThreshold: Perbill & AugmentedConst<ApiType>;
/**
* Duration of the unsigned phase.
**/
unsignedPhase: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of voters to put in the snapshot. At the moment, snapshots are only
* over a single block, but once multi-block elections are introduced they will take place
* over multiple blocks.
*
* Also, note the data type: If the voters are represented by a `u32` in `type
* CompactSolution`, the same `u32` is used here to ensure bounds are respected.
**/
voterSnapshotPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
@@ -624,6 +639,16 @@ declare module '@polkadot/api-base/types/consts' {
**/
[key: string]: Codec;
};
nominationPools: {
/**
* The nomination pool's pallet id.
**/
palletId: FrameSupportPalletId & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
proxy: {
/**
* The base amount of currency needed to reserve for creating an announcement.
@@ -829,16 +854,6 @@ declare module '@polkadot/api-base/types/consts' {
**/
[key: string]: Codec;
};
stateTrieMigration: {
/**
* The maximum limits that the signed migration could use.
**/
signedMigrationMaxLimits: PalletStateTrieMigrationMigrationLimits & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
system: {
/**
* Maximum number of block number to block hash mappings to keep (oldest pruned first).
@@ -915,6 +930,10 @@ declare module '@polkadot/api-base/types/consts' {
[key: string]: Codec;
};
transactionPayment: {
/**
* The polynomial that is applied in order to derive fee from length.
**/
lengthToFee: Vec<FrameSupportWeightsWeightToFeeCoefficient> & AugmentedConst<ApiType>;
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
@@ -939,10 +958,6 @@ declare module '@polkadot/api-base/types/consts' {
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: u128 & AugmentedConst<ApiType>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
+141 -12
View File
@@ -127,17 +127,9 @@ declare module '@polkadot/api-base/types/errors' {
};
bagsList: {
/**
* Id not found in list.
* A error in the list interface implementation.
**/
IdNotFound: AugmentedError<ApiType>;
/**
* An Id does not have a greater score than another Id.
**/
NotHeavier: AugmentedError<ApiType>;
/**
* Attempted to place node in front of a node in another bag.
**/
NotInSameBag: AugmentedError<ApiType>;
List: AugmentedError<ApiType>;
/**
* Generic error
**/
@@ -183,7 +175,7 @@ declare module '@polkadot/api-base/types/errors' {
};
bounties: {
/**
* The bounty cannot be closed because it has active child-bounties.
* The bounty cannot be closed because it has active child bounties.
**/
HasActiveChildBounty: AugmentedError<ApiType>;
/**
@@ -242,7 +234,7 @@ declare module '@polkadot/api-base/types/errors' {
**/
ParentBountyNotActive: AugmentedError<ApiType>;
/**
* Number of child-bounties exceeds limit `MaxActiveChildBountyCount`.
* Number of child bounties exceeds limit `MaxActiveChildBountyCount`.
**/
TooManyChildBounties: AugmentedError<ApiType>;
/**
@@ -1018,6 +1010,117 @@ declare module '@polkadot/api-base/types/errors' {
**/
[key: string]: AugmentedError<ApiType>;
};
nominationPools: {
/**
* An account is already delegating in another pool. An account may only belong to one
* pool at a time.
**/
AccountBelongsToOtherPool: AugmentedError<ApiType>;
/**
* The member is already unbonding in this era.
**/
AlreadyUnbonding: AugmentedError<ApiType>;
/**
* The pools state cannot be changed.
**/
CanNotChangeState: AugmentedError<ApiType>;
/**
* None of the funds can be withdrawn yet because the bonding duration has not passed.
**/
CannotWithdrawAny: AugmentedError<ApiType>;
/**
* Some error occurred that should never happen. This should be reported to the
* maintainers.
**/
DefensiveError: AugmentedError<ApiType>;
/**
* The caller does not have adequate permissions.
**/
DoesNotHavePermission: AugmentedError<ApiType>;
/**
* The member is fully unbonded (and thus cannot access the bonded and reward pool
* anymore to, for example, collect rewards).
**/
FullyUnbonding: AugmentedError<ApiType>;
/**
* The pool has insufficient balance to bond as a nominator.
**/
InsufficientBond: AugmentedError<ApiType>;
/**
* Too many members in the pool or system.
**/
MaxPoolMembers: AugmentedError<ApiType>;
/**
* The system is maxed out on pools.
**/
MaxPools: AugmentedError<ApiType>;
/**
* The member cannot unbond further chunks due to reaching the limit.
**/
MaxUnbondingLimit: AugmentedError<ApiType>;
/**
* Metadata exceeds [`Config::MaxMetadataLen`]
**/
MetadataExceedsMaxLen: AugmentedError<ApiType>;
/**
* The amount does not meet the minimum bond to either join or create a pool.
**/
MinimumBondNotMet: AugmentedError<ApiType>;
/**
* A pool must be in [`PoolState::Destroying`] in order for the depositor to unbond or for
* other members to be permissionlessly unbonded.
**/
NotDestroying: AugmentedError<ApiType>;
/**
* Not enough points. Ty unbonding less.
**/
NotEnoughPointsToUnbond: AugmentedError<ApiType>;
/**
* Either a) the caller cannot make a valid kick or b) the pool is not destroying.
**/
NotKickerOrDestroying: AugmentedError<ApiType>;
/**
* The caller does not have nominating permissions for the pool.
**/
NotNominator: AugmentedError<ApiType>;
/**
* The depositor must be the only member in the bonded pool in order to unbond. And the
* depositor must be the only member in the sub pools in order to withdraw unbonded.
**/
NotOnlyPoolMember: AugmentedError<ApiType>;
/**
* The pool is not open to join
**/
NotOpen: AugmentedError<ApiType>;
/**
* The transaction could not be executed due to overflow risk for the pool.
**/
OverflowRisk: AugmentedError<ApiType>;
/**
* Partial unbonding now allowed permissionlessly.
**/
PartialUnbondNotAllowedPermissionlessly: AugmentedError<ApiType>;
/**
* An account is not a member.
**/
PoolMemberNotFound: AugmentedError<ApiType>;
/**
* A (bonded) pool id does not exist.
**/
PoolNotFound: AugmentedError<ApiType>;
/**
* A reward pool does not exist. In all cases this is a system logic error.
**/
RewardPoolNotFound: AugmentedError<ApiType>;
/**
* A sub pool does not exist.
**/
SubPoolsNotFound: AugmentedError<ApiType>;
/**
* Generic error
**/
[key: string]: AugmentedError<ApiType>;
};
preimage: {
/**
* Preimage has already been noted on-chain.
@@ -1206,6 +1309,20 @@ declare module '@polkadot/api-base/types/errors' {
**/
[key: string]: AugmentedError<ApiType>;
};
remark: {
/**
* Attempted to call `store` outside of block execution.
**/
BadContext: AugmentedError<ApiType>;
/**
* Attempting to store empty data.
**/
Empty: AugmentedError<ApiType>;
/**
* Generic error
**/
[key: string]: AugmentedError<ApiType>;
};
scheduler: {
/**
* Failed to schedule a call
@@ -1451,6 +1568,10 @@ declare module '@polkadot/api-base/types/errors' {
* submitter does not have enough funds.
**/
NotEnoughFunds: AugmentedError<ApiType>;
/**
* Signed migration is not allowed because the maximum limit is not set yet.
**/
SignedMigrationNotAllowed: AugmentedError<ApiType>;
/**
* upper bound of size is exceeded,
**/
@@ -1661,6 +1782,10 @@ declare module '@polkadot/api-base/types/errors' {
* No proposal or bounty at that index.
**/
InvalidIndex: AugmentedError<ApiType>;
/**
* Proposal has not been approved.
**/
ProposalNotApproved: AugmentedError<ApiType>;
/**
* Too many approvals in the queue.
**/
@@ -1687,6 +1812,10 @@ declare module '@polkadot/api-base/types/errors' {
* The asset ID is already taken.
**/
InUse: AugmentedError<ApiType>;
/**
* The asset instance is locked.
**/
Locked: AugmentedError<ApiType>;
/**
* There is no delegate approved.
**/
+67 -1
View File
@@ -5,7 +5,7 @@ import type { ApiTypes } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPostDispatchInfo, NodeRuntimeProxyType, PalletConvictionVotingTally, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletStakingExposure, PalletStateTrieMigrationMigrationCompute, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo } from '@polkadot/types/lookup';
import type { FrameSupportScheduleLookupError, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPostDispatchInfo, NodeRuntimeProxyType, PalletConvictionVotingTally, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletNominationPoolsPoolState, PalletStakingExposure, PalletStakingValidatorPrefs, PalletStateTrieMigrationMigrationCompute, SpFinalityGrandpaAppPublic, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/events' {
export interface AugmentedEvents<ApiType extends ApiTypes> {
@@ -615,6 +615,46 @@ declare module '@polkadot/api-base/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
nominationPools: {
/**
* A member has became bonded in a pool.
**/
Bonded: AugmentedEvent<ApiType, [AccountId32, u32, u128, bool]>;
/**
* A pool has been created.
**/
Created: AugmentedEvent<ApiType, [AccountId32, u32]>;
/**
* A pool has been destroyed.
**/
Destroyed: AugmentedEvent<ApiType, [u32]>;
/**
* A member has been removed from a pool.
*
* The removal can be voluntary (withdrawn all unbonded funds) or involuntary (kicked).
**/
MemberRemoved: AugmentedEvent<ApiType, [u32, AccountId32]>;
/**
* A payout has been made to a member.
**/
PaidOut: AugmentedEvent<ApiType, [AccountId32, u32, u128]>;
/**
* The state of a pool has changed
**/
StateChanged: AugmentedEvent<ApiType, [u32, PalletNominationPoolsPoolState]>;
/**
* A member has unbonded from their pool.
**/
Unbonded: AugmentedEvent<ApiType, [AccountId32, u32, u128]>;
/**
* A member has withdrawn from their pool.
**/
Withdrawn: AugmentedEvent<ApiType, [AccountId32, u32, u128]>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
offences: {
/**
* There is an offence reported of the given `kind` happened at the `session_index` and
@@ -663,6 +703,10 @@ declare module '@polkadot/api-base/types/events' {
* A proxy was executed correctly, with the given.
**/
ProxyExecuted: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
/**
* A proxy was removed.
**/
ProxyRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u32]>;
/**
* Generic event
**/
@@ -750,6 +794,16 @@ declare module '@polkadot/api-base/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
remark: {
/**
* Stored data off chain.
**/
Stored: AugmentedEvent<ApiType, [AccountId32, H256]>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
scheduler: {
/**
* The call for the provided hash was not found so the task has been aborted.
@@ -909,6 +963,10 @@ declare module '@polkadot/api-base/types/events' {
* An account has unbonded this amount. \[stash, amount\]
**/
Unbonded: AugmentedEvent<ApiType, [AccountId32, u128]>;
/**
* A validator has set their preferences.
**/
ValidatorPrefsSet: AugmentedEvent<ApiType, [AccountId32, PalletStakingValidatorPrefs]>;
/**
* An account has called `withdraw_unbonded` and removed unbonding chunks worth `Balance`
* from the unlocking queue. \[stash, amount\]
@@ -1239,6 +1297,10 @@ declare module '@polkadot/api-base/types/events' {
* Batch of dispatches completed fully with no error.
**/
BatchCompleted: AugmentedEvent<ApiType, []>;
/**
* Batch of dispatches completed but has errors.
**/
BatchCompletedWithErrors: AugmentedEvent<ApiType, []>;
/**
* Batch of dispatches did not complete fully. Index of first failing dispatch given, as
* well as the error.
@@ -1252,6 +1314,10 @@ declare module '@polkadot/api-base/types/events' {
* A single item within a Batch of dispatches has completed with no error.
**/
ItemCompleted: AugmentedEvent<ApiType, []>;
/**
* A single item within a Batch of dispatches has completed with error.
**/
ItemFailed: AugmentedEvent<ApiType, [SpRuntimeDispatchError]>;
/**
* Generic event
**/
+96 -7
View File
@@ -6,7 +6,7 @@ import type { Data } from '@polkadot/types';
import type { BTreeMap, Bytes, Null, Option, U8aFixed, Vec, WrapperKeepOpaque, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetAccount, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletConvictionVotingVoteVoting, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletReferendaReferendumInfo, PalletSchedulerScheduledV3, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletStateTrieMigrationMigrationLimits, PalletStateTrieMigrationMigrationTask, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetAccount, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletConvictionVotingVoteVoting, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsPoolMember, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletReferendaReferendumInfo, PalletSchedulerScheduledV3, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletStateTrieMigrationMigrationLimits, PalletStateTrieMigrationMigrationTask, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';
declare module '@polkadot/api-base/types/storage' {
@@ -76,7 +76,7 @@ declare module '@polkadot/api-base/types/storage' {
* This field should always be populated during block processing unless
* secondary plain slots are enabled (which don't contain a VRF output).
*
* It is set in `on_initialize`, before it will contain the value from the last block.
* It is set in `on_finalize`, before it will contain the value from the last block.
**/
authorVrfRandomness: AugmentedQuery<ApiType, () => Observable<Option<U8aFixed>>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -109,7 +109,7 @@ declare module '@polkadot/api-base/types/storage' {
* Temporary value (cleared at block finalization) which is `Some`
* if per-block initialization has already been called for current block.
**/
initialized: AugmentedQuery<ApiType, () => Observable<Option<Option<U8aFixed>>>, []> & QueryableStorageEntry<ApiType, []>;
initialized: AugmentedQuery<ApiType, () => Observable<Option<Option<SpConsensusBabeDigestsPreDigest>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* How late the current block is compared to its parent.
*
@@ -267,7 +267,7 @@ declare module '@polkadot/api-base/types/storage' {
};
childBounties: {
/**
* Child-bounties that have been added.
* Child bounties that have been added.
**/
childBounties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletChildBountiesChildBounty>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
@@ -283,7 +283,7 @@ declare module '@polkadot/api-base/types/storage' {
**/
childrenCuratorFees: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u128>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Number of child-bounties per parent bounty.
* Number of child bounties per parent bounty.
* Map of parent bounty index to number of child bounties.
**/
parentChildBounties: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
@@ -785,6 +785,86 @@ declare module '@polkadot/api-base/types/storage' {
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
nominationPools: {
/**
* Storage for bonded pools.
**/
bondedPools: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsBondedPoolInner>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Counter for the related counted storage map
**/
counterForBondedPools: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Counter for the related counted storage map
**/
counterForMetadata: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Counter for the related counted storage map
**/
counterForPoolMembers: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Counter for the related counted storage map
**/
counterForReversePoolIdLookup: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Counter for the related counted storage map
**/
counterForRewardPools: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Counter for the related counted storage map
**/
counterForSubPoolsStorage: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
lastPoolId: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Maximum number of members that can exist in the system. If `None`, then the count
* members are not bound on a system wide basis.
**/
maxPoolMembers: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Maximum number of members that may belong to pool. If `None`, then the count of
* members is not bound on a per pool basis.
**/
maxPoolMembersPerPool: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Maximum number of nomination pools that can exist. If `None`, then an unbounded number of
* pools can exist.
**/
maxPools: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Metadata for the pool.
**/
metadata: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Bytes>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Minimum bond required to create a pool.
*
* This is the amount that the depositor must put as their initial stake in the pool, as an
* indication of "skin in the game".
**/
minCreateBond: AugmentedQuery<ApiType, () => Observable<u128>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Minimum amount to bond to join a pool.
**/
minJoinBond: AugmentedQuery<ApiType, () => Observable<u128>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Active members.
**/
poolMembers: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<PalletNominationPoolsPoolMember>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
reversePoolIdLookup: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
/**
* Reward pools. This is where there rewards for each pool accumulate. When a members payout
* is claimed, the balance comes out fo the reward pool. Keyed by the bonded pools account.
**/
rewardPools: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsRewardPool>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Groups of unbonding pools. Each group of unbonding pools belongs to a bonded pool,
* hence the name sub-pools. Keyed by the bonded pools account.
**/
subPoolsStorage: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsSubPools>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Generic query
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
offences: {
/**
* A vector of reports of the same kind that happened at the same time slot.
@@ -1282,6 +1362,12 @@ declare module '@polkadot/api-base/types/storage' {
* forward by any of the means provided by this pallet.
**/
migrationProcess: AugmentedQuery<ApiType, () => Observable<PalletStateTrieMigrationMigrationTask>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The maximum limits that the signed migration could use.
*
* If not set, no signed submission is allowed.
**/
signedMigrationMaxLimits: AugmentedQuery<ApiType, () => Observable<Option<PalletStateTrieMigrationMigrationLimits>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Generic query
**/
@@ -1325,8 +1411,11 @@ declare module '@polkadot/api-base/types/storage' {
/**
* Events deposited for the current block.
*
* NOTE: This storage item is explicitly unbounded since it is never intended to be read
* from within the runtime.
* NOTE: The item is unbound and should therefore never be read on chain.
* It could otherwise inflate the PoV size of a block.
*
* Events have a large in-memory size. Box the events to not go out-of-memory
* just in case someone still reads them from within the runtime.
**/
events: AugmentedQuery<ApiType, () => Observable<Vec<FrameSystemEventRecord>>, []> & QueryableStorageEntry<ApiType, []>;
/**
+222 -106
View File
@@ -4,9 +4,9 @@
import type { ApiTypes } from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U8aFixed, Vec, WrapperKeepOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportScheduleDispatchTime, FrameSupportScheduleMaybeHashed, NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletConvictionVotingConviction, PalletConvictionVotingVoteAccountVote, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU128, PalletStakingPalletConfigOpU32, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletStateTrieMigrationMigrationLimits, PalletStateTrieMigrationMigrationTask, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpFinalityGrandpaEquivocationProof, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
import type { FrameSupportScheduleDispatchTime, FrameSupportScheduleMaybeHashed, NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletConvictionVotingConviction, PalletConvictionVotingVoteAccountVote, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletNominationPoolsBondExtra, PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU32, PalletNominationPoolsPoolState, PalletSocietyJudgement, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU128, PalletStakingPalletConfigOpU32, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletStateTrieMigrationMigrationLimits, PalletStateTrieMigrationMigrationTask, PalletStateTrieMigrationProgress, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpFinalityGrandpaEquivocationProof, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
declare module '@polkadot/api-base/types/submittable' {
export interface AugmentedSubmittables<ApiType extends ApiTypes> {
@@ -761,7 +761,7 @@ declare module '@polkadot/api-base/types/submittable' {
* parent bounty to child-bounty account, if parent bounty has enough
* funds, else the call fails.
*
* Upper bound to maximum number of active child-bounties that can be
* Upper bound to maximum number of active child bounties that can be
* added are managed via runtime trait config
* [`Config::MaxActiveChildBountyCount`].
*
@@ -778,7 +778,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The beneficiary will be able to claim the funds after a delay.
*
* The dispatch origin for this call must be the master curator or
* The dispatch origin for this call must be the parent curator or
* curator of this child-bounty.
*
* Parent bounty must be in active state, for this child-bounty call to
@@ -862,12 +862,12 @@ declare module '@polkadot/api-base/types/submittable' {
* the curator of the parent bounty, or any signed origin.
*
* For the origin other than T::RejectOrigin and the child-bounty
* curator, parent-bounty must be in active state, for this call to
* curator, parent bounty must be in active state, for this call to
* work. We allow child-bounty curator and T::RejectOrigin to execute
* this call irrespective of the parent-bounty state.
* this call irrespective of the parent bounty state.
*
* If this function is called by the `RejectOrigin` or the
* parent-bounty curator, we assume that the child-bounty curator is
* parent bounty curator, we assume that the child-bounty curator is
* malicious or inactive. As a result, child-bounty curator deposit is
* slashed.
*
@@ -1175,7 +1175,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
execute: AugmentedSubmittable<(proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
execute: AugmentedSubmittable<(proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
/**
* Add a new proposal to either be voted on or executed directly.
*
@@ -1205,7 +1205,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
/**
* Set the collective's membership.
*
@@ -2271,7 +2271,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* This extrinsic must be called by a signed origin.
**/
buyTicket: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
buyTicket: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
/**
* Set calls in storage which can be used to purchase a lottery ticket.
*
@@ -2280,7 +2280,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* This extrinsic must be called by the Manager origin.
**/
setCalls: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
setCalls: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Start a lottery using the provided configuration.
*
@@ -2411,7 +2411,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Plus Call Weight
* # </weight>
**/
asMultiThreshold1: AugmentedSubmittable<(otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Call]>;
asMultiThreshold1: AugmentedSubmittable<(otherSignatories: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, Call]>;
/**
* Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously
* for this operation will be unreserved on success.
@@ -2446,6 +2446,139 @@ declare module '@polkadot/api-base/types/submittable' {
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
nominationPools: {
/**
* Bond `extra` more funds from `origin` into the pool to which they already belong.
*
* Additional funds can come from either the free balance of the account, of from the
* accumulated rewards, see [`BondExtra`].
**/
bondExtra: AugmentedSubmittable<(extra: PalletNominationPoolsBondExtra | { FreeBalance: any } | { Rewards: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletNominationPoolsBondExtra]>;
/**
* A bonded member can use this to claim their payout based on the rewards that the pool
* has accumulated since their last claimed payout (OR since joining if this is there first
* time claiming rewards). The payout will be transferred to the member's account.
*
* The member will earn rewards pro rata based on the members stake vs the sum of the
* members in the pools stake. Rewards do not "expire".
**/
claimPayout: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
/**
* Create a new delegation pool.
*
* # Arguments
*
* * `amount` - The amount of funds to delegate to the pool. This also acts of a sort of
* deposit since the pools creator cannot fully unbond funds until the pool is being
* destroyed.
* * `index` - A disambiguation index for creating the account. Likely only useful when
* creating multiple pools in the same extrinsic.
* * `root` - The account to set as [`PoolRoles::root`].
* * `nominator` - The account to set as the [`PoolRoles::nominator`].
* * `state_toggler` - The account to set as the [`PoolRoles::state_toggler`].
*
* # Note
*
* In addition to `amount`, the caller will transfer the existential deposit; so the caller
* needs at have at least `amount + existential_deposit` transferrable.
**/
create: AugmentedSubmittable<(amount: Compact<u128> | AnyNumber | Uint8Array, root: AccountId32 | string | Uint8Array, nominator: AccountId32 | string | Uint8Array, stateToggler: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, AccountId32, AccountId32, AccountId32]>;
/**
* Stake funds with a pool. The amount to bond is transferred from the member to the
* pools account and immediately increases the pools bond.
*
* # Note
*
* * An account can only be a member of a single pool.
* * An account cannot join the same pool multiple times.
* * This call will *not* dust the member account, so the member must have at least
* `existential deposit + amount` in their account.
* * Only a pool with [`PoolState::Open`] can be joined
**/
join: AugmentedSubmittable<(amount: Compact<u128> | AnyNumber | Uint8Array, poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, u32]>;
nominate: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, validators: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<AccountId32>]>;
/**
* Call `withdraw_unbonded` for the pools account. This call can be made by any account.
*
* This is useful if their are too many unlocking chunks to call `unbond`, and some
* can be cleared by withdrawing. In the case there are too many unlocking chunks, the user
* would probably see an error like `NoMoreChunks` emitted from the staking system when
* they attempt to unbond.
**/
poolWithdrawUnbonded: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
/**
* Update configurations for the nomination pools. The origin must for this call must be
* Root.
*
* # Arguments
*
* * `min_join_bond` - Set [`MinJoinBond`].
* * `min_create_bond` - Set [`MinCreateBond`].
* * `max_pools` - Set [`MaxPools`].
* * `max_members` - Set [`MaxPoolMembers`].
* * `max_members_per_pool` - Set [`MaxPoolMembersPerPool`].
**/
setConfigs: AugmentedSubmittable<(minJoinBond: PalletNominationPoolsConfigOpU128 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array, minCreateBond: PalletNominationPoolsConfigOpU128 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array, maxPools: PalletNominationPoolsConfigOpU32 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array, maxMembers: PalletNominationPoolsConfigOpU32 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array, maxMembersPerPool: PalletNominationPoolsConfigOpU32 | { Noop: any } | { Set: any } | { Remove: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU32, PalletNominationPoolsConfigOpU32, PalletNominationPoolsConfigOpU32]>;
setMetadata: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, metadata: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Bytes]>;
setState: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, state: PalletNominationPoolsPoolState | 'Open' | 'Blocked' | 'Destroying' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletNominationPoolsPoolState]>;
/**
* Unbond up to `unbonding_points` of the `member_account`'s funds from the pool. It
* implicitly collects the rewards one last time, since not doing so would mean some
* rewards would go forfeited.
*
* Under certain conditions, this call can be dispatched permissionlessly (i.e. by any
* account).
*
* # Conditions for a permissionless dispatch.
*
* * The pool is blocked and the caller is either the root or state-toggler. This is
* refereed to as a kick.
* * The pool is destroying and the member is not the depositor.
* * The pool is destroying, the member is the depositor and no other members are in the
* pool.
*
* ## Conditions for permissioned dispatch (i.e. the caller is also the
* `member_account`):
*
* * The caller is not the depositor.
* * The caller is the depositor, the pool is destroying and no other members are in the
* pool.
*
* # Note
*
* If there are too many unlocking chunks to unbond with the pool account,
* [`Call::pool_withdraw_unbonded`] can be called to try and minimize unlocking chunks. If
* there are too many unlocking chunks, the result of this call will likely be the
* `NoMoreChunks` error from the staking system.
**/
unbond: AugmentedSubmittable<(memberAccount: AccountId32 | string | Uint8Array, unbondingPoints: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Compact<u128>]>;
/**
* Withdraw unbonded funds from `member_account`. If no bonded funds can be unbonded, an
* error is returned.
*
* Under certain conditions, this call can be dispatched permissionlessly (i.e. by any
* account).
*
* # Conditions for a permissionless dispatch
*
* * The pool is in destroy mode and the target is not the depositor.
* * The target is the depositor and they are the only member in the sub pools.
* * The pool is blocked and the caller is either the root or state-toggler.
*
* # Conditions for permissioned dispatch
*
* * The caller is the target and they are not the depositor.
*
* # Note
*
* If the target is the depositor, the pool will be destroyed.
**/
withdrawUnbonded: AugmentedSubmittable<(memberAccount: AccountId32 | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>;
/**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
preimage: {
/**
* Register a preimage on-chain.
@@ -2583,7 +2716,7 @@ declare module '@polkadot/api-base/types/submittable' {
* Weight is a function of the number of proxies the user has (P).
* # </weight>
**/
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<NodeRuntimeProxyType> | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<NodeRuntimeProxyType>, Call]>;
proxy: AugmentedSubmittable<(real: AccountId32 | string | Uint8Array, forceProxyType: Option<NodeRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Option<NodeRuntimeProxyType>, Call]>;
/**
* Dispatch the given `call` from an account that the sender is authorized for through
* `add_proxy`.
@@ -2603,7 +2736,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - P: the number of proxies the user has.
* # </weight>
**/
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<NodeRuntimeProxyType> | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<NodeRuntimeProxyType>, Call]>;
proxyAnnounced: AugmentedSubmittable<(delegate: AccountId32 | string | Uint8Array, real: AccountId32 | string | Uint8Array, forceProxyType: Option<NodeRuntimeProxyType> | null | object | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32, Option<NodeRuntimeProxyType>, Call]>;
/**
* Remove the given announcement of a delegate.
*
@@ -2684,13 +2817,8 @@ declare module '@polkadot/api-base/types/submittable' {
* Parameters:
* - `account`: The recovered account you want to make a call on-behalf-of.
* - `call`: The call you want to make with the recovered account.
*
* # <weight>
* - The weight of the `call` + 10,000.
* - One storage lookup to check account is recovered by `who`. O(1)
* # </weight>
**/
asRecovered: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Call]>;
asRecovered: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, Call]>;
/**
* Cancel the ability to use `as_recovered` for `account`.
*
@@ -2699,10 +2827,6 @@ declare module '@polkadot/api-base/types/submittable' {
*
* Parameters:
* - `account`: The recovered account you are able to call on-behalf-of.
*
* # <weight>
* - One storage mutation to check account is recovered by `who`. O(1)
* # </weight>
**/
cancelRecovered: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
@@ -2715,17 +2839,6 @@ declare module '@polkadot/api-base/types/submittable' {
* Parameters:
* - `account`: The lost account that you want to claim has been successfully recovered by
* you.
*
* # <weight>
* Key: F (len of friends in config), V (len of vouching friends)
* - One storage read to get the recovery configuration. O(1), Codec O(F)
* - One storage read to get the active recovery process. O(1), Codec O(V)
* - One storage read to get the current block number. O(1)
* - One storage write. O(1), Codec O(V).
* - One event.
*
* Total Complexity: O(F + V)
* # </weight>
**/
claimRecovery: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
@@ -2740,15 +2853,6 @@ declare module '@polkadot/api-base/types/submittable' {
*
* Parameters:
* - `rescuer`: The account trying to rescue this recoverable account.
*
* # <weight>
* Key: V (len of vouching friends)
* - One storage read/remove to get the active recovery process. O(1), Codec O(V)
* - One balance call to repatriate reserved. O(X)
* - One event.
*
* Total Complexity: O(V + X)
* # </weight>
**/
closeRecovery: AugmentedSubmittable<(rescuer: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
@@ -2768,17 +2872,6 @@ declare module '@polkadot/api-base/types/submittable' {
* friends.
* - `delay_period`: The number of blocks after a recovery attempt is initialized that
* needs to pass before the account can be recovered.
*
* # <weight>
* - Key: F (len of friends)
* - One storage read to check that account is not already recoverable. O(1).
* - A check that the friends list is sorted and unique. O(F)
* - One currency reserve operation. O(X)
* - One storage write. O(1). Codec O(F).
* - One event.
*
* Total Complexity: O(F + X)
* # </weight>
**/
createRecovery: AugmentedSubmittable<(friends: Vec<AccountId32> | (AccountId32 | string | Uint8Array)[], threshold: u16 | AnyNumber | Uint8Array, delayPeriod: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId32>, u16, u32]>;
/**
@@ -2793,17 +2886,6 @@ declare module '@polkadot/api-base/types/submittable' {
* Parameters:
* - `account`: The lost account that you want to recover. This account needs to be
* recoverable (i.e. have a recovery configuration).
*
* # <weight>
* - One storage read to check that account is recoverable. O(F)
* - One storage read to check that this recovery process hasn't already started. O(1)
* - One currency reserve operation. O(X)
* - One storage read to get the current block number. O(1)
* - One storage write. O(1).
* - One event.
*
* Total Complexity: O(F + X)
* # </weight>
**/
initiateRecovery: AugmentedSubmittable<(account: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32]>;
/**
@@ -2818,16 +2900,6 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The dispatch origin for this call must be _Signed_ and must be a
* recoverable account (i.e. has a recovery configuration).
*
* # <weight>
* Key: F (len of friends)
* - One storage read to get the prefix iterator for active recoveries. O(1)
* - One storage read/remove to get the recovery configuration. O(1), Codec O(F)
* - One balance call to unreserved. O(X)
* - One event.
*
* Total Complexity: O(F + X)
* # </weight>
**/
removeRecovery: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
/**
@@ -2839,11 +2911,6 @@ declare module '@polkadot/api-base/types/submittable' {
* Parameters:
* - `lost`: The "lost account" to be recovered.
* - `rescuer`: The "rescuer account" which can call as the lost account.
*
* # <weight>
* - One storage write O(1)
* - One event
* # </weight>
**/
setRecovered: AugmentedSubmittable<(lost: AccountId32 | string | Uint8Array, rescuer: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32]>;
/**
@@ -2859,18 +2926,6 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The combination of these two parameters must point to an active recovery
* process.
*
* # <weight>
* Key: F (len of friends in config), V (len of vouching friends)
* - One storage read to get the recovery configuration. O(1), Codec O(F)
* - One storage read to get the active recovery process. O(1), Codec O(V)
* - One binary search to confirm caller is a friend. O(logF)
* - One binary search to confirm caller has not already vouched. O(logV)
* - One storage write. O(1), Codec O(V).
* - One event.
*
* Total Complexity: O(F + logF + V + logV)
* # </weight>
**/
vouchRecovery: AugmentedSubmittable<(lost: AccountId32 | string | Uint8Array, rescuer: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, AccountId32]>;
/**
@@ -2954,6 +3009,16 @@ declare module '@polkadot/api-base/types/submittable' {
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
remark: {
/**
* Index and store data off chain.
**/
store: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
scheduler: {
/**
* Cancel an anonymously scheduled task.
@@ -3614,7 +3679,7 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* (Re-)set the controller of a stash.
*
* Effects will be felt at the beginning of the next era.
* Effects will be felt instantly (as soon as this function is completed successfully).
*
* The dispatch origin for this call must be _Signed_ by the stash, not the controller.
*
@@ -3664,7 +3729,7 @@ declare module '@polkadot/api-base/types/submittable' {
/**
* (Re-)set the payment target for a controller.
*
* Effects will be felt at the beginning of the next era.
* Effects will be felt instantly (as soon as this function is completed successfully).
*
* The dispatch origin for this call must be _Signed_ by the controller, not the stash.
*
@@ -3795,6 +3860,18 @@ declare module '@polkadot/api-base/types/submittable' {
* The dispatch origin of this call must be [`Config::ControlOrigin`].
**/
controlAutoMigration: AugmentedSubmittable<(maybeConfig: Option<PalletStateTrieMigrationMigrationLimits> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<PalletStateTrieMigrationMigrationLimits>]>;
/**
* Forcefully set the progress the running migration.
*
* This is only useful in one case: the next key to migrate is too big to be migrated with
* a signed account, in a parachain context, and we simply want to skip it. A reasonable
* example of this would be `:code:`, which is both very expensive to migrate, and commonly
* used, so probably it is already migrated.
*
* In case you mess things up, you can also, in principle, use this to reset the migration
* process.
**/
forceSetProgress: AugmentedSubmittable<(progressTop: PalletStateTrieMigrationProgress | { ToStart: any } | { LastKey: any } | { Complete: any } | string | Uint8Array, progressChild: PalletStateTrieMigrationProgress | { ToStart: any } | { LastKey: any } | { Complete: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletStateTrieMigrationProgress, PalletStateTrieMigrationProgress]>;
/**
* Migrate the list of child keys by iterating each of them one by one.
*
@@ -3811,6 +3888,10 @@ declare module '@polkadot/api-base/types/submittable' {
* should only be used in case any keys are leftover due to a bug.
**/
migrateCustomTop: AugmentedSubmittable<(keys: Vec<Bytes> | (Bytes | string | Uint8Array)[], witnessSize: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<Bytes>, u32]>;
/**
* Set the maximum limit of the signed migration.
**/
setSignedMaxLimits: AugmentedSubmittable<(limits: PalletStateTrieMigrationMigrationLimits | { size_?: any; item?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletStateTrieMigrationMigrationLimits]>;
/**
* Generic tx
**/
@@ -3842,7 +3923,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Weight of derivative `call` execution + 10,000.
* # </weight>
**/
sudo: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
sudo: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
/**
* Authenticates the sudo key and dispatches a function call with `Signed` origin from
* a given account.
@@ -3856,7 +3937,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Weight of derivative `call` execution + 10,000.
* # </weight>
**/
sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Call]>;
sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Call]>;
/**
* Authenticates the sudo key and dispatches a function call with `Root` origin.
* This function does not check the weight of the call, and instead allows the
@@ -3869,7 +3950,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - The weight of this call is defined by the caller.
* # </weight>
**/
sudoUncheckedWeight: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array, weight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, u64]>;
sudoUncheckedWeight: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array, weight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, u64]>;
/**
* Generic tx
**/
@@ -4009,7 +4090,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
execute: AugmentedSubmittable<(proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
execute: AugmentedSubmittable<(proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Compact<u32>]>;
/**
* Add a new proposal to either be voted on or executed directly.
*
@@ -4039,7 +4120,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - 1 event
* # </weight>
**/
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | { callIndex?: any; args?: any } | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
propose: AugmentedSubmittable<(threshold: Compact<u32> | AnyNumber | Uint8Array, proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Call, Compact<u32>]>;
/**
* Set the collective's membership.
*
@@ -4335,7 +4416,7 @@ declare module '@polkadot/api-base/types/submittable' {
**/
renew: AugmentedSubmittable<(block: u32 | AnyNumber | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
/**
* Index and store data on chain. Minimum data size is 1 bytes, maximum is
* Index and store data off chain. Minimum data size is 1 bytes, maximum is
* `MaxTransactionSize`. Data will be removed after `STORAGE_PERIOD` blocks, unless `renew`
* is called. # <weight>
* - n*log(n) of data size, as all data is pushed to an in-memory trie.
@@ -4386,6 +4467,24 @@ declare module '@polkadot/api-base/types/submittable' {
* # </weight>
**/
rejectProposal: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Force a previously approved proposal to be removed from the approval queue.
* The original deposit will no longer be returned.
*
* May only be called from `T::RejectOrigin`.
* - `proposal_id`: The index of a proposal
*
* # <weight>
* - Complexity: O(A) where `A` is the number of approvals
* - Db reads and writes: `Approvals`
* # </weight>
*
* Errors:
* - `ProposalNotApproved`: The `proposal_id` supplied was not found in the approval queue,
* i.e., the proposal has not been approved. This could also mean the proposal does not
* exist altogether, thus there is no way it would have been approved in the first place.
**/
removeApproval: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Generic tx
**/
@@ -4789,7 +4888,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* The dispatch origin for this call must be _Signed_.
**/
asDerivative: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Call]>;
asDerivative: AugmentedSubmittable<(index: u16 | AnyNumber | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u16, Call]>;
/**
* Send a batch of dispatch calls.
*
@@ -4811,7 +4910,7 @@ declare module '@polkadot/api-base/types/submittable' {
* and the error of the failed call. If all were successful, then the `BatchCompleted`
* event is deposited.
**/
batch: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
batch: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Send a batch of dispatch calls and atomically execute them.
* The whole transaction will rollback and fail if any of the calls failed.
@@ -4828,7 +4927,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Complexity: O(C) where C is the number of calls to be batched.
* # </weight>
**/
batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Dispatches a function call with a provided origin.
*
@@ -4841,7 +4940,24 @@ declare module '@polkadot/api-base/types/submittable' {
* - Weight of derivative `call` execution + T::WeightInfo::dispatch_as().
* # </weight>
**/
dispatchAs: AugmentedSubmittable<(asOrigin: NodeRuntimeOriginCaller | { system: any } | { Void: any } | { Council: any } | { TechnicalCommittee: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [NodeRuntimeOriginCaller, Call]>;
dispatchAs: AugmentedSubmittable<(asOrigin: NodeRuntimeOriginCaller | { system: any } | { Void: any } | { Council: any } | { TechnicalCommittee: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [NodeRuntimeOriginCaller, Call]>;
/**
* Send a batch of dispatch calls.
* Unlike `batch`, it allows errors and won't interrupt.
*
* May be called from any origin.
*
* - `calls`: The calls to be dispatched from the same origin. The number of call must not
* exceed the constant: `batched_calls_limit` (available in constant metadata).
*
* If origin is root then call are dispatch without checking origin filter. (This includes
* bypassing `frame_system::Config::BaseCallFilter`).
*
* # <weight>
* - Complexity: O(C) where C is the number of calls to be batched.
* # </weight>
**/
forceBatch: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Generic tx
**/
@@ -4954,7 +5070,7 @@ declare module '@polkadot/api-base/types/submittable' {
};
whitelist: {
dispatchWhitelistedCall: AugmentedSubmittable<(callHash: H256 | string | Uint8Array, callWeightWitness: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256, u64]>;
dispatchWhitelistedCallWithPreimage: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
dispatchWhitelistedCallWithPreimage: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
removeWhitelistedCall: AugmentedSubmittable<(callHash: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256]>;
whitelistCall: AugmentedSubmittable<(callHash: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256]>;
/**
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/rpc-core": "7.13.1",
"@polkadot/types": "7.13.1",
"@polkadot/util": "^8.6.1",
"@babel/runtime": "^7.17.9",
"@polkadot/rpc-core": "8.4.2",
"@polkadot/types": "8.4.2",
"@polkadot/util": "^9.2.1",
"rxjs": "^7.5.5"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.4.2' };
+2 -2
View File
@@ -74,12 +74,10 @@ export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunctio
* @deprecated Use api.at(<blockHash>)
*/
entriesAt: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entriesPaged: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
/**
* @deprecated Use api.at(<blockHash>)
*/
keysAt: <K extends AnyTuple = A> (hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
keysPaged: <K extends AnyTuple = A> (opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
/**
* @deprecated The underlying RPC this been marked unsafe and is generally not exposed
*/
@@ -95,11 +93,13 @@ export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunctio
export interface StorageEntryBaseAt<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> {
entries: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entriesPaged: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
key: (...args: Parameters<F>) => string;
keyPrefix: (...args: DropLast<Parameters<F>>) => string;
keys: <K extends AnyTuple = A> (...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
keysPaged: <K extends AnyTuple = A> (opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
}
-13
View File
@@ -1,16 +1,3 @@
# @polkadot/api-contract
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 wsProvider = new WsProvider(<...Node Url...>);
const api = await ApiPromise.create({ provider: wsProvider });
const abi = new Abi(<...JSON ABI...>, api.registry.getChainProperties());
api.tx.contracts
.call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
.signAndSend(<keyring pair>, (result: SubmittableResult) => { ... });
```
+10 -10
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/api": "7.13.1",
"@polkadot/types": "7.13.1",
"@polkadot/types-codec": "7.13.1",
"@polkadot/types-create": "7.13.1",
"@polkadot/util": "^8.6.1",
"@polkadot/util-crypto": "^8.6.1",
"@babel/runtime": "^7.17.9",
"@polkadot/api": "8.4.2",
"@polkadot/types": "8.4.2",
"@polkadot/types-codec": "8.4.2",
"@polkadot/types-create": "8.4.2",
"@polkadot/util": "^9.2.1",
"@polkadot/util-crypto": "^9.2.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api-augment": "7.13.1",
"@polkadot/keyring": "^8.6.1"
"@polkadot/api-augment": "8.4.2",
"@polkadot/keyring": "^9.2.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.4.2' };
+15 -15
View File
@@ -20,25 +20,25 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/api": "7.13.1",
"@polkadot/api-augment": "7.13.1",
"@polkadot/api-base": "7.13.1",
"@polkadot/rpc-core": "7.13.1",
"@polkadot/types": "7.13.1",
"@polkadot/types-codec": "7.13.1",
"@polkadot/util": "^8.6.1",
"@polkadot/util-crypto": "^8.6.1",
"@babel/runtime": "^7.17.9",
"@polkadot/api": "8.4.2",
"@polkadot/api-augment": "8.4.2",
"@polkadot/api-base": "8.4.2",
"@polkadot/rpc-core": "8.4.2",
"@polkadot/types": "8.4.2",
"@polkadot/types-codec": "8.4.2",
"@polkadot/util": "^9.2.1",
"@polkadot/util-crypto": "^9.2.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api": "7.13.1",
"@polkadot/api-augment": "7.13.1",
"@polkadot/rpc-augment": "7.13.1",
"@polkadot/rpc-provider": "7.13.1",
"@polkadot/types-support": "7.13.1"
"@polkadot/api": "8.4.2",
"@polkadot/api-augment": "8.4.2",
"@polkadot/rpc-augment": "8.4.2",
"@polkadot/rpc-provider": "8.4.2",
"@polkadot/types-support": "8.4.2"
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ function retrieveNick (api: DeriveApi, accountId?: AccountId): Observable<string
) 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())
? u8aToString(nameOf.unwrap()[0]).substring(0, (api.consts.nicks.maxLength as u32).toNumber())
: undefined
)
);
+72
View File
@@ -0,0 +1,72 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types';
import type { PalletBagsListListBag } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { Bag } from './types';
import { map, of, switchMap } from 'rxjs';
import { BN_ZERO, bnToBn } from '@polkadot/util';
import { memo } from '../util';
function orderBags (ids: BN[], bags: Option<PalletBagsListListBag>[]): Bag[] {
const sorted = ids
.map((id, index) => ({
bag: bags[index].unwrapOr(null),
id,
key: id.toString()
}))
.sort((a, b) => b.id.cmp(a.id))
.map((base, index): Bag => ({
...base,
bagLower: BN_ZERO,
bagUpper: base.id,
index
}));
const max = sorted.length - 1;
return sorted.map((entry, index) =>
index === max
? entry
// We could probably use a .add(BN_ONE) here
: { ...entry, bagLower: sorted[index + 1].bagUpper }
);
}
export function _getIds (instanceId: string, api: DeriveApi): (ids: (BN | number)[]) => Observable<Bag[]> {
return memo(instanceId, (_ids: (BN | number)[]): Observable<Bag[]> => {
const ids = _ids.map((id) => bnToBn(id));
return ids.length
? api.query.listBags.multi<Option<PalletBagsListListBag>[]>(ids).pipe(
map((bags) => orderBags(ids, bags))
)
: of([]);
});
}
export function all (instanceId: string, api: DeriveApi): () => Observable<Bag[]> {
return memo(instanceId, (): Observable<Bag[]> =>
api.query.bagsList.listBags.keys().pipe(
switchMap((keys) =>
api.derive.bagsList._getIds(keys.map(({ args: [id] }) => id))
),
map((list) =>
list.filter(({ bag }) => bag)
)
)
);
}
export function get (instanceId: string, api: DeriveApi): (id: BN | number) => Observable<Bag> {
return memo(instanceId, (id: BN | number): Observable<Bag> =>
api.derive.bagsList._getIds([bnToBn(id)]).pipe(
map((bags) => bags[0])
)
);
}
@@ -0,0 +1,29 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { Bag, BagExpanded } from './types';
import { map, switchMap } from 'rxjs';
import { memo } from '../util';
export function expand (instanceId: string, api: DeriveApi): (bag: Bag) => Observable<BagExpanded> {
return memo(instanceId, (bag: Bag): Observable<BagExpanded> =>
api.derive.bagsList.listNodes(bag.bag).pipe(
map((nodes) => ({ ...bag, nodes }))
)
);
}
export function getExpanded (instanceId: string, api: DeriveApi): (id: BN | number) => Observable<BagExpanded> {
return memo(instanceId, (id: BN | number): Observable<BagExpanded> =>
api.derive.bagsList.get(id).pipe(
switchMap((bag) =>
api.derive.bagsList.expand(bag)
)
)
);
}
@@ -0,0 +1,6 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './get';
export * from './getExpanded';
export * from './listNodes';
@@ -0,0 +1,41 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types';
import type { AccountId32 } from '@polkadot/types/interfaces';
import type { PalletBagsListListBag, PalletBagsListListNode } from '@polkadot/types/lookup';
import type { DeriveApi } from '../types';
import { BehaviorSubject, map, of, switchMap, tap, toArray } from 'rxjs';
import { memo } from '../util';
function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<PalletBagsListListNode[]> {
const subject = new BehaviorSubject<AccountId32 | string>(head);
return subject.pipe(
switchMap((account) =>
api.query.bagsList.listNodes(account)
),
tap((node: Option<PalletBagsListListNode>): void => {
setTimeout((): void => {
node.isSome && (node.value as PalletBagsListListNode).next.isSome
? subject.next(node.unwrap().next.unwrap())
: subject.complete();
}, 0);
}),
toArray(), // toArray since we want to startSubject to be completed
map((all: Option<PalletBagsListListNode>[]) =>
all.map((o) => o.unwrap())
)
);
}
export function listNodes (instanceId: string, api: DeriveApi): (bag: PalletBagsListListBag | null) => Observable<PalletBagsListListNode[]> {
return memo(instanceId, (bag: PalletBagsListListBag | null): Observable<PalletBagsListListNode[]> =>
bag && bag.head.isSome
? traverseLinks(api, bag.head.unwrap())
: of([])
);
}
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletBagsListListBag, PalletBagsListListNode } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
export interface Bag {
bag: PalletBagsListListBag | null;
bagUpper: BN;
bagLower: BN;
id: BN;
index: number;
key: string;
}
export interface BagExpanded extends Bag {
nodes: PalletBagsListListNode[];
}
-45
View File
@@ -1,45 +0,0 @@
// Copyright 2017-2022 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Balance } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveFees } from '../types';
import { map, of } from 'rxjs';
import { memo } from '../util';
/**
* @name fees
* @returns An object containing the combined results of the storage queries for
* all relevant fees as declared in the substrate chain spec.
* @example
* <BR>
*
* ```javascript
* api.derive.balances.fees(({ creationFee, transferFee }) => {
* console.log(`The fee for creating a new account on this chain is ${creationFee} units. The fee required for making a transfer is ${transferFee} units.`);
* });
* ```
*/
export function fees (instanceId: string, api: DeriveApi): () => Observable<DeriveFees> {
return memo(instanceId, (): Observable<DeriveFees> =>
of([
// deprecated - remove
(api.consts.balances?.creationFee as unknown as Balance) || api.registry.createType('Balance'),
(api.consts.balances?.transferFee as unknown as Balance) || api.registry.createType('Balance'),
// current
(api.consts.balances?.existentialDeposit as Balance) || api.registry.createType('Balance'),
(api.consts.transactionPayment?.transactionBaseFee as unknown as Balance) || api.registry.createType('Balance'),
(api.consts.transactionPayment?.transactionByteFee as Balance) || api.registry.createType('Balance')
]).pipe(
map(([creationFee, transferFee, existentialDeposit, transactionBaseFee, transactionByteFee]): DeriveFees => ({
creationFee,
existentialDeposit,
transactionBaseFee,
transactionByteFee,
transferFee
}))
));
}
@@ -4,7 +4,6 @@
import { all } from './all';
export * from './account';
export * from './fees';
export * from './votingBalances';
const votingBalance = all;
+4
View File
@@ -22,6 +22,10 @@ export { lazyDeriveSection };
// Enable derive only if some of these modules are available
const checks: Record<string, Avail> = {
bagsList: {
instances: ['bagsList'],
methods: []
},
contracts: {
instances: ['contracts'],
methods: []
@@ -60,17 +60,17 @@ function _eventTriggerAll (api: DeriveApi, paraId: string | number | BN): Observ
}
function _getKeysPaged (api: DeriveApi, childKey: string): Observable<StorageKey[]> {
const startSubject = new BehaviorSubject<string | undefined>(undefined);
const subject = new BehaviorSubject<string | undefined>(undefined);
return startSubject.pipe(
return subject.pipe(
switchMap((startKey) =>
api.rpc.childstate.getKeysPaged(childKey, '0x', PAGE_SIZE_K, startKey)
),
tap((keys): void => {
setTimeout((): void => {
keys.length === PAGE_SIZE_K
? startSubject.next(keys[PAGE_SIZE_K - 1].toHex())
: startSubject.complete();
? subject.next(keys[PAGE_SIZE_K - 1].toHex())
: subject.complete();
}, 0);
}),
toArray(), // toArray since we want to startSubject to be completed
+2 -1
View File
@@ -4,6 +4,7 @@
import type { AnyFunction } from '@polkadot/types/types';
import * as accounts from './accounts';
import * as bagsList from './bagsList';
import * as balances from './balances';
import * as bounties from './bounties';
import * as chain from './chain';
@@ -22,7 +23,7 @@ import * as technicalCommittee from './technicalCommittee';
import * as treasury from './treasury';
import * as tx from './tx';
export const derive = { accounts, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
export const derive = { accounts, bagsList, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
type DeriveSection<Section> = {
[M in keyof Section]: Section[M] extends AnyFunction
-1
View File
@@ -47,7 +47,6 @@ describe('derive', (): void => {
testFunction(api)('accounts', 'indexToId', []);
testFunction(api)('balances', 'all', []);
testFunction(api)('balances', 'fees', []);
testFunction(api)('balances', 'votingBalance', []);
testFunction(api)('balances', 'votingBalances', []);
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.4.2' };
+2 -3
View File
@@ -2,10 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { Option, Vec } from '@polkadot/types';
import type { Option } from '@polkadot/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { NodeRuntimeSessionKeys } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi } from '../types';
import type { DeriveStakingKeys } from './types';
@@ -36,7 +35,7 @@ export function keysMulti (instanceId: string, api: DeriveApi): (stashIds: (Uint
return memo(instanceId, (stashIds: (Uint8Array | string)[]): Observable<DeriveStakingKeys[]> =>
stashIds.length
? api.query.session.queuedKeys().pipe(
switchMap((queuedKeys): Observable<[Vec<ITuple<[AccountId, NodeRuntimeSessionKeys]>>, Option<NodeRuntimeSessionKeys>[]]> =>
switchMap((queuedKeys) =>
combineLatest([
of(queuedKeys),
api.consts.session?.dedupKeyPrefix
+4 -4
View File
@@ -23,17 +23,17 @@ const ERA_CHUNK_SIZE = 14;
function chunkEras <T> (eras: EraIndex[], fn: (eras: EraIndex[]) => Observable<T[]>): Observable<T[]> {
const chunked = arrayChunk(eras, ERA_CHUNK_SIZE);
let index = 0;
const startSubject = new BehaviorSubject<EraIndex[]>(chunked[index]);
const subject = new BehaviorSubject<EraIndex[]>(chunked[index]);
return startSubject.pipe(
return subject.pipe(
switchMap(fn),
tap((): void => {
setTimeout((): void => {
index++;
index === chunked.length
? startSubject.complete()
: startSubject.next(chunked[index]);
? subject.complete()
: subject.next(chunked[index]);
}, 0);
}),
toArray(),
+1
View File
@@ -10,6 +10,7 @@ import type { ExactDerive } from './derive';
export * from './accounts/types';
export * from './balances/types';
export * from './bagsList/types';
export * from './council/types';
export * from './crowdloan/types';
export * from './democracy/types';
+18 -18
View File
@@ -20,29 +20,29 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/api-augment": "7.13.1",
"@polkadot/api-base": "7.13.1",
"@polkadot/api-derive": "7.13.1",
"@polkadot/keyring": "^8.6.1",
"@polkadot/rpc-augment": "7.13.1",
"@polkadot/rpc-core": "7.13.1",
"@polkadot/rpc-provider": "7.13.1",
"@polkadot/types": "7.13.1",
"@polkadot/types-augment": "7.13.1",
"@polkadot/types-codec": "7.13.1",
"@polkadot/types-create": "7.13.1",
"@polkadot/types-known": "7.13.1",
"@polkadot/util": "^8.6.1",
"@polkadot/util-crypto": "^8.6.1",
"@babel/runtime": "^7.17.9",
"@polkadot/api-augment": "8.4.2",
"@polkadot/api-base": "8.4.2",
"@polkadot/api-derive": "8.4.2",
"@polkadot/keyring": "^9.2.1",
"@polkadot/rpc-augment": "8.4.2",
"@polkadot/rpc-core": "8.4.2",
"@polkadot/rpc-provider": "8.4.2",
"@polkadot/types": "8.4.2",
"@polkadot/types-augment": "8.4.2",
"@polkadot/types-codec": "8.4.2",
"@polkadot/types-create": "8.4.2",
"@polkadot/types-known": "8.4.2",
"@polkadot/util": "^9.2.1",
"@polkadot/util-crypto": "^9.2.1",
"eventemitter3": "^4.0.7",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/api-augment": "7.13.1",
"@polkadot/types-support": "7.13.1"
"@polkadot/api-augment": "8.4.2",
"@polkadot/types-support": "8.4.2"
}
}
+44 -34
View File
@@ -199,18 +199,23 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._rpcCore.provider.hasSubscriptions || !!this._rpcCore.state.queryStorageAt;
}
protected _emptyDecorated (registry: Registry, blockHash?: Uint8Array): ApiDecoration<ApiType> {
return {
consts: {},
errors: {},
events: {},
query: {},
registry,
rx: {
query: {}
},
tx: createSubmittable(this._type, this._rx, this._decorateMethod, registry, blockHash)
} as ApiDecoration<ApiType>;
}
protected _createDecorated (registry: VersionedRegistry<ApiType>, fromEmpty: boolean, decoratedApi: ApiDecoration<ApiType> | null, blockHash?: Uint8Array): FullDecoration<ApiType> {
if (!decoratedApi) {
decoratedApi = {
consts: {},
errors: {},
events: {},
query: {},
registry: registry.registry,
rx: {
query: {}
}
} as ApiDecoration<ApiType>;
decoratedApi = this._emptyDecorated(registry.registry, blockHash);
}
if (fromEmpty || !registry.decoratedMeta) {
@@ -243,16 +248,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
protected _injectMetadata (registry: VersionedRegistry<ApiType>, fromEmpty = false): void {
// clear the decoration, we are redoing it here
if (fromEmpty || !registry.decoratedApi) {
registry.decoratedApi = {
consts: {},
errors: {},
events: {},
query: {},
registry: registry.registry,
rx: {
query: {}
}
} as ApiDecoration<ApiType>;
registry.decoratedApi = this._emptyDecorated(registry.registry);
}
const { decoratedApi, decoratedMeta } = this._createDecorated(registry, fromEmpty, registry.decoratedApi);
@@ -543,7 +539,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
decorated.entriesPaged = decorateMethod(
memo(this.#instanceId, (opts: PaginationOptions): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntriesPaged(creator, opts)));
this._retrieveMapEntriesPaged(creator, undefined, opts)));
decorated.keys = decorateMethod(
memo(this.#instanceId, (...args: unknown[]): Observable<StorageKey[]> =>
@@ -556,7 +552,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
decorated.keysPaged = decorateMethod(
memo(this.#instanceId, (opts: PaginationOptions): Observable<StorageKey[]> =>
this._retrieveMapKeysPaged(creator, opts)));
this._retrieveMapKeysPaged(creator, undefined, opts)));
}
if (this.supportMulti && creator.meta.type.isMap) {
@@ -610,9 +606,17 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
memo(this.#instanceId, (...args: unknown[]): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, blockHash, args)));
decorated.entriesPaged = decorateMethod(
memo(this.#instanceId, (opts: PaginationOptions): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntriesPaged(creator, blockHash, opts)));
decorated.keys = decorateMethod(
memo(this.#instanceId, (...args: unknown[]): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, blockHash, args)));
decorated.keysPaged = decorateMethod(
memo(this.#instanceId, (opts: PaginationOptions): Observable<StorageKey[]> =>
this._retrieveMapKeysPaged(creator, blockHash, opts)));
}
if (this.supportMulti && creator.meta.type.isMap) {
@@ -683,13 +687,13 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
const headKey = iterKey(...args).toHex();
const startSubject = new BehaviorSubject<string>(headKey);
const queryCall = at
const getKeysPaged = at
? (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey, at)
: (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey);
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
return startSubject.pipe(
switchMap(queryCall),
switchMap(getKeysPaged),
map((keys) => keys.map(setMeta)),
tap((keys): void => {
setTimeout((): void => {
@@ -703,26 +707,28 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
);
}
private _retrieveMapKeysPaged ({ iterKey, meta, method, section }: StorageEntry, opts: PaginationOptions): Observable<StorageKey[]> {
private _retrieveMapKeysPaged ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | undefined, opts: PaginationOptions): Observable<StorageKey[]> {
assert(iterKey && meta.type.isMap, 'keys can only be retrieved on maps');
const headKey = iterKey(...opts.args).toHex();
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
const getKeysPaged = at
? (headKey: string) => this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey, at)
: (headKey: string) => this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey);
return this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey).pipe(
return getKeysPaged(iterKey(...opts.args).toHex()).pipe(
map((keys) => keys.map(setMeta))
);
}
private _retrieveMapEntries (entry: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<[StorageKey, Codec][]> {
const query = at
? (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset, at)
: (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset);
const queryStorageAt = at
? (keys: StorageKey[]) => this._rpcCore.state.queryStorageAt(keys, at)
: (keys: StorageKey[]) => this._rpcCore.state.queryStorageAt(keys);
return this._retrieveMapKeys(entry, at, args).pipe(
switchMap((keys) =>
keys.length
? combineLatest(arrayChunk(keys, PAGE_SIZE_V).map(query)).pipe(
? combineLatest(arrayChunk(keys, PAGE_SIZE_V).map(queryStorageAt)).pipe(
map((valsArr) =>
arrayFlatten(valsArr).map((value, index): [StorageKey, Codec] => [keys[index], value])
)
@@ -732,11 +738,15 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
);
}
private _retrieveMapEntriesPaged (entry: StorageEntry, opts: PaginationOptions): Observable<[StorageKey, Codec][]> {
return this._retrieveMapKeysPaged(entry, opts).pipe(
private _retrieveMapEntriesPaged (entry: StorageEntry, at: Hash | Uint8Array | string | undefined, opts: PaginationOptions): Observable<[StorageKey, Codec][]> {
const queryStorageAt = at
? (keys: StorageKey[]) => this._rpcCore.state.queryStorageAt(keys, at)
: (keys: StorageKey[]) => this._rpcCore.state.queryStorageAt(keys);
return this._retrieveMapKeysPaged(entry, at, opts).pipe(
switchMap((keys) =>
keys.length
? this._rpcCore.state.queryStorageAt(keys).pipe(
? queryStorageAt(keys).pipe(
map((valsArr) =>
valsArr.map((value, index): [StorageKey, Codec] => [keys[index], value])
)
+59 -57
View File
@@ -4,7 +4,7 @@
import type { Observable, Subscription } from 'rxjs';
import type { Text } from '@polkadot/types';
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
import type { ChainProperties, Hash, RuntimeVersion, RuntimeVersionPartial } from '@polkadot/types/interfaces';
import type { ChainProperties, Hash, HeaderPartial, RuntimeVersion, RuntimeVersionPartial } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { HexString } from '@polkadot/util/types';
@@ -35,7 +35,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
#updateSub?: Subscription | null = null;
#waitingRegistries: Record<string, Promise<VersionedRegistry<ApiType>>> = {};
#waitingRegistries: Record<HexString, Promise<VersionedRegistry<ApiType>>> = {};
constructor (options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) {
super(options, type, decorateMethod);
@@ -120,6 +120,44 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
return this._createDecorated(registry, true, null, u8aHash).decoratedApi;
}
private async _createBlockRegistry (blockHash: Uint8Array, header: HeaderPartial, version: RuntimeVersionPartial): Promise<VersionedRegistry<ApiType>> {
const registry = new TypeRegistry(blockHash);
const metadata = new Metadata(registry,
await firstValueFrom(this._rpcCore.state.getMetadata.raw<HexString>(header.parentHash))
);
this._initRegistry(registry, this._runtimeChain as Text, version, metadata);
// add our new registry
const result = { lastBlockHash: blockHash, metadata, registry, specName: version.specName, specVersion: version.specVersion };
this.#registries.push(result);
return result;
}
private _cacheBlockRegistryProgress (key: HexString, creator: () => Promise<VersionedRegistry<ApiType>>): Promise<VersionedRegistry<ApiType>> {
// look for waiting resolves
let waiting = this.#waitingRegistries[key];
if (isUndefined(waiting)) {
// nothing waiting, construct new
waiting = this.#waitingRegistries[key] = new Promise<VersionedRegistry<ApiType>>((resolve, reject): void => {
creator()
.then((registry): void => {
delete this.#waitingRegistries[key];
resolve(registry);
})
.catch((error): void => {
delete this.#waitingRegistries[key];
reject(error);
});
});
}
return waiting;
}
private _getBlockRegistryViaVersion (blockHash: Uint8Array, version?: RuntimeVersionPartial): VersionedRegistry<ApiType> | null {
if (version) {
// check for pre-existing registries. We also check specName, e.g. it
@@ -139,7 +177,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
return null;
}
private async _getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
private async _getBlockRegistryViaHash (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
// ensure we have everything required
assert(this._genesisHash && this._runtimeVersion, 'Cannot retrieve data on an uninitialized chain');
@@ -161,62 +199,28 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
: await firstValueFrom(this._rpcCore.state.getRuntimeVersion.raw(header.parentHash))
);
const existingViaVersion = this._getBlockRegistryViaVersion(blockHash, version);
if (existingViaVersion) {
return existingViaVersion;
}
// nothing has been found, construct new
const registry = new TypeRegistry(blockHash);
const metadata = new Metadata(registry,
await firstValueFrom(this._rpcCore.state.getMetadata.raw<HexString>(header.parentHash))
return (
// try to find via version
this._getBlockRegistryViaVersion(blockHash, version) ||
// return new or in-flight result
await this._cacheBlockRegistryProgress(version.toHex(), () => this._createBlockRegistry(blockHash, header, version))
);
this._initRegistry(registry, this._runtimeChain as Text, version, metadata);
// add our new registry
const result = { lastBlockHash: blockHash, metadata, registry, specName: version.specName, specVersion: version.specVersion };
this.#registries.push(result);
return result;
}
/**
* @description Sets up a registry based on the block hash defined
*/
public async getBlockRegistry (blockHash: Uint8Array, knownVersion?: RuntimeVersion): Promise<VersionedRegistry<ApiType>> {
const existingViaHash = this.#registries.find(({ lastBlockHash }) =>
lastBlockHash && u8aEq(lastBlockHash, blockHash)
return (
// try to find via blockHash
this.#registries.find(({ lastBlockHash }) =>
lastBlockHash && u8aEq(lastBlockHash, blockHash)
) ||
// try to find via version
this._getBlockRegistryViaVersion(blockHash, knownVersion) ||
// return new or in-flight result
await this._cacheBlockRegistryProgress(u8aToHex(blockHash), () => this._getBlockRegistryViaHash(blockHash))
);
if (existingViaHash) {
return existingViaHash;
}
const existingViaVersion = this._getBlockRegistryViaVersion(blockHash, knownVersion);
if (existingViaVersion) {
return existingViaVersion;
}
const blockHashHex = u8aToHex(blockHash);
let waiting = this.#waitingRegistries[blockHashHex];
if (isUndefined(waiting)) {
waiting = this._getBlockRegistry(blockHash);
this.#waitingRegistries[blockHashHex] = waiting;
// when we have resolved, remove this from the waiting list
waiting
.then((): void => {
delete this.#waitingRegistries[blockHashHex];
})
.catch(() => undefined);
}
return waiting;
}
protected async _loadMeta (): Promise<boolean> {
@@ -387,12 +391,10 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
this.emit('connected');
try {
const [hasMeta, cryptoReady] = await Promise.all([
this._loadMeta(),
this._options.initWasm === false
? Promise.resolve(true)
: cryptoWaitReady()
]);
const cryptoReady = this._options.initWasm === false
? true
: await cryptoWaitReady();
const hasMeta = await this._loadMeta();
this._subscribeHealth();
+2 -2
View File
@@ -33,9 +33,9 @@ async function derive (api: ApiPromise): Promise<void> {
console.log('current author:', header.author);
});
const fees = await api.derive.balances.fees();
const info = await api.derive.balances.account('0x1234');
console.log('fees', fees);
console.log('info', info);
}
function errors (api: ApiPromise): void {
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.4.2' };
+12 -8
View File
@@ -21,6 +21,7 @@ import { SubmittableResult } from './Result';
interface SubmittableOptions<ApiType extends ApiTypes> {
api: ApiInterfaceRx;
apiType: ApiTypes;
blockHash?: Uint8Array;
decorateMethod: ApiBase<ApiType>['_decorateMethod'];
}
@@ -80,7 +81,7 @@ function optionsOrNonce (partialOptions: Partial<SignerOptions> = {}): Partial<S
: partialOptions;
}
export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorateMethod }: SubmittableOptions<ApiType>): Constructor<SubmittableExtrinsic<ApiType>> {
export function createClass <ApiType extends ApiTypes> ({ api, apiType, blockHash, decorateMethod }: SubmittableOptions<ApiType>): Constructor<SubmittableExtrinsic<ApiType>> {
// an instance of the base extrinsic for us to extend
const ExtrinsicBase = api.registry.createClass('Extrinsic');
@@ -97,10 +98,10 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
// dry run an extrinsic
public dryRun (account: AddressOrPair, optionsOrHash?: Partial<SignerOptions> | Uint8Array | string): SubmittableDryRunResult<ApiType> {
if (isString(optionsOrHash) || isU8a(optionsOrHash)) {
if (blockHash || isString(optionsOrHash) || isU8a(optionsOrHash)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return decorateMethod(
() => api.rpc.system.dryRun(this.toHex(), optionsOrHash)
() => api.rpc.system.dryRun(this.toHex(), blockHash || optionsOrHash as string)
);
}
@@ -115,10 +116,11 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
// calculate the payment info for this transaction (if signed and submitted)
public paymentInfo (account: AddressOrPair, optionsOrHash?: Partial<SignerOptions> | Uint8Array | string): SubmittablePaymentResult<ApiType> {
if (isString(optionsOrHash) || isU8a(optionsOrHash)) {
if (blockHash || isString(optionsOrHash) || isU8a(optionsOrHash)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return decorateMethod(
(): Observable<RuntimeDispatchInfo> => api.rpc.payment.queryInfo(this.toHex(), optionsOrHash)
(): Observable<RuntimeDispatchInfo> =>
api.rpc.payment.queryInfo(this.toHex(), blockHash || optionsOrHash as string)
);
}
@@ -135,9 +137,11 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
const eraOptions = makeEraOptions(api, this.registry, allOptions, signingInfo);
const signOptions = makeSignOptions(api, eraOptions, {});
this.signFake(address, signOptions);
return api.rpc.payment.queryInfo(this.toHex());
return api.rpc.payment.queryInfo(
this.isSigned
? api.tx(this).signFake(address, signOptions).toHex()
: this.signFake(address, signOptions).toHex()
);
})
)
)();
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Call, Extrinsic } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types-codec/types';
import type { ApiInterfaceRx, ApiTypes } from '../types';
import type { SubmittableExtrinsic } from './types';
@@ -10,9 +11,9 @@ import { createClass } from './createClass';
type Creator<ApiType extends ApiTypes> = (extrinsic: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>;
export function createSubmittable<ApiType extends ApiTypes> (apiType: ApiTypes, api: ApiInterfaceRx, decorateMethod: ApiBase<ApiType>['_decorateMethod']): Creator<ApiType> {
const Submittable = createClass<ApiType>({ api, apiType, decorateMethod });
export function createSubmittable<ApiType extends ApiTypes> (apiType: ApiTypes, api: ApiInterfaceRx, decorateMethod: ApiBase<ApiType>['_decorateMethod'], registry?: Registry, blockHash?: Uint8Array): Creator<ApiType> {
const Submittable = createClass<ApiType>({ api, apiType, blockHash, decorateMethod });
return (extrinsic: Call | Extrinsic | Uint8Array | string): SubmittableExtrinsic<ApiType> =>
new Submittable(api.registry, extrinsic);
new Submittable(registry || api.registry, extrinsic);
}
+4 -2
View File
@@ -9,11 +9,12 @@ import type { DecoratedEvents } from '@polkadot/api-base/types/events';
import type { QueryableStorage } from '@polkadot/api-base/types/storage';
import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { Call, Extrinsic, Hash } from '@polkadot/types/interfaces';
import type { CallFunction, DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, RegistryError, SignatureOptions, Signer } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { HexString } from '@polkadot/util/types';
import type { ApiBase } from '../base';
import type { SubmittableExtrinsic } from '../types/submittable';
import type { AllDerives } from '../util/decorate';
export * from '@polkadot/api-base/types';
@@ -96,7 +97,8 @@ export interface ApiDecoration<ApiType extends ApiTypes> {
registry: Registry;
rx: {
query: QueryableStorage<'rxjs'>;
}
};
tx: (extrinsic: Call | Extrinsic | Uint8Array | string) => SubmittableExtrinsic<ApiType>;
findCall (callIndex: Uint8Array | string): CallFunction;
findError (errorIndex: Uint8Array | string): RegistryError;
+6 -6
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/rpc-core": "7.13.1",
"@polkadot/types": "7.13.1",
"@polkadot/types-codec": "7.13.1",
"@polkadot/util": "^8.6.1"
"@babel/runtime": "^7.17.9",
"@polkadot/rpc-core": "8.4.2",
"@polkadot/types": "8.4.2",
"@polkadot/types-codec": "8.4.2",
"@polkadot/util": "^9.2.1"
}
}
@@ -12,6 +12,7 @@ import type { BlockHash } from '@polkadot/types/interfaces/chain';
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
import type { CodeUploadRequest, CodeUploadResult, ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';
import type { BlockStats } from '@polkadot/types/interfaces/dev';
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
@@ -155,6 +156,12 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
**/
uploadCode: AugmentedRpc<(uploadRequest: CodeUploadRequest | { origin?: any; code?: any; storageDepositLimit?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<CodeUploadResult>>;
};
dev: {
/**
* Reexecute the specified `block_hash` and gather statistics while doing so
**/
getBlockStats: AugmentedRpc<(at: Hash | string | Uint8Array) => Observable<Option<BlockStats>>>;
};
engine: {
/**
* Instructs the manual-seal authorship task to create a new block
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.4.2' };
+8 -8
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/rpc-augment": "7.13.1",
"@polkadot/rpc-provider": "7.13.1",
"@polkadot/types": "7.13.1",
"@polkadot/util": "^8.6.1",
"@babel/runtime": "^7.17.9",
"@polkadot/rpc-augment": "8.4.2",
"@polkadot/rpc-provider": "8.4.2",
"@polkadot/types": "8.4.2",
"@polkadot/util": "^9.2.1",
"rxjs": "^7.5.5"
},
"devDependencies": {
"@polkadot/keyring": "^8.6.1",
"@polkadot/rpc-augment": "7.13.1"
"@polkadot/keyring": "^9.2.1",
"@polkadot/rpc-augment": "8.4.2"
}
}
+5 -2
View File
@@ -12,7 +12,7 @@ import type { RpcInterfaceMethod } from './types';
import { Observable, publishReplay, refCount } from 'rxjs';
import { rpcDefinitions } from '@polkadot/types';
import { assert, hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aToU8a } from '@polkadot/util';
import { assert, hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aConcat, u8aToU8a } from '@polkadot/util';
import { drr, refCountDelay } from './util';
@@ -455,7 +455,10 @@ export class RpcCore {
return registry.createTypeUnsafe(type, [
isEmpty
? meta.fallback
? hexToU8a(meta.fallback.toHex())
// For old-style Linkage, we add an empty linkage at the end
? type.includes('Linkage<')
? u8aConcat(hexToU8a(meta.fallback.toHex()), new Uint8Array(2))
: hexToU8a(meta.fallback.toHex())
: undefined
: meta.modifier.isOptional
? registry.createTypeUnsafe(type, [input], { blockHash, isPedantic: true })
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.4.2' };
+3 -1
View File
@@ -36,7 +36,9 @@ describe('replay', (): void => {
const observable = rpc.system.chain();
let a: any | undefined;
observable.subscribe((value?: unknown): void => { a = value; });
observable.subscribe((value?: unknown): void => {
a = value;
});
setTimeout((): void => {
// Subscribe again to the same observable, it should fire value immediately
+3 -1
View File
@@ -14,7 +14,9 @@ describe('drr', (): void => {
it('should not fire twice the same value', (done): void => {
let count = 0;
const sub = of(1, 1).pipe(drr({ delay: 500 })).subscribe((): void => { ++count; });
const sub = of(1, 1).pipe(drr({ delay: 500 })).subscribe((): void => {
++count;
});
setTimeout((): void => {
expect(count).toBe(1);
+23 -2
View File
@@ -4,9 +4,9 @@ Generic transport providers to handle the transport of method calls to and from
## Provider Selection
There are two flavours of the providers provided, one allowing for using HTTP as a transport mechanism, the other using WebSockets. It is generally recommended to use the [[WsProvider]] since in addition to standard calls, it allows for subscriptions where all changes to state can be pushed from the node to the client.
There are three flavours of the providers provided, one allowing for using HTTP as a transport mechanism, the other using WebSockets, and the third one uses substrate light-client through @substrate/connect. It is generally recommended to use the [[WsProvider]] since in addition to standard calls, it allows for subscriptions where all changes to state can be pushed from the node to the client.
Both providers are usable (as is the API), in both browser-based and Node.js environments. Polyfills for unsupported functionality are automatically applied based on feature-detection.
All providers are usable (as is the API), in both browser-based and Node.js environments. Polyfills for unsupported functionality are automatically applied based on feature-detection.
## Usage
@@ -39,3 +39,24 @@ const version = await provider.send('chain_getBlockHash', []);
console.log('latest block Hash', hash);
```
@substrate/connect Initialization -
Instantiating a Provider for the Polkadot Relay Chain:
```javascript
import { ScProvider, WellKnownChain } from '@polkadot/rpc-provider/substrate-connect';
const provider = new ScProvider(WellKnownChain.polkadot);
await provider.connect();
const version = await provider.send('chain_getBlockHash', []);
```
Instantiating a Provider for a Polkadot parachain:
```javascript
import { ScProvider, WellKnownChain } from '@polkadot/rpc-provider/substrate-connect';
const polkadotProvider = new ScProvider(WellKnownChain.polkadot);
const parachainProvider = new ScProvider(parachainSpec, polkadotProvider);
await parachainProvider.connect();
const version = await parachainProvider.send('chain_getBlockHash', []);
```
+12 -11
View File
@@ -20,20 +20,21 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/keyring": "^8.6.1",
"@polkadot/types": "7.13.1",
"@polkadot/types-support": "7.13.1",
"@polkadot/util": "^8.6.1",
"@polkadot/util-crypto": "^8.6.1",
"@polkadot/x-fetch": "^8.6.1",
"@polkadot/x-global": "^8.6.1",
"@polkadot/x-ws": "^8.6.1",
"@babel/runtime": "^7.17.9",
"@polkadot/keyring": "^9.2.1",
"@polkadot/types": "8.4.2",
"@polkadot/types-support": "8.4.2",
"@polkadot/util": "^9.2.1",
"@polkadot/util-crypto": "^9.2.1",
"@polkadot/x-fetch": "^9.2.1",
"@polkadot/x-global": "^9.2.1",
"@polkadot/x-ws": "^9.2.1",
"@substrate/connect": "0.7.4",
"eventemitter3": "^4.0.7",
"mock-socket": "^9.1.2",
"mock-socket": "^9.1.3",
"nock": "^13.2.4"
}
}
+3
View File
@@ -4,3 +4,6 @@
export { HttpProvider } from './http';
export { packageInfo } from './packageInfo';
export { WsProvider } from './ws';
// ESM-only, only export top-level when we have dual versions
// export { ScProvider } from './substrate-connect';
@@ -15,7 +15,7 @@ describe('decodeResponse', (): void => {
it('expects a non-empty input object', (): void => {
expect(
() => coder.decodeResponse(undefined as unknown as JsonRpcResponse)
).toThrow(/Empty response/);
).toThrow(/Invalid jsonrpc/);
});
it('expects a valid jsonrpc field', (): void => {
@@ -13,6 +13,6 @@ describe('encodeJson', (): void => {
it('encodes a valid JsonRPC JSON string', (): void => {
expect(
coder.encodeJson('method', ['params'])
).toEqual('{"id":1,"jsonrpc":"2.0","method":"method","params":["params"]}');
).toEqual([1, '{"id":1,"jsonrpc":"2.0","method":"method","params":["params"]}']);
});
});
@@ -10,19 +10,14 @@ describe('encodeObject', (): void => {
coder = new RpcCoder();
});
it('starts with id === 0 (nothing sent)', (): void => {
expect(coder.getId()).toEqual(0);
});
it('encodes a valid JsonRPC object', (): void => {
expect(
coder.encodeObject('method', ['a', 'b'])
).toEqual({
).toEqual([1, {
id: 1,
jsonrpc: '2.0',
method: 'method',
params: ['a', 'b']
});
expect(coder.getId()).toEqual(1);
}]);
});
});
+24 -28
View File
@@ -20,27 +20,34 @@ function formatErrorData (data?: string | number): string {
// very nested, pick a number and trim the result display to it
return formatted.length <= 256
? formatted
: `${formatted.substr(0, 255)}`;
: `${formatted.substring(0, 255)}`;
}
function checkError (error?: JsonRpcResponseBaseError): void {
if (error) {
const { code, data, message } = error;
throw new RpcError(`${code}: ${message}${formatErrorData(data)}`, code, data);
}
}
/** @internal */
export class RpcCoder {
#id = 0;
public decodeResponse (response: JsonRpcResponse): unknown {
assert(response, 'Empty response object received');
assert(response.jsonrpc === '2.0', 'Invalid jsonrpc field in decoded object');
public decodeResponse (response?: JsonRpcResponse): unknown {
assert(response && response.jsonrpc === '2.0', 'Invalid jsonrpc field in decoded object');
const isSubscription = !isUndefined(response.params) && !isUndefined(response.method);
assert(isNumber(response.id) || (isSubscription && (isNumber(response.params.subscription) || isString(response.params.subscription))), 'Invalid id field in decoded object');
this._checkError(response.error);
checkError(response.error);
assert(!isUndefined(response.result) || isSubscription, 'No result found in JsonRpc response');
assert(!isUndefined(response.result) || isSubscription, 'No result found in jsonrpc response');
if (isSubscription) {
this._checkError(response.params.error);
checkError(response.params.error);
return response.params.result;
}
@@ -48,31 +55,20 @@ export class RpcCoder {
return response.result;
}
public encodeJson (method: string, params: unknown[]): string {
return stringify(
this.encodeObject(method, params)
);
public encodeJson (method: string, params: unknown[]): [number, string] {
const [id, data] = this.encodeObject(method, params);
return [id, stringify(data)];
}
public encodeObject (method: string, params: unknown[]): JsonRpcRequest {
return {
id: ++this.#id,
public encodeObject (method: string, params: unknown[]): [number, JsonRpcRequest] {
const id = ++this.#id;
return [id, {
id,
jsonrpc: '2.0',
method,
params
};
}
public getId (): number {
return this.#id;
}
private _checkError (error?: JsonRpcResponseBaseError): void {
if (error) {
const { code, data, message } = error;
const fmtMessage = `${code}: ${message}${formatErrorData(data)}`;
throw new RpcError(fmtMessage, code, data);
}
}];
}
}
+8 -4
View File
@@ -56,7 +56,7 @@ export class HttpProvider implements ProviderInterface {
this.#headers = headers;
this.#stats = {
active: { requests: 0, subscriptions: 0 },
total: { cached: 0, requests: 0, subscriptions: 0, timeout: 0 }
total: { bytesRecv: 0, bytesSent: 0, cached: 0, requests: 0, subscriptions: 0, timeout: 0 }
};
}
@@ -122,7 +122,7 @@ export class HttpProvider implements ProviderInterface {
public async send <T> (method: string, params: unknown[], isCacheable?: boolean): Promise<T> {
this.#stats.total.requests++;
const body = this.#coder.encodeJson(method, params);
const [, body] = this.#coder.encodeJson(method, params);
let resultPromise: Promise<T> | null = isCacheable
? this.#callCache.get(body) as Promise<T>
: null;
@@ -142,6 +142,7 @@ export class HttpProvider implements ProviderInterface {
async #send <T> (body: string): Promise<T> {
this.#stats.active.requests++;
this.#stats.total.bytesSent += body.length;
try {
const response = await fetch(this.#endpoint, {
@@ -157,8 +158,11 @@ export class HttpProvider implements ProviderInterface {
assert(response.ok, () => `[${response.status}]: ${response.statusText}`);
const result = (await response.json()) as JsonRpcResponse;
const decoded = this.#coder.decodeResponse(result) as T;
const result = await response.text();
this.#stats.total.bytesRecv += result.length;
const decoded = this.#coder.decodeResponse(JSON.parse(result) as JsonRpcResponse) as T;
this.#stats.active.requests--;
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.4.2' };
@@ -0,0 +1,347 @@
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert } from '@polkadot/util';
export interface SmoldotHealth {
isSyncing: boolean
peers: number
shouldHavePeers: boolean
}
export interface HealthChecker {
setSendJsonRpc(sendRequest: (request: string) => void): void
start(healthCallback: (health: SmoldotHealth) => void): void
stop(): void
sendJsonRpc(request: string): void
responsePassThrough(response: string): string | null
}
/*
* Creates a new health checker.
*
* The role of the health checker is to report to the user the health of a smoldot chain.
*
* In order to use it, start by creating a health checker, and call `setSendJsonRpc` to set the
* way to send a JSON-RPC request to a chain. The health checker is disabled by default. Use
* `start()` in order to start the health checks. The `start()` function must be passed a callback called
* when an update to the health of the node is available.
*
* In order to send a JSON-RPC request to the chain, you **must** use the `sendJsonRpc` function
* of the health checker. The health checker rewrites the `id` of the requests it receives.
*
* When the chain send a JSON-RPC response, it must be passed to `responsePassThrough()`. This
* function intercepts the responses destined to the requests that have been emitted by the health
* checker and returns `null`. If the response doesn't concern the health checker, the response is
* simply returned by the function.
*
* # How it works
*
* The health checker periodically calls the `system_health` JSON-RPC call in order to determine
* the health of the chain.
*
* In addition to this, as long as the health check reports that `isSyncing` is `true`, the
* health checker also maintains a subscription to new best blocks using `chain_subscribeNewHeads`.
* Whenever a new block is notified, a health check is performed immediately in order to determine
* whether `isSyncing` has changed to `false`.
*
* Thanks to this subscription, the latency of the report of the switch from `isSyncing: true` to
* `isSyncing: false` is very low.
*
*/
export function healthChecker (): HealthChecker {
// `null` if health checker is not started.
let checker: null | InnerChecker = null;
let sendJsonRpc: null | ((request: string) => void) = null;
return {
responsePassThrough: (jsonRpcResponse) => {
if (checker === null) {
return jsonRpcResponse;
}
return checker.responsePassThrough(jsonRpcResponse);
},
sendJsonRpc: (request) => {
assert(
sendJsonRpc,
'setSendJsonRpc must be called before sending requests'
);
if (checker === null) {
sendJsonRpc(request);
} else {
checker.sendJsonRpc(request);
}
},
setSendJsonRpc: (cb) => {
sendJsonRpc = cb;
},
start: (healthCallback) => {
assert(
checker === null,
"Can't start the health checker multiple times in parallel"
);
assert(
sendJsonRpc,
'setSendJsonRpc must be called before starting the health checks'
);
checker = new InnerChecker(healthCallback, sendJsonRpc);
checker.update(true);
},
stop: () => {
if (checker === null) {
return;
} // Already stopped.
checker.destroy();
checker = null;
}
};
}
class InnerChecker {
#healthCallback: (health: SmoldotHealth) => void;
#currentHealthCheckId: string | null = null;
#currentHealthTimeout: ReturnType<typeof setTimeout> | null = null;
#currentSubunsubRequestId: string | null = null;
#currentSubscriptionId: string | null = null;
#requestToSmoldot: (request: string) => void;
#isSyncing = false;
#nextRequestId = 0;
constructor (
healthCallback: (health: SmoldotHealth) => void,
requestToSmoldot: (request: string) => void
) {
this.#healthCallback = healthCallback;
this.#requestToSmoldot = requestToSmoldot;
}
sendJsonRpc = (request: string): void => {
// Replace the `id` in the request to prefix the request ID with `extern:`.
let parsedRequest: {id: string | number};
try {
parsedRequest = JSON.parse(request) as {id: string | number};
} catch (err) {
return;
}
if (parsedRequest.id) {
const newId = 'extern:' + JSON.stringify(parsedRequest.id);
parsedRequest.id = newId;
}
this.#requestToSmoldot(JSON.stringify(parsedRequest));
};
responsePassThrough = (jsonRpcResponse: string): string | null => {
let parsedResponse: {id: string, result?: SmoldotHealth, params?: { subscription: string }};
try {
parsedResponse = JSON.parse(jsonRpcResponse) as {id: string, result: undefined | SmoldotHealth};
} catch (err) {
return jsonRpcResponse;
}
// Check whether response is a response to `system_health`.
if (parsedResponse.id && this.#currentHealthCheckId === parsedResponse.id) {
this.#currentHealthCheckId = null;
// Check whether query was successful. It is possible for queries to fail for
// various reasons, such as the client being overloaded.
if (!parsedResponse.result) {
this.update(false);
return null;
}
this.#healthCallback(parsedResponse.result);
this.#isSyncing = parsedResponse.result.isSyncing;
this.update(false);
return null;
}
// Check whether response is a response to the subscription or unsubscription.
if (
parsedResponse.id &&
this.#currentSubunsubRequestId === parsedResponse.id
) {
this.#currentSubunsubRequestId = null;
// Check whether query was successful. It is possible for queries to fail for
// various reasons, such as the client being overloaded.
if (!parsedResponse.result) {
this.update(false);
return null;
}
if (this.#currentSubscriptionId) {
this.#currentSubscriptionId = null;
} else {
this.#currentSubscriptionId = parsedResponse.result as unknown as string;
}
this.update(false);
return null;
}
// Check whether response is a notification to a subscription.
if (
parsedResponse.params &&
this.#currentSubscriptionId &&
parsedResponse.params.subscription === this.#currentSubscriptionId
) {
// Note that after a successful subscription, a notification containing
// the current best block is always returned. Considering that a
// subscription is performed in response to a health check, calling
// `startHealthCheck()` here will lead to a second health check.
// It might seem redundant to perform two health checks in a quick
// succession, but doing so doesn't lead to any problem, and it is
// actually possible for the health to have changed in between as the
// current best block might have been updated during the subscription
// request.
this.update(true);
return null;
}
// Response doesn't concern us.
if (parsedResponse.id) {
const id: string = parsedResponse.id;
// Need to remove the `extern:` prefix.
assert(id.startsWith('extern:'), 'State inconsistency in health checker');
const newId = JSON.parse(id.slice('extern:'.length)) as string;
parsedResponse.id = newId;
}
return JSON.stringify(parsedResponse);
};
update = (startNow: boolean): void => {
// If `startNow`, clear `#currentHealthTimeout` so that it is set below.
if (startNow && this.#currentHealthTimeout) {
clearTimeout(this.#currentHealthTimeout);
this.#currentHealthTimeout = null;
}
if (!this.#currentHealthTimeout) {
const startHealthRequest = () => {
this.#currentHealthTimeout = null;
// No matter what, don't start a health request if there is already one in progress.
// This is sane to do because receiving a response to a health request calls `update()`.
if (this.#currentHealthCheckId) {
return;
}
// Actual request starting.
this.#currentHealthCheckId = 'health-checker:'.concat(
this.#nextRequestId.toString()
);
this.#nextRequestId += 1;
this.#requestToSmoldot(
JSON.stringify({
id: this.#currentHealthCheckId,
jsonrpc: '2.0',
method: 'system_health',
params: []
})
);
};
if (startNow) {
startHealthRequest();
} else {
this.#currentHealthTimeout = setTimeout(startHealthRequest, 1000);
}
}
if (
this.#isSyncing &&
!this.#currentSubscriptionId &&
!this.#currentSubunsubRequestId
) {
this.startSubscription();
}
if (
!this.#isSyncing &&
this.#currentSubscriptionId &&
!this.#currentSubunsubRequestId
) {
this.endSubscription();
}
};
startSubscription = (): void => {
assert(
!this.#currentSubunsubRequestId && !this.#currentSubscriptionId,
'Internal error in health checker'
);
this.#currentSubunsubRequestId = 'health-checker:'.concat(
this.#nextRequestId.toString()
);
this.#nextRequestId += 1;
this.#requestToSmoldot(
JSON.stringify({
id: this.#currentSubunsubRequestId,
jsonrpc: '2.0',
method: 'chain_subscribeNewHeads',
params: []
})
);
};
endSubscription = (): void => {
assert(
!this.#currentSubunsubRequestId && this.#currentSubscriptionId,
'Internal error in health checker'
);
this.#currentSubunsubRequestId = 'health-checker:'.concat(
this.#nextRequestId.toString()
);
this.#nextRequestId += 1;
this.#requestToSmoldot(
JSON.stringify({
id: this.#currentSubunsubRequestId,
jsonrpc: '2.0',
method: 'chain_unsubscribeNewHeads',
params: [this.#currentSubscriptionId]
})
);
};
destroy = (): void => {
if (this.#currentHealthTimeout) {
clearTimeout(this.#currentHealthTimeout);
this.#currentHealthTimeout = null;
}
};
}
export class HealthCheckError extends Error {
readonly #cause: unknown;
getCause (): unknown {
return this.#cause;
}
constructor (
response: unknown,
message = 'Got error response asking for system health'
) {
super(message);
this.#cause = response;
}
}
@@ -0,0 +1,647 @@
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
/* eslint-disable promise/param-names */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/ban-types */
import type { Chain, JsonRpcCallback } from '@substrate/connect';
import type { HealthChecker, SmoldotHealth } from './Health';
import type { ScProviderClass } from './ScProvider';
import { jest } from '@jest/globals';
const wait = (ms: number) => new Promise((res) => setTimeout(res, ms));
type MockedHealthChecker = HealthChecker & {
_isActive: () => boolean
_triggerHealthUpdate: (update: SmoldotHealth) => void
}
const healthCheckerMock = (): MockedHealthChecker => {
let cb: (health: SmoldotHealth) => void = () => {};
let sendJsonRpc: (request: string) => void = () => {};
let isActive = false;
return {
setSendJsonRpc: (cb) => {
sendJsonRpc = cb;
},
start: (x) => {
isActive = true;
cb = x;
},
stop: () => {
isActive = false;
},
sendJsonRpc: (...args) => sendJsonRpc(...args),
responsePassThrough: (response) => response,
_isActive: () => isActive,
_triggerHealthUpdate: (update: SmoldotHealth) => {
cb(update);
}
};
};
const healthCheckerFactory = () => {
const _healthCheckers: MockedHealthChecker[] = [];
return {
healthChecker: () => {
const result = healthCheckerMock();
_healthCheckers.push(result);
return result;
},
_healthCheckers,
_latestHealthChecker: () => _healthCheckers.slice(-1)[0]
};
};
jest.mock('./Health', () => healthCheckerFactory());
type MockChain = Chain & {
_spec: () => string
_recevedRequests: () => string[]
_isTerminated: () => boolean
_triggerCallback: (response: string | {}) => void
_setTerminateInterceptor: (fn: () => void) => void
_setSendJsonRpcInterceptor: (fn: (rpc: string) => void) => void
_getLatestRequest: () => string
}
const getFakeChain = (spec: string, callback: JsonRpcCallback): MockChain => {
const _receivedRequests: string[] = [];
let _isTerminated = false;
let terminateInterceptor: Function = Function.prototype;
let sendJsonRpcInterceptor: Function = Function.prototype;
return {
_spec: () => spec,
_recevedRequests: () => _receivedRequests,
_isTerminated: () => _isTerminated,
_triggerCallback: (response) => {
callback(
typeof response === 'string' ? response : JSON.stringify(response)
);
},
_setSendJsonRpcInterceptor: (fn) => {
sendJsonRpcInterceptor = fn;
},
_setTerminateInterceptor: (fn) => {
terminateInterceptor = fn;
},
sendJsonRpc: (rpc) => {
sendJsonRpcInterceptor(rpc);
_receivedRequests.push(rpc);
},
remove: () => {
terminateInterceptor();
_isTerminated = true;
},
_getLatestRequest: () => _receivedRequests[_receivedRequests.length - 1]
};
};
const getFakeClient = () => {
const chains: MockChain[] = [];
let addChainInterceptor: Promise<void> = Promise.resolve();
let addWellKnownChainInterceptor: Promise<void> = Promise.resolve();
return {
_chains: () => chains,
_setAddChainInterceptor: (interceptor: Promise<void>) => {
addChainInterceptor = interceptor;
},
_setAddWellKnownChainInterceptor: (interceptor: Promise<void>) => {
addWellKnownChainInterceptor = interceptor;
},
addChain: (chainSpec: string, cb: JsonRpcCallback): Promise<MockChain> =>
addChainInterceptor.then(() => {
const result = getFakeChain(chainSpec, cb);
chains.push(result);
return result;
}),
addWellKnownChain: (
wellKnownChain: string,
cb: JsonRpcCallback
): Promise<MockChain> =>
addWellKnownChainInterceptor.then(() => {
const result = getFakeChain(wellKnownChain, cb);
chains.push(result);
return result;
})
};
};
enum WellKnownChain {
polkadot = 'polkadot',
ksmcc3 = 'ksmcc3',
rococo_v2_2 = 'rococo_v2_2',
westend2 = 'westend2'
}
const connectorFactory = () => {
const clients: ReturnType<typeof getFakeClient>[] = [];
const latestClient = () => clients[clients.length - 1];
return {
WellKnownChain,
createScClient: () => {
const result = getFakeClient();
clients.push(result);
return result;
},
_clients: () => clients,
latestClient,
latestChain: () =>
latestClient()._chains()[latestClient()._chains().length - 1]
};
};
jest.mock('@substrate/connect', () => connectorFactory());
let ScProvider: ScProviderClass;
let mockedConnector: ReturnType<typeof connectorFactory>;
let mockedHealthChecker: ReturnType<typeof healthCheckerFactory>;
const getCurrentHealthChecker = () => mockedHealthChecker._latestHealthChecker();
const setChainSyncyingStatus = (isSyncing: boolean) => {
getCurrentHealthChecker()._triggerHealthUpdate({
isSyncing,
peers: 1,
shouldHavePeers: true
});
};
beforeAll(async () => {
({ ScProvider } = await import('./ScProvider'));
mockedConnector = (await import(
'@substrate/connect'
)) as unknown as ReturnType<typeof connectorFactory>;
mockedHealthChecker = await (import('./Health') as any);
});
describe('ScProvider', () => {
describe('on', () => {
it('emits `connected` as soon as the chain is not syncing', async () => {
const provider = new ScProvider('');
await provider.connect();
const onConnected = jest.fn();
provider.on('connected', onConnected);
expect(onConnected).not.toHaveBeenCalled();
setChainSyncyingStatus(false);
expect(onConnected).toHaveBeenCalled();
});
it('stops receiving notifications after unsubscribing', async () => {
const provider = new ScProvider('');
await provider.connect();
const onConnected = jest.fn();
provider.on('connected', onConnected)();
expect(onConnected).not.toHaveBeenCalled();
setChainSyncyingStatus(false);
expect(onConnected).not.toHaveBeenCalled();
});
it('synchronously emits connected if the Provider is already `connected`', async () => {
const provider = new ScProvider('');
await provider.connect();
setChainSyncyingStatus(false);
const onConnected = jest.fn();
provider.on('connected', onConnected);
expect(onConnected).toHaveBeenCalled();
});
it('emits `disconnected` once the chain goes back to syncing', async () => {
const provider = new ScProvider('');
await provider.connect();
setChainSyncyingStatus(false);
const onConnected = jest.fn();
provider.on('connected', onConnected);
const onDisconnected = jest.fn();
provider.on('disconnected', onDisconnected);
expect(onConnected).toHaveBeenCalled();
expect(onDisconnected).not.toHaveBeenCalled();
onConnected.mockRestore();
setChainSyncyingStatus(true);
expect(onConnected).not.toHaveBeenCalled();
expect(onDisconnected).toHaveBeenCalled();
});
});
describe('hasSubscriptions', () => {
it('supports subscriptions', async () => {
const provider = new ScProvider('');
await provider.connect();
expect(provider.hasSubscriptions).toBe(true);
});
});
describe('clone', () => {
it('can not be clonned', async () => {
const provider = new ScProvider('');
await provider.connect();
expect(() => provider.clone()).toThrowError();
});
});
describe('connect', () => {
it('does not create a new chain when trying to re-connect while the current chain is syncing', async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
await provider.connect();
expect(chain).toBe(mockedConnector.latestChain());
});
it('throws when trying to connect on an already connected Provider', async () => {
const provider = new ScProvider('');
await provider.connect();
setChainSyncyingStatus(false);
await expect(provider.connect()).rejects.toThrowError(
'Already connected!'
);
});
});
describe('disconnect', () => {
it('removes the chain and cleans up', async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
await provider.disconnect();
expect(chain._isTerminated()).toBe(true);
});
it('does not throw when disconnecting on an already disconnected Provider', async () => {
const provider = new ScProvider('');
await provider.connect();
await provider.disconnect();
await expect(provider.disconnect()).resolves.not.toThrow();
});
});
describe('send', () => {
it('throws when trying to send a request while the Provider is not connected', async () => {
const provider = new ScProvider('');
await provider.connect();
await expect(provider.send('', [])).rejects.toThrow();
});
it('receives responses to its requests', async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false);
const responsePromise = provider.send('getData', ['foo']);
await wait(0);
expect(chain._getLatestRequest()).toEqual(
'{"id":1,"jsonrpc":"2.0","method":"getData","params":["foo"]}'
);
const result = { foo: 'foo' };
chain._triggerCallback({
jsonrpc: '2.0',
id: 1,
result
});
const response = await responsePromise;
expect(response).toEqual(result);
});
it("rejects when the response can't be deserialized", async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false);
setTimeout(() => {
chain._triggerCallback({
jsonrpc: '2.0',
id: 1
});
}, 0);
await expect(provider.send('getData', ['foo'])).rejects.toThrow();
});
it('rejects when the smoldot chain has crashed', async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false);
await wait(0);
chain._setSendJsonRpcInterceptor(() => {
throw new Error('boom!');
});
await expect(provider.send('getData', ['foo'])).rejects.toThrowError(
'Disconnected'
);
expect(provider.isConnected).toBe(false);
});
});
describe('subscribe', () => {
it('subscribes and recives messages until it unsubscribes', async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false);
const unsubscribeToken = 'unsubscribeToken';
setTimeout(() => {
chain._triggerCallback({
jsonrpc: '2.0',
id: 1,
result: unsubscribeToken
});
}, 0);
const cb = jest.fn();
const token = await provider.subscribe(
'foo',
'chain_subscribeNewHeads',
['baz'],
cb
);
expect(token).toBe(unsubscribeToken);
expect(cb).not.toHaveBeenCalled();
chain._triggerCallback({
jsonrpc: '2.0',
method: 'foo',
params: {
result: 1,
subscription: token
}
});
expect(cb).toHaveBeenCalledTimes(1);
expect(cb).toHaveBeenLastCalledWith(null, 1);
chain._triggerCallback({
jsonrpc: '2.0',
method: 'foo',
params: {
result: 2,
subscription: token
}
});
expect(cb).toHaveBeenCalledTimes(2);
expect(cb).toHaveBeenLastCalledWith(null, 2);
provider.unsubscribe('foo', 'chain_unsubscribeNewHeads', unsubscribeToken);
chain._triggerCallback({
jsonrpc: '2.0',
method: 'foo',
params: {
result: 3,
subscription: token
}
});
expect(cb).toHaveBeenCalledTimes(2);
expect(cb).toHaveBeenLastCalledWith(null, 2);
});
it('ignores subscription messages that were received before the subscription token', async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false);
const unsubscribeToken = 'unsubscribeToken';
chain._triggerCallback({
jsonrpc: '2.0',
method: 'foo',
params: {
result: 1,
subscription: unsubscribeToken
}
});
setTimeout(() => {
chain._triggerCallback({
jsonrpc: '2.0',
id: 1,
result: unsubscribeToken
});
}, 0);
const cb = jest.fn();
const token = await provider.subscribe(
'foo',
'chain_subscribeNewHeads',
['baz'],
cb
);
expect(token).toBe(unsubscribeToken);
expect(cb).not.toHaveBeenCalled();
});
it('emits the error when the message has an error', async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
setChainSyncyingStatus(false);
await wait(0);
const unsubscribeToken = 'unsubscribeToken';
setTimeout(() => {
chain._triggerCallback({
jsonrpc: '2.0',
id: 1,
result: unsubscribeToken
});
}, 0);
const cb = jest.fn();
const token = await provider.subscribe(
'foo',
'chain_subscribeNewHeads',
['baz'],
cb
);
chain._triggerCallback({
jsonrpc: '2.0',
method: 'foo',
params: {
error: 'boom',
subscription: unsubscribeToken
}
});
expect(token).toBe(unsubscribeToken);
expect(cb).toHaveBeenCalledTimes(1);
expect(cb.mock.lastCall![0]).toBeInstanceOf(Error);
expect(cb.mock.lastCall![1]).toBe(undefined);
});
it('errors when subscribing to an unsupported method', async () => {
const provider = new ScProvider('');
await provider.connect();
setChainSyncyingStatus(false);
await wait(0);
await expect(
provider.subscribe('foo', 'bar', ['baz'], () => {})
).rejects.toThrowError('Unsupported subscribe method: bar');
});
});
describe('unsubscribe', () => {
it('rejects when trying to unsubscribe from un unexisting subscription', async () => {
const provider = new ScProvider('');
await provider.connect();
setChainSyncyingStatus(false);
await expect(provider.unsubscribe('', '', '')).rejects.toThrowError(
'Unable to find active subscription=::'
);
});
});
it('cleans up the stale subscriptions once it reconnects', async () => {
const provider = new ScProvider('');
await provider.connect();
const chain = mockedConnector.latestChain();
// setting the syncing status of the chain to fals so that the Provider
// gets `connected`
setChainSyncyingStatus(false);
// while connected we create a subscription
const unsubscribeToken = 'unsubscribeToken';
setTimeout(() => {
chain._triggerCallback({
jsonrpc: '2.0',
id: 1,
result: unsubscribeToken
});
}, 0);
const cb = jest.fn();
const token = await provider.subscribe(
'foo',
'chain_subscribeNewHeads',
['baz'],
cb
);
// setting the syncing status of the chain to fals so that the Provider
// gets `disconnected`
setChainSyncyingStatus(true);
// let's wait some time in order to ensure that the stale unsubscription
// messages are not sent until the chain syncing status changes back to false
await wait(200);
// before we let the healthChecker know that the chain is no longer syncing,
// let's make sure that the chain has received the correct request, and
// most importantly that it has not received a request for unsubscribing
// from the stale subscription, since that request should happen once the
// chain is no longer syncing
expect(chain._recevedRequests()).toEqual([
'{"id":1,"jsonrpc":"2.0","method":"chain_subscribeNewHeads","params":["baz"]}'
]);
// lets change the sync status back to false
setChainSyncyingStatus(false);
// let's wait one tick to ensure that the microtasks got processed
await wait(0);
// let's make sure that we have now sent the request for killing the
// stale subscription
expect(chain._recevedRequests()).toEqual([
'{"id":1,"jsonrpc":"2.0","method":"chain_subscribeNewHeads","params":["baz"]}',
`{"id":2,"jsonrpc":"2.0","method":"chain_unsubscribeNewHeads","params":["${token}"]}`
]);
});
});
@@ -0,0 +1,350 @@
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '../types';
import { Chain, createScClient, ScClient, WellKnownChain } from '@substrate/connect';
import EventEmitter from 'eventemitter3';
import { assert, isError } from '@polkadot/util';
import { RpcCoder } from '../coder';
import { healthChecker } from './Health';
type ResponseCallback = (response: string | Error) => void
// These methods have been taken from:
// https://github.com/paritytech/smoldot/blob/17425040ddda47d539556eeaf62b88c4240d1d42/src/json_rpc/methods.rs#L338-L462
// It's important to take into account that smoldot is adding support to the new
// json-rpc-interface https://paritytech.github.io/json-rpc-interface-spec/
// However, at the moment this list only includes methods that belong to the "old" API
const subscriptionUnsubscriptionMethods = new Map<string, string>([
['author_submitAndWatchExtrinsic', 'author_unwatchExtrinsic'],
['chain_subscribeAllHeads', 'chain_unsubscribeAllHeads'],
['chain_subscribeFinalizedHeads', 'chain_unsubscribeFinalizedHeads'],
['chain_subscribeFinalisedHeads', 'chain_subscribeFinalisedHeads'],
['chain_subscribeNewHeads', 'chain_unsubscribeNewHeads'],
['chain_subscribeNewHead', 'chain_unsubscribeNewHead'],
['chain_subscribeRuntimeVersion', 'chain_unsubscribeRuntimeVersion'],
['subscribe_newHead', 'unsubscribe_newHead'],
['state_subscribeRuntimeVersion', 'state_unsubscribeRuntimeVersion'],
['state_subscribeStorage', 'state_unsubscribeStorage']
]);
const wellKnownChains = new Set(Object.values(WellKnownChain));
const scClients = new WeakMap<ScProvider, ScClient>();
export { WellKnownChain };
export class ScProvider implements ProviderInterface {
readonly #coder: RpcCoder = new RpcCoder();
readonly #spec: string | WellKnownChain;
readonly #sharedSandbox?: ScProvider;
readonly #subscriptions: Map<
string,
[ResponseCallback, { unsubscribeMethod: string; id: string | number }]
> = new Map();
readonly #requests: Map<number, ResponseCallback> = new Map();
readonly #eventemitter: EventEmitter = new EventEmitter();
#chain: Promise<Chain> | null = null;
#isChainReady = false;
public constructor (spec: string | WellKnownChain, sharedSandbox?: ScProvider) {
this.#spec = spec;
this.#sharedSandbox = sharedSandbox;
}
public get hasSubscriptions (): boolean {
// Indicates that subscriptions are supported
return true;
}
public get isConnected (): boolean {
return !!this.#chain && this.#isChainReady;
}
public clone (): ProviderInterface {
throw new Error('clone() is not supported.');
}
async connect (): Promise<void> {
assert(!this.isConnected, 'Already connected!');
// it could happen that after emitting `disconnected` due to the fact taht
// smoldot is syncing, the consumer tries to reconnect after a certain amount
// of time... In which case we want to make sure that we don't create a new
// chain.
if (this.#chain) {
await this.#chain;
return;
}
if (this.#sharedSandbox && !this.#sharedSandbox.isConnected) {
await this.#sharedSandbox.connect();
}
const client = this.#sharedSandbox
? scClients.get(this.#sharedSandbox)
: createScClient();
assert(client, 'Unkown ScProvider!');
scClients.set(this, client);
const hc = healthChecker();
const onResponse = (res: string): void => {
const hcRes = hc.responsePassThrough(res);
if (!hcRes) {
return;
}
const response = JSON.parse(hcRes) as JsonRpcResponse;
let decodedResponse: string | Error;
try {
decodedResponse = this.#coder.decodeResponse(response) as string;
} catch (e) {
decodedResponse = e as Error;
}
// It's not a subscription message, but rather a standar RPC response
if (response.params?.subscription === undefined || !response.method) {
return this.#requests.get(response.id)?.(decodedResponse);
}
// We are dealing with a subscription message
const subscriptionId = `${response.method}::${response.params.subscription}`;
const callback = this.#subscriptions.get(subscriptionId)?.[0];
callback?.(decodedResponse);
};
const addChain = wellKnownChains.has(this.#spec as WellKnownChain)
? client.addWellKnownChain
: client.addChain;
this.#chain = addChain(this.#spec as WellKnownChain, onResponse).then((chain) => {
hc.setSendJsonRpc(chain.sendJsonRpc);
this.#isChainReady = false;
const cleanup = () => {
// If there are any callbacks left, we have to reject/error them.
// Otherwise, that would cause a memory leak.
const disconnectionError = new Error('Disconnected');
this.#requests.forEach((cb) => cb(disconnectionError));
this.#subscriptions.forEach(([cb]) => cb(disconnectionError));
this.#subscriptions.clear();
};
const staleSubscriptions: {
unsubscribeMethod: string
id: number | string
}[] = [];
const killStaleSubscriptions = () => {
if (staleSubscriptions.length === 0) {
return;
}
const stale = staleSubscriptions.pop();
assert(stale, 'Unable to get stale subscription');
const { id, unsubscribeMethod } = stale;
Promise
.race([
this.send(unsubscribeMethod, [id]).catch(() => undefined),
new Promise((resolve) => setTimeout(resolve, 500))
])
.then(killStaleSubscriptions)
.catch(() => undefined);
};
hc.start((health) => {
const isReady =
!health.isSyncing && (health.peers > 0 || !health.shouldHavePeers);
// if it's the same as before, then nothing has changed and we are done
if (this.#isChainReady === isReady) {
return;
}
this.#isChainReady = isReady;
if (!isReady) {
// If we've reached this point, that means that the chain used to be "ready"
// and now we are about to emit `disconnected`.
//
// This will cause the PolkadotJs API think that the connection is
// actually dead. In reality the smoldot chain is not dead, of course.
// However, we have to cleanup all the existing callbacks because when
// the smoldot chain stops syncing, then we will emit `connected` and
// the PolkadotJs API will try to re-create the previous
// subscriptions and requests. Although, now is not a good moment
// to be sending unsubscription messages to the smoldot chain, we
// should wait until is no longer syncing to send the unsubscription
// messages from the stale subscriptions of the previous connection.
//
// That's why -before we perform the cleanup of `this.#subscriptions`-
// we keep the necessary information that we will need later on to
// kill the stale subscriptions.
[...this.#subscriptions.values()].forEach((s) => {
staleSubscriptions.push(s[1]);
});
cleanup();
} else {
killStaleSubscriptions();
}
this.#eventemitter.emit(isReady ? 'connected' : 'disconnected');
});
return {
...chain,
remove: () => {
hc.stop();
chain.remove();
cleanup();
},
sendJsonRpc: hc.sendJsonRpc.bind(hc)
};
});
try {
await this.#chain;
} catch (e) {
this.#chain = null;
this.#eventemitter.emit('error', e);
throw e;
}
}
async disconnect (): Promise<void> {
if (!this.#chain) {
return;
}
const chain = await this.#chain;
this.#chain = null;
this.#isChainReady = false;
try {
chain.remove();
} catch (_) {}
this.#eventemitter.emit('disconnected');
}
public on (
type: ProviderInterfaceEmitted,
sub: ProviderInterfaceEmitCb
): () => void {
// It's possible. Although, quite unlikely, that by the time that polkadot
// subscribes to the `connected` event, the Provider is already connected.
// In that case, we must emit to let the consumer know that we are connected.
if (type === 'connected' && this.isConnected) {
sub();
}
this.#eventemitter.on(type, sub);
return (): void => {
this.#eventemitter.removeListener(type, sub);
};
}
public async send<T = any> (method: string, params: unknown[]): Promise<T> {
assert(this.isConnected && this.#chain, 'Provider is not connected');
const chain = await this.#chain;
const [id, json] = this.#coder.encodeJson(method, params);
const result = new Promise<T>((resolve, reject): void => {
this.#requests.set(id, (response) => {
(isError(response) ? reject : resolve)(response as unknown as T);
});
try {
chain.sendJsonRpc(json);
} catch (e) {
this.#chain = null;
try {
chain.remove();
} catch (_) {}
this.#eventemitter.emit('error', e);
}
});
try {
return await result;
} finally {
// let's ensure that once the Promise is resolved/rejected, then we remove
// remove its entry from the internal #requests
this.#requests.delete(id);
}
}
public async subscribe (
type: string,
method: string,
params: any[],
callback: ProviderInterfaceCallback
): Promise<number | string> {
assert(
subscriptionUnsubscriptionMethods.has(method),
`Unsupported subscribe method: ${method}`
);
const id = await this.send<number | string>(method, params);
const subscriptionId = `${type}::${id}`;
const cb = (response: Error | string) => {
if (response instanceof Error) {
callback(response, undefined);
} else {
callback(null, response);
}
};
const unsubscribeMethod = subscriptionUnsubscriptionMethods.get(method);
assert(unsubscribeMethod, 'Invalid unsubscribe method found');
this.#subscriptions.set(subscriptionId, [cb, { id, unsubscribeMethod }]);
return id;
}
public unsubscribe (
type: string,
method: string,
id: number | string
): Promise<boolean> {
assert(
this.isConnected,
'Provider is not connected'
);
const subscriptionId = `${type}::${id}`;
if (!this.#subscriptions.has(subscriptionId)) {
return Promise.reject(
new Error(`Unable to find active subscription=${subscriptionId}`)
);
}
this.#subscriptions.delete(subscriptionId);
return this.send(method, [id]);
}
}
export type ScProviderClass = typeof ScProvider
@@ -0,0 +1,4 @@
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './ScProvider';
+2
View File
@@ -68,6 +68,8 @@ export interface ProviderStats {
subscriptions: number;
};
total: {
bytesRecv: number;
bytesSent: number;
cached: number;
requests: number;
subscriptions: number;
+9 -2
View File
@@ -12,9 +12,9 @@ const TEST_WS_URL = 'ws://localhost-index.spec.ts:9977';
let provider: WsProvider | null;
let mock: Mock;
function createWs (requests: Request[], autoConnect = 1000, headers?: Record<string, string>): WsProvider {
function createWs (requests: Request[], autoConnect = 1000, headers?: Record<string, string>, timeout?: number): WsProvider {
mock = mockWs(requests, TEST_WS_URL);
provider = new WsProvider(TEST_WS_URL, autoConnect, headers);
provider = new WsProvider(TEST_WS_URL, autoConnect, headers, timeout);
return provider;
}
@@ -40,6 +40,13 @@ describe('Ws', (): void => {
it('allows you to initialize the provider with custom headers', () => {
createWs([], 100, { foo: 'bar' });
});
it('allows you to set custom timeout value for handlers', () => {
const CUSTOM_TIMEOUT_S = 90;
const CUSTOM_TIMEOUT_MS = CUSTOM_TIMEOUT_S * 1000;
createWs([], 100, { foo: 'bar' }, CUSTOM_TIMEOUT_MS);
});
});
describe('Endpoint Parsing', (): void => {
+28 -18
View File
@@ -42,8 +42,7 @@ const ALIASES: { [index: string]: string } = {
const RETRY_DELAY = 2_500;
const TIMEOUT_S = 30;
const TIMEOUT_MS = TIMEOUT_S * 1000;
const DEFAULT_TIMEOUT_MS = 60 * 1000;
const TIMEOUT_INTERVAL = 5_000;
const MEGABYTE = 1024 * 1024;
@@ -107,13 +106,18 @@ export class WsProvider implements ProviderInterface {
#subscriptions: Record<string, WsStateSubscription> = {};
#timeoutId?: NodeJS.Timeout | null = null;
#websocket: WebSocket | null;
#timeout: number;
/**
* @param {string | string[]} endpoint The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944`, may provide an array of endpoint strings.
* @param {boolean} autoConnect Whether to connect automatically or not.
* @param {number} [timeout] Custom timeout value
*/
constructor (endpoint: string | string[] = defaults.WS_URL, autoConnectMs: number | false = RETRY_DELAY, headers: Record<string, string> = {}) {
constructor (endpoint: string | string[] = defaults.WS_URL, autoConnectMs: number | false = RETRY_DELAY, headers: Record<string, string> = {}, timeout?: number) {
const endpoints = Array.isArray(endpoint)
? endpoint
: [endpoint];
@@ -133,8 +137,9 @@ export class WsProvider implements ProviderInterface {
this.#websocket = null;
this.#stats = {
active: { requests: 0, subscriptions: 0 },
total: { cached: 0, requests: 0, subscriptions: 0, timeout: 0 }
total: { bytesRecv: 0, bytesSent: 0, cached: 0, requests: 0, subscriptions: 0, timeout: 0 }
};
this.#timeout = timeout || DEFAULT_TIMEOUT_MS;
if (autoConnectMs > 0) {
this.connectWithRetry().catch((): void => {
@@ -147,9 +152,6 @@ export class WsProvider implements ProviderInterface {
resolve(this);
});
});
// timeout any handlers that have not had a response
setInterval(() => this.#timeout(), TIMEOUT_INTERVAL);
}
/**
@@ -209,6 +211,9 @@ export class WsProvider implements ProviderInterface {
this.#websocket.onerror = this.#onSocketError;
this.#websocket.onmessage = this.#onSocketMessage;
this.#websocket.onopen = this.#onSocketOpen;
// timeout any handlers that have not had a response
this.#timeoutId = setInterval(() => this.#timeoutHandlers(), TIMEOUT_INTERVAL);
} catch (error) {
l.error(error);
@@ -293,13 +298,13 @@ export class WsProvider implements ProviderInterface {
public send <T = any> (method: string, params: unknown[], isCacheable?: boolean, subscription?: SubscriptionHandler): Promise<T> {
this.#stats.total.requests++;
const body = this.#coder.encodeJson(method, params);
const [id, body] = this.#coder.encodeJson(method, params);
let resultPromise: Promise<T> | null = isCacheable
? this.#callCache.get(body) as Promise<T>
: null;
if (!resultPromise) {
resultPromise = this.#send(body, method, params, subscription);
resultPromise = this.#send(id, body, method, params, subscription);
if (isCacheable) {
this.#callCache.set(body, resultPromise);
@@ -311,20 +316,18 @@ export class WsProvider implements ProviderInterface {
return resultPromise;
}
async #send <T> (json: string, method: string, params: unknown[], subscription?: SubscriptionHandler): Promise<T> {
async #send <T> (id: number, body: string, method: string, params: unknown[], subscription?: SubscriptionHandler): Promise<T> {
return new Promise<T>((resolve, reject): void => {
try {
assert(this.isConnected && !isNull(this.#websocket), 'WebSocket is not connected');
const id = this.#coder.getId();
const callback = (error?: Error | null, result?: T): void => {
error
? reject(error)
: resolve(result as T);
};
l.debug(() => ['calling', method, json]);
l.debug(() => ['calling', method, body]);
this.#handlers[id] = {
callback,
@@ -333,8 +336,8 @@ export class WsProvider implements ProviderInterface {
start: Date.now(),
subscription
};
this.#websocket.send(json);
this.#stats.total.bytesSent += body.length;
this.#websocket.send(body);
} catch (error) {
reject(error);
}
@@ -414,6 +417,11 @@ export class WsProvider implements ProviderInterface {
this.#websocket = null;
}
if (this.#timeoutId) {
clearInterval(this.#timeoutId);
this.#timeoutId = null;
}
this.#emit('disconnected');
// reject all hanging requests
@@ -444,6 +452,8 @@ export class WsProvider implements ProviderInterface {
#onSocketMessage = (message: MessageEvent<string>): void => {
l.debug(() => ['received', message.data]);
this.#stats.total.bytesRecv += message.data.length;
const response = JSON.parse(message.data) as JsonRpcResponse;
return isUndefined(response.method)
@@ -550,16 +560,16 @@ export class WsProvider implements ProviderInterface {
})).catch(l.error);
};
#timeout = (): void => {
#timeoutHandlers = (): void => {
const now = Date.now();
const ids = Object.keys(this.#handlers);
for (let i = 0; i < ids.length; i++) {
const handler = this.#handlers[ids[i]];
if ((now - handler.start) > TIMEOUT_MS) {
if ((now - handler.start) > this.#timeout) {
try {
handler.callback(new Error(`No response received from RPC endpoint in ${TIMEOUT_S}s`), undefined);
handler.callback(new Error(`No response received from RPC endpoint in ${this.#timeout / 1000}s`), undefined);
} catch {
// ignore
}
+15 -15
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
@@ -30,23 +30,23 @@
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs"
},
"dependencies": {
"@babel/core": "^7.17.8",
"@babel/core": "^7.17.10",
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.17.8",
"@polkadot/api": "7.13.1",
"@polkadot/api-augment": "7.13.1",
"@polkadot/rpc-augment": "7.13.1",
"@polkadot/rpc-provider": "7.13.1",
"@polkadot/types": "7.13.1",
"@polkadot/types-augment": "7.13.1",
"@polkadot/types-codec": "7.13.1",
"@polkadot/types-create": "7.13.1",
"@polkadot/types-support": "7.13.1",
"@polkadot/util": "^8.6.1",
"@polkadot/x-ws": "^8.6.1",
"@babel/runtime": "^7.17.9",
"@polkadot/api": "8.4.2",
"@polkadot/api-augment": "8.4.2",
"@polkadot/rpc-augment": "8.4.2",
"@polkadot/rpc-provider": "8.4.2",
"@polkadot/types": "8.4.2",
"@polkadot/types-augment": "8.4.2",
"@polkadot/types-codec": "8.4.2",
"@polkadot/types-create": "8.4.2",
"@polkadot/types-support": "8.4.2",
"@polkadot/util": "^9.2.1",
"@polkadot/x-ws": "^9.2.1",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.3.1"
"yargs": "^17.5.0"
},
"devDependencies": {
"@types/websocket": "^1.0.5",
+1 -1
View File
@@ -5,7 +5,7 @@ module.exports = function (file) {
let main;
try {
main = require(`../${file}.cjs`).main;
main = require(`../cjs/${file}.js`).main;
} catch (error) {
// required for dev-only setups
process.env.JEST_WORKER_ID = '123';
+28 -43
View File
@@ -8,40 +8,46 @@ import yargs from 'yargs';
import { Definitions } from '@polkadot/types/types';
import { formatNumber } from '@polkadot/util';
import { WebSocket } from '@polkadot/x-ws';
import { generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultQuery, generateDefaultRpc, generateDefaultTx } from './generate';
import { HEADER, writeFile } from './util';
import { assertDir, assertFile, getMetadataViaWs, HEADER, writeFile } from './util';
function generate (metaHex: HexString, pkg: string | undefined, output: string, isStrict?: boolean): void {
console.log(`Generating from metadata, ${formatNumber((metaHex.length - 2) / 2)} bytes`);
const base = path.join(process.cwd(), output);
const extraTypes = pkg
// eslint-disable-next-line @typescript-eslint/no-var-requires
? { [pkg]: require(path.join(base, 'definitions')) as Record<string, any> }
: {};
const outputPath = assertDir(path.join(process.cwd(), output));
let extraTypes: Record<string, any> = {};
let customLookupDefinitions: Definitions = { rpc: {}, types: {} };
let customLookupDefinitions;
if (pkg) {
try {
extraTypes = {
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-argument
[pkg]: require(assertFile(path.join(outputPath, 'definitions.ts'))) as Record<string, any>
};
} catch (error) {
console.error('ERROR: No custom definitions found:', (error as Error).message);
}
}
try {
customLookupDefinitions = {
rpc: {},
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
types: require(path.join(base, 'lookup.ts')).default
} as Definitions;
types: require(assertFile(path.join(outputPath, 'lookup.ts'))).default
};
} catch (error) {
console.log('No custom definitions found.');
console.error('ERROR: No lookup definitions found:', (error as Error).message);
}
generateDefaultConsts(path.join(base, 'augment-api-consts.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultErrors(path.join(base, 'augment-api-errors.ts'), metaHex, extraTypes, isStrict);
generateDefaultEvents(path.join(base, 'augment-api-events.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultQuery(path.join(base, 'augment-api-query.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultRpc(path.join(base, 'augment-api-rpc.ts'), extraTypes);
generateDefaultTx(path.join(base, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultConsts(path.join(outputPath, 'augment-api-consts.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultErrors(path.join(outputPath, 'augment-api-errors.ts'), metaHex, extraTypes, isStrict);
generateDefaultEvents(path.join(outputPath, 'augment-api-events.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultQuery(path.join(outputPath, 'augment-api-query.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultRpc(path.join(outputPath, 'augment-api-rpc.ts'), extraTypes);
generateDefaultTx(path.join(outputPath, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
writeFile(path.join(base, 'augment-api.ts'), (): string =>
writeFile(path.join(outputPath, 'augment-api.ts'), (): string =>
[
HEADER('chain'),
...[
@@ -78,32 +84,11 @@ export function main (): void {
}).argv as ArgV;
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
try {
const websocket = new WebSocket(endpoint);
websocket.onclose = (event: { code: number; reason: string }): void => {
console.error(`disconnected, code: '${event.code}' reason: '${event.reason}'`);
process.exit(1);
};
websocket.onerror = (event: unknown): void => {
console.error(event);
process.exit(1);
};
websocket.onopen = (): void => {
console.log('connected');
websocket.send('{"id":"1","jsonrpc":"2.0","method":"state_getMetadata","params":[]}');
};
websocket.onmessage = (message: unknown): void => {
generate((JSON.parse((message as Record<string, string>).data) as Record<string, HexString>).result, pkg, output, isStrict);
};
} catch (error) {
process.exit(1);
}
getMetadataViaWs(endpoint)
.then((metadata) => generate(metadata, pkg, output, isStrict))
.catch(() => process.exit(1));
} else {
// eslint-disable-next-line @typescript-eslint/no-var-requires
generate((require(path.join(process.cwd(), endpoint)) as Record<string, HexString>).result, pkg, output, isStrict);
generate((require(assertFile(path.join(process.cwd(), endpoint))) as Record<string, HexString>).result, pkg, output, isStrict);
}
}
+23 -8
View File
@@ -11,6 +11,7 @@ import * as substrateDefs from '@polkadot/types/interfaces/definitions';
import { generateInterfaceTypes } from './generate/interfaceRegistry';
import { generateTsDef } from './generate/tsDef';
import { generateDefaultLookup } from './generate';
import { assertDir, assertFile, getMetadataViaWs } from './util';
type ArgV = { input: string; package: string; endpoint?: string; };
@@ -32,15 +33,16 @@ export function main (): void {
}
}).argv as ArgV;
if (endpoint) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const metaHex = (require(path.join(process.cwd(), endpoint)) as Record<string, HexString>).result;
const inputPath = assertDir(path.join(process.cwd(), input));
let userDefs: Record<string, any> = {};
generateDefaultLookup(path.join(process.cwd(), input), metaHex);
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
userDefs = require(assertFile(path.join(inputPath, 'definitions.ts'))) as Record<string, any>;
} catch (error) {
console.error('ERROR: Unable to load user definitions:', (error as Error).message);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires
const userDefs = require(path.join(process.cwd(), input, 'definitions.ts')) as Record<string, any>;
const userKeys = Object.keys(userDefs);
const filteredBase = Object
.entries(substrateDefs as Record<string, unknown>)
@@ -64,6 +66,19 @@ export function main (): void {
[pkg]: userDefs
};
generateTsDef(allDefs, path.join(process.cwd(), input), pkg);
generateInterfaceTypes(allDefs, path.join(process.cwd(), input, 'augment-types.ts'));
generateTsDef(allDefs, inputPath, pkg);
generateInterfaceTypes(allDefs, path.join(inputPath, 'augment-types.ts'));
if (endpoint) {
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
getMetadataViaWs(endpoint)
.then((metadata) => generateDefaultLookup(inputPath, metadata))
.catch(() => process.exit(1));
} else {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const metaHex = (require(assertFile(path.join(process.cwd(), endpoint))) as Record<string, HexString>).result;
generateDefaultLookup(inputPath, metaHex);
}
}
}
+16 -23
View File
@@ -42,17 +42,6 @@ function tsExport (registry: Registry, definitions: Record<string, ModuleTypes>,
return exportInterface(def.lookupIndex, def.name, formatType(registry, definitions, def, imports, false));
}
const tsBTreeMap = tsExport;
const tsBTreeSet = tsExport;
const tsCompact = tsExport;
const tsDoNotConstruct = tsExport;
const tsHashMap = tsExport;
const tsOption = tsExport;
const tsPlain = tsExport;
const tsTuple = tsExport;
const tsWrapperKeepOpaque = tsExport;
const tsWrapperOpaque = tsExport;
/** @internal */
function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, { lookupIndex, name: enumName, sub }: TypeDef, imports: TypeImports): string {
setImports(definitions, imports, ['Enum']);
@@ -77,6 +66,8 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
case TypeDefInfo.Struct:
case TypeDefInfo.Tuple:
case TypeDefInfo.Vec:
case TypeDefInfo.BTreeMap:
case TypeDefInfo.BTreeSet:
case TypeDefInfo.Option:
case TypeDefInfo.VecFixed:
case TypeDefInfo.WrapperKeepOpaque:
@@ -125,6 +116,8 @@ function tsResultGetter (registry: Registry, definitions: Record<string, ModuleT
case TypeDefInfo.Si:
case TypeDefInfo.Tuple:
case TypeDefInfo.Vec:
case TypeDefInfo.BTreeMap:
case TypeDefInfo.BTreeSet:
case TypeDefInfo.WrapperKeepOpaque:
case TypeDefInfo.WrapperOpaque:
return `${isGetter}${asGetter}`;
@@ -223,29 +216,29 @@ function tsVec (registry: Registry, definitions: Record<string, ModuleTypes>, de
// `generators[typedef.info](...)` TS will show any unhandled types. Rather
// we are being explicit in having no handlers where we do not support (yet)
export const typeEncoders: Record<TypeDefInfo, (registry: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports) => string> = {
[TypeDefInfo.BTreeMap]: tsBTreeMap,
[TypeDefInfo.BTreeSet]: tsBTreeSet,
[TypeDefInfo.Compact]: tsCompact,
[TypeDefInfo.DoNotConstruct]: tsDoNotConstruct,
[TypeDefInfo.BTreeMap]: tsExport,
[TypeDefInfo.BTreeSet]: tsExport,
[TypeDefInfo.Compact]: tsExport,
[TypeDefInfo.DoNotConstruct]: tsExport,
[TypeDefInfo.Enum]: tsEnum,
[TypeDefInfo.HashMap]: tsHashMap,
[TypeDefInfo.HashMap]: tsExport,
[TypeDefInfo.Int]: tsInt,
[TypeDefInfo.Linkage]: errorUnhandled,
[TypeDefInfo.Null]: tsNull,
[TypeDefInfo.Option]: tsOption,
[TypeDefInfo.Plain]: tsPlain,
[TypeDefInfo.Range]: errorUnhandled,
[TypeDefInfo.RangeInclusive]: errorUnhandled,
[TypeDefInfo.Option]: tsExport,
[TypeDefInfo.Plain]: tsExport,
[TypeDefInfo.Range]: tsExport,
[TypeDefInfo.RangeInclusive]: tsExport,
[TypeDefInfo.Result]: tsResult,
[TypeDefInfo.Set]: tsSet,
[TypeDefInfo.Si]: tsSi,
[TypeDefInfo.Struct]: tsStruct,
[TypeDefInfo.Tuple]: tsTuple,
[TypeDefInfo.Tuple]: tsExport,
[TypeDefInfo.UInt]: tsUInt,
[TypeDefInfo.Vec]: tsVec,
[TypeDefInfo.VecFixed]: tsVec,
[TypeDefInfo.WrapperKeepOpaque]: tsWrapperKeepOpaque,
[TypeDefInfo.WrapperOpaque]: tsWrapperOpaque
[TypeDefInfo.WrapperKeepOpaque]: tsExport,
[TypeDefInfo.WrapperOpaque]: tsExport
};
/** @internal */
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.4.2' };
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2017-2022 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import { assert } from '@polkadot/util';
export function assertDir (path: string): string {
assert(fs.existsSync(path) && fs.lstatSync(path).isDirectory(), `${path} is not a directory`);
return path;
}
export function assertFile (path: string): string {
assert(fs.existsSync(path) && fs.lstatSync(path).isFile(), `${path} is not a file`);
return path;
}
+41 -13
View File
@@ -8,26 +8,54 @@ import { getSimilarTypes } from './derived';
describe('getSimilarTypes', (): void => {
let registry: TypeRegistry;
const mockImports = {
codecTypes: {},
definitions: {},
extrinsicTypes: {},
genericTypes: {},
ignoredTypes: [],
localTypes: {},
lookupTypes: {},
metadataTypes: {},
primitiveTypes: {},
typeToModule: {},
typesTypes: {}
};
beforeAll((): void => {
registry = new TypeRegistry();
});
it('handles nested Tuples', (): void => {
expect(getSimilarTypes(registry, {}, '(AccountId, (Balance, u32), u64)', {
codecTypes: {},
definitions: {},
extrinsicTypes: {},
genericTypes: {},
ignoredTypes: [],
localTypes: {},
lookupTypes: {},
metadataTypes: {},
primitiveTypes: {},
typeToModule: {},
typesTypes: {}
})).toEqual([
expect(getSimilarTypes(registry, {}, '(AccountId, (Balance, u32), u64)', mockImports)).toEqual([
'ITuple<[AccountId, ITuple<[Balance, u32]>, u64]>',
'[AccountId | string | Uint8Array, ITuple<[Balance, u32]> | [Balance | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], u64 | AnyNumber | Uint8Array]'
]);
});
it('handles vectors of slices', (): void => {
expect(getSimilarTypes(registry, {}, 'Vec<[u8;4]>', mockImports)).toEqual([
'Vec<U8aFixed>'
]);
expect(getSimilarTypes(registry, {}, 'Vec<[Balance;8]>', mockImports)).toEqual([
'Vec<Vec<Balance>>'
]);
});
it('handles structs', (): void => {
expect(getSimilarTypes(registry, {}, '{ "a": "u8", "b": "Vec<u8>" }', mockImports)).toEqual([
`{
readonly a: u8;
readonly b: Bytes;
} & Struct`, '{ a?: any; b?: any }', 'string', 'Uint8Array'
]);
});
it('handles vectors of structs', (): void => {
expect(getSimilarTypes(registry, {}, 'Vec<{ "a": "H256", "b": "Vec<H256>" }>', mockImports)).toEqual([
`Vec<{
readonly a: H256;
readonly b: Vec<H256>;
} & Struct>`
]);
});
});
+7 -1
View File
@@ -4,7 +4,7 @@
import type { Constructor, Registry } from '@polkadot/types/types';
import type { TypeDef } from '@polkadot/types-create/types';
import { GenericAccountId, GenericLookupSource, GenericVote } from '@polkadot/types/generic';
import { GenericAccountId, GenericCall, GenericLookupSource, GenericVote } from '@polkadot/types/generic';
import { AllConvictions } from '@polkadot/types/interfaces/democracy/definitions';
import { AbstractInt, bool, Compact, Enum, Null, Option, Struct, Tuple, UInt, Vec, WrapperKeepOpaque, WrapperOpaque } from '@polkadot/types-codec';
import { getTypeDef, TypeDefInfo } from '@polkadot/types-create';
@@ -58,6 +58,10 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
);
possibleTypes.push(`([${subs.join(', ')}])[]`);
} else if (subDef.info === TypeDefInfo.VecFixed) {
// TODO: Add possibleTypes so imports work
} else if (subDef.info === TypeDefInfo.Struct) {
// TODO: Add possibleTypes so imports work
} else {
throw new Error(`Unhandled subtype in Vec, ${stringify(subDef)}`);
}
@@ -80,6 +84,8 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
possibleTypes.push('Address', 'AccountId', 'AccountIndex', 'LookupSource', 'string', 'Uint8Array');
} else if (isChildClass(GenericAccountId, Clazz)) {
possibleTypes.push('string', 'Uint8Array');
} else if (isChildClass(GenericCall, Clazz)) {
possibleTypes.push('IMethod', 'string', 'Uint8Array');
} else if (isChildClass(bool, Clazz)) {
possibleTypes.push('boolean', 'Uint8Array');
} else if (isChildClass(Null, Clazz)) {
+17 -1
View File
@@ -4,6 +4,10 @@
import fs from 'fs';
import path from 'path';
import { assert } from '@polkadot/util';
import { packageInfo } from '../packageInfo';
export function writeFile (dest: string, generator: () => string, noLog?: boolean): void {
!noLog && console.log(`${dest}\n\tGenerating`);
@@ -21,5 +25,17 @@ export function writeFile (dest: string, generator: () => string, noLog?: boolea
}
export function readTemplate (template: string): string {
return fs.readFileSync(path.join(__dirname, `../templates/${template}.hbs`)).toString();
// Inside the api repo itself, it will be 'auto'
const rootDir = packageInfo.path === 'auto'
? path.join(__dirname, '..')
: packageInfo.path;
// NOTE With cjs in a subdir, search one lower as well
const file = ['./templates', '../templates']
.map((p) => path.join(rootDir, p, `${template}.hbs`))
.find((p) => fs.existsSync(p));
assert(file, `Unable to locate ${template}.hbs from ${rootDir}`);
return fs.readFileSync(file).toString();
}
+2 -2
View File
@@ -175,11 +175,11 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
},
[TypeDefInfo.Range]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
throw new Error(`TypeDefInfo.Range: Not implemented on ${stringify(typeDef)}`);
return singleParamNotation(registry, 'Range', typeDef, definitions, imports, withShortcut);
},
[TypeDefInfo.RangeInclusive]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
throw new Error(`TypeDefInfo.RangeInclusive: Not implemented on ${stringify(typeDef)}`);
return singleParamNotation(registry, 'RangeInclusive', typeDef, definitions, imports, withShortcut);
},
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
+1 -1
View File
@@ -42,7 +42,7 @@ export function setImports (allDefs: Record<string, ModuleTypes>, imports: TypeI
types.filter((t): t is string => !!t).forEach((type): void => {
if (ignoredTypes.includes(type)) {
// do nothing
} else if (['AnyNumber', 'CallFunction', 'Codec', 'IExtrinsic', 'ITuple'].includes(type)) {
} else if (['AnyNumber', 'CallFunction', 'Codec', 'IExtrinsic', 'IMethod', 'ITuple'].includes(type)) {
typesTypes[type] = true;
} else if (['Metadata', 'PortableRegistry'].includes(type)) {
metadataTypes[type] = true;
+2
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2022 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './assert';
export * from './derived';
export * from './docs';
export * from './file';
@@ -8,6 +9,7 @@ export * from './formatting';
export * from './imports';
export * from './initMeta';
export * from './register';
export * from './wsMeta';
type Cmp = { name: { toString(): string } };
+35
View File
@@ -0,0 +1,35 @@
// Copyright 2017-2022 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import { WebSocket } from '@polkadot/x-ws';
export async function getMetadataViaWs (endpoint: string): Promise<HexString> {
return new Promise((resolve): void => {
try {
const websocket = new WebSocket(endpoint);
websocket.onclose = (event: { code: number; reason: string }): void => {
console.error(`disconnected, code: '${event.code}' reason: '${event.reason}'`);
process.exit(1);
};
websocket.onerror = (event: unknown): void => {
console.error(event);
process.exit(1);
};
websocket.onopen = (): void => {
console.log('connected');
websocket.send('{"id":"1","jsonrpc":"2.0","method":"state_getMetadata","params":[]}');
};
websocket.onmessage = (message: { data: string }): void => {
resolve((JSON.parse(message.data) as { result: HexString }).result);
};
} catch (error) {
process.exit(1);
}
});
}
+5 -5
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "7.13.1",
"version": "8.4.2",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.17.8",
"@polkadot/types": "7.13.1",
"@polkadot/types-codec": "7.13.1",
"@polkadot/util": "^8.6.1"
"@babel/runtime": "^7.17.9",
"@polkadot/types": "8.4.2",
"@polkadot/types-codec": "8.4.2",
"@polkadot/util": "^9.2.1"
}
}
+5 -5
View File
@@ -5,13 +5,13 @@
export default {
/**
* Lookup75: kusama_runtime::ProxyType
* Lookup79: kusama_runtime::ProxyType
**/
KusamaRuntimeProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy', 'Auction', 'Society']
},
/**
* Lookup252: kusama_runtime::SessionKeys
* Lookup258: kusama_runtime::SessionKeys
**/
KusamaRuntimeSessionKeys: {
grandpa: 'SpFinalityGrandpaAppPublic',
@@ -22,7 +22,7 @@ export default {
authorityDiscovery: 'SpAuthorityDiscoveryAppPublic'
},
/**
* Lookup326: kusama_runtime::OriginCaller
* Lookup332: kusama_runtime::OriginCaller
**/
KusamaRuntimeOriginCaller: {
_enum: {
@@ -129,7 +129,7 @@ export default {
}
},
/**
* Lookup392: kusama_runtime::NposCompactSolution24
* Lookup398: kusama_runtime::NposCompactSolution24
**/
KusamaRuntimeNposCompactSolution24: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
@@ -158,7 +158,7 @@ export default {
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
},
/**
* Lookup747: kusama_runtime::Runtime
* Lookup753: kusama_runtime::Runtime
**/
KusamaRuntimeRuntime: 'Null'
};
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -6,7 +6,7 @@ declare module '@polkadot/types/lookup' {
import type { ITuple } from '@polkadot/types-codec/types';
import type { PerU16 } from '@polkadot/types/interfaces/runtime';
/** @name KusamaRuntimeProxyType (75) */
/** @name KusamaRuntimeProxyType (79) */
export interface KusamaRuntimeProxyType extends Enum {
readonly isAny: boolean;
readonly isNonTransfer: boolean;
@@ -19,7 +19,7 @@ declare module '@polkadot/types/lookup' {
readonly type: 'Any' | 'NonTransfer' | 'Governance' | 'Staking' | 'IdentityJudgement' | 'CancelProxy' | 'Auction' | 'Society';
}
/** @name KusamaRuntimeSessionKeys (252) */
/** @name KusamaRuntimeSessionKeys (258) */
export interface KusamaRuntimeSessionKeys extends Struct {
readonly grandpa: SpFinalityGrandpaAppPublic;
readonly babe: SpConsensusBabeAppPublic;
@@ -29,7 +29,7 @@ declare module '@polkadot/types/lookup' {
readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic;
}
/** @name KusamaRuntimeOriginCaller (326) */
/** @name KusamaRuntimeOriginCaller (332) */
export interface KusamaRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSupportDispatchRawOrigin;
@@ -45,7 +45,7 @@ declare module '@polkadot/types/lookup' {
readonly type: 'System' | 'Void' | 'Council' | 'TechnicalCommittee' | 'ParachainsOrigin' | 'XcmPallet';
}
/** @name KusamaRuntimeNposCompactSolution24 (392) */
/** @name KusamaRuntimeNposCompactSolution24 (398) */
export interface KusamaRuntimeNposCompactSolution24 extends Struct {
readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>;
readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>;
@@ -73,7 +73,7 @@ declare module '@polkadot/types/lookup' {
readonly votes24: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>;
}
/** @name KusamaRuntimeRuntime (747) */
/** @name KusamaRuntimeRuntime (753) */
export type KusamaRuntimeRuntime = Null;
} // declare module
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '7.13.1' };
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '8.4.2' };

Some files were not shown because too many files have changed in this diff Show More