Compare commits

...
124 Commits
Author SHA1 Message Date
Github Actions ff67a659b6 [CI Skip] release/stable 6.7.1
skip-checks: true
2021-11-07 09:17:39 +00:00
Jaco a5c69a42fc 6.7.1 (#4184)
* 6.7.1

* packgeInfo

* voteLockingPeriod
2021-11-07 11:09:03 +02:00
Github Actions 3facbf00eb [CI Skip] release/beta 6.6.2-27
skip-checks: true
2021-11-07 07:54:42 +00:00
Jaco 5a6eece6d6 Swap to objectProperty from @polkadot/util (#4183)
* Swap to objectProperty from @polkadot/util

* Re-apply
2021-11-07 09:45:37 +02:00
Github Actions 9219fa3197 [CI Skip] release/beta 6.6.2-26
skip-checks: true
2021-11-07 01:10:02 +00:00
Jaco 32b9a39b1e Multiple Codec property assignments helper (#4182)
* Multiple Codec property assignments helper

* Pass index

* consistency in naming

* typesToMap external

* Loop on index

* any -> unknown

* CHANGELOG

* Adjust

* Fix Enum with Array keys
2021-11-07 03:00:37 +02:00
Github Actions 61a7fe6307 [CI Skip] release/beta 6.6.2-25
skip-checks: true
2021-11-06 20:50:48 +00:00
Jaco ca755d3e0d Make v4 payload driven by extension fields (#4017)
* Make v4 payload driven by extension fields

* Add getters for additional fields

* Move keys

* Re-adjust

* abstract

* SignerPayload fields

* CHANGELOG
2021-11-06 22:42:14 +02:00
Github Actions 442dba42ba [CI Skip] release/beta 6.6.2-24
skip-checks: true
2021-11-06 14:43:03 +00:00
Jaco ba80dd8873 Bump metadata (#4180)
* Bump metadata

* Re-generate types.json

* Kusama hex

* Kusama (... after some struggles)
2021-11-06 16:34:33 +02:00
Github Actions 1d35302dca [CI Skip] release/beta 6.6.2-23
skip-checks: true
2021-11-06 12:36:03 +00:00
Jaco 39c3121437 CHANGELOG (#4179) 2021-11-06 14:28:22 +02:00
Github Actions d7de1d84fb [CI Skip] release/beta 6.6.2-22
skip-checks: true
2021-11-06 10:24:30 +00:00
Jaco 0ee1dfb353 Caching for previously-created complex classes (#4177)
* Caching for previousl-created complex classes

* Drop non-output testing test
2021-11-06 12:17:07 +02:00
Github Actions 0a6f1d87d4 [CI Skip] release/beta 6.6.2-21
skip-checks: true
2021-11-06 10:12:27 +00:00
Jaco b7c563391c Remove memoized caches (Enum, Set) (#4178) 2021-11-06 12:01:40 +02:00
Github Actions b648c4ba6c [CI Skip] release/beta 6.6.2-20
skip-checks: true
2021-11-06 08:09:13 +00:00
Jaco 0eb995c9a1 Apply hashCache on Extrinsic only (no duplication) (#4176) 2021-11-06 10:01:05 +02:00
Github Actions 936d14ffea [CI Skip] release/beta 6.6.2-19
skip-checks: true
2021-11-06 07:34:38 +00:00
Nazar Mokrynskyi 72c7a0a34b Performance tweaks (#4143)
* Avoid unnecessary work in `filterEvents`

* Memoize computed extrinsic hash

* Optimize sanitize by reusing precompiled regular expressions

* Memoize generation of property names in `Enum` and `Set`

* Memoize sanitizing
2021-11-06 09:25:54 +02:00
Jaco 8402013e97 Add account::AccountId20 mapping (#4175)
Replaces https://github.com/polkadot-js/api/pull/4117

Sadly I messed up that one since I moved the PortableRegistry, so despite best-efforts cannot quite revolve the now-conflicts on GitHub itself

Will give acknowledgement since it is deserved, just cannot quite get the PR merged as of right now.
2021-11-06 09:12:12 +02:00
Github Actions fde6b72974 [CI Skip] release/beta 6.6.2-18
skip-checks: true
2021-11-05 16:06:06 +00:00
Jaco d98d4d6908 Move PortableRegistry alongside metadata (#4172) 2021-11-05 17:47:02 +02:00
Github Actions ed384666ee [CI Skip] release/beta 6.6.2-17
skip-checks: true
2021-11-05 14:38:57 +00:00
Jaco 4e64e3d654 Change initialU8aLength to non-getter (#4170)
* Change initialU8aLength to non-getter

* Remove time comments

* Adjust Compact shortcut

* Adjust

* Move isU8a check first in decoding

* #initialLength for Compact

* Compact re-adjust

* Split decodeU8aVec

* decodeVec opt

* Fix compare

* Adjust

* Additional objectSpread

* Additional objectSpread

* isU8a always first

* Comment time logs

* Convert String right at point of using

* Optimize Text from Text

* Fix Text test

* Additional ordering updates

* Enum adjustments

* Reorder Option

* Adjust

* Remove comments

* Adjust
2021-11-05 16:19:38 +02:00
Github Actions 72b4b51915 [CI Skip] release/beta 6.6.2-16
skip-checks: true
2021-11-05 07:25:57 +00:00
Jaco 81f5bf96f5 Adjust Struct loops (#4169) 2021-11-05 09:09:52 +02:00
Github Actions e935281b77 [CI Skip] release/beta 6.6.2-15
skip-checks: true
2021-11-05 06:23:39 +00:00
Jaco e132330c0b Update rpc mappings (#4168)
* Update rpc mappings

* spread
2021-11-05 08:07:57 +02:00
Github Actions 21594aa660 [CI Skip] release/beta 6.6.2-14
skip-checks: true
2021-11-04 14:14:02 +00:00
Jaco 6fb7989b41 Lazy decoration (part 9, rpc) (#4165)
* Lazy decoration (part 9, rpc)

* Flatten

* Cleanups (& bump dev, fix copy-to)

* Only RPC methods are lazy

* Decorate rpc-core lazily

* Adjust import

* Remove (now) invalid test
2021-11-04 15:59:05 +02:00
Github Actions 1f38a38bd5 [CI Skip] release/beta 6.6.2-13
skip-checks: true
2021-11-04 13:06:08 +00:00
Jaco e918aa8b14 Lazy decoration (part 10, Import lazy* from @polkadot/util) (#4166)
* Impot lazy* from @polkadot/util

* Bumps
2021-11-04 14:51:06 +02:00
Github Actions 4a33b18ac4 [CI Skip] release/beta 6.6.2-12
skip-checks: true
2021-11-04 09:36:06 +00:00
Jaco cb97fd1a48 Use new object utilities (as applicable) (#4161)
* Use new object utilities (as applicable)

* Extract utility functions

* Renames

* Comment cleanup

* Fix types
2021-11-04 11:20:03 +02:00
Github Actions 51600bc560 [CI Skip] release/beta 6.6.2-11
skip-checks: true
2021-11-04 09:01:50 +00:00
Jaco 12344ed980 Bump deps (dev & common) (#4162) 2021-11-04 10:43:42 +02:00
Github Actions 0b6773a744 [CI Skip] release/beta 6.6.2-10
skip-checks: true
2021-11-03 14:19:54 +00:00
Jaco 17a38e9c09 Rebump dev, rollup build fixes (#4158) 2021-11-03 16:01:27 +02:00
Github Actions 70499fe6ac [CI Skip] release/beta 6.6.2-9
skip-checks: true
2021-11-03 13:09:32 +00:00
Jaco 64493e0091 Bump dev (#4156) 2021-11-03 15:05:39 +02:00
Github Actions ae3efb31f8 [CI Skip] release/beta 6.6.2-8
skip-checks: true
2021-11-03 10:34:20 +00:00
Jaco 6da58d0698 Dedupe decorate for storage & storageAt (#4155)
* Dedupe decorate for storage & storageAt

* blockHash as last param

* Adjust

* Reorder

* Reorder
2021-11-03 12:16:27 +02:00
Github Actions 07f40c1429 [CI Skip] release/beta 6.6.2-7
skip-checks: true
2021-11-03 09:00:41 +00:00
Jaco f5f67e795e Lazy decoration (part 8, consistent call order) (#4153)
* Lazy decoration (part 8, consistent call order)

* Dedupe

* Flatten, no extra calls

* Dedupe more

* Adjust lazyVariants

* Additional flatten

* Adjust lazyVariants

* Reorder name/index

* Deupe strings

* Flatten createkeys

* Adjust
2021-11-03 10:47:04 +02:00
Github Actions 5b0652c272 [CI Skip] release/beta 6.6.2-6
skip-checks: true
2021-11-03 05:42:40 +00:00
Jaco 53ef5f7c56 Lazy decoration (part 7, augment optimize) (#4152)
* Lazy decoration (part 7, augment optimize)

* augment with generics

* Adjust
2021-11-03 07:26:02 +02:00
Github Actions 71f99875e4 [CI Skip] release/beta 6.6.2-5
skip-checks: true
2021-11-02 14:43:15 +00:00
Jaco a097075bfe Lazy decorate (part 6, API internals) (#4150)
* Lazy decorate (part 6, API internals)

* Rework tx decoration

* Adjust metadata decoration triggers

* Reformat registry lazy decoration

* storage
2021-11-02 16:29:08 +02:00
Jaco 527f840950 More internal reduce adjustments (#4149) 2021-11-02 16:13:20 +02:00
Github Actions 7fadc7eedb [CI Skip] release/beta 6.6.2-4
skip-checks: true
2021-11-02 11:37:04 +00:00
Jaco 35663319d9 Lazy decoration (part 5, augmentObject) (#4145)
* Lazy decoration (part 5, augmentObject)

* hasOwnProperty update

* Fix comments

* loop indexes

* Extract lazySection

* Use hasOwnProperty on is/as getters

* defineProperty helper

* Update defineProperty & use for loops

* skip/adjust for some keys
2021-11-02 13:21:16 +02:00
Github Actions b9d9670d18 [CI Skip] release/beta 6.6.2-3
skip-checks: true
2021-11-02 10:32:15 +00:00
Jaco fd027f452c Lazy decoration (part 3, derives) (#4142)
* Lazy decoration (part 3, prep for derives)

* Derives are lazy

* ... it should have derives

* dedupe api-derive lazy

* function -> inline

* Cleanup defineProperty

* Adjust

* Final readability tweaks

* ... I lied, alignment tweaks

* Exportable lazyDeriveSection

* lazy from @polkadot/types

* Adjust
2021-11-02 12:10:30 +02:00
Github Actions 10a6e03f85 [CI Skip] release/beta 6.6.2-2
skip-checks: true
2021-11-02 09:42:13 +00:00
Jaco 522eb8359f Lazy decoration (part 2, registry) (#4141)
* Lazy decoration (part 2)

* createCallFunction

* Remove previous gen

* WIP, registry dedup

* ... anbd with extrinsics

* Additional cleanups

* Creator

* This should be sharable with derive...

* getName

* Adjust

* lazy.ts in types/create

* Go crazy on comments...
2021-11-02 11:28:29 +02:00
Github Actions d1fd7f75af [CI Skip] release/beta 6.6.2-1
skip-checks: true
2021-11-02 08:05:34 +00:00
Jaco bb61b1e6ac Lazy decoration (part 1, metadata) (#4139)
* Make decoration lazy

* Extract common

* w/ Extrinsics

* Storage lazy

* V14 -> Latest

* Util

* Adjust to use create/lazy

* Adjust

* Add tests for errors & events (long-time outstanding)
2021-11-02 09:49:16 +02:00
Github Actions 7c17baa5be [CI Skip] release/beta 6.6.2-0
skip-checks: true
2021-11-02 05:56:45 +00:00
Jaco 9e7c0a1959 Lazy decoration (part 4, lazyMethod/lazyMethods) (#4144) 2021-11-02 07:35:32 +02:00
Github Actions db2e97bf66 [CI Skip] release/stable 6.6.1
skip-checks: true
2021-11-01 16:17:29 +00:00
Jaco 057f6b6041 6.6.1 (#4140)
* 6.6.1

* 6.6.1
2021-11-01 17:59:50 +02:00
Github Actions ca82336087 [CI Skip] release/beta 6.5.3-13
skip-checks: true
2021-11-01 09:50:27 +00:00
Jaco 761ceaeaa3 Internal adjustments (part 6) (#4138)
* Internal adjustments (part 6)

* Additional
2021-11-01 11:35:17 +02:00
Github Actions 0cbca0adb8 [CI Skip] release/beta 6.5.3-12
skip-checks: true
2021-11-01 09:21:33 +00:00
Jaco d24db4fd6a Internal adjustments (part 4) (#4136)
* Internal adjustments (part 3)

* Internal adjustments (part 4)

* Additional

* Additional

* Fix set encoding
2021-11-01 11:01:31 +02:00
Jaco 4a893b9feb Internal adjustments (part 5) (#4137) 2021-11-01 10:56:16 +02:00
Github Actions 71a0a84f26 [CI Skip] release/beta 6.5.3-11
skip-checks: true
2021-11-01 08:25:14 +00:00
Jaco 44d241f489 Internal adjustments (part 3) (#4135) 2021-11-01 10:03:13 +02:00
Github Actions a4cb5f558d [CI Skip] release/beta 6.5.3-10
skip-checks: true
2021-11-01 07:46:07 +00:00
Jaco aef4d07c48 Internal adjustments (part 2) (#4134) 2021-11-01 09:27:04 +02:00
Github Actions 6a5f1bbbf4 [CI Skip] release/beta 6.5.3-9
skip-checks: true
2021-10-31 05:15:37 +00:00
Jaco e60ef2d677 Optimize internal u8a decoding (#4131)
* Optimize internal u8a decoding

* linting

* tsc fixes & HexString usage

* yet more... it passes now (well... tsc & lint)
2021-10-31 06:58:14 +02:00
Github Actions f4622d05db [CI Skip] release/beta 6.5.3-8
skip-checks: true
2021-10-30 15:33:20 +00:00
Jaco 47d7900809 Adjust struct iterable creation (#4130) 2021-10-30 18:12:12 +03:00
Jaco 2c86e9347b Optimize Struct from Struct construction (#4128)
* Optimize Struct from Map constrcution

* Update packages/types/src/metadata/MetadataVersioned.ts

* CHANGELOG

* Only shortcut Struct

* tests
2021-10-30 17:50:37 +03:00
Github Actions 5827d298ad [CI Skip] release/beta 6.5.3-7
skip-checks: true
2021-10-29 15:25:42 +00:00
Jaco 60e0f69920 Adjust AbstractArray & Struct decoders (#4127)
* Adjust AbstractArray & Struct decoders

* Fixes, add Text & Bytes/Raw to shortcuts

* Additional

* Additional

* Remove debug log

* Revert extra arg, make CC happy

* BTreeSet
2021-10-29 18:06:57 +03:00
Github Actions 97f1ee17b0 [CI Skip] release/beta 6.5.3-6
skip-checks: true
2021-10-28 12:13:17 +00:00
Jaco 85215a308d Bump metadata (#4123) 2021-10-28 14:48:42 +03:00
Github Actions 89fa4edcf7 [CI Skip] release/beta 6.5.3-5
skip-checks: true
2021-10-28 11:05:51 +00:00
Jaco ec42fb9bff Update known Westend upgrade blocks (#4122) 2021-10-28 13:48:10 +03:00
Github Actions 96d696dbf3 [CI Skip] release/beta 6.5.3-4
skip-checks: true
2021-10-28 08:43:46 +00:00
Jaco b7992ecc0b Use lookupName in createClass (as available) (#4121)
* User lookupName in createClass (as available)

* CHANGELOG

* cleanups

* Adjust for Vecs

* Small check cleanups
2021-10-28 11:19:30 +03:00
Github Actions 0acae6e158 [CI Skip] release/beta 6.5.3-3
skip-checks: true
2021-10-26 12:58:10 +00:00
Jaco 6afea5043e Add and dedupe EthereumAddress (#4118)
* Add and dedupe EthereumAddress

* Override for Polkadot claims
2021-10-26 15:40:58 +03:00
Github Actions c9ee8d9942 [CI Skip] release/beta 6.5.3-2
skip-checks: true
2021-10-26 11:58:39 +00:00
Jaco 55f4e150c0 Split namespaces (#4116) 2021-10-26 14:42:18 +03:00
Github Actions 3e3e9c5f5a [CI Skip] release/beta 6.5.3-1
skip-checks: true
2021-10-26 10:40:54 +00:00
Jaco 66215890dd Correct construction of palletVersion keys (#4115) 2021-10-26 13:20:54 +03:00
Github Actions bf6c7ee0c3 [CI Skip] release/beta 6.5.3-0
skip-checks: true
2021-10-26 07:58:18 +00:00
Jaco f726edf725 Bump dev (#4113) 2021-10-26 10:42:23 +03:00
Github Actions d917861a77 [CI Skip] release/stable 6.5.2
skip-checks: true
2021-10-26 06:02:42 +00:00
Jaco 12a54efde5 Fix Struct decoding for null (#4112)
* Fix Struct decoding for null

* CHANGELOG

* 6.5.2
2021-10-26 08:46:03 +03:00
Github Actions 9ae87bed78 [CI Skip] release/beta 6.5.2-3
skip-checks: true
2021-10-25 14:27:40 +00:00
Jaco 7f5a52258c Adjust toHuman on Call (#4109) 2021-10-25 17:10:26 +03:00
Github Actions 2c212e6b4d [CI Skip] release/beta 6.5.2-2
skip-checks: true
2021-10-25 14:07:57 +00:00
Jaco 3d75744a20 Bump dev deps (#4108) 2021-10-25 16:51:05 +03:00
Github Actions d2ff259989 [CI Skip] release/beta 6.5.2-1
skip-checks: true
2021-10-25 12:08:53 +00:00
Jaco cac2ef30a1 Bump dev (#4106) 2021-10-25 14:44:47 +03:00
Github Actions ea38dedcc1 [CI Skip] release/beta 6.5.2-0
skip-checks: true
2021-10-25 06:15:30 +00:00
Jaco 0bd632e612 Allow for optional known RuntimeVersion on api.at (#4103)
* Allow for optional known RuntimeVersion on api.at

* CHANGELOG typo
2021-10-25 08:57:26 +03:00
Github Actions 4ce7163bb1 [CI Skip] release/stable 6.5.1
skip-checks: true
2021-10-24 18:18:36 +00:00
Jaco 72fbd3f829 6.5.1 (#4102) 2021-10-24 20:58:36 +03:00
Github Actions f20fadb51c [CI Skip] release/beta 6.4.3-9
skip-checks: true
2021-10-23 12:36:20 +00:00
Jaco 0e0183dc99 Adjust raw toAscii output (#4097) 2021-10-23 15:16:07 +03:00
Github Actions fa71e129c2 [CI Skip] release/beta 6.4.3-8
skip-checks: true
2021-10-23 11:39:43 +00:00
Jaco cb68842da6 Bump metadata (& deps) (#4096)
* Bump metadata (& deps)

* Bump deps
2021-10-23 14:18:20 +03:00
Github Actions 44f348ecc5 [CI Skip] release/beta 6.4.3-7
skip-checks: true
2021-10-22 11:48:06 +00:00
Jaco 891a6106f0 Ensure rpcCore correctly decorates .raw (#4091)
* Ensure rpcCore correctly decorates .json/.raw

* .raw encoding changes + memoization
2021-10-22 14:25:46 +03:00
Github Actions 90fcc234a9 [CI Skip] release/beta 6.4.3-6
skip-checks: true
2021-10-22 05:55:01 +00:00
Jaco 72fcd97cdb Add typeName to TypeDef (#4089)
* Add typeName to TypeDef

* Sanitize typeName

* Export typeName inside fuction args meta

* Correct typeName extraction
2021-10-22 08:35:09 +03:00
Github Actions 2ded2052b7 [CI Skip] release/beta 6.4.3-5
skip-checks: true
2021-10-21 11:53:24 +00:00
Jaco a8da5707f2 Add palletVersion to queries (#4088)
* Add palletVersion to queries

* Re-use raw key creator

* types

* Re-adjust test
2021-10-21 14:36:54 +03:00
Github Actions f508668c46 [CI Skip] release/beta 6.4.3-4
skip-checks: true
2021-10-21 10:14:53 +00:00
Jaco 15ed0723f1 Adjust Node Websocket options (frame sizes) (#4087) 2021-10-21 12:54:25 +03:00
Github Actions c9b0502542 [CI Skip] release/beta 6.4.3-3
skip-checks: true
2021-10-21 04:55:24 +00:00
Jaco 0d5a841a81 Expose extracted type names in PortableRegistry 2021-10-21 07:33:10 +03:00
Github Actions e47b8c1e73 [CI Skip] release/beta 6.4.3-2
skip-checks: true
2021-10-21 03:28:36 +00:00
Nikos Kontakis 50fe50d1a8 Add auction in shared types (#4085) 2021-10-21 06:07:51 +03:00
Github Actions 9e4669b8b4 [CI Skip] release/beta 6.4.3-1
skip-checks: true
2021-10-19 06:09:04 +00:00
Jaco 1e383315e2 Adjust convertSiV0toV1 import location (#4082) 2021-10-19 08:47:06 +03:00
Github Actions 6f66eb2b66 [CI Skip] release/beta 6.4.3-0
skip-checks: true
2021-10-19 05:37:39 +00:00
Jaco 0864340ae2 Adjust xcm version mapping utility (#4081) 2021-10-19 08:21:07 +03:00
191 changed files with 11094 additions and 9485 deletions
+2 -1
View File
@@ -40,4 +40,5 @@
6.0.5 6.0.5
6.1.2 6.1.2
6.4.2 6.4.2
6.5.2
+71
View File
@@ -1,5 +1,76 @@
# CHANGELOG # CHANGELOG
## 6.7.1 Nov 7, 2021
Upgrade priority: Low. Internal maintenance updates, focussed on internal optimizations.
Changelog:
- Optimize Extrinsic & block handling (Thanks to https://github.com/nazar-pc)
- Add `account::AccountId20` mapping (Thanks to https://github.com/joelamouche)
Changes:
- Use new-gen `voteLockingPeriod` in democracy derives (as available)
- Dynamically inject getters for `Extrinsic` payloads
- Optimize caching for complex constructed type classes per registry
- Convert metadata, rpc and api to use lazy decoration
- Split u8a decoding paths for `Vec` (different from general path)
- Keep track of initial u8a decoded length inside base Codecs
- Extract multi property assignments for `Struct`, `Set`, `Json` & `Enum`
- Move `PortableRegistry` location inside `@polkadot/types/metadata`
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 6.6.1 Nov 1, 2021
Upgrade priority: Low. Internal maintenance updates.
Changes:
- Fix construction for `palletVersion` keys with correct prefix
- Add Polkadot `EthereumAddress` as a known `PortableRegistry` override
- De-dupe `PortableRegistry` namespace splitting operations
- Optimize internal `AbstractArray` & `Struct` u8a decoding
- Shortcut `Struct` construction from `Struct` instance
- Use internal `lookupName` in `createClass` (allows deeply recursive lookups)
- Codec `toHex()` will now correctly return the TS `HexString` type
- Update known upgrade blocks for Westend & Kusama
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 6.5.2 Oct 26, 2021
Upgrade priority: Low. Recommended for users with `.at` queries on unknown blocks.
Changes:
- Adjust `toHuman` on `Call` to return names & (not only) values
- Allow for optional known `RuntimeVersion` to short-circuit `api.at`
- Ensure `Struct` decodes fully on `null` input (equivalent to `undefined` & `{}`)
## 6.5.1 Oct 24, 2021
Upgrade priority: Low. Internal maintenance upgrades.
Contributed:
- Add `Auction` to Polkadot pre-0.9.11 `ProxyType` (Thanks to https://github.com/wirednkod)
Changes:
- Ecah module now exposes the Substrate-added `palletVersion` storage item
- Adjust Websocket `maxReceivedFrameSize` under Node
- `TypeDef` structures now contain the `typeName` from metadata v14 on fields
- Fix browser bundle imports for xcm-mapping (move to `types-known`)
- Expose all extracted type names in `PortableRegistry`
- Adjust `toJSON` (Ascii) output detection on `Raw`
- Adjust `api.rpc.*.*.raw(..args)` return to the actual over-the-wire JSON result
- Remove `api.rpc.*.*.json(..args)` since it now overlaps with new `.raw`
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 6.4.2 Oct 18, 2021 ## 6.4.2 Oct 18, 2021
Upgrade priority: Low. Recommended for Westmint runtime 500+ Upgrade priority: Low. Recommended for Westmint runtime 500+
+19 -13
View File
@@ -1,40 +1,46 @@
{ {
"repository": "https://github.com/polkadot-js/api",
"author": "Jaco Greeff <jacogr@gmail.com>", "author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api#readme",
"license": "Apache-2", "license": "Apache-2",
"packageManager": "yarn@3.0.1",
"private": true, "private": true,
"repository": {
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": false,
"type": "commonjs", "type": "commonjs",
"version": "6.7.1",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
"resolutions": {
"typescript": "^4.4.4"
},
"scripts": { "scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts", "build": "yarn build:interfaces && polkadot-dev-build-ts",
"build:extra": "(cd packages/typegen && copyfiles scripts/* build)", "build:extra": "(cd packages/typegen && copyfiles scripts/* build)",
"build:interfaces": "polkadot-types-internal-interfaces", "build:interfaces": "polkadot-types-internal-interfaces",
"build:release": "polkadot-ci-ghact-build", "build:release": "polkadot-ci-ghact-build",
"build:rollup": "polkadot-exec-rollup --config", "build:rollup": "polkadot-exec-rollup --config",
"docs:metadata": "polkadot-types-internal-metadata",
"chain:info": "polkadot-types-chain-info", "chain:info": "polkadot-types-chain-info",
"lint": "polkadot-dev-run-lint",
"clean": "polkadot-dev-clean-build", "clean": "polkadot-dev-clean-build",
"docs:metadata": "polkadot-types-internal-metadata",
"lint": "polkadot-dev-run-lint",
"postinstall": "polkadot-dev-yarn-only", "postinstall": "polkadot-dev-yarn-only",
"test": "polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e", "test": "polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e",
"test:one": "polkadot-dev-run-test --detectOpenHandles --forceExit", "test:one": "polkadot-dev-run-test --detectOpenHandles --forceExit",
"test:watch": "polkadot-dev-run-test --watch" "test:watch": "polkadot-dev-run-test --watch"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.15.8", "@babel/core": "^7.16.0",
"@babel/register": "^7.15.3", "@babel/register": "^7.16.0",
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/dev": "^0.63.3", "@polkadot/dev": "^0.63.27",
"@polkadot/ts": "^0.4.9", "@polkadot/ts": "^0.4.13",
"@polkadot/typegen": "workspace:packages/typegen", "@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
}, },
"version": "6.4.2", "resolutions": {
"packageManager": "yarn@3.0.1" "typescript": "^4.4.4"
}
} }
+22 -18
View File
@@ -1,28 +1,32 @@
{ {
"name": "@polkadot/api-contract", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "Interfaces for interacting with contracts and contract ABIs", "description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/api-contract",
"repository": {
"directory": "packages/api-contract",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/api": "6.4.2", "@polkadot/api": "6.7.1",
"@polkadot/types": "6.4.2", "@polkadot/types": "6.7.1",
"@polkadot/util": "^7.5.1", "@polkadot/util": "^7.8.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
} }
} }
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2021 @polkadot/api-contract authors & contributors // Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Bytes } from '@polkadot/types'; import type { Bytes, PortableRegistry } from '@polkadot/types';
import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageParamSpec, ContractMessageSpec, ContractMetadataLatest, ContractProjectInfo } from '@polkadot/types/interfaces'; import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageParamSpec, ContractMessageSpec, ContractMetadataLatest, ContractProjectInfo } from '@polkadot/types/interfaces';
import type { AnyJson, Codec, Registry } from '@polkadot/types/types'; import type { AnyJson, Codec, Registry } from '@polkadot/types/types';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from '../types'; import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from '../types';
@@ -45,7 +45,7 @@ function parseJson (json: AnyJson, chainProperties?: ChainProperties): [AnyJson,
const latest = metadata.isV0 const latest = metadata.isV0
? toLatest(registry, metadata.asV0) ? toLatest(registry, metadata.asV0)
: metadata.asV1; : metadata.asV1;
const lookup = registry.createType('PortableRegistry', { types: latest.types }); const lookup = registry.createType<PortableRegistry>('PortableRegistry', { types: latest.types });
// attach the lookup to the registry - now the types are known // attach the lookup to the registry - now the types are known
registry.setLookup(lookup); registry.setLookup(lookup);
+1 -1
View File
@@ -4,7 +4,7 @@
import type { ContractMetadataLatest, ContractMetadataV0 } from '@polkadot/types/interfaces'; import type { ContractMetadataLatest, ContractMetadataV0 } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types/types'; import type { Registry } from '@polkadot/types/types';
import { convertSiV0toV1 } from '@polkadot/types/generic/PortableRegistry'; import { convertSiV0toV1 } from '@polkadot/types';
export function toLatest (registry: Registry, v0: ContractMetadataV0): ContractMetadataLatest { export function toLatest (registry: Registry, v0: ContractMetadataV0): ContractMetadataLatest {
return registry.createType('ContractMetadataLatest', { return registry.createType('ContractMetadataLatest', {
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '6.4.2' }; export const packageInfo = { name: '@polkadot/api-contract', version: '6.7.1' };
@@ -18,6 +18,7 @@
"lookupIndex": 1, "lookupIndex": 1,
"lookupName": "RecursiveMyEnum", "lookupName": "RecursiveMyEnum",
"type": "Lookup1", "type": "Lookup1",
"typeName": "MyEnum",
"index": 1, "index": 1,
"name": "B" "name": "B"
} }
+26 -22
View File
@@ -1,34 +1,38 @@
{ {
"name": "@polkadot/api-derive", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.", "description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/api-derive",
"repository": {
"directory": "packages/api-derive",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/api": "6.4.2", "@polkadot/api": "6.7.1",
"@polkadot/rpc-core": "6.4.2", "@polkadot/rpc-core": "6.7.1",
"@polkadot/types": "6.4.2", "@polkadot/types": "6.7.1",
"@polkadot/util": "^7.5.1", "@polkadot/util": "^7.8.2",
"@polkadot/util-crypto": "^7.5.1", "@polkadot/util-crypto": "^7.8.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.5.1", "@polkadot/keyring": "^7.8.2",
"@polkadot/rpc-provider": "6.4.2" "@polkadot/rpc-provider": "6.7.1"
} }
} }
+39 -25
View File
@@ -5,6 +5,7 @@ import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types'; import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AnyFunction } from '@polkadot/types/types'; import type { AnyFunction } from '@polkadot/types/types';
import { lazyDeriveSection } from './util/lazy';
import * as accounts from './accounts'; import * as accounts from './accounts';
import * as balances from './balances'; import * as balances from './balances';
import * as bounties from './bounties'; import * as bounties from './bounties';
@@ -32,6 +33,8 @@ interface Avail {
withDetect?: boolean; withDetect?: boolean;
} }
export { lazyDeriveSection };
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, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
type DeriveSection<Section> = { type DeriveSection<Section> = {
@@ -66,49 +69,60 @@ const checks: Record<string, Avail> = {
treasury: { instances: ['treasury'] } treasury: { instances: ['treasury'] }
}; };
function getModuleInstances (api: ApiInterfaceRx, specName: string, moduleName: string): string[] {
return api.registry.getModuleInstances(specName, moduleName) || [];
}
/** /**
* Returns an object that will inject `api` into all the functions inside * Returns an object that will inject `api` into all the functions inside
* `allSections`, and keep the object architecture of `allSections`. * `allSections`, and keep the object architecture of `allSections`.
*/ */
/** @internal */ /** @internal */
function injectFunctions<AllSections> (instanceId: string, api: ApiInterfaceRx, allSections: AllSections): DeriveAllSections<AllSections> { function injectFunctions (instanceId: string, api: ApiInterfaceRx, derives: DeriveCustom): ExactDerive {
const queryKeys = Object.keys(api.query); const queryKeys = Object.keys(api.query);
const specName = api.runtimeVersion.specName.toString(); const specName = api.runtimeVersion.specName.toString();
return Object const filterQueryKeys = (q: string) =>
.keys(allSections) queryKeys.includes(q);
.filter((sectionName) =>
!checks[sectionName] || const filterInstances = (q: string) =>
checks[sectionName].instances.some((q) => queryKeys.includes(q)) || getModuleInstances(api, specName, q).some(filterQueryKeys);
(
checks[sectionName].withDetect && const isIncluded = (s: string) => (
checks[sectionName].instances.some((q) => !checks[s] ||
(api.registry.getModuleInstances(specName, q) || []).some((q) => queryKeys.includes(q)) checks[s].instances.some(filterQueryKeys) ||
) (
) checks[s].withDetect &&
checks[s].instances.some(filterInstances)
) )
.reduce((derives, sectionName): DeriveAllSections<AllSections> => { );
const section = allSections[sectionName as keyof AllSections];
derives[sectionName as keyof AllSections] = Object const getKeys = (section: string) =>
.entries(section) Object.keys(derives[section]);
.reduce((methods, [methodName, creator]): DeriveSection<typeof section> => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
methods[methodName as keyof typeof section] = creator(instanceId, api);
return methods; const creator = (section: string, method: string) =>
}, {} as DeriveSection<typeof section>); derives[section][method](instanceId, api);
return derives; const result: Record<string, Record<string, AnyFunction>> = {};
}, {} as DeriveAllSections<AllSections>); const names = Object.keys(derives);
for (let i = 0; i < names.length; i++) {
const name = names[i];
if (isIncluded(name)) {
lazyDeriveSection(result, name, getKeys, creator);
}
}
return result as ExactDerive;
} }
// FIXME The return type of this function should be {...ExactDerive, ...DeriveCustom} // FIXME The return type of this function should be {...ExactDerive, ...DeriveCustom}
// For now we just drop the custom derive typings // For now we just drop the custom derive typings
/** @internal */ /** @internal */
export function decorateDerive (instanceId: string, api: ApiInterfaceRx, custom: DeriveCustom = {}): ExactDerive { export function getAvailableDerives (instanceId: string, api: ApiInterfaceRx, custom: DeriveCustom = {}): ExactDerive {
return { return {
...injectFunctions(instanceId, api, derive), ...injectFunctions(instanceId, api, derive as DeriveCustom),
...injectFunctions(instanceId, api, custom) ...injectFunctions(instanceId, api, custom)
}; };
} }
+10 -2
View File
@@ -25,7 +25,11 @@ function parseEnd (api: ApiInterfaceRx, vote: Vote, { approved, end }: Referendu
return [ return [
end, end,
(approved.isTrue && vote.isAye) || (approved.isFalse && vote.isNay) (approved.isTrue && vote.isAye) || (approved.isFalse && vote.isNay)
? end.add(api.consts.democracy.enactmentPeriod.muln(LOCKUPS[vote.conviction.index])) ? end.add(
(
api.consts.democracy.voteLockingPeriod ||
api.consts.democracy.enactmentPeriod
).muln(LOCKUPS[vote.conviction.index]))
: BN_ZERO : BN_ZERO
]; ];
} }
@@ -50,7 +54,11 @@ function delegateLocks (api: ApiInterfaceRx, { balance, conviction, target }: Vo
referendumId, referendumId,
unlockAt: unlockAt.isZero() unlockAt: unlockAt.isZero()
? unlockAt ? unlockAt
: referendumEnd.add(api.consts.democracy.enactmentPeriod.muln(LOCKUPS[conviction.index])), : referendumEnd.add(
(
api.consts.democracy.voteLockingPeriod ||
api.consts.democracy.enactmentPeriod
).muln(LOCKUPS[conviction.index])),
vote: api.registry.createType('Vote', { aye: vote.isAye, conviction }) vote: api.registry.createType('Vote', { aye: vote.isAye, conviction })
})) }))
) )
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '6.4.2' }; export const packageInfo = { name: '@polkadot/api-derive', version: '6.7.1' };
+16
View File
@@ -0,0 +1,16 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { lazyMethod, lazyMethods } from '@polkadot/util';
type LazySection <T> = Record<string, T>;
type LazyRecord <T> = Record<string, LazySection<T>>;
export function lazyDeriveSection <T> (result: LazyRecord<T>, section: string, getKeys: (s: string) => string[], creator: (s: string, m: string) => T): void {
lazyMethod(result, section, () =>
lazyMethods({}, getKeys(section), (method: string) =>
creator(section, method)
)
);
}
+27 -23
View File
@@ -1,33 +1,37 @@
{ {
"name": "@polkadot/api", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "Promise and RxJS wrappers around the Polkadot JS RPC", "description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/api",
"repository": {
"directory": "packages/api",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/api-derive": "6.4.2", "@polkadot/api-derive": "6.7.1",
"@polkadot/keyring": "^7.5.1", "@polkadot/keyring": "^7.8.2",
"@polkadot/rpc-core": "6.4.2", "@polkadot/rpc-core": "6.7.1",
"@polkadot/rpc-provider": "6.4.2", "@polkadot/rpc-provider": "6.7.1",
"@polkadot/types": "6.4.2", "@polkadot/types": "6.7.1",
"@polkadot/types-known": "6.4.2", "@polkadot/types-known": "6.7.1",
"@polkadot/util": "^7.5.1", "@polkadot/util": "^7.8.2",
"@polkadot/util-crypto": "^7.5.1", "@polkadot/util-crypto": "^7.8.2",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
} }
+4
View File
@@ -1237,6 +1237,10 @@ declare module '@polkadot/api/types/errors' {
[key: string]: AugmentedError<ApiType>; [key: string]: AugmentedError<ApiType>;
}; };
system: { system: {
/**
* The origin filter prevent the call to be dispatched.
**/
CallFiltered: AugmentedError<ApiType>;
/** /**
* Failed to extract the runtime version from the new runtime. * Failed to extract the runtime version from the new runtime.
* *
+16 -2
View File
@@ -108,7 +108,8 @@ declare module '@polkadot/api/types/events' {
**/ **/
BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>; BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>;
/** /**
* Some amount was deposited (e.g. for transaction fees). \[who, deposit\] * Some amount was deposited into the account (e.g. for transaction fees). \[who,
* deposit\]
**/ **/
Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>; Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
@@ -130,6 +131,11 @@ declare module '@polkadot/api/types/events' {
* \[from, to, balance, destination_status\] * \[from, to, balance, destination_status\]
**/ **/
ReserveRepatriated: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>; ReserveRepatriated: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>;
/**
* Some amount was removed from the account (e.g. for misbehavior). \[who,
* amount_slashed\]
**/
Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Transfer succeeded. \[from, to, value\] * Transfer succeeded. \[from, to, value\]
**/ **/
@@ -138,6 +144,10 @@ declare module '@polkadot/api/types/events' {
* Some balance was unreserved (moved from reserved to free). \[who, value\] * Some balance was unreserved (moved from reserved to free). \[who, value\]
**/ **/
Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>; Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
/**
* Some amount was withdrawn from the account (e.g. for transaction fees). \[who, value\]
**/
Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Generic event * Generic event
**/ **/
@@ -572,7 +582,7 @@ declare module '@polkadot/api/types/events' {
**/ **/
MultisigApproval: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>; MultisigApproval: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>;
/** /**
* A multisig operation has been cancelled. \[cancelling, timepoint, multisig, call_hash\] * A multisig operation has been cancelled. \[canceling, timepoint, multisig, call_hash\]
**/ **/
MultisigCancelled: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>; MultisigCancelled: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>;
/** /**
@@ -1136,6 +1146,10 @@ declare module '@polkadot/api/types/events' {
* well as the error. \[index, error\] * well as the error. \[index, error\]
**/ **/
BatchInterrupted: AugmentedEvent<ApiType, [u32, SpRuntimeDispatchError]>; BatchInterrupted: AugmentedEvent<ApiType, [u32, SpRuntimeDispatchError]>;
/**
* A call was dispatched. \[result\]
**/
DispatchedAs: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A single item within a Batch of dispatches has completed with no error. * A single item within a Batch of dispatches has completed with no error.
**/ **/
+16 -2
View File
@@ -4,7 +4,7 @@
import type { ApiTypes } from '@polkadot/api/types'; import type { ApiTypes } from '@polkadot/api/types';
import type { BTreeMap, Bytes, Data, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types'; import type { BTreeMap, Bytes, Data, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types';
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime'; import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeGenericDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup'; import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeGenericDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types'; import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
declare module '@polkadot/api/types/storage' { declare module '@polkadot/api/types/storage' {
@@ -33,6 +33,20 @@ declare module '@polkadot/api/types/storage' {
**/ **/
[key: string]: QueryableStorageEntry<ApiType>; [key: string]: QueryableStorageEntry<ApiType>;
}; };
authorityDiscovery: {
/**
* Keys of the current authority set.
**/
keys: AugmentedQuery<ApiType, () => Observable<Vec<SpAuthorityDiscoveryAppPublic>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Keys of the next authority set.
**/
nextKeys: AugmentedQuery<ApiType, () => Observable<Vec<SpAuthorityDiscoveryAppPublic>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Generic query
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
authorship: { authorship: {
/** /**
* Author of current block. * Author of current block.
@@ -135,7 +149,7 @@ declare module '@polkadot/api/types/storage' {
/** /**
* Randomness under construction. * Randomness under construction.
* *
* We make a tradeoff between storage accesses and list length. * We make a trade-off between storage accesses and list length.
* We store the under-construction randomness in segments of up to * We store the under-construction randomness in segments of up to
* `UNDER_CONSTRUCTION_SEGMENT_LENGTH`. * `UNDER_CONSTRUCTION_SEGMENT_LENGTH`.
* *
+19 -2
View File
@@ -5,7 +5,7 @@ import type { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types'; import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics'; import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime'; import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime';
import type { NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpCoreChangesTrieChangesTrieConfiguration, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeGenericHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup'; import type { NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpCoreChangesTrieChangesTrieConfiguration, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeGenericHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
import type { AnyNumber, ITuple } from '@polkadot/types/types'; import type { AnyNumber, ITuple } from '@polkadot/types/types';
declare module '@polkadot/api/types/submittable' { declare module '@polkadot/api/types/submittable' {
@@ -2567,9 +2567,13 @@ declare module '@polkadot/api/types/submittable' {
session: { session: {
/** /**
* Removes any session key(s) of the function caller. * Removes any session key(s) of the function caller.
*
* This doesn't take effect until the next session. * This doesn't take effect until the next session.
* *
* The dispatch origin of this function must be signed. * The dispatch origin of this function must be Signed and the account must be either be
* convertible to a validator ID using the chain's typical addressing system (this usually
* means being a controller account) or directly convertible into a validator ID (which
* usually means being a stash account).
* *
* # <weight> * # <weight>
* - Complexity: `O(1)` in number of key types. Actual cost depends on the number of length * - Complexity: `O(1)` in number of key types. Actual cost depends on the number of length
@@ -4388,6 +4392,19 @@ declare module '@polkadot/api/types/submittable' {
* # </weight> * # </weight>
**/ **/
batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>; batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
/**
* Dispatches a function call with a provided origin.
*
* The dispatch origin for this call must be _Root_.
*
* # <weight>
* - O(1).
* - Limited storage reads.
* - One DB write (event).
* - 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]>;
/** /**
* Generic tx * Generic tx
**/ **/
+100 -85
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { DeriveCustom } from '@polkadot/api-derive';
import type { RpcInterface } from '@polkadot/rpc-core/types'; import type { RpcInterface } from '@polkadot/rpc-core/types';
import type { Option, Raw, StorageKey, Text, u64 } from '@polkadot/types'; import type { Option, Raw, StorageKey, Text, u64 } from '@polkadot/types';
import type { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces'; import type { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
@@ -9,20 +10,20 @@ import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
import type { StorageEntry } from '@polkadot/types/primitive/types'; import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, CallFunction, Codec, DefinitionRpc, DefinitionRpcSub, DetectCodec, IMethod, IStorageKey, Registry, RegistryError, RegistryTypes } from '@polkadot/types/types'; import type { AnyFunction, AnyTuple, CallFunction, Codec, DefinitionRpc, DefinitionRpcSub, DetectCodec, IMethod, IStorageKey, Registry, RegistryError, RegistryTypes } from '@polkadot/types/types';
import type { SubmittableExtrinsic } from '../submittable/types'; import type { SubmittableExtrinsic } from '../submittable/types';
import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, AugmentedQuery, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecoratedRpcSection, DecorateMethod, GenericStorageEntryFunction, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableModuleStorageAt, QueryableStorage, QueryableStorageAt, QueryableStorageEntry, QueryableStorageEntryAt, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types'; import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, AugmentedQuery, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecorateMethod, GenericStorageEntryFunction, PaginationOptions, QueryableConsts, QueryableStorage, QueryableStorageEntry, QueryableStorageEntryAt, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics } from '../types';
import type { VersionedRegistry } from './types'; import type { VersionedRegistry } from './types';
import { BehaviorSubject, combineLatest, from, map, of, switchMap, tap, toArray } from 'rxjs'; import { BehaviorSubject, combineLatest, from, map, of, switchMap, tap, toArray } from 'rxjs';
import { decorateDerive, ExactDerive } from '@polkadot/api-derive'; import { ExactDerive, getAvailableDerives } from '@polkadot/api-derive';
import { memo, RpcCore } from '@polkadot/rpc-core'; import { memo, RpcCore } from '@polkadot/rpc-core';
import { WsProvider } from '@polkadot/rpc-provider'; import { WsProvider } from '@polkadot/rpc-provider';
import { expandMetadata, Metadata, TypeRegistry, unwrapStorageType } from '@polkadot/types'; import { expandMetadata, Metadata, TypeRegistry, unwrapStorageType } from '@polkadot/types';
import { arrayChunk, arrayFlatten, assert, BN, BN_ZERO, compactStripLength, logger, u8aToHex } from '@polkadot/util'; import { arrayChunk, arrayFlatten, assert, BN, BN_ZERO, compactStripLength, lazyMethod, lazyMethods, logger, objectSpread, u8aToHex } from '@polkadot/util';
import { createSubmittable } from '../submittable'; import { createSubmittable } from '../submittable';
import { augmentObject } from '../util/augmentObject'; import { augmentObject } from '../util/augmentObject';
import { decorateSections, DeriveAllSections } from '../util/decorate'; import { decorateDeriveSections, DeriveAllSections } from '../util/decorate';
import { extractStorageArgs } from '../util/validate'; import { extractStorageArgs } from '../util/validate';
import { Events } from './Events'; import { Events } from './Events';
import { findCall, findError } from './find'; import { findCall, findError } from './find';
@@ -163,7 +164,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this._rx.hasSubscriptions = this._rpcCore.provider.hasSubscriptions; this._rx.hasSubscriptions = this._rpcCore.provider.hasSubscriptions;
} }
public abstract at (blockHash: Uint8Array | string): Promise<ApiDecoration<ApiType>>; public abstract at (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion): Promise<ApiDecoration<ApiType>>;
/** /**
* @description Return the current used registry * @description Return the current used registry
@@ -200,7 +201,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._rpcCore.provider.hasSubscriptions || !!this._rpcCore.state.queryStorageAt; return this._rpcCore.provider.hasSubscriptions || !!this._rpcCore.state.queryStorageAt;
} }
protected _createDecorated (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean, blockHash?: Uint8Array | null, decoratedApi?: ApiDecoration<ApiType>): FullDecoration<ApiType> { protected _createDecorated (registry: VersionedRegistry<ApiType>, fromEmpty: boolean, decoratedApi: ApiDecoration<ApiType> | null, blockHash?: Uint8Array): FullDecoration<ApiType> {
if (!decoratedApi) { if (!decoratedApi) {
decoratedApi = { decoratedApi = {
consts: {}, consts: {},
@@ -218,18 +219,12 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
registry.decoratedMeta = expandMetadata(registry.registry, registry.metadata); registry.decoratedMeta = expandMetadata(registry.registry, registry.metadata);
} }
// adjust the versioned registry const storage = this._decorateStorage(registry.decoratedMeta, this._decorateMethod, blockHash);
const storageRx = this._decorateStorage(registry.decoratedMeta, this._rxDecorateMethod, blockHash);
augmentObject('consts', registry.decoratedMeta.consts, decoratedApi.consts, fromEmpty); augmentObject('consts', registry.decoratedMeta.consts, decoratedApi.consts, fromEmpty);
augmentObject('errors', registry.decoratedMeta.errors, decoratedApi.errors, fromEmpty); augmentObject('errors', registry.decoratedMeta.errors, decoratedApi.errors, fromEmpty);
augmentObject('events', registry.decoratedMeta.events, decoratedApi.events, fromEmpty); augmentObject('events', registry.decoratedMeta.events, decoratedApi.events, fromEmpty);
const storage = blockHash
? this._decorateStorageAt(registry.decoratedMeta, this._decorateMethod, blockHash)
: this._decorateStorage(registry.decoratedMeta, this._decorateMethod);
const storageRx = blockHash
? this._decorateStorageAt(registry.decoratedMeta, this._rxDecorateMethod, blockHash)
: this._decorateStorage(registry.decoratedMeta, this._rxDecorateMethod);
augmentObject('query', storage, decoratedApi.query, fromEmpty); augmentObject('query', storage, decoratedApi.query, fromEmpty);
augmentObject('query', storageRx, decoratedApi.rx.query, fromEmpty); augmentObject('query', storageRx, decoratedApi.rx.query, fromEmpty);
@@ -247,7 +242,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}; };
} }
protected _injectMetadata (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean): void { protected _injectMetadata (registry: VersionedRegistry<ApiType>, fromEmpty = false): void {
// clear the decoration, we are redoing it here // clear the decoration, we are redoing it here
if (fromEmpty || !registry.decoratedApi) { if (fromEmpty || !registry.decoratedApi) {
registry.decoratedApi = { registry.decoratedApi = {
@@ -262,7 +257,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
} as ApiDecoration<ApiType>; } as ApiDecoration<ApiType>;
} }
const { decoratedApi, decoratedMeta } = this._createDecorated(registry, fromEmpty, null, registry.decoratedApi); const { decoratedApi, decoratedMeta } = this._createDecorated(registry, fromEmpty, registry.decoratedApi);
this._consts = decoratedApi.consts; this._consts = decoratedApi.consts;
this._errors = decoratedApi.errors; this._errors = decoratedApi.errors;
@@ -270,12 +265,15 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this._query = decoratedApi.query; this._query = decoratedApi.query;
this._rx.query = decoratedApi.rx.query; this._rx.query = decoratedApi.rx.query;
const tx = this._decorateExtrinsics(decoratedMeta, this._decorateMethod);
const rxtx = this._decorateExtrinsics(decoratedMeta, this._rxDecorateMethod);
if (fromEmpty || !this._extrinsics) { if (fromEmpty || !this._extrinsics) {
this._extrinsics = this._decorateExtrinsics(decoratedMeta, this._decorateMethod); this._extrinsics = tx;
this._rx.tx = this._decorateExtrinsics(decoratedMeta, this._rxDecorateMethod); this._rx.tx = rxtx;
} else { } else {
augmentObject('tx', this._decorateExtrinsics(decoratedMeta, this._decorateMethod), this._extrinsics, false); augmentObject('tx', tx, this._extrinsics, false);
augmentObject(null, this._decorateExtrinsics(decoratedMeta, this._rxDecorateMethod), this._rx.tx, false); augmentObject(null, rxtx, this._rx.tx, false);
} }
augmentObject(null, decoratedMeta.consts, this._rx.consts, fromEmpty); augmentObject(null, decoratedMeta.consts, this._rx.consts, fromEmpty);
@@ -322,7 +320,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
protected _filterRpcMethods (exposed: string[]): void { protected _filterRpcMethods (exposed: string[]): void {
const hasResults = exposed.length !== 0; const hasResults = exposed.length !== 0;
const allKnown = [...this._rpcCore.mapping.entries()]; const allKnown = [...this._rpcCore.mapping.entries()];
const allKeys = allKnown.reduce((allKeys: string[], [, { alias, endpoint, method, pubsub, section }]): string[] => { const allKeys: string[] = [];
for (let i = 0; i < allKnown.length; i++) {
const [, { alias, endpoint, method, pubsub, section }] = allKnown[i];
allKeys.push(`${section}_${method}`); allKeys.push(`${section}_${method}`);
if (pubsub) { if (pubsub) {
@@ -337,11 +339,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
if (endpoint) { if (endpoint) {
allKeys.push(endpoint); allKeys.push(endpoint);
} }
}
return allKeys; const filterKey = (k: string) => !allKeys.includes(k);
}, []); const unknown = exposed.filter(filterKey);
const unknown = exposed.filter((k) => !allKeys.includes(k));
const deletion = allKnown.filter(([k]) => hasResults && !exposed.includes(k) && k !== 'rpc_methods');
if (unknown.length) { if (unknown.length) {
l.warn(`RPC methods not decorated: ${unknown.join(', ')}`); l.warn(`RPC methods not decorated: ${unknown.join(', ')}`);
@@ -349,36 +350,54 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
// loop through all entries we have (populated in decorate) and filter as required // loop through all entries we have (populated in decorate) and filter as required
// only remove when we have results and method missing, or with no results if optional // only remove when we have results and method missing, or with no results if optional
deletion.forEach(([, { method, section }]): void => { for (let i = 0; i < allKnown.length; i++) {
delete (this._rpc as Record<string, Record<string, unknown>>)[section][method]; const [k, { method, section }] = allKnown[i];
delete (this._rx.rpc as Record<string, Record<string, unknown>>)[section][method];
}); if (hasResults && !exposed.includes(k) && k !== 'rpc_methods') {
delete (this._rpc as Record<string, Record<string, unknown>>)[section][method];
delete (this._rx.rpc as Record<string, Record<string, unknown>>)[section][method];
}
}
} }
protected _decorateRpc<ApiType extends ApiTypes> (rpc: RpcCore & RpcInterface, decorateMethod: DecorateMethod<ApiType>, input: Partial<DecoratedRpc<ApiType, RpcInterface>> = {}): DecoratedRpc<ApiType, RpcInterface> { protected _decorateRpc<ApiType extends ApiTypes> (rpc: RpcCore & RpcInterface, decorateMethod: DecorateMethod<ApiType>, input: Partial<DecoratedRpc<ApiType, RpcInterface>> = {}): DecoratedRpc<ApiType, RpcInterface> {
return rpc.sections.reduce((out, _sectionName): DecoratedRpc<ApiType, RpcInterface> => { const out: Record<string, Record<string, unknown>> = input;
const sectionName = _sectionName as keyof DecoratedRpc<ApiType, RpcInterface>;
const decorateFn = (section: string, method: string): unknown => {
const source = rpc[section as 'chain'][method as 'getHeader'];
const fn = decorateMethod(source, { methodName: method }) as Record<string, unknown>;
fn.meta = source.meta;
fn.raw = decorateMethod(source.raw, { methodName: method }) as unknown;
return fn;
};
for (let s = 0; s < rpc.sections.length; s++) {
const section = rpc.sections[s];
if (!Object.prototype.hasOwnProperty.call(out, section)) {
const methods = Object.keys(rpc[section as 'chain']);
const decorateInternal = (method: string) =>
decorateFn(section, method);
for (let m = 0; m < methods.length; m++) {
const method = methods[m];
if (!(out as Record<string, unknown>)[sectionName]) {
// out and section here are horrors to get right from a typing perspective :(
(out as Record<string, unknown>)[sectionName] = Object.entries(rpc[sectionName]).reduce((section, [methodName, method]): DecoratedRpcSection<ApiType, RpcInterface[typeof sectionName]> => {
// skip subscriptions where we have a non-subscribe interface // skip subscriptions where we have a non-subscribe interface
if (this.hasSubscriptions || !(methodName.startsWith('subscribe') || methodName.startsWith('unsubscribe'))) { if (this.hasSubscriptions || !(method.startsWith('subscribe') || method.startsWith('unsubscribe'))) {
(section as Record<string, unknown>)[methodName] = decorateMethod(method, { methodName }) as unknown; if (!Object.prototype.hasOwnProperty.call(out, section)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access out[section] = {};
(section as Record<string, { json: unknown }>)[methodName].json = decorateMethod(method.json, { methodName }) as unknown; }
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(section as Record<string, { raw: unknown }>)[methodName].raw = decorateMethod(method.raw, { methodName }) as unknown; lazyMethod(out[section], method, decorateInternal);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(section as Record<string, { meta: unknown }>)[methodName].meta = method.meta;
} }
}
return section;
}, {} as DecoratedRpcSection<ApiType, RpcInterface[typeof sectionName]>);
} }
}
return out; return out as DecoratedRpc<ApiType, RpcInterface>;
}, input as DecoratedRpc<ApiType, RpcInterface>);
} }
// only be called if supportMulti is true // only be called if supportMulti is true
@@ -419,17 +438,20 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
} }
protected _decorateExtrinsics<ApiType extends ApiTypes> ({ tx }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): SubmittableExtrinsics<ApiType> { protected _decorateExtrinsics<ApiType extends ApiTypes> ({ tx }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): SubmittableExtrinsics<ApiType> {
const creator = createSubmittable(this._type, this._rx, decorateMethod); const result = createSubmittable(this._type, this._rx, decorateMethod) as SubmittableExtrinsics<ApiType>;
return Object.entries(tx).reduce((out, [name, section]): SubmittableExtrinsics<ApiType> => { const lazySection = (section: string) =>
out[name] = Object.entries(section).reduce((out, [name, method]): SubmittableModuleExtrinsics<ApiType> => { lazyMethods({}, Object.keys(tx[section]), (method: string) =>
out[name] = this._decorateExtrinsicEntry(method, creator); this._decorateExtrinsicEntry(tx[section][method], result)
);
return out; const sections = Object.keys(tx);
}, {} as SubmittableModuleExtrinsics<ApiType>);
return out; for (let i = 0; i < sections.length; i++) {
}, creator as SubmittableExtrinsics<ApiType>); lazyMethod(result, sections[i], lazySection);
}
return result;
} }
private _decorateExtrinsicEntry<ApiType extends ApiTypes> (method: CallFunction, creator: (value: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>): SubmittableExtrinsicFunction<ApiType> { private _decorateExtrinsicEntry<ApiType extends ApiTypes> (method: CallFunction, creator: (value: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>): SubmittableExtrinsicFunction<ApiType> {
@@ -444,28 +466,23 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._decorateFunctionMeta(method as unknown as MetaDecoration, decorated as unknown as MetaDecoration) as unknown as SubmittableExtrinsicFunction<ApiType>; return this._decorateFunctionMeta(method as unknown as MetaDecoration, decorated as unknown as MetaDecoration) as unknown as SubmittableExtrinsicFunction<ApiType>;
} }
protected _decorateStorage<ApiType extends ApiTypes> ({ query }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): QueryableStorage<ApiType> { protected _decorateStorage<ApiType extends ApiTypes> ({ query, registry }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>, blockHash?: Uint8Array): QueryableStorage<ApiType> {
return Object.entries(query).reduce((out, [name, section]): QueryableStorage<ApiType> => { const result = {} as QueryableStorage<ApiType>;
out[name] = Object.entries(section).reduce((out, [name, method]): QueryableModuleStorage<ApiType> => {
out[name] = this._decorateStorageEntry(method, decorateMethod);
return out; const lazySection = (section: string) =>
}, {} as QueryableModuleStorage<ApiType>); lazyMethods({}, Object.keys(query[section]), (method: string) =>
blockHash
? this._decorateStorageEntryAt(registry, query[section][method], decorateMethod, blockHash)
: this._decorateStorageEntry(query[section][method], decorateMethod)
);
return out; const sections = Object.keys(query);
}, {} as QueryableStorage<ApiType>);
}
protected _decorateStorageAt<ApiType extends ApiTypes> ({ query, registry }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array): QueryableStorageAt<ApiType> { for (let i = 0; i < sections.length; i++) {
return Object.entries(query).reduce((out, [name, section]): QueryableStorageAt<ApiType> => { lazyMethod(result, sections[i], lazySection);
out[name] = Object.entries(section).reduce((out, [name, method]): QueryableModuleStorageAt<ApiType> => { }
out[name] = this._decorateStorageEntryAt(registry, method, decorateMethod, blockHash);
return out; return result;
}, {} as QueryableModuleStorageAt<ApiType>);
return out;
}, {} as QueryableStorageAt<ApiType>);
} }
private _decorateStorageEntry<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): QueryableStorageEntry<ApiType> { private _decorateStorageEntry<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): QueryableStorageEntry<ApiType> {
@@ -622,9 +639,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._rpcCore.state return this._rpcCore.state
.queryStorage<[Option<Raw>]>([decorated.key(...args)], ...range) .queryStorage<[Option<Raw>]>([decorated.key(...args)], ...range)
.pipe(map((result: [Hash, [Option<Raw>]][]): [Hash, Codec][] => .pipe(map((result: [Hash, [Option<Raw>]][]): [Hash, Codec][] =>
result.map(([blockHash, [value]]): [Hash, Codec] => [ result.map(([blockHash, [value]]) => [
blockHash, blockHash,
this.createType(outputType, value.isSome ? value.unwrap().toHex() : undefined) this.createType<Codec>(outputType, value.isSome ? value.unwrap().toHex() : undefined)
]) ])
)); ));
} }
@@ -654,10 +671,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
const queryCall = at const queryCall = at
? (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey, at) ? (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey, at)
: (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey); : (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey);
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
return startSubject.pipe( return startSubject.pipe(
switchMap(queryCall), switchMap(queryCall),
map((keys) => keys.map((key) => key.setMeta(meta, section, method))), map((keys) => keys.map(setMeta)),
tap((keys): void => { tap((keys): void => {
setTimeout((): void => { setTimeout((): void => {
keys.length === PAGE_SIZE_K keys.length === PAGE_SIZE_K
@@ -674,9 +692,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
assert(iterKey && meta.type.isMap, 'keys can only be retrieved on maps'); assert(iterKey && meta.type.isMap, 'keys can only be retrieved on maps');
const headKey = iterKey(...opts.args).toHex(); const headKey = iterKey(...opts.args).toHex();
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
return this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey).pipe( return this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey).pipe(
map((keys) => keys.map((key) => key.setMeta(meta, section, method))) map((keys) => keys.map(setMeta))
); );
} }
@@ -714,19 +733,15 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
protected _decorateDeriveRx (decorateMethod: DecorateMethod<ApiType>): DeriveAllSections<'rxjs', ExactDerive> { protected _decorateDeriveRx (decorateMethod: DecorateMethod<ApiType>): DeriveAllSections<'rxjs', ExactDerive> {
const specName = this._runtimeVersion?.specName.toString(); const specName = this._runtimeVersion?.specName.toString();
const derives = {
...this._options.derives,
...(this._options.typesBundle?.spec?.[specName || '']?.derives || {})
};
// Pull in derive from api-derive // Pull in derive from api-derive
const derive = decorateDerive(this.#instanceId, this._rx, derives); const available = getAvailableDerives(this.#instanceId, this._rx, objectSpread<DeriveCustom>({}, this._options.derives, this._options.typesBundle?.spec?.[specName || '']?.derives));
return decorateSections<'rxjs', ExactDerive>(derive, decorateMethod); return decorateDeriveSections<'rxjs', ExactDerive>(decorateMethod, available);
} }
protected _decorateDerive (decorateMethod: DecorateMethod<ApiType>): DeriveAllSections<ApiType, ExactDerive> { protected _decorateDerive (decorateMethod: DecorateMethod<ApiType>): DeriveAllSections<ApiType, ExactDerive> {
return decorateSections<ApiType, ExactDerive>(this._rx.derive, decorateMethod); return decorateDeriveSections<ApiType, ExactDerive>(decorateMethod, this._rx.derive);
} }
/** /**
+54 -31
View File
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable, Subscription } from 'rxjs'; import type { Observable, Subscription } from 'rxjs';
import type { RpcInterfaceMethod } from '@polkadot/rpc-core/types';
import type { Text } from '@polkadot/types'; import type { Text } from '@polkadot/types';
import type { ChainProperties, Hash, RuntimeVersion } from '@polkadot/types/interfaces'; import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
import type { ChainProperties, Hash, RuntimeVersion, RuntimeVersionPartial } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types/types'; import type { Registry } from '@polkadot/types/types';
import type { BN } from '@polkadot/util'; import type { BN } from '@polkadot/util';
import type { ApiBase, ApiDecoration, ApiOptions, ApiTypes, DecorateMethod } from '../types'; import type { ApiBase, ApiDecoration, ApiOptions, ApiTypes, DecorateMethod } from '../types';
@@ -14,7 +14,7 @@ import { firstValueFrom, map, of, switchMap } from 'rxjs';
import { Metadata, TypeRegistry } from '@polkadot/types'; import { Metadata, TypeRegistry } from '@polkadot/types';
import { getSpecAlias, getSpecExtensions, getSpecHasher, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known'; import { getSpecAlias, getSpecExtensions, getSpecHasher, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
import { assert, BN_ZERO, isUndefined, logger, stringify, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util'; import { assert, BN_ZERO, isUndefined, logger, objectSpread, stringify, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto'; import { cryptoWaitReady } from '@polkadot/util-crypto';
import { detectedCapabilities } from './capabilities'; import { detectedCapabilities } from './capabilities';
@@ -24,6 +24,10 @@ const KEEPALIVE_INTERVAL = 10000;
const l = logger('api/init'); const l = logger('api/init');
function textToString (t: Text): string {
return t.toString();
}
export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> { export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
#healthTimer: NodeJS.Timeout | null = null; #healthTimer: NodeJS.Timeout | null = null;
@@ -91,10 +95,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
registry.knownTypes.typesAlias = getSpecAlias(registry, chain, version.specName); registry.knownTypes.typesAlias = getSpecAlias(registry, chain, version.specName);
} }
registry.setMetadata(metadata, undefined, { registry.setMetadata(metadata, undefined, objectSpread<ExtDef>({}, getSpecExtensions(registry, chain, version.specName), this._options.signedExtensions));
...getSpecExtensions(registry, chain, version.specName),
...(this._options.signedExtensions || {})
});
} }
/** /**
@@ -112,13 +113,32 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
/** /**
* @description Returns a decorated API instance at a specific point in time * @description Returns a decorated API instance at a specific point in time
*/ */
public async at (blockHash: Uint8Array | string): Promise<ApiDecoration<ApiType>> { public async at (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion): Promise<ApiDecoration<ApiType>> {
const u8aHash = u8aToU8a(blockHash); const u8aHash = u8aToU8a(blockHash);
const registry = await this.getBlockRegistry(u8aHash); const registry = await this.getBlockRegistry(u8aHash, knownVersion);
// always create a new decoration - since we are pointing to a specific hash, this // always create a new decoration - since we are pointing to a specific hash, this
// means that all queries needs to use that hash (not a previous one already existing) // means that all queries needs to use that hash (not a previous one already existing)
return this._createDecorated(registry, true, u8aHash).decoratedApi; return this._createDecorated(registry, true, null, u8aHash).decoratedApi;
}
private _getBlockRegistryViaVersion (blockHash: Uint8Array, version?: RuntimeVersionPartial): VersionedRegistry<ApiType> | null {
if (version) {
// check for pre-existing registries. We also check specName, e.g. it
// could be changed like in Westmint with upgrade from shell -> westmint
const existingViaVersion = this.#registries.find(({ specName, specVersion }) =>
specName.eq(version.specName) &&
specVersion.eq(version.specVersion)
);
if (existingViaVersion) {
existingViaVersion.lastBlockHash = blockHash;
return existingViaVersion;
}
}
return null;
} }
private async _getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> { private async _getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
@@ -130,7 +150,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
const header = this.registry.createType('HeaderPartial', const header = this.registry.createType('HeaderPartial',
this._genesisHash.eq(blockHash) this._genesisHash.eq(blockHash)
? { number: BN_ZERO, parentHash: this._genesisHash } ? { number: BN_ZERO, parentHash: this._genesisHash }
: await firstValueFrom((this._rpcCore.chain.getHeader as RpcInterfaceMethod).json(blockHash)) : await firstValueFrom(this._rpcCore.chain.getHeader.raw(blockHash))
); );
assert(!header.parentHash.isEmpty, 'Unable to retrieve header and parent from supplied hash'); assert(!header.parentHash.isEmpty, 'Unable to retrieve header and parent from supplied hash');
@@ -140,26 +160,19 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
const version = this.registry.createType('RuntimeVersionPartial', const version = this.registry.createType('RuntimeVersionPartial',
(firstVersion && (lastVersion || firstVersion.specVersion.eq(this._runtimeVersion.specVersion))) (firstVersion && (lastVersion || firstVersion.specVersion.eq(this._runtimeVersion.specVersion)))
? { specName: this._runtimeVersion.specName, specVersion: firstVersion.specVersion } ? { specName: this._runtimeVersion.specName, specVersion: firstVersion.specVersion }
: await firstValueFrom((this._rpcCore.state.getRuntimeVersion as RpcInterfaceMethod).json(header.parentHash)) : await firstValueFrom(this._rpcCore.state.getRuntimeVersion.raw(header.parentHash))
); );
// check for pre-existing registries. We also check specName, e.g. it const existingViaVersion = this._getBlockRegistryViaVersion(blockHash, version);
// could be changed like in Westmint with upgrade from shell -> westmint
const existingViaVersion = this.#registries.find(({ specName, specVersion }) =>
specName.eq(version.specName) &&
specVersion.eq(version.specVersion)
);
if (existingViaVersion) { if (existingViaVersion) {
existingViaVersion.lastBlockHash = blockHash;
return existingViaVersion; return existingViaVersion;
} }
// nothing has been found, construct new // nothing has been found, construct new
const registry = new TypeRegistry(blockHash); const registry = new TypeRegistry(blockHash);
const metadata = new Metadata(registry, const metadata = new Metadata(registry,
await firstValueFrom((this._rpcCore.state.getMetadata as RpcInterfaceMethod).raw(header.parentHash)) await firstValueFrom(this._rpcCore.state.getMetadata.raw<string>(header.parentHash))
); );
this._initRegistry(registry, this._runtimeChain as Text, version, metadata); this._initRegistry(registry, this._runtimeChain as Text, version, metadata);
@@ -175,7 +188,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
/** /**
* @description Sets up a registry based on the block hash defined * @description Sets up a registry based on the block hash defined
*/ */
public async getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> { public async getBlockRegistry (blockHash: Uint8Array, knownVersion?: RuntimeVersion): Promise<VersionedRegistry<ApiType>> {
const existingViaHash = this.#registries.find(({ lastBlockHash }) => const existingViaHash = this.#registries.find(({ lastBlockHash }) =>
lastBlockHash && u8aEq(lastBlockHash, blockHash) lastBlockHash && u8aEq(lastBlockHash, blockHash)
); );
@@ -184,6 +197,12 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
return existingViaHash; return existingViaHash;
} }
const existingViaVersion = this._getBlockRegistryViaVersion(blockHash, knownVersion);
if (existingViaVersion) {
return existingViaVersion;
}
const blockHashHex = u8aToHex(blockHash); const blockHashHex = u8aToHex(blockHash);
let waiting = this.#waitingRegistries[blockHashHex]; let waiting = this.#waitingRegistries[blockHashHex];
@@ -225,17 +244,21 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
this._runtimeChain = source.runtimeChain; this._runtimeChain = source.runtimeChain;
this._runtimeVersion = source.runtimeVersion; this._runtimeVersion = source.runtimeVersion;
const methods: string[] = [];
// manually build a list of all available methods in this RPC, we are // manually build a list of all available methods in this RPC, we are
// going to filter on it to align the cloned RPC without making a call // going to filter on it to align the cloned RPC without making a call
Object.keys(source.rpc).forEach((section): void => { const sections = Object.keys(source.rpc);
Object.keys((source.rpc as Record<string, Record<string, unknown>>)[section]).forEach((method): void => { const rpcs: string[] = [];
methods.push(`${section}_${method}`);
});
});
this._filterRpc(methods, getSpecRpc(this.registry, source.runtimeChain, source.runtimeVersion.specName)); for (let s = 0; s < sections.length; s++) {
const section = sections[s];
const methods = Object.keys((source.rpc as Record<string, Record<string, unknown>>)[section]);
for (let m = 0; m < methods.length; m++) {
rpcs.push(`${section}_${methods[m]}`);
}
}
this._filterRpc(rpcs, getSpecRpc(this.registry, source.runtimeChain, source.runtimeVersion.specName));
return [source.genesisHash, source.runtimeMetadata]; return [source.genesisHash, source.runtimeMetadata];
} }
@@ -318,7 +341,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// initializes the registry & RPC // initializes the registry & RPC
this._initRegistry(this.registry, chain, runtimeVersion, metadata, chainProps); this._initRegistry(this.registry, chain, runtimeVersion, metadata, chainProps);
this._filterRpc(rpcMethods.methods.map((t) => t.toString()), getSpecRpc(this.registry, chain, runtimeVersion.specName)); this._filterRpc(rpcMethods.methods.map(textToString), getSpecRpc(this.registry, chain, runtimeVersion.specName));
this._subscribeUpdates(); this._subscribeUpdates();
// setup the initial registry, when we have none // setup the initial registry, when we have none
+1 -1
View File
@@ -182,7 +182,7 @@ export function detectedCapabilities (api: ApiInterfaceRx, blockHash?: Uint8Arra
}, },
extractResults<ExtractedC>(cResults, consts), extractResults<ExtractedC>(cResults, consts),
extractResults<ExtractedQ>(qResults, queries), extractResults<ExtractedQ>(qResults, queries),
extractResults<ExtractedR>(rResults, raws) extractResults<ExtractedR>(rResults.map((r) => api.registry.createType('Raw', r)), raws)
) )
), ),
take(1), take(1),
+4 -6
View File
@@ -4,7 +4,7 @@
import type { SignerPayloadRawBase } from '@polkadot/types/types'; import type { SignerPayloadRawBase } from '@polkadot/types/types';
import type { ApiOptions, ApiTypes, DecorateMethod, Signer } from '../types'; import type { ApiOptions, ApiTypes, DecorateMethod, Signer } from '../types';
import { assert, isString, u8aToHex, u8aToU8a } from '@polkadot/util'; import { assert, isString, objectSpread, u8aToHex, u8aToU8a } from '@polkadot/util';
import { Getters } from './Getters'; import { Getters } from './Getters';
@@ -72,11 +72,9 @@ export abstract class ApiBase<ApiType extends ApiTypes> extends Getters<ApiType>
assert(_signer?.signRaw, 'No signer exists with a signRaw interface. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.'); assert(_signer?.signRaw, 'No signer exists with a signRaw interface. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.');
return ( return (
await _signer.signRaw({ await _signer.signRaw(
type: 'bytes', objectSpread({ type: 'bytes' }, data, { address })
...data, )
address
})
).signature; ).signature;
} }
+1 -3
View File
@@ -177,12 +177,10 @@ async function rpc (api: ApiPromise): Promise<void> {
}); });
// using json & raw // using json & raw
await api.rpc.chain.getBlock.json('0x123456');
await api.rpc.chain.getBlock.raw('0x123456'); await api.rpc.chain.getBlock.raw('0x123456');
// using raw subs // using raw subs
// eslint-disable-next-line @typescript-eslint/no-floating-promises await api.rpc.chain.subscribeNewHeads.raw((result: Uint8Array): void => {
api.rpc.chain.subscribeNewHeads.raw((result: Uint8Array): void => {
console.log(result); console.log(result);
}); });
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '6.4.2' }; export const packageInfo = { name: '@polkadot/api', version: '6.7.1' };
+4 -5
View File
@@ -7,7 +7,7 @@ import type { ApiOptions, DecorateFn, DecorateMethodOptions, ObsInnerType, Stora
import { catchError, EMPTY, Subscription, tap } from 'rxjs'; import { catchError, EMPTY, Subscription, tap } from 'rxjs';
import { assert, isFunction } from '@polkadot/util'; import { assert, isFunction, objectSpread } from '@polkadot/util';
import { ApiBase } from '../base'; import { ApiBase } from '../base';
import { Combinator, CombinatorCallback, CombinatorFunction } from './Combinator'; import { Combinator, CombinatorCallback, CombinatorFunction } from './Combinator';
@@ -277,10 +277,9 @@ export class ApiPromise extends ApiBase<'promise'> {
* @description Returns a clone of this ApiPromise instance (new underlying provider connection) * @description Returns a clone of this ApiPromise instance (new underlying provider connection)
*/ */
public clone (): ApiPromise { public clone (): ApiPromise {
return new ApiPromise({ return new ApiPromise(
...this._options, objectSpread({}, this._options, { source: this })
source: this );
});
} }
/** /**
+5 -4
View File
@@ -6,6 +6,8 @@ import type { ApiOptions, DecorateFn } from '../types';
import { from, Observable } from 'rxjs'; import { from, Observable } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { ApiBase } from '../base'; import { ApiBase } from '../base';
export function decorateMethod <Method extends DecorateFn<Codec>> (method: Method): Method { export function decorateMethod <Method extends DecorateFn<Codec>> (method: Method): Method {
@@ -180,9 +182,8 @@ export class ApiRx extends ApiBase<'rxjs'> {
* @description Returns a clone of this ApiRx instance (new underlying provider connection) * @description Returns a clone of this ApiRx instance (new underlying provider connection)
*/ */
public clone (): ApiRx { public clone (): ApiRx {
return new ApiRx({ return new ApiRx(
...this._options, objectSpread({}, this._options, { source: this })
source: this );
});
} }
} }
+17 -10
View File
@@ -9,22 +9,29 @@ const recordIdentity = (record: EventRecord) => record;
function filterAndApply <T> (events: EventRecord[], section: string, methods: string[], onFound: (record: EventRecord) => T): T[] { function filterAndApply <T> (events: EventRecord[], section: string, methods: string[], onFound: (record: EventRecord) => T): T[] {
return events return events
.filter(({ event }) => section === event.section && methods.includes(event.method)) .filter(({ event }) =>
section === event.section &&
methods.includes(event.method)
)
.map((record) => onFound(record)); .map((record) => onFound(record));
} }
function getDispatchError ({ event: { data: [dispatchError] } }: EventRecord): DispatchError {
return dispatchError as DispatchError;
}
function getDispatchInfo ({ event: { data, method } }: EventRecord): DispatchInfo {
return method === 'ExtrinsicSuccess'
? data[0] as DispatchInfo
: data[1] as DispatchInfo;
}
function extractError (events: EventRecord[] = []): DispatchError | undefined { function extractError (events: EventRecord[] = []): DispatchError | undefined {
return filterAndApply(events, 'system', ['ExtrinsicFailed'], ({ event: { data } }) => return filterAndApply(events, 'system', ['ExtrinsicFailed'], getDispatchError)[0];
data[0] as DispatchError
)[0];
} }
function extractInfo (events: EventRecord[] = []): DispatchInfo | undefined { function extractInfo (events: EventRecord[] = []): DispatchInfo | undefined {
return filterAndApply(events, 'system', ['ExtrinsicFailed', 'ExtrinsicSuccess'], ({ event: { data, method } }) => return filterAndApply(events, 'system', ['ExtrinsicFailed', 'ExtrinsicSuccess'], getDispatchInfo)[0];
method === 'ExtrinsicSuccess'
? data[0] as DispatchInfo
: data[1] as DispatchInfo
)[0];
} }
export class SubmittableResult implements ISubmittableResult { export class SubmittableResult implements ISubmittableResult {
@@ -87,7 +94,7 @@ export class SubmittableResult implements ISubmittableResult {
return { return {
dispatchError: this.dispatchError?.toHuman(), dispatchError: this.dispatchError?.toHuman(),
dispatchInfo: this.dispatchInfo?.toHuman(), dispatchInfo: this.dispatchInfo?.toHuman(),
events: this.events.map((event) => event.toHuman(isExtended)), events: this.events.map((e) => e.toHuman(isExtended)),
internalError: this.internalError?.message.toString(), internalError: this.internalError?.message.toString(),
status: this.status.toHuman(isExtended) status: this.status.toHuman(isExtended)
}; };
+75 -74
View File
@@ -11,7 +11,7 @@ import type { AddressOrPair, SignerOptions, SubmittableDryRunResult, Submittable
import { catchError, first, map, mapTo, mergeMap, of, switchMap, tap } from 'rxjs'; import { catchError, first, map, mapTo, mergeMap, of, switchMap, tap } from 'rxjs';
import { assert, isBn, isFunction, isNumber, isString, isU8a } from '@polkadot/util'; import { assert, isBn, isFunction, isNumber, isString, isU8a, objectSpread } from '@polkadot/util';
import { ApiBase } from '../base'; import { ApiBase } from '../base';
import { filterEvents, isKeyringPair } from '../util'; import { filterEvents, isKeyringPair } from '../util';
@@ -25,6 +25,55 @@ interface SubmittableOptions<ApiType extends ApiTypes> {
const identity = <T> (input: T): T => input; const identity = <T> (input: T): T => input;
function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions {
if (!header) {
if (isNumber(partialOptions.era)) {
// since we have no header, it is immortal, remove any option overrides
// so we only supply the genesisHash and no era to the construction
delete partialOptions.era;
delete partialOptions.blockHash;
}
return makeSignOptions(api, partialOptions, { nonce });
}
return makeSignOptions(api, partialOptions, {
blockHash: header.hash,
era: registry.createType('ExtrinsicEra', {
current: header.number,
period: partialOptions.era || mortalLength
}),
nonce
});
}
function makeSignAndSendOptions (partialOptions?: Partial<SignerOptions> | Callback<ISubmittableResult>, statusCb?: Callback<ISubmittableResult>): [Partial<SignerOptions>, Callback<ISubmittableResult>?] {
let options: Partial<SignerOptions> = {};
if (isFunction(partialOptions)) {
statusCb = partialOptions;
} else {
options = objectSpread({}, partialOptions);
}
return [options, statusCb];
}
function makeSignOptions (api: ApiInterfaceRx, partialOptions: Partial<SignerOptions>, extras: { blockHash?: Hash; era?: ExtrinsicEra; nonce?: Index }): SignatureOptions {
return objectSpread(
{ blockHash: api.genesisHash, genesisHash: api.genesisHash },
partialOptions,
extras,
{ runtimeVersion: api.runtimeVersion, signedExtensions: api.registry.signedExtensions, version: api.extrinsicType }
);
}
function optionsOrNonce (partialOptions: Partial<SignerOptions> = {}): Partial<SignerOptions> {
return isBn(partialOptions) || isNumber(partialOptions)
? { nonce: partialOptions }
: partialOptions;
}
export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorateMethod }: SubmittableOptions<ApiType>): Constructor<SubmittableExtrinsic<ApiType>> { export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorateMethod }: SubmittableOptions<ApiType>): Constructor<SubmittableExtrinsic<ApiType>> {
// an instance of the base extrinsic for us to extend // an instance of the base extrinsic for us to extend
const ExtrinsicBase = api.registry.createClass('Extrinsic'); const ExtrinsicBase = api.registry.createClass('Extrinsic');
@@ -67,7 +116,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
); );
} }
const [allOptions] = this.#makeSignAndSendOptions(optionsOrHash); const [allOptions] = makeSignAndSendOptions(optionsOrHash);
const address = isKeyringPair(account) ? account.address : account.toString(); const address = isKeyringPair(account) ? account.address : account.toString();
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
@@ -77,8 +126,8 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
first(), first(),
switchMap((signingInfo): Observable<RuntimeDispatchInfo> => { switchMap((signingInfo): Observable<RuntimeDispatchInfo> => {
// setup our options (same way as in signAndSend) // setup our options (same way as in signAndSend)
const eraOptions = this.#makeEraOptions(allOptions, signingInfo); const eraOptions = makeEraOptions(api, this.registry, allOptions, signingInfo);
const signOptions = this.#makeSignOptions(eraOptions, {}); const signOptions = makeSignOptions(api, eraOptions, {});
this.signFake(address, signOptions); this.signFake(address, signOptions);
@@ -110,8 +159,8 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
* @description Sign a transaction, returning the this to allow chaining, i.e. .sign(...).send(). When options, e.g. nonce/blockHash are not specified, it will be inferred. To retrieve eg. nonce use `signAsync` (the preferred interface, this is provided for backwards compatibility) * @description Sign a transaction, returning the this to allow chaining, i.e. .sign(...).send(). When options, e.g. nonce/blockHash are not specified, it will be inferred. To retrieve eg. nonce use `signAsync` (the preferred interface, this is provided for backwards compatibility)
* @deprecated * @deprecated
*/ */
public override sign (account: IKeyringPair, optionsOrNonce?: Partial<SignerOptions>): this { public override sign (account: IKeyringPair, partialOptions?: Partial<SignerOptions>): this {
super.sign(account, this.#makeSignOptions(this.#optionsOrNonce(optionsOrNonce), {})); super.sign(account, makeSignOptions(api, optionsOrNonce(partialOptions), {}));
return this; return this;
} }
@@ -119,26 +168,28 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
/** /**
* @description Signs a transaction, returning `this` to allow chaining. E.g.: `sign(...).send()`. Like `.signAndSend` this will retrieve the nonce and blockHash to send the tx with. * @description Signs a transaction, returning `this` to allow chaining. E.g.: `sign(...).send()`. Like `.signAndSend` this will retrieve the nonce and blockHash to send the tx with.
*/ */
public signAsync (account: AddressOrPair, optionsOrNonce?: Partial<SignerOptions>): SubmittableThis<ApiType, this> { public signAsync (account: AddressOrPair, partialOptions?: Partial<SignerOptions>): SubmittableThis<ApiType, this> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
return decorateMethod( return decorateMethod(
(): Observable<this> => (): Observable<this> =>
this.#observeSign(account, optionsOrNonce).pipe(mapTo(this) as OperatorFunction<number | undefined, this>) this.#observeSign(account, partialOptions).pipe(
mapTo<number | undefined, this>(this)
)
)(); )();
} }
// signAndSend with an immediate Hash result // signAndSend with an immediate Hash result
public signAndSend (account: AddressOrPair, options?: Partial<SignerOptions>): SubmittableResultResult<ApiType>; public signAndSend (account: AddressOrPair, partialOptions?: Partial<SignerOptions>): SubmittableResultResult<ApiType>;
// signAndSend with a subscription, i.e. callback provided // signAndSend with a subscription, i.e. callback provided
public signAndSend (account: AddressOrPair, statusCb: Callback<ISubmittableResult>): SubmittableResultSubscription<ApiType>; public signAndSend (account: AddressOrPair, statusCb: Callback<ISubmittableResult>): SubmittableResultSubscription<ApiType>;
// signAndSend with options and a callback // signAndSend with options and a callback
public signAndSend (account: AddressOrPair, options: Partial<SignerOptions>, statusCb?: Callback<ISubmittableResult>): SubmittableResultSubscription<ApiType>; public signAndSend (account: AddressOrPair, partialOptions: Partial<SignerOptions>, statusCb?: Callback<ISubmittableResult>): SubmittableResultSubscription<ApiType>;
// signAndSend implementation for all 3 cases above // signAndSend implementation for all 3 cases above
public signAndSend (account: AddressOrPair, optionsOrStatus?: Partial<SignerOptions> | Callback<ISubmittableResult>, optionalStatusCb?: Callback<ISubmittableResult>): SubmittableResultResult<ApiType> | SubmittableResultSubscription<ApiType> { public signAndSend (account: AddressOrPair, partialOptions?: Partial<SignerOptions> | Callback<ISubmittableResult>, optionalStatusCb?: Callback<ISubmittableResult>): SubmittableResultResult<ApiType> | SubmittableResultSubscription<ApiType> {
const [options, statusCb] = this.#makeSignAndSendOptions(optionsOrStatus, optionalStatusCb); const [options, statusCb] = makeSignAndSendOptions(partialOptions, optionalStatusCb);
const isSubscription = api.hasSubscriptions && (this.#ignoreStatusCb || !!statusCb); const isSubscription = api.hasSubscriptions && (this.#ignoreStatusCb || !!statusCb);
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
@@ -161,61 +212,15 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
return this; return this;
} }
#makeEraOptions = (options: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions => { #observeSign = (account: AddressOrPair, partialOptions?: Partial<SignerOptions>): Observable<number | undefined> => {
if (!header) {
if (isNumber(options.era)) {
// since we have no header, it is immortal, remove any option overrides
// so we only supply the genesisHash and no era to the construction
delete options.era;
delete options.blockHash;
}
return this.#makeSignOptions(options, { nonce });
}
return this.#makeSignOptions(options, {
blockHash: header.hash,
era: this.registry.createType('ExtrinsicEra', {
current: header.number,
period: options.era || mortalLength
}),
nonce
});
};
#makeSignOptions = (options: Partial<SignerOptions>, extras: { blockHash?: Hash; era?: ExtrinsicEra; nonce?: Index }): SignatureOptions => {
return {
blockHash: api.genesisHash,
genesisHash: api.genesisHash,
...options,
...extras,
runtimeVersion: api.runtimeVersion,
signedExtensions: api.registry.signedExtensions,
version: api.extrinsicType
} as SignatureOptions;
};
#makeSignAndSendOptions = (optionsOrStatus?: Partial<SignerOptions> | Callback<ISubmittableResult>, statusCb?: Callback<ISubmittableResult>): [Partial<SignerOptions>, Callback<ISubmittableResult>?] => {
let options: Partial<SignerOptions> = {};
if (isFunction(optionsOrStatus)) {
statusCb = optionsOrStatus;
} else {
options = { ...optionsOrStatus };
}
return [options, statusCb];
};
#observeSign = (account: AddressOrPair, optionsOrNonce?: Partial<SignerOptions>): Observable<number | undefined> => {
const address = isKeyringPair(account) ? account.address : account.toString(); const address = isKeyringPair(account) ? account.address : account.toString();
const options = this.#optionsOrNonce(optionsOrNonce); const options = optionsOrNonce(partialOptions);
let updateId: number | undefined; let updateId: number | undefined;
return api.derive.tx.signingInfo(address, options.nonce, options.era).pipe( return api.derive.tx.signingInfo(address, options.nonce, options.era).pipe(
first(), first(),
mergeMap(async (signingInfo): Promise<void> => { mergeMap(async (signingInfo): Promise<void> => {
const eraOptions = this.#makeEraOptions(options, signingInfo); const eraOptions = makeEraOptions(api, this.registry, options, signingInfo);
if (isKeyringPair(account)) { if (isKeyringPair(account)) {
this.sign(account, eraOptions); this.sign(account, eraOptions);
@@ -229,7 +234,9 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
#observeStatus = (hash: Hash, status: ExtrinsicStatus): Observable<ISubmittableResult> => { #observeStatus = (hash: Hash, status: ExtrinsicStatus): Observable<ISubmittableResult> => {
if (!status.isFinalized && !status.isInBlock) { if (!status.isFinalized && !status.isInBlock) {
return of(this.#transformResult(new SubmittableResult({ status }))); return of(this.#transformResult(new SubmittableResult({
status
})));
} }
const blockHash = status.isInBlock const blockHash = status.isInBlock
@@ -244,7 +251,10 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
})) }))
), ),
catchError((internalError: Error) => catchError((internalError: Error) =>
of(this.#transformResult(new SubmittableResult({ internalError, status }))) of(this.#transformResult(new SubmittableResult({
internalError,
status
})))
) )
); );
}; };
@@ -270,25 +280,16 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
); );
}; };
// NOTE here we actually override nonce if it was specified (backwards compat for
// the previous signature - don't let user space break, but allow then time to upgrade)
#optionsOrNonce = (optionsOrNonce: Partial<SignerOptions> = {}): Partial<SignerOptions> => {
return isBn(optionsOrNonce) || isNumber(optionsOrNonce)
? { nonce: optionsOrNonce }
: optionsOrNonce;
};
#signViaSigner = async (address: Address | string | Uint8Array, options: SignatureOptions, header: Header | null): Promise<number> => { #signViaSigner = async (address: Address | string | Uint8Array, options: SignatureOptions, header: Header | null): Promise<number> => {
const signer = options.signer || api.signer; const signer = options.signer || api.signer;
assert(signer, 'No signer specified, either via api.setSigner or via sign options. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.'); assert(signer, 'No signer specified, either via api.setSigner or via sign options. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.');
const payload = this.registry.createType('SignerPayload', { const payload = this.registry.createType('SignerPayload', objectSpread({}, options, {
...options,
address, address,
blockNumber: header ? header.number : 0, blockNumber: header ? header.number : 0,
method: this.method method: this.method
}); }));
let result: SignerResult; let result: SignerResult;
if (signer.signPayload) { if (signer.signPayload) {
+2 -1
View File
@@ -64,4 +64,5 @@ export interface PaginationOptions<A = unknown> {
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export type DecorateMethod<ApiType extends ApiTypes> = <Method extends (...args: any[]) => Observable<any>>(method: Method, options?: DecorateMethodOptions) => any; export type DecorateMethod<ApiType extends ApiTypes, T = any> =
<M extends (...args: any[]) => Observable<any>>(method: M, options?: DecorateMethodOptions) => T;
+3 -7
View File
@@ -2,23 +2,19 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { Json, Raw } from '@polkadot/types/codec';
import type { AnyFunction, Callback, DefinitionRpc } from '@polkadot/types/types'; import type { AnyFunction, Callback, DefinitionRpc } from '@polkadot/types/types';
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
import { ApiTypes, PromiseResult, Push, RxResult, UnsubscribePromise } from './base'; import { ApiTypes, PromiseResult, Push, RxResult, UnsubscribePromise } from './base';
export interface RpcRxResult<F extends AnyFunction> extends RxResult<F> { export interface RpcRxResult<F extends AnyFunction> extends RxResult<F> {
json (...args: Parameters<F>): Observable<Json>; raw <T> (...args: Parameters<F>): Observable<T>;
raw (...args: Parameters<F>): Observable<Raw>;
meta: DefinitionRpc; meta: DefinitionRpc;
} }
export interface RpcPromiseResult<F extends AnyFunction> extends PromiseResult<F> { export interface RpcPromiseResult<F extends AnyFunction> extends PromiseResult<F> {
json (...args: Parameters<F>): Promise<Json>; raw <T> (...args: Parameters<F>): Promise<T>;
json (...args: Push<Parameters<F>, Callback<Json>>): UnsubscribePromise; raw <T> (...args: Push<Parameters<F>, Callback<T>>): UnsubscribePromise;
raw (...args: Parameters<F>): Promise<Raw>;
raw (...args: Push<Parameters<F>, Callback<Raw>>): UnsubscribePromise;
meta: DefinitionRpc; meta: DefinitionRpc;
} }
+64 -45
View File
@@ -1,7 +1,11 @@
// Copyright 2017-2021 @polkadot/api authors & contributors // Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import { logger } from '@polkadot/util'; import { lazyMethod, logger, objectClear } from '@polkadot/util';
type Sections <T> = Record<string, Methods<T>>;
type Methods <T> = Record<string, T>;
type StringsStrings = [string[], string[]]; type StringsStrings = [string[], string[]];
@@ -26,16 +30,17 @@ function warn (prefix: string, type: 'calls' | 'modules', [added, removed]: Stri
} }
} }
function extractKeys (src: Record<string, Record<string, any>>, dst: Record<string, Record<string, any>>): StringsStrings {
return [Object.keys(src), Object.keys(dst)];
}
function findSectionExcludes (a: string[], b: string[]): string[] { function findSectionExcludes (a: string[], b: string[]): string[] {
return a.filter((section) => !b.includes(section)); return a.filter((s) => !b.includes(s));
} }
function extractSections (src: Record<string, Record<string, any>>, dst: Record<string, Record<string, any>>): StringsStrings { function findSectionIncludes (a: string[], b: string[]): string[] {
const [srcSections, dstSections] = extractKeys(src, dst); return a.filter((s) => b.includes(s));
}
function extractSections <T> (src: Sections<T>, dst: Sections<T>): StringsStrings {
const srcSections = Object.keys(src);
const dstSections = Object.keys(dst);
return [ return [
findSectionExcludes(srcSections, dstSections), findSectionExcludes(srcSections, dstSections),
@@ -43,64 +48,78 @@ function extractSections (src: Record<string, Record<string, any>>, dst: Record<
]; ];
} }
function findMethodExcludes (src: Record<string, Record<string, any>>, dst: Record<string, Record<string, any>>): string[] { function findMethodExcludes <T> (src: Sections<T>, dst: Sections<T>): string[] {
const srcSections = Object.keys(src); const srcSections = Object.keys(src);
const dstSections = Object.keys(dst); const dstSections = findSectionIncludes(Object.keys(dst), srcSections);
const excludes: string[] = [];
return dstSections for (let s = 0; s < dstSections.length; s++) {
.filter((section) => srcSections.includes(section)) const section = dstSections[s];
.reduce((rmMethods: string[], section): string[] => { const srcMethods = Object.keys(src[section]);
const srcMethods = Object.keys(src[section]); const dstMethods = Object.keys(dst[section]);
return rmMethods.concat( excludes.push(
...Object ...dstMethods
.keys(dst[section]) .filter((m) => !srcMethods.includes(m))
.filter((method) => !srcMethods.includes(method)) .map((m) => `${section}.${m}`)
.map((method) => `${section}.${method}`) );
); }
}, []);
return excludes;
} }
function extractMethods (src: Record<string, Record<string, any>>, dst: Record<string, Record<string, any>>): StringsStrings { function extractMethods <T> (src: Sections<T>, dst: Sections<T>): StringsStrings {
return [ return [
findMethodExcludes(dst, src), findMethodExcludes(dst, src),
findMethodExcludes(src, dst) findMethodExcludes(src, dst)
]; ];
} }
function lazySection <T> (src: Methods<T>, dst: Methods<T>): void {
const creator = (m: string) => src[m];
const methods = Object.keys(src);
for (let i = 0; i < methods.length; i++) {
const method = methods[i];
// We use hasOwnproperty here to only check for the existence of the key,
// instead of reading dst[section][method] which will evaluate when already
// set as a lazy value previously
if (!Object.prototype.hasOwnProperty.call(dst, method)) {
lazyMethod(dst, method, creator);
}
}
}
/** /**
* Takes a decorated api section (e.g. api.tx) and augment it with the details. It does not override what is * @description Takes a decorated api section (e.g. api.tx) and augment it with the details. It does not override what is
* already available, but rather just adds new missing ites into the result object. * already available, but rather just adds new missing items into the result object.
* @internal * @internal
*/ */
export function augmentObject (prefix: string | null, src: Record<string, Record<string, unknown>>, dst: Record<string, Record<string, unknown>>, fromEmpty = false): Record<string, Record<string, any>> { export function augmentObject <T> (prefix: string | null, src: Sections<T>, dst: Sections<T>, fromEmpty = false): Sections<T> {
if (fromEmpty) { fromEmpty && objectClear(dst);
Object.keys(dst).forEach((key): void => {
delete dst[key];
});
}
// NOTE: This part is slightly problematic since it will get the
// values for at least all the sections and the names of the methods
// (Since methods won't be decorated before lazy, this _may_ be ok)
if (prefix && Object.keys(dst).length) { if (prefix && Object.keys(dst).length) {
warn(prefix, 'modules', extractSections(src, dst)); warn(prefix, 'modules', extractSections(src, dst));
warn(prefix, 'calls', extractMethods(src, dst)); warn(prefix, 'calls', extractMethods(src, dst));
} }
return Object const sections = Object.keys(src);
.keys(src)
.reduce((newSection, sectionName): Record<string, Record<string, unknown>> => {
const section = src[sectionName];
newSection[sectionName] = Object for (let i = 0; i < sections.length; i++) {
.keys(section) const section = sections[i];
.reduce((result, methodName): Record<string, unknown> => {
// TODO When it does match, check the actual details and warn when there are differences
if (!result[methodName]) {
result[methodName] = section[methodName];
}
return result; // We don't set here with a lazy interface, we decorate based
}, dst[sectionName] || {}); // on the top-level structure (this bypasses adding lazy onto lazy)
if (!dst[section]) {
dst[section] = {};
}
return newSection; lazySection(src[section], dst[section]);
}, dst); }
return dst;
} }
+27 -43
View File
@@ -4,55 +4,39 @@
import type { AnyFunction } from '@polkadot/types/types'; import type { AnyFunction } from '@polkadot/types/types';
import type { ApiTypes, DecorateMethod, MethodResult } from '../types'; import type { ApiTypes, DecorateMethod, MethodResult } from '../types';
import { lazyDeriveSection } from '@polkadot/api-derive';
type AnyDeriveSection = Record<string, AnyFunction>;
// Most generic typings for `api.derive.*.*` // Most generic typings for `api.derive.*.*`
type AnyDerive = Record<string, Record<string, AnyFunction>>; type AnyDerive = Record<string, AnyDeriveSection>;
// Exact typings for a particular section `api.derive.section.*` // Exact typings for a particular section `api.derive.section.*`
type DeriveSection<ApiType extends ApiTypes, Section extends Record<string, AnyFunction>> = { [MethodName in keyof Section]: MethodResult<ApiType, Section[MethodName]> }; type DeriveSection<ApiType extends ApiTypes, Section extends AnyDeriveSection> = {
[MethodName in keyof Section]: MethodResult<ApiType, Section[MethodName]>
};
// Exact typings for all sections `api.derive.*.*` // Exact typings for all sections `api.derive.*.*`
export type DeriveAllSections<ApiType extends ApiTypes, AllSections extends AnyDerive> = { [SectionName in keyof AllSections]: DeriveSection<ApiType, AllSections[SectionName]> }; export type DeriveAllSections<ApiType extends ApiTypes, AllSections extends AnyDerive> = {
[SectionName in keyof AllSections]: DeriveSection<ApiType, AllSections[SectionName]>
// A technically unsafe version of Object.keys(obj) that assumes that };
// obj only has known properties of T
function keys<T extends Record<string, unknown>> (obj: T): (keyof T)[] {
return Object.keys(obj);
}
/**
* This is a methods decorator which keeps all type information.
*/
function decorateMethods<ApiType extends ApiTypes, Section extends Record<string, AnyFunction>> (section: Section, decorateMethod: DecorateMethod<ApiType>): DeriveSection<ApiType, Section> {
return keys(section).reduce(
<MethodName extends keyof Section>(
acc: DeriveSection<ApiType, Section>,
methodName: MethodName
): DeriveSection<ApiType, Section> => {
const method = section[methodName];
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
acc[methodName] = decorateMethod(method) as MethodResult<ApiType, Section[MethodName]>;
return acc;
},
{} as DeriveSection<ApiType, Section>
);
}
/** /**
* This is a section decorator which keeps all type information. * This is a section decorator which keeps all type information.
*/ */
export function decorateSections<ApiType extends ApiTypes, AllSections extends AnyDerive> ( export function decorateDeriveSections<ApiType extends ApiTypes, A extends AnyDerive> (decorateMethod: DecorateMethod<ApiType>, derives: AnyDerive): DeriveAllSections<ApiType, A> {
allSections: AllSections, const getKeys = (s: string) =>
decorateMethod: DecorateMethod<ApiType> Object.keys(derives[s]);
): DeriveAllSections<ApiType, AllSections> {
return keys(allSections).reduce(
<MethodName extends keyof AllSections>(
acc: DeriveAllSections<ApiType, AllSections>,
sectionName: MethodName
): DeriveAllSections<ApiType, AllSections> => {
acc[sectionName] = decorateMethods(allSections[sectionName], decorateMethod);
return acc; const creator = (s: string, m: string) =>
}, decorateMethod(derives[s][m]) as AnyFunction;
{} as DeriveAllSections<ApiType, AllSections>
); const result: AnyDerive = {};
const names = Object.keys(derives);
for (let i = 0; i < names.length; i++) {
lazyDeriveSection(result, names[i], getKeys, creator);
}
return result as DeriveAllSections<ApiType, A>;
} }
+15 -17
View File
@@ -7,24 +7,22 @@ import { l } from './logging';
export function filterEvents (extHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[], status: ExtrinsicStatus): EventRecord[] | undefined { export function filterEvents (extHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[], status: ExtrinsicStatus): EventRecord[] | undefined {
// extrinsics to hashes // extrinsics to hashes
const myHash = extHash.toHex(); for (const [index, extrinsic] of extrinsics.entries()) {
const allHashes = extrinsics.map((ext): string => ext.hash.toHex()); if (extrinsic.hash.eq(extHash)) {
return allEvents.filter(({ phase }) =>
// find the index of our extrinsic in the block // only ApplyExtrinsic has the extrinsic index
const index = allHashes.indexOf(myHash); phase.isApplyExtrinsic && phase.asApplyExtrinsic.eqn(index)
);
// if we do get the block after finalized, it _should_ be there
if (index === -1) {
// only warn on filtering with isInBlock (finalization finalizes after)
if (status.isInBlock) {
l.warn(`block ${header.hash.toHex()}: Unable to find extrinsic ${myHash} inside ${allHashes.join(', ')}`);
} }
return;
} }
return allEvents.filter(({ phase }) => // if we do get the block after finalized, it _should_ be there
// only ApplyExtrinsic has the extrinsic index // only warn on filtering with isInBlock (finalization finalizes after)
phase.isApplyExtrinsic && phase.asApplyExtrinsic.eqn(index) if (status.isInBlock) {
); const allHashes = extrinsics.map((ext): string => ext.hash.toHex());
l.warn(`block ${header.hash.toHex()}: Unable to find extrinsic ${extHash.toHex()} inside ${allHashes.join(', ')}`);
}
return undefined;
} }
+23 -19
View File
@@ -1,31 +1,35 @@
{ {
"name": "@polkadot/rpc-core", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/rpc-core",
"repository": {
"directory": "packages/rpc-core",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/rpc-provider": "6.4.2", "@polkadot/rpc-provider": "6.7.1",
"@polkadot/types": "6.4.2", "@polkadot/types": "6.7.1",
"@polkadot/util": "^7.5.1", "@polkadot/util": "^7.8.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.5.1" "@polkadot/keyring": "^7.8.2"
} }
} }
+50 -61
View File
@@ -7,12 +7,12 @@ import type { StorageKey, Vec } from '@polkadot/types';
import type { Hash } from '@polkadot/types/interfaces'; import type { Hash } from '@polkadot/types/interfaces';
import type { AnyJson, Codec, DefinitionRpc, DefinitionRpcExt, DefinitionRpcSub, Registry } from '@polkadot/types/types'; import type { AnyJson, Codec, DefinitionRpc, DefinitionRpcExt, DefinitionRpcSub, Registry } from '@polkadot/types/types';
import type { Memoized } from '@polkadot/util/types'; import type { Memoized } from '@polkadot/util/types';
import type { RpcInterface, RpcInterfaceMethod } from './types'; import type { RpcInterfaceMethod } from './types';
import { Observable, publishReplay, refCount } from 'rxjs'; import { Observable, publishReplay, refCount } from 'rxjs';
import { rpcDefinitions } from '@polkadot/types'; import { rpcDefinitions } from '@polkadot/types';
import { assert, hexToU8a, isFunction, isNull, isUndefined, logger, memoize, u8aToU8a } from '@polkadot/util'; import { assert, hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aToU8a } from '@polkadot/util';
import { drr, refCountDelay } from './util'; import { drr, refCountDelay } from './util';
@@ -24,8 +24,6 @@ interface StorageChangeSetJSON {
changes: [string, string | null][]; changes: [string, string | null][];
} }
type OutputType = 'json' | 'raw' | 'scale';
const l = logger('rpc-core'); const l = logger('rpc-core');
const EMPTY_META = { const EMPTY_META = {
@@ -143,84 +141,79 @@ export class RpcCore {
}); });
} }
public addUserInterfaces<Section extends keyof RpcInterface> (userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void { public addUserInterfaces (userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void {
// add any extra user-defined sections // add any extra user-defined sections
this.sections.push(...Object.keys(userRpc).filter((key) => !this.sections.includes(key))); this.sections.push(...Object.keys(userRpc).filter((k) => !this.sections.includes(k)));
// decorate the sections with base and user methods for (let s = 0; s < this.sections.length; s++) {
this.sections.forEach((sectionName): void => { const section = this.sections[s];
(this as Record<string, unknown>)[sectionName as Section] ||= {}; const defs = objectSpread<Record<string, DefinitionRpc | DefinitionRpcSub>>({}, rpcDefinitions[section as 'babe'], userRpc[section]);
const methods = Object.keys(defs);
const section = (this as Record<string, unknown>)[sectionName as Section] as Record<string, unknown>; for (let m = 0; m < methods.length; m++) {
const method = methods[m];
const def = defs[method];
const jsonrpc = def.endpoint || `${section}_${method}`;
Object if (!this.mapping.has(jsonrpc)) {
.entries({ const isSubscription = !!(def as DefinitionRpcSub).pubsub;
...this._createInterface(sectionName, rpcDefinitions[sectionName as 'babe'] || {}),
...this._createInterface(sectionName, userRpc[sectionName] || {}) if (!(this as Record<string, unknown>)[section]) {
}) (this as Record<string, unknown>)[section] = {};
.forEach(([key, value]): void => { }
section[key] ||= value;
}); this.mapping.set(jsonrpc, objectSpread({}, def, { isSubscription, jsonrpc, method, section }));
});
lazyMethod(this[section as 'connect'], method, () =>
isSubscription
? this._createMethodSubscribe(section, method, def as DefinitionRpcSub)
: this._createMethodSend(section, method, def)
);
}
}
}
} }
private _createInterface<Section extends keyof RpcInterface> (section: string, methods: Record<string, DefinitionRpc | DefinitionRpcSub>): RpcInterface[Section] { private _memomize (creator: <T> (isScale: boolean) => (...values: unknown[]) => Observable<T>, def: DefinitionRpc): Memoized<RpcInterfaceMethod> {
return Object const memoOpts = { getInstanceId: () => this.#instanceId };
.entries(methods) const memoized = memoize(creator(true) as RpcInterfaceMethod, memoOpts);
.filter(([method, { endpoint }]) => !this.mapping.has(endpoint || `${section}_${method}`))
.reduce((exposed, [method, { endpoint }]): RpcInterface[Section] => {
const def = methods[method];
const isSubscription = !!(def as DefinitionRpcSub).pubsub;
const jsonrpc = endpoint || `${section}_${method}`;
this.mapping.set(jsonrpc, { ...def, isSubscription, jsonrpc, method, section }); memoized.raw = memoize(creator(false), memoOpts);
(exposed as Record<string, unknown>)[method] = isSubscription
? this._createMethodSubscribe(section, method, def as DefinitionRpcSub)
: this._createMethodSend(section, method, def);
return exposed;
}, {} as RpcInterface[Section]);
}
private _memomize (creator: <T> (outputAs: OutputType) => (...values: unknown[]) => Observable<T>, def: DefinitionRpc): Memoized<RpcInterfaceMethod> {
const memoized = memoize(creator('scale') as RpcInterfaceMethod, {
getInstanceId: () => this.#instanceId
});
memoized.json = creator('json');
memoized.raw = creator('raw');
memoized.meta = def; memoized.meta = def;
return memoized; return memoized;
} }
private _formatResult <T> (isScale: boolean, registry: Registry, blockHash: string | Uint8Array | null | undefined, method: string, def: DefinitionRpc, params: Codec[], result: unknown): T {
return isScale
? this._formatOutput(registry, blockHash, method, def, params, result) as unknown as T
: result as T;
}
private _createMethodSend (section: string, method: string, def: DefinitionRpc): RpcInterfaceMethod { private _createMethodSend (section: string, method: string, def: DefinitionRpc): RpcInterfaceMethod {
const rpcName = def.endpoint || `${section}_${method}`; const rpcName = def.endpoint || `${section}_${method}`;
const hashIndex = def.params.findIndex(({ isHistoric }) => isHistoric); const hashIndex = def.params.findIndex(({ isHistoric }) => isHistoric);
let memoized: null | Memoized<RpcInterfaceMethod> = null; let memoized: null | Memoized<RpcInterfaceMethod> = null;
// execute the RPC call, doing a registry swap for historic as applicable // execute the RPC call, doing a registry swap for historic as applicable
const callWithRegistry = async <T> (outputAs: OutputType, values: unknown[]): Promise<T> => { const callWithRegistry = async <T> (isScale: boolean, values: unknown[]): Promise<T> => {
const blockHash = hashIndex === -1 const blockHash = hashIndex === -1
? null ? null
: values[hashIndex] as (Uint8Array | string | null | undefined); : values[hashIndex] as (Uint8Array | string | null | undefined);
const { registry } = outputAs === 'scale' && blockHash && this.#getBlockRegistry const { registry } = isScale && blockHash && this.#getBlockRegistry
? await this.#getBlockRegistry(u8aToU8a(blockHash)) ? await this.#getBlockRegistry(u8aToU8a(blockHash))
: { registry: this.#registryDefault }; : { registry: this.#registryDefault };
const params = this._formatInputs(registry, null, def, values); const params = this._formatInputs(registry, null, def, values);
const data = await this.provider.send<AnyJson>(rpcName, params.map((param) => param.toJSON())); const result = await this.provider.send<AnyJson>(rpcName, params.map((p) => p.toJSON()));
return outputAs === 'scale' return this._formatResult(isScale, registry, blockHash, method, def, params, result);
? this._formatOutput(registry, blockHash, method, def, params, data) as unknown as T
: registry.createType(outputAs === 'raw' ? 'Raw' : 'Json', data) as unknown as T;
}; };
const creator = <T> (outputAs: OutputType) => (...values: unknown[]): Observable<T> => { const creator = <T> (isScale: boolean) => (...values: unknown[]): Observable<T> => {
const isDelayed = outputAs === 'scale' && hashIndex !== -1 && !!values[hashIndex]; const isDelayed = isScale && hashIndex !== -1 && !!values[hashIndex];
return new Observable((observer: Observer<T>): VoidCallback => { return new Observable((observer: Observer<T>): VoidCallback => {
callWithRegistry<T>(outputAs, values) callWithRegistry<T>(isScale, values)
.then((value): void => { .then((value): void => {
observer.next(value); observer.next(value);
observer.complete(); observer.complete();
@@ -269,7 +262,7 @@ export class RpcCore {
const subType = `${section}_${updateType}`; const subType = `${section}_${updateType}`;
let memoized: null | Memoized<RpcInterfaceMethod> = null; let memoized: null | Memoized<RpcInterfaceMethod> = null;
const creator = <T> (outputAs: OutputType) => (...values: unknown[]): Observable<T> => { const creator = <T> (isScale: boolean) => (...values: unknown[]): Observable<T> => {
return new Observable((observer: Observer<T>): VoidCallback => { return new Observable((observer: Observer<T>): VoidCallback => {
// Have at least an empty promise, as used in the unsubscribe // Have at least an empty promise, as used in the unsubscribe
let subscriptionPromise: Promise<number | string | null> = Promise.resolve(null); let subscriptionPromise: Promise<number | string | null> = Promise.resolve(null);
@@ -283,9 +276,9 @@ export class RpcCore {
try { try {
const params = this._formatInputs(registry, null, def, values); const params = this._formatInputs(registry, null, def, values);
const paramsJson = params.map((param) => param.toJSON()); const paramsJson = params.map((p) => p.toJSON());
const update = (error?: Error | null, result?: T): void => { const update = (error?: Error | null, result?: unknown): void => {
if (error) { if (error) {
logErrorMessage(method, def, error); logErrorMessage(method, def, error);
@@ -293,11 +286,7 @@ export class RpcCore {
} }
try { try {
observer.next( observer.next(this._formatResult(isScale, registry, null, method, def, params, result));
outputAs === 'scale'
? this._formatOutput(registry, null, method, def, params, result) as unknown as T
: registry.createType(outputAs === 'raw' ? 'Raw' : 'Json', result) as unknown as T
);
} catch (error) { } catch (error) {
observer.error(error); observer.error(error);
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '6.4.2' }; export const packageInfo = { name: '@polkadot/rpc-core', version: '6.7.1' };
-18
View File
@@ -1,11 +1,8 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors // Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { RpcInterface } from '@polkadot/rpc-core/types.jsonrpc'; import type { RpcInterface } from '@polkadot/rpc-core/types.jsonrpc';
import { of } from 'rxjs';
import { MockProvider } from '@polkadot/rpc-provider/mock'; import { MockProvider } from '@polkadot/rpc-provider/mock';
import { TypeRegistry } from '@polkadot/types/create'; import { TypeRegistry } from '@polkadot/types/create';
@@ -25,21 +22,6 @@ describe('replay', (): void => {
await provider.disconnect(); await provider.disconnect();
}); });
it('subscribes via the rpc section', (done): void => {
// we don't honor types or number of params here
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(rpc.chain as any).getBlockHash = jest.fn((): Observable<number> => of(1));
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
(rpc.chain as any).getBlockHash(123, false).subscribe((): void => {
expect(
// eslint-disable-next-line @typescript-eslint/unbound-method
rpc.chain.getBlockHash
).toHaveBeenCalledWith(123, false);
done();
});
});
it('returns the observable value', (done): void => { it('returns the observable value', (done): void => {
rpc.system.chain().subscribe((value: any): void => { rpc.system.chain().subscribe((value: any): void => {
if (value) { if (value) {
+6 -2
View File
@@ -3,9 +3,13 @@
// FIXME, this whole file needs to move to API // FIXME, this whole file needs to move to API
import type { AnyFunction } from '@polkadot/types/types'; import type { Observable } from 'rxjs';
import type { AnyFunction, DefinitionRpc } from '@polkadot/types/types';
// eslint-disable-next-line @typescript-eslint/no-empty-interface // eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface RpcInterface {} export interface RpcInterface {}
export type AugmentedRpc<F extends AnyFunction> = F; export type AugmentedRpc<F extends AnyFunction> = F & {
raw: <T> (...params: Parameters<F>) => Observable<T>;
meta: DefinitionRpc;
};
+1 -3
View File
@@ -2,14 +2,12 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { Json, Raw } from '@polkadot/types';
import type { Codec, DefinitionRpc } from '@polkadot/types/types'; import type { Codec, DefinitionRpc } from '@polkadot/types/types';
export * from './types.jsonrpc'; export * from './types.jsonrpc';
export interface RpcInterfaceMethod { export interface RpcInterfaceMethod {
<T extends Codec> (...params: unknown[]): Observable<T>; <T extends Codec> (...params: unknown[]): Observable<T>;
json (...params: unknown[]): Observable<Json>; raw (...params: unknown[]): Observable<unknown>;
raw (...params: unknown[]): Observable<Raw>;
meta: DefinitionRpc; meta: DefinitionRpc;
} }
+29 -25
View File
@@ -1,37 +1,41 @@
{ {
"name": "@polkadot/rpc-provider", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "Transport providers for the API", "description": "Transport providers for the API",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/rpc-provider",
"repository": {
"directory": "packages/rpc-provider",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/types": "6.4.2", "@polkadot/types": "6.7.1",
"@polkadot/util": "^7.5.1", "@polkadot/util": "^7.8.2",
"@polkadot/util-crypto": "^7.5.1", "@polkadot/util-crypto": "^7.8.2",
"@polkadot/x-fetch": "^7.5.1", "@polkadot/x-fetch": "^7.8.2",
"@polkadot/x-global": "^7.5.1", "@polkadot/x-global": "^7.8.2",
"@polkadot/x-ws": "^7.5.1", "@polkadot/x-ws": "^7.8.2",
"eventemitter3": "^4.0.7" "eventemitter3": "^4.0.7"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.5.1", "@polkadot/keyring": "^7.8.2",
"@polkadot/types": "6.4.2", "@polkadot/types": "6.7.1",
"mock-socket": "^9.0.5", "mock-socket": "^9.0.7",
"nock": "^13.1.3" "nock": "^13.1.4"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.4.2' }; export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.7.1' };
+7 -3
View File
@@ -40,6 +40,8 @@ const ALIASES: { [index: string]: string } = {
const RETRY_DELAY = 2500; const RETRY_DELAY = 2500;
const MEGABYTE = 1024 * 1024;
const l = logger('api-ws'); const l = logger('api-ws');
function eraseRecord<T> (record: Record<string, T>, cb?: (item: T) => void): void { function eraseRecord<T> (record: Record<string, T>, cb?: (item: T) => void): void {
@@ -179,9 +181,11 @@ export class WsProvider implements ProviderInterface {
// default: true // default: true
fragmentOutgoingMessages: true, fragmentOutgoingMessages: true,
// default: 16K (bump, the Node has issues with too many fragments, e.g. on setCode) // default: 16K (bump, the Node has issues with too many fragments, e.g. on setCode)
fragmentationThreshold: 256 * 1024, fragmentationThreshold: 1 * MEGABYTE,
// default: 8MB (however Polkadot api.query.staking.erasStakers.entries(356) is over that) // default: 1MiB (also align with maxReceivedMessageSize)
maxReceivedMessageSize: 16 * 1024 * 1024 maxReceivedFrameSize: 24 * MEGABYTE,
// default: 8MB (however Polkadot api.query.staking.erasStakers.entries(356) is over that, 16M is ok there)
maxReceivedMessageSize: 24 * MEGABYTE
}); });
this.#websocket.onclose = this.#onSocketClose; this.#websocket.onclose = this.#onSocketClose;
+27 -23
View File
@@ -1,16 +1,27 @@
{ {
"name": "@polkadot/typegen", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "Type generation scripts", "description": "Type generation scripts",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/typegen",
"repository": {
"directory": "packages/typegen",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"bin": { "bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs", "polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.cjs", "polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.cjs",
@@ -18,28 +29,21 @@
"polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.cjs", "polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.cjs",
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs" "polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs"
}, },
"repository": "github:polkadot-js/api",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"dependencies": { "dependencies": {
"@babel/core": "^7.15.8", "@babel/core": "^7.16.0",
"@babel/register": "^7.15.3", "@babel/register": "^7.16.0",
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/api": "6.4.2", "@polkadot/api": "6.7.1",
"@polkadot/rpc-provider": "6.4.2", "@polkadot/rpc-provider": "6.7.1",
"@polkadot/types": "6.4.2", "@polkadot/types": "6.7.1",
"@polkadot/types-support": "6.4.2", "@polkadot/types-support": "6.7.1",
"@polkadot/util": "^7.5.1", "@polkadot/util": "^7.8.2",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"websocket": "^1.0.34", "websocket": "^1.0.34",
"yargs": "^17.2.1" "yargs": "^17.2.1"
}, },
"devDependencies": { "devDependencies": {
"@types/websocket": "^1.0.4", "@types/websocket": "^1.0.4",
"@types/yargs": "^17.0.4" "@types/yargs": "^17.0.5"
} }
} }
+2 -1
View File
@@ -1,7 +1,8 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors // Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { PortableRegistry, PortableType, SiLookupTypeId, SiPath, SiTypeParameter } from '@polkadot/types/interfaces'; import type { PortableType, SiLookupTypeId, SiPath, SiTypeParameter } from '@polkadot/types/interfaces';
import type { PortableRegistry } from '@polkadot/types/metadata';
import type { TypeDef } from '@polkadot/types/types'; import type { TypeDef } from '@polkadot/types/types';
import Handlebars from 'handlebars'; import Handlebars from 'handlebars';
+2 -2
View File
@@ -1,8 +1,8 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors // Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { PortableRegistry, StorageEntryMetadataLatest } from '@polkadot/types/interfaces/metadata'; import type { StorageEntryMetadataLatest } from '@polkadot/types/interfaces';
import type { Metadata } from '@polkadot/types/metadata/Metadata'; import type { Metadata, PortableRegistry } from '@polkadot/types/metadata';
import type { Registry } from '@polkadot/types/types'; import type { Registry } from '@polkadot/types/types';
import type { ExtraTypes } from './types'; import type { ExtraTypes } from './types';
+2 -1
View File
@@ -1,7 +1,8 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors // Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { MetadataLatest, PortableRegistry, SiLookupTypeId } from '@polkadot/types/interfaces'; import type { MetadataLatest, SiLookupTypeId } from '@polkadot/types/interfaces';
import type { PortableRegistry } from '@polkadot/types/metadata';
import type { Codec, DefinitionRpcParam } from '@polkadot/types/types'; import type { Codec, DefinitionRpcParam } from '@polkadot/types/types';
import fs from 'fs'; import fs from 'fs';
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '6.4.2' }; export const packageInfo = { name: '@polkadot/typegen', version: '6.7.1' };
+1 -1
View File
@@ -44,7 +44,7 @@ export function setImports (allDefs: Record<string, ModuleTypes>, imports: TypeI
// do nothing // do nothing
} else if (['AnyNumber', 'CallFunction', 'Codec', 'IExtrinsic', 'ITuple'].includes(type)) { } else if (['AnyNumber', 'CallFunction', 'Codec', 'IExtrinsic', 'ITuple'].includes(type)) {
typesTypes[type] = true; typesTypes[type] = true;
} else if (type === 'Metadata') { } else if (['Metadata', 'PortableRegistry'].includes(type)) {
metadataTypes[type] = true; metadataTypes[type] = true;
} else if ((codecClasses as Record<string, unknown>)[type]) { } else if ((codecClasses as Record<string, unknown>)[type]) {
codecTypes[type] = true; codecTypes[type] = true;
+22 -18
View File
@@ -1,27 +1,31 @@
{ {
"name": "@polkadot/types-known", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "Known type definitions", "description": "Known type definitions",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/types-known",
"repository": {
"directory": "packages/types-known",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/networks": "^7.5.1", "@polkadot/networks": "^7.8.2",
"@polkadot/types": "6.4.2", "@polkadot/types": "6.7.1",
"@polkadot/util": "^7.5.1" "@polkadot/util": "^7.8.2"
} }
} }
+29 -32
View File
@@ -7,7 +7,7 @@ import type { Hash } from '@polkadot/types/interfaces';
import type { ChainUpgradeVersion, CodecHasher, DefinitionRpc, DefinitionRpcSub, OverrideModuleType, OverrideVersionedType, Registry, RegistryTypes } from '@polkadot/types/types'; import type { ChainUpgradeVersion, CodecHasher, DefinitionRpc, DefinitionRpcSub, OverrideModuleType, OverrideVersionedType, Registry, RegistryTypes } from '@polkadot/types/types';
import type { BN } from '@polkadot/util'; import type { BN } from '@polkadot/util';
import { bnToBn, isNull, isUndefined } from '@polkadot/util'; import { bnToBn, isNull, isUndefined, objectSpread } from '@polkadot/util';
import typesChain from './chain'; import typesChain from './chain';
import typesModules from './modules'; import typesModules from './modules';
@@ -16,6 +16,7 @@ import upgrades from './upgrades';
export { knownOrigins } from './knownOrigins'; export { knownOrigins } from './knownOrigins';
export { packageInfo } from './packageInfo'; export { packageInfo } from './packageInfo';
export { mapXcmTypes } from './xcm';
// flatten a VersionedType[] into a Record<string, string> // flatten a VersionedType[] into a Record<string, string>
/** @internal */ /** @internal */
@@ -25,20 +26,16 @@ function filterVersions (versions: OverrideVersionedType[] = [], specVersion: nu
(isUndefined(min) || isNull(min) || specVersion >= min) && (isUndefined(min) || isNull(min) || specVersion >= min) &&
(isUndefined(max) || isNull(max) || specVersion <= max) (isUndefined(max) || isNull(max) || specVersion <= max)
) )
.reduce((result: RegistryTypes, { types }): RegistryTypes => ({ .reduce((result: RegistryTypes, { types }): RegistryTypes =>
...result, objectSpread(result, types), {}
...types );
}), {});
} }
/** /**
* @description Get types for specific modules (metadata override) * @description Get types for specific modules (metadata override)
*/ */
export function getModuleTypes ({ knownTypes }: Registry, section: string): OverrideModuleType { export function getModuleTypes ({ knownTypes }: Registry, section: string): OverrideModuleType {
return { return objectSpread({}, typesModules[section], knownTypes.typesAlias?.[section]);
...(typesModules[section] || {}),
...(knownTypes.typesAlias?.[section] || {})
};
} }
/** /**
@@ -48,10 +45,10 @@ export function getSpecExtensions ({ knownTypes }: Registry, chainName: Text | s
const _chainName = chainName.toString(); const _chainName = chainName.toString();
const _specName = specName.toString(); const _specName = specName.toString();
return { return objectSpread({},
...(knownTypes.typesBundle?.spec?.[_specName]?.signedExtensions || {}), knownTypes.typesBundle?.spec?.[_specName]?.signedExtensions,
...(knownTypes.typesBundle?.chain?.[_chainName]?.signedExtensions || {}) knownTypes.typesBundle?.chain?.[_chainName]?.signedExtensions
}; );
} }
/** /**
@@ -66,15 +63,15 @@ export function getSpecTypes ({ knownTypes }: Registry, chainName: Text | string
// - spec then chain // - spec then chain
// - typesBundle takes higher precedence // - typesBundle takes higher precedence
// - types is the final catch-all override // - types is the final catch-all override
return { return objectSpread({},
...filterVersions(typesSpec[_specName], _specVersion), filterVersions(typesSpec[_specName], _specVersion),
...filterVersions(typesChain[_chainName], _specVersion), filterVersions(typesChain[_chainName], _specVersion),
...filterVersions(knownTypes.typesBundle?.spec?.[_specName]?.types, _specVersion), filterVersions(knownTypes.typesBundle?.spec?.[_specName]?.types, _specVersion),
...filterVersions(knownTypes.typesBundle?.chain?.[_chainName]?.types, _specVersion), filterVersions(knownTypes.typesBundle?.chain?.[_chainName]?.types, _specVersion),
...(knownTypes.typesSpec?.[_specName] || {}), knownTypes.typesSpec?.[_specName],
...(knownTypes.typesChain?.[_chainName] || {}), knownTypes.typesChain?.[_chainName],
...(knownTypes.types || {}) knownTypes.types
}; );
} }
export function getSpecHasher ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): CodecHasher | null { export function getSpecHasher ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): CodecHasher | null {
@@ -91,10 +88,10 @@ export function getSpecRpc ({ knownTypes }: Registry, chainName: Text | string,
const _chainName = chainName.toString(); const _chainName = chainName.toString();
const _specName = specName.toString(); const _specName = specName.toString();
return { return objectSpread({},
...(knownTypes.typesBundle?.spec?.[_specName]?.rpc || {}), knownTypes.typesBundle?.spec?.[_specName]?.rpc,
...(knownTypes.typesBundle?.chain?.[_chainName]?.rpc || {}) knownTypes.typesBundle?.chain?.[_chainName]?.rpc
}; );
} }
/** /**
@@ -105,11 +102,11 @@ export function getSpecAlias ({ knownTypes }: Registry, chainName: Text | string
const _specName = specName.toString(); const _specName = specName.toString();
// as per versions, first spec, then chain then finally non-versioned // as per versions, first spec, then chain then finally non-versioned
return { return objectSpread({},
...(knownTypes.typesBundle?.spec?.[_specName]?.alias || {}), knownTypes.typesBundle?.spec?.[_specName]?.alias,
...(knownTypes.typesBundle?.chain?.[_chainName]?.alias || {}), knownTypes.typesBundle?.chain?.[_chainName]?.alias,
...(knownTypes.typesAlias || {}) knownTypes.typesAlias
}; );
} }
/** /**
@@ -120,7 +117,7 @@ export function getUpgradeVersion (genesisHash: Hash, blockNumber: BN): [ChainUp
return known return known
? [ ? [
known.versions.reduce((last: ChainUpgradeVersion | undefined, version): ChainUpgradeVersion | undefined => { known.versions.reduce<ChainUpgradeVersion | undefined>((last, version) => {
return blockNumber.gt(version.blockNumber) return blockNumber.gt(version.blockNumber)
? version ? version
: last; : last;
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '6.4.2' }; export const packageInfo = { name: '@polkadot/types-known', version: '6.7.1' };
@@ -5,6 +5,8 @@
import type { OverrideVersionedType } from '@polkadot/types/types'; import type { OverrideVersionedType } from '@polkadot/types/types';
import { objectSpread } from '@polkadot/util';
const sharedTypes = { const sharedTypes = {
// Anchor // Anchor
AnchorData: { AnchorData: {
@@ -79,20 +81,18 @@ const sharedTypes = {
} }
}; };
const standaloneTypes = { const standaloneTypes = objectSpread({}, sharedTypes, {
...sharedTypes,
AccountInfo: 'AccountInfoWithRefCount', AccountInfo: 'AccountInfoWithRefCount',
Address: 'LookupSource', Address: 'LookupSource',
LookupSource: 'IndicesLookupSource', LookupSource: 'IndicesLookupSource',
Multiplier: 'Fixed64', Multiplier: 'Fixed64',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
}; });
const versioned: OverrideVersionedType[] = [ const versioned: OverrideVersionedType[] = [
{ {
minmax: [240, 243], minmax: [240, 243],
types: { types: objectSpread({}, standaloneTypes, {
...standaloneTypes,
ProxyType: { ProxyType: {
_enum: [ _enum: [
'Any', 'Any',
@@ -102,19 +102,15 @@ const versioned: OverrideVersionedType[] = [
'Vesting' 'Vesting'
] ]
} }
} })
}, },
{ {
minmax: [244, 999], minmax: [244, 999],
types: { types: objectSpread({}, standaloneTypes)
...standaloneTypes
}
}, },
{ {
minmax: [1000, undefined], minmax: [1000, undefined],
types: { types: objectSpread({}, sharedTypes)
...sharedTypes
}
} }
]; ];
+29 -56
View File
@@ -5,7 +5,9 @@
import type { OverrideVersionedType } from '@polkadot/types/types'; import type { OverrideVersionedType } from '@polkadot/types/types';
import { mapXcm } from '@polkadot/types/interfaces/xcm/definitions'; import { objectSpread } from '@polkadot/util';
import { mapXcmTypes } from '../xcm';
const sharedTypes = { const sharedTypes = {
CompactAssignments: 'CompactAssignmentsWith24', CompactAssignments: 'CompactAssignmentsWith24',
@@ -40,8 +42,7 @@ const versioned: OverrideVersionedType[] = [
{ {
// 1020 is first CC3 // 1020 is first CC3
minmax: [1019, 1031], minmax: [1019, 1031],
types: { types: objectSpread({}, addrIndicesTypes, {
...addrIndicesTypes,
BalanceLock: 'BalanceLockTo212', BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchError: 'DispatchErrorTo198', DispatchError: 'DispatchErrorTo198',
@@ -57,12 +58,11 @@ const versioned: OverrideVersionedType[] = [
StakingLedger: 'StakingLedgerTo223', StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230', Votes: 'VotesTo230',
Weight: 'u32' Weight: 'u32'
} })
}, },
{ {
minmax: [1032, 1042], minmax: [1032, 1042],
types: { types: objectSpread({}, addrIndicesTypes, {
...addrIndicesTypes,
BalanceLock: 'BalanceLockTo212', BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
@@ -76,13 +76,12 @@ const versioned: OverrideVersionedType[] = [
StakingLedger: 'StakingLedgerTo223', StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230', Votes: 'VotesTo230',
Weight: 'u32' Weight: 'u32'
} })
}, },
{ {
// actual at 1045 (1043-1044 is dev) // actual at 1045 (1043-1044 is dev)
minmax: [1043, 1045], minmax: [1043, 1045],
types: { types: objectSpread({}, addrIndicesTypes, {
...addrIndicesTypes,
BalanceLock: 'BalanceLockTo212', BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
@@ -95,14 +94,11 @@ const versioned: OverrideVersionedType[] = [
StakingLedger: 'StakingLedgerTo223', StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230', Votes: 'VotesTo230',
Weight: 'u32' Weight: 'u32'
} })
}, },
{ {
minmax: [1046, 1054], minmax: [1046, 1054],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
// Indices optional, not in transaction
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244', Heartbeat: 'HeartbeatTo244',
@@ -112,13 +108,11 @@ const versioned: OverrideVersionedType[] = [
ReferendumInfo: 'ReferendumInfoTo239', ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240', StakingLedger: 'StakingLedgerTo240',
Weight: 'u32' Weight: 'u32'
} })
}, },
{ {
minmax: [1055, 1056], minmax: [1055, 1056],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244', Heartbeat: 'HeartbeatTo244',
@@ -127,92 +121,71 @@ const versioned: OverrideVersionedType[] = [
RefCount: 'RefCountTo259', RefCount: 'RefCountTo259',
StakingLedger: 'StakingLedgerTo240', StakingLedger: 'StakingLedgerTo240',
Weight: 'u32' Weight: 'u32'
} })
}, },
{ {
minmax: [1057, 1061], minmax: [1057, 1061],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244', Heartbeat: 'HeartbeatTo244',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [1062, 2012], minmax: [1062, 2012],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [2013, 2022], minmax: [2013, 2022],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [2023, 2024], minmax: [2023, 2024],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [2025, 2027], minmax: [2025, 2027],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes)
...sharedTypes,
...addrAccountIdTypes
}
}, },
{ {
minmax: [2028, 2029], minmax: [2028, 2029],
types: { types: objectSpread({}, sharedTypes, {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount', AccountInfo: 'AccountInfoWithDualRefCount',
CompactAssignments: 'CompactAssignmentsWith16', CompactAssignments: 'CompactAssignmentsWith16',
RawSolution: 'RawSolutionWith16' RawSolution: 'RawSolutionWith16'
} })
}, },
{ {
minmax: [2030, 9000], minmax: [2030, 9000],
types: { types: objectSpread({}, sharedTypes, {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsWith16', CompactAssignments: 'CompactAssignmentsWith16',
RawSolution: 'RawSolutionWith16' RawSolution: 'RawSolutionWith16'
} })
}, },
{ {
minmax: [9010, 9099], minmax: [9010, 9099],
types: { types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
...sharedTypes,
...mapXcm('V0')
}
}, },
{ {
// jump from 9100 to 9110, however align with Rococo // jump from 9100 to 9110, however align with Rococo
minmax: [9100, 9105], minmax: [9100, 9105],
types: { types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
...sharedTypes,
...mapXcm('V1')
}
}, },
{ {
// metadata v14 // metadata v14
minmax: [9106, undefined], minmax: [9106, undefined],
types: { types: objectSpread({}, sharedTypes)
...sharedTypes
}
} }
]; ];
+15 -26
View File
@@ -5,6 +5,8 @@
import type { OverrideVersionedType } from '@polkadot/types/types'; import type { OverrideVersionedType } from '@polkadot/types/types';
import { objectSpread } from '@polkadot/util';
const sharedTypes = { const sharedTypes = {
CompactAssignments: 'CompactAssignmentsWith16', CompactAssignments: 'CompactAssignmentsWith16',
RawSolution: 'RawSolutionWith16', RawSolution: 'RawSolutionWith16',
@@ -17,7 +19,8 @@ const sharedTypes = {
Staking: 3, Staking: 3,
UnusedSudoBalances: 4, UnusedSudoBalances: 4,
IdentityJudgement: 5, IdentityJudgement: 5,
CancelProxy: 6 CancelProxy: 6,
Auction: 7
} }
} }
}; };
@@ -34,57 +37,43 @@ const addrAccountIdTypes = {
const versioned: OverrideVersionedType[] = [ const versioned: OverrideVersionedType[] = [
{ {
minmax: [0, 12], minmax: [0, 12],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [13, 22], minmax: [13, 22],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [23, 24], minmax: [23, 24],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [25, 27], minmax: [25, 27],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes)
...sharedTypes,
...addrAccountIdTypes
}
}, },
{ {
minmax: [28, 29], minmax: [28, 29],
types: { types: objectSpread({}, sharedTypes, {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount' AccountInfo: 'AccountInfoWithDualRefCount'
} })
}, },
{ {
minmax: [30, 9109], minmax: [30, 9109],
types: { types: objectSpread({}, sharedTypes)
...sharedTypes
}
}, },
{ {
// metadata v14 // metadata v14
minmax: [9110, undefined], minmax: [9110, undefined],
types: { types: objectSpread({}, sharedTypes)
...sharedTypes
}
} }
]; ];
+12 -21
View File
@@ -5,7 +5,9 @@
import type { OverrideVersionedType } from '@polkadot/types/types'; import type { OverrideVersionedType } from '@polkadot/types/types';
import { mapXcm } from '@polkadot/types/interfaces/xcm/definitions'; import { objectSpread } from '@polkadot/util';
import { mapXcmTypes } from '../xcm';
// structs need to be in order // structs need to be in order
/* eslint-disable sort-keys */ /* eslint-disable sort-keys */
@@ -18,47 +20,36 @@ const sharedTypes = {
const versioned: OverrideVersionedType[] = [ const versioned: OverrideVersionedType[] = [
{ {
minmax: [0, 200], minmax: [0, 200],
types: { types: objectSpread({}, sharedTypes, {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount', AccountInfo: 'AccountInfoWithDualRefCount',
Address: 'AccountId', Address: 'AccountId',
LookupSource: 'AccountId' LookupSource: 'AccountId'
} })
}, },
{ {
minmax: [201, 214], minmax: [201, 214],
types: { types: objectSpread({}, sharedTypes, {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount' AccountInfo: 'AccountInfoWithDualRefCount'
} })
}, },
{ {
minmax: [215, 228], minmax: [215, 228],
types: { types: objectSpread({}, sharedTypes, {
...sharedTypes,
Keys: 'SessionKeys6' Keys: 'SessionKeys6'
} })
}, },
{ {
minmax: [229, 9099], minmax: [229, 9099],
types: { types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
...sharedTypes,
...mapXcm('V0')
}
}, },
{ {
minmax: [9100, 9105], minmax: [9100, 9105],
types: { types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
...sharedTypes,
...mapXcm('V1')
}
}, },
{ {
// metadata v14 // metadata v14
minmax: [9106, undefined], minmax: [9106, undefined],
types: { types: objectSpread({}, sharedTypes)
...sharedTypes
}
} }
]; ];
+6 -12
View File
@@ -5,7 +5,9 @@
import type { OverrideVersionedType } from '@polkadot/types/types'; import type { OverrideVersionedType } from '@polkadot/types/types';
import { mapXcm } from '@polkadot/types/interfaces/xcm/definitions'; import { objectSpread } from '@polkadot/util';
import { mapXcmTypes } from '../xcm';
const sharedTypes = { const sharedTypes = {
TAssetBalance: 'u128', TAssetBalance: 'u128',
@@ -26,24 +28,16 @@ const sharedTypes = {
const versioned: OverrideVersionedType[] = [ const versioned: OverrideVersionedType[] = [
{ {
minmax: [0, 3], minmax: [0, 3],
types: { types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
...sharedTypes,
...mapXcm('V0')
}
}, },
{ {
minmax: [4, 5], minmax: [4, 5],
types: { types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
...sharedTypes,
...mapXcm('V1')
}
}, },
{ {
// metadata V14 // metadata V14
minmax: [500, undefined], minmax: [500, undefined],
types: { types: objectSpread({}, sharedTypes)
...sharedTypes
}
} }
]; ];
+17 -35
View File
@@ -5,7 +5,9 @@
import type { OverrideVersionedType } from '@polkadot/types/types'; import type { OverrideVersionedType } from '@polkadot/types/types';
import { mapXcm } from '@polkadot/types/interfaces/xcm/definitions'; import { objectSpread } from '@polkadot/util';
import { mapXcmTypes } from '../xcm';
const sharedTypes = { const sharedTypes = {
// 16 validators // 16 validators
@@ -31,9 +33,7 @@ const addrAccountIdTypes = {
const versioned: OverrideVersionedType[] = [ const versioned: OverrideVersionedType[] = [
{ {
minmax: [1, 2], minmax: [1, 2],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244', Heartbeat: 'HeartbeatTo244',
@@ -41,75 +41,57 @@ const versioned: OverrideVersionedType[] = [
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259', RefCount: 'RefCountTo259',
Weight: 'u32' Weight: 'u32'
} })
}, },
{ {
minmax: [3, 22], minmax: [3, 22],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244', Heartbeat: 'HeartbeatTo244',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [23, 42], minmax: [23, 42],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244', Heartbeat: 'HeartbeatTo244',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [43, 44], minmax: [43, 44],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
...sharedTypes,
...addrAccountIdTypes,
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244', Heartbeat: 'HeartbeatTo244',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} })
}, },
{ {
minmax: [45, 47], minmax: [45, 47],
types: { types: objectSpread({}, sharedTypes, addrAccountIdTypes)
...sharedTypes,
...addrAccountIdTypes
}
}, },
{ {
minmax: [48, 49], minmax: [48, 49],
types: { types: objectSpread({}, sharedTypes, {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount' AccountInfo: 'AccountInfoWithDualRefCount'
} })
}, },
{ {
minmax: [50, 9099], minmax: [50, 9099],
types: { types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
...sharedTypes,
...mapXcm('V0')
}
}, },
{ {
minmax: [9100, 9105], minmax: [9100, 9105],
types: { types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
...sharedTypes,
...mapXcm('V1')
}
}, },
{ {
// metadata v14 // metadata v14
minmax: [9106, undefined], minmax: [9106, undefined],
types: { types: objectSpread({}, sharedTypes)
...sharedTypes
}
} }
]; ];
+1 -1
View File
@@ -14,7 +14,7 @@ const upgrades: ChainUpgradesRaw = [
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027], [3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030], [6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080], [8945245, 9090], [7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080], [8945245, 9090],
[9611377, 9100], [9625129, 9111] [9611377, 9100], [9625129, 9111], [9866422, 9122]
]; ];
export default upgrades; export default upgrades;
+2 -1
View File
@@ -11,7 +11,8 @@ const upgrades: ChainUpgradesRaw = [
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49], [2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
[5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030], [5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030],
[5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070], [5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070],
[6379314, 9080], [6979141, 9090], [7568453, 9100], [7766392, 9111] [6379314, 9080], [6979141, 9090], [7568453, 9100], [7766394, 9111], [7911691, 9120],
[7968866, 9121], [7982889, 9122]
]; ];
export default upgrades; export default upgrades;
+12
View File
@@ -0,0 +1,12 @@
// Copyright 2017-2021 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { objectSpread } from '@polkadot/util';
export const XCM_MAPPINGS = ['AssetInstance', 'Fungibility', 'Junction', 'Junctions', 'MultiAsset', 'MultiAssetFilter', 'MultiLocation', 'Response', 'WildFungibility', 'WildMultiAsset', 'Xcm', 'XcmError', 'XcmOrder'];
export function mapXcmTypes (version: 'V0' | 'V1' | 'V2'): Record<string, string> {
return XCM_MAPPINGS.reduce<Record<string, string>>((all, key) =>
objectSpread(all, { [key]: `${key}${version}` }), {}
);
}
+20 -16
View File
@@ -1,25 +1,29 @@
{ {
"name": "@polkadot/types-support", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "Supporting files for types, mostly for testing", "description": "Supporting files for types, mostly for testing",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-support#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/types-support",
"repository": {
"directory": "packages/types-support",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-support#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/util": "^7.5.1" "@polkadot/util": "^7.8.2"
} }
} }
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
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 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-support', version: '6.4.2' }; export const packageInfo = { name: '@polkadot/types-support', version: '6.7.1' };
+23 -19
View File
@@ -1,32 +1,36 @@
{ {
"name": "@polkadot/types", "author": "Jaco Greeff <jacogr@gmail.com>",
"version": "6.4.2", "bugs": "https://github.com/polkadot-js/api/issues",
"type": "module", "contributors": [],
"description": "Implementation of the Parity codec", "description": "Implementation of the Parity codec",
"main": "index.js", "engines": {
"node": ">=14.0.0"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/types",
"repository": {
"directory": "packages/types",
"type": "git",
"url": "https://github.com/polkadot-js/api.git"
},
"sideEffects": [ "sideEffects": [
"./detectPackage.js", "./detectPackage.js",
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"engines": { "type": "module",
"node": ">=14.0.0" "version": "6.7.1",
}, "main": "index.js",
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.16.0",
"@polkadot/util": "^7.5.1", "@polkadot/util": "^7.8.2",
"@polkadot/util-crypto": "^7.5.1", "@polkadot/util-crypto": "^7.8.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.5.1", "@polkadot/keyring": "^7.8.2",
"@polkadot/types-support": "6.4.2", "@polkadot/types-support": "6.7.1",
"@types/bn.js": "^4.11.6", "@types/bn.js": "^4.11.6",
"bn.js": "^4.12.0" "bn.js": "^4.12.0"
} }
@@ -3,17 +3,15 @@
import type { Definitions } from '../../types'; import type { Definitions } from '../../types';
import { objectSpread } from '@polkadot/util';
import kusama from './kusama'; import kusama from './kusama';
import polkadot from './polkadot'; import polkadot from './polkadot';
import substrate from './substrate'; import substrate from './substrate';
export default { export default {
rpc: {}, rpc: {},
types: { // Not 100% sure it is relevant, however the order here is the same
// Not 100% sure it is relevant, however the order here is the same // as exposed in the typegen lookup order
// as exposed in the typegen lookup order types: objectSpread({}, substrate, polkadot, kusama)
...substrate,
...polkadot,
...kusama
}
} as Definitions; } as Definitions;
+263 -263
View File
@@ -429,264 +429,7 @@ export default {
authorityDiscovery: 'SpAuthorityDiscoveryAppPublic' authorityDiscovery: 'SpAuthorityDiscoveryAppPublic'
}, },
/** /**
* Lookup371: kusama_runtime::NposCompactSolution24 * Lookup316: kusama_runtime::OriginCaller
**/
KusamaRuntimeNposCompactSolution24: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
votes2: 'Vec<(Compact<u32>,(Compact<u16>,Compact<PerU16>),Compact<u16>)>',
votes3: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);2],Compact<u16>)>',
votes4: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);3],Compact<u16>)>',
votes5: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);4],Compact<u16>)>',
votes6: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);5],Compact<u16>)>',
votes7: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);6],Compact<u16>)>',
votes8: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);7],Compact<u16>)>',
votes9: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);8],Compact<u16>)>',
votes10: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);9],Compact<u16>)>',
votes11: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);10],Compact<u16>)>',
votes12: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);11],Compact<u16>)>',
votes13: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);12],Compact<u16>)>',
votes14: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);13],Compact<u16>)>',
votes15: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);14],Compact<u16>)>',
votes16: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);15],Compact<u16>)>',
votes17: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);16],Compact<u16>)>',
votes18: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);17],Compact<u16>)>',
votes19: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);18],Compact<u16>)>',
votes20: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);19],Compact<u16>)>',
votes21: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);20],Compact<u16>)>',
votes22: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);21],Compact<u16>)>',
votes23: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);22],Compact<u16>)>',
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
},
/**
* Lookup504: xcm::VersionedXcm<Call>
**/
XcmVersionedXcm: {
_enum: {
V0: 'XcmV0Xcm',
V1: 'XcmV1Xcm',
V2: 'XcmV2Xcm'
}
},
/**
* Lookup505: xcm::v0::Xcm<Call>
**/
XcmV0Xcm: {
_enum: {
WithdrawAsset: {
assets: 'Vec<XcmV0MultiAsset>',
effects: 'Vec<XcmV0Order>',
},
ReserveAssetDeposit: {
assets: 'Vec<XcmV0MultiAsset>',
effects: 'Vec<XcmV0Order>',
},
TeleportAsset: {
assets: 'Vec<XcmV0MultiAsset>',
effects: 'Vec<XcmV0Order>',
},
QueryResponse: {
queryId: 'Compact<u64>',
response: 'XcmV0Response',
},
TransferAsset: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
},
TransferReserveAsset: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
effects: 'Vec<XcmV0Order>',
},
Transact: {
originType: 'XcmV0OriginKind',
requireWeightAtMost: 'u64',
call: 'XcmDoubleEncoded',
},
HrmpNewChannelOpenRequest: {
sender: 'Compact<u32>',
maxMessageSize: 'Compact<u32>',
maxCapacity: 'Compact<u32>',
},
HrmpChannelAccepted: {
recipient: 'Compact<u32>',
},
HrmpChannelClosing: {
initiator: 'Compact<u32>',
sender: 'Compact<u32>',
recipient: 'Compact<u32>',
},
RelayedFrom: {
who: 'XcmV0MultiLocation',
message: 'XcmV0Xcm'
}
}
},
/**
* Lookup507: xcm::v0::order::Order<Call>
**/
XcmV0Order: {
_enum: {
Null: 'Null',
DepositAsset: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
},
DepositReserveAsset: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
effects: 'Vec<XcmV0Order>',
},
ExchangeAsset: {
give: 'Vec<XcmV0MultiAsset>',
receive: 'Vec<XcmV0MultiAsset>',
},
InitiateReserveWithdraw: {
assets: 'Vec<XcmV0MultiAsset>',
reserve: 'XcmV0MultiLocation',
effects: 'Vec<XcmV0Order>',
},
InitiateTeleport: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
effects: 'Vec<XcmV0Order>',
},
QueryHolding: {
queryId: 'Compact<u64>',
dest: 'XcmV0MultiLocation',
assets: 'Vec<XcmV0MultiAsset>',
},
BuyExecution: {
fees: 'XcmV0MultiAsset',
weight: 'u64',
debt: 'u64',
haltOnError: 'bool',
xcm: 'Vec<XcmV0Xcm>'
}
}
},
/**
* Lookup509: xcm::v0::Response
**/
XcmV0Response: {
_enum: {
Assets: 'Vec<XcmV0MultiAsset>'
}
},
/**
* Lookup510: xcm::v1::Xcm<Call>
**/
XcmV1Xcm: {
_enum: {
WithdrawAsset: {
assets: 'XcmV1MultiassetMultiAssets',
effects: 'Vec<XcmV1Order>',
},
ReserveAssetDeposited: {
assets: 'XcmV1MultiassetMultiAssets',
effects: 'Vec<XcmV1Order>',
},
ReceiveTeleportedAsset: {
assets: 'XcmV1MultiassetMultiAssets',
effects: 'Vec<XcmV1Order>',
},
QueryResponse: {
queryId: 'Compact<u64>',
response: 'XcmV1Response',
},
TransferAsset: {
assets: 'XcmV1MultiassetMultiAssets',
beneficiary: 'XcmV1MultiLocation',
},
TransferReserveAsset: {
assets: 'XcmV1MultiassetMultiAssets',
dest: 'XcmV1MultiLocation',
effects: 'Vec<XcmV1Order>',
},
Transact: {
originType: 'XcmV0OriginKind',
requireWeightAtMost: 'u64',
call: 'XcmDoubleEncoded',
},
HrmpNewChannelOpenRequest: {
sender: 'Compact<u32>',
maxMessageSize: 'Compact<u32>',
maxCapacity: 'Compact<u32>',
},
HrmpChannelAccepted: {
recipient: 'Compact<u32>',
},
HrmpChannelClosing: {
initiator: 'Compact<u32>',
sender: 'Compact<u32>',
recipient: 'Compact<u32>',
},
RelayedFrom: {
who: 'XcmV1MultilocationJunctions',
message: 'XcmV1Xcm',
},
SubscribeVersion: {
queryId: 'Compact<u64>',
maxResponseWeight: 'Compact<u64>',
},
UnsubscribeVersion: 'Null'
}
},
/**
* Lookup512: xcm::v1::order::Order<Call>
**/
XcmV1Order: {
_enum: {
Noop: 'Null',
DepositAsset: {
assets: 'XcmV1MultiassetMultiAssetFilter',
maxAssets: 'u32',
beneficiary: 'XcmV1MultiLocation',
},
DepositReserveAsset: {
assets: 'XcmV1MultiassetMultiAssetFilter',
maxAssets: 'u32',
dest: 'XcmV1MultiLocation',
effects: 'Vec<XcmV1Order>',
},
ExchangeAsset: {
give: 'XcmV1MultiassetMultiAssetFilter',
receive: 'XcmV1MultiassetMultiAssets',
},
InitiateReserveWithdraw: {
assets: 'XcmV1MultiassetMultiAssetFilter',
reserve: 'XcmV1MultiLocation',
effects: 'Vec<XcmV1Order>',
},
InitiateTeleport: {
assets: 'XcmV1MultiassetMultiAssetFilter',
dest: 'XcmV1MultiLocation',
effects: 'Vec<XcmV1Order>',
},
QueryHolding: {
queryId: 'Compact<u64>',
dest: 'XcmV1MultiLocation',
assets: 'XcmV1MultiassetMultiAssetFilter',
},
BuyExecution: {
fees: 'XcmV1MultiAsset',
weight: 'u64',
debt: 'u64',
haltOnError: 'bool',
instructions: 'Vec<XcmV1Xcm>'
}
}
},
/**
* Lookup514: xcm::v1::Response
**/
XcmV1Response: {
_enum: {
Assets: 'XcmV1MultiassetMultiAssets',
Version: 'u32'
}
},
/**
* Lookup575: kusama_runtime::OriginCaller
**/ **/
KusamaRuntimeOriginCaller: { KusamaRuntimeOriginCaller: {
_enum: { _enum: {
@@ -793,7 +536,7 @@ export default {
} }
}, },
/** /**
* Lookup580: pallet_xcm::pallet::Origin * Lookup321: pallet_xcm::pallet::Origin
**/ **/
PalletXcmOrigin: { PalletXcmOrigin: {
_enum: { _enum: {
@@ -802,7 +545,264 @@ export default {
} }
}, },
/** /**
* Lookup689: pallet_xcm::pallet::QueryStatus<BlockNumber> * Lookup379: kusama_runtime::NposCompactSolution24
**/
KusamaRuntimeNposCompactSolution24: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
votes2: 'Vec<(Compact<u32>,(Compact<u16>,Compact<PerU16>),Compact<u16>)>',
votes3: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);2],Compact<u16>)>',
votes4: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);3],Compact<u16>)>',
votes5: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);4],Compact<u16>)>',
votes6: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);5],Compact<u16>)>',
votes7: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);6],Compact<u16>)>',
votes8: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);7],Compact<u16>)>',
votes9: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);8],Compact<u16>)>',
votes10: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);9],Compact<u16>)>',
votes11: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);10],Compact<u16>)>',
votes12: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);11],Compact<u16>)>',
votes13: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);12],Compact<u16>)>',
votes14: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);13],Compact<u16>)>',
votes15: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);14],Compact<u16>)>',
votes16: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);15],Compact<u16>)>',
votes17: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);16],Compact<u16>)>',
votes18: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);17],Compact<u16>)>',
votes19: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);18],Compact<u16>)>',
votes20: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);19],Compact<u16>)>',
votes21: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);20],Compact<u16>)>',
votes22: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);21],Compact<u16>)>',
votes23: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);22],Compact<u16>)>',
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
},
/**
* Lookup512: xcm::VersionedXcm<Call>
**/
XcmVersionedXcm: {
_enum: {
V0: 'XcmV0Xcm',
V1: 'XcmV1Xcm',
V2: 'XcmV2Xcm'
}
},
/**
* Lookup513: xcm::v0::Xcm<Call>
**/
XcmV0Xcm: {
_enum: {
WithdrawAsset: {
assets: 'Vec<XcmV0MultiAsset>',
effects: 'Vec<XcmV0Order>',
},
ReserveAssetDeposit: {
assets: 'Vec<XcmV0MultiAsset>',
effects: 'Vec<XcmV0Order>',
},
TeleportAsset: {
assets: 'Vec<XcmV0MultiAsset>',
effects: 'Vec<XcmV0Order>',
},
QueryResponse: {
queryId: 'Compact<u64>',
response: 'XcmV0Response',
},
TransferAsset: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
},
TransferReserveAsset: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
effects: 'Vec<XcmV0Order>',
},
Transact: {
originType: 'XcmV0OriginKind',
requireWeightAtMost: 'u64',
call: 'XcmDoubleEncoded',
},
HrmpNewChannelOpenRequest: {
sender: 'Compact<u32>',
maxMessageSize: 'Compact<u32>',
maxCapacity: 'Compact<u32>',
},
HrmpChannelAccepted: {
recipient: 'Compact<u32>',
},
HrmpChannelClosing: {
initiator: 'Compact<u32>',
sender: 'Compact<u32>',
recipient: 'Compact<u32>',
},
RelayedFrom: {
who: 'XcmV0MultiLocation',
message: 'XcmV0Xcm'
}
}
},
/**
* Lookup515: xcm::v0::order::Order<Call>
**/
XcmV0Order: {
_enum: {
Null: 'Null',
DepositAsset: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
},
DepositReserveAsset: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
effects: 'Vec<XcmV0Order>',
},
ExchangeAsset: {
give: 'Vec<XcmV0MultiAsset>',
receive: 'Vec<XcmV0MultiAsset>',
},
InitiateReserveWithdraw: {
assets: 'Vec<XcmV0MultiAsset>',
reserve: 'XcmV0MultiLocation',
effects: 'Vec<XcmV0Order>',
},
InitiateTeleport: {
assets: 'Vec<XcmV0MultiAsset>',
dest: 'XcmV0MultiLocation',
effects: 'Vec<XcmV0Order>',
},
QueryHolding: {
queryId: 'Compact<u64>',
dest: 'XcmV0MultiLocation',
assets: 'Vec<XcmV0MultiAsset>',
},
BuyExecution: {
fees: 'XcmV0MultiAsset',
weight: 'u64',
debt: 'u64',
haltOnError: 'bool',
xcm: 'Vec<XcmV0Xcm>'
}
}
},
/**
* Lookup517: xcm::v0::Response
**/
XcmV0Response: {
_enum: {
Assets: 'Vec<XcmV0MultiAsset>'
}
},
/**
* Lookup518: xcm::v1::Xcm<Call>
**/
XcmV1Xcm: {
_enum: {
WithdrawAsset: {
assets: 'XcmV1MultiassetMultiAssets',
effects: 'Vec<XcmV1Order>',
},
ReserveAssetDeposited: {
assets: 'XcmV1MultiassetMultiAssets',
effects: 'Vec<XcmV1Order>',
},
ReceiveTeleportedAsset: {
assets: 'XcmV1MultiassetMultiAssets',
effects: 'Vec<XcmV1Order>',
},
QueryResponse: {
queryId: 'Compact<u64>',
response: 'XcmV1Response',
},
TransferAsset: {
assets: 'XcmV1MultiassetMultiAssets',
beneficiary: 'XcmV1MultiLocation',
},
TransferReserveAsset: {
assets: 'XcmV1MultiassetMultiAssets',
dest: 'XcmV1MultiLocation',
effects: 'Vec<XcmV1Order>',
},
Transact: {
originType: 'XcmV0OriginKind',
requireWeightAtMost: 'u64',
call: 'XcmDoubleEncoded',
},
HrmpNewChannelOpenRequest: {
sender: 'Compact<u32>',
maxMessageSize: 'Compact<u32>',
maxCapacity: 'Compact<u32>',
},
HrmpChannelAccepted: {
recipient: 'Compact<u32>',
},
HrmpChannelClosing: {
initiator: 'Compact<u32>',
sender: 'Compact<u32>',
recipient: 'Compact<u32>',
},
RelayedFrom: {
who: 'XcmV1MultilocationJunctions',
message: 'XcmV1Xcm',
},
SubscribeVersion: {
queryId: 'Compact<u64>',
maxResponseWeight: 'Compact<u64>',
},
UnsubscribeVersion: 'Null'
}
},
/**
* Lookup520: xcm::v1::order::Order<Call>
**/
XcmV1Order: {
_enum: {
Noop: 'Null',
DepositAsset: {
assets: 'XcmV1MultiassetMultiAssetFilter',
maxAssets: 'u32',
beneficiary: 'XcmV1MultiLocation',
},
DepositReserveAsset: {
assets: 'XcmV1MultiassetMultiAssetFilter',
maxAssets: 'u32',
dest: 'XcmV1MultiLocation',
effects: 'Vec<XcmV1Order>',
},
ExchangeAsset: {
give: 'XcmV1MultiassetMultiAssetFilter',
receive: 'XcmV1MultiassetMultiAssets',
},
InitiateReserveWithdraw: {
assets: 'XcmV1MultiassetMultiAssetFilter',
reserve: 'XcmV1MultiLocation',
effects: 'Vec<XcmV1Order>',
},
InitiateTeleport: {
assets: 'XcmV1MultiassetMultiAssetFilter',
dest: 'XcmV1MultiLocation',
effects: 'Vec<XcmV1Order>',
},
QueryHolding: {
queryId: 'Compact<u64>',
dest: 'XcmV1MultiLocation',
assets: 'XcmV1MultiassetMultiAssetFilter',
},
BuyExecution: {
fees: 'XcmV1MultiAsset',
weight: 'u64',
debt: 'u64',
haltOnError: 'bool',
instructions: 'Vec<XcmV1Xcm>'
}
}
},
/**
* Lookup522: xcm::v1::Response
**/
XcmV1Response: {
_enum: {
Assets: 'XcmV1MultiassetMultiAssets',
Version: 'u32'
}
},
/**
* Lookup690: pallet_xcm::pallet::QueryStatus<BlockNumber>
**/ **/
PalletXcmQueryStatus: { PalletXcmQueryStatus: {
_enum: { _enum: {
@@ -822,7 +822,7 @@ export default {
} }
}, },
/** /**
* Lookup692: xcm::VersionedResponse * Lookup693: xcm::VersionedResponse
**/ **/
XcmVersionedResponse: { XcmVersionedResponse: {
_enum: { _enum: {
@@ -832,7 +832,7 @@ export default {
} }
}, },
/** /**
* Lookup698: pallet_xcm::pallet::VersionMigrationStage * Lookup699: pallet_xcm::pallet::VersionMigrationStage
**/ **/
PalletXcmVersionMigrationStage: { PalletXcmVersionMigrationStage: {
_enum: { _enum: {
@@ -843,7 +843,7 @@ export default {
} }
}, },
/** /**
* Lookup710: kusama_runtime::Runtime * Lookup711: kusama_runtime::Runtime
**/ **/
KusamaRuntimeRuntime: 'Null' KusamaRuntimeRuntime: 'Null'
} as DefinitionsTypes; } as DefinitionsTypes;
+179 -183
View File
@@ -6,10 +6,6 @@
import type { DefinitionsTypes } from '../../types'; import type { DefinitionsTypes } from '../../types';
export default { export default {
/**
* Lookup66: polkadot_runtime_common::claims::EthereumAddress
**/
PolkadotRuntimeCommonClaimsEthereumAddress: '[u8;20]',
/** /**
* Lookup72: polkadot_runtime::ProxyType * Lookup72: polkadot_runtime::ProxyType
**/ **/
@@ -17,14 +13,14 @@ export default {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', '__Unused4', 'IdentityJudgement', 'CancelProxy', 'Auction'] _enum: ['Any', 'NonTransfer', 'Governance', 'Staking', '__Unused4', 'IdentityJudgement', 'CancelProxy', 'Auction']
}, },
/** /**
* Lookup82: polkadot_primitives::v1::CandidateReceipt<primitive_types::H256> * Lookup83: polkadot_primitives::v1::CandidateReceipt<primitive_types::H256>
**/ **/
PolkadotPrimitivesV1CandidateReceipt: { PolkadotPrimitivesV1CandidateReceipt: {
descriptor: 'PolkadotPrimitivesV1CandidateDescriptor', descriptor: 'PolkadotPrimitivesV1CandidateDescriptor',
commitmentsHash: 'H256' commitmentsHash: 'H256'
}, },
/** /**
* Lookup83: polkadot_primitives::v1::CandidateDescriptor<primitive_types::H256> * Lookup84: polkadot_primitives::v1::CandidateDescriptor<primitive_types::H256>
**/ **/
PolkadotPrimitivesV1CandidateDescriptor: { PolkadotPrimitivesV1CandidateDescriptor: {
paraId: 'u32', paraId: 'u32',
@@ -38,15 +34,15 @@ export default {
validationCodeHash: 'H256' validationCodeHash: 'H256'
}, },
/** /**
* Lookup85: polkadot_primitives::v0::collator_app::Public * Lookup86: polkadot_primitives::v0::collator_app::Public
**/ **/
PolkadotPrimitivesV0CollatorAppPublic: 'SpCoreSr25519Public', PolkadotPrimitivesV0CollatorAppPublic: 'SpCoreSr25519Public',
/** /**
* Lookup86: polkadot_primitives::v0::collator_app::Signature * Lookup87: polkadot_primitives::v0::collator_app::Signature
**/ **/
PolkadotPrimitivesV0CollatorAppSignature: 'SpCoreSr25519Signature', PolkadotPrimitivesV0CollatorAppSignature: 'SpCoreSr25519Signature',
/** /**
* Lookup95: xcm::v2::traits::Outcome * Lookup96: xcm::v2::traits::Outcome
**/ **/
XcmV2TraitsOutcome: { XcmV2TraitsOutcome: {
_enum: { _enum: {
@@ -56,7 +52,7 @@ export default {
} }
}, },
/** /**
* Lookup96: xcm::v2::traits::Error * Lookup97: xcm::v2::traits::Error
**/ **/
XcmV2TraitsError: { XcmV2TraitsError: {
_enum: { _enum: {
@@ -89,14 +85,14 @@ export default {
} }
}, },
/** /**
* Lookup98: polkadot_parachain::primitives::HrmpChannelId * Lookup99: polkadot_parachain::primitives::HrmpChannelId
**/ **/
PolkadotParachainPrimitivesHrmpChannelId: { PolkadotParachainPrimitivesHrmpChannelId: {
sender: 'u32', sender: 'u32',
recipient: 'u32' recipient: 'u32'
}, },
/** /**
* Lookup161: polkadot_runtime::SessionKeys * Lookup162: polkadot_runtime::SessionKeys
**/ **/
PolkadotRuntimeSessionKeys: { PolkadotRuntimeSessionKeys: {
grandpa: 'SpFinalityGrandpaAppPublic', grandpa: 'SpFinalityGrandpaAppPublic',
@@ -107,162 +103,25 @@ export default {
authorityDiscovery: 'SpAuthorityDiscoveryAppPublic' authorityDiscovery: 'SpAuthorityDiscoveryAppPublic'
}, },
/** /**
* Lookup162: polkadot_primitives::v0::validator_app::Public * Lookup163: polkadot_primitives::v0::validator_app::Public
**/ **/
PolkadotPrimitivesV0ValidatorAppPublic: 'SpCoreSr25519Public', PolkadotPrimitivesV0ValidatorAppPublic: 'SpCoreSr25519Public',
/** /**
* Lookup163: polkadot_primitives::v1::assignment_app::Public * Lookup164: polkadot_primitives::v1::assignment_app::Public
**/ **/
PolkadotPrimitivesV1AssignmentAppPublic: 'SpCoreSr25519Public', PolkadotPrimitivesV1AssignmentAppPublic: 'SpCoreSr25519Public',
/** /**
* Lookup195: polkadot_runtime_common::claims::EcdsaSignature * Lookup196: polkadot_runtime_common::claims::EcdsaSignature
**/ **/
PolkadotRuntimeCommonClaimsEcdsaSignature: '[u8;65]', PolkadotRuntimeCommonClaimsEcdsaSignature: '[u8;65]',
/** /**
* Lookup200: polkadot_runtime_common::claims::StatementKind * Lookup201: polkadot_runtime_common::claims::StatementKind
**/ **/
PolkadotRuntimeCommonClaimsStatementKind: { PolkadotRuntimeCommonClaimsStatementKind: {
_enum: ['Regular', 'Saft'] _enum: ['Regular', 'Saft']
}, },
/** /**
* Lookup253: polkadot_runtime::NposCompactSolution16 * Lookup206: polkadot_runtime::OriginCaller
**/
PolkadotRuntimeNposCompactSolution16: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
votes2: 'Vec<(Compact<u32>,(Compact<u16>,Compact<PerU16>),Compact<u16>)>',
votes3: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);2],Compact<u16>)>',
votes4: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);3],Compact<u16>)>',
votes5: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);4],Compact<u16>)>',
votes6: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);5],Compact<u16>)>',
votes7: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);6],Compact<u16>)>',
votes8: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);7],Compact<u16>)>',
votes9: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);8],Compact<u16>)>',
votes10: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);9],Compact<u16>)>',
votes11: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);10],Compact<u16>)>',
votes12: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);11],Compact<u16>)>',
votes13: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);12],Compact<u16>)>',
votes14: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);13],Compact<u16>)>',
votes15: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);14],Compact<u16>)>',
votes16: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);15],Compact<u16>)>'
},
/**
* Lookup314: polkadot_primitives::v1::InherentData<sp_runtime::generic::header::Header<Number, sp_runtime::traits::BlakeTwo256>>
**/
PolkadotPrimitivesV1InherentData: {
bitfields: 'Vec<PolkadotPrimitivesV1SignedUncheckedSigned>',
backedCandidates: 'Vec<PolkadotPrimitivesV1BackedCandidate>',
disputes: 'Vec<PolkadotPrimitivesV1DisputeStatementSet>',
parentHeader: 'SpRuntimeGenericHeader'
},
/**
* Lookup316: polkadot_primitives::v1::signed::UncheckedSigned<polkadot_primitives::v1::AvailabilityBitfield, polkadot_primitives::v1::AvailabilityBitfield>
**/
PolkadotPrimitivesV1SignedUncheckedSigned: {
payload: 'BitVec',
validatorIndex: 'u32',
signature: 'PolkadotPrimitivesV0ValidatorAppSignature'
},
/**
* Lookup319: bitvec::order::Lsb0
**/
BitvecOrderLsb0: 'Null',
/**
* Lookup321: polkadot_primitives::v0::validator_app::Signature
**/
PolkadotPrimitivesV0ValidatorAppSignature: 'SpCoreSr25519Signature',
/**
* Lookup323: polkadot_primitives::v1::BackedCandidate<primitive_types::H256>
**/
PolkadotPrimitivesV1BackedCandidate: {
candidate: 'PolkadotPrimitivesV1CommittedCandidateReceipt',
validityVotes: 'Vec<PolkadotPrimitivesV0ValidityAttestation>',
validatorIndices: 'BitVec'
},
/**
* Lookup324: polkadot_primitives::v1::CommittedCandidateReceipt<primitive_types::H256>
**/
PolkadotPrimitivesV1CommittedCandidateReceipt: {
descriptor: 'PolkadotPrimitivesV1CandidateDescriptor',
commitments: 'PolkadotPrimitivesV1CandidateCommitments'
},
/**
* Lookup325: polkadot_primitives::v1::CandidateCommitments<N>
**/
PolkadotPrimitivesV1CandidateCommitments: {
upwardMessages: 'Vec<Bytes>',
horizontalMessages: 'Vec<PolkadotCorePrimitivesOutboundHrmpMessage>',
newValidationCode: 'Option<Bytes>',
headData: 'Bytes',
processedDownwardMessages: 'u32',
hrmpWatermark: 'u32'
},
/**
* Lookup327: polkadot_core_primitives::OutboundHrmpMessage<polkadot_parachain::primitives::Id>
**/
PolkadotCorePrimitivesOutboundHrmpMessage: {
recipient: 'u32',
data: 'Bytes'
},
/**
* Lookup331: polkadot_primitives::v0::ValidityAttestation
**/
PolkadotPrimitivesV0ValidityAttestation: {
_enum: {
__Unused0: 'Null',
Implicit: 'PolkadotPrimitivesV0ValidatorAppSignature',
Explicit: 'PolkadotPrimitivesV0ValidatorAppSignature'
}
},
/**
* Lookup333: polkadot_primitives::v1::DisputeStatementSet
**/
PolkadotPrimitivesV1DisputeStatementSet: {
candidateHash: 'H256',
session: 'u32',
statements: 'Vec<(PolkadotPrimitivesV1DisputeStatement,u32,PolkadotPrimitivesV0ValidatorAppSignature)>'
},
/**
* Lookup337: polkadot_primitives::v1::DisputeStatement
**/
PolkadotPrimitivesV1DisputeStatement: {
_enum: {
Valid: 'PolkadotPrimitivesV1ValidDisputeStatementKind',
Invalid: 'PolkadotPrimitivesV1InvalidDisputeStatementKind'
}
},
/**
* Lookup338: polkadot_primitives::v1::ValidDisputeStatementKind
**/
PolkadotPrimitivesV1ValidDisputeStatementKind: {
_enum: {
Explicit: 'Null',
BackingSeconded: 'H256',
BackingValid: 'H256',
ApprovalChecking: 'Null'
}
},
/**
* Lookup339: polkadot_primitives::v1::InvalidDisputeStatementKind
**/
PolkadotPrimitivesV1InvalidDisputeStatementKind: {
_enum: ['Explicit']
},
/**
* Lookup351: sp_runtime::MultiSigner
**/
SpRuntimeMultiSigner: {
_enum: {
Ed25519: 'SpCoreEd25519Public',
Sr25519: 'SpCoreSr25519Public',
Ecdsa: 'SpCoreEcdsaPublic'
}
},
/**
* Lookup352: sp_core::ecdsa::Public
**/
SpCoreEcdsaPublic: '[u8;33]',
/**
* Lookup357: polkadot_runtime::OriginCaller
**/ **/
PolkadotRuntimeOriginCaller: { PolkadotRuntimeOriginCaller: {
_enum: { _enum: {
@@ -320,7 +179,7 @@ export default {
} }
}, },
/** /**
* Lookup361: polkadot_runtime_parachains::origin::pallet::Origin * Lookup210: polkadot_runtime_parachains::origin::pallet::Origin
**/ **/
PolkadotRuntimeParachainsOriginPalletOrigin: { PolkadotRuntimeParachainsOriginPalletOrigin: {
_enum: { _enum: {
@@ -328,7 +187,144 @@ export default {
} }
}, },
/** /**
* Lookup508: polkadot_runtime_parachains::configuration::HostConfiguration<BlockNumber> * Lookup261: polkadot_runtime::NposCompactSolution16
**/
PolkadotRuntimeNposCompactSolution16: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
votes2: 'Vec<(Compact<u32>,(Compact<u16>,Compact<PerU16>),Compact<u16>)>',
votes3: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);2],Compact<u16>)>',
votes4: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);3],Compact<u16>)>',
votes5: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);4],Compact<u16>)>',
votes6: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);5],Compact<u16>)>',
votes7: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);6],Compact<u16>)>',
votes8: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);7],Compact<u16>)>',
votes9: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);8],Compact<u16>)>',
votes10: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);9],Compact<u16>)>',
votes11: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);10],Compact<u16>)>',
votes12: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);11],Compact<u16>)>',
votes13: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);12],Compact<u16>)>',
votes14: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);13],Compact<u16>)>',
votes15: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);14],Compact<u16>)>',
votes16: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);15],Compact<u16>)>'
},
/**
* Lookup323: polkadot_primitives::v1::InherentData<sp_runtime::generic::header::Header<Number, sp_runtime::traits::BlakeTwo256>>
**/
PolkadotPrimitivesV1InherentData: {
bitfields: 'Vec<PolkadotPrimitivesV1SignedUncheckedSigned>',
backedCandidates: 'Vec<PolkadotPrimitivesV1BackedCandidate>',
disputes: 'Vec<PolkadotPrimitivesV1DisputeStatementSet>',
parentHeader: 'SpRuntimeGenericHeader'
},
/**
* Lookup325: polkadot_primitives::v1::signed::UncheckedSigned<polkadot_primitives::v1::AvailabilityBitfield, polkadot_primitives::v1::AvailabilityBitfield>
**/
PolkadotPrimitivesV1SignedUncheckedSigned: {
payload: 'BitVec',
validatorIndex: 'u32',
signature: 'PolkadotPrimitivesV0ValidatorAppSignature'
},
/**
* Lookup328: bitvec::order::Lsb0
**/
BitvecOrderLsb0: 'Null',
/**
* Lookup330: polkadot_primitives::v0::validator_app::Signature
**/
PolkadotPrimitivesV0ValidatorAppSignature: 'SpCoreSr25519Signature',
/**
* Lookup332: polkadot_primitives::v1::BackedCandidate<primitive_types::H256>
**/
PolkadotPrimitivesV1BackedCandidate: {
candidate: 'PolkadotPrimitivesV1CommittedCandidateReceipt',
validityVotes: 'Vec<PolkadotPrimitivesV0ValidityAttestation>',
validatorIndices: 'BitVec'
},
/**
* Lookup333: polkadot_primitives::v1::CommittedCandidateReceipt<primitive_types::H256>
**/
PolkadotPrimitivesV1CommittedCandidateReceipt: {
descriptor: 'PolkadotPrimitivesV1CandidateDescriptor',
commitments: 'PolkadotPrimitivesV1CandidateCommitments'
},
/**
* Lookup334: polkadot_primitives::v1::CandidateCommitments<N>
**/
PolkadotPrimitivesV1CandidateCommitments: {
upwardMessages: 'Vec<Bytes>',
horizontalMessages: 'Vec<PolkadotCorePrimitivesOutboundHrmpMessage>',
newValidationCode: 'Option<Bytes>',
headData: 'Bytes',
processedDownwardMessages: 'u32',
hrmpWatermark: 'u32'
},
/**
* Lookup336: polkadot_core_primitives::OutboundHrmpMessage<polkadot_parachain::primitives::Id>
**/
PolkadotCorePrimitivesOutboundHrmpMessage: {
recipient: 'u32',
data: 'Bytes'
},
/**
* Lookup340: polkadot_primitives::v0::ValidityAttestation
**/
PolkadotPrimitivesV0ValidityAttestation: {
_enum: {
__Unused0: 'Null',
Implicit: 'PolkadotPrimitivesV0ValidatorAppSignature',
Explicit: 'PolkadotPrimitivesV0ValidatorAppSignature'
}
},
/**
* Lookup342: polkadot_primitives::v1::DisputeStatementSet
**/
PolkadotPrimitivesV1DisputeStatementSet: {
candidateHash: 'H256',
session: 'u32',
statements: 'Vec<(PolkadotPrimitivesV1DisputeStatement,u32,PolkadotPrimitivesV0ValidatorAppSignature)>'
},
/**
* Lookup346: polkadot_primitives::v1::DisputeStatement
**/
PolkadotPrimitivesV1DisputeStatement: {
_enum: {
Valid: 'PolkadotPrimitivesV1ValidDisputeStatementKind',
Invalid: 'PolkadotPrimitivesV1InvalidDisputeStatementKind'
}
},
/**
* Lookup347: polkadot_primitives::v1::ValidDisputeStatementKind
**/
PolkadotPrimitivesV1ValidDisputeStatementKind: {
_enum: {
Explicit: 'Null',
BackingSeconded: 'H256',
BackingValid: 'H256',
ApprovalChecking: 'Null'
}
},
/**
* Lookup348: polkadot_primitives::v1::InvalidDisputeStatementKind
**/
PolkadotPrimitivesV1InvalidDisputeStatementKind: {
_enum: ['Explicit']
},
/**
* Lookup360: sp_runtime::MultiSigner
**/
SpRuntimeMultiSigner: {
_enum: {
Ed25519: 'SpCoreEd25519Public',
Sr25519: 'SpCoreSr25519Public',
Ecdsa: 'SpCoreEcdsaPublic'
}
},
/**
* Lookup361: sp_core::ecdsa::Public
**/
SpCoreEcdsaPublic: '[u8;33]',
/**
* Lookup514: polkadot_runtime_parachains::configuration::HostConfiguration<BlockNumber>
**/ **/
PolkadotRuntimeParachainsConfigurationHostConfiguration: { PolkadotRuntimeParachainsConfigurationHostConfiguration: {
maxCodeSize: 'u32', maxCodeSize: 'u32',
@@ -373,14 +369,14 @@ export default {
umpMaxIndividualWeight: 'u64' umpMaxIndividualWeight: 'u64'
}, },
/** /**
* Lookup512: polkadot_runtime_parachains::inclusion::AvailabilityBitfieldRecord<N> * Lookup518: polkadot_runtime_parachains::inclusion::AvailabilityBitfieldRecord<N>
**/ **/
PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord: { PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord: {
bitfield: 'BitVec', bitfield: 'BitVec',
submittedAt: 'u32' submittedAt: 'u32'
}, },
/** /**
* Lookup513: polkadot_runtime_parachains::inclusion::CandidatePendingAvailability<primitive_types::H256, N> * Lookup519: polkadot_runtime_parachains::inclusion::CandidatePendingAvailability<primitive_types::H256, N>
**/ **/
PolkadotRuntimeParachainsInclusionCandidatePendingAvailability: { PolkadotRuntimeParachainsInclusionCandidatePendingAvailability: {
_alias: { _alias: {
@@ -396,7 +392,7 @@ export default {
backingGroup: 'u32' backingGroup: 'u32'
}, },
/** /**
* Lookup515: polkadot_primitives::v1::ScrapedOnChainVotes<primitive_types::H256> * Lookup521: polkadot_primitives::v1::ScrapedOnChainVotes<primitive_types::H256>
**/ **/
PolkadotPrimitivesV1ScrapedOnChainVotes: { PolkadotPrimitivesV1ScrapedOnChainVotes: {
session: 'u32', session: 'u32',
@@ -404,32 +400,32 @@ export default {
disputes: 'Vec<PolkadotPrimitivesV1DisputeStatementSet>' disputes: 'Vec<PolkadotPrimitivesV1DisputeStatementSet>'
}, },
/** /**
* Lookup522: polkadot_runtime_parachains::scheduler::ParathreadClaimQueue * Lookup528: polkadot_runtime_parachains::scheduler::ParathreadClaimQueue
**/ **/
PolkadotRuntimeParachainsSchedulerParathreadClaimQueue: { PolkadotRuntimeParachainsSchedulerParathreadClaimQueue: {
queue: 'Vec<PolkadotRuntimeParachainsSchedulerQueuedParathread>', queue: 'Vec<PolkadotRuntimeParachainsSchedulerQueuedParathread>',
nextCoreOffset: 'u32' nextCoreOffset: 'u32'
}, },
/** /**
* Lookup524: polkadot_runtime_parachains::scheduler::QueuedParathread * Lookup530: polkadot_runtime_parachains::scheduler::QueuedParathread
**/ **/
PolkadotRuntimeParachainsSchedulerQueuedParathread: { PolkadotRuntimeParachainsSchedulerQueuedParathread: {
claim: 'PolkadotPrimitivesV1ParathreadEntry', claim: 'PolkadotPrimitivesV1ParathreadEntry',
coreOffset: 'u32' coreOffset: 'u32'
}, },
/** /**
* Lookup525: polkadot_primitives::v1::ParathreadEntry * Lookup531: polkadot_primitives::v1::ParathreadEntry
**/ **/
PolkadotPrimitivesV1ParathreadEntry: { PolkadotPrimitivesV1ParathreadEntry: {
claim: 'PolkadotPrimitivesV1ParathreadClaim', claim: 'PolkadotPrimitivesV1ParathreadClaim',
retries: 'u32' retries: 'u32'
}, },
/** /**
* Lookup526: polkadot_primitives::v1::ParathreadClaim * Lookup532: polkadot_primitives::v1::ParathreadClaim
**/ **/
PolkadotPrimitivesV1ParathreadClaim: '(u32,PolkadotPrimitivesV0CollatorAppPublic)', PolkadotPrimitivesV1ParathreadClaim: '(u32,PolkadotPrimitivesV0CollatorAppPublic)',
/** /**
* Lookup529: polkadot_primitives::v1::CoreOccupied * Lookup535: polkadot_primitives::v1::CoreOccupied
**/ **/
PolkadotPrimitivesV1CoreOccupied: { PolkadotPrimitivesV1CoreOccupied: {
_enum: { _enum: {
@@ -438,7 +434,7 @@ export default {
} }
}, },
/** /**
* Lookup532: polkadot_runtime_parachains::scheduler::CoreAssignment * Lookup538: polkadot_runtime_parachains::scheduler::CoreAssignment
**/ **/
PolkadotRuntimeParachainsSchedulerCoreAssignment: { PolkadotRuntimeParachainsSchedulerCoreAssignment: {
core: 'u32', core: 'u32',
@@ -447,7 +443,7 @@ export default {
groupIdx: 'u32' groupIdx: 'u32'
}, },
/** /**
* Lookup533: polkadot_runtime_parachains::scheduler::AssignmentKind * Lookup539: polkadot_runtime_parachains::scheduler::AssignmentKind
**/ **/
PolkadotRuntimeParachainsSchedulerAssignmentKind: { PolkadotRuntimeParachainsSchedulerAssignmentKind: {
_enum: { _enum: {
@@ -456,39 +452,39 @@ export default {
} }
}, },
/** /**
* Lookup534: polkadot_runtime_parachains::paras::ParaLifecycle * Lookup540: polkadot_runtime_parachains::paras::ParaLifecycle
**/ **/
PolkadotRuntimeParachainsParasParaLifecycle: { PolkadotRuntimeParachainsParasParaLifecycle: {
_enum: ['Onboarding', 'Parathread', 'Parachain', 'UpgradingParathread', 'DowngradingParachain', 'OffboardingParathread', 'OffboardingParachain'] _enum: ['Onboarding', 'Parathread', 'Parachain', 'UpgradingParathread', 'DowngradingParachain', 'OffboardingParathread', 'OffboardingParachain']
}, },
/** /**
* Lookup536: polkadot_runtime_parachains::paras::ParaPastCodeMeta<N> * Lookup542: polkadot_runtime_parachains::paras::ParaPastCodeMeta<N>
**/ **/
PolkadotRuntimeParachainsParasParaPastCodeMeta: { PolkadotRuntimeParachainsParasParaPastCodeMeta: {
upgradeTimes: 'Vec<PolkadotRuntimeParachainsParasReplacementTimes>', upgradeTimes: 'Vec<PolkadotRuntimeParachainsParasReplacementTimes>',
lastPruned: 'Option<u32>' lastPruned: 'Option<u32>'
}, },
/** /**
* Lookup538: polkadot_runtime_parachains::paras::ReplacementTimes<N> * Lookup544: polkadot_runtime_parachains::paras::ReplacementTimes<N>
**/ **/
PolkadotRuntimeParachainsParasReplacementTimes: { PolkadotRuntimeParachainsParasReplacementTimes: {
expectedAt: 'u32', expectedAt: 'u32',
activatedAt: 'u32' activatedAt: 'u32'
}, },
/** /**
* Lookup540: polkadot_primitives::v1::UpgradeGoAhead * Lookup546: polkadot_primitives::v1::UpgradeGoAhead
**/ **/
PolkadotPrimitivesV1UpgradeGoAhead: { PolkadotPrimitivesV1UpgradeGoAhead: {
_enum: ['Abort', 'GoAhead'] _enum: ['Abort', 'GoAhead']
}, },
/** /**
* Lookup541: polkadot_primitives::v1::UpgradeRestriction * Lookup547: polkadot_primitives::v1::UpgradeRestriction
**/ **/
PolkadotPrimitivesV1UpgradeRestriction: { PolkadotPrimitivesV1UpgradeRestriction: {
_enum: ['Present'] _enum: ['Present']
}, },
/** /**
* Lookup542: polkadot_runtime_parachains::paras::ParaGenesisArgs * Lookup548: polkadot_runtime_parachains::paras::ParaGenesisArgs
**/ **/
PolkadotRuntimeParachainsParasParaGenesisArgs: { PolkadotRuntimeParachainsParasParaGenesisArgs: {
genesisHead: 'Bytes', genesisHead: 'Bytes',
@@ -496,7 +492,7 @@ export default {
parachain: 'bool' parachain: 'bool'
}, },
/** /**
* Lookup545: polkadot_runtime_parachains::initializer::BufferedSessionChange * Lookup551: polkadot_runtime_parachains::initializer::BufferedSessionChange
**/ **/
PolkadotRuntimeParachainsInitializerBufferedSessionChange: { PolkadotRuntimeParachainsInitializerBufferedSessionChange: {
validators: 'Vec<PolkadotPrimitivesV0ValidatorAppPublic>', validators: 'Vec<PolkadotPrimitivesV0ValidatorAppPublic>',
@@ -504,14 +500,14 @@ export default {
sessionIndex: 'u32' sessionIndex: 'u32'
}, },
/** /**
* Lookup547: polkadot_core_primitives::InboundDownwardMessage<BlockNumber> * Lookup553: polkadot_core_primitives::InboundDownwardMessage<BlockNumber>
**/ **/
PolkadotCorePrimitivesInboundDownwardMessage: { PolkadotCorePrimitivesInboundDownwardMessage: {
sentAt: 'u32', sentAt: 'u32',
msg: 'Bytes' msg: 'Bytes'
}, },
/** /**
* Lookup550: polkadot_runtime_parachains::hrmp::HrmpOpenChannelRequest * Lookup556: polkadot_runtime_parachains::hrmp::HrmpOpenChannelRequest
**/ **/
PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest: { PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest: {
confirmed: 'bool', confirmed: 'bool',
@@ -522,7 +518,7 @@ export default {
maxTotalSize: 'u32' maxTotalSize: 'u32'
}, },
/** /**
* Lookup552: polkadot_runtime_parachains::hrmp::HrmpChannel * Lookup558: polkadot_runtime_parachains::hrmp::HrmpChannel
**/ **/
PolkadotRuntimeParachainsHrmpHrmpChannel: { PolkadotRuntimeParachainsHrmpHrmpChannel: {
maxCapacity: 'u32', maxCapacity: 'u32',
@@ -535,14 +531,14 @@ export default {
recipientDeposit: 'u128' recipientDeposit: 'u128'
}, },
/** /**
* Lookup555: polkadot_core_primitives::InboundHrmpMessage<BlockNumber> * Lookup561: polkadot_core_primitives::InboundHrmpMessage<BlockNumber>
**/ **/
PolkadotCorePrimitivesInboundHrmpMessage: { PolkadotCorePrimitivesInboundHrmpMessage: {
sentAt: 'u32', sentAt: 'u32',
data: 'Bytes' data: 'Bytes'
}, },
/** /**
* Lookup560: polkadot_primitives::v1::SessionInfo * Lookup566: polkadot_primitives::v1::SessionInfo
**/ **/
PolkadotPrimitivesV1SessionInfo: { PolkadotPrimitivesV1SessionInfo: {
validators: 'Vec<PolkadotPrimitivesV0ValidatorAppPublic>', validators: 'Vec<PolkadotPrimitivesV0ValidatorAppPublic>',
@@ -557,7 +553,7 @@ export default {
neededApprovals: 'u32' neededApprovals: 'u32'
}, },
/** /**
* Lookup562: polkadot_runtime_common::paras_registrar::ParaInfo<sp_core::crypto::AccountId32, Balance> * Lookup568: polkadot_runtime_common::paras_registrar::ParaInfo<sp_core::crypto::AccountId32, Balance>
**/ **/
PolkadotRuntimeCommonParasRegistrarParaInfo: { PolkadotRuntimeCommonParasRegistrarParaInfo: {
manager: 'AccountId32', manager: 'AccountId32',
@@ -565,7 +561,7 @@ export default {
locked: 'bool' locked: 'bool'
}, },
/** /**
* Lookup572: polkadot_runtime_common::crowdloan::FundInfo<sp_core::crypto::AccountId32, Balance, BlockNumber, LeasePeriod> * Lookup578: polkadot_runtime_common::crowdloan::FundInfo<sp_core::crypto::AccountId32, Balance, BlockNumber, LeasePeriod>
**/ **/
PolkadotRuntimeCommonCrowdloanFundInfo: { PolkadotRuntimeCommonCrowdloanFundInfo: {
depositor: 'AccountId32', depositor: 'AccountId32',
@@ -580,7 +576,7 @@ export default {
trieIndex: 'u32' trieIndex: 'u32'
}, },
/** /**
* Lookup573: polkadot_runtime_common::crowdloan::LastContribution<BlockNumber> * Lookup579: polkadot_runtime_common::crowdloan::LastContribution<BlockNumber>
**/ **/
PolkadotRuntimeCommonCrowdloanLastContribution: { PolkadotRuntimeCommonCrowdloanLastContribution: {
_enum: { _enum: {
@@ -590,11 +586,11 @@ export default {
} }
}, },
/** /**
* Lookup585: polkadot_runtime_common::claims::PrevalidateAttests<T> * Lookup591: polkadot_runtime_common::claims::PrevalidateAttests<T>
**/ **/
PolkadotRuntimeCommonClaimsPrevalidateAttests: 'Null', PolkadotRuntimeCommonClaimsPrevalidateAttests: 'Null',
/** /**
* Lookup586: polkadot_runtime::Runtime * Lookup592: polkadot_runtime::Runtime
**/ **/
PolkadotRuntimeRuntime: 'Null' PolkadotRuntimeRuntime: 'Null'
} as DefinitionsTypes; } as DefinitionsTypes;
+139 -139
View File
@@ -129,19 +129,19 @@ export default {
_enum: ['Underflow', 'Overflow', 'DivisionByZero'] _enum: ['Underflow', 'Overflow', 'DivisionByZero']
}, },
/** /**
* Lookup31: frame_support::traits::tokens::misc::BalanceStatus * Lookup33: frame_support::traits::tokens::misc::BalanceStatus
**/ **/
FrameSupportTokensMiscBalanceStatus: { FrameSupportTokensMiscBalanceStatus: {
_enum: ['Free', 'Reserved'] _enum: ['Free', 'Reserved']
}, },
/** /**
* Lookup33: pallet_election_provider_multi_phase::ElectionCompute * Lookup35: pallet_election_provider_multi_phase::ElectionCompute
**/ **/
PalletElectionProviderMultiPhaseElectionCompute: { PalletElectionProviderMultiPhaseElectionCompute: {
_enum: ['OnChain', 'Signed', 'Unsigned', 'Fallback', 'Emergency'] _enum: ['OnChain', 'Signed', 'Unsigned', 'Fallback', 'Emergency']
}, },
/** /**
* Lookup40: pallet_democracy::vote_threshold::VoteThreshold * Lookup42: pallet_democracy::vote_threshold::VoteThreshold
**/ **/
PalletDemocracyVoteThreshold: { PalletDemocracyVoteThreshold: {
_enum: ['SuperMajorityApprove', 'SuperMajorityAgainst', 'SimpleMajority'] _enum: ['SuperMajorityApprove', 'SuperMajorityAgainst', 'SimpleMajority']
@@ -568,7 +568,7 @@ export default {
startingBlock: 'u32' startingBlock: 'u32'
}, },
/** /**
* Lookup295: pallet_assets::types::DestroyWitness * Lookup296: pallet_assets::types::DestroyWitness
**/ **/
PalletAssetsDestroyWitness: { PalletAssetsDestroyWitness: {
accounts: 'Compact<u32>', accounts: 'Compact<u32>',
@@ -576,7 +576,7 @@ export default {
approvals: 'Compact<u32>' approvals: 'Compact<u32>'
}, },
/** /**
* Lookup301: pallet_uniques::types::DestroyWitness * Lookup302: pallet_uniques::types::DestroyWitness
**/ **/
PalletUniquesDestroyWitness: { PalletUniquesDestroyWitness: {
instances: 'Compact<u32>', instances: 'Compact<u32>',
@@ -584,21 +584,66 @@ export default {
attributes: 'Compact<u32>' attributes: 'Compact<u32>'
}, },
/** /**
* Lookup304: sp_transaction_storage_proof::TransactionStorageProof * Lookup305: sp_transaction_storage_proof::TransactionStorageProof
**/ **/
SpTransactionStorageProofTransactionStorageProof: { SpTransactionStorageProofTransactionStorageProof: {
chunk: 'Bytes', chunk: 'Bytes',
proof: 'Vec<Bytes>' proof: 'Vec<Bytes>'
}, },
/** /**
* Lookup313: sp_consensus_babe::BabeEpochConfiguration * Lookup307: node_runtime::OriginCaller
**/
NodeRuntimeOriginCaller: {
_enum: {
system: 'FrameSystemRawOrigin',
__Unused1: 'Null',
__Unused2: 'Null',
Void: 'SpCoreVoid',
__Unused4: 'Null',
__Unused5: 'Null',
__Unused6: 'Null',
__Unused7: 'Null',
__Unused8: 'Null',
__Unused9: 'Null',
__Unused10: 'Null',
__Unused11: 'Null',
Council: 'PalletCollectiveRawOrigin',
TechnicalCommittee: 'PalletCollectiveRawOrigin'
}
},
/**
* Lookup308: frame_system::RawOrigin<sp_core::crypto::AccountId32>
**/
FrameSystemRawOrigin: {
_enum: {
Root: 'Null',
Signed: 'AccountId32',
None: 'Null'
}
},
/**
* Lookup309: pallet_collective::RawOrigin<sp_core::crypto::AccountId32, I>
**/
PalletCollectiveRawOrigin: {
_enum: {
Members: '(u32,u32)',
Member: 'AccountId32',
_Phantom: 'Null'
}
},
/**
* Lookup311: sp_core::Void
**/
SpCoreVoid: 'Null',
/**
* Lookup319: sp_consensus_babe::BabeEpochConfiguration
**/ **/
SpConsensusBabeBabeEpochConfiguration: { SpConsensusBabeBabeEpochConfiguration: {
c: '(u64,u64)', c: '(u64,u64)',
allowedSlots: 'SpConsensusBabeAllowedSlots' allowedSlots: 'SpConsensusBabeAllowedSlots'
}, },
/** /**
* Lookup316: pallet_authorship::UncleEntryItem<BlockNumber, primitive_types::H256, sp_core::crypto::AccountId32> * Lookup322: pallet_authorship::UncleEntryItem<BlockNumber, primitive_types::H256, sp_core::crypto::AccountId32>
**/ **/
PalletAuthorshipUncleEntryItem: { PalletAuthorshipUncleEntryItem: {
_enum: { _enum: {
@@ -607,7 +652,7 @@ export default {
} }
}, },
/** /**
* Lookup321: pallet_balances::BalanceLock<Balance> * Lookup327: pallet_balances::BalanceLock<Balance>
**/ **/
PalletBalancesBalanceLock: { PalletBalancesBalanceLock: {
id: '[u8;8]', id: '[u8;8]',
@@ -615,32 +660,32 @@ export default {
reasons: 'PalletBalancesReasons' reasons: 'PalletBalancesReasons'
}, },
/** /**
* Lookup322: pallet_balances::Reasons * Lookup328: pallet_balances::Reasons
**/ **/
PalletBalancesReasons: { PalletBalancesReasons: {
_enum: ['Fee', 'Misc', 'All'] _enum: ['Fee', 'Misc', 'All']
}, },
/** /**
* Lookup325: pallet_balances::ReserveData<ReserveIdentifier, Balance> * Lookup331: pallet_balances::ReserveData<ReserveIdentifier, Balance>
**/ **/
PalletBalancesReserveData: { PalletBalancesReserveData: {
id: '[u8;8]', id: '[u8;8]',
amount: 'u128' amount: 'u128'
}, },
/** /**
* Lookup327: pallet_balances::Releases * Lookup333: pallet_balances::Releases
**/ **/
PalletBalancesReleases: { PalletBalancesReleases: {
_enum: ['V1_0_0', 'V2_0_0'] _enum: ['V1_0_0', 'V2_0_0']
}, },
/** /**
* Lookup330: pallet_transaction_payment::Releases * Lookup336: pallet_transaction_payment::Releases
**/ **/
PalletTransactionPaymentReleases: { PalletTransactionPaymentReleases: {
_enum: ['V1Ancient', 'V2'] _enum: ['V1Ancient', 'V2']
}, },
/** /**
* Lookup332: frame_support::weights::WeightToFeeCoefficient<Balance> * Lookup338: frame_support::weights::WeightToFeeCoefficient<Balance>
**/ **/
FrameSupportWeightsWeightToFeeCoefficient: { FrameSupportWeightsWeightToFeeCoefficient: {
coeffInteger: 'u128', coeffInteger: 'u128',
@@ -649,7 +694,7 @@ export default {
degree: 'u8' degree: 'u8'
}, },
/** /**
* Lookup333: pallet_election_provider_multi_phase::Phase<Bn> * Lookup339: pallet_election_provider_multi_phase::Phase<Bn>
**/ **/
PalletElectionProviderMultiPhasePhase: { PalletElectionProviderMultiPhasePhase: {
_enum: { _enum: {
@@ -660,7 +705,7 @@ export default {
} }
}, },
/** /**
* Lookup335: pallet_election_provider_multi_phase::ReadySolution<sp_core::crypto::AccountId32> * Lookup341: pallet_election_provider_multi_phase::ReadySolution<sp_core::crypto::AccountId32>
**/ **/
PalletElectionProviderMultiPhaseReadySolution: { PalletElectionProviderMultiPhaseReadySolution: {
supports: 'Vec<(AccountId32,SpNposElectionsSupport)>', supports: 'Vec<(AccountId32,SpNposElectionsSupport)>',
@@ -668,14 +713,14 @@ export default {
compute: 'PalletElectionProviderMultiPhaseElectionCompute' compute: 'PalletElectionProviderMultiPhaseElectionCompute'
}, },
/** /**
* Lookup336: pallet_election_provider_multi_phase::RoundSnapshot<sp_core::crypto::AccountId32> * Lookup342: pallet_election_provider_multi_phase::RoundSnapshot<sp_core::crypto::AccountId32>
**/ **/
PalletElectionProviderMultiPhaseRoundSnapshot: { PalletElectionProviderMultiPhaseRoundSnapshot: {
voters: 'Vec<(AccountId32,u64,Vec<AccountId32>)>', voters: 'Vec<(AccountId32,u64,Vec<AccountId32>)>',
targets: 'Vec<AccountId32>' targets: 'Vec<AccountId32>'
}, },
/** /**
* Lookup343: pallet_election_provider_multi_phase::signed::SignedSubmission<sp_core::crypto::AccountId32, Balance, node_runtime::NposSolution16> * Lookup349: pallet_election_provider_multi_phase::signed::SignedSubmission<sp_core::crypto::AccountId32, Balance, node_runtime::NposSolution16>
**/ **/
PalletElectionProviderMultiPhaseSignedSignedSubmission: { PalletElectionProviderMultiPhaseSignedSignedSubmission: {
who: 'AccountId32', who: 'AccountId32',
@@ -684,7 +729,7 @@ export default {
reward: 'u128' reward: 'u128'
}, },
/** /**
* Lookup345: pallet_staking::StakingLedger<sp_core::crypto::AccountId32, Balance> * Lookup351: pallet_staking::StakingLedger<sp_core::crypto::AccountId32, Balance>
**/ **/
PalletStakingStakingLedger: { PalletStakingStakingLedger: {
stash: 'AccountId32', stash: 'AccountId32',
@@ -694,14 +739,14 @@ export default {
claimedRewards: 'Vec<u32>' claimedRewards: 'Vec<u32>'
}, },
/** /**
* Lookup347: pallet_staking::UnlockChunk<Balance> * Lookup353: pallet_staking::UnlockChunk<Balance>
**/ **/
PalletStakingUnlockChunk: { PalletStakingUnlockChunk: {
value: 'Compact<u128>', value: 'Compact<u128>',
era: 'Compact<u32>' era: 'Compact<u32>'
}, },
/** /**
* Lookup348: pallet_staking::Nominations<sp_core::crypto::AccountId32> * Lookup354: pallet_staking::Nominations<sp_core::crypto::AccountId32>
**/ **/
PalletStakingNominations: { PalletStakingNominations: {
targets: 'Vec<AccountId32>', targets: 'Vec<AccountId32>',
@@ -709,27 +754,27 @@ export default {
suppressed: 'bool' suppressed: 'bool'
}, },
/** /**
* Lookup349: pallet_staking::ActiveEraInfo * Lookup355: pallet_staking::ActiveEraInfo
**/ **/
PalletStakingActiveEraInfo: { PalletStakingActiveEraInfo: {
index: 'u32', index: 'u32',
start: 'Option<u64>' start: 'Option<u64>'
}, },
/** /**
* Lookup351: pallet_staking::EraRewardPoints<sp_core::crypto::AccountId32> * Lookup357: pallet_staking::EraRewardPoints<sp_core::crypto::AccountId32>
**/ **/
PalletStakingEraRewardPoints: { PalletStakingEraRewardPoints: {
total: 'u32', total: 'u32',
individual: 'BTreeMap<AccountId32, u32>' individual: 'BTreeMap<AccountId32, u32>'
}, },
/** /**
* Lookup355: pallet_staking::Forcing * Lookup361: pallet_staking::Forcing
**/ **/
PalletStakingForcing: { PalletStakingForcing: {
_enum: ['NotForcing', 'ForceNew', 'ForceNone', 'ForceAlways'] _enum: ['NotForcing', 'ForceNew', 'ForceNone', 'ForceAlways']
}, },
/** /**
* Lookup357: pallet_staking::UnappliedSlash<sp_core::crypto::AccountId32, Balance> * Lookup363: pallet_staking::UnappliedSlash<sp_core::crypto::AccountId32, Balance>
**/ **/
PalletStakingUnappliedSlash: { PalletStakingUnappliedSlash: {
validator: 'AccountId32', validator: 'AccountId32',
@@ -739,7 +784,7 @@ export default {
payout: 'u128' payout: 'u128'
}, },
/** /**
* Lookup359: pallet_staking::slashing::SlashingSpans * Lookup365: pallet_staking::slashing::SlashingSpans
**/ **/
PalletStakingSlashingSlashingSpans: { PalletStakingSlashingSlashingSpans: {
spanIndex: 'u32', spanIndex: 'u32',
@@ -748,24 +793,24 @@ export default {
prior: 'Vec<u32>' prior: 'Vec<u32>'
}, },
/** /**
* Lookup360: pallet_staking::slashing::SpanRecord<Balance> * Lookup366: pallet_staking::slashing::SpanRecord<Balance>
**/ **/
PalletStakingSlashingSpanRecord: { PalletStakingSlashingSpanRecord: {
slashed: 'u128', slashed: 'u128',
paidOut: 'u128' paidOut: 'u128'
}, },
/** /**
* Lookup363: pallet_staking::Releases * Lookup369: pallet_staking::Releases
**/ **/
PalletStakingReleases: { PalletStakingReleases: {
_enum: ['V1_0_0Ancient', 'V2_0_0', 'V3_0_0', 'V4_0_0', 'V5_0_0', 'V6_0_0', 'V7_0_0', 'V8_0_0'] _enum: ['V1_0_0Ancient', 'V2_0_0', 'V3_0_0', 'V4_0_0', 'V5_0_0', 'V6_0_0', 'V7_0_0', 'V8_0_0']
}, },
/** /**
* Lookup368: sp_core::crypto::KeyTypeId * Lookup374: sp_core::crypto::KeyTypeId
**/ **/
SpCoreCryptoKeyTypeId: '[u8;4]', SpCoreCryptoKeyTypeId: '[u8;4]',
/** /**
* Lookup373: pallet_democracy::PreimageStatus<sp_core::crypto::AccountId32, Balance, BlockNumber> * Lookup379: pallet_democracy::PreimageStatus<sp_core::crypto::AccountId32, Balance, BlockNumber>
**/ **/
PalletDemocracyPreimageStatus: { PalletDemocracyPreimageStatus: {
_enum: { _enum: {
@@ -780,7 +825,7 @@ export default {
} }
}, },
/** /**
* Lookup374: pallet_democracy::types::ReferendumInfo<BlockNumber, primitive_types::H256, Balance> * Lookup380: pallet_democracy::types::ReferendumInfo<BlockNumber, primitive_types::H256, Balance>
**/ **/
PalletDemocracyReferendumInfo: { PalletDemocracyReferendumInfo: {
_enum: { _enum: {
@@ -792,7 +837,7 @@ export default {
} }
}, },
/** /**
* Lookup375: pallet_democracy::types::ReferendumStatus<BlockNumber, primitive_types::H256, Balance> * Lookup381: pallet_democracy::types::ReferendumStatus<BlockNumber, primitive_types::H256, Balance>
**/ **/
PalletDemocracyReferendumStatus: { PalletDemocracyReferendumStatus: {
end: 'u32', end: 'u32',
@@ -802,7 +847,7 @@ export default {
tally: 'PalletDemocracyTally' tally: 'PalletDemocracyTally'
}, },
/** /**
* Lookup376: pallet_democracy::types::Tally<Balance> * Lookup382: pallet_democracy::types::Tally<Balance>
**/ **/
PalletDemocracyTally: { PalletDemocracyTally: {
ayes: 'u128', ayes: 'u128',
@@ -810,7 +855,7 @@ export default {
turnout: 'u128' turnout: 'u128'
}, },
/** /**
* Lookup377: pallet_democracy::vote::Voting<Balance, sp_core::crypto::AccountId32, BlockNumber> * Lookup383: pallet_democracy::vote::Voting<Balance, sp_core::crypto::AccountId32, BlockNumber>
**/ **/
PalletDemocracyVoteVoting: { PalletDemocracyVoteVoting: {
_enum: { _enum: {
@@ -829,24 +874,24 @@ export default {
} }
}, },
/** /**
* Lookup380: pallet_democracy::types::Delegations<Balance> * Lookup386: pallet_democracy::types::Delegations<Balance>
**/ **/
PalletDemocracyDelegations: { PalletDemocracyDelegations: {
votes: 'u128', votes: 'u128',
capital: 'u128' capital: 'u128'
}, },
/** /**
* Lookup381: pallet_democracy::vote::PriorLock<BlockNumber, Balance> * Lookup387: pallet_democracy::vote::PriorLock<BlockNumber, Balance>
**/ **/
PalletDemocracyVotePriorLock: '(u32,u128)', PalletDemocracyVotePriorLock: '(u32,u128)',
/** /**
* Lookup384: pallet_democracy::Releases * Lookup390: pallet_democracy::Releases
**/ **/
PalletDemocracyReleases: { PalletDemocracyReleases: {
_enum: ['V1'] _enum: ['V1']
}, },
/** /**
* Lookup387: pallet_collective::Votes<sp_core::crypto::AccountId32, BlockNumber> * Lookup393: pallet_collective::Votes<sp_core::crypto::AccountId32, BlockNumber>
**/ **/
PalletCollectiveVotes: { PalletCollectiveVotes: {
index: 'u32', index: 'u32',
@@ -856,7 +901,7 @@ export default {
end: 'u32' end: 'u32'
}, },
/** /**
* Lookup392: pallet_elections_phragmen::SeatHolder<sp_core::crypto::AccountId32, Balance> * Lookup398: pallet_elections_phragmen::SeatHolder<sp_core::crypto::AccountId32, Balance>
**/ **/
PalletElectionsPhragmenSeatHolder: { PalletElectionsPhragmenSeatHolder: {
who: 'AccountId32', who: 'AccountId32',
@@ -864,7 +909,7 @@ export default {
deposit: 'u128' deposit: 'u128'
}, },
/** /**
* Lookup393: pallet_elections_phragmen::Voter<sp_core::crypto::AccountId32, Balance> * Lookup399: pallet_elections_phragmen::Voter<sp_core::crypto::AccountId32, Balance>
**/ **/
PalletElectionsPhragmenVoter: { PalletElectionsPhragmenVoter: {
votes: 'Vec<AccountId32>', votes: 'Vec<AccountId32>',
@@ -872,7 +917,7 @@ export default {
deposit: 'u128' deposit: 'u128'
}, },
/** /**
* Lookup396: pallet_grandpa::StoredState<N> * Lookup402: pallet_grandpa::StoredState<N>
**/ **/
PalletGrandpaStoredState: { PalletGrandpaStoredState: {
_enum: { _enum: {
@@ -889,7 +934,7 @@ export default {
} }
}, },
/** /**
* Lookup397: pallet_grandpa::StoredPendingChange<N, Limit> * Lookup403: pallet_grandpa::StoredPendingChange<N, Limit>
**/ **/
PalletGrandpaStoredPendingChange: { PalletGrandpaStoredPendingChange: {
scheduledAt: 'u32', scheduledAt: 'u32',
@@ -898,7 +943,7 @@ export default {
forced: 'Option<u32>' forced: 'Option<u32>'
}, },
/** /**
* Lookup400: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance> * Lookup406: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
**/ **/
PalletTreasuryProposal: { PalletTreasuryProposal: {
proposer: 'AccountId32', proposer: 'AccountId32',
@@ -907,11 +952,11 @@ export default {
bond: 'u128' bond: 'u128'
}, },
/** /**
* Lookup403: frame_support::PalletId * Lookup409: frame_support::PalletId
**/ **/
FrameSupportPalletId: '[u8;8]', FrameSupportPalletId: '[u8;8]',
/** /**
* Lookup405: pallet_contracts::wasm::PrefabWasmModule<T> * Lookup411: pallet_contracts::wasm::PrefabWasmModule<T>
**/ **/
PalletContractsWasmPrefabWasmModule: { PalletContractsWasmPrefabWasmModule: {
instructionWeightsVersion: 'Compact<u32>', instructionWeightsVersion: 'Compact<u32>',
@@ -923,7 +968,7 @@ export default {
originalCodeLen: 'u32' originalCodeLen: 'u32'
}, },
/** /**
* Lookup407: pallet_contracts::storage::RawContractInfo<primitive_types::H256> * Lookup413: pallet_contracts::storage::RawContractInfo<primitive_types::H256>
**/ **/
PalletContractsStorageRawContractInfo: { PalletContractsStorageRawContractInfo: {
trieId: 'Bytes', trieId: 'Bytes',
@@ -931,13 +976,13 @@ export default {
reserved: 'Option<Null>' reserved: 'Option<Null>'
}, },
/** /**
* Lookup409: pallet_contracts::storage::DeletedContract * Lookup415: pallet_contracts::storage::DeletedContract
**/ **/
PalletContractsStorageDeletedContract: { PalletContractsStorageDeletedContract: {
trieId: 'Bytes' trieId: 'Bytes'
}, },
/** /**
* Lookup410: pallet_contracts::schedule::Schedule<T> * Lookup416: pallet_contracts::schedule::Schedule<T>
**/ **/
PalletContractsSchedule: { PalletContractsSchedule: {
limits: 'PalletContractsScheduleLimits', limits: 'PalletContractsScheduleLimits',
@@ -945,7 +990,7 @@ export default {
hostFnWeights: 'PalletContractsScheduleHostFnWeights' hostFnWeights: 'PalletContractsScheduleHostFnWeights'
}, },
/** /**
* Lookup411: pallet_contracts::schedule::Limits * Lookup417: pallet_contracts::schedule::Limits
**/ **/
PalletContractsScheduleLimits: { PalletContractsScheduleLimits: {
eventTopics: 'u32', eventTopics: 'u32',
@@ -961,7 +1006,7 @@ export default {
codeLen: 'u32' codeLen: 'u32'
}, },
/** /**
* Lookup412: pallet_contracts::schedule::InstructionWeights<T> * Lookup418: pallet_contracts::schedule::InstructionWeights<T>
**/ **/
PalletContractsScheduleInstructionWeights: { PalletContractsScheduleInstructionWeights: {
_alias: { _alias: {
@@ -1021,7 +1066,7 @@ export default {
i64Rotr: 'u32' i64Rotr: 'u32'
}, },
/** /**
* Lookup413: pallet_contracts::schedule::HostFnWeights<T> * Lookup419: pallet_contracts::schedule::HostFnWeights<T>
**/ **/
PalletContractsScheduleHostFnWeights: { PalletContractsScheduleHostFnWeights: {
_alias: { _alias: {
@@ -1073,21 +1118,21 @@ export default {
ecdsaRecover: 'u64' ecdsaRecover: 'u64'
}, },
/** /**
* Lookup419: pallet_im_online::BoundedOpaqueNetworkState<PeerIdEncodingLimit, MultiAddrEncodingLimit, AddressesLimit> * Lookup425: pallet_im_online::BoundedOpaqueNetworkState<PeerIdEncodingLimit, MultiAddrEncodingLimit, AddressesLimit>
**/ **/
PalletImOnlineBoundedOpaqueNetworkState: { PalletImOnlineBoundedOpaqueNetworkState: {
peerId: 'Bytes', peerId: 'Bytes',
externalAddresses: 'Vec<Bytes>' externalAddresses: 'Vec<Bytes>'
}, },
/** /**
* Lookup424: sp_staking::offence::OffenceDetails<sp_core::crypto::AccountId32, Offender> * Lookup432: sp_staking::offence::OffenceDetails<sp_core::crypto::AccountId32, Offender>
**/ **/
SpStakingOffenceOffenceDetails: { SpStakingOffenceOffenceDetails: {
offender: '(AccountId32,PalletStakingExposure)', offender: '(AccountId32,PalletStakingExposure)',
reporters: 'Vec<AccountId32>' reporters: 'Vec<AccountId32>'
}, },
/** /**
* Lookup426: pallet_identity::types::Registration<Balance, MaxJudgements, MaxAdditionalFields> * Lookup434: pallet_identity::types::Registration<Balance, MaxJudgements, MaxAdditionalFields>
**/ **/
PalletIdentityRegistration: { PalletIdentityRegistration: {
judgements: 'Vec<(u32,PalletIdentityJudgement)>', judgements: 'Vec<(u32,PalletIdentityJudgement)>',
@@ -1095,7 +1140,7 @@ export default {
info: 'PalletIdentityIdentityInfo' info: 'PalletIdentityIdentityInfo'
}, },
/** /**
* Lookup434: pallet_identity::types::RegistrarInfo<Balance, sp_core::crypto::AccountId32> * Lookup442: pallet_identity::types::RegistrarInfo<Balance, sp_core::crypto::AccountId32>
**/ **/
PalletIdentityRegistrarInfo: { PalletIdentityRegistrarInfo: {
account: 'AccountId32', account: 'AccountId32',
@@ -1103,7 +1148,7 @@ export default {
fields: 'PalletIdentityBitFlags' fields: 'PalletIdentityBitFlags'
}, },
/** /**
* Lookup438: pallet_society::Bid<sp_core::crypto::AccountId32, Balance> * Lookup446: pallet_society::Bid<sp_core::crypto::AccountId32, Balance>
**/ **/
PalletSocietyBid: { PalletSocietyBid: {
who: 'AccountId32', who: 'AccountId32',
@@ -1111,7 +1156,7 @@ export default {
value: 'u128' value: 'u128'
}, },
/** /**
* Lookup439: pallet_society::BidKind<sp_core::crypto::AccountId32, Balance> * Lookup447: pallet_society::BidKind<sp_core::crypto::AccountId32, Balance>
**/ **/
PalletSocietyBidKind: { PalletSocietyBidKind: {
_enum: { _enum: {
@@ -1120,19 +1165,19 @@ export default {
} }
}, },
/** /**
* Lookup441: pallet_society::VouchingStatus * Lookup449: pallet_society::VouchingStatus
**/ **/
PalletSocietyVouchingStatus: { PalletSocietyVouchingStatus: {
_enum: ['Vouching', 'Banned'] _enum: ['Vouching', 'Banned']
}, },
/** /**
* Lookup445: pallet_society::Vote * Lookup453: pallet_society::Vote
**/ **/
PalletSocietyVote: { PalletSocietyVote: {
_enum: ['Skeptic', 'Reject', 'Approve'] _enum: ['Skeptic', 'Reject', 'Approve']
}, },
/** /**
* Lookup447: pallet_recovery::RecoveryConfig<BlockNumber, Balance, sp_core::crypto::AccountId32> * Lookup455: pallet_recovery::RecoveryConfig<BlockNumber, Balance, sp_core::crypto::AccountId32>
**/ **/
PalletRecoveryRecoveryConfig: { PalletRecoveryRecoveryConfig: {
delayPeriod: 'u32', delayPeriod: 'u32',
@@ -1141,7 +1186,7 @@ export default {
threshold: 'u16' threshold: 'u16'
}, },
/** /**
* Lookup448: pallet_recovery::ActiveRecovery<BlockNumber, Balance, sp_core::crypto::AccountId32> * Lookup456: pallet_recovery::ActiveRecovery<BlockNumber, Balance, sp_core::crypto::AccountId32>
**/ **/
PalletRecoveryActiveRecovery: { PalletRecoveryActiveRecovery: {
created: 'u32', created: 'u32',
@@ -1149,13 +1194,13 @@ export default {
friends: 'Vec<AccountId32>' friends: 'Vec<AccountId32>'
}, },
/** /**
* Lookup452: pallet_vesting::Releases * Lookup460: pallet_vesting::Releases
**/ **/
PalletVestingReleases: { PalletVestingReleases: {
_enum: ['V0', 'V1'] _enum: ['V0', 'V1']
}, },
/** /**
* Lookup456: pallet_scheduler::ScheduledV2<node_runtime::Call, BlockNumber, node_runtime::OriginCaller, sp_core::crypto::AccountId32> * Lookup464: pallet_scheduler::ScheduledV2<node_runtime::Call, BlockNumber, node_runtime::OriginCaller, sp_core::crypto::AccountId32>
**/ **/
PalletSchedulerScheduledV2: { PalletSchedulerScheduledV2: {
maybeId: 'Option<Bytes>', maybeId: 'Option<Bytes>',
@@ -1165,58 +1210,13 @@ export default {
origin: 'NodeRuntimeOriginCaller' origin: 'NodeRuntimeOriginCaller'
}, },
/** /**
* Lookup457: node_runtime::OriginCaller * Lookup465: pallet_scheduler::Releases
**/
NodeRuntimeOriginCaller: {
_enum: {
system: 'FrameSystemRawOrigin',
__Unused1: 'Null',
__Unused2: 'Null',
Void: 'SpCoreVoid',
__Unused4: 'Null',
__Unused5: 'Null',
__Unused6: 'Null',
__Unused7: 'Null',
__Unused8: 'Null',
__Unused9: 'Null',
__Unused10: 'Null',
__Unused11: 'Null',
Council: 'PalletCollectiveRawOrigin',
TechnicalCommittee: 'PalletCollectiveRawOrigin'
}
},
/**
* Lookup458: frame_system::RawOrigin<sp_core::crypto::AccountId32>
**/
FrameSystemRawOrigin: {
_enum: {
Root: 'Null',
Signed: 'AccountId32',
None: 'Null'
}
},
/**
* Lookup459: pallet_collective::RawOrigin<sp_core::crypto::AccountId32, I>
**/
PalletCollectiveRawOrigin: {
_enum: {
Members: '(u32,u32)',
Member: 'AccountId32',
_Phantom: 'Null'
}
},
/**
* Lookup461: sp_core::Void
**/
SpCoreVoid: 'Null',
/**
* Lookup462: pallet_scheduler::Releases
**/ **/
PalletSchedulerReleases: { PalletSchedulerReleases: {
_enum: ['V1', 'V2'] _enum: ['V1', 'V2']
}, },
/** /**
* Lookup466: pallet_proxy::ProxyDefinition<sp_core::crypto::AccountId32, node_runtime::ProxyType, BlockNumber> * Lookup469: pallet_proxy::ProxyDefinition<sp_core::crypto::AccountId32, node_runtime::ProxyType, BlockNumber>
**/ **/
PalletProxyProxyDefinition: { PalletProxyProxyDefinition: {
delegate: 'AccountId32', delegate: 'AccountId32',
@@ -1224,7 +1224,7 @@ export default {
delay: 'u32' delay: 'u32'
}, },
/** /**
* Lookup470: pallet_proxy::Announcement<sp_core::crypto::AccountId32, primitive_types::H256, BlockNumber> * Lookup473: pallet_proxy::Announcement<sp_core::crypto::AccountId32, primitive_types::H256, BlockNumber>
**/ **/
PalletProxyAnnouncement: { PalletProxyAnnouncement: {
real: 'AccountId32', real: 'AccountId32',
@@ -1232,7 +1232,7 @@ export default {
height: 'u32' height: 'u32'
}, },
/** /**
* Lookup474: pallet_multisig::Multisig<BlockNumber, Balance, sp_core::crypto::AccountId32> * Lookup477: pallet_multisig::Multisig<BlockNumber, Balance, sp_core::crypto::AccountId32>
**/ **/
PalletMultisigMultisig: { PalletMultisigMultisig: {
when: 'PalletMultisigTimepoint', when: 'PalletMultisigTimepoint',
@@ -1241,7 +1241,7 @@ export default {
approvals: 'Vec<AccountId32>' approvals: 'Vec<AccountId32>'
}, },
/** /**
* Lookup477: pallet_bounties::Bounty<sp_core::crypto::AccountId32, Balance, BlockNumber> * Lookup480: pallet_bounties::Bounty<sp_core::crypto::AccountId32, Balance, BlockNumber>
**/ **/
PalletBountiesBounty: { PalletBountiesBounty: {
proposer: 'AccountId32', proposer: 'AccountId32',
@@ -1252,7 +1252,7 @@ export default {
status: 'PalletBountiesBountyStatus' status: 'PalletBountiesBountyStatus'
}, },
/** /**
* Lookup478: pallet_bounties::BountyStatus<sp_core::crypto::AccountId32, BlockNumber> * Lookup481: pallet_bounties::BountyStatus<sp_core::crypto::AccountId32, BlockNumber>
**/ **/
PalletBountiesBountyStatus: { PalletBountiesBountyStatus: {
_enum: { _enum: {
@@ -1274,7 +1274,7 @@ export default {
} }
}, },
/** /**
* Lookup480: pallet_tips::OpenTip<sp_core::crypto::AccountId32, Balance, BlockNumber, primitive_types::H256> * Lookup483: pallet_tips::OpenTip<sp_core::crypto::AccountId32, Balance, BlockNumber, primitive_types::H256>
**/ **/
PalletTipsOpenTip: { PalletTipsOpenTip: {
reason: 'H256', reason: 'H256',
@@ -1286,7 +1286,7 @@ export default {
findersFee: 'bool' findersFee: 'bool'
}, },
/** /**
* Lookup482: pallet_assets::types::AssetDetails<Balance, sp_core::crypto::AccountId32, DepositBalance> * Lookup485: pallet_assets::types::AssetDetails<Balance, sp_core::crypto::AccountId32, DepositBalance>
**/ **/
PalletAssetsAssetDetails: { PalletAssetsAssetDetails: {
owner: 'AccountId32', owner: 'AccountId32',
@@ -1303,7 +1303,7 @@ export default {
isFrozen: 'bool' isFrozen: 'bool'
}, },
/** /**
* Lookup483: pallet_assets::types::AssetBalance<Balance, Extra> * Lookup486: pallet_assets::types::AssetBalance<Balance, Extra>
**/ **/
PalletAssetsAssetBalance: { PalletAssetsAssetBalance: {
balance: 'u64', balance: 'u64',
@@ -1312,14 +1312,14 @@ export default {
extra: 'Null' extra: 'Null'
}, },
/** /**
* Lookup485: pallet_assets::types::Approval<Balance, DepositBalance> * Lookup488: pallet_assets::types::Approval<Balance, DepositBalance>
**/ **/
PalletAssetsApproval: { PalletAssetsApproval: {
amount: 'u64', amount: 'u64',
deposit: 'u128' deposit: 'u128'
}, },
/** /**
* Lookup486: pallet_assets::types::AssetMetadata<DepositBalance, frame_support::storage::bounded_vec::BoundedVec<T, S>> * Lookup489: pallet_assets::types::AssetMetadata<DepositBalance, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/ **/
PalletAssetsAssetMetadata: { PalletAssetsAssetMetadata: {
deposit: 'u128', deposit: 'u128',
@@ -1329,7 +1329,7 @@ export default {
isFrozen: 'bool' isFrozen: 'bool'
}, },
/** /**
* Lookup488: pallet_lottery::LotteryConfig<BlockNumber, Balance> * Lookup491: pallet_lottery::LotteryConfig<BlockNumber, Balance>
**/ **/
PalletLotteryLotteryConfig: { PalletLotteryLotteryConfig: {
price: 'u128', price: 'u128',
@@ -1339,14 +1339,14 @@ export default {
repeat: 'bool' repeat: 'bool'
}, },
/** /**
* Lookup493: pallet_gilt::pallet::GiltBid<Balance, sp_core::crypto::AccountId32> * Lookup496: pallet_gilt::pallet::GiltBid<Balance, sp_core::crypto::AccountId32>
**/ **/
PalletGiltGiltBid: { PalletGiltGiltBid: {
amount: 'u128', amount: 'u128',
who: 'AccountId32' who: 'AccountId32'
}, },
/** /**
* Lookup494: pallet_gilt::pallet::ActiveGiltsTotal<Balance> * Lookup497: pallet_gilt::pallet::ActiveGiltsTotal<Balance>
**/ **/
PalletGiltActiveGiltsTotal: { PalletGiltActiveGiltsTotal: {
frozen: 'u128', frozen: 'u128',
@@ -1355,7 +1355,7 @@ export default {
target: 'Perquintill' target: 'Perquintill'
}, },
/** /**
* Lookup495: pallet_gilt::pallet::ActiveGilt<Balance, sp_core::crypto::AccountId32, BlockNumber> * Lookup498: pallet_gilt::pallet::ActiveGilt<Balance, sp_core::crypto::AccountId32, BlockNumber>
**/ **/
PalletGiltActiveGilt: { PalletGiltActiveGilt: {
proportion: 'Perquintill', proportion: 'Perquintill',
@@ -1364,7 +1364,7 @@ export default {
expiry: 'u32' expiry: 'u32'
}, },
/** /**
* Lookup497: pallet_uniques::types::ClassDetails<sp_core::crypto::AccountId32, DepositBalance> * Lookup500: pallet_uniques::types::ClassDetails<sp_core::crypto::AccountId32, DepositBalance>
**/ **/
PalletUniquesClassDetails: { PalletUniquesClassDetails: {
owner: 'AccountId32', owner: 'AccountId32',
@@ -1379,7 +1379,7 @@ export default {
isFrozen: 'bool' isFrozen: 'bool'
}, },
/** /**
* Lookup499: pallet_uniques::types::InstanceDetails<sp_core::crypto::AccountId32, DepositBalance> * Lookup502: pallet_uniques::types::InstanceDetails<sp_core::crypto::AccountId32, DepositBalance>
**/ **/
PalletUniquesInstanceDetails: { PalletUniquesInstanceDetails: {
owner: 'AccountId32', owner: 'AccountId32',
@@ -1388,7 +1388,7 @@ export default {
deposit: 'u128' deposit: 'u128'
}, },
/** /**
* Lookup500: pallet_uniques::types::ClassMetadata<DepositBalance, StringLimit> * Lookup503: pallet_uniques::types::ClassMetadata<DepositBalance, StringLimit>
**/ **/
PalletUniquesClassMetadata: { PalletUniquesClassMetadata: {
deposit: 'u128', deposit: 'u128',
@@ -1396,7 +1396,7 @@ export default {
isFrozen: 'bool' isFrozen: 'bool'
}, },
/** /**
* Lookup501: pallet_uniques::types::InstanceMetadata<DepositBalance, StringLimit> * Lookup504: pallet_uniques::types::InstanceMetadata<DepositBalance, StringLimit>
**/ **/
PalletUniquesInstanceMetadata: { PalletUniquesInstanceMetadata: {
deposit: 'u128', deposit: 'u128',
@@ -1404,7 +1404,7 @@ export default {
isFrozen: 'bool' isFrozen: 'bool'
}, },
/** /**
* Lookup506: pallet_transaction_storage::TransactionInfo * Lookup509: pallet_transaction_storage::TransactionInfo
**/ **/
PalletTransactionStorageTransactionInfo: { PalletTransactionStorageTransactionInfo: {
_alias: { _alias: {
@@ -1416,7 +1416,7 @@ export default {
blockChunks: 'u32' blockChunks: 'u32'
}, },
/** /**
* Lookup508: pallet_bags_list::list::Node<T> * Lookup511: pallet_bags_list::list::Node<T>
**/ **/
PalletBagsListListNode: { PalletBagsListListNode: {
id: 'AccountId32', id: 'AccountId32',
@@ -1425,14 +1425,14 @@ export default {
bagUpper: 'u64' bagUpper: 'u64'
}, },
/** /**
* Lookup509: pallet_bags_list::list::Bag<T> * Lookup512: pallet_bags_list::list::Bag<T>
**/ **/
PalletBagsListListBag: { PalletBagsListListBag: {
head: 'Option<AccountId32>', head: 'Option<AccountId32>',
tail: 'Option<AccountId32>' tail: 'Option<AccountId32>'
}, },
/** /**
* Lookup512: sp_runtime::MultiSignature * Lookup515: sp_runtime::MultiSignature
**/ **/
SpRuntimeMultiSignature: { SpRuntimeMultiSignature: {
_enum: { _enum: {
@@ -1442,35 +1442,35 @@ export default {
} }
}, },
/** /**
* Lookup513: sp_core::ecdsa::Signature * Lookup516: sp_core::ecdsa::Signature
**/ **/
SpCoreEcdsaSignature: '[u8;65]', SpCoreEcdsaSignature: '[u8;65]',
/** /**
* Lookup516: frame_system::extensions::check_spec_version::CheckSpecVersion<T> * Lookup519: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
**/ **/
FrameSystemExtensionsCheckSpecVersion: 'Null', FrameSystemExtensionsCheckSpecVersion: 'Null',
/** /**
* Lookup517: frame_system::extensions::check_tx_version::CheckTxVersion<T> * Lookup520: frame_system::extensions::check_tx_version::CheckTxVersion<T>
**/ **/
FrameSystemExtensionsCheckTxVersion: 'Null', FrameSystemExtensionsCheckTxVersion: 'Null',
/** /**
* Lookup518: frame_system::extensions::check_genesis::CheckGenesis<T> * Lookup521: frame_system::extensions::check_genesis::CheckGenesis<T>
**/ **/
FrameSystemExtensionsCheckGenesis: 'Null', FrameSystemExtensionsCheckGenesis: 'Null',
/** /**
* Lookup521: frame_system::extensions::check_nonce::CheckNonce<T> * Lookup524: frame_system::extensions::check_nonce::CheckNonce<T>
**/ **/
FrameSystemExtensionsCheckNonce: 'Compact<u32>', FrameSystemExtensionsCheckNonce: 'Compact<u32>',
/** /**
* Lookup522: frame_system::extensions::check_weight::CheckWeight<T> * Lookup525: frame_system::extensions::check_weight::CheckWeight<T>
**/ **/
FrameSystemExtensionsCheckWeight: 'Null', FrameSystemExtensionsCheckWeight: 'Null',
/** /**
* Lookup523: pallet_transaction_payment::ChargeTransactionPayment<T> * Lookup526: pallet_transaction_payment::ChargeTransactionPayment<T>
**/ **/
PalletTransactionPaymentChargeTransactionPayment: 'Compact<u128>', PalletTransactionPaymentChargeTransactionPayment: 'Compact<u128>',
/** /**
* Lookup524: node_runtime::Runtime * Lookup527: node_runtime::Runtime
**/ **/
NodeRuntimeRuntime: 'Null' NodeRuntimeRuntime: 'Null'
} as DefinitionsTypes; } as DefinitionsTypes;
@@ -468,7 +468,30 @@ declare module '@polkadot/types/lookup' {
readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic; readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic;
} }
/** @name KusamaRuntimeNposCompactSolution24 (371) */ /** @name KusamaRuntimeOriginCaller (316) */
export interface KusamaRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin;
readonly isVoid: boolean;
readonly isCouncil: boolean;
readonly asCouncil: PalletCollectiveRawOrigin;
readonly isTechnicalCommittee: boolean;
readonly asTechnicalCommittee: PalletCollectiveRawOrigin;
readonly isParachainsOrigin: boolean;
readonly asParachainsOrigin: PolkadotRuntimeParachainsOriginPalletOrigin;
readonly isXcmPallet: boolean;
readonly asXcmPallet: PalletXcmOrigin;
}
/** @name PalletXcmOrigin (321) */
export interface PalletXcmOrigin extends Enum {
readonly isXcm: boolean;
readonly asXcm: XcmV1MultiLocation;
readonly isResponse: boolean;
readonly asResponse: XcmV1MultiLocation;
}
/** @name KusamaRuntimeNposCompactSolution24 (379) */
export interface KusamaRuntimeNposCompactSolution24 extends Struct { export interface KusamaRuntimeNposCompactSolution24 extends Struct {
readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>; readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>;
readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>; readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>;
@@ -496,7 +519,7 @@ declare module '@polkadot/types/lookup' {
readonly votes24: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>; readonly votes24: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>;
} }
/** @name XcmVersionedXcm (504) */ /** @name XcmVersionedXcm (512) */
export interface XcmVersionedXcm extends Enum { export interface XcmVersionedXcm extends Enum {
readonly isV0: boolean; readonly isV0: boolean;
readonly asV0: XcmV0Xcm; readonly asV0: XcmV0Xcm;
@@ -506,7 +529,7 @@ declare module '@polkadot/types/lookup' {
readonly asV2: XcmV2Xcm; readonly asV2: XcmV2Xcm;
} }
/** @name XcmV0Xcm (505) */ /** @name XcmV0Xcm (513) */
export interface XcmV0Xcm extends Enum { export interface XcmV0Xcm extends Enum {
readonly isWithdrawAsset: boolean; readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: { readonly asWithdrawAsset: {
@@ -568,7 +591,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV0Order (507) */ /** @name XcmV0Order (515) */
export interface XcmV0Order extends Enum { export interface XcmV0Order extends Enum {
readonly isNull: boolean; readonly isNull: boolean;
readonly isDepositAsset: boolean; readonly isDepositAsset: boolean;
@@ -615,13 +638,13 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV0Response (509) */ /** @name XcmV0Response (517) */
export interface XcmV0Response extends Enum { export interface XcmV0Response extends Enum {
readonly isAssets: boolean; readonly isAssets: boolean;
readonly asAssets: Vec<XcmV0MultiAsset>; readonly asAssets: Vec<XcmV0MultiAsset>;
} }
/** @name XcmV1Xcm (510) */ /** @name XcmV1Xcm (518) */
export interface XcmV1Xcm extends Enum { export interface XcmV1Xcm extends Enum {
readonly isWithdrawAsset: boolean; readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: { readonly asWithdrawAsset: {
@@ -689,7 +712,7 @@ declare module '@polkadot/types/lookup' {
readonly isUnsubscribeVersion: boolean; readonly isUnsubscribeVersion: boolean;
} }
/** @name XcmV1Order (512) */ /** @name XcmV1Order (520) */
export interface XcmV1Order extends Enum { export interface XcmV1Order extends Enum {
readonly isNoop: boolean; readonly isNoop: boolean;
readonly isDepositAsset: boolean; readonly isDepositAsset: boolean;
@@ -738,7 +761,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV1Response (514) */ /** @name XcmV1Response (522) */
export interface XcmV1Response extends Enum { export interface XcmV1Response extends Enum {
readonly isAssets: boolean; readonly isAssets: boolean;
readonly asAssets: XcmV1MultiassetMultiAssets; readonly asAssets: XcmV1MultiassetMultiAssets;
@@ -746,30 +769,7 @@ declare module '@polkadot/types/lookup' {
readonly asVersion: u32; readonly asVersion: u32;
} }
/** @name KusamaRuntimeOriginCaller (575) */ /** @name PalletXcmQueryStatus (690) */
export interface KusamaRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin;
readonly isVoid: boolean;
readonly isCouncil: boolean;
readonly asCouncil: PalletCollectiveRawOrigin;
readonly isTechnicalCommittee: boolean;
readonly asTechnicalCommittee: PalletCollectiveRawOrigin;
readonly isParachainsOrigin: boolean;
readonly asParachainsOrigin: PolkadotRuntimeParachainsOriginPalletOrigin;
readonly isXcmPallet: boolean;
readonly asXcmPallet: PalletXcmOrigin;
}
/** @name PalletXcmOrigin (580) */
export interface PalletXcmOrigin extends Enum {
readonly isXcm: boolean;
readonly asXcm: XcmV1MultiLocation;
readonly isResponse: boolean;
readonly asResponse: XcmV1MultiLocation;
}
/** @name PalletXcmQueryStatus (689) */
export interface PalletXcmQueryStatus extends Enum { export interface PalletXcmQueryStatus extends Enum {
readonly isPending: boolean; readonly isPending: boolean;
readonly asPending: { readonly asPending: {
@@ -789,7 +789,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmVersionedResponse (692) */ /** @name XcmVersionedResponse (693) */
export interface XcmVersionedResponse extends Enum { export interface XcmVersionedResponse extends Enum {
readonly isV0: boolean; readonly isV0: boolean;
readonly asV0: XcmV0Response; readonly asV0: XcmV0Response;
@@ -799,7 +799,7 @@ declare module '@polkadot/types/lookup' {
readonly asV2: XcmV2Response; readonly asV2: XcmV2Response;
} }
/** @name PalletXcmVersionMigrationStage (698) */ /** @name PalletXcmVersionMigrationStage (699) */
export interface PalletXcmVersionMigrationStage extends Enum { export interface PalletXcmVersionMigrationStage extends Enum {
readonly isMigrateSupportedVersion: boolean; readonly isMigrateSupportedVersion: boolean;
readonly isMigrateVersionNotifiers: boolean; readonly isMigrateVersionNotifiers: boolean;
@@ -808,7 +808,7 @@ declare module '@polkadot/types/lookup' {
readonly isMigrateAndNotifyOldTargets: boolean; readonly isMigrateAndNotifyOldTargets: boolean;
} }
/** @name KusamaRuntimeRuntime (710) */ /** @name KusamaRuntimeRuntime (711) */
export type KusamaRuntimeRuntime = Null; export type KusamaRuntimeRuntime = Null;
} }
@@ -7,9 +7,6 @@ import type { ITuple } from '@polkadot/types/types';
declare module '@polkadot/types/lookup' { declare module '@polkadot/types/lookup' {
/** @name PolkadotRuntimeCommonClaimsEthereumAddress (66) */
export interface PolkadotRuntimeCommonClaimsEthereumAddress extends U8aFixed {}
/** @name PolkadotRuntimeProxyType (72) */ /** @name PolkadotRuntimeProxyType (72) */
export interface PolkadotRuntimeProxyType extends Enum { export interface PolkadotRuntimeProxyType extends Enum {
readonly isAny: boolean; readonly isAny: boolean;
@@ -21,13 +18,13 @@ declare module '@polkadot/types/lookup' {
readonly isAuction: boolean; readonly isAuction: boolean;
} }
/** @name PolkadotPrimitivesV1CandidateReceipt (82) */ /** @name PolkadotPrimitivesV1CandidateReceipt (83) */
export interface PolkadotPrimitivesV1CandidateReceipt extends Struct { export interface PolkadotPrimitivesV1CandidateReceipt extends Struct {
readonly descriptor: PolkadotPrimitivesV1CandidateDescriptor; readonly descriptor: PolkadotPrimitivesV1CandidateDescriptor;
readonly commitmentsHash: H256; readonly commitmentsHash: H256;
} }
/** @name PolkadotPrimitivesV1CandidateDescriptor (83) */ /** @name PolkadotPrimitivesV1CandidateDescriptor (84) */
export interface PolkadotPrimitivesV1CandidateDescriptor extends Struct { export interface PolkadotPrimitivesV1CandidateDescriptor extends Struct {
readonly paraId: u32; readonly paraId: u32;
readonly relayParent: H256; readonly relayParent: H256;
@@ -40,13 +37,13 @@ declare module '@polkadot/types/lookup' {
readonly validationCodeHash: H256; readonly validationCodeHash: H256;
} }
/** @name PolkadotPrimitivesV0CollatorAppPublic (85) */ /** @name PolkadotPrimitivesV0CollatorAppPublic (86) */
export interface PolkadotPrimitivesV0CollatorAppPublic extends SpCoreSr25519Public {} export interface PolkadotPrimitivesV0CollatorAppPublic extends SpCoreSr25519Public {}
/** @name PolkadotPrimitivesV0CollatorAppSignature (86) */ /** @name PolkadotPrimitivesV0CollatorAppSignature (87) */
export interface PolkadotPrimitivesV0CollatorAppSignature extends SpCoreSr25519Signature {} export interface PolkadotPrimitivesV0CollatorAppSignature extends SpCoreSr25519Signature {}
/** @name XcmV2TraitsOutcome (95) */ /** @name XcmV2TraitsOutcome (96) */
export interface XcmV2TraitsOutcome extends Enum { export interface XcmV2TraitsOutcome extends Enum {
readonly isComplete: boolean; readonly isComplete: boolean;
readonly asComplete: u64; readonly asComplete: u64;
@@ -56,7 +53,7 @@ declare module '@polkadot/types/lookup' {
readonly asError: XcmV2TraitsError; readonly asError: XcmV2TraitsError;
} }
/** @name XcmV2TraitsError (96) */ /** @name XcmV2TraitsError (97) */
export interface XcmV2TraitsError extends Enum { export interface XcmV2TraitsError extends Enum {
readonly isOverflow: boolean; readonly isOverflow: boolean;
readonly isUnimplemented: boolean; readonly isUnimplemented: boolean;
@@ -88,13 +85,13 @@ declare module '@polkadot/types/lookup' {
readonly isWeightNotComputable: boolean; readonly isWeightNotComputable: boolean;
} }
/** @name PolkadotParachainPrimitivesHrmpChannelId (98) */ /** @name PolkadotParachainPrimitivesHrmpChannelId (99) */
export interface PolkadotParachainPrimitivesHrmpChannelId extends Struct { export interface PolkadotParachainPrimitivesHrmpChannelId extends Struct {
readonly sender: u32; readonly sender: u32;
readonly recipient: u32; readonly recipient: u32;
} }
/** @name PolkadotRuntimeSessionKeys (161) */ /** @name PolkadotRuntimeSessionKeys (162) */
export interface PolkadotRuntimeSessionKeys extends Struct { export interface PolkadotRuntimeSessionKeys extends Struct {
readonly grandpa: SpFinalityGrandpaAppPublic; readonly grandpa: SpFinalityGrandpaAppPublic;
readonly babe: SpConsensusBabeAppPublic; readonly babe: SpConsensusBabeAppPublic;
@@ -104,22 +101,41 @@ declare module '@polkadot/types/lookup' {
readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic; readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic;
} }
/** @name PolkadotPrimitivesV0ValidatorAppPublic (162) */ /** @name PolkadotPrimitivesV0ValidatorAppPublic (163) */
export interface PolkadotPrimitivesV0ValidatorAppPublic extends SpCoreSr25519Public {} export interface PolkadotPrimitivesV0ValidatorAppPublic extends SpCoreSr25519Public {}
/** @name PolkadotPrimitivesV1AssignmentAppPublic (163) */ /** @name PolkadotPrimitivesV1AssignmentAppPublic (164) */
export interface PolkadotPrimitivesV1AssignmentAppPublic extends SpCoreSr25519Public {} export interface PolkadotPrimitivesV1AssignmentAppPublic extends SpCoreSr25519Public {}
/** @name PolkadotRuntimeCommonClaimsEcdsaSignature (195) */ /** @name PolkadotRuntimeCommonClaimsEcdsaSignature (196) */
export interface PolkadotRuntimeCommonClaimsEcdsaSignature extends U8aFixed {} export interface PolkadotRuntimeCommonClaimsEcdsaSignature extends U8aFixed {}
/** @name PolkadotRuntimeCommonClaimsStatementKind (200) */ /** @name PolkadotRuntimeCommonClaimsStatementKind (201) */
export interface PolkadotRuntimeCommonClaimsStatementKind extends Enum { export interface PolkadotRuntimeCommonClaimsStatementKind extends Enum {
readonly isRegular: boolean; readonly isRegular: boolean;
readonly isSaft: boolean; readonly isSaft: boolean;
} }
/** @name PolkadotRuntimeNposCompactSolution16 (253) */ /** @name PolkadotRuntimeOriginCaller (206) */
export interface PolkadotRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin;
readonly isVoid: boolean;
readonly isCouncil: boolean;
readonly asCouncil: PalletCollectiveRawOrigin;
readonly isTechnicalCommittee: boolean;
readonly asTechnicalCommittee: PalletCollectiveRawOrigin;
readonly isParachainsOrigin: boolean;
readonly asParachainsOrigin: PolkadotRuntimeParachainsOriginPalletOrigin;
}
/** @name PolkadotRuntimeParachainsOriginPalletOrigin (210) */
export interface PolkadotRuntimeParachainsOriginPalletOrigin extends Enum {
readonly isParachain: boolean;
readonly asParachain: u32;
}
/** @name PolkadotRuntimeNposCompactSolution16 (261) */
export interface PolkadotRuntimeNposCompactSolution16 extends Struct { export interface PolkadotRuntimeNposCompactSolution16 extends Struct {
readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>; readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>;
readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>; readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>;
@@ -139,7 +155,7 @@ declare module '@polkadot/types/lookup' {
readonly votes16: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>; readonly votes16: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>;
} }
/** @name PolkadotPrimitivesV1InherentData (314) */ /** @name PolkadotPrimitivesV1InherentData (323) */
export interface PolkadotPrimitivesV1InherentData extends Struct { export interface PolkadotPrimitivesV1InherentData extends Struct {
readonly bitfields: Vec<PolkadotPrimitivesV1SignedUncheckedSigned>; readonly bitfields: Vec<PolkadotPrimitivesV1SignedUncheckedSigned>;
readonly backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>; readonly backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>;
@@ -147,33 +163,33 @@ declare module '@polkadot/types/lookup' {
readonly parentHeader: SpRuntimeGenericHeader; readonly parentHeader: SpRuntimeGenericHeader;
} }
/** @name PolkadotPrimitivesV1SignedUncheckedSigned (316) */ /** @name PolkadotPrimitivesV1SignedUncheckedSigned (325) */
export interface PolkadotPrimitivesV1SignedUncheckedSigned extends Struct { export interface PolkadotPrimitivesV1SignedUncheckedSigned extends Struct {
readonly payload: BitVec; readonly payload: BitVec;
readonly validatorIndex: u32; readonly validatorIndex: u32;
readonly signature: PolkadotPrimitivesV0ValidatorAppSignature; readonly signature: PolkadotPrimitivesV0ValidatorAppSignature;
} }
/** @name BitvecOrderLsb0 (319) */ /** @name BitvecOrderLsb0 (328) */
export type BitvecOrderLsb0 = Null; export type BitvecOrderLsb0 = Null;
/** @name PolkadotPrimitivesV0ValidatorAppSignature (321) */ /** @name PolkadotPrimitivesV0ValidatorAppSignature (330) */
export interface PolkadotPrimitivesV0ValidatorAppSignature extends SpCoreSr25519Signature {} export interface PolkadotPrimitivesV0ValidatorAppSignature extends SpCoreSr25519Signature {}
/** @name PolkadotPrimitivesV1BackedCandidate (323) */ /** @name PolkadotPrimitivesV1BackedCandidate (332) */
export interface PolkadotPrimitivesV1BackedCandidate extends Struct { export interface PolkadotPrimitivesV1BackedCandidate extends Struct {
readonly candidate: PolkadotPrimitivesV1CommittedCandidateReceipt; readonly candidate: PolkadotPrimitivesV1CommittedCandidateReceipt;
readonly validityVotes: Vec<PolkadotPrimitivesV0ValidityAttestation>; readonly validityVotes: Vec<PolkadotPrimitivesV0ValidityAttestation>;
readonly validatorIndices: BitVec; readonly validatorIndices: BitVec;
} }
/** @name PolkadotPrimitivesV1CommittedCandidateReceipt (324) */ /** @name PolkadotPrimitivesV1CommittedCandidateReceipt (333) */
export interface PolkadotPrimitivesV1CommittedCandidateReceipt extends Struct { export interface PolkadotPrimitivesV1CommittedCandidateReceipt extends Struct {
readonly descriptor: PolkadotPrimitivesV1CandidateDescriptor; readonly descriptor: PolkadotPrimitivesV1CandidateDescriptor;
readonly commitments: PolkadotPrimitivesV1CandidateCommitments; readonly commitments: PolkadotPrimitivesV1CandidateCommitments;
} }
/** @name PolkadotPrimitivesV1CandidateCommitments (325) */ /** @name PolkadotPrimitivesV1CandidateCommitments (334) */
export interface PolkadotPrimitivesV1CandidateCommitments extends Struct { export interface PolkadotPrimitivesV1CandidateCommitments extends Struct {
readonly upwardMessages: Vec<Bytes>; readonly upwardMessages: Vec<Bytes>;
readonly horizontalMessages: Vec<PolkadotCorePrimitivesOutboundHrmpMessage>; readonly horizontalMessages: Vec<PolkadotCorePrimitivesOutboundHrmpMessage>;
@@ -183,13 +199,13 @@ declare module '@polkadot/types/lookup' {
readonly hrmpWatermark: u32; readonly hrmpWatermark: u32;
} }
/** @name PolkadotCorePrimitivesOutboundHrmpMessage (327) */ /** @name PolkadotCorePrimitivesOutboundHrmpMessage (336) */
export interface PolkadotCorePrimitivesOutboundHrmpMessage extends Struct { export interface PolkadotCorePrimitivesOutboundHrmpMessage extends Struct {
readonly recipient: u32; readonly recipient: u32;
readonly data: Bytes; readonly data: Bytes;
} }
/** @name PolkadotPrimitivesV0ValidityAttestation (331) */ /** @name PolkadotPrimitivesV0ValidityAttestation (340) */
export interface PolkadotPrimitivesV0ValidityAttestation extends Enum { export interface PolkadotPrimitivesV0ValidityAttestation extends Enum {
readonly isImplicit: boolean; readonly isImplicit: boolean;
readonly asImplicit: PolkadotPrimitivesV0ValidatorAppSignature; readonly asImplicit: PolkadotPrimitivesV0ValidatorAppSignature;
@@ -197,14 +213,14 @@ declare module '@polkadot/types/lookup' {
readonly asExplicit: PolkadotPrimitivesV0ValidatorAppSignature; readonly asExplicit: PolkadotPrimitivesV0ValidatorAppSignature;
} }
/** @name PolkadotPrimitivesV1DisputeStatementSet (333) */ /** @name PolkadotPrimitivesV1DisputeStatementSet (342) */
export interface PolkadotPrimitivesV1DisputeStatementSet extends Struct { export interface PolkadotPrimitivesV1DisputeStatementSet extends Struct {
readonly candidateHash: H256; readonly candidateHash: H256;
readonly session: u32; readonly session: u32;
readonly statements: Vec<ITuple<[PolkadotPrimitivesV1DisputeStatement, u32, PolkadotPrimitivesV0ValidatorAppSignature]>>; readonly statements: Vec<ITuple<[PolkadotPrimitivesV1DisputeStatement, u32, PolkadotPrimitivesV0ValidatorAppSignature]>>;
} }
/** @name PolkadotPrimitivesV1DisputeStatement (337) */ /** @name PolkadotPrimitivesV1DisputeStatement (346) */
export interface PolkadotPrimitivesV1DisputeStatement extends Enum { export interface PolkadotPrimitivesV1DisputeStatement extends Enum {
readonly isValid: boolean; readonly isValid: boolean;
readonly asValid: PolkadotPrimitivesV1ValidDisputeStatementKind; readonly asValid: PolkadotPrimitivesV1ValidDisputeStatementKind;
@@ -212,7 +228,7 @@ declare module '@polkadot/types/lookup' {
readonly asInvalid: PolkadotPrimitivesV1InvalidDisputeStatementKind; readonly asInvalid: PolkadotPrimitivesV1InvalidDisputeStatementKind;
} }
/** @name PolkadotPrimitivesV1ValidDisputeStatementKind (338) */ /** @name PolkadotPrimitivesV1ValidDisputeStatementKind (347) */
export interface PolkadotPrimitivesV1ValidDisputeStatementKind extends Enum { export interface PolkadotPrimitivesV1ValidDisputeStatementKind extends Enum {
readonly isExplicit: boolean; readonly isExplicit: boolean;
readonly isBackingSeconded: boolean; readonly isBackingSeconded: boolean;
@@ -222,12 +238,12 @@ declare module '@polkadot/types/lookup' {
readonly isApprovalChecking: boolean; readonly isApprovalChecking: boolean;
} }
/** @name PolkadotPrimitivesV1InvalidDisputeStatementKind (339) */ /** @name PolkadotPrimitivesV1InvalidDisputeStatementKind (348) */
export interface PolkadotPrimitivesV1InvalidDisputeStatementKind extends Enum { export interface PolkadotPrimitivesV1InvalidDisputeStatementKind extends Enum {
readonly isExplicit: boolean; readonly isExplicit: boolean;
} }
/** @name SpRuntimeMultiSigner (351) */ /** @name SpRuntimeMultiSigner (360) */
export interface SpRuntimeMultiSigner extends Enum { export interface SpRuntimeMultiSigner extends Enum {
readonly isEd25519: boolean; readonly isEd25519: boolean;
readonly asEd25519: SpCoreEd25519Public; readonly asEd25519: SpCoreEd25519Public;
@@ -237,29 +253,10 @@ declare module '@polkadot/types/lookup' {
readonly asEcdsa: SpCoreEcdsaPublic; readonly asEcdsa: SpCoreEcdsaPublic;
} }
/** @name SpCoreEcdsaPublic (352) */ /** @name SpCoreEcdsaPublic (361) */
export interface SpCoreEcdsaPublic extends U8aFixed {} export interface SpCoreEcdsaPublic extends U8aFixed {}
/** @name PolkadotRuntimeOriginCaller (357) */ /** @name PolkadotRuntimeParachainsConfigurationHostConfiguration (514) */
export interface PolkadotRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin;
readonly isVoid: boolean;
readonly isCouncil: boolean;
readonly asCouncil: PalletCollectiveRawOrigin;
readonly isTechnicalCommittee: boolean;
readonly asTechnicalCommittee: PalletCollectiveRawOrigin;
readonly isParachainsOrigin: boolean;
readonly asParachainsOrigin: PolkadotRuntimeParachainsOriginPalletOrigin;
}
/** @name PolkadotRuntimeParachainsOriginPalletOrigin (361) */
export interface PolkadotRuntimeParachainsOriginPalletOrigin extends Enum {
readonly isParachain: boolean;
readonly asParachain: u32;
}
/** @name PolkadotRuntimeParachainsConfigurationHostConfiguration (508) */
export interface PolkadotRuntimeParachainsConfigurationHostConfiguration extends Struct { export interface PolkadotRuntimeParachainsConfigurationHostConfiguration extends Struct {
readonly maxCodeSize: u32; readonly maxCodeSize: u32;
readonly maxHeadDataSize: u32; readonly maxHeadDataSize: u32;
@@ -303,13 +300,13 @@ declare module '@polkadot/types/lookup' {
readonly umpMaxIndividualWeight: u64; readonly umpMaxIndividualWeight: u64;
} }
/** @name PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord (512) */ /** @name PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord (518) */
export interface PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord extends Struct { export interface PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord extends Struct {
readonly bitfield: BitVec; readonly bitfield: BitVec;
readonly submittedAt: u32; readonly submittedAt: u32;
} }
/** @name PolkadotRuntimeParachainsInclusionCandidatePendingAvailability (513) */ /** @name PolkadotRuntimeParachainsInclusionCandidatePendingAvailability (519) */
export interface PolkadotRuntimeParachainsInclusionCandidatePendingAvailability extends Struct { export interface PolkadotRuntimeParachainsInclusionCandidatePendingAvailability extends Struct {
readonly core: u32; readonly core: u32;
readonly hash_: H256; readonly hash_: H256;
@@ -321,42 +318,42 @@ declare module '@polkadot/types/lookup' {
readonly backingGroup: u32; readonly backingGroup: u32;
} }
/** @name PolkadotPrimitivesV1ScrapedOnChainVotes (515) */ /** @name PolkadotPrimitivesV1ScrapedOnChainVotes (521) */
export interface PolkadotPrimitivesV1ScrapedOnChainVotes extends Struct { export interface PolkadotPrimitivesV1ScrapedOnChainVotes extends Struct {
readonly session: u32; readonly session: u32;
readonly backingValidatorsPerCandidate: Vec<ITuple<[PolkadotPrimitivesV1CandidateReceipt, Vec<ITuple<[u32, PolkadotPrimitivesV0ValidityAttestation]>>]>>; readonly backingValidatorsPerCandidate: Vec<ITuple<[PolkadotPrimitivesV1CandidateReceipt, Vec<ITuple<[u32, PolkadotPrimitivesV0ValidityAttestation]>>]>>;
readonly disputes: Vec<PolkadotPrimitivesV1DisputeStatementSet>; readonly disputes: Vec<PolkadotPrimitivesV1DisputeStatementSet>;
} }
/** @name PolkadotRuntimeParachainsSchedulerParathreadClaimQueue (522) */ /** @name PolkadotRuntimeParachainsSchedulerParathreadClaimQueue (528) */
export interface PolkadotRuntimeParachainsSchedulerParathreadClaimQueue extends Struct { export interface PolkadotRuntimeParachainsSchedulerParathreadClaimQueue extends Struct {
readonly queue: Vec<PolkadotRuntimeParachainsSchedulerQueuedParathread>; readonly queue: Vec<PolkadotRuntimeParachainsSchedulerQueuedParathread>;
readonly nextCoreOffset: u32; readonly nextCoreOffset: u32;
} }
/** @name PolkadotRuntimeParachainsSchedulerQueuedParathread (524) */ /** @name PolkadotRuntimeParachainsSchedulerQueuedParathread (530) */
export interface PolkadotRuntimeParachainsSchedulerQueuedParathread extends Struct { export interface PolkadotRuntimeParachainsSchedulerQueuedParathread extends Struct {
readonly claim: PolkadotPrimitivesV1ParathreadEntry; readonly claim: PolkadotPrimitivesV1ParathreadEntry;
readonly coreOffset: u32; readonly coreOffset: u32;
} }
/** @name PolkadotPrimitivesV1ParathreadEntry (525) */ /** @name PolkadotPrimitivesV1ParathreadEntry (531) */
export interface PolkadotPrimitivesV1ParathreadEntry extends Struct { export interface PolkadotPrimitivesV1ParathreadEntry extends Struct {
readonly claim: PolkadotPrimitivesV1ParathreadClaim; readonly claim: PolkadotPrimitivesV1ParathreadClaim;
readonly retries: u32; readonly retries: u32;
} }
/** @name PolkadotPrimitivesV1ParathreadClaim (526) */ /** @name PolkadotPrimitivesV1ParathreadClaim (532) */
export interface PolkadotPrimitivesV1ParathreadClaim extends ITuple<[u32, PolkadotPrimitivesV0CollatorAppPublic]> {} export interface PolkadotPrimitivesV1ParathreadClaim extends ITuple<[u32, PolkadotPrimitivesV0CollatorAppPublic]> {}
/** @name PolkadotPrimitivesV1CoreOccupied (529) */ /** @name PolkadotPrimitivesV1CoreOccupied (535) */
export interface PolkadotPrimitivesV1CoreOccupied extends Enum { export interface PolkadotPrimitivesV1CoreOccupied extends Enum {
readonly isParathread: boolean; readonly isParathread: boolean;
readonly asParathread: PolkadotPrimitivesV1ParathreadEntry; readonly asParathread: PolkadotPrimitivesV1ParathreadEntry;
readonly isParachain: boolean; readonly isParachain: boolean;
} }
/** @name PolkadotRuntimeParachainsSchedulerCoreAssignment (532) */ /** @name PolkadotRuntimeParachainsSchedulerCoreAssignment (538) */
export interface PolkadotRuntimeParachainsSchedulerCoreAssignment extends Struct { export interface PolkadotRuntimeParachainsSchedulerCoreAssignment extends Struct {
readonly core: u32; readonly core: u32;
readonly paraId: u32; readonly paraId: u32;
@@ -364,14 +361,14 @@ declare module '@polkadot/types/lookup' {
readonly groupIdx: u32; readonly groupIdx: u32;
} }
/** @name PolkadotRuntimeParachainsSchedulerAssignmentKind (533) */ /** @name PolkadotRuntimeParachainsSchedulerAssignmentKind (539) */
export interface PolkadotRuntimeParachainsSchedulerAssignmentKind extends Enum { export interface PolkadotRuntimeParachainsSchedulerAssignmentKind extends Enum {
readonly isParachain: boolean; readonly isParachain: boolean;
readonly isParathread: boolean; readonly isParathread: boolean;
readonly asParathread: ITuple<[PolkadotPrimitivesV0CollatorAppPublic, u32]>; readonly asParathread: ITuple<[PolkadotPrimitivesV0CollatorAppPublic, u32]>;
} }
/** @name PolkadotRuntimeParachainsParasParaLifecycle (534) */ /** @name PolkadotRuntimeParachainsParasParaLifecycle (540) */
export interface PolkadotRuntimeParachainsParasParaLifecycle extends Enum { export interface PolkadotRuntimeParachainsParasParaLifecycle extends Enum {
readonly isOnboarding: boolean; readonly isOnboarding: boolean;
readonly isParathread: boolean; readonly isParathread: boolean;
@@ -382,50 +379,50 @@ declare module '@polkadot/types/lookup' {
readonly isOffboardingParachain: boolean; readonly isOffboardingParachain: boolean;
} }
/** @name PolkadotRuntimeParachainsParasParaPastCodeMeta (536) */ /** @name PolkadotRuntimeParachainsParasParaPastCodeMeta (542) */
export interface PolkadotRuntimeParachainsParasParaPastCodeMeta extends Struct { export interface PolkadotRuntimeParachainsParasParaPastCodeMeta extends Struct {
readonly upgradeTimes: Vec<PolkadotRuntimeParachainsParasReplacementTimes>; readonly upgradeTimes: Vec<PolkadotRuntimeParachainsParasReplacementTimes>;
readonly lastPruned: Option<u32>; readonly lastPruned: Option<u32>;
} }
/** @name PolkadotRuntimeParachainsParasReplacementTimes (538) */ /** @name PolkadotRuntimeParachainsParasReplacementTimes (544) */
export interface PolkadotRuntimeParachainsParasReplacementTimes extends Struct { export interface PolkadotRuntimeParachainsParasReplacementTimes extends Struct {
readonly expectedAt: u32; readonly expectedAt: u32;
readonly activatedAt: u32; readonly activatedAt: u32;
} }
/** @name PolkadotPrimitivesV1UpgradeGoAhead (540) */ /** @name PolkadotPrimitivesV1UpgradeGoAhead (546) */
export interface PolkadotPrimitivesV1UpgradeGoAhead extends Enum { export interface PolkadotPrimitivesV1UpgradeGoAhead extends Enum {
readonly isAbort: boolean; readonly isAbort: boolean;
readonly isGoAhead: boolean; readonly isGoAhead: boolean;
} }
/** @name PolkadotPrimitivesV1UpgradeRestriction (541) */ /** @name PolkadotPrimitivesV1UpgradeRestriction (547) */
export interface PolkadotPrimitivesV1UpgradeRestriction extends Enum { export interface PolkadotPrimitivesV1UpgradeRestriction extends Enum {
readonly isPresent: boolean; readonly isPresent: boolean;
} }
/** @name PolkadotRuntimeParachainsParasParaGenesisArgs (542) */ /** @name PolkadotRuntimeParachainsParasParaGenesisArgs (548) */
export interface PolkadotRuntimeParachainsParasParaGenesisArgs extends Struct { export interface PolkadotRuntimeParachainsParasParaGenesisArgs extends Struct {
readonly genesisHead: Bytes; readonly genesisHead: Bytes;
readonly validationCode: Bytes; readonly validationCode: Bytes;
readonly parachain: bool; readonly parachain: bool;
} }
/** @name PolkadotRuntimeParachainsInitializerBufferedSessionChange (545) */ /** @name PolkadotRuntimeParachainsInitializerBufferedSessionChange (551) */
export interface PolkadotRuntimeParachainsInitializerBufferedSessionChange extends Struct { export interface PolkadotRuntimeParachainsInitializerBufferedSessionChange extends Struct {
readonly validators: Vec<PolkadotPrimitivesV0ValidatorAppPublic>; readonly validators: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
readonly queued: Vec<PolkadotPrimitivesV0ValidatorAppPublic>; readonly queued: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
readonly sessionIndex: u32; readonly sessionIndex: u32;
} }
/** @name PolkadotCorePrimitivesInboundDownwardMessage (547) */ /** @name PolkadotCorePrimitivesInboundDownwardMessage (553) */
export interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct { export interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct {
readonly sentAt: u32; readonly sentAt: u32;
readonly msg: Bytes; readonly msg: Bytes;
} }
/** @name PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest (550) */ /** @name PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest (556) */
export interface PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest extends Struct { export interface PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest extends Struct {
readonly confirmed: bool; readonly confirmed: bool;
readonly age: u32; readonly age: u32;
@@ -435,7 +432,7 @@ declare module '@polkadot/types/lookup' {
readonly maxTotalSize: u32; readonly maxTotalSize: u32;
} }
/** @name PolkadotRuntimeParachainsHrmpHrmpChannel (552) */ /** @name PolkadotRuntimeParachainsHrmpHrmpChannel (558) */
export interface PolkadotRuntimeParachainsHrmpHrmpChannel extends Struct { export interface PolkadotRuntimeParachainsHrmpHrmpChannel extends Struct {
readonly maxCapacity: u32; readonly maxCapacity: u32;
readonly maxTotalSize: u32; readonly maxTotalSize: u32;
@@ -447,13 +444,13 @@ declare module '@polkadot/types/lookup' {
readonly recipientDeposit: u128; readonly recipientDeposit: u128;
} }
/** @name PolkadotCorePrimitivesInboundHrmpMessage (555) */ /** @name PolkadotCorePrimitivesInboundHrmpMessage (561) */
export interface PolkadotCorePrimitivesInboundHrmpMessage extends Struct { export interface PolkadotCorePrimitivesInboundHrmpMessage extends Struct {
readonly sentAt: u32; readonly sentAt: u32;
readonly data: Bytes; readonly data: Bytes;
} }
/** @name PolkadotPrimitivesV1SessionInfo (560) */ /** @name PolkadotPrimitivesV1SessionInfo (566) */
export interface PolkadotPrimitivesV1SessionInfo extends Struct { export interface PolkadotPrimitivesV1SessionInfo extends Struct {
readonly validators: Vec<PolkadotPrimitivesV0ValidatorAppPublic>; readonly validators: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
readonly discoveryKeys: Vec<SpAuthorityDiscoveryAppPublic>; readonly discoveryKeys: Vec<SpAuthorityDiscoveryAppPublic>;
@@ -467,14 +464,14 @@ declare module '@polkadot/types/lookup' {
readonly neededApprovals: u32; readonly neededApprovals: u32;
} }
/** @name PolkadotRuntimeCommonParasRegistrarParaInfo (562) */ /** @name PolkadotRuntimeCommonParasRegistrarParaInfo (568) */
export interface PolkadotRuntimeCommonParasRegistrarParaInfo extends Struct { export interface PolkadotRuntimeCommonParasRegistrarParaInfo extends Struct {
readonly manager: AccountId32; readonly manager: AccountId32;
readonly deposit: u128; readonly deposit: u128;
readonly locked: bool; readonly locked: bool;
} }
/** @name PolkadotRuntimeCommonCrowdloanFundInfo (572) */ /** @name PolkadotRuntimeCommonCrowdloanFundInfo (578) */
export interface PolkadotRuntimeCommonCrowdloanFundInfo extends Struct { export interface PolkadotRuntimeCommonCrowdloanFundInfo extends Struct {
readonly depositor: AccountId32; readonly depositor: AccountId32;
readonly verifier: Option<SpRuntimeMultiSigner>; readonly verifier: Option<SpRuntimeMultiSigner>;
@@ -488,7 +485,7 @@ declare module '@polkadot/types/lookup' {
readonly trieIndex: u32; readonly trieIndex: u32;
} }
/** @name PolkadotRuntimeCommonCrowdloanLastContribution (573) */ /** @name PolkadotRuntimeCommonCrowdloanLastContribution (579) */
export interface PolkadotRuntimeCommonCrowdloanLastContribution extends Enum { export interface PolkadotRuntimeCommonCrowdloanLastContribution extends Enum {
readonly isNever: boolean; readonly isNever: boolean;
readonly isPreEnding: boolean; readonly isPreEnding: boolean;
@@ -497,10 +494,10 @@ declare module '@polkadot/types/lookup' {
readonly asEnding: u32; readonly asEnding: u32;
} }
/** @name PolkadotRuntimeCommonClaimsPrevalidateAttests (585) */ /** @name PolkadotRuntimeCommonClaimsPrevalidateAttests (591) */
export type PolkadotRuntimeCommonClaimsPrevalidateAttests = Null; export type PolkadotRuntimeCommonClaimsPrevalidateAttests = Null;
/** @name PolkadotRuntimeRuntime (586) */ /** @name PolkadotRuntimeRuntime (592) */
export type PolkadotRuntimeRuntime = Null; export type PolkadotRuntimeRuntime = Null;
} }
@@ -130,13 +130,13 @@ declare module '@polkadot/types/lookup' {
readonly isDivisionByZero: boolean; readonly isDivisionByZero: boolean;
} }
/** @name FrameSupportTokensMiscBalanceStatus (31) */ /** @name FrameSupportTokensMiscBalanceStatus (33) */
export interface FrameSupportTokensMiscBalanceStatus extends Enum { export interface FrameSupportTokensMiscBalanceStatus extends Enum {
readonly isFree: boolean; readonly isFree: boolean;
readonly isReserved: boolean; readonly isReserved: boolean;
} }
/** @name PalletElectionProviderMultiPhaseElectionCompute (33) */ /** @name PalletElectionProviderMultiPhaseElectionCompute (35) */
export interface PalletElectionProviderMultiPhaseElectionCompute extends Enum { export interface PalletElectionProviderMultiPhaseElectionCompute extends Enum {
readonly isOnChain: boolean; readonly isOnChain: boolean;
readonly isSigned: boolean; readonly isSigned: boolean;
@@ -145,7 +145,7 @@ declare module '@polkadot/types/lookup' {
readonly isEmergency: boolean; readonly isEmergency: boolean;
} }
/** @name PalletDemocracyVoteThreshold (40) */ /** @name PalletDemocracyVoteThreshold (42) */
export interface PalletDemocracyVoteThreshold extends Enum { export interface PalletDemocracyVoteThreshold extends Enum {
readonly isSuperMajorityApprove: boolean; readonly isSuperMajorityApprove: boolean;
readonly isSuperMajorityAgainst: boolean; readonly isSuperMajorityAgainst: boolean;
@@ -533,33 +533,64 @@ declare module '@polkadot/types/lookup' {
readonly startingBlock: u32; readonly startingBlock: u32;
} }
/** @name PalletAssetsDestroyWitness (295) */ /** @name PalletAssetsDestroyWitness (296) */
export interface PalletAssetsDestroyWitness extends Struct { export interface PalletAssetsDestroyWitness extends Struct {
readonly accounts: Compact<u32>; readonly accounts: Compact<u32>;
readonly sufficients: Compact<u32>; readonly sufficients: Compact<u32>;
readonly approvals: Compact<u32>; readonly approvals: Compact<u32>;
} }
/** @name PalletUniquesDestroyWitness (301) */ /** @name PalletUniquesDestroyWitness (302) */
export interface PalletUniquesDestroyWitness extends Struct { export interface PalletUniquesDestroyWitness extends Struct {
readonly instances: Compact<u32>; readonly instances: Compact<u32>;
readonly instanceMetadatas: Compact<u32>; readonly instanceMetadatas: Compact<u32>;
readonly attributes: Compact<u32>; readonly attributes: Compact<u32>;
} }
/** @name SpTransactionStorageProofTransactionStorageProof (304) */ /** @name SpTransactionStorageProofTransactionStorageProof (305) */
export interface SpTransactionStorageProofTransactionStorageProof extends Struct { export interface SpTransactionStorageProofTransactionStorageProof extends Struct {
readonly chunk: Bytes; readonly chunk: Bytes;
readonly proof: Vec<Bytes>; readonly proof: Vec<Bytes>;
} }
/** @name SpConsensusBabeBabeEpochConfiguration (313) */ /** @name NodeRuntimeOriginCaller (307) */
export interface NodeRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin;
readonly isVoid: boolean;
readonly isCouncil: boolean;
readonly asCouncil: PalletCollectiveRawOrigin;
readonly isTechnicalCommittee: boolean;
readonly asTechnicalCommittee: PalletCollectiveRawOrigin;
}
/** @name FrameSystemRawOrigin (308) */
export interface FrameSystemRawOrigin extends Enum {
readonly isRoot: boolean;
readonly isSigned: boolean;
readonly asSigned: AccountId32;
readonly isNone: boolean;
}
/** @name PalletCollectiveRawOrigin (309) */
export interface PalletCollectiveRawOrigin extends Enum {
readonly isMembers: boolean;
readonly asMembers: ITuple<[u32, u32]>;
readonly isMember: boolean;
readonly asMember: AccountId32;
readonly isPhantom: boolean;
}
/** @name SpCoreVoid (311) */
export type SpCoreVoid = Null;
/** @name SpConsensusBabeBabeEpochConfiguration (319) */
export interface SpConsensusBabeBabeEpochConfiguration extends Struct { export interface SpConsensusBabeBabeEpochConfiguration extends Struct {
readonly c: ITuple<[u64, u64]>; readonly c: ITuple<[u64, u64]>;
readonly allowedSlots: SpConsensusBabeAllowedSlots; readonly allowedSlots: SpConsensusBabeAllowedSlots;
} }
/** @name PalletAuthorshipUncleEntryItem (316) */ /** @name PalletAuthorshipUncleEntryItem (322) */
export interface PalletAuthorshipUncleEntryItem extends Enum { export interface PalletAuthorshipUncleEntryItem extends Enum {
readonly isInclusionHeight: boolean; readonly isInclusionHeight: boolean;
readonly asInclusionHeight: u32; readonly asInclusionHeight: u32;
@@ -567,39 +598,39 @@ declare module '@polkadot/types/lookup' {
readonly asUncle: ITuple<[H256, Option<AccountId32>]>; readonly asUncle: ITuple<[H256, Option<AccountId32>]>;
} }
/** @name PalletBalancesBalanceLock (321) */ /** @name PalletBalancesBalanceLock (327) */
export interface PalletBalancesBalanceLock extends Struct { export interface PalletBalancesBalanceLock extends Struct {
readonly id: U8aFixed; readonly id: U8aFixed;
readonly amount: u128; readonly amount: u128;
readonly reasons: PalletBalancesReasons; readonly reasons: PalletBalancesReasons;
} }
/** @name PalletBalancesReasons (322) */ /** @name PalletBalancesReasons (328) */
export interface PalletBalancesReasons extends Enum { export interface PalletBalancesReasons extends Enum {
readonly isFee: boolean; readonly isFee: boolean;
readonly isMisc: boolean; readonly isMisc: boolean;
readonly isAll: boolean; readonly isAll: boolean;
} }
/** @name PalletBalancesReserveData (325) */ /** @name PalletBalancesReserveData (331) */
export interface PalletBalancesReserveData extends Struct { export interface PalletBalancesReserveData extends Struct {
readonly id: U8aFixed; readonly id: U8aFixed;
readonly amount: u128; readonly amount: u128;
} }
/** @name PalletBalancesReleases (327) */ /** @name PalletBalancesReleases (333) */
export interface PalletBalancesReleases extends Enum { export interface PalletBalancesReleases extends Enum {
readonly isV100: boolean; readonly isV100: boolean;
readonly isV200: boolean; readonly isV200: boolean;
} }
/** @name PalletTransactionPaymentReleases (330) */ /** @name PalletTransactionPaymentReleases (336) */
export interface PalletTransactionPaymentReleases extends Enum { export interface PalletTransactionPaymentReleases extends Enum {
readonly isV1Ancient: boolean; readonly isV1Ancient: boolean;
readonly isV2: boolean; readonly isV2: boolean;
} }
/** @name FrameSupportWeightsWeightToFeeCoefficient (332) */ /** @name FrameSupportWeightsWeightToFeeCoefficient (338) */
export interface FrameSupportWeightsWeightToFeeCoefficient extends Struct { export interface FrameSupportWeightsWeightToFeeCoefficient extends Struct {
readonly coeffInteger: u128; readonly coeffInteger: u128;
readonly coeffFrac: Perbill; readonly coeffFrac: Perbill;
@@ -607,7 +638,7 @@ declare module '@polkadot/types/lookup' {
readonly degree: u8; readonly degree: u8;
} }
/** @name PalletElectionProviderMultiPhasePhase (333) */ /** @name PalletElectionProviderMultiPhasePhase (339) */
export interface PalletElectionProviderMultiPhasePhase extends Enum { export interface PalletElectionProviderMultiPhasePhase extends Enum {
readonly isOff: boolean; readonly isOff: boolean;
readonly isSigned: boolean; readonly isSigned: boolean;
@@ -616,20 +647,20 @@ declare module '@polkadot/types/lookup' {
readonly isEmergency: boolean; readonly isEmergency: boolean;
} }
/** @name PalletElectionProviderMultiPhaseReadySolution (335) */ /** @name PalletElectionProviderMultiPhaseReadySolution (341) */
export interface PalletElectionProviderMultiPhaseReadySolution extends Struct { export interface PalletElectionProviderMultiPhaseReadySolution extends Struct {
readonly supports: Vec<ITuple<[AccountId32, SpNposElectionsSupport]>>; readonly supports: Vec<ITuple<[AccountId32, SpNposElectionsSupport]>>;
readonly score: Vec<u128>; readonly score: Vec<u128>;
readonly compute: PalletElectionProviderMultiPhaseElectionCompute; readonly compute: PalletElectionProviderMultiPhaseElectionCompute;
} }
/** @name PalletElectionProviderMultiPhaseRoundSnapshot (336) */ /** @name PalletElectionProviderMultiPhaseRoundSnapshot (342) */
export interface PalletElectionProviderMultiPhaseRoundSnapshot extends Struct { export interface PalletElectionProviderMultiPhaseRoundSnapshot extends Struct {
readonly voters: Vec<ITuple<[AccountId32, u64, Vec<AccountId32>]>>; readonly voters: Vec<ITuple<[AccountId32, u64, Vec<AccountId32>]>>;
readonly targets: Vec<AccountId32>; readonly targets: Vec<AccountId32>;
} }
/** @name PalletElectionProviderMultiPhaseSignedSignedSubmission (343) */ /** @name PalletElectionProviderMultiPhaseSignedSignedSubmission (349) */
export interface PalletElectionProviderMultiPhaseSignedSignedSubmission extends Struct { export interface PalletElectionProviderMultiPhaseSignedSignedSubmission extends Struct {
readonly who: AccountId32; readonly who: AccountId32;
readonly deposit: u128; readonly deposit: u128;
@@ -637,7 +668,7 @@ declare module '@polkadot/types/lookup' {
readonly reward: u128; readonly reward: u128;
} }
/** @name PalletStakingStakingLedger (345) */ /** @name PalletStakingStakingLedger (351) */
export interface PalletStakingStakingLedger extends Struct { export interface PalletStakingStakingLedger extends Struct {
readonly stash: AccountId32; readonly stash: AccountId32;
readonly total: Compact<u128>; readonly total: Compact<u128>;
@@ -646,32 +677,32 @@ declare module '@polkadot/types/lookup' {
readonly claimedRewards: Vec<u32>; readonly claimedRewards: Vec<u32>;
} }
/** @name PalletStakingUnlockChunk (347) */ /** @name PalletStakingUnlockChunk (353) */
export interface PalletStakingUnlockChunk extends Struct { export interface PalletStakingUnlockChunk extends Struct {
readonly value: Compact<u128>; readonly value: Compact<u128>;
readonly era: Compact<u32>; readonly era: Compact<u32>;
} }
/** @name PalletStakingNominations (348) */ /** @name PalletStakingNominations (354) */
export interface PalletStakingNominations extends Struct { export interface PalletStakingNominations extends Struct {
readonly targets: Vec<AccountId32>; readonly targets: Vec<AccountId32>;
readonly submittedIn: u32; readonly submittedIn: u32;
readonly suppressed: bool; readonly suppressed: bool;
} }
/** @name PalletStakingActiveEraInfo (349) */ /** @name PalletStakingActiveEraInfo (355) */
export interface PalletStakingActiveEraInfo extends Struct { export interface PalletStakingActiveEraInfo extends Struct {
readonly index: u32; readonly index: u32;
readonly start: Option<u64>; readonly start: Option<u64>;
} }
/** @name PalletStakingEraRewardPoints (351) */ /** @name PalletStakingEraRewardPoints (357) */
export interface PalletStakingEraRewardPoints extends Struct { export interface PalletStakingEraRewardPoints extends Struct {
readonly total: u32; readonly total: u32;
readonly individual: BTreeMap<AccountId32, u32>; readonly individual: BTreeMap<AccountId32, u32>;
} }
/** @name PalletStakingForcing (355) */ /** @name PalletStakingForcing (361) */
export interface PalletStakingForcing extends Enum { export interface PalletStakingForcing extends Enum {
readonly isNotForcing: boolean; readonly isNotForcing: boolean;
readonly isForceNew: boolean; readonly isForceNew: boolean;
@@ -679,7 +710,7 @@ declare module '@polkadot/types/lookup' {
readonly isForceAlways: boolean; readonly isForceAlways: boolean;
} }
/** @name PalletStakingUnappliedSlash (357) */ /** @name PalletStakingUnappliedSlash (363) */
export interface PalletStakingUnappliedSlash extends Struct { export interface PalletStakingUnappliedSlash extends Struct {
readonly validator: AccountId32; readonly validator: AccountId32;
readonly own: u128; readonly own: u128;
@@ -688,7 +719,7 @@ declare module '@polkadot/types/lookup' {
readonly payout: u128; readonly payout: u128;
} }
/** @name PalletStakingSlashingSlashingSpans (359) */ /** @name PalletStakingSlashingSlashingSpans (365) */
export interface PalletStakingSlashingSlashingSpans extends Struct { export interface PalletStakingSlashingSlashingSpans extends Struct {
readonly spanIndex: u32; readonly spanIndex: u32;
readonly lastStart: u32; readonly lastStart: u32;
@@ -696,13 +727,13 @@ declare module '@polkadot/types/lookup' {
readonly prior: Vec<u32>; readonly prior: Vec<u32>;
} }
/** @name PalletStakingSlashingSpanRecord (360) */ /** @name PalletStakingSlashingSpanRecord (366) */
export interface PalletStakingSlashingSpanRecord extends Struct { export interface PalletStakingSlashingSpanRecord extends Struct {
readonly slashed: u128; readonly slashed: u128;
readonly paidOut: u128; readonly paidOut: u128;
} }
/** @name PalletStakingReleases (363) */ /** @name PalletStakingReleases (369) */
export interface PalletStakingReleases extends Enum { export interface PalletStakingReleases extends Enum {
readonly isV100Ancient: boolean; readonly isV100Ancient: boolean;
readonly isV200: boolean; readonly isV200: boolean;
@@ -714,10 +745,10 @@ declare module '@polkadot/types/lookup' {
readonly isV800: boolean; readonly isV800: boolean;
} }
/** @name SpCoreCryptoKeyTypeId (368) */ /** @name SpCoreCryptoKeyTypeId (374) */
export interface SpCoreCryptoKeyTypeId extends U8aFixed {} export interface SpCoreCryptoKeyTypeId extends U8aFixed {}
/** @name PalletDemocracyPreimageStatus (373) */ /** @name PalletDemocracyPreimageStatus (379) */
export interface PalletDemocracyPreimageStatus extends Enum { export interface PalletDemocracyPreimageStatus extends Enum {
readonly isMissing: boolean; readonly isMissing: boolean;
readonly asMissing: u32; readonly asMissing: u32;
@@ -731,7 +762,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name PalletDemocracyReferendumInfo (374) */ /** @name PalletDemocracyReferendumInfo (380) */
export interface PalletDemocracyReferendumInfo extends Enum { export interface PalletDemocracyReferendumInfo extends Enum {
readonly isOngoing: boolean; readonly isOngoing: boolean;
readonly asOngoing: PalletDemocracyReferendumStatus; readonly asOngoing: PalletDemocracyReferendumStatus;
@@ -742,7 +773,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name PalletDemocracyReferendumStatus (375) */ /** @name PalletDemocracyReferendumStatus (381) */
export interface PalletDemocracyReferendumStatus extends Struct { export interface PalletDemocracyReferendumStatus extends Struct {
readonly end: u32; readonly end: u32;
readonly proposalHash: H256; readonly proposalHash: H256;
@@ -751,14 +782,14 @@ declare module '@polkadot/types/lookup' {
readonly tally: PalletDemocracyTally; readonly tally: PalletDemocracyTally;
} }
/** @name PalletDemocracyTally (376) */ /** @name PalletDemocracyTally (382) */
export interface PalletDemocracyTally extends Struct { export interface PalletDemocracyTally extends Struct {
readonly ayes: u128; readonly ayes: u128;
readonly nays: u128; readonly nays: u128;
readonly turnout: u128; readonly turnout: u128;
} }
/** @name PalletDemocracyVoteVoting (377) */ /** @name PalletDemocracyVoteVoting (383) */
export interface PalletDemocracyVoteVoting extends Enum { export interface PalletDemocracyVoteVoting extends Enum {
readonly isDirect: boolean; readonly isDirect: boolean;
readonly asDirect: { readonly asDirect: {
@@ -776,21 +807,21 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name PalletDemocracyDelegations (380) */ /** @name PalletDemocracyDelegations (386) */
export interface PalletDemocracyDelegations extends Struct { export interface PalletDemocracyDelegations extends Struct {
readonly votes: u128; readonly votes: u128;
readonly capital: u128; readonly capital: u128;
} }
/** @name PalletDemocracyVotePriorLock (381) */ /** @name PalletDemocracyVotePriorLock (387) */
export interface PalletDemocracyVotePriorLock extends ITuple<[u32, u128]> {} export interface PalletDemocracyVotePriorLock extends ITuple<[u32, u128]> {}
/** @name PalletDemocracyReleases (384) */ /** @name PalletDemocracyReleases (390) */
export interface PalletDemocracyReleases extends Enum { export interface PalletDemocracyReleases extends Enum {
readonly isV1: boolean; readonly isV1: boolean;
} }
/** @name PalletCollectiveVotes (387) */ /** @name PalletCollectiveVotes (393) */
export interface PalletCollectiveVotes extends Struct { export interface PalletCollectiveVotes extends Struct {
readonly index: u32; readonly index: u32;
readonly threshold: u32; readonly threshold: u32;
@@ -799,21 +830,21 @@ declare module '@polkadot/types/lookup' {
readonly end: u32; readonly end: u32;
} }
/** @name PalletElectionsPhragmenSeatHolder (392) */ /** @name PalletElectionsPhragmenSeatHolder (398) */
export interface PalletElectionsPhragmenSeatHolder extends Struct { export interface PalletElectionsPhragmenSeatHolder extends Struct {
readonly who: AccountId32; readonly who: AccountId32;
readonly stake: u128; readonly stake: u128;
readonly deposit: u128; readonly deposit: u128;
} }
/** @name PalletElectionsPhragmenVoter (393) */ /** @name PalletElectionsPhragmenVoter (399) */
export interface PalletElectionsPhragmenVoter extends Struct { export interface PalletElectionsPhragmenVoter extends Struct {
readonly votes: Vec<AccountId32>; readonly votes: Vec<AccountId32>;
readonly stake: u128; readonly stake: u128;
readonly deposit: u128; readonly deposit: u128;
} }
/** @name PalletGrandpaStoredState (396) */ /** @name PalletGrandpaStoredState (402) */
export interface PalletGrandpaStoredState extends Enum { export interface PalletGrandpaStoredState extends Enum {
readonly isLive: boolean; readonly isLive: boolean;
readonly isPendingPause: boolean; readonly isPendingPause: boolean;
@@ -829,7 +860,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name PalletGrandpaStoredPendingChange (397) */ /** @name PalletGrandpaStoredPendingChange (403) */
export interface PalletGrandpaStoredPendingChange extends Struct { export interface PalletGrandpaStoredPendingChange extends Struct {
readonly scheduledAt: u32; readonly scheduledAt: u32;
readonly delay: u32; readonly delay: u32;
@@ -837,7 +868,7 @@ declare module '@polkadot/types/lookup' {
readonly forced: Option<u32>; readonly forced: Option<u32>;
} }
/** @name PalletTreasuryProposal (400) */ /** @name PalletTreasuryProposal (406) */
export interface PalletTreasuryProposal extends Struct { export interface PalletTreasuryProposal extends Struct {
readonly proposer: AccountId32; readonly proposer: AccountId32;
readonly value: u128; readonly value: u128;
@@ -845,10 +876,10 @@ declare module '@polkadot/types/lookup' {
readonly bond: u128; readonly bond: u128;
} }
/** @name FrameSupportPalletId (403) */ /** @name FrameSupportPalletId (409) */
export interface FrameSupportPalletId extends U8aFixed {} export interface FrameSupportPalletId extends U8aFixed {}
/** @name PalletContractsWasmPrefabWasmModule (405) */ /** @name PalletContractsWasmPrefabWasmModule (411) */
export interface PalletContractsWasmPrefabWasmModule extends Struct { export interface PalletContractsWasmPrefabWasmModule extends Struct {
readonly instructionWeightsVersion: Compact<u32>; readonly instructionWeightsVersion: Compact<u32>;
readonly initial: Compact<u32>; readonly initial: Compact<u32>;
@@ -859,26 +890,26 @@ declare module '@polkadot/types/lookup' {
readonly originalCodeLen: u32; readonly originalCodeLen: u32;
} }
/** @name PalletContractsStorageRawContractInfo (407) */ /** @name PalletContractsStorageRawContractInfo (413) */
export interface PalletContractsStorageRawContractInfo extends Struct { export interface PalletContractsStorageRawContractInfo extends Struct {
readonly trieId: Bytes; readonly trieId: Bytes;
readonly codeHash: H256; readonly codeHash: H256;
readonly reserved: Option<Null>; readonly reserved: Option<Null>;
} }
/** @name PalletContractsStorageDeletedContract (409) */ /** @name PalletContractsStorageDeletedContract (415) */
export interface PalletContractsStorageDeletedContract extends Struct { export interface PalletContractsStorageDeletedContract extends Struct {
readonly trieId: Bytes; readonly trieId: Bytes;
} }
/** @name PalletContractsSchedule (410) */ /** @name PalletContractsSchedule (416) */
export interface PalletContractsSchedule extends Struct { export interface PalletContractsSchedule extends Struct {
readonly limits: PalletContractsScheduleLimits; readonly limits: PalletContractsScheduleLimits;
readonly instructionWeights: PalletContractsScheduleInstructionWeights; readonly instructionWeights: PalletContractsScheduleInstructionWeights;
readonly hostFnWeights: PalletContractsScheduleHostFnWeights; readonly hostFnWeights: PalletContractsScheduleHostFnWeights;
} }
/** @name PalletContractsScheduleLimits (411) */ /** @name PalletContractsScheduleLimits (417) */
export interface PalletContractsScheduleLimits extends Struct { export interface PalletContractsScheduleLimits extends Struct {
readonly eventTopics: u32; readonly eventTopics: u32;
readonly stackHeight: u32; readonly stackHeight: u32;
@@ -893,7 +924,7 @@ declare module '@polkadot/types/lookup' {
readonly codeLen: u32; readonly codeLen: u32;
} }
/** @name PalletContractsScheduleInstructionWeights (412) */ /** @name PalletContractsScheduleInstructionWeights (418) */
export interface PalletContractsScheduleInstructionWeights extends Struct { export interface PalletContractsScheduleInstructionWeights extends Struct {
readonly version: u32; readonly version: u32;
readonly i64Const: u32; readonly i64Const: u32;
@@ -949,7 +980,7 @@ declare module '@polkadot/types/lookup' {
readonly i64Rotr: u32; readonly i64Rotr: u32;
} }
/** @name PalletContractsScheduleHostFnWeights (413) */ /** @name PalletContractsScheduleHostFnWeights (419) */
export interface PalletContractsScheduleHostFnWeights extends Struct { export interface PalletContractsScheduleHostFnWeights extends Struct {
readonly caller: u64; readonly caller: u64;
readonly address: u64; readonly address: u64;
@@ -997,40 +1028,40 @@ declare module '@polkadot/types/lookup' {
readonly ecdsaRecover: u64; readonly ecdsaRecover: u64;
} }
/** @name PalletImOnlineBoundedOpaqueNetworkState (419) */ /** @name PalletImOnlineBoundedOpaqueNetworkState (425) */
export interface PalletImOnlineBoundedOpaqueNetworkState extends Struct { export interface PalletImOnlineBoundedOpaqueNetworkState extends Struct {
readonly peerId: Bytes; readonly peerId: Bytes;
readonly externalAddresses: Vec<Bytes>; readonly externalAddresses: Vec<Bytes>;
} }
/** @name SpStakingOffenceOffenceDetails (424) */ /** @name SpStakingOffenceOffenceDetails (432) */
export interface SpStakingOffenceOffenceDetails extends Struct { export interface SpStakingOffenceOffenceDetails extends Struct {
readonly offender: ITuple<[AccountId32, PalletStakingExposure]>; readonly offender: ITuple<[AccountId32, PalletStakingExposure]>;
readonly reporters: Vec<AccountId32>; readonly reporters: Vec<AccountId32>;
} }
/** @name PalletIdentityRegistration (426) */ /** @name PalletIdentityRegistration (434) */
export interface PalletIdentityRegistration extends Struct { export interface PalletIdentityRegistration extends Struct {
readonly judgements: Vec<ITuple<[u32, PalletIdentityJudgement]>>; readonly judgements: Vec<ITuple<[u32, PalletIdentityJudgement]>>;
readonly deposit: u128; readonly deposit: u128;
readonly info: PalletIdentityIdentityInfo; readonly info: PalletIdentityIdentityInfo;
} }
/** @name PalletIdentityRegistrarInfo (434) */ /** @name PalletIdentityRegistrarInfo (442) */
export interface PalletIdentityRegistrarInfo extends Struct { export interface PalletIdentityRegistrarInfo extends Struct {
readonly account: AccountId32; readonly account: AccountId32;
readonly fee: u128; readonly fee: u128;
readonly fields: PalletIdentityBitFlags; readonly fields: PalletIdentityBitFlags;
} }
/** @name PalletSocietyBid (438) */ /** @name PalletSocietyBid (446) */
export interface PalletSocietyBid extends Struct { export interface PalletSocietyBid extends Struct {
readonly who: AccountId32; readonly who: AccountId32;
readonly kind: PalletSocietyBidKind; readonly kind: PalletSocietyBidKind;
readonly value: u128; readonly value: u128;
} }
/** @name PalletSocietyBidKind (439) */ /** @name PalletSocietyBidKind (447) */
export interface PalletSocietyBidKind extends Enum { export interface PalletSocietyBidKind extends Enum {
readonly isDeposit: boolean; readonly isDeposit: boolean;
readonly asDeposit: u128; readonly asDeposit: u128;
@@ -1038,20 +1069,20 @@ declare module '@polkadot/types/lookup' {
readonly asVouch: ITuple<[AccountId32, u128]>; readonly asVouch: ITuple<[AccountId32, u128]>;
} }
/** @name PalletSocietyVouchingStatus (441) */ /** @name PalletSocietyVouchingStatus (449) */
export interface PalletSocietyVouchingStatus extends Enum { export interface PalletSocietyVouchingStatus extends Enum {
readonly isVouching: boolean; readonly isVouching: boolean;
readonly isBanned: boolean; readonly isBanned: boolean;
} }
/** @name PalletSocietyVote (445) */ /** @name PalletSocietyVote (453) */
export interface PalletSocietyVote extends Enum { export interface PalletSocietyVote extends Enum {
readonly isSkeptic: boolean; readonly isSkeptic: boolean;
readonly isReject: boolean; readonly isReject: boolean;
readonly isApprove: boolean; readonly isApprove: boolean;
} }
/** @name PalletRecoveryRecoveryConfig (447) */ /** @name PalletRecoveryRecoveryConfig (455) */
export interface PalletRecoveryRecoveryConfig extends Struct { export interface PalletRecoveryRecoveryConfig extends Struct {
readonly delayPeriod: u32; readonly delayPeriod: u32;
readonly deposit: u128; readonly deposit: u128;
@@ -1059,20 +1090,20 @@ declare module '@polkadot/types/lookup' {
readonly threshold: u16; readonly threshold: u16;
} }
/** @name PalletRecoveryActiveRecovery (448) */ /** @name PalletRecoveryActiveRecovery (456) */
export interface PalletRecoveryActiveRecovery extends Struct { export interface PalletRecoveryActiveRecovery extends Struct {
readonly created: u32; readonly created: u32;
readonly deposit: u128; readonly deposit: u128;
readonly friends: Vec<AccountId32>; readonly friends: Vec<AccountId32>;
} }
/** @name PalletVestingReleases (452) */ /** @name PalletVestingReleases (460) */
export interface PalletVestingReleases extends Enum { export interface PalletVestingReleases extends Enum {
readonly isV0: boolean; readonly isV0: boolean;
readonly isV1: boolean; readonly isV1: boolean;
} }
/** @name PalletSchedulerScheduledV2 (456) */ /** @name PalletSchedulerScheduledV2 (464) */
export interface PalletSchedulerScheduledV2 extends Struct { export interface PalletSchedulerScheduledV2 extends Struct {
readonly maybeId: Option<Bytes>; readonly maybeId: Option<Bytes>;
readonly priority: u8; readonly priority: u8;
@@ -1081,58 +1112,27 @@ declare module '@polkadot/types/lookup' {
readonly origin: NodeRuntimeOriginCaller; readonly origin: NodeRuntimeOriginCaller;
} }
/** @name NodeRuntimeOriginCaller (457) */ /** @name PalletSchedulerReleases (465) */
export interface NodeRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin;
readonly isVoid: boolean;
readonly isCouncil: boolean;
readonly asCouncil: PalletCollectiveRawOrigin;
readonly isTechnicalCommittee: boolean;
readonly asTechnicalCommittee: PalletCollectiveRawOrigin;
}
/** @name FrameSystemRawOrigin (458) */
export interface FrameSystemRawOrigin extends Enum {
readonly isRoot: boolean;
readonly isSigned: boolean;
readonly asSigned: AccountId32;
readonly isNone: boolean;
}
/** @name PalletCollectiveRawOrigin (459) */
export interface PalletCollectiveRawOrigin extends Enum {
readonly isMembers: boolean;
readonly asMembers: ITuple<[u32, u32]>;
readonly isMember: boolean;
readonly asMember: AccountId32;
readonly isPhantom: boolean;
}
/** @name SpCoreVoid (461) */
export type SpCoreVoid = Null;
/** @name PalletSchedulerReleases (462) */
export interface PalletSchedulerReleases extends Enum { export interface PalletSchedulerReleases extends Enum {
readonly isV1: boolean; readonly isV1: boolean;
readonly isV2: boolean; readonly isV2: boolean;
} }
/** @name PalletProxyProxyDefinition (466) */ /** @name PalletProxyProxyDefinition (469) */
export interface PalletProxyProxyDefinition extends Struct { export interface PalletProxyProxyDefinition extends Struct {
readonly delegate: AccountId32; readonly delegate: AccountId32;
readonly proxyType: NodeRuntimeProxyType; readonly proxyType: NodeRuntimeProxyType;
readonly delay: u32; readonly delay: u32;
} }
/** @name PalletProxyAnnouncement (470) */ /** @name PalletProxyAnnouncement (473) */
export interface PalletProxyAnnouncement extends Struct { export interface PalletProxyAnnouncement extends Struct {
readonly real: AccountId32; readonly real: AccountId32;
readonly callHash: H256; readonly callHash: H256;
readonly height: u32; readonly height: u32;
} }
/** @name PalletMultisigMultisig (474) */ /** @name PalletMultisigMultisig (477) */
export interface PalletMultisigMultisig extends Struct { export interface PalletMultisigMultisig extends Struct {
readonly when: PalletMultisigTimepoint; readonly when: PalletMultisigTimepoint;
readonly deposit: u128; readonly deposit: u128;
@@ -1140,7 +1140,7 @@ declare module '@polkadot/types/lookup' {
readonly approvals: Vec<AccountId32>; readonly approvals: Vec<AccountId32>;
} }
/** @name PalletBountiesBounty (477) */ /** @name PalletBountiesBounty (480) */
export interface PalletBountiesBounty extends Struct { export interface PalletBountiesBounty extends Struct {
readonly proposer: AccountId32; readonly proposer: AccountId32;
readonly value: u128; readonly value: u128;
@@ -1150,7 +1150,7 @@ declare module '@polkadot/types/lookup' {
readonly status: PalletBountiesBountyStatus; readonly status: PalletBountiesBountyStatus;
} }
/** @name PalletBountiesBountyStatus (478) */ /** @name PalletBountiesBountyStatus (481) */
export interface PalletBountiesBountyStatus extends Enum { export interface PalletBountiesBountyStatus extends Enum {
readonly isProposed: boolean; readonly isProposed: boolean;
readonly isApproved: boolean; readonly isApproved: boolean;
@@ -1172,7 +1172,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name PalletTipsOpenTip (480) */ /** @name PalletTipsOpenTip (483) */
export interface PalletTipsOpenTip extends Struct { export interface PalletTipsOpenTip extends Struct {
readonly reason: H256; readonly reason: H256;
readonly who: AccountId32; readonly who: AccountId32;
@@ -1183,7 +1183,7 @@ declare module '@polkadot/types/lookup' {
readonly findersFee: bool; readonly findersFee: bool;
} }
/** @name PalletAssetsAssetDetails (482) */ /** @name PalletAssetsAssetDetails (485) */
export interface PalletAssetsAssetDetails extends Struct { export interface PalletAssetsAssetDetails extends Struct {
readonly owner: AccountId32; readonly owner: AccountId32;
readonly issuer: AccountId32; readonly issuer: AccountId32;
@@ -1199,7 +1199,7 @@ declare module '@polkadot/types/lookup' {
readonly isFrozen: bool; readonly isFrozen: bool;
} }
/** @name PalletAssetsAssetBalance (483) */ /** @name PalletAssetsAssetBalance (486) */
export interface PalletAssetsAssetBalance extends Struct { export interface PalletAssetsAssetBalance extends Struct {
readonly balance: u64; readonly balance: u64;
readonly isFrozen: bool; readonly isFrozen: bool;
@@ -1207,13 +1207,13 @@ declare module '@polkadot/types/lookup' {
readonly extra: Null; readonly extra: Null;
} }
/** @name PalletAssetsApproval (485) */ /** @name PalletAssetsApproval (488) */
export interface PalletAssetsApproval extends Struct { export interface PalletAssetsApproval extends Struct {
readonly amount: u64; readonly amount: u64;
readonly deposit: u128; readonly deposit: u128;
} }
/** @name PalletAssetsAssetMetadata (486) */ /** @name PalletAssetsAssetMetadata (489) */
export interface PalletAssetsAssetMetadata extends Struct { export interface PalletAssetsAssetMetadata extends Struct {
readonly deposit: u128; readonly deposit: u128;
readonly name: Bytes; readonly name: Bytes;
@@ -1222,7 +1222,7 @@ declare module '@polkadot/types/lookup' {
readonly isFrozen: bool; readonly isFrozen: bool;
} }
/** @name PalletLotteryLotteryConfig (488) */ /** @name PalletLotteryLotteryConfig (491) */
export interface PalletLotteryLotteryConfig extends Struct { export interface PalletLotteryLotteryConfig extends Struct {
readonly price: u128; readonly price: u128;
readonly start: u32; readonly start: u32;
@@ -1231,13 +1231,13 @@ declare module '@polkadot/types/lookup' {
readonly repeat: bool; readonly repeat: bool;
} }
/** @name PalletGiltGiltBid (493) */ /** @name PalletGiltGiltBid (496) */
export interface PalletGiltGiltBid extends Struct { export interface PalletGiltGiltBid extends Struct {
readonly amount: u128; readonly amount: u128;
readonly who: AccountId32; readonly who: AccountId32;
} }
/** @name PalletGiltActiveGiltsTotal (494) */ /** @name PalletGiltActiveGiltsTotal (497) */
export interface PalletGiltActiveGiltsTotal extends Struct { export interface PalletGiltActiveGiltsTotal extends Struct {
readonly frozen: u128; readonly frozen: u128;
readonly proportion: Perquintill; readonly proportion: Perquintill;
@@ -1245,7 +1245,7 @@ declare module '@polkadot/types/lookup' {
readonly target: Perquintill; readonly target: Perquintill;
} }
/** @name PalletGiltActiveGilt (495) */ /** @name PalletGiltActiveGilt (498) */
export interface PalletGiltActiveGilt extends Struct { export interface PalletGiltActiveGilt extends Struct {
readonly proportion: Perquintill; readonly proportion: Perquintill;
readonly amount: u128; readonly amount: u128;
@@ -1253,7 +1253,7 @@ declare module '@polkadot/types/lookup' {
readonly expiry: u32; readonly expiry: u32;
} }
/** @name PalletUniquesClassDetails (497) */ /** @name PalletUniquesClassDetails (500) */
export interface PalletUniquesClassDetails extends Struct { export interface PalletUniquesClassDetails extends Struct {
readonly owner: AccountId32; readonly owner: AccountId32;
readonly issuer: AccountId32; readonly issuer: AccountId32;
@@ -1267,7 +1267,7 @@ declare module '@polkadot/types/lookup' {
readonly isFrozen: bool; readonly isFrozen: bool;
} }
/** @name PalletUniquesInstanceDetails (499) */ /** @name PalletUniquesInstanceDetails (502) */
export interface PalletUniquesInstanceDetails extends Struct { export interface PalletUniquesInstanceDetails extends Struct {
readonly owner: AccountId32; readonly owner: AccountId32;
readonly approved: Option<AccountId32>; readonly approved: Option<AccountId32>;
@@ -1275,21 +1275,21 @@ declare module '@polkadot/types/lookup' {
readonly deposit: u128; readonly deposit: u128;
} }
/** @name PalletUniquesClassMetadata (500) */ /** @name PalletUniquesClassMetadata (503) */
export interface PalletUniquesClassMetadata extends Struct { export interface PalletUniquesClassMetadata extends Struct {
readonly deposit: u128; readonly deposit: u128;
readonly data: Bytes; readonly data: Bytes;
readonly isFrozen: bool; readonly isFrozen: bool;
} }
/** @name PalletUniquesInstanceMetadata (501) */ /** @name PalletUniquesInstanceMetadata (504) */
export interface PalletUniquesInstanceMetadata extends Struct { export interface PalletUniquesInstanceMetadata extends Struct {
readonly deposit: u128; readonly deposit: u128;
readonly data: Bytes; readonly data: Bytes;
readonly isFrozen: bool; readonly isFrozen: bool;
} }
/** @name PalletTransactionStorageTransactionInfo (506) */ /** @name PalletTransactionStorageTransactionInfo (509) */
export interface PalletTransactionStorageTransactionInfo extends Struct { export interface PalletTransactionStorageTransactionInfo extends Struct {
readonly chunkRoot: H256; readonly chunkRoot: H256;
readonly contentHash: H256; readonly contentHash: H256;
@@ -1297,7 +1297,7 @@ declare module '@polkadot/types/lookup' {
readonly blockChunks: u32; readonly blockChunks: u32;
} }
/** @name PalletBagsListListNode (508) */ /** @name PalletBagsListListNode (511) */
export interface PalletBagsListListNode extends Struct { export interface PalletBagsListListNode extends Struct {
readonly id: AccountId32; readonly id: AccountId32;
readonly prev: Option<AccountId32>; readonly prev: Option<AccountId32>;
@@ -1305,13 +1305,13 @@ declare module '@polkadot/types/lookup' {
readonly bagUpper: u64; readonly bagUpper: u64;
} }
/** @name PalletBagsListListBag (509) */ /** @name PalletBagsListListBag (512) */
export interface PalletBagsListListBag extends Struct { export interface PalletBagsListListBag extends Struct {
readonly head: Option<AccountId32>; readonly head: Option<AccountId32>;
readonly tail: Option<AccountId32>; readonly tail: Option<AccountId32>;
} }
/** @name SpRuntimeMultiSignature (512) */ /** @name SpRuntimeMultiSignature (515) */
export interface SpRuntimeMultiSignature extends Enum { export interface SpRuntimeMultiSignature extends Enum {
readonly isEd25519: boolean; readonly isEd25519: boolean;
readonly asEd25519: SpCoreEd25519Signature; readonly asEd25519: SpCoreEd25519Signature;
@@ -1321,28 +1321,28 @@ declare module '@polkadot/types/lookup' {
readonly asEcdsa: SpCoreEcdsaSignature; readonly asEcdsa: SpCoreEcdsaSignature;
} }
/** @name SpCoreEcdsaSignature (513) */ /** @name SpCoreEcdsaSignature (516) */
export interface SpCoreEcdsaSignature extends U8aFixed {} export interface SpCoreEcdsaSignature extends U8aFixed {}
/** @name FrameSystemExtensionsCheckSpecVersion (516) */ /** @name FrameSystemExtensionsCheckSpecVersion (519) */
export type FrameSystemExtensionsCheckSpecVersion = Null; export type FrameSystemExtensionsCheckSpecVersion = Null;
/** @name FrameSystemExtensionsCheckTxVersion (517) */ /** @name FrameSystemExtensionsCheckTxVersion (520) */
export type FrameSystemExtensionsCheckTxVersion = Null; export type FrameSystemExtensionsCheckTxVersion = Null;
/** @name FrameSystemExtensionsCheckGenesis (518) */ /** @name FrameSystemExtensionsCheckGenesis (521) */
export type FrameSystemExtensionsCheckGenesis = Null; export type FrameSystemExtensionsCheckGenesis = Null;
/** @name FrameSystemExtensionsCheckNonce (521) */ /** @name FrameSystemExtensionsCheckNonce (524) */
export interface FrameSystemExtensionsCheckNonce extends Compact<u32> {} export interface FrameSystemExtensionsCheckNonce extends Compact<u32> {}
/** @name FrameSystemExtensionsCheckWeight (522) */ /** @name FrameSystemExtensionsCheckWeight (525) */
export type FrameSystemExtensionsCheckWeight = Null; export type FrameSystemExtensionsCheckWeight = Null;
/** @name PalletTransactionPaymentChargeTransactionPayment (523) */ /** @name PalletTransactionPaymentChargeTransactionPayment (526) */
export interface PalletTransactionPaymentChargeTransactionPayment extends Compact<u128> {} export interface PalletTransactionPaymentChargeTransactionPayment extends Compact<u128> {}
/** @name NodeRuntimeRuntime (524) */ /** @name NodeRuntimeRuntime (527) */
export type NodeRuntimeRuntime = Null; export type NodeRuntimeRuntime = Null;
} }
+5 -6
View File
@@ -13,7 +13,7 @@ import type { BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, Bee
import type { BridgeMessageId, BridgedBlockHash, BridgedBlockNumber, BridgedHeader, CallOrigin, ChainId, DeliveredMessages, DispatchFeePayment, InboundLaneData, InboundRelayer, InitializationData, LaneId, MessageData, MessageKey, MessageNonce, MessagesDeliveryProofOf, MessagesProofOf, OperatingMode, OutboundLaneData, OutboundMessageFee, OutboundPayload, Parameter, RelayerId, UnrewardedRelayer, UnrewardedRelayersState } from '@polkadot/types/interfaces/bridges'; import type { BridgeMessageId, BridgedBlockHash, BridgedBlockNumber, BridgedHeader, CallOrigin, ChainId, DeliveredMessages, DispatchFeePayment, InboundLaneData, InboundRelayer, InitializationData, LaneId, MessageData, MessageKey, MessageNonce, MessagesDeliveryProofOf, MessagesProofOf, OperatingMode, OutboundLaneData, OutboundMessageFee, OutboundPayload, Parameter, RelayerId, UnrewardedRelayer, UnrewardedRelayersState } from '@polkadot/types/interfaces/bridges';
import type { BlockHash } from '@polkadot/types/interfaces/chain'; import type { BlockHash } from '@polkadot/types/interfaces/chain';
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate'; import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
import type { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims'; import type { StatementKind } from '@polkadot/types/interfaces/claims';
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective'; import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus'; import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts'; import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
@@ -23,7 +23,7 @@ import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData
import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy'; import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections'; import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine'; import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
import type { BlockV0, BlockV1, BlockV2, EIP1559Transaction, EIP2930Transaction, EthAccessList, EthAccessListItem, EthAccount, EthAddress, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature, LegacyTransaction, TransactionV0, TransactionV1, TransactionV2 } from '@polkadot/types/interfaces/eth'; import type { BlockV0, BlockV1, BlockV2, EIP1559Transaction, EIP2930Transaction, EthAccessList, EthAccessListItem, EthAccount, EthAddress, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumAddress, EthereumLookupSource, EthereumSignature, LegacyTransaction, TransactionV0, TransactionV1, TransactionV2 } from '@polkadot/types/interfaces/eth';
import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } from '@polkadot/types/interfaces/evm'; import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } from '@polkadot/types/interfaces/evm';
import type { AnySignature, EcdsaSignature, Ed25519Signature, Era, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics'; import type { AnySignature, EcdsaSignature, Ed25519Signature, Era, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset'; import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset';
@@ -32,7 +32,7 @@ import type { AuthorityIndex, AuthorityList, AuthoritySet, AuthoritySetChange, A
import type { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityInfoTo198, IdentityJudgement, RegistrarIndex, RegistrarInfo, Registration, RegistrationJudgement, RegistrationTo198 } from '@polkadot/types/interfaces/identity'; import type { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityInfoTo198, IdentityJudgement, RegistrarIndex, RegistrarInfo, Registration, RegistrationJudgement, RegistrationTo198 } from '@polkadot/types/interfaces/identity';
import type { AuthIndex, AuthoritySignature, Heartbeat, HeartbeatTo244, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline'; import type { AuthIndex, AuthoritySignature, Heartbeat, HeartbeatTo244, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline';
import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lottery'; import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lottery';
import type { ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV13, ErrorMetadataV14, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV14, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, ExtrinsicMetadataV14, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV14, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV14, FunctionMetadataV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV13, MetadataV14, MetadataV9, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV13, ModuleConstantMetadataV9, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV13, ModuleMetadataV9, PalletCallMetadataLatest, PalletCallMetadataV14, PalletConstantMetadataLatest, PalletConstantMetadataV14, PalletErrorMetadataLatest, PalletErrorMetadataV14, PalletEventMetadataLatest, PalletEventMetadataV14, PalletMetadataLatest, PalletMetadataV14, PalletStorageMetadataLatest, PalletStorageMetadataV14, PortableRegistry, PortableRegistryV14, PortableType, PortableTypeV14, SignedExtensionMetadataLatest, SignedExtensionMetadataV14, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV13, StorageEntryMetadataV14, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV13, StorageEntryModifierV14, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV13, StorageEntryTypeV14, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV13, StorageHasherV14, StorageHasherV9, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV13, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata'; import type { ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV13, ErrorMetadataV14, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV14, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, ExtrinsicMetadataV14, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV14, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV14, FunctionMetadataV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV13, MetadataV14, MetadataV9, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV13, ModuleConstantMetadataV9, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV13, ModuleMetadataV9, PalletCallMetadataLatest, PalletCallMetadataV14, PalletConstantMetadataLatest, PalletConstantMetadataV14, PalletErrorMetadataLatest, PalletErrorMetadataV14, PalletEventMetadataLatest, PalletEventMetadataV14, PalletMetadataLatest, PalletMetadataV14, PalletStorageMetadataLatest, PalletStorageMetadataV14, PortableType, PortableTypeV14, SignedExtensionMetadataLatest, SignedExtensionMetadataV14, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV13, StorageEntryMetadataV14, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV13, StorageEntryModifierV14, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV13, StorageEntryTypeV14, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV13, StorageHasherV14, StorageHasherV9, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV13, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr'; import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
import type { StorageKind } from '@polkadot/types/interfaces/offchain'; import type { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences'; import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
@@ -43,7 +43,7 @@ import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/ty
import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase'; import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery'; import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc'; import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, AccountId20, AccountId32, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionInfo, TransactionPriority, TransactionStorageProof, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime'; import type { AccountId, AccountId20, AccountId32, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, CrateVersion, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionInfo, TransactionPriority, TransactionStorageProof, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDefArray, Si0TypeDefBitSequence, Si0TypeDefCompact, Si0TypeDefComposite, Si0TypeDefPhantom, Si0TypeDefPrimitive, Si0TypeDefSequence, Si0TypeDefTuple, Si0TypeDefVariant, Si0TypeParameter, Si0Variant, Si1Field, Si1LookupTypeId, Si1Path, Si1Type, Si1TypeDef, Si1TypeDefArray, Si1TypeDefBitSequence, Si1TypeDefCompact, Si1TypeDefComposite, Si1TypeDefPrimitive, Si1TypeDefSequence, Si1TypeDefTuple, Si1TypeDefVariant, Si1TypeParameter, Si1Variant, SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '@polkadot/types/interfaces/scaleInfo'; import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDefArray, Si0TypeDefBitSequence, Si0TypeDefCompact, Si0TypeDefComposite, Si0TypeDefPhantom, Si0TypeDefPrimitive, Si0TypeDefSequence, Si0TypeDefTuple, Si0TypeDefVariant, Si0TypeParameter, Si0Variant, Si1Field, Si1LookupTypeId, Si1Path, Si1Type, Si1TypeDef, Si1TypeDefArray, Si1TypeDefBitSequence, Si1TypeDefCompact, Si1TypeDefComposite, Si1TypeDefPrimitive, Si1TypeDefSequence, Si1TypeDefTuple, Si1TypeDefVariant, Si1TypeParameter, Si1Variant, SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler'; import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session'; import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session';
@@ -259,6 +259,7 @@ declare module '@polkadot/types/types/registry' {
CoreAssignment: CoreAssignment; CoreAssignment: CoreAssignment;
CoreIndex: CoreIndex; CoreIndex: CoreIndex;
CoreOccupied: CoreOccupied; CoreOccupied: CoreOccupied;
CrateVersion: CrateVersion;
CreatedBlock: CreatedBlock; CreatedBlock: CreatedBlock;
Data: Data; Data: Data;
DeferredOffenceOf: DeferredOffenceOf; DeferredOffenceOf: DeferredOffenceOf;
@@ -697,8 +698,6 @@ declare module '@polkadot/types/types/registry' {
Phase: Phase; Phase: Phase;
PhragmenScore: PhragmenScore; PhragmenScore: PhragmenScore;
Points: Points; Points: Points;
PortableRegistry: PortableRegistry;
PortableRegistryV14: PortableRegistryV14;
PortableType: PortableType; PortableType: PortableType;
PortableTypeV14: PortableTypeV14; PortableTypeV14: PortableTypeV14;
Precommits: Precommits; Precommits: Precommits;
+1
View File
@@ -10,6 +10,7 @@ export * from './index.types';
export * from './metadata'; export * from './metadata';
export { TypeDefInfo } from './create/types'; export { TypeDefInfo } from './create/types';
export { convertSiV0toV1 } from './metadata/PortableRegistry';
export { packageInfo } from './packageInfo'; export { packageInfo } from './packageInfo';
export { unwrapStorageType } from './primitive/StorageKey'; export { unwrapStorageType } from './primitive/StorageKey';
+41 -17
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyJson, Codec, IVec, Registry } from '../types'; import type { AnyJson, Codec, IVec, Registry } from '../types';
@@ -20,21 +21,33 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
public createdAtHash?: Hash; public createdAtHash?: Hash;
protected constructor (registry: Registry, values: T[]) { readonly initialU8aLength?: number;
protected constructor (registry: Registry, values: T[], initialU8aLength?: number) {
super(values.length); super(values.length);
// explicitly set the values here - this removes the need for any extra allocations
for (let i = 0; i < values.length; i++) { for (let i = 0; i < values.length; i++) {
this[i] = values[i]; this[i] = values[i];
} }
this.registry = registry; this.registry = registry;
this.initialU8aLength = initialU8aLength;
} }
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public get encodedLength (): number {
return this.reduce((total, entry) => total + entry.encodedLength, compactToU8a(this.length).length); // We need to loop through all entries since they may have a variable length themselves,
// e.g. when a Vec or Compact is contained withing, it has a variable length based on data
let total = compactToU8a(this.length).length;
for (let i = 0; i < this.length; i++) {
total += this[i].encodedLength;
}
return total;
} }
/** /**
@@ -76,7 +89,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (): string { public toHex (): HexString {
return u8aToHex(this.toU8a()); return u8aToHex(this.toU8a());
} }
@@ -84,18 +97,26 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (isExtended?: boolean): AnyJson { public toHuman (isExtended?: boolean): AnyJson {
return this.map((entry): AnyJson => const result = new Array<AnyJson>(this.length);
entry.toHuman(isExtended)
); for (let i = 0; i < this.length; i++) {
result[i] = this[i].toHuman(isExtended);
}
return result;
} }
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @description Converts the Object to JSON, typically used for RPC transfers
*/ */
public toJSON (): AnyJson { public toJSON (): AnyJson {
return this.map((entry): AnyJson => const result = new Array<AnyJson>(this.length);
entry.toJSON()
); for (let i = 0; i < this.length; i++) {
result[i] = this[i].toJSON();
}
return result;
} }
/** /**
@@ -107,12 +128,13 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public override toString (): string { public override toString (): string {
// Overwrite the default toString representation of Array. const result = new Array<string>(this.length);
const data = this.map((entry): string =>
entry.toString()
);
return `[${data.join(', ')}]`; for (let i = 0; i < this.length; i++) {
result[i] = this[i].toString();
}
return `[${result.join(', ')}]`;
} }
/** /**
@@ -120,9 +142,11 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
* @param isBare true when the value has none of the type-specific prefixes (internal) * @param isBare true when the value has none of the type-specific prefixes (internal)
*/ */
public toU8a (isBare?: boolean): Uint8Array { public toU8a (isBare?: boolean): Uint8Array {
const encoded = this.map((entry): Uint8Array => const encoded = new Array<Uint8Array>(this.length);
entry.toU8a(isBare)
); for (let i = 0; i < this.length; i++) {
encoded[i] = this[i].toU8a(isBare);
}
return isBare return isBare
? u8aConcat(...encoded) ? u8aConcat(...encoded)
+20 -28
View File
@@ -1,11 +1,12 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyNumber, INumber, Registry } from '../types'; import type { AnyNumber, INumber, Registry } from '../types';
import type { UIntBitLength } from './types'; import type { UIntBitLength } from './types';
import { assert, BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isHex, isString, isU8a, stringify, u8aToBn } from '@polkadot/util'; import { assert, BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBn, isHex, isU8a, stringify, u8aToBn } from '@polkadot/util';
export const DEFAULT_UINT_BITS = 64; export const DEFAULT_UINT_BITS = 64;
@@ -25,31 +26,26 @@ function toPercentage (value: BN, divisor: BN): string {
return `${(value.mul(MUL_P).div(divisor).toNumber() / 100).toFixed(2)}%`; return `${(value.mul(MUL_P).div(divisor).toNumber() / 100).toFixed(2)}%`;
} }
/** @internal */
function decodeAbstracIntU8a (value: Uint8Array, bitLength: UIntBitLength, isNegative: boolean): string {
if (!value.length) {
return '0';
}
try {
// NOTE When passing u8a in (typically from decoded data), it is always Little Endian
return u8aToBn(value.subarray(0, bitLength / 8), { isLe: true, isNegative }).toString();
} catch (error) {
throw new Error(`AbstractInt: failed on ${stringify(value)}:: ${(error as Error).message}`);
}
}
/** @internal */ /** @internal */
function decodeAbstractInt (value: AnyNumber, bitLength: UIntBitLength, isNegative: boolean): string { function decodeAbstractInt (value: AnyNumber, bitLength: UIntBitLength, isNegative: boolean): string {
// This function returns a string, which will be passed in the BN // This function returns a string, which will be passed in the BN
// constructor. It would be ideal to actually return a BN, but there's a // constructor. It would be ideal to actually return a BN, but there's a
// bug: https://github.com/indutny/bn.js/issues/206. // bug: https://github.com/indutny/bn.js/issues/206.
if (isHex(value, -1, true)) { if (isU8a(value)) {
if (!value.length) {
return '0';
}
try {
// NOTE When passing u8a in (typically from decoded data), it is always Little Endian
return u8aToBn(value.subarray(0, bitLength / 8), { isLe: true, isNegative }).toString();
} catch (error) {
throw new Error(`AbstractInt: failed on ${stringify(value)}:: ${(error as Error).message}`);
}
} else if (isBn(value)) {
return value.toString();
} else if (isHex(value, -1, true)) {
return hexToBn(value, { isLe: false, isNegative }).toString(); return hexToBn(value, { isLe: false, isNegative }).toString();
} else if (isU8a(value)) {
return decodeAbstracIntU8a(value, bitLength, isNegative);
} else if (isString(value)) {
return new BN(value.toString(), 10).toString();
} }
return bnToBn(value).toString(); return bnToBn(value).toString();
@@ -65,6 +61,8 @@ export abstract class AbstractInt extends BN implements INumber {
public createdAtHash?: Hash; public createdAtHash?: Hash;
readonly encodedLength: number;
readonly #bitLength: UIntBitLength; readonly #bitLength: UIntBitLength;
readonly #isSigned: boolean; readonly #isSigned: boolean;
@@ -74,6 +72,7 @@ export abstract class AbstractInt extends BN implements INumber {
this.registry = registry; this.registry = registry;
this.#bitLength = bitLength; this.#bitLength = bitLength;
this.encodedLength = this.#bitLength / 8;
this.#isSigned = isSigned; this.#isSigned = isSigned;
const isPositive = this.gte(BN_ZERO); const isPositive = this.gte(BN_ZERO);
@@ -83,13 +82,6 @@ export abstract class AbstractInt extends BN implements INumber {
assert(super.bitLength() <= maxBits, () => `${this.toRawType()}: Input too large. Found input with ${super.bitLength()} bits, expected ${maxBits}`); assert(super.bitLength() <= maxBits, () => `${this.toRawType()}: Input too large. Found input with ${super.bitLength()} bits, expected ${maxBits}`);
} }
/**
* @description The length of the value when encoded as a Uint8Array
*/
public get encodedLength (): number {
return this.#bitLength / 8;
}
/** /**
* @description returns a hash of the contents * @description returns a hash of the contents
*/ */
@@ -158,7 +150,7 @@ export abstract class AbstractInt extends BN implements INumber {
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (isLe = false): string { public toHex (isLe = false): HexString {
// For display/JSON, this is BE, for compare, use isLe // For display/JSON, this is BE, for compare, use isLe
return bnToHex(this, { return bnToHex(this, {
bitLength: this.bitLength(), bitLength: this.bitLength(),
+24 -24
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyJson, Codec, Constructor, ISet, Registry } from '../types'; import type { AnyJson, Codec, Constructor, ISet, Registry } from '../types';
@@ -11,26 +12,20 @@ import { compareSet, decodeU8a, sortSet, typeToConstructor } from './utils';
const l = logger('BTreeSet'); const l = logger('BTreeSet');
/** @internal */ /** @internal */
function decodeSetFromU8a<V extends Codec> (registry: Registry, ValClass: Constructor<V>, u8a: Uint8Array): Set<V> { function decodeSetFromU8a<V extends Codec> (registry: Registry, ValClass: Constructor<V>, u8a: Uint8Array): [Set<V>, number] {
const output = new Set<V>(); const output = new Set<V>();
const [offset, length] = compactFromU8a(u8a); const [offset, length] = compactFromU8a(u8a);
const types = []; const [values, decodedLength] = decodeU8a<V>(registry, u8a.subarray(offset), new Array(length.toNumber()).fill(ValClass));
for (let i = 0; i < length.toNumber(); i++) {
types.push(ValClass);
}
const values = decodeU8a<V>(registry, u8a.subarray(offset), types);
for (let i = 0; i < values.length; i++) { for (let i = 0; i < values.length; i++) {
output.add(values[i]); output.add(values[i]);
} }
return output; return [output, decodedLength + offset];
} }
/** @internal */ /** @internal */
function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: Constructor<V>, value: Set<any> | string[]): Set<V> { function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: Constructor<V>, value: Set<any> | string[]): [Set<V>, number] {
const output = new Set<V>(); const output = new Set<V>();
value.forEach((val: any) => { value.forEach((val: any) => {
@@ -43,7 +38,7 @@ function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: Constr
} }
}); });
return output; return [output, 0];
} }
/** /**
@@ -60,14 +55,14 @@ function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: Constr
* @param jsonSet * @param jsonSet
* @internal * @internal
*/ */
function decodeSet<V extends Codec> (registry: Registry, valType: Constructor<V> | string, value?: Uint8Array | string | string[] | Set<any>): Set<V> { function decodeSet<V extends Codec> (registry: Registry, valType: Constructor<V> | string, value?: Uint8Array | string | string[] | Set<any>): [Set<V>, number] {
if (!value) { if (!value) {
return new Set<V>(); return [new Set<V>(), 0];
} }
const ValClass = typeToConstructor(registry, valType); const ValClass = typeToConstructor(registry, valType);
if (isHex(value) || isU8a(value)) { if (isU8a(value) || isHex(value)) {
return decodeSetFromU8a<V>(registry, ValClass, u8aToU8a(value)); return decodeSetFromU8a<V>(registry, ValClass, u8aToU8a(value));
} else if (Array.isArray(value) || value instanceof Set) { } else if (Array.isArray(value) || value instanceof Set) {
return decodeSetFromSet<V>(registry, ValClass, value); return decodeSetFromSet<V>(registry, ValClass, value);
@@ -81,12 +76,17 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
public createdAtHash?: Hash; public createdAtHash?: Hash;
readonly initialU8aLength?: number;
readonly #ValClass: Constructor<V>; readonly #ValClass: Constructor<V>;
constructor (registry: Registry, valType: Constructor<V> | string, rawValue?: Uint8Array | string | string[] | Set<any>) { constructor (registry: Registry, valType: Constructor<V> | string, rawValue?: Uint8Array | string | string[] | Set<any>) {
super(sortSet(decodeSet(registry, valType, rawValue))); const [values, decodedLength] = decodeSet(registry, valType, rawValue);
super(sortSet(values));
this.registry = registry; this.registry = registry;
this.initialU8aLength = decodedLength;
this.#ValClass = typeToConstructor(registry, valType); this.#ValClass = typeToConstructor(registry, valType);
} }
@@ -104,9 +104,9 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
public get encodedLength (): number { public get encodedLength (): number {
let len = compactToU8a(this.size).length; let len = compactToU8a(this.size).length;
this.forEach((v: V) => { for (const v of this.values()) {
len += v.encodedLength; len += v.encodedLength;
}); }
return len; return len;
} }
@@ -142,7 +142,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
/** /**
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
*/ */
public toHex (): string { public toHex (): HexString {
return u8aToHex(this.toU8a()); return u8aToHex(this.toU8a());
} }
@@ -152,9 +152,9 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
public toHuman (isExtended?: boolean): AnyJson { public toHuman (isExtended?: boolean): AnyJson {
const json: AnyJson = []; const json: AnyJson = [];
this.forEach((v: V) => { for (const v of this.values()) {
json.push(v.toHuman(isExtended)); json.push(v.toHuman(isExtended));
}); }
return json; return json;
} }
@@ -165,9 +165,9 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
public toJSON (): AnyJson { public toJSON (): AnyJson {
const json: AnyJson = []; const json: AnyJson = [];
this.forEach((v: V) => { for (const v of this.values()) {
json.push(v.toJSON()); json.push(v.toJSON());
}); }
return json; return json;
} }
@@ -197,9 +197,9 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
encoded.push(compactToU8a(this.size)); encoded.push(compactToU8a(this.size));
} }
this.forEach((v: V) => { for (const v of this.values()) {
encoded.push(v.toU8a(isBare)); encoded.push(v.toU8a(isBare));
}); }
return u8aConcat(...encoded); return u8aConcat(...encoded);
} }
+6 -2
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyJson, BareOpts, Codec, Registry } from '../types'; import type { AnyJson, BareOpts, Codec, Registry } from '../types';
@@ -13,11 +14,14 @@ export abstract class Base<T extends Codec> implements Codec {
public createdAtHash?: Hash; public createdAtHash?: Hash;
readonly initialU8aLength?: number;
protected readonly _raw: T; protected readonly _raw: T;
protected constructor (registry: Registry, value: T) { protected constructor (registry: Registry, value: T, initialU8aLength?: number) {
this.registry = registry; this.registry = registry;
this._raw = value; this._raw = value;
this.initialU8aLength = initialU8aLength;
} }
/** /**
@@ -51,7 +55,7 @@ export abstract class Base<T extends Codec> implements Codec {
/** /**
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
*/ */
public toHex (isLe?: boolean): string { public toHex (isLe?: boolean): HexString {
return this._raw.toHex(isLe); return this._raw.toHex(isLe);
} }
+17 -6
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { BN } from '@polkadot/util'; import type { BN } from '@polkadot/util';
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces'; import type { CodecHash, Hash } from '../interfaces';
import type { AnyJson, AnyNumber, Constructor, ICompact, INumber, Registry } from '../types'; import type { AnyJson, AnyNumber, Constructor, ICompact, INumber, Registry } from '../types';
@@ -22,6 +23,8 @@ export class Compact<T extends INumber> implements ICompact<T> {
public createdAtHash?: Hash; public createdAtHash?: Hash;
readonly initialU8aLength?: number;
readonly #Type: Constructor<T>; readonly #Type: Constructor<T>;
readonly #raw: T; readonly #raw: T;
@@ -29,7 +32,11 @@ export class Compact<T extends INumber> implements ICompact<T> {
constructor (registry: Registry, Type: Constructor<T> | string, value: Compact<T> | AnyNumber = 0) { constructor (registry: Registry, Type: Constructor<T> | string, value: Compact<T> | AnyNumber = 0) {
this.registry = registry; this.registry = registry;
this.#Type = typeToConstructor(registry, Type); this.#Type = typeToConstructor(registry, Type);
this.#raw = Compact.decodeCompact<T>(registry, this.#Type, value) as T;
const [raw, decodedLength] = Compact.decodeCompact<T>(registry, this.#Type, value);
this.initialU8aLength = decodedLength;
this.#raw = raw;
} }
public static with<T extends INumber> (Type: Constructor<T> | string): Constructor<Compact<T>> { public static with<T extends INumber> (Type: Constructor<T> | string): Constructor<Compact<T>> {
@@ -41,14 +48,18 @@ export class Compact<T extends INumber> implements ICompact<T> {
} }
/** @internal */ /** @internal */
public static decodeCompact<T extends INumber> (registry: Registry, Type: Constructor<T>, value: Compact<T> | AnyNumber): INumber { public static decodeCompact<T extends INumber> (registry: Registry, Type: Constructor<T>, value: Compact<T> | AnyNumber): [T, number] {
if (value instanceof Compact) { if (value instanceof Compact) {
return new Type(registry, value.#raw); return [new Type(registry, value.#raw), 0];
} else if (value instanceof Type) {
return [value, 0];
} else if (isString(value) || isNumber(value) || isBn(value) || isBigInt(value)) { } else if (isString(value) || isNumber(value) || isBn(value) || isBigInt(value)) {
return new Type(registry, value); return [new Type(registry, value), 0];
} }
return new Type(registry, compactFromU8a(value)[1]); const [decodedLength, bn] = compactFromU8a(value);
return [new Type(registry, bn), decodedLength];
} }
/** /**
@@ -107,7 +118,7 @@ export class Compact<T extends INumber> implements ICompact<T> {
/** /**
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
*/ */
public toHex (isLe?: boolean): string { public toHex (isLe?: boolean): HexString {
return this.#raw.toHex(isLe); return this.#raw.toHex(isLe);
} }
+5 -4
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyNumber, INumber, Registry } from '../types'; import type { AnyNumber, INumber, Registry } from '../types';
import type { UIntBitLength } from './types'; import type { UIntBitLength } from './types';
@@ -10,10 +11,10 @@ import { BN, bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkado
const BITLENGTH: UIntBitLength = 64; const BITLENGTH: UIntBitLength = 64;
function decodeDate (value: CodecDate | Date | AnyNumber): Date { function decodeDate (value: CodecDate | Date | AnyNumber): Date {
if (value instanceof Date) { if (isU8a(value)) {
return value;
} else if (isU8a(value)) {
value = u8aToBn(value.subarray(0, BITLENGTH / 8), true); value = u8aToBn(value.subarray(0, BITLENGTH / 8), true);
} else if (value instanceof Date) {
return value;
} else if (isString(value)) { } else if (isString(value)) {
value = new BN(value.toString(), 10, 'le'); value = new BN(value.toString(), 10, 'le');
} }
@@ -96,7 +97,7 @@ export class CodecDate extends Date implements INumber {
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (isLe = false): string { public toHex (isLe = false): HexString {
return bnToHex(this.toBn(), { return bnToHex(this.toBn(), {
bitLength: BITLENGTH, bitLength: BITLENGTH,
isLe, isLe,
+2 -1
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyJson, Codec, Constructor, Registry } from '../types'; import type { AnyJson, Codec, Constructor, Registry } from '../types';
@@ -56,7 +57,7 @@ export class DoNotConstruct implements Codec {
throw this.#neverError; throw this.#neverError;
} }
toHex (): string { toHex (): HexString {
throw this.#neverError; throw this.#neverError;
} }
+10 -5
View File
@@ -114,9 +114,14 @@ describe('Enum', (): void => {
}); });
it('has correct isXyz/asXyz (Enum.with)', (): void => { it('has correct isXyz/asXyz (Enum.with)', (): void => {
const test = new (Enum.with({ First: Text, Second: U32, Third: U32 }))(registry, { Second: 42 }) as any as { isSecond: boolean; asSecond: U32; asThird: never }; const test = new (Enum.with({ First: Text, Second: U32, Third: U32 }))(registry, { Second: 42 }) as any as { isFirst: boolean; isSecond: boolean; asSecond: U32; isThird: boolean; asThird: never };
const asKeys = Object.keys(test).filter((k) => k.startsWith('as'));
const isKeys = Object.keys(test).filter((k) => k.startsWith('is'));
expect(asKeys).toEqual(['asFirst', 'asSecond', 'asThird']);
expect(isKeys).toEqual(['isFirst', 'isSecond', 'isThird']);
expect([test.isFirst, test.isSecond, test.isThird]).toEqual([false, true, false]);
expect(test.isSecond).toEqual(true);
expect(test.asSecond.toNumber()).toEqual(42); expect(test.asSecond.toNumber()).toEqual(42);
expect((): never => test.asThird).toThrow(/Cannot convert 'Second' via asThird/); expect((): never => test.asThird).toThrow(/Cannot convert 'Second' via asThird/);
}); });
@@ -250,9 +255,9 @@ describe('Enum', (): void => {
}); });
it('has correct isXyz getters (Enum.with)', (): void => { it('has correct isXyz getters (Enum.with)', (): void => {
const test = new (Enum.with(['First', 'Second', 'Third']))(registry, 'Second') as any as { isSecond: boolean; asSecond: never }; const test = new (Enum.with(['First', 'Second', 'Third']))(registry, 'Second') as any as { isFirst: boolean; isSecond: boolean; isThird: boolean };
expect(test.isSecond).toEqual(true); expect([test.isFirst, test.isSecond, test.isThird]).toEqual([false, true, false]);
}); });
describe('utils', (): void => { describe('utils', (): void => {
@@ -423,7 +428,7 @@ describe('Enum', (): void => {
}); });
it('encodes a single entry correctly (with embedded encoding)', (): void => { it('encodes a single entry correctly (with embedded encoding)', (): void => {
const Test = Enum.with({ A: 'Address' }); const Test = Enum.with({ A: 'MultiAddress' });
const test = new Test(registry, registry.createType('AccountId', '0x0001020304050607080910111213141516171819202122232425262728293031'), 0); const test = new Test(registry, registry.createType('AccountId', '0x0001020304050607080910111213141516171819202122232425262728293031'), 0);
expect(test.toHex()).toEqual( expect(test.toHex()).toEqual(
+36 -32
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces'; import type { CodecHash, Hash } from '../interfaces';
import type { AnyJson, Codec, Constructor, IEnum, Registry } from '../types'; import type { AnyJson, Codec, Constructor, IEnum, Registry } from '../types';
import { assert, hexToU8a, isHex, isNumber, isObject, isString, isU8a, isUndefined, stringCamelCase, stringify, stringUpperFirst, u8aConcat, u8aToHex } from '@polkadot/util'; import { assert, hexToU8a, isHex, isNumber, isObject, isString, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, stringUpperFirst, u8aConcat, u8aToHex } from '@polkadot/util';
import { Null } from '../primitive/Null'; import { Null } from '../primitive/Null';
import { Struct } from './Struct'; import { mapToTypeMap, typesToMap } from './utils';
import { mapToTypeMap } from './utils';
// export interface, this is used in Enum.with, so required as public by TS // export interface, this is used in Enum.with, so required as public by TS
export interface EnumConstructor<T = Codec> { export interface EnumConstructor<T = Codec> {
@@ -85,7 +85,7 @@ function extractDef (registry: Registry, _def: Record<string, string | Construct
}; };
} }
function createFromValue (registry: Registry, def: TypesDef, index = 0, value?: any): Decoded { function createFromValue (registry: Registry, def: TypesDef, index = 0, value?: unknown): Decoded {
const entry = Object.values(def).find((e) => e.index === index); const entry = Object.values(def).find((e) => e.index === index);
assert(!isUndefined(entry), () => `Unable to create Enum via index ${index}, in ${Object.keys(def).join(', ')}`); assert(!isUndefined(entry), () => `Unable to create Enum via index ${index}, in ${Object.keys(def).join(', ')}`);
@@ -98,7 +98,7 @@ function createFromValue (registry: Registry, def: TypesDef, index = 0, value?:
}; };
} }
function decodeFromJSON (registry: Registry, def: TypesDef, key: string, value?: any): Decoded { function decodeFromJSON (registry: Registry, def: TypesDef, key: string, value?: unknown): Decoded {
// JSON comes in the form of { "<type (camelCase)>": "<value for type>" }, here we // JSON comes in the form of { "<type (camelCase)>": "<value for type>" }, here we
// additionally force to lower to ensure forward compat // additionally force to lower to ensure forward compat
const keys = Object.keys(def).map((k) => k.toLowerCase()); const keys = Object.keys(def).map((k) => k.toLowerCase());
@@ -121,7 +121,7 @@ function decodeFromString (registry: Registry, def: TypesDef, value: string): De
: decodeFromJSON(registry, def, value); : decodeFromJSON(registry, def, value);
} }
function decodeFromValue (registry: Registry, def: TypesDef, value?: any): Decoded { function decodeFromValue (registry: Registry, def: TypesDef, value?: unknown): Decoded {
if (isU8a(value)) { if (isU8a(value)) {
// nested, we don't want to match isObject below // nested, we don't want to match isObject below
if (value.length) { if (value.length) {
@@ -141,7 +141,7 @@ function decodeFromValue (registry: Registry, def: TypesDef, value?: any): Decod
return createFromValue(registry, def, Object.values(def)[0].index); return createFromValue(registry, def, Object.values(def)[0].index);
} }
function decodeEnum (registry: Registry, def: TypesDef, value?: any, index?: number): Decoded { function decodeEnum (registry: Registry, def: TypesDef, value?: unknown, index?: number): Decoded {
// NOTE We check the index path first, before looking at values - this allows treating // NOTE We check the index path first, before looking at values - this allows treating
// the optional indexes before anything else, more-specific > less-specific // the optional indexes before anything else, more-specific > less-specific
if (isNumber(index)) { if (isNumber(index)) {
@@ -169,6 +169,8 @@ export class Enum implements IEnum {
readonly #entryIndex: number; readonly #entryIndex: number;
readonly initialU8aLength?: number;
readonly #indexes: number[]; readonly #indexes: number[];
readonly #isBasic: boolean; readonly #isBasic: boolean;
@@ -188,33 +190,35 @@ export class Enum implements IEnum {
this.#indexes = Object.values(defInfo.def).map(({ index }) => index); this.#indexes = Object.values(defInfo.def).map(({ index }) => index);
this.#entryIndex = this.#indexes.indexOf(decoded.index) || 0; this.#entryIndex = this.#indexes.indexOf(decoded.index) || 0;
this.#raw = decoded.value; this.#raw = decoded.value;
if (this.#raw.initialU8aLength) {
this.initialU8aLength = 1 + this.#raw.initialU8aLength;
}
} }
public static with (Types: Record<string, string | Constructor> | Record<string, number> | string[]): EnumConstructor<Enum> { public static with (Types: Record<string, string | Constructor> | Record<string, number> | string[]): EnumConstructor<Enum> {
const keys = Array.isArray(Types)
? Types
: Object.keys(Types);
const asKeys = new Array<string>(keys.length);
const isKeys = new Array<string>(keys.length);
for (let i = 0; i < keys.length; i++) {
const name = stringUpperFirst(stringCamelCase(keys[i].replace(' ', '_')));
asKeys[i] = `as${name}`;
isKeys[i] = `is${name}`;
}
return class extends Enum { return class extends Enum {
constructor (registry: Registry, value?: unknown, index?: number) { constructor (registry: Registry, value?: unknown, index?: number) {
super(registry, Types, value, index); super(registry, Types, value, index);
Object.keys(this.#def).forEach((_key): void => { objectProperties(this, isKeys, (_, i) => this.type === keys[i]);
const name = stringUpperFirst(stringCamelCase(_key.replace(' ', '_'))); objectProperties(this, asKeys, (k, i): Codec => {
const askey = `as${name}`; assert(this[isKeys[i] as keyof this], () => `Cannot convert '${this.type}' via ${k}`);
const iskey = `is${name}`;
isUndefined(this[iskey as keyof this]) && return this.value;
Object.defineProperty(this, iskey, {
enumerable: true,
get: () => this.type === _key
});
isUndefined(this[askey as keyof this]) &&
Object.defineProperty(this, askey, {
enumerable: true,
get: (): Codec => {
assert(this[iskey as keyof this], () => `Cannot convert '${this.type}' via ${askey}`);
return this.value;
}
});
}); });
} }
}; };
@@ -267,7 +271,7 @@ export class Enum implements IEnum {
* @deprecated use isNone * @deprecated use isNone
*/ */
public get isNull (): boolean { public get isNull (): boolean {
return this.isNone; return this.#raw instanceof Null;
} }
/** /**
@@ -303,12 +307,12 @@ export class Enum implements IEnum {
*/ */
public eq (other?: unknown): boolean { public eq (other?: unknown): boolean {
// cater for the case where we only pass the enum index // cater for the case where we only pass the enum index
if (isNumber(other)) { if (isU8a(other)) {
return !this.toU8a().some((entry, index) => entry !== other[index]);
} else if (isNumber(other)) {
return this.toNumber() === other; return this.toNumber() === other;
} else if (this.#isBasic && isString(other)) { } else if (this.#isBasic && isString(other)) {
return this.type === other; return this.type === other;
} else if (isU8a(other)) {
return !this.toU8a().some((entry, index) => entry !== other[index]);
} else if (isHex(other)) { } else if (isHex(other)) {
return this.toHex() === other; return this.toHex() === other;
} else if (other instanceof Enum) { } else if (other instanceof Enum) {
@@ -324,7 +328,7 @@ export class Enum implements IEnum {
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (): string { public toHex (): HexString {
return u8aToHex(this.toU8a()); return u8aToHex(this.toU8a());
} }
@@ -375,7 +379,7 @@ export class Enum implements IEnum {
return out; return out;
}, {}); }, {});
return Struct.typesToMap(this.registry, typeMap); return typesToMap(this.registry, typeMap);
} }
/** /**
+4 -9
View File
@@ -1,10 +1,11 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyJson, Codec, Registry } from '../types'; import type { AnyJson, Codec, Registry } from '../types';
import { isFunction, isUndefined, stringify } from '@polkadot/util'; import { isFunction, objectProperties, stringify } from '@polkadot/util';
import { compareMap } from './utils'; import { compareMap } from './utils';
@@ -33,13 +34,7 @@ export class Json extends Map<string, any> implements Codec {
this.registry = registry; this.registry = registry;
decoded.forEach(([key]): void => { objectProperties(this, decoded.map(([k]) => k), (k) => this.get(k));
isUndefined(this[key as keyof this]) &&
Object.defineProperty(this, key, {
enumerable: true,
get: (): Codec | undefined => this.get(key) as Codec
});
});
} }
/** /**
@@ -73,7 +68,7 @@ export class Json extends Map<string, any> implements Codec {
/** /**
* @description Unimplemented, will throw * @description Unimplemented, will throw
*/ */
public toHex (): string { public toHex (): HexString {
throw new Error('Unimplemented'); throw new Error('Unimplemented');
} }
+2 -1
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { Codec, Constructor, Registry } from '../types'; import type { Codec, Constructor, Registry } from '../types';
import { Option } from './Option'; import { Option } from './Option';
@@ -22,7 +23,7 @@ export class Linkage<T extends Codec> extends Struct {
previous: Option.with(Type), previous: Option.with(Type),
// eslint-disable-next-line sort-keys // eslint-disable-next-line sort-keys
next: Option.with(Type) next: Option.with(Type)
}, value as string); }, value as HexString);
} }
public static withKey<O extends Codec> (Type: Constructor | string): Constructor<Linkage<O>> { public static withKey<O extends Codec> (Type: Constructor | string): Constructor<Linkage<O>> {
+25 -20
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyJson, Codec, Constructor, IMap, Registry } from '../types'; import type { AnyJson, Codec, Constructor, IMap, Registry } from '../types';
@@ -14,29 +15,30 @@ import { compareMap, decodeU8a, sortMap, typeToConstructor } from './utils';
const l = logger('Map'); const l = logger('Map');
/** @internal */ /** @internal */
function decodeMapFromU8a<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, u8a: Uint8Array): Map<K, V> { function decodeMapFromU8a<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, u8a: Uint8Array): [Map<K, V>, number] {
const output = new Map<K, V>(); const output = new Map<K, V>();
const [offset, length] = compactFromU8a(u8a); const [offset, length] = compactFromU8a(u8a);
const count = length.toNumber();
const types = []; const types = [];
for (let i = 0; i < length.toNumber(); i++) { for (let i = 0; i < count; i++) {
types.push(KeyClass, ValClass); types.push(KeyClass, ValClass);
} }
const values = decodeU8a(registry, u8a.subarray(offset), types); const [values, decodedLength] = decodeU8a(registry, u8a.subarray(offset), types);
for (let i = 0; i < values.length; i += 2) { for (let i = 0; i < values.length; i += 2) {
output.set(values[i] as K, values[i + 1] as V); output.set(values[i] as K, values[i + 1] as V);
} }
return output; return [output, offset + decodedLength];
} }
/** @internal */ /** @internal */
function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, value: Map<any, any>): Map<K, V> { function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, value: Map<any, any>): [Map<K, V>, number] {
const output = new Map<K, V>(); const output = new Map<K, V>();
value.forEach((val: unknown, key: unknown) => { for (const [key, val] of value.entries()) {
const isComplex = KeyClass.prototype instanceof AbstractArray || const isComplex = KeyClass.prototype instanceof AbstractArray ||
KeyClass.prototype instanceof Struct || KeyClass.prototype instanceof Struct ||
KeyClass.prototype instanceof Enum; KeyClass.prototype instanceof Enum;
@@ -55,9 +57,9 @@ function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry,
throw error; throw error;
} }
}); }
return output; return [output, 0];
} }
/** /**
@@ -75,12 +77,12 @@ function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry,
* @param jsonMap * @param jsonMap
* @internal * @internal
*/ */
function decodeMap<K extends Codec, V extends Codec> (registry: Registry, keyType: Constructor<K> | string, valType: Constructor<V> | string, value?: Uint8Array | string | Map<any, any>): Map<K, V> { function decodeMap<K extends Codec, V extends Codec> (registry: Registry, keyType: Constructor<K> | string, valType: Constructor<V> | string, value?: Uint8Array | string | Map<any, any>): [Map<K, V>, number] {
const KeyClass = typeToConstructor(registry, keyType); const KeyClass = typeToConstructor(registry, keyType);
const ValClass = typeToConstructor(registry, valType); const ValClass = typeToConstructor(registry, valType);
if (!value) { if (!value) {
return new Map<K, V>(); return [new Map<K, V>(), 0];
} else if (isU8a(value) || isHex(value)) { } else if (isU8a(value) || isHex(value)) {
return decodeMapFromU8a<K, V>(registry, KeyClass, ValClass, u8aToU8a(value)); return decodeMapFromU8a<K, V>(registry, KeyClass, ValClass, u8aToU8a(value));
} else if (value instanceof Map) { } else if (value instanceof Map) {
@@ -101,14 +103,17 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
readonly #ValClass: Constructor<V>; readonly #ValClass: Constructor<V>;
readonly initialU8aLength?: number;
readonly #type: string; readonly #type: string;
constructor (registry: Registry, keyType: Constructor<K> | string, valType: Constructor<V> | string, rawValue: Uint8Array | string | Map<any, any> | undefined, type: 'BTreeMap' | 'HashMap' = 'HashMap') { constructor (registry: Registry, keyType: Constructor<K> | string, valType: Constructor<V> | string, rawValue: Uint8Array | string | Map<any, any> | undefined, type: 'BTreeMap' | 'HashMap' = 'HashMap') {
const decoded = decodeMap(registry, keyType, valType, rawValue); const [decoded, decodedLength] = decodeMap(registry, keyType, valType, rawValue);
super(type === 'BTreeMap' ? sortMap(decoded) : decoded); super(type === 'BTreeMap' ? sortMap(decoded) : decoded);
this.registry = registry; this.registry = registry;
this.initialU8aLength = decodedLength;
this.#KeyClass = typeToConstructor(registry, keyType); this.#KeyClass = typeToConstructor(registry, keyType);
this.#ValClass = typeToConstructor(registry, valType); this.#ValClass = typeToConstructor(registry, valType);
this.#type = type; this.#type = type;
@@ -120,9 +125,9 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
public get encodedLength (): number { public get encodedLength (): number {
let len = compactToU8a(this.size).length; let len = compactToU8a(this.size).length;
this.forEach((v: V, k: K) => { for (const [k, v] of this.entries()) {
len += v.encodedLength + k.encodedLength; len += v.encodedLength + k.encodedLength;
}); }
return len; return len;
} }
@@ -151,7 +156,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
/** /**
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation * @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
*/ */
public toHex (): string { public toHex (): HexString {
return u8aToHex(this.toU8a()); return u8aToHex(this.toU8a());
} }
@@ -161,9 +166,9 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
public toHuman (isExtended?: boolean): Record<string, AnyJson> { public toHuman (isExtended?: boolean): Record<string, AnyJson> {
const json: Record<string, AnyJson> = {}; const json: Record<string, AnyJson> = {};
this.forEach((v: V, k: K) => { for (const [k, v] of this.entries()) {
json[k.toString()] = v.toHuman(isExtended); json[k.toString()] = v.toHuman(isExtended);
}); }
return json; return json;
} }
@@ -174,9 +179,9 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
public toJSON (): Record<string, AnyJson> { public toJSON (): Record<string, AnyJson> {
const json: Record<string, AnyJson> = {}; const json: Record<string, AnyJson> = {};
this.forEach((v: V, k: K) => { for (const [k, v] of this.entries()) {
json[k.toString()] = v.toJSON(); json[k.toString()] = v.toJSON();
}); }
return json; return json;
} }
@@ -206,9 +211,9 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
encoded.push(compactToU8a(this.size)); encoded.push(compactToU8a(this.size));
} }
this.forEach((v: V, k: K) => { for (const [k, v] of this.entries()) {
encoded.push(k.toU8a(isBare), v.toU8a(isBare)); encoded.push(k.toU8a(isBare), v.toU8a(isBare));
}); }
return u8aConcat(...encoded); return u8aConcat(...encoded);
} }
+18 -9
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces'; import type { CodecHash, Hash } from '../interfaces';
import type { AnyJson, Codec, Constructor, IOption, Registry } from '../types'; import type { AnyJson, Codec, Constructor, IOption, Registry } from '../types';
@@ -9,13 +10,6 @@ import { assert, isNull, isU8a, isUndefined, u8aToHex } from '@polkadot/util';
import { Null } from '../primitive/Null'; import { Null } from '../primitive/Null';
import { typeToConstructor } from './utils'; import { typeToConstructor } from './utils';
/** @internal */
function decodeOptionU8a (registry: Registry, Type: Constructor, value: Uint8Array): Codec {
return !value.length || value[0] === 0
? new Null(registry)
: new Type(registry, value.subarray(1));
}
/** @internal */ /** @internal */
function decodeOption (registry: Registry, typeName: Constructor | string, value?: unknown): Codec { function decodeOption (registry: Registry, typeName: Constructor | string, value?: unknown): Codec {
if (isNull(value) || isUndefined(value) || value instanceof Null || value === '0x') { if (isNull(value) || isUndefined(value) || value instanceof Null || value === '0x') {
@@ -33,7 +27,9 @@ function decodeOption (registry: Registry, typeName: Constructor | string, value
} else if (isU8a(value)) { } else if (isU8a(value)) {
// the isU8a check happens last in the if-tree - since the wrapped value // the isU8a check happens last in the if-tree - since the wrapped value
// may be an instance of it, so Type and Option checks go in first // may be an instance of it, so Type and Option checks go in first
return decodeOptionU8a(registry, Type, value); return !value.length || value[0] === 0
? new Null(registry)
: new Type(registry, value.subarray(1));
} }
return new Type(registry, value); return new Type(registry, value);
@@ -54,12 +50,18 @@ export class Option<T extends Codec> implements IOption<T> {
readonly #Type: Constructor<T>; readonly #Type: Constructor<T>;
readonly #initialU8aLength?: number;
readonly #raw: T; readonly #raw: T;
constructor (registry: Registry, typeName: Constructor<T> | string, value?: unknown) { constructor (registry: Registry, typeName: Constructor<T> | string, value?: unknown) {
this.registry = registry; this.registry = registry;
this.#Type = typeToConstructor(registry, typeName); this.#Type = typeToConstructor(registry, typeName);
this.#raw = decodeOption(registry, typeName, value) as T; this.#raw = decodeOption(registry, typeName, value) as T;
if (this.#raw.initialU8aLength) {
this.#initialU8aLength = 1 + this.#raw.initialU8aLength;
}
} }
public static with<O extends Codec> (Type: Constructor<O> | string): Constructor<Option<O>> { public static with<O extends Codec> (Type: Constructor<O> | string): Constructor<Option<O>> {
@@ -78,6 +80,13 @@ export class Option<T extends Codec> implements IOption<T> {
return 1 + this.#raw.encodedLength; return 1 + this.#raw.encodedLength;
} }
/**
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
*/
public get initialU8aLength (): number | undefined {
return this.#initialU8aLength;
}
/** /**
* @description returns a hash of the contents * @description returns a hash of the contents
*/ */
@@ -127,7 +136,7 @@ export class Option<T extends Codec> implements IOption<T> {
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (): string { public toHex (): HexString {
// This attempts to align with the JSON encoding - actually in this case // This attempts to align with the JSON encoding - actually in this case
// the isSome value is correct, however the `isNone` may be problematic // the isSome value is correct, however the `isNone` may be problematic
return this.isNone return this.isNone
+18 -7
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyJson, AnyU8a, IU8a, Registry } from '../types'; import type { AnyJson, AnyU8a, IU8a, Registry } from '../types';
@@ -20,10 +21,13 @@ export class Raw extends Uint8Array implements IU8a {
public createdAtHash?: Hash; public createdAtHash?: Hash;
constructor (registry: Registry, value?: AnyU8a) { readonly initialU8aLength?: number;
constructor (registry: Registry, value?: AnyU8a, initialU8aLength?: number) {
super(u8aToU8a(value)); super(u8aToU8a(value));
this.registry = registry; this.registry = registry;
this.initialU8aLength = initialU8aLength;
} }
/** /**
@@ -51,7 +55,7 @@ export class Raw extends Uint8Array implements IU8a {
* @description Returns true if the type wraps an empty/default all-0 value * @description Returns true if the type wraps an empty/default all-0 value
*/ */
public get isEmpty (): boolean { public get isEmpty (): boolean {
return !this.length || isUndefined(this.find((value) => !!value)); return !this.length || isUndefined(this.find((b) => !!b));
} }
/** /**
@@ -82,7 +86,7 @@ export class Raw extends Uint8Array implements IU8a {
public eq (other?: unknown): boolean { public eq (other?: unknown): boolean {
if (other instanceof Uint8Array) { if (other instanceof Uint8Array) {
return (this.length === other.length) && return (this.length === other.length) &&
!this.some((value, index) => value !== other[index]); !this.some((b, index) => b !== other[index]);
} }
return this.eq(u8aToU8a(other as string)); return this.eq(u8aToU8a(other as string));
@@ -111,7 +115,7 @@ export class Raw extends Uint8Array implements IU8a {
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (): string { public toHex (): HexString {
return u8aToHex(this); return u8aToHex(this);
} }
@@ -119,9 +123,16 @@ export class Raw extends Uint8Array implements IU8a {
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (): AnyJson { public toHuman (): AnyJson {
return this.isAscii if (this.isAscii) {
? this.toUtf8() const text = this.toUtf8();
: this.toJSON();
// ensure we didn't end up with multibyte codepoints
if (isAscii(text)) {
return text;
}
}
return this.toJSON();
} }
/** /**
+38 -27
View File
@@ -1,42 +1,54 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { Constructor, ISet, Registry } from '../types'; import type { Constructor, ISet, Registry } from '../types';
import { assert, BN, bnToBn, bnToU8a, isBn, isNumber, isString, isU8a, isUndefined, stringCamelCase, stringify, stringUpperFirst, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util'; import { assert, BN, bnToBn, bnToU8a, isBn, isNumber, isString, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, stringUpperFirst, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util';
import { compareArray } from './utils'; import { compareArray } from './utils';
type SetValues = Record<string, number | BN>; type SetValues = Record<string, number | BN>;
function encodeSet (setValues: SetValues, value: string[]): BN { function encodeSet (setValues: SetValues, values: string[]): BN {
return value.reduce((result, value): BN => { const encoded = new BN(0);
return result.or(bnToBn(setValues[value] || 0));
}, new BN(0)); for (let i = 0; i < values.length; i++) {
encoded.ior(bnToBn(setValues[values[i]] || 0));
}
return encoded;
} }
/** @internal */ /** @internal */
function decodeSetArray (setValues: SetValues, value: string[]): string[] { function decodeSetArray (setValues: SetValues, values: string[]): string[] {
return value.reduce<string[]>((result, key): string[] => { const result = new Array<string>(values.length);
for (let i = 0; i < values.length; i++) {
const key = values[i];
assert(!isUndefined(setValues[key]), () => `Set: Invalid key '${key}' passed to Set, allowed ${Object.keys(setValues).join(', ')}`); assert(!isUndefined(setValues[key]), () => `Set: Invalid key '${key}' passed to Set, allowed ${Object.keys(setValues).join(', ')}`);
result.push(key); result[i] = key;
}
return result; return result;
}, []);
} }
/** @internal */ /** @internal */
function decodeSetNumber (setValues: SetValues, _value: BN | number): string[] { function decodeSetNumber (setValues: SetValues, _value: BN | number): string[] {
const bn = bnToBn(_value); const bn = bnToBn(_value);
const result = Object.keys(setValues).reduce<string[]>((result, key): string[] => { const keys = Object.keys(setValues);
const result: string[] = [];
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (bn.and(bnToBn(setValues[key])).eq(bnToBn(setValues[key]))) { if (bn.and(bnToBn(setValues[key])).eq(bnToBn(setValues[key]))) {
result.push(key); result.push(key);
} }
}
return result;
}, []);
const computed = encodeSet(setValues, result); const computed = encodeSet(setValues, result);
@@ -51,12 +63,12 @@ function decodeSet (setValues: SetValues, value: string[] | Set<string> | Uint8A
const byteLength = bitLength / 8; const byteLength = bitLength / 8;
if (isString(value)) { if (isU8a(value)) {
return decodeSet(setValues, u8aToU8a(value), byteLength);
} else if (isU8a(value)) {
return value.length === 0 return value.length === 0
? [] ? []
: decodeSetNumber(setValues, u8aToBn(value.subarray(0, byteLength), { isLe: true })); : decodeSetNumber(setValues, u8aToBn(value.subarray(0, byteLength), { isLe: true }));
} else if (isString(value)) {
return decodeSet(setValues, u8aToU8a(value), byteLength);
} else if (value instanceof Set || Array.isArray(value)) { } else if (value instanceof Set || Array.isArray(value)) {
const input = Array.isArray(value) const input = Array.isArray(value)
? value ? value
@@ -92,19 +104,18 @@ export class CodecSet extends Set<string> implements ISet<string> {
} }
public static with (values: SetValues, bitLength?: number): Constructor<CodecSet> { public static with (values: SetValues, bitLength?: number): Constructor<CodecSet> {
const keys = Object.keys(values);
const isKeys = new Array<string>(keys.length);
for (let i = 0; i < keys.length; i++) {
isKeys[i] = `is${stringUpperFirst(stringCamelCase(keys[i]))}`;
}
return class extends CodecSet { return class extends CodecSet {
constructor (registry: Registry, value?: unknown) { constructor (registry: Registry, value?: unknown) {
super(registry, values, value as undefined, bitLength); super(registry, values, value as undefined, bitLength);
Object.keys(values).forEach((_key): void => { objectProperties(this, isKeys, (_, i) => this.strings.includes(keys[i]));
const iskey = `is${stringUpperFirst(stringCamelCase(_key))}`;
isUndefined(this[iskey as keyof this]) &&
Object.defineProperty(this, iskey, {
enumerable: true,
get: () => this.strings.includes(_key)
});
});
} }
}; };
} }
@@ -177,7 +188,7 @@ export class CodecSet extends Set<string> implements ISet<string> {
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (): string { public toHex (): HexString {
return u8aToHex(this.toU8a()); return u8aToHex(this.toU8a());
} }
+11 -14
View File
@@ -52,15 +52,16 @@ describe('Struct', (): void => {
testEncode('toString', '{"foo":"bazzing","bar":69}'); testEncode('toString', '{"foo":"bazzing","bar":69}');
}); });
it('decodes null', (): void => { it('decodes null/undefined/empty correctly (& equivalently)', (): void => {
expect( const Clazz = Struct.with({
new ( txt: Text,
Struct.with({ u32: U32
txt: Text, });
u32: U32 const expected = { txt: '', u32: '0' };
})
)(registry, null).toString() expect(new Clazz(registry, {}).toHuman()).toEqual(expected);
).toEqual('{}'); expect(new Clazz(registry, null).toHuman()).toEqual(expected);
expect(new Clazz(registry, undefined).toHuman()).toEqual(expected);
}); });
it('decodes reusing instantiated inputs', (): void => { it('decodes reusing instantiated inputs', (): void => {
@@ -110,15 +111,11 @@ describe('Struct', (): void => {
}); });
it('decodes from a Map input', (): void => { it('decodes from a Map input', (): void => {
const input = new Struct(registry, {
a: U32,
txt: Text
}, { a: 42, txt: 'fubar' });
const s = new Struct(registry, { const s = new Struct(registry, {
txt: Text, txt: Text,
foo: U32, foo: U32,
bar: U32 bar: U32
}, input); }, new Map<string, unknown>([['a', 42], ['txt', 'fubar']]));
expect(s.toString()).toEqual('{"txt":"fubar","foo":0,"bar":0}'); expect(s.toString()).toEqual('{"txt":"fubar","foo":0,"bar":0}');
}); });
+104 -122
View File
@@ -1,71 +1,63 @@
// Copyright 2017-2021 @polkadot/types authors & contributors // Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { CodecHash, Hash } from '../interfaces/runtime'; import type { CodecHash, Hash } from '../interfaces/runtime';
import type { AnyJson, BareOpts, Codec, Constructor, ConstructorDef, IStruct, Registry } from '../types'; import type { AnyJson, BareOpts, Codec, Constructor, ConstructorDef, IStruct, Registry } from '../types';
import { assert, hexToU8a, isBoolean, isFunction, isHex, isObject, isU8a, isUndefined, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util'; import { assert, hexToU8a, isBoolean, isFunction, isHex, isObject, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
import { compareMap, decodeU8a, mapToTypeMap } from './utils'; import { compareMap, decodeU8a, mapToTypeMap, typesToMap } from './utils';
type TypesDef<T = Codec> = Record<string, string | Constructor<T>>; type TypesDef<T = Codec> = Record<string, string | Constructor<T>>;
/** @internal */ /** @internal */
function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<any, string>): T { function decodeStructFromObject (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<string, string>): Iterable<[string, Codec]> {
let jsonObj: Record<string, any> | undefined; let jsonObj: Record<string, unknown> | undefined;
const inputKeys = Object.keys(Types); const inputKeys = Object.keys(Types);
const typeofArray = Array.isArray(value);
const typeofMap = value instanceof Map;
assert(!Array.isArray(value) || value.length === inputKeys.length, () => `Struct: Unable to map ${stringify(value)} array to object with known keys ${inputKeys.join(', ')}`); assert(typeofArray || typeofMap || isObject(value), () => `Struct: Cannot decode value ${stringify(value)} (typeof ${typeof value}), expected an input object, map or array`);
assert(!typeofArray || value.length === inputKeys.length, () => `Struct: Unable to map ${stringify(value)} array to object with known keys ${inputKeys.join(', ')}`);
return inputKeys.reduce((raw, key, index): T => { const raw = new Array<[string, Codec]>(inputKeys.length);
// The key in the JSON can be snake_case (or other cases), but in our
// Types, result or any other maps, it's camelCase for (let i = 0; i < inputKeys.length; i++) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access const key = inputKeys[i];
const jsonKey = (jsonMap.get(key as any) && !value[key]) const jsonKey = jsonMap.get(key) || key;
? jsonMap.get(key as any)
: key;
const Type = Types[key]; const Type = Types[key];
let assign: unknown;
try { try {
if (Array.isArray(value)) { if (typeofArray) {
// TS2322: Type 'Codec' is not assignable to type 'T[keyof S]'. assign = value[i] as unknown;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access } else if (typeofMap) {
(raw as any)[key] = value[index] instanceof Type assign = jsonKey && value.get(jsonKey);
? value[index] } else {
: new Type(registry, value[index]); assign = jsonKey && value[jsonKey] as unknown;
} else if (value instanceof Map) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const mapped = value.get(jsonKey);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(raw as any)[key] = mapped instanceof Type
? mapped
: new Type(registry, mapped);
} else if (isObject(value)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
let assign = value[jsonKey as string];
if (isUndefined(assign)) { if (isUndefined(assign)) {
if (isUndefined(jsonObj)) { if (isUndefined(jsonObj)) {
jsonObj = Object.entries(value).reduce((all: Record<string, any>, [key, value]): Record<string, any> => { const entries = Object.entries(value);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
all[stringCamelCase(key)] = value;
return all; jsonObj = {};
}, {});
for (let e = 0; e < entries.length; e++) {
jsonObj[stringCamelCase(entries[e][0])] = entries[e][1];
}
} }
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment assign = jsonKey && jsonObj[jsonKey];
assign = jsonObj[jsonKey as string];
} }
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
(raw as any)[key] = assign instanceof Type
? assign
: new Type(registry, assign);
} else {
throw new Error(`Cannot decode value ${stringify(value)} (typeof ${typeof value}), expected an input object with known keys`);
} }
raw[i] = [
key,
assign instanceof Type
? assign
: new Type(registry, assign)
];
} catch (error) { } catch (error) {
let type = Type.name; let type = Type.name;
@@ -75,11 +67,15 @@ function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef,
// ignore // ignore
} }
throw new Error(`Struct: failed on ${jsonKey as string}: ${type}:: ${(error as Error).message}`); throw new Error(`Struct: failed on ${jsonKey}: ${type}:: ${(error as Error).message}`);
} }
}
return raw; return raw;
}, {} as T); }
function decodeZip (k: string, v: Codec): [string, Codec] {
return [k, v];
} }
/** /**
@@ -98,27 +94,17 @@ function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef,
* @param jsonMap * @param jsonMap
* @internal * @internal
*/ */
function decodeStruct <T> (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<any, string>): T { function decodeStruct (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<string, string>): [Iterable<[string, Codec]>, number] {
if (isHex(value)) { if (isU8a(value)) {
return decodeU8a(registry, value, Types, decodeZip);
} else if (value instanceof Struct) {
return [value as Iterable<[string, Codec]>, 0];
} else if (isHex(value)) {
return decodeStruct(registry, Types, hexToU8a(value), jsonMap); return decodeStruct(registry, Types, hexToU8a(value), jsonMap);
} else if (isU8a(value)) {
const keys = Object.keys(Types);
const values = decodeU8a(registry, value, Object.values(Types), keys);
// Transform array of values to {key: value} mapping
return keys.reduce((raw, key, index): T => {
// TS2322: Type 'Codec' is not assignable to type 'T[keyof S]'.
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(raw as any)[key] = values[index];
return raw;
}, {} as T);
} else if (!value) {
return {} as T;
} }
// We assume from here that value is a JS object (Array, Map, Object) // We assume from here that value is a JS object (Array, Map, Object)
return decodeStructFromObject(registry, Types, value, jsonMap); return [decodeStructFromObject(registry, Types, value || {}, jsonMap), 0];
} }
/** /**
@@ -142,43 +128,36 @@ export class Struct<
public createdAtHash?: Hash; public createdAtHash?: Hash;
readonly initialU8aLength?: number;
readonly #jsonMap: Map<keyof S, string>; readonly #jsonMap: Map<keyof S, string>;
readonly #Types: ConstructorDef; readonly #Types: ConstructorDef;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
constructor (registry: Registry, Types: S, value: V | Map<unknown, unknown> | unknown[] | string = {} as V, jsonMap: Map<keyof S, string> = new Map()) { constructor (registry: Registry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap = new Map<string, string>()) {
super(Object.entries(decodeStruct(registry, mapToTypeMap(registry, Types), value, jsonMap))); const [decoded, decodedLength] = decodeStruct(registry, mapToTypeMap(registry, Types), value, jsonMap);
super(decoded);
this.registry = registry; this.registry = registry;
this.initialU8aLength = decodedLength;
this.#jsonMap = jsonMap; this.#jsonMap = jsonMap;
this.#Types = mapToTypeMap(registry, Types); this.#Types = mapToTypeMap(registry, Types);
} }
public static with<S extends TypesDef> (Types: S, jsonMap?: Map<keyof S, string>): Constructor<Struct<S>> { public static with<S extends TypesDef> (Types: S, jsonMap?: Map<string, string>): Constructor<Struct<S>> {
const keys = Object.keys(Types);
return class extends Struct<S> { return class extends Struct<S> {
constructor (registry: Registry, value?: unknown) { constructor (registry: Registry, value?: unknown) {
super(registry, Types, value as string, jsonMap); super(registry, Types, value as HexString, jsonMap);
Object.keys(Types).forEach((key): void => { objectProperties(this, keys, (k) => this.get(k));
isUndefined(this[key as keyof this]) &&
Object.defineProperty(this, key, {
enumerable: true,
get: (): Codec | undefined => this.get(key as keyof S)
});
});
} }
}; };
} }
public static typesToMap (registry: Registry, Types: Record<string, Constructor>): Record<string, string> {
return Object.entries(Types).reduce((result: Record<string, string>, [key, Type]): Record<string, string> => {
result[key] = registry.getClassName(Type) || new Type(registry).toRawType();
return result;
}, {});
}
/** /**
* @description The available keys for this struct * @description The available keys for this struct
*/ */
@@ -190,10 +169,8 @@ export class Struct<
* @description Checks if the value is an empty value * @description Checks if the value is an empty value
*/ */
public get isEmpty (): boolean { public get isEmpty (): boolean {
const items = this.toArray(); for (const v of this.values()) {
if (!v.isEmpty) {
for (let i = 0; i < items.length; i++) {
if (!items[i].isEmpty) {
return false; return false;
} }
} }
@@ -202,28 +179,32 @@ export class Struct<
} }
/** /**
* @description Returns the Type description to sthe structure * @description Returns the Type description of the structure
*/ */
public get Type (): E { public get Type (): E {
return (Object const result: Record<string, string> = {};
.entries(this.#Types)) const defs = Object.entries(this.#Types);
.reduce((result: E, [key, Type]): E => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(result as any)[key] = new Type(this.registry).toRawType();
return result; for (let i = 0; i < defs.length; i++) {
}, {} as E); const [key, Type] = defs[i];
result[key] = new Type(this.registry).toRawType();
}
return result as E;
} }
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public get encodedLength (): number {
return this.toArray().reduce((length, entry): number => { let total = 0;
length += entry.encodedLength;
return length; for (const v of this.values()) {
}, 0); total += v.encodedLength;
}
return total;
} }
/** /**
@@ -265,7 +246,7 @@ export class Struct<
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (): string { public toHex (): HexString {
return u8aToHex(this.toU8a()); return u8aToHex(this.toU8a());
} }
@@ -273,34 +254,35 @@ export class Struct<
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (isExtended?: boolean): Record<string, AnyJson> { public toHuman (isExtended?: boolean): Record<string, AnyJson> {
return [...this.keys()].reduce((json: Record<string, AnyJson>, key): Record<string, AnyJson> => { const json: Record<string, AnyJson> = {};
const value = this.get(key);
json[key as string] = value && value.toHuman(isExtended); for (const [k, v] of this.entries()) {
json[k as string] = v && v.toHuman(isExtended);
}
return json; return json;
}, {});
} }
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @description Converts the Object to JSON, typically used for RPC transfers
*/ */
public toJSON (): Record<string, AnyJson> { public toJSON (): Record<string, AnyJson> {
return [...this.keys()].reduce((json: Record<string, AnyJson>, key): Record<string, AnyJson> => { const json: Record<string, AnyJson> = {};
const jsonKey = this.#jsonMap.get(key) || key;
const value = this.get(key);
json[jsonKey as string] = value && value.toJSON(); for (const [k, v] of this.entries()) {
const jsonKey = this.#jsonMap.get(k) || k;
return json; json[jsonKey as string] = v && v.toJSON();
}, {}); }
return json;
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public toRawType (): string {
return stringify(Struct.typesToMap(this.registry, this.#Types)); return stringify(typesToMap(this.registry, this.#Types));
} }
/** /**
@@ -315,20 +297,20 @@ export class Struct<
* @param isBare true when the value has none of the type-specific prefixes (internal) * @param isBare true when the value has none of the type-specific prefixes (internal)
*/ */
public toU8a (isBare?: BareOpts): Uint8Array { public toU8a (isBare?: BareOpts): Uint8Array {
// we have keyof S here, cast to string to make it compatible with isBare const encoded: Uint8Array[] = [];
const entries = [...this.entries()] as [string, Codec][];
return u8aConcat( for (const [k, v] of this.entries()) {
...entries if (v && isFunction(v.toU8a)) {
// eslint-disable-next-line @typescript-eslint/unbound-method encoded.push(
.filter(([, value]) => isFunction(value?.toU8a)) v.toU8a(
.map(([key, value]): Uint8Array =>
value.toU8a(
!isBare || isBoolean(isBare) !isBare || isBoolean(isBare)
? isBare ? isBare
: isBare[key] : isBare[k]
) )
) );
); }
}
return u8aConcat(...encoded);
} }
} }
+41 -29
View File
@@ -21,7 +21,7 @@ type TupleTypes = TupleType[] | {
}; };
/** @internal */ /** @internal */
function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: AnyTupleValue): Codec[] { function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: AnyTupleValue): [Codec[], number] {
if (isU8a(value) || isHex(value)) { if (isU8a(value) || isHex(value)) {
return decodeU8a(registry, u8aToU8a(value), _Types); return decodeU8a(registry, u8aToU8a(value), _Types);
} }
@@ -30,19 +30,22 @@ function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: Any
? _Types ? _Types
: Object.values(_Types); : Object.values(_Types);
return Types.map((Type, index): Codec => { return [
try { Types.map((Type, index): Codec => {
const entry = value?.[index]; try {
const entry = value?.[index];
if (entry instanceof Type) { if (entry instanceof Type) {
return entry; return entry;
}
return new Type(registry, entry);
} catch (error) {
throw new Error(`Tuple: failed on ${index}:: ${(error as Error).message}`);
} }
}),
return new Type(registry, entry); 0
} catch (error) { ];
throw new Error(`Tuple: failed on ${index}:: ${(error as Error).message}`);
}
});
} }
/** /**
@@ -52,7 +55,7 @@ function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: Any
* own type. It extends the base JS `Array` object. * own type. It extends the base JS `Array` object.
*/ */
export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> { export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
private _Types: TupleConstructors; #Types: TupleConstructors;
constructor (registry: Registry, Types: TupleTypes | TupleType, value?: AnyTupleValue) { constructor (registry: Registry, Types: TupleTypes | TupleType, value?: AnyTupleValue) {
const Clazzes = Array.isArray(Types) const Clazzes = Array.isArray(Types)
@@ -60,10 +63,11 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
: isFunction(Types) || isString(Types) : isFunction(Types) || isString(Types)
? [typeToConstructor(registry, Types)] ? [typeToConstructor(registry, Types)]
: mapToTypeMap(registry, Types); : mapToTypeMap(registry, Types);
const [values, decodedLength] = decodeTuple(registry, Clazzes, value);
super(registry, decodeTuple(registry, Clazzes, value)); super(registry, values, decodedLength);
this._Types = Clazzes; this.#Types = Clazzes;
} }
public static with (Types: TupleTypes | TupleType): Constructor<Tuple> { public static with (Types: TupleTypes | TupleType): Constructor<Tuple> {
@@ -78,16 +82,22 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public override get encodedLength (): number { public override get encodedLength (): number {
return this.reduce((total, entry) => total + entry.encodedLength, 0); let total = 0;
for (let i = 0; i < this.length; i++) {
total += this[i].encodedLength;
}
return total;
} }
/** /**
* @description The types definition of the tuple * @description The types definition of the tuple
*/ */
public get Types (): string[] { public get Types (): string[] {
return Array.isArray(this._Types) return Array.isArray(this.#Types)
? this._Types.map((Type) => new Type(this.registry).toRawType()) ? this.#Types.map((T) => new T(this.registry).toRawType())
: Object.keys(this._Types); : Object.keys(this.#Types);
} }
/** /**
@@ -95,11 +105,11 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
*/ */
public toRawType (): string { public toRawType (): string {
const types = ( const types = (
Array.isArray(this._Types) Array.isArray(this.#Types)
? this._Types ? this.#Types
: Object.values(this._Types) : Object.values(this.#Types)
).map((Type) => ).map((T) =>
this.registry.getClassName(Type) || new Type(this.registry).toRawType() this.registry.getClassName(T) || new T(this.registry).toRawType()
); );
return `(${types.join(',')})`; return `(${types.join(',')})`;
@@ -118,10 +128,12 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
* @param isBare true when the value has none of the type-specific prefixes (internal) * @param isBare true when the value has none of the type-specific prefixes (internal)
*/ */
public override toU8a (isBare?: boolean): Uint8Array { public override toU8a (isBare?: boolean): Uint8Array {
return u8aConcat( const encoded = new Array<Uint8Array>(this.length);
...this.map((entry): Uint8Array =>
entry.toU8a(isBare) for (let i = 0; i < this.length; i++) {
) encoded[i] = this[i].toU8a(isBare);
); }
return u8aConcat(...encoded);
} }
} }
+16 -15
View File
@@ -4,26 +4,25 @@
import type { AnyU8a, Constructor, Registry } from '../types'; import type { AnyU8a, Constructor, Registry } from '../types';
import type { U8aBitLength } from './types'; import type { U8aBitLength } from './types';
import { assert, isString, u8aToU8a } from '@polkadot/util'; import { assert, isU8a, u8aToU8a } from '@polkadot/util';
import { Raw } from './Raw'; import { Raw } from './Raw';
/** @internal */ /** @internal */
function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): AnyU8a { function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): [AnyU8a, number] {
if (Array.isArray(value) || isString(value)) { if (isU8a(value)) {
return decodeU8aFixed(u8aToU8a(value), bitLength); const byteLength = bitLength / 8;
if (!value || !value.length) {
return [new Uint8Array(byteLength), 0];
}
assert(value.length >= byteLength, () => `Expected at least ${byteLength} bytes (${bitLength} bits), found ${value.length} bytes`);
return [value.subarray(0, byteLength), byteLength];
} }
const byteLength = bitLength / 8; return decodeU8aFixed(u8aToU8a(value), bitLength);
const u8a = new Uint8Array(byteLength);
if (!value || !value.length) {
return u8a;
}
assert(value.length >= byteLength, () => `Expected at least ${byteLength} bytes (${bitLength} bits), found ${value.length} bytes`);
return value.subarray(0, byteLength);
} }
/** /**
@@ -34,7 +33,9 @@ function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): AnyU8a {
*/ */
export class U8aFixed extends Raw { export class U8aFixed extends Raw {
constructor (registry: Registry, value: AnyU8a = new Uint8Array(), bitLength: U8aBitLength = 256) { constructor (registry: Registry, value: AnyU8a = new Uint8Array(), bitLength: U8aBitLength = 256) {
super(registry, decodeU8aFixed(value, bitLength)); const [u8a, decodedLength] = decodeU8aFixed(value, bitLength);
super(registry, u8a, decodedLength);
} }
public static with (bitLength: U8aBitLength, typeName?: string): Constructor<U8aFixed> { public static with (bitLength: U8aBitLength, typeName?: string): Constructor<U8aFixed> {

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