Compare commits

..
58 Commits
Author SHA1 Message Date
github-actions[bot] b363833a9f [CI Skip] release/stable 6.10.1
skip-checks: true
2021-11-29 06:45:19 +00:00
Jaco f083ea3861 6.10.1 (#4267) 2021-11-29 08:38:21 +02:00
github-actions[bot] f62e7f8bf9 [CI Skip] release/beta 6.9.3-6
skip-checks: true
2021-11-29 05:55:26 +00:00
Jaco fedb0a3f09 Re-order augmentation imports (#4266) 2021-11-29 07:46:34 +02:00
github-actions[bot] 38928448bf [CI Skip] release/beta 6.9.3-5
skip-checks: true
2021-11-26 12:54:56 +00:00
Jaco cfbde5f6bd Fix RPC non-available section init (#4263) 2021-11-26 14:47:54 +02:00
github-actions[bot] 4b0e0bc6d3 [CI Skip] release/beta 6.9.3-4
skip-checks: true
2021-11-26 10:51:45 +00:00
Jaco 9acb79f500 Bump common (#4262)
* Bump common

* Adjust
2021-11-26 12:45:02 +02:00
Github Actions 5dc0b38881 [CI Skip] release/beta 6.9.3-3
skip-checks: true
2021-11-24 14:59:43 +00:00
Jaco fab6f7e883 Adjust stale schedule (#4257) 2021-11-24 16:52:40 +02:00
Github Actions 66e635e909 [CI Skip] release/beta 6.9.3-2
skip-checks: true
2021-11-23 08:08:38 +00:00
Jaco 6e496d5a3c Add missing types -> types-known dep (#4252)
* Add missing types -> types-known dep

* Run install :)
2021-11-23 09:59:53 +02:00
Github Actions ca172c9a53 [CI Skip] release/beta 6.9.3-1
skip-checks: true
2021-11-22 09:49:34 +00:00
Jaco e9b83a9ff6 Bump static metadata (#4248)
* Bump static metadata

* metadata static json

* Adjust tests (new signed extensions)
2021-11-22 11:42:27 +02:00
Github Actions cf18d97b3a [CI Skip] release/beta 6.9.3-0
skip-checks: true
2021-11-22 06:41:45 +00:00
Jaco 0b1c715408 Bump dev (#4247) 2021-11-22 08:32:50 +02:00
Github Actions 5d493e1a03 [CI Skip] release/stable 6.9.2
skip-checks: true
2021-11-22 05:34:55 +00:00
Jaco e5437ef9e9 6.9.2 (#4246)
* 6.9.2

* Pull in new util
2021-11-22 07:26:47 +02:00
Github Actions b56bed39e1 [CI Skip] release/stable 6.9.1
skip-checks: true
2021-11-21 09:36:41 +00:00
Jaco e789f91850 6.9.1 (#4244) 2021-11-21 11:28:52 +02:00
Github Actions a236eb9453 [CI Skip] release/beta 6.8.2-18
skip-checks: true
2021-11-21 09:14:31 +00:00
Jaco 7ef01b8534 Bump common (#4243) 2021-11-21 11:06:08 +02:00
Github Actions 0e58545a9d [CI Skip] release/beta 6.8.2-17
skip-checks: true
2021-11-19 10:21:44 +00:00
Jaco c474123777 Bump common (#4239)
* Bump common

* CHANGELOG
2021-11-19 12:14:05 +02:00
Github Actions 93edfcf560 [CI Skip] release/beta 6.8.2-16
skip-checks: true
2021-11-19 07:59:40 +00:00
Daniel SavuandGithub Actions e5a67d82fa fix: Generate custom type definitions (#4224)
* fix: Generate custom type definitions

* Generate separate lookup types

* fix: Custom imports

* fix linting errors

Co-authored-by: Github Actions <action@github.com>
2021-11-19 09:51:51 +02:00
Github Actions 194f6aece1 [CI Skip] release/beta 6.8.2-15
skip-checks: true
2021-11-19 05:35:22 +00:00
Jaco 3b4fef8f6e Bump deps (#4238) 2021-11-19 07:26:28 +02:00
Github Actions 6c7323ee3a [CI Skip] release/beta 6.8.2-14
skip-checks: true
2021-11-18 20:00:39 +00:00
Jaco a97b50decb Additional isU8a decoding shortcuts (#4236) 2021-11-18 21:52:24 +02:00
Github Actions 52accf6444 [CI Skip] release/beta 6.8.2-13
skip-checks: true
2021-11-18 13:27:34 +00:00
Jaco 5b8eb231cc CHANGELOG (#4234) 2021-11-18 15:20:21 +02:00
Github Actions 5ea62367d3 [CI Skip] release/beta 6.8.2-12
skip-checks: true
2021-11-18 10:49:36 +00:00
Jaco 49a034a1a0 Place u8a decoding top-of-tree (#4230)
* Place u8a decoding top-of-tree

* Adjust
2021-11-18 12:41:27 +02:00
Github Actions 62a476cb4c [CI Skip] release/beta 6.8.2-11
skip-checks: true
2021-11-18 09:59:41 +00:00
Jaco b283673812 Squeek less recursion out of DetectCodec (#4232)
* Squeek less recursion out of DetectCodec

* Flatten more

* TS 4.5.2 for checking
2021-11-18 11:52:31 +02:00
Github Actions b6a075fefb [CI Skip] release/beta 6.8.2-10
skip-checks: true
2021-11-18 09:11:06 +00:00
Jaco afa844ae01 Bump deps (#4231) 2021-11-18 11:03:45 +02:00
Github Actions 353ef59a1c [CI Skip] release/beta 6.8.2-9
skip-checks: true
2021-11-18 06:32:55 +00:00
Jaco 6228999e6f Decoding cleanups (#4228)
* Decoding cleanups

* CHANGELOG

* Additional adjustments

* Adjust

* Ordering
2021-11-18 08:24:52 +02:00
Github Actions 56db42fedf [CI Skip] release/beta 6.8.2-8
skip-checks: true
2021-11-18 04:48:36 +00:00
Jaco df44693e5d Use stringPascalCase from @polkadot/util (#4211) 2021-11-18 06:40:28 +02:00
Github Actions cfa25f8dda [CI Skip] release/beta 6.8.2-7
skip-checks: true
2021-11-18 04:01:38 +00:00
Jaco bc8934f3c3 Ensure generation of Call/Event enums (#4226) 2021-11-18 05:53:54 +02:00
Github Actions bc67c72e9b [CI Skip] release/beta 6.8.2-6
skip-checks: true
2021-11-17 12:26:35 +00:00
Jaco 22d85e745a Bump deps (#4221)
* Bump deps

* Adjust

* Adjust
2021-11-17 14:19:21 +02:00
Github Actions 60ba2952f7 [CI Skip] release/beta 6.8.2-5
skip-checks: true
2021-11-17 08:28:22 +00:00
Jaco bb10d2813f Expand runtime Call/Event matching (#4220)
* Expand runtime Call/Event matching

* Adjust * matching

* CHANGELOG
2021-11-17 10:18:55 +02:00
Github Actions 80b581f0df [CI Skip] release/beta 6.8.2-4
skip-checks: true
2021-11-13 06:00:08 +00:00
Jaco ef37c421ac Option toJSON output same as from Substrate input (#4212)
* Option toJSON output same as from Substrate input

* CHANGELOG
2021-11-13 07:53:15 +02:00
Github Actions 6e1e8e622b [CI Skip] release/beta 6.8.2-3
skip-checks: true
2021-11-13 05:41:31 +00:00
Jaco ec38a1510f CHANGELOG (#4210) 2021-11-13 07:33:18 +02:00
Github Actions e550ca5a71 [CI Skip] release/beta 6.8.2-2
skip-checks: true
2021-11-12 10:56:32 +00:00
Jaco 80241f732f Split base/essential definition handling (#4206)
* Split base/essential definition handling

* Adjust
2021-11-12 12:47:34 +02:00
Github Actions 84fc0be12e [CI Skip] release/beta 6.8.2-1
skip-checks: true
2021-11-12 08:53:05 +00:00
flex e1f14e8a83 Change BeefySignedCommitment signatures type to EcdsaSignature (#4204) 2021-11-12 10:45:09 +02:00
Github Actions 1155724604 [CI Skip] release/beta 6.8.2-0
skip-checks: true
2021-11-11 12:55:42 +00:00
Jaco 3bb9541943 Bump deps (#4203) 2021-11-11 14:47:26 +02:00
94 changed files with 17360 additions and 11263 deletions
+2 -1
View File
@@ -42,4 +42,5 @@
6.4.2 6.4.2
6.5.2 6.5.2
6.7.2 6.7.2
6.9.2
+1 -1
View File
@@ -2,7 +2,7 @@ name: 'Lock Threads'
on: on:
schedule: schedule:
- cron: '30 1/2 * * *' - cron: '10 1 * * *'
jobs: jobs:
lock: lock:
+1 -1
View File
@@ -1,7 +1,7 @@
name: 'Close stale issues and PRs' name: 'Close stale issues and PRs'
on: on:
schedule: schedule:
- cron: '30 2/2 * * *' - cron: '55 1 * * *'
jobs: jobs:
stale: stale:
+41
View File
@@ -1,5 +1,46 @@
# CHANGELOG # CHANGELOG
## 6.10.1 Nov 29, 2021
Upgrade priority: Low. Recommended for users of `HttpProvider` and for chains generating types using TS augmentation.
Changes:
- Fix for HttpProvider init (RPC sections with only subscriptions)
- Re-order imports in lookup type augmentation interfaces
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 6.9.2 Nov 22, 2021
Upgrade priority: Medium. Pulls in `@polkadot/util-crypto` fix for TS projects.
Changes:
- Update `@polkadot/util-crypto` with TS compilation work-around
## 6.9.1 Nov 21, 2021
Upgrade priority: Medium. Recommended for metadata v14 parachains. For TS users, the package now support TypeScript 4.5.2 and allows extraction of user types from metadata v14.
Contributed:
- Lookup TS generation for all metadata v14 chains (Thanks to https://github.com/savudani8)
- Update `BeefySignedCommitment` type (Thanks to https://github.com/czl1378)
Changes:
- Adjust runtime `*::{Call, Event}` matching for metadata v14
- Adjust derive decoration with (optional) known methods
- Expose `*{Call, Event, Error}` TS types for metadata v14
- Align Option `.toJSON` output with Substrate input
- Optimize Enum, Struct, Option & Number decoding paths
- Ajust PascalCase conversions with function from util
- Prepare pre-v13 types for optional injection
- Adjustments for TS 4.5.2 support (flatten type infers)
## 6.8.1 Nov 11, 2021 ## 6.8.1 Nov 11, 2021
Upgrade priority: Low. Recommended for chains with non-MultiSignature variants where `paymentInfo` is required. Upgrade priority: Low. Recommended for chains with non-MultiSignature variants where `paymentInfo` is required.
+6 -6
View File
@@ -11,7 +11,7 @@
}, },
"sideEffects": false, "sideEffects": false,
"type": "commonjs", "type": "commonjs",
"version": "6.8.1", "version": "6.10.1",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
@@ -33,14 +33,14 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.0", "@babel/core": "^7.16.0",
"@babel/register": "^7.16.0", "@babel/register": "^7.16.0",
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/dev": "^0.63.27", "@polkadot/dev": "^0.63.33",
"@polkadot/ts": "^0.4.13", "@polkadot/ts": "^0.4.15",
"@polkadot/typegen": "workspace:packages/typegen", "@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^27.0.2", "@types/jest": "^27.0.3",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
}, },
"resolutions": { "resolutions": {
"typescript": "^4.4.4" "typescript": "^4.5.2"
} }
} }
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/api": "6.8.1", "@polkadot/api": "6.10.1",
"@polkadot/types": "6.8.1", "@polkadot/types": "6.10.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.0.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
} }
} }
+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.8.1' }; export const packageInfo = { name: '@polkadot/api-contract', version: '6.10.1' };
+9 -9
View File
@@ -20,19 +20,19 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/api": "6.8.1", "@polkadot/api": "6.10.1",
"@polkadot/rpc-core": "6.8.1", "@polkadot/rpc-core": "6.10.1",
"@polkadot/types": "6.8.1", "@polkadot/types": "6.10.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.0.2",
"@polkadot/util-crypto": "^7.8.2", "@polkadot/util-crypto": "^8.0.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.8.2", "@polkadot/keyring": "^8.0.2",
"@polkadot/rpc-provider": "6.8.1" "@polkadot/rpc-provider": "6.10.1"
} }
} }
+74 -16
View File
@@ -30,6 +30,7 @@ export * from './type';
interface Avail { interface Avail {
instances: string[]; instances: string[];
methods: string[];
withDetect?: boolean; withDetect?: boolean;
} }
@@ -54,19 +55,61 @@ export type ExactDerive = DeriveAllSections<typeof derive>;
// Enable derive only if some of these modules are available // Enable derive only if some of these modules are available
const checks: Record<string, Avail> = { const checks: Record<string, Avail> = {
contracts: { instances: ['contracts'] }, contracts: {
council: { instances: ['council'], withDetect: true }, instances: ['contracts'],
crowdloan: { instances: ['crowdloan'] }, methods: []
democracy: { instances: ['democracy'] }, },
elections: { instances: ['phragmenElection', 'electionsPhragmen', 'elections', 'council'], withDetect: true }, council: {
imOnline: { instances: ['imOnline'] }, instances: ['council'],
membership: { instances: ['membership'] }, methods: [],
parachains: { instances: ['parachains', 'registrar'] }, withDetect: true
session: { instances: ['session'] }, },
society: { instances: ['society'] }, crowdloan: {
staking: { instances: ['staking'] }, instances: ['crowdloan'],
technicalCommittee: { instances: ['technicalCommittee'], withDetect: true }, methods: []
treasury: { instances: ['treasury'] } },
democracy: {
instances: ['democracy'],
methods: []
},
elections: {
instances: ['phragmenElection', 'electionsPhragmen', 'elections', 'council'],
methods: [],
withDetect: true
},
imOnline: {
instances: ['imOnline'],
methods: []
},
membership: {
instances: ['membership'],
methods: []
},
parachains: {
instances: ['parachains', 'registrar'],
methods: []
},
session: {
instances: ['session'],
methods: []
},
society: {
instances: ['society'],
methods: []
},
staking: {
instances: ['staking'],
methods: ['erasRewardPoints']
},
technicalCommittee: {
instances: ['technicalCommittee'],
methods: [],
withDetect: true
},
treasury: {
instances: ['treasury'],
methods: []
}
}; };
function getModuleInstances (api: ApiInterfaceRx, specName: string, moduleName: string): string[] { function getModuleInstances (api: ApiInterfaceRx, specName: string, moduleName: string): string[] {
@@ -88,12 +131,27 @@ function injectFunctions (instanceId: string, api: ApiInterfaceRx, derives: Deri
const filterInstances = (q: string) => const filterInstances = (q: string) =>
getModuleInstances(api, specName, q).some(filterQueryKeys); getModuleInstances(api, specName, q).some(filterQueryKeys);
const filterMethods = (instances: string[]) =>
(m: string) =>
instances.some((q) =>
queryKeys.includes(q) &&
!!api.query[q][m]
);
const isIncluded = (s: string) => ( const isIncluded = (s: string) => (
!checks[s] || !checks[s] ||
checks[s].instances.some(filterQueryKeys) ||
( (
checks[s].withDetect && (
checks[s].instances.some(filterInstances) checks[s].instances.some(filterQueryKeys) &&
(
!checks[s].methods.length ||
checks[s].methods.every(filterMethods(checks[s].instances))
)
) ||
(
checks[s].withDetect &&
checks[s].instances.some(filterInstances)
)
) )
); );
+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.8.1' }; export const packageInfo = { name: '@polkadot/api-derive', version: '6.10.1' };
+10 -10
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/api-derive": "6.8.1", "@polkadot/api-derive": "6.10.1",
"@polkadot/keyring": "^7.8.2", "@polkadot/keyring": "^8.0.2",
"@polkadot/rpc-core": "6.8.1", "@polkadot/rpc-core": "6.10.1",
"@polkadot/rpc-provider": "6.8.1", "@polkadot/rpc-provider": "6.10.1",
"@polkadot/types": "6.8.1", "@polkadot/types": "6.10.1",
"@polkadot/types-known": "6.8.1", "@polkadot/types-known": "6.10.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.0.2",
"@polkadot/util-crypto": "^7.8.2", "@polkadot/util-crypto": "^8.0.2",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
} }
+1 -1
View File
@@ -741,7 +741,7 @@ declare module '@polkadot/api/types/consts' {
* that the runtime should know about the prefix in order to make use of it as * that the runtime should know about the prefix in order to make use of it as
* an identifier of the chain. * an identifier of the chain.
**/ **/
ss58Prefix: u16 & AugmentedConst<ApiType>; sS58Prefix: u16 & AugmentedConst<ApiType>;
/** /**
* Get the chain's current version. * Get the chain's current version.
**/ **/
+3 -1
View File
@@ -1172,7 +1172,9 @@ declare module '@polkadot/api/types/errors' {
**/ **/
IncorrectSlashingSpans: AugmentedError<ApiType>; IncorrectSlashingSpans: AugmentedError<ApiType>;
/** /**
* Can not bond with value less than minimum required. * Cannot have a validator or nominator role, with value less than the minimum defined by
* governance (see `MinValidatorBond` and `MinNominatorBond`). If unbonding is the
* intention, `chill` first to remove one's role as validator/nominator.
**/ **/
InsufficientBond: AugmentedError<ApiType>; InsufficientBond: AugmentedError<ApiType>;
/** /**
+98 -142
View File
@@ -12,33 +12,30 @@ declare module '@polkadot/api/types/events' {
assets: { assets: {
/** /**
* An approval for account `delegate` was cancelled by `owner`. * An approval for account `delegate` was cancelled by `owner`.
* \[id, owner, delegate\]
**/ **/
ApprovalCancelled: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>; ApprovalCancelled: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>;
/** /**
* (Additional) funds have been approved for transfer to a destination account. * (Additional) funds have been approved for transfer to a destination account.
* \[asset_id, source, delegate, amount\]
**/ **/
ApprovedTransfer: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, u64]>; ApprovedTransfer: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, u128]>;
/** /**
* Some asset `asset_id` was frozen. \[asset_id\] * Some asset `asset_id` was frozen.
**/ **/
AssetFrozen: AugmentedEvent<ApiType, [u32]>; AssetFrozen: AugmentedEvent<ApiType, [u32]>;
/** /**
* An asset has had its attributes changed by the `Force` origin. * An asset has had its attributes changed by the `Force` origin.
* \[id\]
**/ **/
AssetStatusChanged: AugmentedEvent<ApiType, [u32]>; AssetStatusChanged: AugmentedEvent<ApiType, [u32]>;
/** /**
* Some asset `asset_id` was thawed. \[asset_id\] * Some asset `asset_id` was thawed.
**/ **/
AssetThawed: AugmentedEvent<ApiType, [u32]>; AssetThawed: AugmentedEvent<ApiType, [u32]>;
/** /**
* Some assets were destroyed. \[asset_id, owner, balance\] * Some assets were destroyed.
**/ **/
Burned: AugmentedEvent<ApiType, [u32, AccountId32, u64]>; Burned: AugmentedEvent<ApiType, [u32, AccountId32, u128]>;
/** /**
* Some asset class was created. \[asset_id, creator, owner\] * Some asset class was created.
**/ **/
Created: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>; Created: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>;
/** /**
@@ -46,47 +43,46 @@ declare module '@polkadot/api/types/events' {
**/ **/
Destroyed: AugmentedEvent<ApiType, [u32]>; Destroyed: AugmentedEvent<ApiType, [u32]>;
/** /**
* Some asset class was force-created. \[asset_id, owner\] * Some asset class was force-created.
**/ **/
ForceCreated: AugmentedEvent<ApiType, [u32, AccountId32]>; ForceCreated: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Some account `who` was frozen. \[asset_id, who\] * Some account `who` was frozen.
**/ **/
Frozen: AugmentedEvent<ApiType, [u32, AccountId32]>; Frozen: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Some assets were issued. \[asset_id, owner, total_supply\] * Some assets were issued.
**/ **/
Issued: AugmentedEvent<ApiType, [u32, AccountId32, u64]>; Issued: AugmentedEvent<ApiType, [u32, AccountId32, u128]>;
/** /**
* Metadata has been cleared for an asset. \[asset_id\] * Metadata has been cleared for an asset.
**/ **/
MetadataCleared: AugmentedEvent<ApiType, [u32]>; MetadataCleared: AugmentedEvent<ApiType, [u32]>;
/** /**
* New metadata has been set for an asset. \[asset_id, name, symbol, decimals, is_frozen\] * New metadata has been set for an asset.
**/ **/
MetadataSet: AugmentedEvent<ApiType, [u32, Bytes, Bytes, u8, bool]>; MetadataSet: AugmentedEvent<ApiType, [u32, Bytes, Bytes, u8, bool]>;
/** /**
* The owner changed \[asset_id, owner\] * The owner changed.
**/ **/
OwnerChanged: AugmentedEvent<ApiType, [u32, AccountId32]>; OwnerChanged: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* The management team changed \[asset_id, issuer, admin, freezer\] * The management team changed.
**/ **/
TeamChanged: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32]>; TeamChanged: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32]>;
/** /**
* Some account `who` was thawed. \[asset_id, who\] * Some account `who` was thawed.
**/ **/
Thawed: AugmentedEvent<ApiType, [u32, AccountId32]>; Thawed: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Some assets were transferred. \[asset_id, from, to, amount\] * Some assets were transferred.
**/ **/
Transferred: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, u64]>; Transferred: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, u128]>;
/** /**
* An `amount` was transferred in its entirety from `owner` to `destination` by * An `amount` was transferred in its entirety from `owner` to `destination` by
* the approved `delegate`. * the approved `delegate`.
* \[id, owner, delegate, destination\]
**/ **/
TransferredApproved: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32, u64]>; TransferredApproved: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32, u128]>;
/** /**
* Generic event * Generic event
**/ **/
@@ -94,7 +90,7 @@ declare module '@polkadot/api/types/events' {
}; };
bagsList: { bagsList: {
/** /**
* Moved an account from one bag to another. \[who, from, to\]. * Moved an account from one bag to another.
**/ **/
Rebagged: AugmentedEvent<ApiType, [AccountId32, u64, u64]>; Rebagged: AugmentedEvent<ApiType, [AccountId32, u64, u64]>;
/** /**
@@ -104,48 +100,45 @@ declare module '@polkadot/api/types/events' {
}; };
balances: { balances: {
/** /**
* A balance was set by root. \[who, free, reserved\] * A balance was set by root.
**/ **/
BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>; BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>;
/** /**
* Some amount was deposited into the account (e.g. for transaction fees). \[who, * Some amount was deposited (e.g. for transaction fees).
* deposit\]
**/ **/
Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>; Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* An account was removed whose balance was non-zero but below ExistentialDeposit, * An account was removed whose balance was non-zero but below ExistentialDeposit,
* resulting in an outright loss. \[account, balance\] * resulting in an outright loss.
**/ **/
DustLost: AugmentedEvent<ApiType, [AccountId32, u128]>; DustLost: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* An account was created with some free balance. \[account, free_balance\] * An account was created with some free balance.
**/ **/
Endowed: AugmentedEvent<ApiType, [AccountId32, u128]>; Endowed: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Some balance was reserved (moved from free to reserved). \[who, value\] * Some balance was reserved (moved from free to reserved).
**/ **/
Reserved: AugmentedEvent<ApiType, [AccountId32, u128]>; Reserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Some balance was moved from the reserve of the first account to the second account. * Some balance was moved from the reserve of the first account to the second account.
* Final argument indicates the destination balance type. * Final argument indicates the destination balance type.
* \[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, * Some amount was removed from the account (e.g. for misbehavior).
* amount_slashed\]
**/ **/
Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>; Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Transfer succeeded. \[from, to, value\] * Transfer succeeded.
**/ **/
Transfer: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; Transfer: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
/** /**
* Some balance was unreserved (moved from reserved to free). \[who, value\] * Some balance was unreserved (moved from reserved to free).
**/ **/
Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>; Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* Some amount was withdrawn from the account (e.g. for transaction fees). \[who, value\] * Some amount was withdrawn from the account (e.g. for transaction fees).
**/ **/
Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>; Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
@@ -155,31 +148,31 @@ declare module '@polkadot/api/types/events' {
}; };
bounties: { bounties: {
/** /**
* A bounty is awarded to a beneficiary. \[index, beneficiary\] * A bounty is awarded to a beneficiary.
**/ **/
BountyAwarded: AugmentedEvent<ApiType, [u32, AccountId32]>; BountyAwarded: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* A bounty proposal is funded and became active. \[index\] * A bounty proposal is funded and became active.
**/ **/
BountyBecameActive: AugmentedEvent<ApiType, [u32]>; BountyBecameActive: AugmentedEvent<ApiType, [u32]>;
/** /**
* A bounty is cancelled. \[index\] * A bounty is cancelled.
**/ **/
BountyCanceled: AugmentedEvent<ApiType, [u32]>; BountyCanceled: AugmentedEvent<ApiType, [u32]>;
/** /**
* A bounty is claimed by beneficiary. \[index, payout, beneficiary\] * A bounty is claimed by beneficiary.
**/ **/
BountyClaimed: AugmentedEvent<ApiType, [u32, u128, AccountId32]>; BountyClaimed: AugmentedEvent<ApiType, [u32, u128, AccountId32]>;
/** /**
* A bounty expiry is extended. \[index\] * A bounty expiry is extended.
**/ **/
BountyExtended: AugmentedEvent<ApiType, [u32]>; BountyExtended: AugmentedEvent<ApiType, [u32]>;
/** /**
* New bounty proposal. \[index\] * New bounty proposal.
**/ **/
BountyProposed: AugmentedEvent<ApiType, [u32]>; BountyProposed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A bounty proposal was rejected; funds were slashed. \[index, bond\] * A bounty proposal was rejected; funds were slashed.
**/ **/
BountyRejected: AugmentedEvent<ApiType, [u32, u128]>; BountyRejected: AugmentedEvent<ApiType, [u32, u128]>;
/** /**
@@ -227,39 +220,32 @@ declare module '@polkadot/api/types/events' {
council: { council: {
/** /**
* A motion was approved by the required threshold. * A motion was approved by the required threshold.
* \[proposal_hash\]
**/ **/
Approved: AugmentedEvent<ApiType, [H256]>; Approved: AugmentedEvent<ApiType, [H256]>;
/** /**
* A proposal was closed because its threshold was reached or after its duration was up. * A proposal was closed because its threshold was reached or after its duration was up.
* \[proposal_hash, yes, no\]
**/ **/
Closed: AugmentedEvent<ApiType, [H256, u32, u32]>; Closed: AugmentedEvent<ApiType, [H256, u32, u32]>;
/** /**
* A motion was not approved by the required threshold. * A motion was not approved by the required threshold.
* \[proposal_hash\]
**/ **/
Disapproved: AugmentedEvent<ApiType, [H256]>; Disapproved: AugmentedEvent<ApiType, [H256]>;
/** /**
* A motion was executed; result will be `Ok` if it returned without error. * A motion was executed; result will be `Ok` if it returned without error.
* \[proposal_hash, result\]
**/ **/
Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A single member did some action; result will be `Ok` if it returned without error. * A single member did some action; result will be `Ok` if it returned without error.
* \[proposal_hash, result\]
**/ **/
MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A motion (given hash) has been proposed (by given account) with a threshold (given * A motion (given hash) has been proposed (by given account) with a threshold (given
* `MemberCount`). * `MemberCount`).
* \[account, proposal_index, proposal_hash, threshold\]
**/ **/
Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>; Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>;
/** /**
* A motion (given hash) has been voted on by given account, leaving * A motion (given hash) has been voted on by given account, leaving
* a tally (yes votes and no votes given respectively as `MemberCount`). * a tally (yes votes and no votes given respectively as `MemberCount`).
* \[account, proposal_hash, voted, yes, no\]
**/ **/
Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>; Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>;
/** /**
@@ -269,19 +255,19 @@ declare module '@polkadot/api/types/events' {
}; };
democracy: { democracy: {
/** /**
* A proposal \[hash\] has been blacklisted permanently. * A proposal_hash has been blacklisted permanently.
**/ **/
Blacklisted: AugmentedEvent<ApiType, [H256]>; Blacklisted: AugmentedEvent<ApiType, [H256]>;
/** /**
* A referendum has been cancelled. \[ref_index\] * A referendum has been cancelled.
**/ **/
Cancelled: AugmentedEvent<ApiType, [u32]>; Cancelled: AugmentedEvent<ApiType, [u32]>;
/** /**
* An account has delegated their vote to another account. \[who, target\] * An account has delegated their vote to another account.
**/ **/
Delegated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; Delegated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/** /**
* A proposal has been enacted. \[ref_index, result\] * A proposal has been enacted.
**/ **/
Executed: AugmentedEvent<ApiType, [u32, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [u32, Result<Null, SpRuntimeDispatchError>]>;
/** /**
@@ -289,56 +275,51 @@ declare module '@polkadot/api/types/events' {
**/ **/
ExternalTabled: AugmentedEvent<ApiType, []>; ExternalTabled: AugmentedEvent<ApiType, []>;
/** /**
* A proposal has been rejected by referendum. \[ref_index\] * A proposal has been rejected by referendum.
**/ **/
NotPassed: AugmentedEvent<ApiType, [u32]>; NotPassed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A proposal has been approved by referendum. \[ref_index\] * A proposal has been approved by referendum.
**/ **/
Passed: AugmentedEvent<ApiType, [u32]>; Passed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A proposal could not be executed because its preimage was invalid. * A proposal could not be executed because its preimage was invalid.
* \[proposal_hash, ref_index\]
**/ **/
PreimageInvalid: AugmentedEvent<ApiType, [H256, u32]>; PreimageInvalid: AugmentedEvent<ApiType, [H256, u32]>;
/** /**
* A proposal could not be executed because its preimage was missing. * A proposal could not be executed because its preimage was missing.
* \[proposal_hash, ref_index\]
**/ **/
PreimageMissing: AugmentedEvent<ApiType, [H256, u32]>; PreimageMissing: AugmentedEvent<ApiType, [H256, u32]>;
/** /**
* A proposal's preimage was noted, and the deposit taken. \[proposal_hash, who, deposit\] * A proposal's preimage was noted, and the deposit taken.
**/ **/
PreimageNoted: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; PreimageNoted: AugmentedEvent<ApiType, [H256, AccountId32, u128]>;
/** /**
* A registered preimage was removed and the deposit collected by the reaper. * A registered preimage was removed and the deposit collected by the reaper.
* \[proposal_hash, provider, deposit, reaper\]
**/ **/
PreimageReaped: AugmentedEvent<ApiType, [H256, AccountId32, u128, AccountId32]>; PreimageReaped: AugmentedEvent<ApiType, [H256, AccountId32, u128, AccountId32]>;
/** /**
* A proposal preimage was removed and used (the deposit was returned). * A proposal preimage was removed and used (the deposit was returned).
* \[proposal_hash, provider, deposit\]
**/ **/
PreimageUsed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; PreimageUsed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>;
/** /**
* A motion has been proposed by a public account. \[proposal_index, deposit\] * A motion has been proposed by a public account.
**/ **/
Proposed: AugmentedEvent<ApiType, [u32, u128]>; Proposed: AugmentedEvent<ApiType, [u32, u128]>;
/** /**
* A referendum has begun. \[ref_index, threshold\] * A referendum has begun.
**/ **/
Started: AugmentedEvent<ApiType, [u32, PalletDemocracyVoteThreshold]>; Started: AugmentedEvent<ApiType, [u32, PalletDemocracyVoteThreshold]>;
/** /**
* A public proposal has been tabled for referendum vote. \[proposal_index, deposit, * A public proposal has been tabled for referendum vote.
* depositors\]
**/ **/
Tabled: AugmentedEvent<ApiType, [u32, u128, Vec<AccountId32>]>; Tabled: AugmentedEvent<ApiType, [u32, u128, Vec<AccountId32>]>;
/** /**
* An \[account\] has cancelled a previous delegation operation. * An account has cancelled a previous delegation operation.
**/ **/
Undelegated: AugmentedEvent<ApiType, [AccountId32]>; Undelegated: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* An external proposal has been vetoed. \[who, proposal_hash, until\] * An external proposal has been vetoed.
**/ **/
Vetoed: AugmentedEvent<ApiType, [AccountId32, H256, u32]>; Vetoed: AugmentedEvent<ApiType, [AccountId32, H256, u32]>;
/** /**
@@ -384,7 +365,7 @@ declare module '@polkadot/api/types/events' {
}; };
elections: { elections: {
/** /**
* A \[candidate\] was slashed by \[amount\] due to failing to obtain a seat as member or * A candidate was slashed by amount due to failing to obtain a seat as member or
* runner-up. * runner-up.
* *
* Note that old members and runners-up are also candidates. * Note that old members and runners-up are also candidates.
@@ -400,12 +381,12 @@ declare module '@polkadot/api/types/events' {
**/ **/
EmptyTerm: AugmentedEvent<ApiType, []>; EmptyTerm: AugmentedEvent<ApiType, []>;
/** /**
* A \[member\] has been removed. This should always be followed by either `NewTerm` or * A member has been removed. This should always be followed by either `NewTerm` or
* `EmptyTerm`. * `EmptyTerm`.
**/ **/
MemberKicked: AugmentedEvent<ApiType, [AccountId32]>; MemberKicked: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A new term with \[new_members\]. This indicates that enough candidates existed to run * A new term with new_members. This indicates that enough candidates existed to run
* the election, not that enough have has been elected. The inner value must be examined * the election, not that enough have has been elected. The inner value must be examined
* for this purpose. A `NewTerm(\[\])` indicates that some candidates got their bond * for this purpose. A `NewTerm(\[\])` indicates that some candidates got their bond
* slashed and none were elected, whilst `EmptyTerm` means that no candidates existed to * slashed and none were elected, whilst `EmptyTerm` means that no candidates existed to
@@ -417,7 +398,7 @@ declare module '@polkadot/api/types/events' {
**/ **/
Renounced: AugmentedEvent<ApiType, [AccountId32]>; Renounced: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A \[seat holder\] was slashed by \[amount\] by being forcefully removed from the set. * A seat holder was slashed by amount by being forcefully removed from the set.
**/ **/
SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId32, u128]>; SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
@@ -428,22 +409,18 @@ declare module '@polkadot/api/types/events' {
gilt: { gilt: {
/** /**
* A bid was successfully placed. * A bid was successfully placed.
* \[ who, amount, duration \]
**/ **/
BidPlaced: AugmentedEvent<ApiType, [AccountId32, u128, u32]>; BidPlaced: AugmentedEvent<ApiType, [AccountId32, u128, u32]>;
/** /**
* A bid was successfully removed (before being accepted as a gilt). * A bid was successfully removed (before being accepted as a gilt).
* \[ who, amount, duration \]
**/ **/
BidRetracted: AugmentedEvent<ApiType, [AccountId32, u128, u32]>; BidRetracted: AugmentedEvent<ApiType, [AccountId32, u128, u32]>;
/** /**
* A bid was accepted as a gilt. The balance may not be released until expiry. * A bid was accepted as a gilt. The balance may not be released until expiry.
* \[ index, expiry, who, amount \]
**/ **/
GiltIssued: AugmentedEvent<ApiType, [u32, u32, AccountId32, u128]>; GiltIssued: AugmentedEvent<ApiType, [u32, u32, AccountId32, u128]>;
/** /**
* An expired gilt has been thawed. * An expired gilt has been thawed.
* \[ index, who, original_amount, additional_amount \]
**/ **/
GiltThawed: AugmentedEvent<ApiType, [u32, AccountId32, u128, u128]>; GiltThawed: AugmentedEvent<ApiType, [u32, AccountId32, u128, u128]>;
/** /**
@@ -453,7 +430,7 @@ declare module '@polkadot/api/types/events' {
}; };
grandpa: { grandpa: {
/** /**
* New authority set has been applied. \[authority_set\] * New authority set has been applied.
**/ **/
NewAuthorities: AugmentedEvent<ApiType, [Vec<ITuple<[SpFinalityGrandpaAppPublic, u64]>>]>; NewAuthorities: AugmentedEvent<ApiType, [Vec<ITuple<[SpFinalityGrandpaAppPublic, u64]>>]>;
/** /**
@@ -471,45 +448,44 @@ declare module '@polkadot/api/types/events' {
}; };
identity: { identity: {
/** /**
* A name was cleared, and the given balance returned. \[who, deposit\] * A name was cleared, and the given balance returned.
**/ **/
IdentityCleared: AugmentedEvent<ApiType, [AccountId32, u128]>; IdentityCleared: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* A name was removed and the given balance slashed. \[who, deposit\] * A name was removed and the given balance slashed.
**/ **/
IdentityKilled: AugmentedEvent<ApiType, [AccountId32, u128]>; IdentityKilled: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
* A name was set or reset (which will remove all judgements). \[who\] * A name was set or reset (which will remove all judgements).
**/ **/
IdentitySet: AugmentedEvent<ApiType, [AccountId32]>; IdentitySet: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A judgement was given by a registrar. \[target, registrar_index\] * A judgement was given by a registrar.
**/ **/
JudgementGiven: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementGiven: AugmentedEvent<ApiType, [AccountId32, u32]>;
/** /**
* A judgement was asked from a registrar. \[who, registrar_index\] * A judgement was asked from a registrar.
**/ **/
JudgementRequested: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementRequested: AugmentedEvent<ApiType, [AccountId32, u32]>;
/** /**
* A judgement request was retracted. \[who, registrar_index\] * A judgement request was retracted.
**/ **/
JudgementUnrequested: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementUnrequested: AugmentedEvent<ApiType, [AccountId32, u32]>;
/** /**
* A registrar was added. \[registrar_index\] * A registrar was added.
**/ **/
RegistrarAdded: AugmentedEvent<ApiType, [u32]>; RegistrarAdded: AugmentedEvent<ApiType, [u32]>;
/** /**
* A sub-identity was added to an identity and the deposit paid. \[sub, main, deposit\] * A sub-identity was added to an identity and the deposit paid.
**/ **/
SubIdentityAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
/** /**
* A sub-identity was removed from an identity and the deposit freed. * A sub-identity was removed from an identity and the deposit freed.
* \[sub, main, deposit\]
**/ **/
SubIdentityRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
/** /**
* A sub-identity was cleared, and the given deposit repatriated from the * A sub-identity was cleared, and the given deposit repatriated from the
* main identity account to the sub-identity account. \[sub, main, deposit\] * main identity account to the sub-identity account.
**/ **/
SubIdentityRevoked: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityRevoked: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>;
/** /**
@@ -523,11 +499,11 @@ declare module '@polkadot/api/types/events' {
**/ **/
AllGood: AugmentedEvent<ApiType, []>; AllGood: AugmentedEvent<ApiType, []>;
/** /**
* A new heartbeat was received from `AuthorityId` \[authority_id\] * A new heartbeat was received from `AuthorityId`.
**/ **/
HeartbeatReceived: AugmentedEvent<ApiType, [PalletImOnlineSr25519AppSr25519Public]>; HeartbeatReceived: AugmentedEvent<ApiType, [PalletImOnlineSr25519AppSr25519Public]>;
/** /**
* At the end of the session, at least one validator was found to be \[offline\]. * At the end of the session, at least one validator was found to be offline.
**/ **/
SomeOffline: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId32, PalletStakingExposure]>>]>; SomeOffline: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId32, PalletStakingExposure]>>]>;
/** /**
@@ -537,15 +513,15 @@ declare module '@polkadot/api/types/events' {
}; };
indices: { indices: {
/** /**
* A account index was assigned. \[index, who\] * A account index was assigned.
**/ **/
IndexAssigned: AugmentedEvent<ApiType, [AccountId32, u32]>; IndexAssigned: AugmentedEvent<ApiType, [AccountId32, u32]>;
/** /**
* A account index has been freed up (unassigned). \[index\] * A account index has been freed up (unassigned).
**/ **/
IndexFreed: AugmentedEvent<ApiType, [u32]>; IndexFreed: AugmentedEvent<ApiType, [u32]>;
/** /**
* A account index has been frozen to its current account ID. \[index, who\] * A account index has been frozen to its current account ID.
**/ **/
IndexFrozen: AugmentedEvent<ApiType, [u32, AccountId32]>; IndexFrozen: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
@@ -578,19 +554,18 @@ declare module '@polkadot/api/types/events' {
multisig: { multisig: {
/** /**
* A multisig operation has been approved by someone. * A multisig operation has been approved by someone.
* \[approving, timepoint, multisig, call_hash\]
**/ **/
MultisigApproval: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>; MultisigApproval: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>;
/** /**
* A multisig operation has been cancelled. \[canceling, timepoint, multisig, call_hash\] * A multisig operation has been cancelled.
**/ **/
MultisigCancelled: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>; MultisigCancelled: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>;
/** /**
* A multisig operation has been executed. \[approving, timepoint, multisig, call_hash\] * A multisig operation has been executed.
**/ **/
MultisigExecuted: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed, Result<Null, SpRuntimeDispatchError>]>; MultisigExecuted: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A new multisig operation has begun. \[approving, multisig, call_hash\] * A new multisig operation has begun.
**/ **/
NewMultisig: AugmentedEvent<ApiType, [AccountId32, AccountId32, U8aFixed]>; NewMultisig: AugmentedEvent<ApiType, [AccountId32, AccountId32, U8aFixed]>;
/** /**
@@ -612,21 +587,20 @@ declare module '@polkadot/api/types/events' {
}; };
proxy: { proxy: {
/** /**
* An announcement was placed to make a call in the future. \[real, proxy, call_hash\] * An announcement was placed to make a call in the future.
**/ **/
Announced: AugmentedEvent<ApiType, [AccountId32, AccountId32, H256]>; Announced: AugmentedEvent<ApiType, [AccountId32, AccountId32, H256]>;
/** /**
* Anonymous account has been created by new proxy with given * Anonymous account has been created by new proxy with given
* disambiguation index and proxy type. \[anonymous, who, proxy_type, * disambiguation index and proxy type.
* disambiguation_index\]
**/ **/
AnonymousCreated: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u16]>; AnonymousCreated: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u16]>;
/** /**
* A proxy was added. \[delegator, delegatee, proxy_type, delay\] * A proxy was added.
**/ **/
ProxyAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u32]>; ProxyAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, NodeRuntimeProxyType, u32]>;
/** /**
* A proxy was executed correctly, with the given \[result\]. * A proxy was executed correctly, with the given.
**/ **/
ProxyExecuted: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>; ProxyExecuted: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
/** /**
@@ -637,30 +611,26 @@ declare module '@polkadot/api/types/events' {
recovery: { recovery: {
/** /**
* Lost account has been successfully recovered by rescuer account. * Lost account has been successfully recovered by rescuer account.
* \[lost, rescuer\]
**/ **/
AccountRecovered: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; AccountRecovered: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/** /**
* A recovery process for lost account by rescuer account has been closed. * A recovery process for lost account by rescuer account has been closed.
* \[lost, rescuer\]
**/ **/
RecoveryClosed: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; RecoveryClosed: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/** /**
* A recovery process has been set up for an \[account\]. * A recovery process has been set up for an account.
**/ **/
RecoveryCreated: AugmentedEvent<ApiType, [AccountId32]>; RecoveryCreated: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A recovery process has been initiated for lost account by rescuer account. * A recovery process has been initiated for lost account by rescuer account.
* \[lost, rescuer\]
**/ **/
RecoveryInitiated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; RecoveryInitiated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/** /**
* A recovery process has been removed for an \[account\]. * A recovery process has been removed for an account.
**/ **/
RecoveryRemoved: AugmentedEvent<ApiType, [AccountId32]>; RecoveryRemoved: AugmentedEvent<ApiType, [AccountId32]>;
/** /**
* A recovery process for lost account by rescuer account has been vouched for by sender. * A recovery process for lost account by rescuer account has been vouched for by sender.
* \[lost, rescuer, sender\]
**/ **/
RecoveryVouched: AugmentedEvent<ApiType, [AccountId32, AccountId32, AccountId32]>; RecoveryVouched: AugmentedEvent<ApiType, [AccountId32, AccountId32, AccountId32]>;
/** /**
@@ -688,7 +658,7 @@ declare module '@polkadot/api/types/events' {
}; };
session: { session: {
/** /**
* New session has happened. Note that the argument is the \[session_index\], not the * New session has happened. Note that the argument is the session index, not the
* block number as the type might suggest. * block number as the type might suggest.
**/ **/
NewSession: AugmentedEvent<ApiType, [u32]>; NewSession: AugmentedEvent<ApiType, [u32]>;
@@ -885,39 +855,32 @@ declare module '@polkadot/api/types/events' {
technicalCommittee: { technicalCommittee: {
/** /**
* A motion was approved by the required threshold. * A motion was approved by the required threshold.
* \[proposal_hash\]
**/ **/
Approved: AugmentedEvent<ApiType, [H256]>; Approved: AugmentedEvent<ApiType, [H256]>;
/** /**
* A proposal was closed because its threshold was reached or after its duration was up. * A proposal was closed because its threshold was reached or after its duration was up.
* \[proposal_hash, yes, no\]
**/ **/
Closed: AugmentedEvent<ApiType, [H256, u32, u32]>; Closed: AugmentedEvent<ApiType, [H256, u32, u32]>;
/** /**
* A motion was not approved by the required threshold. * A motion was not approved by the required threshold.
* \[proposal_hash\]
**/ **/
Disapproved: AugmentedEvent<ApiType, [H256]>; Disapproved: AugmentedEvent<ApiType, [H256]>;
/** /**
* A motion was executed; result will be `Ok` if it returned without error. * A motion was executed; result will be `Ok` if it returned without error.
* \[proposal_hash, result\]
**/ **/
Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A single member did some action; result will be `Ok` if it returned without error. * A single member did some action; result will be `Ok` if it returned without error.
* \[proposal_hash, result\]
**/ **/
MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>;
/** /**
* A motion (given hash) has been proposed (by given account) with a threshold (given * A motion (given hash) has been proposed (by given account) with a threshold (given
* `MemberCount`). * `MemberCount`).
* \[account, proposal_index, proposal_hash, threshold\]
**/ **/
Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>; Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>;
/** /**
* A motion (given hash) has been voted on by given account, leaving * A motion (given hash) has been voted on by given account, leaving
* a tally (yes votes and no votes given respectively as `MemberCount`). * a tally (yes votes and no votes given respectively as `MemberCount`).
* \[account, proposal_hash, voted, yes, no\]
**/ **/
Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>; Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>;
/** /**
@@ -957,23 +920,23 @@ declare module '@polkadot/api/types/events' {
}; };
tips: { tips: {
/** /**
* A new tip suggestion has been opened. \[tip_hash\] * A new tip suggestion has been opened.
**/ **/
NewTip: AugmentedEvent<ApiType, [H256]>; NewTip: AugmentedEvent<ApiType, [H256]>;
/** /**
* A tip suggestion has been closed. \[tip_hash, who, payout\] * A tip suggestion has been closed.
**/ **/
TipClosed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; TipClosed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>;
/** /**
* A tip suggestion has reached threshold and is closing. \[tip_hash\] * A tip suggestion has reached threshold and is closing.
**/ **/
TipClosing: AugmentedEvent<ApiType, [H256]>; TipClosing: AugmentedEvent<ApiType, [H256]>;
/** /**
* A tip suggestion has been retracted. \[tip_hash\] * A tip suggestion has been retracted.
**/ **/
TipRetracted: AugmentedEvent<ApiType, [H256]>; TipRetracted: AugmentedEvent<ApiType, [H256]>;
/** /**
* A tip suggestion has been slashed. \[tip_hash, finder, deposit\] * A tip suggestion has been slashed.
**/ **/
TipSlashed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; TipSlashed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>;
/** /**
@@ -1038,97 +1001,91 @@ declare module '@polkadot/api/types/events' {
/** /**
* An approval for a `delegate` account to transfer the `instance` of an asset `class` was * An approval for a `delegate` account to transfer the `instance` of an asset `class` was
* cancelled by its `owner`. * cancelled by its `owner`.
* \[ class, instance, owner, delegate \]
**/ **/
ApprovalCancelled: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>; ApprovalCancelled: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>;
/** /**
* An `instance` of an asset `class` has been approved by the `owner` for transfer by a * An `instance` of an asset `class` has been approved by the `owner` for transfer by a
* `delegate`. * `delegate`.
* \[ class, instance, owner, delegate \]
**/ **/
ApprovedTransfer: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>; ApprovedTransfer: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>;
/** /**
* An asset `class` has had its attributes changed by the `Force` origin. * An asset `class` has had its attributes changed by the `Force` origin.
* \[ class \]
**/ **/
AssetStatusChanged: AugmentedEvent<ApiType, [u32]>; AssetStatusChanged: AugmentedEvent<ApiType, [u32]>;
/** /**
* Attribute metadata has been cleared for an asset class or instance. * Attribute metadata has been cleared for an asset class or instance.
* \[ class, maybe_instance, key, maybe_value \]
**/ **/
AttributeCleared: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes]>; AttributeCleared: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes]>;
/** /**
* New attribute metadata has been set for an asset class or instance. * New attribute metadata has been set for an asset class or instance.
* \[ class, maybe_instance, key, value \]
**/ **/
AttributeSet: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes, Bytes]>; AttributeSet: AugmentedEvent<ApiType, [u32, Option<u32>, Bytes, Bytes]>;
/** /**
* An asset `instance` was destroyed. \[ class, instance, owner \] * An asset `instance` was destroyed.
**/ **/
Burned: AugmentedEvent<ApiType, [u32, u32, AccountId32]>; Burned: AugmentedEvent<ApiType, [u32, u32, AccountId32]>;
/** /**
* Some asset `class` was frozen. \[ class \] * Some asset `class` was frozen.
**/ **/
ClassFrozen: AugmentedEvent<ApiType, [u32]>; ClassFrozen: AugmentedEvent<ApiType, [u32]>;
/** /**
* Metadata has been cleared for an asset class. \[ class \] * Metadata has been cleared for an asset class.
**/ **/
ClassMetadataCleared: AugmentedEvent<ApiType, [u32]>; ClassMetadataCleared: AugmentedEvent<ApiType, [u32]>;
/** /**
* New metadata has been set for an asset class. \[ class, data, is_frozen \] * New metadata has been set for an asset class.
**/ **/
ClassMetadataSet: AugmentedEvent<ApiType, [u32, Bytes, bool]>; ClassMetadataSet: AugmentedEvent<ApiType, [u32, Bytes, bool]>;
/** /**
* Some asset `class` was thawed. \[ class \] * Some asset `class` was thawed.
**/ **/
ClassThawed: AugmentedEvent<ApiType, [u32]>; ClassThawed: AugmentedEvent<ApiType, [u32]>;
/** /**
* An asset class was created. \[ class, creator, owner \] * An asset class was created.
**/ **/
Created: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>; Created: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32]>;
/** /**
* An asset `class` was destroyed. \[ class \] * An asset `class` was destroyed.
**/ **/
Destroyed: AugmentedEvent<ApiType, [u32]>; Destroyed: AugmentedEvent<ApiType, [u32]>;
/** /**
* An asset class was force-created. \[ class, owner \] * An asset class was force-created.
**/ **/
ForceCreated: AugmentedEvent<ApiType, [u32, AccountId32]>; ForceCreated: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Some asset `instance` was frozen. \[ class, instance \] * Some asset `instance` was frozen.
**/ **/
Frozen: AugmentedEvent<ApiType, [u32, u32]>; Frozen: AugmentedEvent<ApiType, [u32, u32]>;
/** /**
* An asset `instance` was issued. \[ class, instance, owner \] * An asset `instance` was issued.
**/ **/
Issued: AugmentedEvent<ApiType, [u32, u32, AccountId32]>; Issued: AugmentedEvent<ApiType, [u32, u32, AccountId32]>;
/** /**
* Metadata has been cleared for an asset instance. \[ class, instance \] * Metadata has been cleared for an asset instance.
**/ **/
MetadataCleared: AugmentedEvent<ApiType, [u32, u32]>; MetadataCleared: AugmentedEvent<ApiType, [u32, u32]>;
/** /**
* New metadata has been set for an asset instance. * New metadata has been set for an asset instance.
* \[ class, instance, data, is_frozen \]
**/ **/
MetadataSet: AugmentedEvent<ApiType, [u32, u32, Bytes, bool]>; MetadataSet: AugmentedEvent<ApiType, [u32, u32, Bytes, bool]>;
/** /**
* The owner changed \[ class, new_owner \] * The owner changed.
**/ **/
OwnerChanged: AugmentedEvent<ApiType, [u32, AccountId32]>; OwnerChanged: AugmentedEvent<ApiType, [u32, AccountId32]>;
/** /**
* Metadata has been cleared for an asset instance. \[ class, successful_instances \] * Metadata has been cleared for an asset instance.
**/ **/
Redeposited: AugmentedEvent<ApiType, [u32, Vec<u32>]>; Redeposited: AugmentedEvent<ApiType, [u32, Vec<u32>]>;
/** /**
* The management team changed \[ class, issuer, admin, freezer \] * The management team changed.
**/ **/
TeamChanged: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32]>; TeamChanged: AugmentedEvent<ApiType, [u32, AccountId32, AccountId32, AccountId32]>;
/** /**
* Some asset `instance` was thawed. \[ class, instance \] * Some asset `instance` was thawed.
**/ **/
Thawed: AugmentedEvent<ApiType, [u32, u32]>; Thawed: AugmentedEvent<ApiType, [u32, u32]>;
/** /**
* An asset `instance` was transferred. \[ class, instance, from, to \] * An asset `instance` was transferred.
**/ **/
Transferred: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>; Transferred: AugmentedEvent<ApiType, [u32, u32, AccountId32, AccountId32]>;
/** /**
@@ -1143,7 +1100,7 @@ declare module '@polkadot/api/types/events' {
BatchCompleted: AugmentedEvent<ApiType, []>; BatchCompleted: AugmentedEvent<ApiType, []>;
/** /**
* Batch of dispatches did not complete fully. Index of first failing dispatch given, as * Batch of dispatches did not complete fully. Index of first failing dispatch given, as
* well as the error. \[index, error\] * well as the error.
**/ **/
BatchInterrupted: AugmentedEvent<ApiType, [u32, SpRuntimeDispatchError]>; BatchInterrupted: AugmentedEvent<ApiType, [u32, SpRuntimeDispatchError]>;
/** /**
@@ -1167,7 +1124,6 @@ declare module '@polkadot/api/types/events' {
/** /**
* The amount vested has been updated. This could indicate a change in funds available. * The amount vested has been updated. This could indicate a change in funds available.
* The balance given is the amount which is left unvested (and thus locked). * The balance given is the amount which is left unvested (and thus locked).
* \[account, unvested\]
**/ **/
VestingUpdated: AugmentedEvent<ApiType, [AccountId32, u128]>; VestingUpdated: AugmentedEvent<ApiType, [AccountId32, u128]>;
/** /**
+1 -1
View File
@@ -169,7 +169,7 @@ declare module '@polkadot/api/types/storage' {
}; };
bagsList: { bagsList: {
/** /**
* How many ids are registered. * Counter for the related counted storage map
**/ **/
counterForListNodes: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>; counterForListNodes: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/** /**
+34 -37
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 { 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, SpRuntimeHeader, 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, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeHeader, 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' {
@@ -33,7 +33,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
approveTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, delegate: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; approveTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, delegate: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Reduce the balance of `who` by as much as possible up to `amount` assets of `id`. * Reduce the balance of `who` by as much as possible up to `amount` assets of `id`.
* *
@@ -51,7 +51,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: Post-existence of `who`; Pre & post Zombie-status of `who`. * Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
**/ **/
burn: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; burn: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Cancel all of some asset approved for delegated transfer by a third-party account. * Cancel all of some asset approved for delegated transfer by a third-party account.
* *
@@ -103,7 +103,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
create: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, admin: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, u64]>; create: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, admin: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, u128]>;
/** /**
* Destroy a class of fungible assets. * Destroy a class of fungible assets.
* *
@@ -149,7 +149,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
forceAssetStatus: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, issuer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, admin: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, freezer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: Compact<u64> | AnyNumber | Uint8Array, isSufficient: bool | boolean | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, MultiAddress, MultiAddress, Compact<u64>, bool, bool]>; forceAssetStatus: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, issuer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, admin: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, freezer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: Compact<u128> | AnyNumber | Uint8Array, isSufficient: bool | boolean | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, MultiAddress, MultiAddress, Compact<u128>, bool, bool]>;
/** /**
* Cancel all of some asset approved for delegated transfer by a third-party account. * Cancel all of some asset approved for delegated transfer by a third-party account.
* *
@@ -201,7 +201,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
forceCreate: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, isSufficient: bool | boolean | Uint8Array, minBalance: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, bool, Compact<u64>]>; forceCreate: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, isSufficient: bool | boolean | Uint8Array, minBalance: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, bool, Compact<u128>]>;
/** /**
* Force the metadata for an asset to some value. * Force the metadata for an asset to some value.
* *
@@ -240,7 +240,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of * Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of
* `dest`. * `dest`.
**/ **/
forceTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u64>]>; forceTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u128>]>;
/** /**
* Disallow further unprivileged transfers from an account. * Disallow further unprivileged transfers from an account.
* *
@@ -280,7 +280,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`. * Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
**/ **/
mint: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; mint: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Set the metadata for an asset. * Set the metadata for an asset.
* *
@@ -360,7 +360,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of * Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
* `target`. * `target`.
**/ **/
transfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; transfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Transfer some asset balance from a previously delegated account to some third-party * Transfer some asset balance from a previously delegated account to some third-party
* account. * account.
@@ -381,7 +381,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
transferApproved: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, destination: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u64>]>; transferApproved: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, owner: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, destination: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u128>]>;
/** /**
* Move some assets from the sender account to another, keeping the sender account alive. * Move some assets from the sender account to another, keeping the sender account alive.
* *
@@ -402,7 +402,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of * Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
* `target`. * `target`.
**/ **/
transferKeepAlive: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u64>]>; transferKeepAlive: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
/** /**
* Change the Owner of an asset. * Change the Owner of an asset.
* *
@@ -871,6 +871,13 @@ declare module '@polkadot/api/types/submittable' {
* NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but * NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but
* the weight estimations rely on it to estimate dispatchable weight. * the weight estimations rely on it to estimate dispatchable weight.
* *
* # WARNING:
*
* The `pallet-collective` can also be managed by logic outside of the pallet through the
* implementation of the trait [`ChangeMembers`].
* Any call to `set_members` must be careful that the member set doesn't get out of sync
* with other logic managing the member set.
*
* # <weight> * # <weight>
* ## Weight * ## Weight
* - `O(MP + N)` where: * - `O(MP + N)` where:
@@ -3156,22 +3163,18 @@ declare module '@polkadot/api/types/submittable' {
**/ **/
payoutStakers: AugmentedSubmittable<(validatorStash: AccountId32 | string | Uint8Array, era: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>; payoutStakers: AugmentedSubmittable<(validatorStash: AccountId32 | string | Uint8Array, era: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>;
/** /**
* Remove all data structure concerning a staker/stash once its balance is at the minimum. * Remove all data structures concerning a staker/stash once it is at a state where it can
* This is essentially equivalent to `withdraw_unbonded` except it can be called by anyone * be considered `dust` in the staking system. The requirements are:
* and the target `stash` must have no funds left beyond the ED.
* *
* This can be called from any origin. * 1. the `total_balance` of the stash is below existential deposit.
* 2. or, the `ledger.total` of the stash is below existential deposit.
* *
* - `stash`: The stash account to reap. Its balance must be zero. * The former can happen in cases like a slash; the latter when a fully unbonded account
* is still receiving staking rewards in `RewardDestination::Staked`.
* *
* # <weight> * It can be called by anyone, as long as `stash` meets the above requirements.
* Complexity: O(S) where S is the number of slashing spans on the account. *
* DB Weight: * Refunds the transaction fees upon successful execution.
* - Reads: Stash Account, Bonded, Slashing Spans, Locks
* - Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators,
* Stash Account, Locks
* - Writes Each: SpanSlash * S
* # </weight>
**/ **/
reapStash: AugmentedSubmittable<(stash: AccountId32 | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>; reapStash: AugmentedSubmittable<(stash: AccountId32 | string | Uint8Array, numSlashingSpans: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, u32]>;
/** /**
@@ -3456,19 +3459,6 @@ declare module '@polkadot/api/types/submittable' {
* # </weight> * # </weight>
**/ **/
remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>; remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/**
* Set the new changes trie configuration.
*
* # <weight>
* - `O(1)`
* - 1 storage write or delete (codec `O(1)`).
* - 1 call to `deposit_log`: Uses `append` API, so O(1)
* - Base Weight: 7.218 µs
* - DB Weight:
* - Writes: Changes Trie, System Digest
* # </weight>
**/
setChangesTrieConfig: AugmentedSubmittable<(changesTrieConfig: Option<SpCoreChangesTrieChangesTrieConfiguration> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Option<SpCoreChangesTrieChangesTrieConfiguration>]>;
/** /**
* Set the new runtime code. * Set the new runtime code.
* *
@@ -3634,6 +3624,13 @@ declare module '@polkadot/api/types/submittable' {
* NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but * NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but
* the weight estimations rely on it to estimate dispatchable weight. * the weight estimations rely on it to estimate dispatchable weight.
* *
* # WARNING:
*
* The `pallet-collective` can also be managed by logic outside of the pallet through the
* implementation of the trait [`ChangeMembers`].
* Any call to `set_members` must be careful that the member set doesn't get out of sync
* with other logic managing the member set.
*
* # <weight> * # <weight>
* ## Weight * ## Weight
* - `O(MP + N)` where: * - `O(MP + N)` where:
+4 -2
View File
@@ -354,8 +354,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
const [k, { method, section }] = allKnown[i]; const [k, { method, section }] = allKnown[i];
if (hasResults && !exposed.includes(k) && k !== 'rpc_methods') { if (hasResults && !exposed.includes(k) && k !== 'rpc_methods') {
delete (this._rpc as Record<string, Record<string, unknown>>)[section][method]; if ((this._rpc as Record<string, Record<string, unknown>>)[section]) {
delete (this._rx.rpc as Record<string, Record<string, unknown>>)[section][method]; delete (this._rpc as Record<string, Record<string, unknown>>)[section][method];
delete (this._rx.rpc as Record<string, Record<string, unknown>>)[section][method];
}
} }
} }
} }
+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.8.1' }; export const packageInfo = { name: '@polkadot/api', version: '6.10.1' };
+1 -1
View File
@@ -14,7 +14,7 @@ import { hexToU8a } from '@polkadot/util';
import { SingleAccountSigner } from '../../test/util'; import { SingleAccountSigner } from '../../test/util';
import { ApiPromise } from '.'; import { ApiPromise } from '.';
const TRANSFER_SIG = '0x54f39e43f32376a5ab6cdfd4d0ce57802aa9ff85514a7ffa9f2a949078f02beca16af87427c45fe60d54aa847fd241d127ed39e21b101806f6b1f50f7a82500b'; const TRANSFER_SIG = '0xcc277eb341d3801c08f149508221583fa3185cc3944e6cb376cd061640305edd7dc24dfd754adb24768f1d8547389b7720e6f626bc81f5593fba1141e7f7ba07';
describe('ApiPromise', (): void => { describe('ApiPromise', (): void => {
const registry = new TypeRegistry(); const registry = new TypeRegistry();
+6 -6
View File
@@ -20,16 +20,16 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/rpc-provider": "6.8.1", "@polkadot/rpc-provider": "6.10.1",
"@polkadot/types": "6.8.1", "@polkadot/types": "6.10.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.0.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.8.2" "@polkadot/keyring": "^8.0.2"
} }
} }
+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.8.1' }; export const packageInfo = { name: '@polkadot/rpc-core', version: '6.10.1' };
+12 -12
View File
@@ -20,22 +20,22 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/types": "6.8.1", "@polkadot/types": "6.10.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.0.2",
"@polkadot/util-crypto": "^7.8.2", "@polkadot/util-crypto": "^8.0.2",
"@polkadot/x-fetch": "^7.8.2", "@polkadot/x-fetch": "^8.0.2",
"@polkadot/x-global": "^7.8.2", "@polkadot/x-global": "^8.0.2",
"@polkadot/x-ws": "^7.8.2", "@polkadot/x-ws": "^8.0.2",
"eventemitter3": "^4.0.7" "eventemitter3": "^4.0.7"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.8.2", "@polkadot/keyring": "^8.0.2",
"@polkadot/types": "6.8.1", "@polkadot/types": "6.10.1",
"mock-socket": "^9.0.7", "mock-socket": "^9.0.8",
"nock": "^13.1.4" "nock": "^13.2.1"
} }
} }
+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.8.1' }; export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.10.1' };
+8 -8
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "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",
@@ -32,18 +32,18 @@
"dependencies": { "dependencies": {
"@babel/core": "^7.16.0", "@babel/core": "^7.16.0",
"@babel/register": "^7.16.0", "@babel/register": "^7.16.0",
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/api": "6.8.1", "@polkadot/api": "6.10.1",
"@polkadot/rpc-provider": "6.8.1", "@polkadot/rpc-provider": "6.10.1",
"@polkadot/types": "6.8.1", "@polkadot/types": "6.10.1",
"@polkadot/types-support": "6.8.1", "@polkadot/types-support": "6.10.1",
"@polkadot/util": "^7.8.2", "@polkadot/util": "^8.0.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.5" "@types/yargs": "^17.0.7"
} }
} }
+17 -4
View File
@@ -4,6 +4,7 @@
import path from 'path'; import path from 'path';
import yargs from 'yargs'; import yargs from 'yargs';
import { Definitions } from '@polkadot/types/types';
import { formatNumber } from '@polkadot/util'; import { formatNumber } from '@polkadot/util';
import { WebSocket } from '@polkadot/x-ws'; import { WebSocket } from '@polkadot/x-ws';
@@ -18,12 +19,24 @@ function generate (metaHex: string, pkg: string | undefined, output: string, isS
? { [pkg]: require(path.join(process.cwd(), output, 'definitions')) as Record<string, any> } ? { [pkg]: require(path.join(process.cwd(), output, 'definitions')) as Record<string, any> }
: {}; : {};
generateDefaultConsts(path.join(process.cwd(), output, 'augment-api-consts.ts'), metaHex, extraTypes, isStrict); let customLookupDefinitions;
try {
customLookupDefinitions = {
rpc: {},
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
types: require(path.join(process.cwd(), output, 'lookup.ts')).default
} as Definitions;
} catch (error) {
console.log('No custom definitions found.');
}
generateDefaultConsts(path.join(process.cwd(), output, 'augment-api-consts.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultErrors(path.join(process.cwd(), output, 'augment-api-errors.ts'), metaHex, extraTypes, isStrict); generateDefaultErrors(path.join(process.cwd(), output, 'augment-api-errors.ts'), metaHex, extraTypes, isStrict);
generateDefaultEvents(path.join(process.cwd(), output, 'augment-api-events.ts'), metaHex, extraTypes, isStrict); generateDefaultEvents(path.join(process.cwd(), output, 'augment-api-events.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultQuery(path.join(process.cwd(), output, 'augment-api-query.ts'), metaHex, extraTypes, isStrict); generateDefaultQuery(path.join(process.cwd(), output, 'augment-api-query.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultRpc(path.join(process.cwd(), output, 'augment-api-rpc.ts'), extraTypes); generateDefaultRpc(path.join(process.cwd(), output, 'augment-api-rpc.ts'), extraTypes);
generateDefaultTx(path.join(process.cwd(), output, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict); generateDefaultTx(path.join(process.cwd(), output, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
writeFile(path.join(process.cwd(), output, 'augment-api.ts'), (): string => writeFile(path.join(process.cwd(), output, 'augment-api.ts'), (): string =>
[ [
+14 -2
View File
@@ -8,11 +8,16 @@ import * as substrateDefs from '@polkadot/types/interfaces/definitions';
import { generateInterfaceTypes } from './generate/interfaceRegistry'; import { generateInterfaceTypes } from './generate/interfaceRegistry';
import { generateTsDef } from './generate/tsDef'; import { generateTsDef } from './generate/tsDef';
import { generateDefaultLookup } from './generate';
type ArgV = { input: string; package: string }; type ArgV = { input: string; package: string; endpoint?: string; };
export function main (): void { export function main (): void {
const { input, package: pkg } = yargs.strict().options({ const { endpoint, input, package: pkg } = yargs.strict().options({
endpoint: {
description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call',
type: 'string'
},
input: { input: {
description: 'The directory to use for the user definitions', description: 'The directory to use for the user definitions',
required: true, required: true,
@@ -25,6 +30,13 @@ export function main (): void {
} }
}).argv as ArgV; }).argv as ArgV;
if (endpoint) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const metaHex = (require(path.join(process.cwd(), endpoint)) as Record<string, string>).result;
generateDefaultLookup(path.join(process.cwd(), input), metaHex);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const userDefs = require(path.join(process.cwd(), input, 'definitions.ts')) as Record<string, any>; const userDefs = require(path.join(process.cwd(), input, 'definitions.ts')) as Record<string, any>;
const userKeys = Object.keys(userDefs); const userKeys = Object.keys(userDefs);
+10 -4
View File
@@ -8,6 +8,7 @@ import Handlebars from 'handlebars';
import lookupDefinitions from '@polkadot/types/augment/lookup/definitions'; import lookupDefinitions from '@polkadot/types/augment/lookup/definitions';
import * as defaultDefs from '@polkadot/types/interfaces/definitions'; import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { Definitions } from '@polkadot/types/types';
import { stringCamelCase } from '@polkadot/util'; import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util'; import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
@@ -16,10 +17,15 @@ const template = readTemplate('consts');
const generateForMetaTemplate = Handlebars.compile(template); const generateForMetaTemplate = Handlebars.compile(template);
/** @internal */ /** @internal */
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void { function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => { writeFile(dest, (): string => {
const allTypes = { const allTypes = {
'@polkadot/types/augment': { lookup: lookupDefinitions }, '@polkadot/types/augment': {
lookup: {
...lookupDefinitions,
...customLookupDefinitions
}
},
'@polkadot/types/interfaces': defaultDefs, '@polkadot/types/interfaces': defaultDefs,
...extraTypes ...extraTypes
}; };
@@ -79,8 +85,8 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
// Call `generateForMeta()` with current static metadata // Call `generateForMeta()` with current static metadata
/** @internal */ /** @internal */
export function generateDefaultConsts (dest = 'packages/api/src/augment/consts.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void { export function generateDefaultConsts (dest = 'packages/api/src/augment/consts.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata } = initMeta(data, extraTypes); const { metadata } = initMeta(data, extraTypes);
return generateForMeta(metadata, dest, extraTypes, isStrict); return generateForMeta(metadata, dest, extraTypes, isStrict, customLookupDefinitions);
} }
+10 -4
View File
@@ -8,6 +8,7 @@ import Handlebars from 'handlebars';
import lookupDefinitions from '@polkadot/types/augment/lookup/definitions'; import lookupDefinitions from '@polkadot/types/augment/lookup/definitions';
import * as defaultDefs from '@polkadot/types/interfaces/definitions'; import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import { Definitions } from '@polkadot/types/types';
import { stringCamelCase } from '@polkadot/util'; import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util'; import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
@@ -16,10 +17,15 @@ const template = readTemplate('events');
const generateForMetaTemplate = Handlebars.compile(template); const generateForMetaTemplate = Handlebars.compile(template);
/** @internal */ /** @internal */
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void { function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => { writeFile(dest, (): string => {
const allTypes = { const allTypes = {
'@polkadot/types/augment': { lookup: lookupDefinitions }, '@polkadot/types/augment': {
lookup: {
...lookupDefinitions,
...customLookupDefinitions
}
},
'@polkadot/types/interfaces': defaultDefs, '@polkadot/types/interfaces': defaultDefs,
...extraTypes ...extraTypes
}; };
@@ -71,8 +77,8 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
// Call `generateForMeta()` with current static metadata // Call `generateForMeta()` with current static metadata
/** @internal */ /** @internal */
export function generateDefaultEvents (dest = 'packages/api/src/augment/events.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void { export function generateDefaultEvents (dest = 'packages/api/src/augment/events.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata } = initMeta(data, extraTypes); const { metadata } = initMeta(data, extraTypes);
return generateForMeta(metadata, dest, extraTypes, isStrict); return generateForMeta(metadata, dest, extraTypes, isStrict, customLookupDefinitions);
} }
+2 -29
View File
@@ -18,7 +18,6 @@ import { isString, stringify } from '@polkadot/util';
import { createImports, exportType, initMeta, readTemplate, writeFile } from '../util'; import { createImports, exportType, initMeta, readTemplate, writeFile } from '../util';
import { typeEncoders } from './tsDef'; import { typeEncoders } from './tsDef';
const MAP_ENUMS = ['Call', 'Event', 'Error', 'RawEvent'];
const WITH_TYPEDEF = false; const WITH_TYPEDEF = false;
const generateLookupDefsTmpl = Handlebars.compile(readTemplate('lookup/defs')); const generateLookupDefsTmpl = Handlebars.compile(readTemplate('lookup/defs'));
@@ -131,33 +130,7 @@ function expandDefToString ({ lookupNameRoot, type }: TypeDef, indent: number):
} }
function getFilteredTypes (lookup: PortableRegistry, exclude: string[] = []): [PortableType, TypeDef][] { function getFilteredTypes (lookup: PortableRegistry, exclude: string[] = []): [PortableType, TypeDef][] {
const named = lookup.types.filter(({ id, type: { path } }) => { const named = lookup.types.filter(({ id }) => !!lookup.getTypeDef(id).lookupName);
const typeDef = lookup.getTypeDef(id);
return (
// We actually only want those with lookupName set
!!typeDef.lookupName &&
!(
path.length === 2 &&
(
(
// Ensure that we match {node, kusama, *}_runtime
path[0].toString().split('_')[1] === 'runtime' &&
!['Call', 'Event'].includes(path[1].toString())
) ||
path[0].toString().startsWith('pallet_')
) &&
// Ensure we strip generics, e.g. Event<T>
MAP_ENUMS.includes(path[1].toString().split('<')[0])
) &&
!(
path.length >= 3 &&
path[path.length - 2].toString() === 'pallet' &&
// As above, cater for generics
MAP_ENUMS.includes(path[path.length - 1].toString().split('<')[0])
)
);
});
const names = named.map(({ id }) => lookup.getName(id)); const names = named.map(({ id }) => lookup.getName(id));
return named return named
@@ -261,7 +234,7 @@ export function generateDefaultLookup (destDir = 'packages/types/src/augment/loo
generateLookup( generateLookup(
destDir, destDir,
staticData staticData
? [[undefined, staticData]] ? [['lookup', staticData]]
: [ : [
['substrate', staticSubstrate], ['substrate', staticSubstrate],
['polkadot', staticPolkadot], ['polkadot', staticPolkadot],
+10 -5
View File
@@ -3,7 +3,7 @@
import type { StorageEntryMetadataLatest } from '@polkadot/types/interfaces'; import type { StorageEntryMetadataLatest } from '@polkadot/types/interfaces';
import type { Metadata, PortableRegistry } from '@polkadot/types/metadata'; import type { Metadata, PortableRegistry } from '@polkadot/types/metadata';
import type { Registry } from '@polkadot/types/types'; import type { Definitions, Registry } from '@polkadot/types/types';
import type { ExtraTypes } from './types'; import type { ExtraTypes } from './types';
import Handlebars from 'handlebars'; import Handlebars from 'handlebars';
@@ -66,10 +66,15 @@ const template = readTemplate('query');
const generateForMetaTemplate = Handlebars.compile(template); const generateForMetaTemplate = Handlebars.compile(template);
/** @internal */ /** @internal */
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void { function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => { writeFile(dest, (): string => {
const allTypes: ExtraTypes = { const allTypes: ExtraTypes = {
'@polkadot/types/augment': { lookup: lookupDefinitions }, '@polkadot/types/augment': {
lookup: {
...lookupDefinitions,
...customLookupDefinitions
}
},
'@polkadot/types/interfaces': defaultDefs, '@polkadot/types/interfaces': defaultDefs,
...extraTypes ...extraTypes
}; };
@@ -129,8 +134,8 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
// Call `generateForMeta()` with current static metadata // Call `generateForMeta()` with current static metadata
/** @internal */ /** @internal */
export function generateDefaultQuery (dest = 'packages/api/src/augment/query.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void { export function generateDefaultQuery (dest = 'packages/api/src/augment/query.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata, registry } = initMeta(data, extraTypes); const { metadata, registry } = initMeta(data, extraTypes);
return generateForMeta(registry, metadata, dest, extraTypes, isStrict); return generateForMeta(registry, metadata, dest, extraTypes, isStrict, customLookupDefinitions);
} }
+2 -2
View File
@@ -11,7 +11,7 @@ import path from 'path';
import { getTypeDef, TypeRegistry } from '@polkadot/types/create'; import { getTypeDef, TypeRegistry } from '@polkadot/types/create';
import { TypeDefInfo } from '@polkadot/types/create/types'; import { TypeDefInfo } from '@polkadot/types/create/types';
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions'; import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
import { assert, isString, stringCamelCase, stringify, stringUpperFirst } from '@polkadot/util'; import { assert, isString, stringify, stringPascalCase } from '@polkadot/util';
import { createImports, exportInterface, exportType, formatType, readTemplate, setImports, TypeImports, writeFile } from '../util'; import { createImports, exportInterface, exportType, formatType, readTemplate, setImports, TypeImports, writeFile } from '../util';
@@ -56,7 +56,7 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
.filter(({ name }) => !!name && !name.startsWith('__Unused')) .filter(({ name }) => !!name && !name.startsWith('__Unused'))
.map((def, index): string => { .map((def, index): string => {
const { info, lookupName, name = `unknown${index}`, type } = def; const { info, lookupName, name = `unknown${index}`, type } = def;
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_'))); const getter = stringPascalCase(name.replace(' ', '_'));
const isComplex = [TypeDefInfo.Option, TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info); const isComplex = [TypeDefInfo.Option, TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
? '' ? ''
+10 -5
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Metadata } from '@polkadot/types/metadata/Metadata'; import type { Metadata } from '@polkadot/types/metadata/Metadata';
import type { Registry } from '@polkadot/types/types'; import type { Definitions, Registry } from '@polkadot/types/types';
import type { ExtraTypes } from './types'; import type { ExtraTypes } from './types';
import Handlebars from 'handlebars'; import Handlebars from 'handlebars';
@@ -29,10 +29,15 @@ const template = readTemplate('tx');
const generateForMetaTemplate = Handlebars.compile(template); const generateForMetaTemplate = Handlebars.compile(template);
/** @internal */ /** @internal */
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void { function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => { writeFile(dest, (): string => {
const allTypes: ExtraTypes = { const allTypes: ExtraTypes = {
'@polkadot/types/augment': { lookup: lookupDefinitions }, '@polkadot/types/augment': {
lookup: {
...lookupDefinitions,
...customLookupDefinitions
}
},
'@polkadot/types/interfaces': defaultDefs, '@polkadot/types/interfaces': defaultDefs,
...extraTypes ...extraTypes
}; };
@@ -114,8 +119,8 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
// Call `generateForMeta()` with current static metadata // Call `generateForMeta()` with current static metadata
/** @internal */ /** @internal */
export function generateDefaultTx (dest = 'packages/api/src/augment/tx.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void { export function generateDefaultTx (dest = 'packages/api/src/augment/tx.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata, registry } = initMeta(data, extraTypes); const { metadata, registry } = initMeta(data, extraTypes);
return generateForMeta(registry, metadata, dest, extraTypes, isStrict); return generateForMeta(registry, metadata, dest, extraTypes, isStrict, customLookupDefinitions);
} }
+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.8.1' }; export const packageInfo = { name: '@polkadot/typegen', version: '6.10.1' };
@@ -2,8 +2,6 @@
/* eslint-disable sort-keys */ /* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
export default { export default {
{{#each defs}} {{#each defs}}
{{> docs}} {{> docs}}
@@ -11,5 +9,5 @@ export default {
{{{this}}} {{{this}}}
{{/each}} {{/each}}
{{/each}} {{/each}}
} as DefinitionsTypes; };
{{> footer }} {{> footer }}
@@ -2,8 +2,6 @@
/* eslint-disable sort-keys */ /* eslint-disable sort-keys */
import type { Definitions } from '../../types';
export default { export default {
rpc: {}, rpc: {},
types: { types: {
@@ -14,5 +12,5 @@ export default {
{{/each}} {{/each}}
{{/each}} {{/each}}
} }
} as Definitions; };
{{> footer }} {{> footer }}
@@ -1,9 +1,9 @@
{{> header }} {{> header }}
{{{ imports }}}
declare module '@polkadot/types/lookup' { declare module '@polkadot/types/lookup' {
{{{ imports }}}
{{#each items}} {{#each items}}
{{{this}}} {{{this}}}
+5 -5
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/networks": "^7.8.2", "@polkadot/networks": "^8.0.2",
"@polkadot/types": "6.8.1", "@polkadot/types": "6.10.1",
"@polkadot/util": "^7.8.2" "@polkadot/util": "^8.0.2"
} }
} }
+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.8.1' }; export const packageInfo = { name: '@polkadot/types-known', version: '6.10.1' };
+3 -3
View File
@@ -20,10 +20,10 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/util": "^7.8.2" "@polkadot/util": "^8.0.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.8.1' }; export const packageInfo = { name: '@polkadot/types-support', version: '6.10.1' };
+7 -6
View File
@@ -20,17 +20,18 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "6.8.1", "version": "6.10.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.16.0", "@babel/runtime": "^7.16.3",
"@polkadot/util": "^7.8.2", "@polkadot/types-known": "6.10.1",
"@polkadot/util-crypto": "^7.8.2", "@polkadot/util": "^8.0.2",
"@polkadot/util-crypto": "^8.0.2",
"rxjs": "^7.4.0" "rxjs": "^7.4.0"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^7.8.2", "@polkadot/keyring": "^8.0.2",
"@polkadot/types-support": "6.8.1", "@polkadot/types-support": "6.10.1",
"@types/bn.js": "^4.11.6", "@types/bn.js": "^4.11.6",
"bn.js": "^4.12.0" "bn.js": "^4.12.0"
} }
+125 -44
View File
@@ -3,24 +3,45 @@
/* eslint-disable sort-keys */ /* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
export default { export default {
/** /**
* Lookup74: kusama_runtime::ProxyType * Lookup71: kusama_runtime::ProxyType
**/ **/
KusamaRuntimeProxyType: { KusamaRuntimeProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy', 'Auction'] _enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy', 'Auction']
}, },
/** /**
* Lookup108: xcm::v1::multilocation::MultiLocation * Lookup104: pallet_xcm::pallet::Event<T>
**/
PalletXcmEvent: {
_enum: {
Attempted: 'XcmV2TraitsOutcome',
Sent: '(XcmV1MultiLocation,XcmV1MultiLocation,XcmV2Xcm)',
UnexpectedResponse: '(XcmV1MultiLocation,u64)',
ResponseReady: '(u64,XcmV2Response)',
Notified: '(u64,u8,u8)',
NotifyOverweight: '(u64,u8,u8,u64,u64)',
NotifyDispatchError: '(u64,u8,u8)',
NotifyDecodeFailed: '(u64,u8,u8)',
InvalidResponder: '(XcmV1MultiLocation,u64,Option<XcmV1MultiLocation>)',
InvalidResponderVersion: '(XcmV1MultiLocation,u64)',
ResponseTaken: 'u64',
AssetsTrapped: '(H256,XcmV1MultiLocation,XcmVersionedMultiAssets)',
VersionChangeNotified: '(XcmV1MultiLocation,u32)',
SupportedVersionChanged: '(XcmV1MultiLocation,u32)',
NotifyTargetSendFail: '(XcmV1MultiLocation,u64,XcmV2TraitsError)',
NotifyTargetMigrationFail: '(XcmVersionedMultiLocation,u64)'
}
},
/**
* Lookup105: xcm::v1::multilocation::MultiLocation
**/ **/
XcmV1MultiLocation: { XcmV1MultiLocation: {
parents: 'u8', parents: 'u8',
interior: 'XcmV1MultilocationJunctions' interior: 'XcmV1MultilocationJunctions'
}, },
/** /**
* Lookup109: xcm::v1::multilocation::Junctions * Lookup106: xcm::v1::multilocation::Junctions
**/ **/
XcmV1MultilocationJunctions: { XcmV1MultilocationJunctions: {
_enum: { _enum: {
@@ -36,7 +57,7 @@ export default {
} }
}, },
/** /**
* Lookup110: xcm::v1::junction::Junction * Lookup107: xcm::v1::junction::Junction
**/ **/
XcmV1Junction: { XcmV1Junction: {
_enum: { _enum: {
@@ -64,7 +85,7 @@ export default {
} }
}, },
/** /**
* Lookup112: xcm::v0::junction::NetworkId * Lookup109: xcm::v0::junction::NetworkId
**/ **/
XcmV0JunctionNetworkId: { XcmV0JunctionNetworkId: {
_enum: { _enum: {
@@ -75,7 +96,7 @@ export default {
} }
}, },
/** /**
* Lookup114: xcm::v0::junction::BodyId * Lookup111: xcm::v0::junction::BodyId
**/ **/
XcmV0JunctionBodyId: { XcmV0JunctionBodyId: {
_enum: { _enum: {
@@ -89,7 +110,7 @@ export default {
} }
}, },
/** /**
* Lookup115: xcm::v0::junction::BodyPart * Lookup112: xcm::v0::junction::BodyPart
**/ **/
XcmV0JunctionBodyPart: { XcmV0JunctionBodyPart: {
_enum: { _enum: {
@@ -112,11 +133,11 @@ export default {
} }
}, },
/** /**
* Lookup116: xcm::v2::Xcm<Call> * Lookup113: xcm::v2::Xcm<Call>
**/ **/
XcmV2Xcm: 'Vec<XcmV2Instruction>', XcmV2Xcm: 'Vec<XcmV2Instruction>',
/** /**
* Lookup118: xcm::v2::Instruction<Call> * Lookup115: xcm::v2::Instruction<Call>
**/ **/
XcmV2Instruction: { XcmV2Instruction: {
_enum: { _enum: {
@@ -214,18 +235,18 @@ export default {
} }
}, },
/** /**
* Lookup119: xcm::v1::multiasset::MultiAssets * Lookup116: xcm::v1::multiasset::MultiAssets
**/ **/
XcmV1MultiassetMultiAssets: 'Vec<XcmV1MultiAsset>', XcmV1MultiassetMultiAssets: 'Vec<XcmV1MultiAsset>',
/** /**
* Lookup121: xcm::v1::multiasset::MultiAsset * Lookup118: xcm::v1::multiasset::MultiAsset
**/ **/
XcmV1MultiAsset: { XcmV1MultiAsset: {
id: 'XcmV1MultiassetAssetId', id: 'XcmV1MultiassetAssetId',
fun: 'XcmV1MultiassetFungibility' fun: 'XcmV1MultiassetFungibility'
}, },
/** /**
* Lookup122: xcm::v1::multiasset::AssetId * Lookup119: xcm::v1::multiasset::AssetId
**/ **/
XcmV1MultiassetAssetId: { XcmV1MultiassetAssetId: {
_enum: { _enum: {
@@ -234,7 +255,7 @@ export default {
} }
}, },
/** /**
* Lookup123: xcm::v1::multiasset::Fungibility * Lookup120: xcm::v1::multiasset::Fungibility
**/ **/
XcmV1MultiassetFungibility: { XcmV1MultiassetFungibility: {
_enum: { _enum: {
@@ -243,7 +264,7 @@ export default {
} }
}, },
/** /**
* Lookup124: xcm::v1::multiasset::AssetInstance * Lookup121: xcm::v1::multiasset::AssetInstance
**/ **/
XcmV1MultiassetAssetInstance: { XcmV1MultiassetAssetInstance: {
_enum: { _enum: {
@@ -257,7 +278,7 @@ export default {
} }
}, },
/** /**
* Lookup126: xcm::v2::Response * Lookup123: xcm::v2::Response
**/ **/
XcmV2Response: { XcmV2Response: {
_enum: { _enum: {
@@ -268,19 +289,19 @@ export default {
} }
}, },
/** /**
* Lookup129: xcm::v0::OriginKind * Lookup126: xcm::v0::OriginKind
**/ **/
XcmV0OriginKind: { XcmV0OriginKind: {
_enum: ['Native', 'SovereignAccount', 'Superuser', 'Xcm'] _enum: ['Native', 'SovereignAccount', 'Superuser', 'Xcm']
}, },
/** /**
* Lookup130: xcm::double_encoded::DoubleEncoded<T> * Lookup127: xcm::double_encoded::DoubleEncoded<T>
**/ **/
XcmDoubleEncoded: { XcmDoubleEncoded: {
encoded: 'Bytes' encoded: 'Bytes'
}, },
/** /**
* Lookup131: xcm::v1::multiasset::MultiAssetFilter * Lookup128: xcm::v1::multiasset::MultiAssetFilter
**/ **/
XcmV1MultiassetMultiAssetFilter: { XcmV1MultiassetMultiAssetFilter: {
_enum: { _enum: {
@@ -289,7 +310,7 @@ export default {
} }
}, },
/** /**
* Lookup132: xcm::v1::multiasset::WildMultiAsset * Lookup129: xcm::v1::multiasset::WildMultiAsset
**/ **/
XcmV1MultiassetWildMultiAsset: { XcmV1MultiassetWildMultiAsset: {
_enum: { _enum: {
@@ -301,13 +322,13 @@ export default {
} }
}, },
/** /**
* Lookup133: xcm::v1::multiasset::WildFungibility * Lookup130: xcm::v1::multiasset::WildFungibility
**/ **/
XcmV1MultiassetWildFungibility: { XcmV1MultiassetWildFungibility: {
_enum: ['Fungible', 'NonFungible'] _enum: ['Fungible', 'NonFungible']
}, },
/** /**
* Lookup134: xcm::v2::WeightLimit * Lookup131: xcm::v2::WeightLimit
**/ **/
XcmV2WeightLimit: { XcmV2WeightLimit: {
_enum: { _enum: {
@@ -316,7 +337,7 @@ export default {
} }
}, },
/** /**
* Lookup136: xcm::VersionedMultiAssets * Lookup133: xcm::VersionedMultiAssets
**/ **/
XcmVersionedMultiAssets: { XcmVersionedMultiAssets: {
_enum: { _enum: {
@@ -325,7 +346,7 @@ export default {
} }
}, },
/** /**
* Lookup138: xcm::v0::multi_asset::MultiAsset * Lookup135: xcm::v0::multi_asset::MultiAsset
**/ **/
XcmV0MultiAsset: { XcmV0MultiAsset: {
_enum: { _enum: {
@@ -364,7 +385,7 @@ export default {
} }
}, },
/** /**
* Lookup139: xcm::v0::multi_location::MultiLocation * Lookup136: xcm::v0::multi_location::MultiLocation
**/ **/
XcmV0MultiLocation: { XcmV0MultiLocation: {
_enum: { _enum: {
@@ -380,7 +401,7 @@ export default {
} }
}, },
/** /**
* Lookup140: xcm::v0::junction::Junction * Lookup137: xcm::v0::junction::Junction
**/ **/
XcmV0Junction: { XcmV0Junction: {
_enum: { _enum: {
@@ -409,7 +430,7 @@ export default {
} }
}, },
/** /**
* Lookup141: xcm::VersionedMultiLocation * Lookup138: xcm::VersionedMultiLocation
**/ **/
XcmVersionedMultiLocation: { XcmVersionedMultiLocation: {
_enum: { _enum: {
@@ -418,7 +439,7 @@ export default {
} }
}, },
/** /**
* Lookup241: kusama_runtime::SessionKeys * Lookup238: kusama_runtime::SessionKeys
**/ **/
KusamaRuntimeSessionKeys: { KusamaRuntimeSessionKeys: {
grandpa: 'SpFinalityGrandpaAppPublic', grandpa: 'SpFinalityGrandpaAppPublic',
@@ -429,7 +450,7 @@ export default {
authorityDiscovery: 'SpAuthorityDiscoveryAppPublic' authorityDiscovery: 'SpAuthorityDiscoveryAppPublic'
}, },
/** /**
* Lookup316: kusama_runtime::OriginCaller * Lookup313: kusama_runtime::OriginCaller
**/ **/
KusamaRuntimeOriginCaller: { KusamaRuntimeOriginCaller: {
_enum: { _enum: {
@@ -536,7 +557,7 @@ export default {
} }
}, },
/** /**
* Lookup321: pallet_xcm::pallet::Origin * Lookup318: pallet_xcm::pallet::Origin
**/ **/
PalletXcmOrigin: { PalletXcmOrigin: {
_enum: { _enum: {
@@ -545,7 +566,7 @@ export default {
} }
}, },
/** /**
* Lookup379: kusama_runtime::NposCompactSolution24 * Lookup376: kusama_runtime::NposCompactSolution24
**/ **/
KusamaRuntimeNposCompactSolution24: { KusamaRuntimeNposCompactSolution24: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>', votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
@@ -574,7 +595,61 @@ export default {
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>' votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
}, },
/** /**
* Lookup512: xcm::VersionedXcm<Call> * Lookup508: pallet_xcm::pallet::Call<T>
**/
PalletXcmCall: {
_enum: {
send: {
dest: 'XcmVersionedMultiLocation',
message: 'XcmVersionedXcm',
},
teleport_assets: {
dest: 'XcmVersionedMultiLocation',
beneficiary: 'XcmVersionedMultiLocation',
assets: 'XcmVersionedMultiAssets',
feeAssetItem: 'u32',
},
reserve_transfer_assets: {
dest: 'XcmVersionedMultiLocation',
beneficiary: 'XcmVersionedMultiLocation',
assets: 'XcmVersionedMultiAssets',
feeAssetItem: 'u32',
},
execute: {
message: 'XcmVersionedXcm',
maxWeight: 'u64',
},
force_xcm_version: {
location: 'XcmV1MultiLocation',
xcmVersion: 'u32',
},
force_default_xcm_version: {
maybeXcmVersion: 'Option<u32>',
},
force_subscribe_version_notify: {
location: 'XcmVersionedMultiLocation',
},
force_unsubscribe_version_notify: {
location: 'XcmVersionedMultiLocation',
},
limited_reserve_transfer_assets: {
dest: 'XcmVersionedMultiLocation',
beneficiary: 'XcmVersionedMultiLocation',
assets: 'XcmVersionedMultiAssets',
feeAssetItem: 'u32',
weightLimit: 'XcmV2WeightLimit',
},
limited_teleport_assets: {
dest: 'XcmVersionedMultiLocation',
beneficiary: 'XcmVersionedMultiLocation',
assets: 'XcmVersionedMultiAssets',
feeAssetItem: 'u32',
weightLimit: 'XcmV2WeightLimit'
}
}
},
/**
* Lookup509: xcm::VersionedXcm<Call>
**/ **/
XcmVersionedXcm: { XcmVersionedXcm: {
_enum: { _enum: {
@@ -584,7 +659,7 @@ export default {
} }
}, },
/** /**
* Lookup513: xcm::v0::Xcm<Call> * Lookup510: xcm::v0::Xcm<Call>
**/ **/
XcmV0Xcm: { XcmV0Xcm: {
_enum: { _enum: {
@@ -638,7 +713,7 @@ export default {
} }
}, },
/** /**
* Lookup515: xcm::v0::order::Order<Call> * Lookup512: xcm::v0::order::Order<Call>
**/ **/
XcmV0Order: { XcmV0Order: {
_enum: { _enum: {
@@ -681,7 +756,7 @@ export default {
} }
}, },
/** /**
* Lookup517: xcm::v0::Response * Lookup514: xcm::v0::Response
**/ **/
XcmV0Response: { XcmV0Response: {
_enum: { _enum: {
@@ -689,7 +764,7 @@ export default {
} }
}, },
/** /**
* Lookup518: xcm::v1::Xcm<Call> * Lookup515: xcm::v1::Xcm<Call>
**/ **/
XcmV1Xcm: { XcmV1Xcm: {
_enum: { _enum: {
@@ -748,7 +823,7 @@ export default {
} }
}, },
/** /**
* Lookup520: xcm::v1::order::Order<Call> * Lookup517: xcm::v1::order::Order<Call>
**/ **/
XcmV1Order: { XcmV1Order: {
_enum: { _enum: {
@@ -793,7 +868,7 @@ export default {
} }
}, },
/** /**
* Lookup522: xcm::v1::Response * Lookup519: xcm::v1::Response
**/ **/
XcmV1Response: { XcmV1Response: {
_enum: { _enum: {
@@ -802,7 +877,7 @@ export default {
} }
}, },
/** /**
* Lookup690: pallet_xcm::pallet::QueryStatus<BlockNumber> * Lookup687: pallet_xcm::pallet::QueryStatus<BlockNumber>
**/ **/
PalletXcmQueryStatus: { PalletXcmQueryStatus: {
_enum: { _enum: {
@@ -822,7 +897,7 @@ export default {
} }
}, },
/** /**
* Lookup693: xcm::VersionedResponse * Lookup690: xcm::VersionedResponse
**/ **/
XcmVersionedResponse: { XcmVersionedResponse: {
_enum: { _enum: {
@@ -832,7 +907,7 @@ export default {
} }
}, },
/** /**
* Lookup699: pallet_xcm::pallet::VersionMigrationStage * Lookup696: pallet_xcm::pallet::VersionMigrationStage
**/ **/
PalletXcmVersionMigrationStage: { PalletXcmVersionMigrationStage: {
_enum: { _enum: {
@@ -843,7 +918,13 @@ export default {
} }
}, },
/** /**
* Lookup711: kusama_runtime::Runtime * Lookup697: pallet_xcm::pallet::Error<T>
**/
PalletXcmError: {
_enum: ['Unreachable', 'SendFailure', 'Filtered', 'UnweighableMessage', 'DestinationNotInvertible', 'Empty', 'CannotReanchor', 'TooManyAssets', 'InvalidOrigin', 'BadVersion', 'BadLocation', 'NoSubscription', 'AlreadySubscribed']
},
/**
* Lookup708: kusama_runtime::Runtime
**/ **/
KusamaRuntimeRuntime: 'Null' KusamaRuntimeRuntime: 'Null'
} as DefinitionsTypes; };
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+159 -45
View File
@@ -1,13 +1,13 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit // Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */ /* eslint-disable */
import type { Bytes, Compact, Enum, Null, Option, Struct, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { PerU16 } from '@polkadot/types/interfaces/runtime';
import type { ITuple } from '@polkadot/types/types';
declare module '@polkadot/types/lookup' { declare module '@polkadot/types/lookup' {
/** @name KusamaRuntimeProxyType (74) */ import type { Bytes, Compact, Enum, Null, Option, Struct, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { H256, PerU16 } from '@polkadot/types/interfaces/runtime';
import type { ITuple } from '@polkadot/types/types';
/** @name KusamaRuntimeProxyType (71) */
export interface KusamaRuntimeProxyType extends Enum { export interface KusamaRuntimeProxyType extends Enum {
readonly isAny: boolean; readonly isAny: boolean;
readonly isNonTransfer: boolean; readonly isNonTransfer: boolean;
@@ -18,13 +18,49 @@ declare module '@polkadot/types/lookup' {
readonly isAuction: boolean; readonly isAuction: boolean;
} }
/** @name XcmV1MultiLocation (108) */ /** @name PalletXcmEvent (104) */
export interface PalletXcmEvent extends Enum {
readonly isAttempted: boolean;
readonly asAttempted: XcmV2TraitsOutcome;
readonly isSent: boolean;
readonly asSent: ITuple<[XcmV1MultiLocation, XcmV1MultiLocation, XcmV2Xcm]>;
readonly isUnexpectedResponse: boolean;
readonly asUnexpectedResponse: ITuple<[XcmV1MultiLocation, u64]>;
readonly isResponseReady: boolean;
readonly asResponseReady: ITuple<[u64, XcmV2Response]>;
readonly isNotified: boolean;
readonly asNotified: ITuple<[u64, u8, u8]>;
readonly isNotifyOverweight: boolean;
readonly asNotifyOverweight: ITuple<[u64, u8, u8, u64, u64]>;
readonly isNotifyDispatchError: boolean;
readonly asNotifyDispatchError: ITuple<[u64, u8, u8]>;
readonly isNotifyDecodeFailed: boolean;
readonly asNotifyDecodeFailed: ITuple<[u64, u8, u8]>;
readonly isInvalidResponder: boolean;
readonly asInvalidResponder: ITuple<[XcmV1MultiLocation, u64, Option<XcmV1MultiLocation>]>;
readonly isInvalidResponderVersion: boolean;
readonly asInvalidResponderVersion: ITuple<[XcmV1MultiLocation, u64]>;
readonly isResponseTaken: boolean;
readonly asResponseTaken: u64;
readonly isAssetsTrapped: boolean;
readonly asAssetsTrapped: ITuple<[H256, XcmV1MultiLocation, XcmVersionedMultiAssets]>;
readonly isVersionChangeNotified: boolean;
readonly asVersionChangeNotified: ITuple<[XcmV1MultiLocation, u32]>;
readonly isSupportedVersionChanged: boolean;
readonly asSupportedVersionChanged: ITuple<[XcmV1MultiLocation, u32]>;
readonly isNotifyTargetSendFail: boolean;
readonly asNotifyTargetSendFail: ITuple<[XcmV1MultiLocation, u64, XcmV2TraitsError]>;
readonly isNotifyTargetMigrationFail: boolean;
readonly asNotifyTargetMigrationFail: ITuple<[XcmVersionedMultiLocation, u64]>;
}
/** @name XcmV1MultiLocation (105) */
export interface XcmV1MultiLocation extends Struct { export interface XcmV1MultiLocation extends Struct {
readonly parents: u8; readonly parents: u8;
readonly interior: XcmV1MultilocationJunctions; readonly interior: XcmV1MultilocationJunctions;
} }
/** @name XcmV1MultilocationJunctions (109) */ /** @name XcmV1MultilocationJunctions (106) */
export interface XcmV1MultilocationJunctions extends Enum { export interface XcmV1MultilocationJunctions extends Enum {
readonly isHere: boolean; readonly isHere: boolean;
readonly isX1: boolean; readonly isX1: boolean;
@@ -45,7 +81,7 @@ declare module '@polkadot/types/lookup' {
readonly asX8: ITuple<[XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction]>; readonly asX8: ITuple<[XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction, XcmV1Junction]>;
} }
/** @name XcmV1Junction (110) */ /** @name XcmV1Junction (107) */
export interface XcmV1Junction extends Enum { export interface XcmV1Junction extends Enum {
readonly isParachain: boolean; readonly isParachain: boolean;
readonly asParachain: Compact<u32>; readonly asParachain: Compact<u32>;
@@ -78,7 +114,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV0JunctionNetworkId (112) */ /** @name XcmV0JunctionNetworkId (109) */
export interface XcmV0JunctionNetworkId extends Enum { export interface XcmV0JunctionNetworkId extends Enum {
readonly isAny: boolean; readonly isAny: boolean;
readonly isNamed: boolean; readonly isNamed: boolean;
@@ -87,7 +123,7 @@ declare module '@polkadot/types/lookup' {
readonly isKusama: boolean; readonly isKusama: boolean;
} }
/** @name XcmV0JunctionBodyId (114) */ /** @name XcmV0JunctionBodyId (111) */
export interface XcmV0JunctionBodyId extends Enum { export interface XcmV0JunctionBodyId extends Enum {
readonly isUnit: boolean; readonly isUnit: boolean;
readonly isNamed: boolean; readonly isNamed: boolean;
@@ -100,7 +136,7 @@ declare module '@polkadot/types/lookup' {
readonly isJudicial: boolean; readonly isJudicial: boolean;
} }
/** @name XcmV0JunctionBodyPart (115) */ /** @name XcmV0JunctionBodyPart (112) */
export interface XcmV0JunctionBodyPart extends Enum { export interface XcmV0JunctionBodyPart extends Enum {
readonly isVoice: boolean; readonly isVoice: boolean;
readonly isMembers: boolean; readonly isMembers: boolean;
@@ -124,10 +160,10 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV2Xcm (116) */ /** @name XcmV2Xcm (113) */
export interface XcmV2Xcm extends Vec<XcmV2Instruction> {} export interface XcmV2Xcm extends Vec<XcmV2Instruction> {}
/** @name XcmV2Instruction (118) */ /** @name XcmV2Instruction (115) */
export interface XcmV2Instruction extends Enum { export interface XcmV2Instruction extends Enum {
readonly isWithdrawAsset: boolean; readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: XcmV1MultiassetMultiAssets; readonly asWithdrawAsset: XcmV1MultiassetMultiAssets;
@@ -246,16 +282,16 @@ declare module '@polkadot/types/lookup' {
readonly isUnsubscribeVersion: boolean; readonly isUnsubscribeVersion: boolean;
} }
/** @name XcmV1MultiassetMultiAssets (119) */ /** @name XcmV1MultiassetMultiAssets (116) */
export interface XcmV1MultiassetMultiAssets extends Vec<XcmV1MultiAsset> {} export interface XcmV1MultiassetMultiAssets extends Vec<XcmV1MultiAsset> {}
/** @name XcmV1MultiAsset (121) */ /** @name XcmV1MultiAsset (118) */
export interface XcmV1MultiAsset extends Struct { export interface XcmV1MultiAsset extends Struct {
readonly id: XcmV1MultiassetAssetId; readonly id: XcmV1MultiassetAssetId;
readonly fun: XcmV1MultiassetFungibility; readonly fun: XcmV1MultiassetFungibility;
} }
/** @name XcmV1MultiassetAssetId (122) */ /** @name XcmV1MultiassetAssetId (119) */
export interface XcmV1MultiassetAssetId extends Enum { export interface XcmV1MultiassetAssetId extends Enum {
readonly isConcrete: boolean; readonly isConcrete: boolean;
readonly asConcrete: XcmV1MultiLocation; readonly asConcrete: XcmV1MultiLocation;
@@ -263,7 +299,7 @@ declare module '@polkadot/types/lookup' {
readonly asAbstract: Bytes; readonly asAbstract: Bytes;
} }
/** @name XcmV1MultiassetFungibility (123) */ /** @name XcmV1MultiassetFungibility (120) */
export interface XcmV1MultiassetFungibility extends Enum { export interface XcmV1MultiassetFungibility extends Enum {
readonly isFungible: boolean; readonly isFungible: boolean;
readonly asFungible: Compact<u128>; readonly asFungible: Compact<u128>;
@@ -271,7 +307,7 @@ declare module '@polkadot/types/lookup' {
readonly asNonFungible: XcmV1MultiassetAssetInstance; readonly asNonFungible: XcmV1MultiassetAssetInstance;
} }
/** @name XcmV1MultiassetAssetInstance (124) */ /** @name XcmV1MultiassetAssetInstance (121) */
export interface XcmV1MultiassetAssetInstance extends Enum { export interface XcmV1MultiassetAssetInstance extends Enum {
readonly isUndefined: boolean; readonly isUndefined: boolean;
readonly isIndex: boolean; readonly isIndex: boolean;
@@ -288,7 +324,7 @@ declare module '@polkadot/types/lookup' {
readonly asBlob: Bytes; readonly asBlob: Bytes;
} }
/** @name XcmV2Response (126) */ /** @name XcmV2Response (123) */
export interface XcmV2Response extends Enum { export interface XcmV2Response extends Enum {
readonly isNull: boolean; readonly isNull: boolean;
readonly isAssets: boolean; readonly isAssets: boolean;
@@ -299,7 +335,7 @@ declare module '@polkadot/types/lookup' {
readonly asVersion: u32; readonly asVersion: u32;
} }
/** @name XcmV0OriginKind (129) */ /** @name XcmV0OriginKind (126) */
export interface XcmV0OriginKind extends Enum { export interface XcmV0OriginKind extends Enum {
readonly isNative: boolean; readonly isNative: boolean;
readonly isSovereignAccount: boolean; readonly isSovereignAccount: boolean;
@@ -307,12 +343,12 @@ declare module '@polkadot/types/lookup' {
readonly isXcm: boolean; readonly isXcm: boolean;
} }
/** @name XcmDoubleEncoded (130) */ /** @name XcmDoubleEncoded (127) */
export interface XcmDoubleEncoded extends Struct { export interface XcmDoubleEncoded extends Struct {
readonly encoded: Bytes; readonly encoded: Bytes;
} }
/** @name XcmV1MultiassetMultiAssetFilter (131) */ /** @name XcmV1MultiassetMultiAssetFilter (128) */
export interface XcmV1MultiassetMultiAssetFilter extends Enum { export interface XcmV1MultiassetMultiAssetFilter extends Enum {
readonly isDefinite: boolean; readonly isDefinite: boolean;
readonly asDefinite: XcmV1MultiassetMultiAssets; readonly asDefinite: XcmV1MultiassetMultiAssets;
@@ -320,7 +356,7 @@ declare module '@polkadot/types/lookup' {
readonly asWild: XcmV1MultiassetWildMultiAsset; readonly asWild: XcmV1MultiassetWildMultiAsset;
} }
/** @name XcmV1MultiassetWildMultiAsset (132) */ /** @name XcmV1MultiassetWildMultiAsset (129) */
export interface XcmV1MultiassetWildMultiAsset extends Enum { export interface XcmV1MultiassetWildMultiAsset extends Enum {
readonly isAll: boolean; readonly isAll: boolean;
readonly isAllOf: boolean; readonly isAllOf: boolean;
@@ -330,20 +366,20 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV1MultiassetWildFungibility (133) */ /** @name XcmV1MultiassetWildFungibility (130) */
export interface XcmV1MultiassetWildFungibility extends Enum { export interface XcmV1MultiassetWildFungibility extends Enum {
readonly isFungible: boolean; readonly isFungible: boolean;
readonly isNonFungible: boolean; readonly isNonFungible: boolean;
} }
/** @name XcmV2WeightLimit (134) */ /** @name XcmV2WeightLimit (131) */
export interface XcmV2WeightLimit extends Enum { export interface XcmV2WeightLimit extends Enum {
readonly isUnlimited: boolean; readonly isUnlimited: boolean;
readonly isLimited: boolean; readonly isLimited: boolean;
readonly asLimited: Compact<u64>; readonly asLimited: Compact<u64>;
} }
/** @name XcmVersionedMultiAssets (136) */ /** @name XcmVersionedMultiAssets (133) */
export interface XcmVersionedMultiAssets extends Enum { export interface XcmVersionedMultiAssets extends Enum {
readonly isV0: boolean; readonly isV0: boolean;
readonly asV0: Vec<XcmV0MultiAsset>; readonly asV0: Vec<XcmV0MultiAsset>;
@@ -351,7 +387,7 @@ declare module '@polkadot/types/lookup' {
readonly asV1: XcmV1MultiassetMultiAssets; readonly asV1: XcmV1MultiassetMultiAssets;
} }
/** @name XcmV0MultiAsset (138) */ /** @name XcmV0MultiAsset (135) */
export interface XcmV0MultiAsset extends Enum { export interface XcmV0MultiAsset extends Enum {
readonly isNone: boolean; readonly isNone: boolean;
readonly isAll: boolean; readonly isAll: boolean;
@@ -395,7 +431,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV0MultiLocation (139) */ /** @name XcmV0MultiLocation (136) */
export interface XcmV0MultiLocation extends Enum { export interface XcmV0MultiLocation extends Enum {
readonly isNull: boolean; readonly isNull: boolean;
readonly isX1: boolean; readonly isX1: boolean;
@@ -416,7 +452,7 @@ declare module '@polkadot/types/lookup' {
readonly asX8: ITuple<[XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction]>; readonly asX8: ITuple<[XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction, XcmV0Junction]>;
} }
/** @name XcmV0Junction (140) */ /** @name XcmV0Junction (137) */
export interface XcmV0Junction extends Enum { export interface XcmV0Junction extends Enum {
readonly isParent: boolean; readonly isParent: boolean;
readonly isParachain: boolean; readonly isParachain: boolean;
@@ -450,7 +486,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmVersionedMultiLocation (141) */ /** @name XcmVersionedMultiLocation (138) */
export interface XcmVersionedMultiLocation extends Enum { export interface XcmVersionedMultiLocation extends Enum {
readonly isV0: boolean; readonly isV0: boolean;
readonly asV0: XcmV0MultiLocation; readonly asV0: XcmV0MultiLocation;
@@ -458,7 +494,7 @@ declare module '@polkadot/types/lookup' {
readonly asV1: XcmV1MultiLocation; readonly asV1: XcmV1MultiLocation;
} }
/** @name KusamaRuntimeSessionKeys (241) */ /** @name KusamaRuntimeSessionKeys (238) */
export interface KusamaRuntimeSessionKeys extends Struct { export interface KusamaRuntimeSessionKeys extends Struct {
readonly grandpa: SpFinalityGrandpaAppPublic; readonly grandpa: SpFinalityGrandpaAppPublic;
readonly babe: SpConsensusBabeAppPublic; readonly babe: SpConsensusBabeAppPublic;
@@ -468,7 +504,7 @@ declare module '@polkadot/types/lookup' {
readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic; readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic;
} }
/** @name KusamaRuntimeOriginCaller (316) */ /** @name KusamaRuntimeOriginCaller (313) */
export interface KusamaRuntimeOriginCaller extends Enum { export interface KusamaRuntimeOriginCaller extends Enum {
readonly isSystem: boolean; readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin; readonly asSystem: FrameSystemRawOrigin;
@@ -483,7 +519,7 @@ declare module '@polkadot/types/lookup' {
readonly asXcmPallet: PalletXcmOrigin; readonly asXcmPallet: PalletXcmOrigin;
} }
/** @name PalletXcmOrigin (321) */ /** @name PalletXcmOrigin (318) */
export interface PalletXcmOrigin extends Enum { export interface PalletXcmOrigin extends Enum {
readonly isXcm: boolean; readonly isXcm: boolean;
readonly asXcm: XcmV1MultiLocation; readonly asXcm: XcmV1MultiLocation;
@@ -491,7 +527,7 @@ declare module '@polkadot/types/lookup' {
readonly asResponse: XcmV1MultiLocation; readonly asResponse: XcmV1MultiLocation;
} }
/** @name KusamaRuntimeNposCompactSolution24 (379) */ /** @name KusamaRuntimeNposCompactSolution24 (376) */
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>]>>;
@@ -519,7 +555,68 @@ 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 (512) */ /** @name PalletXcmCall (508) */
export interface PalletXcmCall extends Enum {
readonly isSend: boolean;
readonly asSend: {
readonly dest: XcmVersionedMultiLocation;
readonly message: XcmVersionedXcm;
} & Struct;
readonly isTeleportAssets: boolean;
readonly asTeleportAssets: {
readonly dest: XcmVersionedMultiLocation;
readonly beneficiary: XcmVersionedMultiLocation;
readonly assets: XcmVersionedMultiAssets;
readonly feeAssetItem: u32;
} & Struct;
readonly isReserveTransferAssets: boolean;
readonly asReserveTransferAssets: {
readonly dest: XcmVersionedMultiLocation;
readonly beneficiary: XcmVersionedMultiLocation;
readonly assets: XcmVersionedMultiAssets;
readonly feeAssetItem: u32;
} & Struct;
readonly isExecute: boolean;
readonly asExecute: {
readonly message: XcmVersionedXcm;
readonly maxWeight: u64;
} & Struct;
readonly isForceXcmVersion: boolean;
readonly asForceXcmVersion: {
readonly location: XcmV1MultiLocation;
readonly xcmVersion: u32;
} & Struct;
readonly isForceDefaultXcmVersion: boolean;
readonly asForceDefaultXcmVersion: {
readonly maybeXcmVersion: Option<u32>;
} & Struct;
readonly isForceSubscribeVersionNotify: boolean;
readonly asForceSubscribeVersionNotify: {
readonly location: XcmVersionedMultiLocation;
} & Struct;
readonly isForceUnsubscribeVersionNotify: boolean;
readonly asForceUnsubscribeVersionNotify: {
readonly location: XcmVersionedMultiLocation;
} & Struct;
readonly isLimitedReserveTransferAssets: boolean;
readonly asLimitedReserveTransferAssets: {
readonly dest: XcmVersionedMultiLocation;
readonly beneficiary: XcmVersionedMultiLocation;
readonly assets: XcmVersionedMultiAssets;
readonly feeAssetItem: u32;
readonly weightLimit: XcmV2WeightLimit;
} & Struct;
readonly isLimitedTeleportAssets: boolean;
readonly asLimitedTeleportAssets: {
readonly dest: XcmVersionedMultiLocation;
readonly beneficiary: XcmVersionedMultiLocation;
readonly assets: XcmVersionedMultiAssets;
readonly feeAssetItem: u32;
readonly weightLimit: XcmV2WeightLimit;
} & Struct;
}
/** @name XcmVersionedXcm (509) */
export interface XcmVersionedXcm extends Enum { export interface XcmVersionedXcm extends Enum {
readonly isV0: boolean; readonly isV0: boolean;
readonly asV0: XcmV0Xcm; readonly asV0: XcmV0Xcm;
@@ -529,7 +626,7 @@ declare module '@polkadot/types/lookup' {
readonly asV2: XcmV2Xcm; readonly asV2: XcmV2Xcm;
} }
/** @name XcmV0Xcm (513) */ /** @name XcmV0Xcm (510) */
export interface XcmV0Xcm extends Enum { export interface XcmV0Xcm extends Enum {
readonly isWithdrawAsset: boolean; readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: { readonly asWithdrawAsset: {
@@ -591,7 +688,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV0Order (515) */ /** @name XcmV0Order (512) */
export interface XcmV0Order extends Enum { export interface XcmV0Order extends Enum {
readonly isNull: boolean; readonly isNull: boolean;
readonly isDepositAsset: boolean; readonly isDepositAsset: boolean;
@@ -638,13 +735,13 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV0Response (517) */ /** @name XcmV0Response (514) */
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 (518) */ /** @name XcmV1Xcm (515) */
export interface XcmV1Xcm extends Enum { export interface XcmV1Xcm extends Enum {
readonly isWithdrawAsset: boolean; readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: { readonly asWithdrawAsset: {
@@ -712,7 +809,7 @@ declare module '@polkadot/types/lookup' {
readonly isUnsubscribeVersion: boolean; readonly isUnsubscribeVersion: boolean;
} }
/** @name XcmV1Order (520) */ /** @name XcmV1Order (517) */
export interface XcmV1Order extends Enum { export interface XcmV1Order extends Enum {
readonly isNoop: boolean; readonly isNoop: boolean;
readonly isDepositAsset: boolean; readonly isDepositAsset: boolean;
@@ -761,7 +858,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmV1Response (522) */ /** @name XcmV1Response (519) */
export interface XcmV1Response extends Enum { export interface XcmV1Response extends Enum {
readonly isAssets: boolean; readonly isAssets: boolean;
readonly asAssets: XcmV1MultiassetMultiAssets; readonly asAssets: XcmV1MultiassetMultiAssets;
@@ -769,7 +866,7 @@ declare module '@polkadot/types/lookup' {
readonly asVersion: u32; readonly asVersion: u32;
} }
/** @name PalletXcmQueryStatus (690) */ /** @name PalletXcmQueryStatus (687) */
export interface PalletXcmQueryStatus extends Enum { export interface PalletXcmQueryStatus extends Enum {
readonly isPending: boolean; readonly isPending: boolean;
readonly asPending: { readonly asPending: {
@@ -789,7 +886,7 @@ declare module '@polkadot/types/lookup' {
} & Struct; } & Struct;
} }
/** @name XcmVersionedResponse (693) */ /** @name XcmVersionedResponse (690) */
export interface XcmVersionedResponse extends Enum { export interface XcmVersionedResponse extends Enum {
readonly isV0: boolean; readonly isV0: boolean;
readonly asV0: XcmV0Response; readonly asV0: XcmV0Response;
@@ -799,7 +896,7 @@ declare module '@polkadot/types/lookup' {
readonly asV2: XcmV2Response; readonly asV2: XcmV2Response;
} }
/** @name PalletXcmVersionMigrationStage (699) */ /** @name PalletXcmVersionMigrationStage (696) */
export interface PalletXcmVersionMigrationStage extends Enum { export interface PalletXcmVersionMigrationStage extends Enum {
readonly isMigrateSupportedVersion: boolean; readonly isMigrateSupportedVersion: boolean;
readonly isMigrateVersionNotifiers: boolean; readonly isMigrateVersionNotifiers: boolean;
@@ -808,7 +905,24 @@ declare module '@polkadot/types/lookup' {
readonly isMigrateAndNotifyOldTargets: boolean; readonly isMigrateAndNotifyOldTargets: boolean;
} }
/** @name KusamaRuntimeRuntime (711) */ /** @name PalletXcmError (697) */
export interface PalletXcmError extends Enum {
readonly isUnreachable: boolean;
readonly isSendFailure: boolean;
readonly isFiltered: boolean;
readonly isUnweighableMessage: boolean;
readonly isDestinationNotInvertible: boolean;
readonly isEmpty: boolean;
readonly isCannotReanchor: boolean;
readonly isTooManyAssets: boolean;
readonly isInvalidOrigin: boolean;
readonly isBadVersion: boolean;
readonly isBadLocation: boolean;
readonly isNoSubscription: boolean;
readonly isAlreadySubscribed: boolean;
}
/** @name KusamaRuntimeRuntime (708) */
export type KusamaRuntimeRuntime = Null; export type KusamaRuntimeRuntime = Null;
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -81,8 +81,9 @@ assert(hh[0].bitLength() && ms[0].strings && ms[1].values && ms[2].keys, 'All ok
const tt1 = registry.createType('(u32, Compact<u64>, u128 , Something)'); const tt1 = registry.createType('(u32, Compact<u64>, u128 , Something)');
// unwraps into a u32 // unwraps into a u32
const tt2 = registry.createType('(((u32)))'); const tt2 = registry.createType('(((u32)))');
// TEST: Adding a single param makes this go over the recursion limit in 4.4.4
// lots and lots of params (indicates recursion limit) // lots and lots of params (indicates recursion limit)
const tt4 = registry.createType('(u8,u16,u32,u64,u128,u256,u8,u16,u32,u64,u128,u256,u8,u16,u32,u64,u128,u256)'); const tt4 = registry.createType('(u8,u16,u32,u64,u128,u256,u8,u16,u32,u64,u128,u256,u8,u16,u32,u64,u128,u256,u8)');
// empty // empty
const tt5 = registry.createType('()'); const tt5 = registry.createType('()');
// nested tuples // nested tuples
+11 -15
View File
@@ -6,7 +6,7 @@ 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, isBn, isHex, 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, u8aToBn } from '@polkadot/util';
export const DEFAULT_UINT_BITS = 64; export const DEFAULT_UINT_BITS = 64;
@@ -28,20 +28,8 @@ function toPercentage (value: BN, divisor: BN): string {
/** @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
// constructor. It would be ideal to actually return a BN, but there's a
// bug: https://github.com/indutny/bn.js/issues/206.
if (isU8a(value)) { if (isU8a(value)) {
if (!value.length) { return u8aToBn(value.subarray(0, bitLength / 8), { isLe: true, isNegative }).toString();
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)) { } else if (isBn(value)) {
return value.toString(); return value.toString();
} else if (isHex(value, -1, true)) { } else if (isHex(value, -1, true)) {
@@ -68,7 +56,15 @@ export abstract class AbstractInt extends BN implements INumber {
readonly #isSigned: boolean; readonly #isSigned: boolean;
constructor (registry: Registry, value: AnyNumber = 0, bitLength: UIntBitLength = DEFAULT_UINT_BITS, isSigned = false) { constructor (registry: Registry, value: AnyNumber = 0, bitLength: UIntBitLength = DEFAULT_UINT_BITS, isSigned = false) {
super(decodeAbstractInt(value, bitLength, isSigned)); // Construct via a string, which will be passed in the BN constructor.
// It would be ideal to actually return a BN, but there is an issue:
// https://github.com/indutny/bn.js/issues/206
super(
// shortcut isU8a as used in SCALE decoding
isU8a(value)
? u8aToBn(value.subarray(0, bitLength / 8), { isLe: true, isNegative: isSigned }).toString()
: decodeAbstractInt(value, bitLength, isSigned)
);
this.registry = registry; this.registry = registry;
this.#bitLength = bitLength; this.#bitLength = bitLength;
+2 -2
View File
@@ -7,7 +7,7 @@ import type { AnyJson, Codec, Constructor, ISet, Registry } from '../types';
import { compactFromU8a, compactToU8a, isHex, isU8a, logger, stringify, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util'; import { compactFromU8a, compactToU8a, isHex, isU8a, logger, stringify, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
import { compareSet, decodeU8a, sortSet, typeToConstructor } from './utils'; import { compareSet, decodeU8aVec, sortSet, typeToConstructor } from './utils';
const l = logger('BTreeSet'); const l = logger('BTreeSet');
@@ -15,7 +15,7 @@ const l = logger('BTreeSet');
function decodeSetFromU8a<V extends Codec> (registry: Registry, ValClass: Constructor<V>, u8a: Uint8Array): [Set<V>, number] { 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 [values, decodedLength] = decodeU8a<V>(registry, u8a.subarray(offset), new Array(length.toNumber()).fill(ValClass)); const [values, decodedLength] = decodeU8aVec(registry, u8a, offset, ValClass, length.toNumber());
for (let i = 0; i < values.length; i++) { for (let i = 0; i < values.length; i++) {
output.add(values[i]); output.add(values[i]);
+48 -59
View File
@@ -5,7 +5,7 @@ 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, objectProperties, stringCamelCase, stringify, stringUpperFirst, u8aConcat, u8aToHex } from '@polkadot/util'; import { assert, isHex, isNumber, isObject, isString, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, stringPascalCase, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
import { Null } from '../primitive/Null'; import { Null } from '../primitive/Null';
import { mapToTypeMap, typesToMap } from './utils'; import { mapToTypeMap, typesToMap } from './utils';
@@ -40,40 +40,37 @@ function isRustEnum (def: Record<string, string | Constructor> | Record<string,
} }
function extractDef (registry: Registry, _def: Record<string, string | Constructor> | Record<string, number> | string[]): { def: TypesDef; isBasic: boolean; isIndexed: boolean } { function extractDef (registry: Registry, _def: Record<string, string | Constructor> | Record<string, number> | string[]): { def: TypesDef; isBasic: boolean; isIndexed: boolean } {
if (Array.isArray(_def)) { const def: TypesDef = {};
return {
def: _def.reduce((def: TypesDef, key, index): TypesDef => {
def[key] = { Type: Null, index };
return def;
}, {}),
isBasic: true,
isIndexed: false
};
}
let isBasic: boolean; let isBasic: boolean;
let isIndexed: boolean; let isIndexed: boolean;
let def: TypesDef;
if (isRustEnum(_def)) { if (Array.isArray(_def)) {
def = Object for (let i = 0; i < _def.length; i++) {
.entries(mapToTypeMap(registry, _def)) def[_def[i]] = { Type: Null, index: i };
.reduce((def: TypesDef, [key, Type], index): TypesDef => { }
def[key] = { Type, index };
isBasic = true;
isIndexed = false;
} else if (isRustEnum(_def)) {
const entries = Object.entries(mapToTypeMap(registry, _def));
for (let i = 0; i < entries.length; i++) {
const [key, Type] = entries[i];
def[key] = { Type, index: i };
}
return def;
}, {});
isBasic = !Object.values(def).some(({ Type }) => Type !== Null); isBasic = !Object.values(def).some(({ Type }) => Type !== Null);
isIndexed = false; isIndexed = false;
} else { } else {
def = Object const entries = Object.entries(_def);
.entries(_def)
.reduce((def: TypesDef, [key, index]): TypesDef => { for (let i = 0; i < entries.length; i++) {
def[key] = { Type: Null, index }; const [key, index] = entries[i];
def[key] = { Type: Null, index };
}
return def;
}, {});
isBasic = true; isBasic = true;
isIndexed = true; isIndexed = true;
} }
@@ -114,23 +111,24 @@ function decodeFromJSON (registry: Registry, def: TypesDef, key: string, value?:
} }
} }
function decodeFromString (registry: Registry, def: TypesDef, value: string): Decoded { function decodeEnum (registry: Registry, def: TypesDef, value?: unknown, index?: number): Decoded {
return isHex(value) // NOTE We check the index path first, before looking at values - this allows treating
// eslint-disable-next-line @typescript-eslint/no-use-before-define // the optional indexes before anything else, more-specific > less-specific
? decodeFromValue(registry, def, hexToU8a(value)) if (isNumber(index)) {
: decodeFromJSON(registry, def, value); return createFromValue(registry, def, index, value);
} } else if (isU8a(value) || isHex(value)) {
const u8a = u8aToU8a(value);
function decodeFromValue (registry: Registry, def: TypesDef, value?: unknown): Decoded {
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 (u8a.length) {
return createFromValue(registry, def, value[0], value.subarray(1)); return createFromValue(registry, def, u8a[0], u8a.subarray(1));
} }
} else if (value instanceof Enum) {
return createFromValue(registry, def, value.index, value.value);
} else if (isNumber(value)) { } else if (isNumber(value)) {
return createFromValue(registry, def, value); return createFromValue(registry, def, value);
} else if (isString(value)) { } else if (isString(value)) {
return decodeFromString(registry, def, value.toString()); return decodeFromJSON(registry, def, value.toString());
} else if (isObject(value)) { } else if (isObject(value)) {
const key = Object.keys(value)[0]; const key = Object.keys(value)[0];
@@ -141,19 +139,6 @@ function decodeFromValue (registry: Registry, def: TypesDef, value?: unknown): D
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?: unknown, index?: number): Decoded {
// NOTE We check the index path first, before looking at values - this allows treating
// the optional indexes before anything else, more-specific > less-specific
if (isNumber(index)) {
return createFromValue(registry, def, index, value);
// eslint-disable-next-line @typescript-eslint/no-use-before-define
} else if (value instanceof Enum) {
return createFromValue(registry, def, value.index, value.value);
}
return decodeFromValue(registry, def, value);
}
/** /**
* @name Enum * @name Enum
* @description * @description
@@ -179,15 +164,19 @@ export class Enum implements IEnum {
readonly #raw: Codec; readonly #raw: Codec;
constructor (registry: Registry, def: Record<string, string | Constructor> | Record<string, number> | string[], value?: unknown, index?: number) { constructor (registry: Registry, Types: Record<string, string | Constructor> | Record<string, number> | string[], value?: unknown, index?: number) {
const defInfo = extractDef(registry, def); const { def, isBasic, isIndexed } = extractDef(registry, Types);
const decoded = decodeEnum(registry, defInfo.def, value, index);
// shortcut isU8a as used in SCALE decoding
const decoded = isU8a(value) && value.length && !isNumber(index)
? createFromValue(registry, def, value[0], value.subarray(1))
: decodeEnum(registry, def, value, index);
this.registry = registry; this.registry = registry;
this.#def = defInfo.def; this.#def = def;
this.#isBasic = defInfo.isBasic; this.#isBasic = isBasic;
this.#isIndexed = defInfo.isIndexed; this.#isIndexed = isIndexed;
this.#indexes = Object.values(defInfo.def).map(({ index }) => index); this.#indexes = Object.values(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;
@@ -204,7 +193,7 @@ export class Enum implements IEnum {
const isKeys = new Array<string>(keys.length); const isKeys = new Array<string>(keys.length);
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
const name = stringUpperFirst(stringCamelCase(keys[i].replace(' ', '_'))); const name = stringPascalCase(keys[i].replace(' ', '_'));
asKeys[i] = `as${name}`; asKeys[i] = `as${name}`;
isKeys[i] = `is${name}`; isKeys[i] = `is${name}`;
+18
View File
@@ -102,6 +102,24 @@ describe('Option', (): void => {
).toEqual(new Uint8Array([0])); ).toEqual(new Uint8Array([0]));
}); });
it('converts toJSON() as null without', (): void => {
expect(
new Option(registry, Text).toJSON()
).toEqual(null);
});
it('converts toJSON() as non-null with Bytes', (): void => {
expect(
new Option(registry, Bytes, 'abcde').toJSON()
).toEqual('0x6162636465');
});
it('converts toJSON() as non-null with Text', (): void => {
expect(
new Option(registry, Text, 'abcde').toJSON()
).toEqual('abcde');
});
describe('utils', (): void => { describe('utils', (): void => {
const test = new Option(registry, Text, '1234'); const test = new Option(registry, Text, '1234');
+22 -15
View File
@@ -5,22 +5,20 @@ 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';
import { assert, isNull, isU8a, isUndefined, u8aToHex } from '@polkadot/util'; import { assert, isCodec, 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 */ /** @internal */
function decodeOption (registry: Registry, typeName: Constructor | string, value?: unknown): Codec { function decodeOption (registry: Registry, Type: Constructor, value?: unknown): Codec {
if (isNull(value) || isUndefined(value) || value instanceof Null || value === '0x') { // In the case of an option, unwrap the inner
return new Null(registry); if (value instanceof Option) {
value = value.value;
} }
const Type = typeToConstructor(registry, typeName); if (isNull(value) || isUndefined(value) || value instanceof Null || value === '0x') {
return new Null(registry);
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (value instanceof Option) {
return decodeOption(registry, Type, value.value);
} else if (value instanceof Type) { } else if (value instanceof Type) {
// don't re-create, use as it (which also caters for derived types) // don't re-create, use as it (which also caters for derived types)
return value; return value;
@@ -55,12 +53,19 @@ export class Option<T extends Codec> implements IOption<T> {
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; const Type = typeToConstructor(registry, typeName);
this.#Type = typeToConstructor(registry, typeName); const decoded = isU8a(value) && value.length && !isCodec(value)
this.#raw = decodeOption(registry, typeName, value) as T; ? value[0] === 0
? new Null(registry)
: new Type(registry, value.subarray(1))
: decodeOption(registry, Type, value);
if (this.#raw.initialU8aLength) { this.registry = registry;
this.#initialU8aLength = 1 + this.#raw.initialU8aLength; this.#Type = Type;
this.#raw = decoded as T;
if (decoded.initialU8aLength) {
this.#initialU8aLength = 1 + decoded.initialU8aLength;
} }
} }
@@ -155,7 +160,9 @@ export class Option<T extends Codec> implements IOption<T> {
* @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.#raw.toJSON(); return this.isNone
? null
: this.#raw.toJSON();
} }
/** /**
+2 -2
View File
@@ -5,7 +5,7 @@ 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, objectProperties, stringCamelCase, stringify, stringUpperFirst, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util'; import { assert, BN, bnToBn, bnToU8a, isBn, isNumber, isString, isU8a, isUndefined, objectProperties, stringify, stringPascalCase, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util';
import { compareArray } from './utils'; import { compareArray } from './utils';
@@ -108,7 +108,7 @@ export class CodecSet extends Set<string> implements ISet<string> {
const isKeys = new Array<string>(keys.length); const isKeys = new Array<string>(keys.length);
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
isKeys[i] = `is${stringUpperFirst(stringCamelCase(keys[i]))}`; isKeys[i] = `is${stringPascalCase(keys[i])}`;
} }
return class extends CodecSet { return class extends CodecSet {
+12 -39
View File
@@ -5,14 +5,14 @@ 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, objectProperties, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util'; import { assert, isBoolean, isFunction, isHex, isObject, isU8a, isUndefined, objectProperties, stringCamelCase, stringify, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
import { compareMap, decodeU8a, mapToTypeMap, typesToMap } 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 (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<string, string>): Iterable<[string, Codec]> { function decodeStructFromObject (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<string, string>): [Iterable<[string, Codec]>, number] {
let jsonObj: Record<string, unknown> | undefined; let jsonObj: Record<string, unknown> | undefined;
const inputKeys = Object.keys(Types); const inputKeys = Object.keys(Types);
const typeofArray = Array.isArray(value); const typeofArray = Array.isArray(value);
@@ -71,40 +71,7 @@ function decodeStructFromObject (registry: Registry, Types: ConstructorDef, valu
} }
} }
return raw; return [raw, 0];
}
function decodeZip (k: string, v: Codec): [string, Codec] {
return [k, v];
}
/**
* Decode input to pass into constructor.
*
* @param Types - Types definition.
* @param value - Value to decode, one of:
* - null
* - undefined
* - hex
* - Uint8Array
* - object with `{ key1: value1, key2: value2 }`, assuming `key1` and `key2`
* are also keys in `Types`
* - array with `[value1, value2]` assuming the array has the same length as
* `Object.keys(Types)`
* @param jsonMap
* @internal
*/
function decodeStruct (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<string, string>): [Iterable<[string, Codec]>, number] {
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);
}
// We assume from here that value is a JS object (Array, Map, Object)
return [decodeStructFromObject(registry, Types, value || {}, jsonMap), 0];
} }
/** /**
@@ -134,16 +101,22 @@ export class Struct<
readonly #Types: ConstructorDef; readonly #Types: ConstructorDef;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
constructor (registry: Registry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap = new Map<string, string>()) { constructor (registry: Registry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap = new Map<string, string>()) {
const [decoded, decodedLength] = decodeStruct(registry, mapToTypeMap(registry, Types), value, jsonMap); const typeMap = mapToTypeMap(registry, Types);
const [decoded, decodedLength] = isU8a(value)
? decodeU8a<Codec, [string, Codec]>(registry, value, typeMap, true)
: isHex(value)
? decodeU8a<Codec, [string, Codec]>(registry, u8aToU8a(value), typeMap, true)
: value instanceof Struct
? [value as Iterable<[string, Codec]>, 0]
: decodeStructFromObject(registry, typeMap, value || {}, jsonMap);
super(decoded); super(decoded);
this.registry = registry; this.registry = registry;
this.initialU8aLength = decodedLength; this.initialU8aLength = decodedLength;
this.#jsonMap = jsonMap; this.#jsonMap = jsonMap;
this.#Types = mapToTypeMap(registry, Types); this.#Types = typeMap;
} }
public static with<S extends TypesDef> (Types: S, jsonMap?: Map<string, string>): Constructor<Struct<S>> { public static with<S extends TypesDef> (Types: S, jsonMap?: Map<string, string>): Constructor<Struct<S>> {
+10 -8
View File
@@ -21,14 +21,14 @@ type TupleTypes = TupleType[] | {
}; };
/** @internal */ /** @internal */
function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: AnyTupleValue): [Codec[], number] { function decodeTuple (registry: Registry, Classes: 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), Classes);
} }
const Types: Constructor[] = Array.isArray(_Types) const Types: Constructor[] = Array.isArray(Classes)
? _Types ? Classes
: Object.values(_Types); : Object.values(Classes);
return [ return [
Types.map((Type, index): Codec => { Types.map((Type, index): Codec => {
@@ -58,16 +58,18 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
#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 Classes = Array.isArray(Types)
? Types.map((t) => typeToConstructor(registry, t)) ? Types.map((t) => typeToConstructor(registry, t))
: 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); const [values, decodedLength] = isU8a(value)
? decodeU8a(registry, value, Classes)
: decodeTuple(registry, Classes, value);
super(registry, values, decodedLength); super(registry, values, decodedLength);
this.#Types = Clazzes; this.#Types = Classes;
} }
public static with (Types: TupleTypes | TupleType): Constructor<Tuple> { public static with (Types: TupleTypes | TupleType): Constructor<Tuple> {
+8 -11
View File
@@ -4,25 +4,22 @@
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, isU8a, u8aToU8a } from '@polkadot/util'; import { assert, u8aToU8a } from '@polkadot/util';
import { Raw } from './Raw'; import { Raw } from './Raw';
/** @internal */ /** @internal */
function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): [AnyU8a, number] { function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): [AnyU8a, number] {
if (isU8a(value)) { const u8a = u8aToU8a(value);
const byteLength = bitLength / 8; const byteLength = bitLength / 8;
if (!value || !value.length) { if (!u8a.length) {
return [new Uint8Array(byteLength), 0]; 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];
} }
return decodeU8aFixed(u8aToU8a(value), bitLength); assert(u8a.length >= byteLength, () => `Expected at least ${byteLength} bytes (${bitLength} bits), found ${u8a.length} bytes`);
return [u8a.subarray(0, byteLength), byteLength];
} }
/** /**
+12
View File
@@ -11,6 +11,12 @@ import { UInt } from '.';
describe('UInt', (): void => { describe('UInt', (): void => {
const registry = new TypeRegistry(); const registry = new TypeRegistry();
it('decodes an empty Uint8array correctly', (): void => {
expect(
new UInt(registry, new Uint8Array()).toNumber()
).toEqual(0);
});
it('still has the BN interfaces', (): void => { it('still has the BN interfaces', (): void => {
expect([ expect([
new UInt(registry, 32).mul(BN_TWO).toNumber(), new UInt(registry, 32).mul(BN_TWO).toNumber(),
@@ -26,6 +32,12 @@ describe('UInt', (): void => {
expect(test instanceof BN).toBe(true); expect(test instanceof BN).toBe(true);
}); });
// e.g. headers
it('decodes hex that are not multiples of 2', (): void => {
expect(new UInt(registry, '0x123').toNumber()).toEqual(0x123);
expect(new UInt(registry, '0x0123').toNumber()).toEqual(0x123);
});
it('fails on a number that is too large for the bits specified', (): void => { it('fails on a number that is too large for the bits specified', (): void => {
expect( expect(
(): UInt => new UInt(registry, '12345678901234567890123456789012345678901234567890', 32) (): UInt => new UInt(registry, '12345678901234567890123456789012345678901234567890', 32)
+9 -7
View File
@@ -4,15 +4,15 @@
import type { HexString } from '@polkadot/util/types'; import type { HexString } from '@polkadot/util/types';
import type { Codec, Constructor, Registry } from '../types'; import type { Codec, Constructor, Registry } from '../types';
import { assert, u8aConcat } from '@polkadot/util'; import { assert, isU8a, u8aConcat } from '@polkadot/util';
import { AbstractArray } from './AbstractArray'; import { AbstractArray } from './AbstractArray';
import { typeToConstructor } from './utils'; import { decodeU8aVec, typeToConstructor } from './utils';
import { decodeVec } from './Vec'; import { decodeVec } from './Vec';
/** @internal */ /** @internal */
function decodeVecFixed<T extends Codec> (registry: Registry, Type: Constructor<T>, length: number, value: Uint8Array | HexString | unknown[]): [T[], number] { function decodeVecFixed<T extends Codec> (registry: Registry, value: Uint8Array | HexString | unknown[], Type: Constructor<T>, length: number): [T[], number, number] {
const [values,, decodedLengthNoOffset] = decodeVec(registry, Type, value, length); const [values, decodedLength, decodedLengthNoOffset] = decodeVec(registry, Type, value, length);
while (values.length < length) { while (values.length < length) {
values.push(new Type(registry)); values.push(new Type(registry));
@@ -20,7 +20,7 @@ function decodeVecFixed<T extends Codec> (registry: Registry, Type: Constructor<
assert(values.length === length, () => `Expected a length of exactly ${length} entries`); assert(values.length === length, () => `Expected a length of exactly ${length} entries`);
return [values, decodedLengthNoOffset]; return [values, decodedLength, decodedLengthNoOffset];
} }
/** /**
@@ -33,9 +33,11 @@ export class VecFixed<T extends Codec> extends AbstractArray<T> {
constructor (registry: Registry, Type: Constructor<T> | string, length: number, value: Uint8Array | HexString | unknown[] = [] as unknown[]) { constructor (registry: Registry, Type: Constructor<T> | string, length: number, value: Uint8Array | HexString | unknown[] = [] as unknown[]) {
const Clazz = typeToConstructor<T>(registry, Type); const Clazz = typeToConstructor<T>(registry, Type);
const [values, decodedLength] = decodeVecFixed(registry, Clazz, length, value); const [values,, decodedLengthNoOffset] = isU8a(value)
? decodeU8aVec(registry, value, 0, Clazz, length)
: decodeVecFixed(registry, value, Clazz, length);
super(registry, values, decodedLength); super(registry, values, decodedLengthNoOffset);
this.#Type = Clazz; this.#Type = Clazz;
} }
+6 -6
View File
@@ -5,15 +5,15 @@ import type { Codec, Constructor, Registry } from '../../types';
import { u8aToHex } from '@polkadot/util'; import { u8aToHex } from '@polkadot/util';
function formatFailure (error: Error, type: string, u8a: Uint8Array, key?: string): string { function formatFailure (error: Error, type: string | null, u8a: Uint8Array, key?: string): string {
return `decodeU8a: failed at ${u8aToHex(u8a)}…${key ? ` on ${key}` : ''}${type ? `: ${type}` : ''}:: ${error.message}`; return `decodeU8a: failed at ${u8aToHex(u8a)}…${key ? ` on ${key}` : ''}${type ? `: ${type}` : ''}:: ${error.message}`;
} }
function getRawType (registry: Registry, Type: Constructor): string { function getRawType (registry: Registry, Type: Constructor): string | null {
try { try {
return new Type(registry).toRawType(); return new Type(registry).toRawType();
} catch { } catch {
return ''; return null;
} }
} }
@@ -25,7 +25,7 @@ function getRawType (registry: Registry, Type: Constructor): string {
* @param result - The result array (will be returned with values pushed) * @param result - The result array (will be returned with values pushed)
* @param types - The array of Constructor to decode the U8a against. * @param types - The array of Constructor to decode the U8a against.
*/ */
export function decodeU8a <T extends Codec = Codec, E = T> (registry: Registry, u8a: Uint8Array, types: Constructor[] | { [index: string]: Constructor }, zip?: (key: string, value: T) => E): [E[], number] { export function decodeU8a <T extends Codec = Codec, E = T> (registry: Registry, u8a: Uint8Array, types: Constructor[] | { [index: string]: Constructor }, withZip?: boolean): [E[], number] {
const [Types, keys]: [Constructor[], string[]] = Array.isArray(types) const [Types, keys]: [Constructor[], string[]] = Array.isArray(types)
? [types, []] ? [types, []]
: [Object.values(types), Object.keys(types)]; : [Object.values(types), Object.keys(types)];
@@ -38,8 +38,8 @@ export function decodeU8a <T extends Codec = Codec, E = T> (registry: Registry,
const value = new Types[i](registry, u8a.subarray(offset)); const value = new Types[i](registry, u8a.subarray(offset));
offset += value.initialU8aLength || value.encodedLength; offset += value.initialU8aLength || value.encodedLength;
result[i] = zip result[i] = withZip
? zip(keys[i], value as T) ? [keys[i], value] as unknown as E
: value as unknown as E; : value as unknown as E;
} catch (error) { } catch (error) {
throw new Error(formatFailure( throw new Error(formatFailure(
+4 -4
View File
@@ -3,7 +3,7 @@
import type { ExtDef } from '../extrinsic/signedExtensions/types'; import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { ChainProperties, CodecHash, DispatchErrorModule, Hash, MetadataLatest, SiField, SiLookupTypeId, SiVariant } from '../interfaces/types'; import type { ChainProperties, CodecHash, DispatchErrorModule, Hash, MetadataLatest, SiField, SiLookupTypeId, SiVariant } from '../interfaces/types';
import type { CallFunction, Codec, CodecHasher, Constructor, DetectCodec, DetectConstructor, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types'; import type { CallFunction, Codec, CodecHasher, Constructor, Definitions, DetectCodec, DetectConstructor, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types';
import type { CreateOptions, TypeDef } from './types'; import type { CreateOptions, TypeDef } from './types';
import { assert, assertReturn, BN_ZERO, formatBalance, isFunction, isString, isU8a, lazyMethod, logger, objectSpread, stringCamelCase, stringify } from '@polkadot/util'; import { assert, assertReturn, BN_ZERO, formatBalance, isFunction, isString, isU8a, lazyMethod, logger, objectSpread, stringCamelCase, stringify } from '@polkadot/util';
@@ -158,7 +158,7 @@ export class TypeRegistry implements Registry {
readonly #knownDefaults: RegistryTypes; readonly #knownDefaults: RegistryTypes;
readonly #knownDefinitions: Record<string, { types: RegistryTypes }>; readonly #knownDefinitions: Record<string, Definitions>;
#knownTypes: RegisteredTypes = {}; #knownTypes: RegisteredTypes = {};
@@ -170,7 +170,7 @@ export class TypeRegistry implements Registry {
constructor (createdAtHash?: Hash | Uint8Array | string) { constructor (createdAtHash?: Hash | Uint8Array | string) {
this.#knownDefaults = objectSpread({ Json, Metadata, PortableRegistry, Raw }, baseTypes); this.#knownDefaults = objectSpread({ Json, Metadata, PortableRegistry, Raw }, baseTypes);
this.#knownDefinitions = definitions as unknown as Record<string, { types: RegistryTypes }>; this.#knownDefinitions = definitions;
this.init(); this.init();
@@ -192,7 +192,7 @@ export class TypeRegistry implements Registry {
const allKnown = Object.values(this.#knownDefinitions); const allKnown = Object.values(this.#knownDefinitions);
for (let i = 0; i < allKnown.length; i++) { for (let i = 0; i < allKnown.length; i++) {
this.register(allKnown[i].types); this.register(allKnown[i].types as unknown as RegistryTypes);
} }
return this; return this;
@@ -5,6 +5,7 @@ import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
import { TypeRegistry } from '../create'; import { TypeRegistry } from '../create';
import { Metadata } from '../metadata'; import { Metadata } from '../metadata';
import { fallbackExtensions } from './signedExtensions';
import { GenericExtrinsic as Extrinsic } from '.'; import { GenericExtrinsic as Extrinsic } from '.';
const registry = new TypeRegistry(); const registry = new TypeRegistry();
@@ -15,6 +16,8 @@ registry.setMetadata(metadata);
describe('Extrinsic', (): void => { describe('Extrinsic', (): void => {
describe('V4', (): void => { describe('V4', (): void => {
it('decodes an actual transaction', (): void => { it('decodes an actual transaction', (): void => {
registry.setSignedExtensions(fallbackExtensions);
const extrinsic = new Extrinsic( const extrinsic = new Extrinsic(
registry, registry,
'0x' + '0x' +
@@ -10,16 +10,17 @@ import { shell } from './shell';
import { statemint } from './statemint'; import { statemint } from './statemint';
import { substrate } from './substrate'; import { substrate } from './substrate';
// A mapping of the known signed extensions to the extra fields that they contain. Unlike in the actual extensions, // A mapping of the known signed extensions to the extra fields that they
// we define the extra fields not as a Tuple, but rather as a struct so they can be named. These will be expanded // contain. Unlike in the actual extensions, we define the extra fields not
// into the various fields when added to the payload (we only support V4 onwards with these, V3 and earlier are // as a Tuple, but rather as a struct so they can be named. These will be
// deemed fixed and non-changeable) // expanded into the various fields when added to the payload (we only
// support V4 onwards with these, V3 and earlier are deemed fixed))
export const allExtensions: ExtDef = objectSpread({}, substrate, polkadot, shell, statemint); export const allExtensions: ExtDef = objectSpread({}, substrate, polkadot, shell, statemint);
// the v4 signed extensions prior to the point of exposing these to the metadata. // the v4 signed extensions prior to the point of exposing these to the
// This may not match 100% with the current defaults and are used when not specified // metadata. This may not match 100% with the current defaults and are used
// in the metadata (which is for very old chains). The order is important here, as // when not specified in the metadata (which is for very old chains). The
// applied by default // order is important here, as applied by default
export const fallbackExtensions = [ export const fallbackExtensions = [
'CheckVersion', 'CheckVersion',
'CheckGenesis', 'CheckGenesis',
@@ -39,7 +40,7 @@ export function findUnknownExtensions (extensions: string[], userExtensions: Ext
export function expandExtensionTypes (extensions: string[], type: keyof ExtInfo, userExtensions: ExtDef = {}): ExtTypes { export function expandExtensionTypes (extensions: string[], type: keyof ExtInfo, userExtensions: ExtDef = {}): ExtTypes {
return extensions return extensions
// Always allow user extensions first - these should provide overrides // Always allow user extensions first - these should provide overrides
.map((key) => userExtensions[key] || allExtensions[key]) .map((k) => userExtensions[k] || allExtensions[k])
.filter((info): info is ExtInfo => !!info) .filter((info): info is ExtInfo => !!info)
.reduce((result, info): ExtTypes => objectSpread(result, info[type]), {}); .reduce((result, info): ExtTypes => objectSpread(result, info[type]), {});
} }
@@ -67,9 +67,9 @@ describe('ExtrinsicV4', (): void => {
'00' + '00' +
'd172a74cda4c865912c32ba0a80a57ae69abae410e5ccb59dee84e2f4432db4f' + 'd172a74cda4c865912c32ba0a80a57ae69abae410e5ccb59dee84e2f4432db4f' +
'00' + // ed25519 '00' + // ed25519
'ab31e8dbdbf37398f9a42cfe473e17f6e2e05d8d7a1612513fa73f5f6ad3bfdb' + 'eb58b10100923b73df92010db6f9363300ea3947d4c7c92ce669da93931853e8' +
'adbabd920d033ad48999d9dc6a07e3e7ffb9a503128c94bf4fd97aeb4523f90e' + 'a2f21c8a7c73035b3ddd8cdd47ef5db3092aad09d15e6f5ed9d32d7864821409' +
'000408' + // era. nonce, tip '00040800' + // era. nonce, tip
'0600' + '0600' +
'00' + '00' +
'd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9' + 'd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9' +
@@ -20,8 +20,8 @@ import { sign } from '../util';
/** /**
* @name GenericExtrinsicPayloadV4 * @name GenericExtrinsicPayloadV4
* @description * @description
* A signing payload for an [[Extrinsic]]. For the final encoding, it is variable length based * A signing payload for an [[Extrinsic]]. For the final encoding, it is
* on the contents included * variable length based on the contents included
*/ */
export class GenericExtrinsicPayloadV4 extends Struct { export class GenericExtrinsicPayloadV4 extends Struct {
#signOptions: SignOptions; #signOptions: SignOptions;
@@ -33,8 +33,9 @@ export class GenericExtrinsicPayloadV4 extends Struct {
registry.getSignedExtensionExtra() registry.getSignedExtensionExtra()
), value); ), value);
// Do detection for the type of extrinsic, in the case of MultiSignature this is an // Do detection for the type of extrinsic, in the case of MultiSignature
// enum, in the case of AnySignature, this is a Hash only (may be 64 or 65 bytes) // this is an enum, in the case of AnySignature, this is a Hash only
// (which may be 64 or 65 bytes)
this.#signOptions = { this.#signOptions = {
withType: registry.createType('ExtrinsicSignature') instanceof Enum withType: registry.createType('ExtrinsicSignature') instanceof Enum
}; };
@@ -108,10 +109,11 @@ export class GenericExtrinsicPayloadV4 extends Struct {
* @description Sign the payload with the keypair * @description Sign the payload with the keypair
*/ */
public sign (signerPair: IKeyringPair): Uint8Array { public sign (signerPair: IKeyringPair): Uint8Array {
// NOTE The `toU8a({ method: true })` argument is absolutely critical - we don't want the method (Bytes) // NOTE The `toU8a({ method: true })` argument is absolutely critical, we
// to have the length prefix included. This means that the data-as-signed is un-decodable, // don't want the method (Bytes) to have the length prefix included. This
// but is also doesn't need the extra information, only the pure data (and is not decoded) // means that the data-as-signed is un-decodable, but is also doesn't need
// ... The same applies to V1..V3, if we have a V5, carry move this comment to latest // the extra information, only the pure data (and is not decoded) ...
// The same applies to V1..V3, if we have a V5, carrythis comment
return sign(this.registry, signerPair, this.toU8a({ method: true }), this.#signOptions); return sign(this.registry, signerPair, this.toU8a({ method: true }), this.#signOptions);
} }
} }
@@ -70,7 +70,7 @@ describe('ExtrinsicSignatureV4', (): void => {
'01' + '01' +
'0101010101010101010101010101010101010101010101010101010101010101' + '0101010101010101010101010101010101010101010101010101010101010101' +
'0101010101010101010101010101010101010101010101010101010101010101' + '0101010101010101010101010101010101010101010101010101010101010101' +
'00a50100' '00a5010000'
); );
}); });
@@ -97,7 +97,7 @@ describe('ExtrinsicSignatureV4', (): void => {
// This is a prefix-less signature, anySignture as opposed to Multi above // This is a prefix-less signature, anySignture as opposed to Multi above
'0101010101010101010101010101010101010101010101010101010101010101' + '0101010101010101010101010101010101010101010101010101010101010101' +
'0101010101010101010101010101010101010101010101010101010101010101' + '0101010101010101010101010101010101010101010101010101010101010101' +
'00a50100' '00a5010000'
); );
}); });
@@ -125,7 +125,7 @@ describe('ExtrinsicSignatureV4', (): void => {
'01' + '01' +
'0101010101010101010101010101010101010101010101010101010101010101' + '0101010101010101010101010101010101010101010101010101010101010101' +
'0101010101010101010101010101010101010101010101010101010101010101' + '0101010101010101010101010101010101010101010101010101010101010101' +
'00a50100' '00a5010000'
); );
}); });
@@ -148,7 +148,7 @@ describe('ExtrinsicSignatureV4', (): void => {
'01' + '01' +
'0101010101010101010101010101010101010101010101010101010101010101' + '0101010101010101010101010101010101010101010101010101010101010101' +
'0101010101010101010101010101010101010101010101010101010101010101' + '0101010101010101010101010101010101010101010101010101010101010101' +
'000000' '00000000'
); );
}); });
}); });
+3 -3
View File
@@ -10,7 +10,7 @@ import type { ITuple } from '@polkadot/types/types';
export interface AllowedSlots extends Enum { export interface AllowedSlots extends Enum {
readonly isPrimarySlots: boolean; readonly isPrimarySlots: boolean;
readonly isPrimaryAndSecondaryPlainSlots: boolean; readonly isPrimaryAndSecondaryPlainSlots: boolean;
readonly isPrimaryAndSecondaryVrfSlots: boolean; readonly isPrimaryAndSecondaryVRFSlots: boolean;
} }
/** @name BabeAuthorityWeight */ /** @name BabeAuthorityWeight */
@@ -72,8 +72,8 @@ export interface RawBabePreDigest extends Enum {
readonly asPrimary: RawBabePreDigestPrimary; readonly asPrimary: RawBabePreDigestPrimary;
readonly isSecondaryPlain: boolean; readonly isSecondaryPlain: boolean;
readonly asSecondaryPlain: RawBabePreDigestSecondaryPlain; readonly asSecondaryPlain: RawBabePreDigestSecondaryPlain;
readonly isSecondaryVrf: boolean; readonly isSecondaryVRF: boolean;
readonly asSecondaryVrf: RawBabePreDigestSecondaryVRF; readonly asSecondaryVRF: RawBabePreDigestSecondaryVRF;
} }
/** @name RawBabePreDigestCompat */ /** @name RawBabePreDigestCompat */
@@ -28,7 +28,7 @@ export default {
BeefyId: '[u8; 33]', BeefyId: '[u8; 33]',
BeefySignedCommitment: { BeefySignedCommitment: {
commitment: 'BeefyCommitment', commitment: 'BeefyCommitment',
signatures: 'Vec<Option<Signature>>' signatures: 'Vec<Option<EcdsaSignature>>'
}, },
BeefyNextAuthoritySet: { BeefyNextAuthoritySet: {
id: 'u64', id: 'u64',
+2 -2
View File
@@ -2,7 +2,7 @@
/* eslint-disable */ /* eslint-disable */
import type { Option, Struct, U8aFixed, Vec, u32, u64 } from '@polkadot/types'; import type { Option, Struct, U8aFixed, Vec, u32, u64 } from '@polkadot/types';
import type { Signature } from '@polkadot/types/interfaces/extrinsics'; import type { EcdsaSignature } from '@polkadot/types/interfaces/extrinsics';
import type { BlockNumber, H256 } from '@polkadot/types/interfaces/runtime'; import type { BlockNumber, H256 } from '@polkadot/types/interfaces/runtime';
/** @name BeefyCommitment */ /** @name BeefyCommitment */
@@ -28,7 +28,7 @@ export interface BeefyPayload extends MmrRootHash {}
/** @name BeefySignedCommitment */ /** @name BeefySignedCommitment */
export interface BeefySignedCommitment extends Struct { export interface BeefySignedCommitment extends Struct {
readonly commitment: BeefyCommitment; readonly commitment: BeefyCommitment;
readonly signatures: Vec<Option<Signature>>; readonly signatures: Vec<Option<EcdsaSignature>>;
} }
/** @name MmrRootHash */ /** @name MmrRootHash */
@@ -24,8 +24,8 @@ export interface ContractContractSpec extends Struct {
/** @name ContractCryptoHasher */ /** @name ContractCryptoHasher */
export interface ContractCryptoHasher extends Enum { export interface ContractCryptoHasher extends Enum {
readonly isBlake2X256: boolean; readonly isBlake2x256: boolean;
readonly isSha2X256: boolean; readonly isSha2x256: boolean;
readonly isKeccak256: boolean; readonly isKeccak256: boolean;
} }
+3 -8
View File
@@ -1,8 +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
// technically runtime can go below, but since it is the base, do it first export * from './essentials';
export { default as runtime } from './runtime/definitions';
// substrate types // substrate types
export { default as assets } from './assets/definitions'; export { default as assets } from './assets/definitions';
@@ -53,15 +52,11 @@ export { default as poll } from './poll/definitions';
export { default as purchase } from './purchase/definitions'; export { default as purchase } from './purchase/definitions';
export { default as xcm } from './xcm/definitions'; export { default as xcm } from './xcm/definitions';
// scale-info & contracts
export { default as contractsAbi } from './contractsAbi/definitions';
export { default as scaleInfo } from './scaleInfo/definitions';
// other useful types // other useful types
export { default as contractsAbi } from './contractsAbi/definitions';
export { default as eth } from './eth/definitions'; export { default as eth } from './eth/definitions';
// pull in metadata & rpc last, assuming that is uses info from above // pull in rpc last, assuming that is uses info from above
export { default as metadata } from './metadata/definitions';
export { default as rpc } from './rpc/definitions'; export { default as rpc } from './rpc/definitions';
// rpc-only definitions // rpc-only definitions
@@ -29,12 +29,12 @@ export interface AccountVoteStandard extends Struct {
/** @name Conviction */ /** @name Conviction */
export interface Conviction extends Enum { export interface Conviction extends Enum {
readonly isNone: boolean; readonly isNone: boolean;
readonly isLocked1X: boolean; readonly isLocked1x: boolean;
readonly isLocked2X: boolean; readonly isLocked2x: boolean;
readonly isLocked3X: boolean; readonly isLocked3x: boolean;
readonly isLocked4X: boolean; readonly isLocked4x: boolean;
readonly isLocked5X: boolean; readonly isLocked5x: boolean;
readonly isLocked6X: boolean; readonly isLocked6x: boolean;
} }
/** @name Delegations */ /** @name Delegations */
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { default as metadata } from './metadata/definitions';
export { default as runtime } from './runtime/definitions';
export { default as scaleInfo } from './scaleInfo/definitions';
+6 -6
View File
@@ -378,18 +378,18 @@ export interface TransactionV0 extends LegacyTransaction {}
export interface TransactionV1 extends Enum { export interface TransactionV1 extends Enum {
readonly isLegacy: boolean; readonly isLegacy: boolean;
readonly asLegacy: LegacyTransaction; readonly asLegacy: LegacyTransaction;
readonly isEip2930: boolean; readonly isEIP2930: boolean;
readonly asEip2930: EIP2930Transaction; readonly asEIP2930: EIP2930Transaction;
} }
/** @name TransactionV2 */ /** @name TransactionV2 */
export interface TransactionV2 extends Enum { export interface TransactionV2 extends Enum {
readonly isLegacy: boolean; readonly isLegacy: boolean;
readonly asLegacy: LegacyTransaction; readonly asLegacy: LegacyTransaction;
readonly isEip2930: boolean; readonly isEIP2930: boolean;
readonly asEip2930: EIP2930Transaction; readonly asEIP2930: EIP2930Transaction;
readonly isEip1559: boolean; readonly isEIP1559: boolean;
readonly asEip1559: EIP1559Transaction; readonly asEIP1559: EIP1559Transaction;
} }
export type PHANTOM_ETH = 'eth'; export type PHANTOM_ETH = 'eth';
+1 -1
View File
@@ -36,7 +36,7 @@ export interface ExitError extends Enum {
readonly isOutOfOffset: boolean; readonly isOutOfOffset: boolean;
readonly isOutOfGas: boolean; readonly isOutOfGas: boolean;
readonly isOutOfFund: boolean; readonly isOutOfFund: boolean;
readonly isPcUnderflow: boolean; readonly isPCUnderflow: boolean;
readonly isCreateEmpty: boolean; readonly isCreateEmpty: boolean;
readonly isOther: boolean; readonly isOther: boolean;
readonly asOther: Text; readonly asOther: Text;
+16 -19
View File
@@ -5,29 +5,26 @@ import type { DefinitionRpcExt, DefinitionRpcSub } from '../types';
import { objectSpread } from '@polkadot/util'; import { objectSpread } from '@polkadot/util';
import * as definitions from './definitions'; import * as defs from './definitions';
const jsonrpc: Record<string, Record<string, DefinitionRpcExt>> = {}; const jsonrpc: Record<string, Record<string, DefinitionRpcExt>> = {};
Object Object.keys(defs).forEach((s) =>
.keys(definitions) Object.entries(defs[s as 'babe'].rpc || {}).forEach(([method, def]): void => {
.filter((key) => Object.keys(definitions[key as 'babe'].rpc || {}).length !== 0) // allow for section overrides
.forEach((_section): void => { const section = def.aliasSection || s;
jsonrpc[_section] = {};
Object if (!jsonrpc[section]) {
.entries(definitions[_section as 'babe'].rpc) jsonrpc[section] = {};
.forEach(([method, def]): void => { }
const isSubscription = !!(def as DefinitionRpcSub).pubsub;
const section = def.aliasSection || _section;
// allow for section overrides jsonrpc[section][method] = objectSpread({}, def, {
if (!jsonrpc[section]) { isSubscription: !!(def as DefinitionRpcSub).pubsub,
jsonrpc[section] = {}; jsonrpc: `${section}_${method}`,
} method,
section
jsonrpc[section][method] = objectSpread({}, def, { isSubscription, jsonrpc: `${section}_${method}`, method, section }); });
}); })
}); );
export default jsonrpc; export default jsonrpc;
@@ -5,8 +5,8 @@ import type { Enum } from '@polkadot/types';
/** @name StorageKind */ /** @name StorageKind */
export interface StorageKind extends Enum { export interface StorageKind extends Enum {
readonly isPersistent: boolean; readonly isPERSISTENT: boolean;
readonly isLocal: boolean; readonly isLOCAL: boolean;
} }
export type PHANTOM_OFFCHAIN = 'offchain'; export type PHANTOM_OFFCHAIN = 'offchain';
+3 -3
View File
@@ -31,7 +31,6 @@ export * from './grandpa/types';
export * from './identity/types'; export * from './identity/types';
export * from './imOnline/types'; export * from './imOnline/types';
export * from './lottery/types'; export * from './lottery/types';
export * from './metadata/types';
export * from './mmr/types'; export * from './mmr/types';
export * from './offchain/types'; export * from './offchain/types';
export * from './offences/types'; export * from './offences/types';
@@ -42,8 +41,6 @@ export * from './proxy/types';
export * from './purchase/types'; export * from './purchase/types';
export * from './recovery/types'; export * from './recovery/types';
export * from './rpc/types'; export * from './rpc/types';
export * from './runtime/types';
export * from './scaleInfo/types';
export * from './scheduler/types'; export * from './scheduler/types';
export * from './session/types'; export * from './session/types';
export * from './society/types'; export * from './society/types';
@@ -58,3 +55,6 @@ export * from './uniques/types';
export * from './utility/types'; export * from './utility/types';
export * from './vesting/types'; export * from './vesting/types';
export * from './xcm/types'; export * from './xcm/types';
export * from './metadata/types';
export * from './runtime/types';
export * from './scaleInfo/types';
@@ -7,7 +7,7 @@ import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDefArray, SiTypeDef
import type { Text, Type } from '../../primitive'; import type { Text, Type } from '../../primitive';
import type { Registry, TypeDef } from '../../types'; import type { Registry, TypeDef } from '../../types';
import { assert, isNumber, isString, objectSpread, stringCamelCase, stringify, stringUpperFirst } from '@polkadot/util'; import { assert, isNumber, isString, objectSpread, stringCamelCase, stringify, stringPascalCase } from '@polkadot/util';
import { Struct } from '../../codec/Struct'; import { Struct } from '../../codec/Struct';
import { withTypeString } from '../../create/encodeTypes'; import { withTypeString } from '../../create/encodeTypes';
@@ -26,9 +26,13 @@ const PRIMITIVE_ALIAS: Record<string, string> = {
// These are types where we have a specific decoding/encoding override + helpers // These are types where we have a specific decoding/encoding override + helpers
const PATHS_ALIAS = splitNamespace([ const PATHS_ALIAS = splitNamespace([
// match {node, polkadot, ...}_runtime // These come in different forms
'*_runtime::Call', // - node_runtime::Call
'*_runtime::Event', // - polkadot_runtime::Call
// - node_template_runtime::Call
// - interbtc_runtime_parachain::Call
'*_runtime_*::Call',
'*_runtime_*::Event',
// these have a specific encoding or logic (for pallets) // these have a specific encoding or logic (for pallets)
'pallet_democracy::vote::Vote', 'pallet_democracy::vote::Vote',
'pallet_identity::types::Data', 'pallet_identity::types::Data',
@@ -81,16 +85,24 @@ function matchParts (first: string[], second: (string | Text)[]): boolean {
} }
if (a.includes('*') && a.includes('_') && b.includes('_')) { if (a.includes('*') && a.includes('_') && b.includes('_')) {
const suba = a.split('_'); let suba = a.split('_');
const subb = b.split('_'); let subb = b.split('_');
// match initial *'s to multiples if we have a match for the other
if (suba[0] === '*') { if (suba[0] === '*') {
// the first parts where the length is greater is always a match const indexOf = subb.indexOf(suba[1]);
while (suba.length < subb.length) {
subb.shift(); if (indexOf !== -1) {
suba = suba.slice(1);
subb = subb.slice(indexOf);
} }
} }
// check for * matches at the end, adjust accordingly
if ((suba.length === 2) && (suba[1] === '*') && (suba[0] === subb[0])) {
return true;
}
return matchParts(suba, subb); return matchParts(suba, subb);
} }
@@ -212,7 +224,7 @@ function extractName (types: PortableType[], { id, type: { params, path } }: Por
} }
const parts = path const parts = path
.map((p) => stringUpperFirst(stringCamelCase(p))) .map((p) => stringPascalCase(p))
.filter((p, index) => { .filter((p, index) => {
const lower = p.toLowerCase(); const lower = p.toLowerCase();
@@ -34,6 +34,10 @@ describe('decorateConstants', (): void => {
const [consts] = init(rpcMetadataV10); const [consts] = init(rpcMetadataV10);
// 0x34 removes as the length prefix removed // 0x34 removes as the length prefix removed
expect(consts.session.dedupKeyPrefix.toHex()).toEqual('0x3a73657373696f6e3a6b657973'); expect(
// stringToCamel behavior has changed
// consts.session.dedupKeyPrefix.toHex()
consts.session.dEDUPKEYPREFIX.toHex()
).toEqual('0x3a73657373696f6e3a6b657973');
}); });
}); });
+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', version: '6.8.1' }; export const packageInfo = { name: '@polkadot/types', version: '6.10.1' };
+3
View File
@@ -17,6 +17,9 @@ export class Null implements Codec {
public createdAtHash?: Hash; public createdAtHash?: Hash;
// Added for compatibility reasons, e.g. see Option
public readonly initialU8aLength = 0;
constructor (registry: Registry) { constructor (registry: Registry) {
this.registry = registry; this.registry = registry;
} }
+1 -1
View File
@@ -46,7 +46,7 @@ export function unwrapStorageType (registry: Registry, type: StorageEntryTypeLat
const outputType = getSiName(registry.lookup, unwrapStorageSi(type)); const outputType = getSiName(registry.lookup, unwrapStorageSi(type));
return isOptional return isOptional
? `Option<${outputType}>` as keyof InterfaceTypes ? `Option<${outputType}>` as unknown as keyof InterfaceTypes
: outputType as keyof InterfaceTypes; : outputType as keyof InterfaceTypes;
} }
+26 -31
View File
@@ -62,13 +62,6 @@ export type __WrapTwo = keyof __MapWrapTwo<Codec, Codec>;
export type __Wrap = __WrapOne | __WrapTwo; export type __Wrap = __WrapOne | __WrapTwo;
export type __ToStruct<K extends Record<string, unknown>> =
K['_enum'] extends true
? Enum
: K['_set'] extends true
? CodecSet
: Struct;
export type __ToTuple<O extends Codec[]> = export type __ToTuple<O extends Codec[]> =
O[0] extends Codec O[0] extends Codec
? O[1] extends Codec ? O[1] extends Codec
@@ -76,15 +69,6 @@ export type __ToTuple<O extends Codec[]> =
: O[0] : O[0]
: Null; : Null;
export type __CodecFirst<K> =
K extends keyof InterfaceTypes
? InterfaceTypes[K]
: K extends unknown[]
? __ToTuple<__Codecs<K>>
: K extends Record<string, unknown>
? __ToStruct<K>
: Codec;
export type __CodecsNext<K, C extends Codec[]> = export type __CodecsNext<K, C extends Codec[]> =
K extends __WrapOne K extends __WrapOne
? C extends [Codec, ...infer X] ? C extends [Codec, ...infer X]
@@ -94,7 +78,22 @@ export type __CodecsNext<K, C extends Codec[]> =
? C extends [Codec, Codec, ...infer X] ? C extends [Codec, Codec, ...infer X]
? [__MapWrapTwo<C[0], C[1]>[K], ...X] ? [__MapWrapTwo<C[0], C[1]>[K], ...X]
: Codec : Codec
: [__CodecFirst<K>, ...C]; : [
// __CodecFirst<K>
K extends keyof InterfaceTypes
? InterfaceTypes[K]
: K extends unknown[]
? __ToTuple<__Codecs<K>>
: K extends Record<string, unknown>
// __ToStruct<K extends Record<string, unknown>>
? K['_enum'] extends true
? Enum
: K['_set'] extends true
? CodecSet
: Struct
: Codec,
...C
];
export type __Codecs<T extends unknown[]> = export type __Codecs<T extends unknown[]> =
T extends [infer K, ...infer N] T extends [infer K, ...infer N]
@@ -123,25 +122,18 @@ export type __TokenizeStruct<T extends [__Value[], string], V extends __Value[],
export type __TokenizeTuple<T extends [__Value[], string], V extends __Value[], I extends string> = export type __TokenizeTuple<T extends [__Value[], string], V extends __Value[], I extends string> =
__Tokenize<T[1], __CombineInner<V, I, T[0]>>; __Tokenize<T[1], __CombineInner<V, I, T[0]>>;
export type __TokenizeWrapped<K extends string, V extends __Value[], I extends string, R extends string> =
K extends `${infer X}${R}`
? X extends '['
? __Tokenize<R, [...__Combine<V, I>, '[']>
: __Tokenize<R, __Combine<V, `${I}${X}`>>
: never;
export type __TokenizeKnown<K extends string, V extends __Value[], I extends string, R extends string> =
K extends `${infer X}${',' | '>'}${R}`
? __Tokenize<R, __Combine<V, `${I}${X}`>>
: never;
// NOTE For recursion limits, it is more optimal to use __Sanitize with conjunction with __Tokenize // NOTE For recursion limits, it is more optimal to use __Sanitize with conjunction with __Tokenize
// below, even while we do more matching (Number of characters iterated through is the most problematic) // below, even while we do more matching (Number of characters iterated through is the most problematic)
export type __Tokenize<K extends string, V extends __Value[] = [], I extends string = ''> = export type __Tokenize<K extends string, V extends __Value[] = [], I extends string = ''> =
K extends '' | '>' | ')' | '}' K extends '' | '>' | ')' | '}'
? [__Combine<V, I>, ''] ? [__Combine<V, I>, '']
: K extends `${__Wrap}${infer R}` : K extends `${__Wrap}${infer R}`
? __TokenizeWrapped<K, V, I, R> // __TokenizeWrapped<K extends string, V extends __Value[], I extends string, R extends string>
? K extends `${infer X}${R}`
? X extends '['
? __Tokenize<R, [...__Combine<V, I>, '[']>
: __Tokenize<R, __Combine<V, `${I}${X}`>>
: never
: K extends `${',' | '>'}${infer R}` : K extends `${',' | '>'}${infer R}`
? __Tokenize<R, __Combine<V, I>> ? __Tokenize<R, __Combine<V, I>>
: K extends `${')' | '}'}${infer R}` : K extends `${')' | '}'}${infer R}`
@@ -151,7 +143,10 @@ export type __Tokenize<K extends string, V extends __Value[] = [], I extends str
: K extends `{${infer R}` : K extends `{${infer R}`
? __TokenizeStruct<__Tokenize<R>, V, I, R> ? __TokenizeStruct<__Tokenize<R>, V, I, R>
: K extends `${keyof InterfaceTypes}${',' | '>'}${infer R}` : K extends `${keyof InterfaceTypes}${',' | '>'}${infer R}`
? __TokenizeKnown<K, V, I, R> // __TokenizeKnown<K extends string, V extends __Value[], I extends string, R extends string>
? K extends `${infer X}${',' | '>'}${R}`
? __Tokenize<R, __Combine<V, `${I}${X}`>>
: never
: K extends `${infer C}${infer R}` : K extends `${infer C}${infer R}`
? __Tokenize<R, V, `${I}${C}`> ? __Tokenize<R, V, `${I}${C}`>
: [__Combine<V, I>, '']; : [__Combine<V, I>, ''];
+456 -563
View File
File diff suppressed because it is too large Load Diff