Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c88bb99b19 | ||
|
|
fc174738ec | ||
|
|
b43f1a747d | ||
|
|
555b2fb5fe | ||
|
|
1e1ee6eb49 | ||
|
|
7c4c346389 | ||
|
|
beff353b4e | ||
|
|
3172cb55f8 | ||
|
|
ba74ad0be9 | ||
|
|
6ec7687f33 | ||
|
|
bd70b1e6ce | ||
|
|
8744b95c83 | ||
|
|
94e6d8455d | ||
|
|
70d19fcebb | ||
|
|
174ba867d7 | ||
|
|
36b217463a | ||
|
|
412c7525c0 | ||
|
|
172c6f655f | ||
|
|
1e3240c669 | ||
|
|
43e1bf2d4a | ||
|
|
839b2bc342 | ||
|
|
a281e0dc2d | ||
|
|
9a4893130d | ||
|
|
77c45cf4c0 | ||
|
|
ca0969b1eb | ||
|
|
1df8cf9857 | ||
|
|
b7f095bcbd | ||
|
|
6cc7242bdf | ||
|
|
48f91ae0da |
+16
-1
@@ -1,5 +1,20 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 5.3.1 Aug 2, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for users of `api.at(...)` interfaces
|
||||
|
||||
Changes:
|
||||
|
||||
- Check specName & specVersion for historic registries (caters for runtime renames)
|
||||
- Fix circular dependencies in codec utils
|
||||
- Fix `api.at(<blockHash>)` to decorate with the correct storage hash
|
||||
- Adjustments for upcoming metadata v14 in type creation & `PortableRegistry`
|
||||
- Add Kusama 9080 upgrade block
|
||||
- Add v13/v14 static metadata for Polkadot
|
||||
- Align static metadata with latest Substrate
|
||||
|
||||
|
||||
## 5.2.1 Jul 26, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for users of `BTreeMap` and `BTreeSet`
|
||||
@@ -10,7 +25,7 @@ Contributed:
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust RPC to use registry.createType with optionality (required for metadata v14)
|
||||
- Adjust RPC to use `registry.createType` with optionality (required for metadata v14)
|
||||
- Adjust alphabetical sorting for TS type generation
|
||||
- Adjustments for upcoming metadata v14 in type creation & `PortableRegistry`
|
||||
- Provide the capability to convert v13 Metadata to upcoming v14
|
||||
|
||||
+1
-1
@@ -35,5 +35,5 @@
|
||||
"@types/jest": "^26.0.24",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"version": "5.2.1"
|
||||
"version": "5.3.1"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
@@ -20,9 +20,9 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/api": "5.2.1",
|
||||
"@polkadot/types": "5.2.1",
|
||||
"@polkadot/util": "^7.0.3",
|
||||
"@polkadot/api": "5.3.1",
|
||||
"@polkadot/types": "5.3.1",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"rxjs": "^7.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ const PRIMITIVE_ALIAS: Record<string, keyof InterfaceTypes> = {
|
||||
|
||||
const PRIMITIVE_ALWAYS = ['AccountId', 'AccountIndex', 'Address', 'Balance'];
|
||||
|
||||
// TODO Replace usages with PortableRegistry
|
||||
export class MetaRegistry extends TypeRegistry {
|
||||
public readonly metaTypeDefs: TypeDef[] = [];
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-contract', version: '5.2.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-contract', version: '5.3.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
@@ -20,15 +20,15 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/api": "5.2.1",
|
||||
"@polkadot/rpc-core": "5.2.1",
|
||||
"@polkadot/types": "5.2.1",
|
||||
"@polkadot/util": "^7.0.3",
|
||||
"@polkadot/util-crypto": "^7.0.3",
|
||||
"@polkadot/api": "5.3.1",
|
||||
"@polkadot/rpc-core": "5.3.1",
|
||||
"@polkadot/types": "5.3.1",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"@polkadot/util-crypto": "^7.1.1",
|
||||
"rxjs": "^7.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.0.3",
|
||||
"@polkadot/rpc-provider": "5.2.1"
|
||||
"@polkadot/keyring": "^7.1.1",
|
||||
"@polkadot/rpc-provider": "5.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-derive', version: '5.2.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-derive', version: '5.3.1' };
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { ApiPromise, WsProvider } from '@polkadot/api';
|
||||
import { Metadata, TypeRegistry } from '@polkadot/types';
|
||||
import metaStatic from '@polkadot/types/metadata/static';
|
||||
import metaStatic from '@polkadot/types/metadata/static-substrate';
|
||||
|
||||
export function createApiWithAugmentations (): ApiPromise {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
@@ -20,14 +20,14 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/api-derive": "5.2.1",
|
||||
"@polkadot/keyring": "^7.0.3",
|
||||
"@polkadot/rpc-core": "5.2.1",
|
||||
"@polkadot/rpc-provider": "5.2.1",
|
||||
"@polkadot/types": "5.2.1",
|
||||
"@polkadot/types-known": "5.2.1",
|
||||
"@polkadot/util": "^7.0.3",
|
||||
"@polkadot/util-crypto": "^7.0.3",
|
||||
"@polkadot/api-derive": "5.3.1",
|
||||
"@polkadot/keyring": "^7.1.1",
|
||||
"@polkadot/rpc-core": "5.3.1",
|
||||
"@polkadot/rpc-provider": "5.3.1",
|
||||
"@polkadot/types": "5.3.1",
|
||||
"@polkadot/types-known": "5.3.1",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"@polkadot/util-crypto": "^7.1.1",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"rxjs": "^7.2.0"
|
||||
}
|
||||
|
||||
@@ -1,19 +1,59 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Vec, u16, u32, u64 } from '@polkadot/types';
|
||||
import type { Vec, bool, u16, u32, u64 } from '@polkadot/types';
|
||||
import type { Codec } from '@polkadot/types/types';
|
||||
import type { Schedule } from '@polkadot/types/interfaces/contracts';
|
||||
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, Moment, PalletId, Perbill, Percent, Permill, RuntimeDbWeight, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, Moment, PalletId, Perbill, Percent, Permill, RuntimeDbWeight, TransactionPriority, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import type { SessionIndex } from '@polkadot/types/interfaces/session';
|
||||
import type { EraIndex } from '@polkadot/types/interfaces/staking';
|
||||
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
|
||||
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||
import type { BlockLength, BlockWeights } from '@polkadot/types/interfaces/system';
|
||||
import type { DepositBalanceOf } from '@polkadot/types/interfaces/uniques';
|
||||
import type { ApiTypes } from '@polkadot/api/types';
|
||||
|
||||
declare module '@polkadot/api/types/consts' {
|
||||
export interface AugmentedConsts<ApiType> {
|
||||
assets: {
|
||||
/**
|
||||
* The amount of funds that must be reserved when creating a new approval.
|
||||
**/
|
||||
approvalDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved for an asset.
|
||||
**/
|
||||
assetDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved when adding metadata to your asset.
|
||||
**/
|
||||
metadataDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The additional funds that must be reserved for the number of bytes you store in your
|
||||
* metadata.
|
||||
**/
|
||||
metadataDepositPerByte: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum length of a name or symbol stored on-chain.
|
||||
**/
|
||||
stringLimit: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
authorship: {
|
||||
/**
|
||||
* The number of blocks back we should accept uncles.
|
||||
* This means that we will deal with uncle-parents that are
|
||||
* `UncleGenerations + 1` before `now`.
|
||||
**/
|
||||
uncleGenerations: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
babe: {
|
||||
/**
|
||||
* The amount of time, in slots, that each epoch should last.
|
||||
@@ -39,6 +79,15 @@ declare module '@polkadot/api/types/consts' {
|
||||
* The minimum amount required to keep an account open.
|
||||
**/
|
||||
existentialDeposit: Balance & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of locks that should exist on an account.
|
||||
* Not strictly enforced, but used for weight estimation.
|
||||
**/
|
||||
maxLocks: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of named reserves that can exist on an account.
|
||||
**/
|
||||
maxReserves: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
@@ -163,10 +212,20 @@ declare module '@polkadot/api/types/consts' {
|
||||
* Minimum voting period allowed for a fast-track referendum.
|
||||
**/
|
||||
fastTrackVotingPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Indicator for whether an emergency origin is even allowed to happen. Some chains may want
|
||||
* to set this permanently to `false`, others may want to condition it on things such as
|
||||
* an upgrade having happened recently.
|
||||
**/
|
||||
instantAllowed: bool & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* How often (in blocks) new public referenda are launched.
|
||||
**/
|
||||
launchPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of public proposals that can exist at any time.
|
||||
**/
|
||||
maxProposals: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of votes for an account.
|
||||
*
|
||||
@@ -192,6 +251,29 @@ declare module '@polkadot/api/types/consts' {
|
||||
[key: string]: Codec;
|
||||
};
|
||||
electionProviderMultiPhase: {
|
||||
/**
|
||||
* Maximum number of iteration of balancing that will be executed in the embedded miner of
|
||||
* the pallet.
|
||||
**/
|
||||
minerMaxIterations: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Maximum length (bytes) that the mined solution should consume.
|
||||
*
|
||||
* The miner will ensure that the total length of the unsigned solution will not exceed
|
||||
* this value.
|
||||
**/
|
||||
minerMaxLength: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Maximum weight that the miner should consume.
|
||||
*
|
||||
* The miner will ensure that the total weight of the unsigned solution will not exceed
|
||||
* this value, based on [`WeightInfo::submit_unsigned`].
|
||||
**/
|
||||
minerMaxWeight: Weight & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The priority of the unsigned transaction submitted in the unsigned-phase
|
||||
**/
|
||||
minerTxPriority: TransactionPriority & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The repeat threshold of the offchain worker.
|
||||
*
|
||||
@@ -295,6 +377,11 @@ declare module '@polkadot/api/types/consts' {
|
||||
* Must be no greater than `MaxQueueLen`.
|
||||
**/
|
||||
fifoQueueLen: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The issuance to ignore. This is subtracted from the `Currency`'s `total_issuance` to get
|
||||
* the issuance by which we inflate or deflate the gilt.
|
||||
**/
|
||||
ignoredIssuance: BalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The number of blocks between consecutive attempts to issue more gilts in an effort to
|
||||
* get to the target amount to be frozen.
|
||||
@@ -371,6 +458,19 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
imOnline: {
|
||||
/**
|
||||
* A configuration for base priority of unsigned transactions.
|
||||
*
|
||||
* This is exposed so that it can be tuned for particular runtime, when
|
||||
* multiple pallets send unsigned transactions.
|
||||
**/
|
||||
unsignedPriority: TransactionPriority & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
indices: {
|
||||
/**
|
||||
* The deposit needed for reserving an index.
|
||||
@@ -386,6 +486,12 @@ declare module '@polkadot/api/types/consts' {
|
||||
* The max number of calls available in a single lottery.
|
||||
**/
|
||||
maxCalls: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Number of time we should try to generate a random number that has no modulo bias.
|
||||
* The larger this number, the more potential computation is used for picking the winner,
|
||||
* but also the more likely that the chosen winner is done fairly.
|
||||
**/
|
||||
maxGenerateRandom: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The Lottery's pallet id
|
||||
**/
|
||||
@@ -495,6 +601,22 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
scheduler: {
|
||||
/**
|
||||
* The maximum weight that may be scheduled per block for any dispatchables of less priority
|
||||
* than `schedule::HARD_DEADLINE`.
|
||||
**/
|
||||
maximumWeight: Weight & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of scheduled calls in the queue for a single block.
|
||||
* Not strictly enforced, but used for weight estimation.
|
||||
**/
|
||||
maxScheduledPerBlock: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
society: {
|
||||
/**
|
||||
* The minimum amount of a deposit required for a bid to be made.
|
||||
@@ -657,7 +779,11 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
burn: Permill & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The treasury's module id, used for deriving its sovereign account ID.
|
||||
* The maximum number of approvals that can wait in the spending queue.
|
||||
**/
|
||||
maxApprovals: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The treasury's pallet id, used for deriving its sovereign account ID.
|
||||
**/
|
||||
palletId: PalletId & AugmentedConst<ApiType>;
|
||||
/**
|
||||
@@ -678,6 +804,45 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
uniques: {
|
||||
/**
|
||||
* The basic amount of funds that must be reserved when adding an attribute to an asset.
|
||||
**/
|
||||
attributeDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved for an asset class.
|
||||
**/
|
||||
classDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The additional funds that must be reserved for the number of bytes store in metadata,
|
||||
* either "normal" metadata or attribute metadata.
|
||||
**/
|
||||
depositPerByte: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved for an asset instance.
|
||||
**/
|
||||
instanceDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum length of an attribute key.
|
||||
**/
|
||||
keyLimit: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved when adding metadata to your asset.
|
||||
**/
|
||||
metadataDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum length of data stored on-chain.
|
||||
**/
|
||||
stringLimit: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum length of an attribute value.
|
||||
**/
|
||||
valueLimit: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
vesting: {
|
||||
/**
|
||||
* The minimum amount transferred to call `vested_transfer`.
|
||||
|
||||
@@ -314,9 +314,9 @@ declare module '@polkadot/api/types/events' {
|
||||
**/
|
||||
Delegated: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
||||
/**
|
||||
* A proposal has been enacted. \[ref_index, is_ok\]
|
||||
* A proposal has been enacted. \[ref_index, result\]
|
||||
**/
|
||||
Executed: AugmentedEvent<ApiType, [ReferendumIndex, bool]>;
|
||||
Executed: AugmentedEvent<ApiType, [ReferendumIndex, DispatchResult]>;
|
||||
/**
|
||||
* An external proposal has been tabled.
|
||||
**/
|
||||
@@ -819,7 +819,7 @@ declare module '@polkadot/api/types/events' {
|
||||
* the remainder from the maximum amount of reward.
|
||||
* \[era_index, validator_payout, remainder\]
|
||||
**/
|
||||
EraPayout: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
|
||||
EraPaid: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
|
||||
/**
|
||||
* A nominator has been kicked from a validator. \[nominator, stash\]
|
||||
**/
|
||||
@@ -830,18 +830,22 @@ declare module '@polkadot/api/types/events' {
|
||||
**/
|
||||
OldSlashingReportDiscarded: AugmentedEvent<ApiType, [SessionIndex]>;
|
||||
/**
|
||||
* The staker has been rewarded by this amount. \[stash, amount\]
|
||||
* The stakers' rewards are getting paid. \[era_index, validator_stash\]
|
||||
**/
|
||||
Reward: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
PayoutStarted: AugmentedEvent<ApiType, [EraIndex, AccountId]>;
|
||||
/**
|
||||
* The nominator has been rewarded by this amount. \[stash, amount\]
|
||||
**/
|
||||
Rewarded: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
/**
|
||||
* One validator (and its nominators) has been slashed by the given amount.
|
||||
* \[validator, amount\]
|
||||
**/
|
||||
Slash: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
Slashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
/**
|
||||
* A new set of stakers was elected.
|
||||
**/
|
||||
StakingElection: AugmentedEvent<ApiType, []>;
|
||||
StakersElected: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* The election failed. No new era is planned.
|
||||
**/
|
||||
@@ -1172,6 +1176,10 @@ declare module '@polkadot/api/types/events' {
|
||||
* well as the error. \[index, error\]
|
||||
**/
|
||||
BatchInterrupted: AugmentedEvent<ApiType, [u32, DispatchError]>;
|
||||
/**
|
||||
* A single item within a Batch of dispatches has completed with no error.
|
||||
**/
|
||||
ItemCompleted: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* Generic event
|
||||
**/
|
||||
|
||||
@@ -939,7 +939,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
/**
|
||||
* The last planned session scheduled by the session pallet.
|
||||
*
|
||||
* This is basically in sync with the call to [`SessionManager::new_session`].
|
||||
* This is basically in sync with the call to [`pallet_session::SessionManager::new_session`].
|
||||
**/
|
||||
currentPlannedSession: AugmentedQuery<ApiType, () => Observable<SessionIndex>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
|
||||
@@ -1352,8 +1352,9 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* origin is removed as a runner-up.
|
||||
* - `origin` is a current member. In this case, the deposit is unreserved and origin is
|
||||
* removed as a member, consequently not being a candidate for the next round anymore.
|
||||
* Similar to [`remove_members`], if replacement runners exists, they are immediately
|
||||
* used. If the prime is renouncing, then no prime will exist until the next round.
|
||||
* Similar to [`remove_member`](Self::remove_member), if replacement runners exists,
|
||||
* they are immediately used. If the prime is renouncing, then no prime will exist until
|
||||
* the next round.
|
||||
*
|
||||
* The dispatch origin of this call must be signed, and have one of the above roles.
|
||||
*
|
||||
@@ -2556,7 +2557,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Schedule a named task after a delay.
|
||||
*
|
||||
* # <weight>
|
||||
* Same as [`schedule_named`].
|
||||
* Same as [`schedule_named`](Self::schedule_named).
|
||||
* # </weight>
|
||||
**/
|
||||
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option<Period> | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, BlockNumber, Option<Period>, Priority, Call]>;
|
||||
@@ -2954,8 +2955,8 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin for this call must be _Signed_ by the stash, not the controller.
|
||||
*
|
||||
* Use this if there are additional funds in your stash account that you wish to bond.
|
||||
* Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount
|
||||
* that can be added.
|
||||
* Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose any limitation
|
||||
* on the amount that can be added.
|
||||
*
|
||||
* Emits `Bonded`.
|
||||
*
|
||||
@@ -3017,7 +3018,6 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* This can be helpful if bond requirements are updated, and we need to remove old users
|
||||
* who do not satisfy these requirements.
|
||||
*
|
||||
**/
|
||||
chillOther: AugmentedSubmittable<(controller: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId]>;
|
||||
/**
|
||||
@@ -3093,7 +3093,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # <weight>
|
||||
* Same as [`set_validator_count`].
|
||||
* Same as [`Self::set_validator_count`].
|
||||
* # </weight>
|
||||
**/
|
||||
increaseValidatorCount: AugmentedSubmittable<(additional: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
|
||||
@@ -3185,7 +3185,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # <weight>
|
||||
* Same as [`set_validator_count`].
|
||||
* Same as [`Self::set_validator_count`].
|
||||
* # </weight>
|
||||
**/
|
||||
scaleValidatorCount: AugmentedSubmittable<(factor: Percent | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Percent]>;
|
||||
|
||||
@@ -189,12 +189,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
return this._rpcCore.provider.hasSubscriptions || !!this._rpcCore.state.queryStorageAt;
|
||||
}
|
||||
|
||||
protected _injectDecorated (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean, blockHash?: Uint8Array): FullDecoration<ApiType> {
|
||||
const decoratedMeta = expandMetadata(registry.registry, registry.metadata);
|
||||
|
||||
// clear the decoration, we are redoing it here
|
||||
if (fromEmpty || !registry.decoration) {
|
||||
registry.decoration = {
|
||||
protected _createDecorated (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean, blockHash?: Uint8Array | null, decoratedApi?: ApiDecoration<ApiType>): FullDecoration<ApiType> {
|
||||
if (!decoratedApi) {
|
||||
decoratedApi = {
|
||||
consts: {},
|
||||
errors: {},
|
||||
events: {},
|
||||
@@ -202,25 +199,39 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
} as ApiDecoration<ApiType>;
|
||||
}
|
||||
|
||||
if (!registry.decoratedMeta) {
|
||||
registry.decoratedMeta = expandMetadata(registry.registry, registry.metadata);
|
||||
}
|
||||
|
||||
// adjust the versioned registry
|
||||
augmentObject('consts', decoratedMeta.consts, registry.decoration.consts, fromEmpty);
|
||||
augmentObject('errors', decoratedMeta.errors, registry.decoration.errors, fromEmpty);
|
||||
augmentObject('events', decoratedMeta.events, registry.decoration.events, fromEmpty);
|
||||
augmentObject('consts', registry.decoratedMeta.consts, decoratedApi.consts, fromEmpty);
|
||||
augmentObject('errors', registry.decoratedMeta.errors, decoratedApi.errors, fromEmpty);
|
||||
augmentObject('events', registry.decoratedMeta.events, decoratedApi.events, fromEmpty);
|
||||
|
||||
const storage = blockHash
|
||||
? this._decorateStorageAt(decoratedMeta, this._decorateMethod, blockHash)
|
||||
: this._decorateStorage(decoratedMeta, this._decorateMethod);
|
||||
? this._decorateStorageAt(registry.decoratedMeta, this._decorateMethod, blockHash)
|
||||
: this._decorateStorage(registry.decoratedMeta, this._decorateMethod);
|
||||
|
||||
augmentObject('query', storage, registry.decoration.query, fromEmpty);
|
||||
augmentObject('query', storage, decoratedApi.query, fromEmpty);
|
||||
|
||||
return {
|
||||
decoratedApi: registry.decoration,
|
||||
decoratedMeta
|
||||
decoratedApi,
|
||||
decoratedMeta: registry.decoratedMeta
|
||||
};
|
||||
}
|
||||
|
||||
protected _injectMetadata (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean): void {
|
||||
const { decoratedApi, decoratedMeta } = this._injectDecorated(registry, fromEmpty);
|
||||
// clear the decoration, we are redoing it here
|
||||
if (fromEmpty || !registry.decoratedApi) {
|
||||
registry.decoratedApi = {
|
||||
consts: {},
|
||||
errors: {},
|
||||
events: {},
|
||||
query: {}
|
||||
} as ApiDecoration<ApiType>;
|
||||
}
|
||||
|
||||
const { decoratedApi, decoratedMeta } = this._createDecorated(registry, fromEmpty, null, registry.decoratedApi);
|
||||
|
||||
this._consts = decoratedApi.consts;
|
||||
this._errors = decoratedApi.errors;
|
||||
@@ -245,7 +256,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
* backwards compatible endpoint for metadata injection, may be removed in the future (However, it is still useful for testing injection)
|
||||
*/
|
||||
public injectMetadata (metadata: Metadata, fromEmpty?: boolean, registry?: Registry): void {
|
||||
this._injectMetadata({ metadata, registry: registry || this.#registry, specVersion: BN_ZERO }, fromEmpty);
|
||||
this._injectMetadata({ metadata, registry: registry || this.#registry, specName: this.#registry.createType('Text'), specVersion: BN_ZERO }, fromEmpty);
|
||||
}
|
||||
|
||||
private _decorateFunctionMeta (input: MetaDecoration, output: MetaDecoration): MetaDecoration {
|
||||
|
||||
@@ -114,9 +114,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
const u8aHash = u8aToU8a(blockHash);
|
||||
const registry = await this.getBlockRegistry(u8aHash);
|
||||
|
||||
return registry.decoration
|
||||
? registry.decoration
|
||||
: this._injectDecorated(registry, true, u8aHash).decoratedApi;
|
||||
// always create a new decoration for this specific hash
|
||||
return this._createDecorated(registry, true, u8aHash).decoratedApi;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,8 +151,12 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
: await firstValueFrom((this._rpcCore.state.getRuntimeVersion as RpcInterfaceMethod).json(header.parentHash))
|
||||
);
|
||||
|
||||
// check for pre-existing registries
|
||||
const existingViaVersion = this.#registries.find(({ specVersion }) => specVersion.eq(version.specVersion));
|
||||
// check for pre-existing registries. We also check specName, e.g. it
|
||||
// could be changed like in Westmint with upgrade from shell -> westmint
|
||||
const existingViaVersion = this.#registries.find(({ specName, specVersion }) =>
|
||||
specName.eq(version.specName) &&
|
||||
specVersion.eq(version.specVersion)
|
||||
);
|
||||
|
||||
if (existingViaVersion) {
|
||||
existingViaVersion.lastBlockHash = blockHash;
|
||||
@@ -170,7 +173,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
this._initRegistry(registry, this._runtimeChain as Text, version, metadata);
|
||||
|
||||
// add our new registry
|
||||
const result = { lastBlockHash: blockHash, metadata, registry, specVersion: version.specVersion };
|
||||
const result = { lastBlockHash: blockHash, metadata, registry, specName: version.specName, specVersion: version.specVersion };
|
||||
|
||||
this.#registries.push(result);
|
||||
|
||||
@@ -301,7 +304,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
|
||||
// setup the initial registry, when we have none
|
||||
if (!this.#registries.length) {
|
||||
this.#registries.push({ isDefault: true, metadata, registry: this.registry, specVersion: runtimeVersion.specVersion });
|
||||
this.#registries.push({ isDefault: true, metadata, registry: this.registry, specName: runtimeVersion.specName, specVersion: runtimeVersion.specVersion });
|
||||
}
|
||||
|
||||
// get unique types & validate
|
||||
|
||||
@@ -2,15 +2,19 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Metadata } from '@polkadot/types/metadata';
|
||||
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
|
||||
import type { Text } from '@polkadot/types/primitive';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { ApiDecoration, ApiTypes } from '../types';
|
||||
|
||||
export interface VersionedRegistry<ApiType extends ApiTypes> {
|
||||
decoration?: ApiDecoration<ApiType> | null;
|
||||
decoratedApi?: ApiDecoration<ApiType>;
|
||||
decoratedMeta?: DecoratedMeta;
|
||||
isDefault?: boolean;
|
||||
lastBlockHash?: Uint8Array | null;
|
||||
metadata: Metadata;
|
||||
registry: Registry;
|
||||
specName: Text;
|
||||
specVersion: BN;
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api', version: '5.2.1' };
|
||||
export const packageInfo = { name: '@polkadot/api', version: '5.3.1' };
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { Storage } from '@polkadot/types/metadata/decorate/types';
|
||||
|
||||
import { decorateStorage, Metadata, TypeRegistry } from '@polkadot/types';
|
||||
import metaStatic from '@polkadot/types/metadata/static';
|
||||
import metaStatic from '@polkadot/types/metadata/static-substrate';
|
||||
|
||||
import { extractStorageArgs } from './validate';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-core",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
@@ -20,12 +20,12 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/rpc-provider": "5.2.1",
|
||||
"@polkadot/types": "5.2.1",
|
||||
"@polkadot/util": "^7.0.3",
|
||||
"@polkadot/rpc-provider": "5.3.1",
|
||||
"@polkadot/types": "5.3.1",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"rxjs": "^7.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.0.3"
|
||||
"@polkadot/keyring": "^7.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '5.2.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '5.3.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
@@ -20,17 +20,17 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/types": "5.2.1",
|
||||
"@polkadot/util": "^7.0.3",
|
||||
"@polkadot/util-crypto": "^7.0.3",
|
||||
"@polkadot/x-fetch": "^7.0.3",
|
||||
"@polkadot/x-global": "^7.0.3",
|
||||
"@polkadot/x-ws": "^7.0.3",
|
||||
"@polkadot/types": "5.3.1",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"@polkadot/util-crypto": "^7.1.1",
|
||||
"@polkadot/x-fetch": "^7.1.1",
|
||||
"@polkadot/x-global": "^7.1.1",
|
||||
"@polkadot/x-ws": "^7.1.1",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.0.3",
|
||||
"@polkadot/types": "5.2.1",
|
||||
"@polkadot/keyring": "^7.1.1",
|
||||
"@polkadot/types": "5.3.1",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^13.1.1"
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { decorateStorage, Metadata } from '@polkadot/types';
|
||||
import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
|
||||
import rpcHeader from '@polkadot/types/json/Header.004.json';
|
||||
import rpcSignedBlock from '@polkadot/types/json/SignedBlock.004.immortal.json';
|
||||
import rpcMetadata from '@polkadot/types/metadata/static';
|
||||
import rpcMetadata from '@polkadot/types/metadata/static-substrate';
|
||||
import { assert, BN, bnToU8a, logger, u8aToHex } from '@polkadot/util';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', version: '5.2.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', version: '5.3.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/typegen",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"description": "Type generation scripts",
|
||||
"main": "index.js",
|
||||
@@ -29,16 +29,16 @@
|
||||
"@babel/core": "^7.14.8",
|
||||
"@babel/register": "^7.14.5",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/api": "5.2.1",
|
||||
"@polkadot/rpc-provider": "5.2.1",
|
||||
"@polkadot/types": "5.2.1",
|
||||
"@polkadot/util": "^7.0.3",
|
||||
"@polkadot/api": "5.3.1",
|
||||
"@polkadot/rpc-provider": "5.3.1",
|
||||
"@polkadot/types": "5.3.1",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"handlebars": "^4.7.7",
|
||||
"websocket": "^1.0.34",
|
||||
"yargs": "^17.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/websocket": "^1.0.3",
|
||||
"@types/websocket": "^1.0.4",
|
||||
"@types/yargs": "^17.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,23 +51,21 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
|
||||
})
|
||||
.sort(compareName);
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
];
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,19 +31,17 @@ function generateForMeta (meta: Metadata, dest: string, isStrict: boolean): void
|
||||
}))
|
||||
.sort(compareName);
|
||||
|
||||
const types = [
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
];
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,23 +44,21 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
|
||||
}))
|
||||
.sort(compareName);
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
];
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,18 +62,16 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
|
||||
});
|
||||
});
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
}))
|
||||
];
|
||||
|
||||
return generateInterfaceTypesTemplate({
|
||||
headerType: 'defs',
|
||||
imports,
|
||||
items: items.sort((a, b) => a.localeCompare(b)),
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
}))
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -127,23 +127,21 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
|
||||
imports.typesTypes.Observable = true;
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
];
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -126,18 +126,16 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
|
||||
|
||||
imports.typesTypes.Observable = true;
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
}))
|
||||
];
|
||||
|
||||
return generateRpcTypesTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
}))
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,23 +70,21 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
})
|
||||
.sort(compareName);
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes', 'SubmittableExtrinsic']
|
||||
}
|
||||
];
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes', 'SubmittableExtrinsic']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import fs from 'fs';
|
||||
import { GenericCall as Call, Metadata, TypeRegistry, Vec } from '@polkadot/types';
|
||||
import * as definitions from '@polkadot/types/interfaces/definitions';
|
||||
import { getStorage as getSubstrateStorage } from '@polkadot/types/metadata/decorate/storage/getStorage';
|
||||
import rpcdata from '@polkadot/types/metadata/static';
|
||||
import rpcdata from '@polkadot/types/metadata/static-substrate';
|
||||
import { Text } from '@polkadot/types/primitive';
|
||||
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/typegen', version: '5.2.1' };
|
||||
export const packageInfo = { name: '@polkadot/typegen', version: '5.3.1' };
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ClassOfUnsafe, getTypeDef } from '@polkadot/types/create';
|
||||
import { TypeDefInfo } from '@polkadot/types/create/types';
|
||||
import { GenericAccountId, GenericLookupSource, GenericVote } from '@polkadot/types/generic';
|
||||
import { AllConvictions } from '@polkadot/types/interfaces/democracy/definitions';
|
||||
import { Null } from '@polkadot/types/primitive';
|
||||
import { bool, Null } from '@polkadot/types/primitive';
|
||||
import * as primitiveClasses from '@polkadot/types/primitive';
|
||||
import { isChildClass, stringify } from '@polkadot/util';
|
||||
|
||||
@@ -28,7 +28,10 @@ const voteConvictions = arrayToStrType(AllConvictions);
|
||||
/** @internal */
|
||||
export function getDerivedTypes (registry: Registry, definitions: Record<string, ModuleTypes>, type: string, primitiveName: string, imports: TypeImports): string[] {
|
||||
// `primitiveName` represents the actual primitive type our type is mapped to
|
||||
const isCompact = isCompactEncodable((primitiveClasses as Record<string, any>)[primitiveName] || ClassOfUnsafe(registry, type));
|
||||
const isCompact = isCompactEncodable(
|
||||
(primitiveClasses as Record<string, any>)[primitiveName] ||
|
||||
ClassOfUnsafe(registry, type)
|
||||
);
|
||||
const def = getTypeDef(type);
|
||||
|
||||
setImports(definitions, imports, ['Option', 'Vec', isCompact ? 'Compact' : '']);
|
||||
@@ -121,7 +124,7 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
|
||||
possibleTypes.push('Address', 'AccountId', 'AccountIndex', 'LookupSource', 'string', 'Uint8Array');
|
||||
} else if (isChildClass(GenericAccountId, Clazz)) {
|
||||
possibleTypes.push('string', 'Uint8Array');
|
||||
} else if (isChildClass(registry.createClass('bool'), Clazz)) {
|
||||
} else if (isChildClass(bool, Clazz)) {
|
||||
possibleTypes.push('boolean', 'Uint8Array');
|
||||
} else if (isChildClass(Null, Clazz)) {
|
||||
possibleTypes.push('null');
|
||||
|
||||
@@ -86,74 +86,86 @@ export function exportType (name = '', base: string): string {
|
||||
return exportInterface(name, base);
|
||||
}
|
||||
|
||||
const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => string> = {
|
||||
[TypeDefInfo.Compact]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => string> = {
|
||||
[TypeDefInfo.Compact]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Compact']);
|
||||
|
||||
return paramsNotation('Compact', formatType(registry, definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
const sub = typeDef.sub as TypeDef;
|
||||
|
||||
return paramsNotation('Compact', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.DoNotConstruct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.DoNotConstruct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['DoNotConstruct']);
|
||||
|
||||
return 'DoNotConstruct';
|
||||
},
|
||||
[TypeDefInfo.Enum]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Enum]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
if (typeDef.lookupName) {
|
||||
return typeDef.lookupName;
|
||||
}
|
||||
|
||||
throw new Error(`TypeDefInfo.Enum: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
[TypeDefInfo.Int]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Int]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.Int: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
[TypeDefInfo.UInt]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.UInt]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.UInt: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Null']);
|
||||
|
||||
return 'Null';
|
||||
},
|
||||
[TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Option']);
|
||||
|
||||
return paramsNotation('Option', formatType(registry, definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
return paramsNotation('Option', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.Plain]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Plain]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, [typeDef.type]);
|
||||
|
||||
return typeDef.type;
|
||||
},
|
||||
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.Set: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
[TypeDefInfo.Si]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
throw new Error(`TypeDefInfo.Si: Not implemented on ${stringify(typeDef)}`);
|
||||
[TypeDefInfo.Si]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return formatType(registry, definitions, registry.lookup.getTypeDef(typeDef.type), imports, withShortcut);
|
||||
},
|
||||
[TypeDefInfo.Struct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Struct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Struct']);
|
||||
|
||||
return `{ ${
|
||||
((typeDef.sub as TypeDef[]).map(({ name, type }, index) => [
|
||||
return `{${withShortcut ? ' ' : '\n'}${
|
||||
((typeDef.sub as TypeDef[]).map(({ lookupName, name, type }, index) => [
|
||||
name || `unknown${index}`,
|
||||
formatType(registry, definitions, type, imports)
|
||||
])).map(([k, t]) => `${k}: ${t};`).join(' ')
|
||||
} } & Struct`;
|
||||
formatType(registry, definitions, lookupName || type, imports, withShortcut)
|
||||
])).map(([k, t]) => `${withShortcut ? '' : ' readonly '}${k}: ${t};`).join(withShortcut ? ' ' : '\n')
|
||||
}${withShortcut ? ' ' : '\n '}} & Struct`;
|
||||
},
|
||||
[TypeDefInfo.Tuple]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Tuple]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['ITuple']);
|
||||
|
||||
// `(a,b)` gets transformed into `ITuple<[a, b]>`
|
||||
return paramsNotation('ITuple', `[${
|
||||
((typeDef.sub as TypeDef[]).map(({ type }) =>
|
||||
formatType(registry, definitions, type, imports))
|
||||
).join(', ')
|
||||
((typeDef.sub as TypeDef[]).map(({ lookupName, type }) =>
|
||||
formatType(registry, definitions, lookupName || type, imports, withShortcut)
|
||||
)).join(', ')
|
||||
}]`);
|
||||
},
|
||||
[TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Vec']);
|
||||
|
||||
return paramsNotation('Vec', formatType(registry, definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
},
|
||||
[TypeDefInfo.VecFixed]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
const type = (typeDef.sub as TypeDef).type;
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
if (type === 'u8') {
|
||||
return paramsNotation('Vec', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.VecFixed]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
if (sub.type === 'u8') {
|
||||
setImports(definitions, imports, ['U8aFixed']);
|
||||
|
||||
return 'U8aFixed';
|
||||
@@ -161,42 +173,42 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
|
||||
|
||||
setImports(definitions, imports, ['Vec']);
|
||||
|
||||
return paramsNotation('Vec', formatType(registry, definitions, type, imports));
|
||||
return paramsNotation('Vec', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.BTreeMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.BTreeMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['BTreeMap']);
|
||||
|
||||
const [keyDef, valDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return `BTreeMap<${formatType(registry, definitions, keyDef.type, imports)}, ${formatType(registry, definitions, valDef.type, imports)}>`;
|
||||
return `BTreeMap<${formatType(registry, definitions, keyDef.lookupName || keyDef.type, imports, withShortcut)}, ${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
|
||||
},
|
||||
[TypeDefInfo.BTreeSet]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.BTreeSet]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['BTreeSet']);
|
||||
|
||||
const valDef = typeDef.sub as TypeDef;
|
||||
|
||||
return `BTreeSet<${formatType(registry, definitions, valDef.type, imports)}>`;
|
||||
return `BTreeSet<${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
|
||||
},
|
||||
[TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['HashMap']);
|
||||
|
||||
const [keyDef, valDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return `HashMap<${formatType(registry, definitions, keyDef.type, imports)}, ${formatType(registry, definitions, valDef.type, imports)}>`;
|
||||
return `HashMap<${formatType(registry, definitions, keyDef.lookupName || keyDef.type, imports, withShortcut)}, ${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
|
||||
},
|
||||
[TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
const type = (typeDef.sub as TypeDef).type;
|
||||
|
||||
[TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Linkage']);
|
||||
|
||||
return paramsNotation('Linkage', formatType(registry, definitions, type, imports));
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
return paramsNotation('Linkage', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
|
||||
[TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Result']);
|
||||
|
||||
const [okDef, errorDef] = (typeDef.sub as TypeDef[]);
|
||||
const [okDef, errDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return `Result<${formatType(registry, definitions, okDef.type, imports)}, ${formatType(registry, definitions, errorDef.type, imports)}>`;
|
||||
return `Result<${formatType(registry, definitions, okDef.lookupName || okDef.type, imports, withShortcut)}, ${formatType(registry, definitions, errDef.lookupName || errDef.type, imports, withShortcut)}>`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -205,7 +217,7 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
|
||||
*/
|
||||
/** @internal */
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function formatType (registry: Registry, definitions: Record<string, ModuleTypes>, type: string | String | TypeDef, imports: TypeImports): string {
|
||||
export function formatType (registry: Registry, definitions: Record<string, ModuleTypes>, type: string | String | TypeDef, imports: TypeImports, withShortcut = false): string {
|
||||
let typeDef: TypeDef;
|
||||
|
||||
if (isString(type)) {
|
||||
@@ -213,7 +225,7 @@ export function formatType (registry: Registry, definitions: Record<string, Modu
|
||||
|
||||
// If type is "unorthodox" (i.e. `{ something: any }` for an Enum input or `[a | b | c, d | e | f]` for a Tuple's similar types),
|
||||
// we return it as-is
|
||||
if (/(^{.+:.+})|^\([^,]+\)|^\(.+\)\[\]|^\[.+\]/.exec(_type) && !/\[\w+;\w+\]/.exec(_type)) {
|
||||
if (withShortcut && /(^{.+:.+})|^\([^,]+\)|^\(.+\)\[\]|^\[.+\]/.exec(_type) && !/\[\w+;\w+\]/.exec(_type)) {
|
||||
return _type;
|
||||
}
|
||||
|
||||
@@ -224,5 +236,5 @@ export function formatType (registry: Registry, definitions: Record<string, Modu
|
||||
|
||||
setImports(definitions, imports, [typeDef.type]);
|
||||
|
||||
return formatters[typeDef.info](registry, typeDef, definitions, imports);
|
||||
return formatters[typeDef.info](registry, typeDef, definitions, imports, withShortcut);
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ export function setImports (allDefs: Record<string, ModuleTypes>, imports: TypeI
|
||||
|
||||
// TypeDef.sub is a `TypeDef | TypeDef[]`
|
||||
if (Array.isArray(typeDef.sub)) {
|
||||
typeDef.sub.forEach((subType) => setImports(allDefs, imports, [subType.type]));
|
||||
typeDef.sub.forEach((subType) => setImports(allDefs, imports, [subType.lookupName || subType.type]));
|
||||
} else if (typeDef.sub && (typeDef.info !== TypeDefInfo.VecFixed || typeDef.sub.type !== 'u8')) {
|
||||
// typeDef.sub is a TypeDef in this case
|
||||
setImports(allDefs, imports, [typeDef.sub.type]);
|
||||
setImports(allDefs, imports, [typeDef.sub.lookupName || typeDef.sub.type]);
|
||||
}
|
||||
} else if (type.includes('[') && type.includes('|')) {
|
||||
// We split the types (we already dod the check above, so safe-path should not be caught)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { ExtraTypes } from '../generate/types';
|
||||
|
||||
import { Metadata, TypeRegistry } from '@polkadot/types';
|
||||
import staticData from '@polkadot/types/metadata/static';
|
||||
import staticData from '@polkadot/types/metadata/static-substrate';
|
||||
|
||||
import { registerDefinitions } from './register';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types-known",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
@@ -20,8 +20,8 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/networks": "^7.0.3",
|
||||
"@polkadot/types": "5.2.1",
|
||||
"@polkadot/util": "^7.0.3"
|
||||
"@polkadot/networks": "^7.1.1",
|
||||
"@polkadot/types": "5.3.1",
|
||||
"@polkadot/util": "^7.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/types-known', version: '5.2.1' };
|
||||
export const packageInfo = { name: '@polkadot/types-known', version: '5.3.1' };
|
||||
|
||||
@@ -13,7 +13,7 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
|
||||
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
|
||||
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
|
||||
[7812476, 9040], [8010981, 9050], [8073833, 9070]
|
||||
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.1",
|
||||
"type": "module",
|
||||
"description": "Implementation of the Parity codec",
|
||||
"main": "index.js",
|
||||
@@ -20,12 +20,12 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/util": "^7.0.3",
|
||||
"@polkadot/util-crypto": "^7.0.3",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"@polkadot/util-crypto": "^7.1.1",
|
||||
"rxjs": "^7.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.0.3",
|
||||
"@polkadot/keyring": "^7.1.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.11.9"
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||
import type { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEpochConfiguration, BabeEquivocationProof, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe';
|
||||
import type { AccountData, BalanceLock, BalanceLockTo212, BalanceStatus, Reasons, ReserveData, ReserveIdentifier, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
|
||||
import type { BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, BeefySignedCommitment, MmrRootHash, ValidatorSetId } from '@polkadot/types/interfaces/beefy';
|
||||
import type { BridgedBlockHash, BridgedBlockNumber, BridgedHeader, InitializationData } from '@polkadot/types/interfaces/bridges';
|
||||
import type { BridgedBlockHash, BridgedBlockNumber, BridgedHeader, ChainId, Id, InitializationData, LaneId, MessageKey, MessageNonce } from '@polkadot/types/interfaces/bridges';
|
||||
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
||||
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
||||
import type { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims';
|
||||
@@ -25,14 +25,14 @@ import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex,
|
||||
import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
|
||||
import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth';
|
||||
import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } from '@polkadot/types/interfaces/evm';
|
||||
import type { AnySignature, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { AnySignature, EcdsaSignature, Ed25519Signature, Era, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset';
|
||||
import type { ActiveGilt, ActiveGiltsTotal, ActiveIndex, GiltBid } from '@polkadot/types/interfaces/gilt';
|
||||
import type { AuthorityIndex, AuthorityList, AuthoritySet, AuthoritySetChange, AuthoritySetChanges, AuthorityWeight, DelayKind, DelayKindBest, EncodedFinalityProofs, ForkTreePendingChange, ForkTreePendingChangeNode, GrandpaCommit, GrandpaEquivocation, GrandpaEquivocationProof, GrandpaEquivocationValue, GrandpaJustification, GrandpaPrecommit, GrandpaPrevote, GrandpaSignedPrecommit, JustificationNotification, KeyOwnerProof, NextAuthority, PendingChange, PendingPause, PendingResume, Precommits, Prevotes, ReportedRoundStates, RoundState, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
|
||||
import type { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityJudgement, RegistrarIndex, RegistrarInfo, Registration, RegistrationJudgement } from '@polkadot/types/interfaces/identity';
|
||||
import type { AuthIndex, AuthoritySignature, Heartbeat, HeartbeatTo244, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline';
|
||||
import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lottery';
|
||||
import type { ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV13, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, ExtrinsicMetadataV14, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV13, MetadataV14, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV13, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV13, ModuleMetadataV9, PalletCallMetadataLatest, PalletCallMetadataV14, PalletConstantMetadataLatest, PalletConstantMetadataV14, PalletErrorMetadataLatest, PalletErrorMetadataV14, PalletEventMetadataLatest, PalletEventMetadataV14, PalletMetadataLatest, PalletMetadataV14, PalletStorageMetadataLatest, PalletStorageMetadataV14, PortableRegistry, PortableType, SignedExtensionMetadataLatest, SignedExtensionMetadataV14, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV13, StorageEntryMetadataV14, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV13, StorageEntryModifierV14, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV13, StorageEntryTypeV14, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV13, StorageHasherV14, StorageHasherV9, StorageMetadataLatest, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV13, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
|
||||
import type { ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV13, ErrorMetadataV14, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV14, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, ExtrinsicMetadataV14, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV14, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV14, FunctionMetadataV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV13, MetadataV14, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV13, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV13, ModuleMetadataV9, PalletCallMetadataLatest, PalletCallMetadataV14, PalletConstantMetadataLatest, PalletConstantMetadataV14, PalletErrorMetadataLatest, PalletErrorMetadataV14, PalletEventMetadataLatest, PalletEventMetadataV14, PalletMetadataLatest, PalletMetadataV14, PalletStorageMetadataLatest, PalletStorageMetadataV14, PortableRegistry, PortableType, SignedExtensionMetadataLatest, SignedExtensionMetadataV14, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV13, StorageEntryMetadataV14, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV13, StorageEntryModifierV14, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV13, StorageEntryTypeV14, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV13, StorageHasherV14, StorageHasherV9, StorageMetadataLatest, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV13, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
|
||||
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
|
||||
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
|
||||
import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
|
||||
@@ -48,7 +48,7 @@ import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDe
|
||||
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
||||
import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session';
|
||||
import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
|
||||
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
|
||||
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SignedSubmissionTo276, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
|
||||
import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state';
|
||||
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||
import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithRefCountU8, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system';
|
||||
@@ -98,6 +98,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Compact<LeasePeriod>': Compact<LeasePeriod>;
|
||||
'Compact<LeasePeriodOf>': Compact<LeasePeriodOf>;
|
||||
'Compact<MemberCount>': Compact<MemberCount>;
|
||||
'Compact<MessageNonce>': Compact<MessageNonce>;
|
||||
'Compact<Moment>': Compact<Moment>;
|
||||
'Compact<MomentOf>': Compact<MomentOf>;
|
||||
'Compact<NominatorIndex>': Compact<NominatorIndex>;
|
||||
@@ -280,6 +281,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<CandidateInfo>': Option<CandidateInfo>;
|
||||
'Option<CandidatePendingAvailability>': Option<CandidatePendingAvailability>;
|
||||
'Option<CandidateReceipt>': Option<CandidateReceipt>;
|
||||
'Option<ChainId>': Option<ChainId>;
|
||||
'Option<ChainProperties>': Option<ChainProperties>;
|
||||
'Option<ChainType>': Option<ChainType>;
|
||||
'Option<ChangesTrieConfiguration>': Option<ChangesTrieConfiguration>;
|
||||
@@ -386,6 +388,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<EncodedFinalityProofs>': Option<EncodedFinalityProofs>;
|
||||
'Option<EncodedJustification>': Option<EncodedJustification>;
|
||||
'Option<EpochAuthorship>': Option<EpochAuthorship>;
|
||||
'Option<Era>': Option<Era>;
|
||||
'Option<EraIndex>': Option<EraIndex>;
|
||||
'Option<EraPoints>': Option<EraPoints>;
|
||||
'Option<EraRewardPoints>': Option<EraRewardPoints>;
|
||||
@@ -395,6 +398,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<ErrorMetadataV11>': Option<ErrorMetadataV11>;
|
||||
'Option<ErrorMetadataV12>': Option<ErrorMetadataV12>;
|
||||
'Option<ErrorMetadataV13>': Option<ErrorMetadataV13>;
|
||||
'Option<ErrorMetadataV14>': Option<ErrorMetadataV14>;
|
||||
'Option<ErrorMetadataV9>': Option<ErrorMetadataV9>;
|
||||
'Option<EthAccount>': Option<EthAccount>;
|
||||
'Option<EthBlock>': Option<EthBlock>;
|
||||
@@ -436,6 +440,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<EventMetadataV11>': Option<EventMetadataV11>;
|
||||
'Option<EventMetadataV12>': Option<EventMetadataV12>;
|
||||
'Option<EventMetadataV13>': Option<EventMetadataV13>;
|
||||
'Option<EventMetadataV14>': Option<EventMetadataV14>;
|
||||
'Option<EventMetadataV9>': Option<EventMetadataV9>;
|
||||
'Option<EventRecord>': Option<EventRecord>;
|
||||
'Option<EvmAccount>': Option<EvmAccount>;
|
||||
@@ -483,12 +488,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<FunctionArgumentMetadataV11>': Option<FunctionArgumentMetadataV11>;
|
||||
'Option<FunctionArgumentMetadataV12>': Option<FunctionArgumentMetadataV12>;
|
||||
'Option<FunctionArgumentMetadataV13>': Option<FunctionArgumentMetadataV13>;
|
||||
'Option<FunctionArgumentMetadataV14>': Option<FunctionArgumentMetadataV14>;
|
||||
'Option<FunctionArgumentMetadataV9>': Option<FunctionArgumentMetadataV9>;
|
||||
'Option<FunctionMetadataLatest>': Option<FunctionMetadataLatest>;
|
||||
'Option<FunctionMetadataV10>': Option<FunctionMetadataV10>;
|
||||
'Option<FunctionMetadataV11>': Option<FunctionMetadataV11>;
|
||||
'Option<FunctionMetadataV12>': Option<FunctionMetadataV12>;
|
||||
'Option<FunctionMetadataV13>': Option<FunctionMetadataV13>;
|
||||
'Option<FunctionMetadataV14>': Option<FunctionMetadataV14>;
|
||||
'Option<FunctionMetadataV9>': Option<FunctionMetadataV9>;
|
||||
'Option<FundIndex>': Option<FundIndex>;
|
||||
'Option<FundInfo>': Option<FundInfo>;
|
||||
@@ -539,6 +546,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<I64>': Option<I64>;
|
||||
'Option<i8>': Option<i8>;
|
||||
'Option<I8>': Option<I8>;
|
||||
'Option<Id>': Option<Id>;
|
||||
'Option<IdentificationTuple>': Option<IdentificationTuple>;
|
||||
'Option<IdentityFields>': Option<IdentityFields>;
|
||||
'Option<IdentityInfo>': Option<IdentityInfo>;
|
||||
@@ -580,6 +588,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<KeyValue>': Option<KeyValue>;
|
||||
'Option<KeyValueOption>': Option<KeyValueOption>;
|
||||
'Option<Kind>': Option<Kind>;
|
||||
'Option<LaneId>': Option<LaneId>;
|
||||
'Option<LastContribution>': Option<LastContribution>;
|
||||
'Option<LastRuntimeUpgradeInfo>': Option<LastRuntimeUpgradeInfo>;
|
||||
'Option<LeasePeriod>': Option<LeasePeriod>;
|
||||
@@ -597,6 +606,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<MembershipProof>': Option<MembershipProof>;
|
||||
'Option<MessageId>': Option<MessageId>;
|
||||
'Option<MessageIngestionType>': Option<MessageIngestionType>;
|
||||
'Option<MessageKey>': Option<MessageKey>;
|
||||
'Option<MessageNonce>': Option<MessageNonce>;
|
||||
'Option<MessageQueueChain>': Option<MessageQueueChain>;
|
||||
'Option<MessagingStateSnapshot>': Option<MessagingStateSnapshot>;
|
||||
'Option<MessagingStateSnapshotEgressEntry>': Option<MessagingStateSnapshotEgressEntry>;
|
||||
@@ -871,6 +882,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<SignedExtensionMetadataV14>': Option<SignedExtensionMetadataV14>;
|
||||
'Option<SignedSubmission>': Option<SignedSubmission>;
|
||||
'Option<SignedSubmissionOf>': Option<SignedSubmissionOf>;
|
||||
'Option<SignedSubmissionTo276>': Option<SignedSubmissionTo276>;
|
||||
'Option<SignerPayload>': Option<SignerPayload>;
|
||||
'Option<SigningContext>': Option<SigningContext>;
|
||||
'Option<SiLookupTypeId>': Option<SiLookupTypeId>;
|
||||
@@ -1193,6 +1205,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<CandidateInfo>': Vec<CandidateInfo>;
|
||||
'Vec<CandidatePendingAvailability>': Vec<CandidatePendingAvailability>;
|
||||
'Vec<CandidateReceipt>': Vec<CandidateReceipt>;
|
||||
'Vec<ChainId>': Vec<ChainId>;
|
||||
'Vec<ChainProperties>': Vec<ChainProperties>;
|
||||
'Vec<ChainType>': Vec<ChainType>;
|
||||
'Vec<ChangesTrieConfiguration>': Vec<ChangesTrieConfiguration>;
|
||||
@@ -1299,6 +1312,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<EncodedFinalityProofs>': Vec<EncodedFinalityProofs>;
|
||||
'Vec<EncodedJustification>': Vec<EncodedJustification>;
|
||||
'Vec<EpochAuthorship>': Vec<EpochAuthorship>;
|
||||
'Vec<Era>': Vec<Era>;
|
||||
'Vec<EraIndex>': Vec<EraIndex>;
|
||||
'Vec<EraPoints>': Vec<EraPoints>;
|
||||
'Vec<EraRewardPoints>': Vec<EraRewardPoints>;
|
||||
@@ -1308,6 +1322,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<ErrorMetadataV11>': Vec<ErrorMetadataV11>;
|
||||
'Vec<ErrorMetadataV12>': Vec<ErrorMetadataV12>;
|
||||
'Vec<ErrorMetadataV13>': Vec<ErrorMetadataV13>;
|
||||
'Vec<ErrorMetadataV14>': Vec<ErrorMetadataV14>;
|
||||
'Vec<ErrorMetadataV9>': Vec<ErrorMetadataV9>;
|
||||
'Vec<EthAccount>': Vec<EthAccount>;
|
||||
'Vec<EthBlock>': Vec<EthBlock>;
|
||||
@@ -1349,6 +1364,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<EventMetadataV11>': Vec<EventMetadataV11>;
|
||||
'Vec<EventMetadataV12>': Vec<EventMetadataV12>;
|
||||
'Vec<EventMetadataV13>': Vec<EventMetadataV13>;
|
||||
'Vec<EventMetadataV14>': Vec<EventMetadataV14>;
|
||||
'Vec<EventMetadataV9>': Vec<EventMetadataV9>;
|
||||
'Vec<EventRecord>': Vec<EventRecord>;
|
||||
'Vec<EvmAccount>': Vec<EvmAccount>;
|
||||
@@ -1396,12 +1412,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<FunctionArgumentMetadataV11>': Vec<FunctionArgumentMetadataV11>;
|
||||
'Vec<FunctionArgumentMetadataV12>': Vec<FunctionArgumentMetadataV12>;
|
||||
'Vec<FunctionArgumentMetadataV13>': Vec<FunctionArgumentMetadataV13>;
|
||||
'Vec<FunctionArgumentMetadataV14>': Vec<FunctionArgumentMetadataV14>;
|
||||
'Vec<FunctionArgumentMetadataV9>': Vec<FunctionArgumentMetadataV9>;
|
||||
'Vec<FunctionMetadataLatest>': Vec<FunctionMetadataLatest>;
|
||||
'Vec<FunctionMetadataV10>': Vec<FunctionMetadataV10>;
|
||||
'Vec<FunctionMetadataV11>': Vec<FunctionMetadataV11>;
|
||||
'Vec<FunctionMetadataV12>': Vec<FunctionMetadataV12>;
|
||||
'Vec<FunctionMetadataV13>': Vec<FunctionMetadataV13>;
|
||||
'Vec<FunctionMetadataV14>': Vec<FunctionMetadataV14>;
|
||||
'Vec<FunctionMetadataV9>': Vec<FunctionMetadataV9>;
|
||||
'Vec<FundIndex>': Vec<FundIndex>;
|
||||
'Vec<FundInfo>': Vec<FundInfo>;
|
||||
@@ -1452,6 +1470,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<I64>': Vec<I64>;
|
||||
'Vec<i8>': Vec<i8>;
|
||||
'Vec<I8>': Vec<I8>;
|
||||
'Vec<Id>': Vec<Id>;
|
||||
'Vec<IdentificationTuple>': Vec<IdentificationTuple>;
|
||||
'Vec<IdentityFields>': Vec<IdentityFields>;
|
||||
'Vec<IdentityInfo>': Vec<IdentityInfo>;
|
||||
@@ -1493,6 +1512,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<KeyValue>': Vec<KeyValue>;
|
||||
'Vec<KeyValueOption>': Vec<KeyValueOption>;
|
||||
'Vec<Kind>': Vec<Kind>;
|
||||
'Vec<LaneId>': Vec<LaneId>;
|
||||
'Vec<LastContribution>': Vec<LastContribution>;
|
||||
'Vec<LastRuntimeUpgradeInfo>': Vec<LastRuntimeUpgradeInfo>;
|
||||
'Vec<LeasePeriod>': Vec<LeasePeriod>;
|
||||
@@ -1510,6 +1530,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<MembershipProof>': Vec<MembershipProof>;
|
||||
'Vec<MessageId>': Vec<MessageId>;
|
||||
'Vec<MessageIngestionType>': Vec<MessageIngestionType>;
|
||||
'Vec<MessageKey>': Vec<MessageKey>;
|
||||
'Vec<MessageNonce>': Vec<MessageNonce>;
|
||||
'Vec<MessageQueueChain>': Vec<MessageQueueChain>;
|
||||
'Vec<MessagingStateSnapshot>': Vec<MessagingStateSnapshot>;
|
||||
'Vec<MessagingStateSnapshotEgressEntry>': Vec<MessagingStateSnapshotEgressEntry>;
|
||||
@@ -1784,6 +1806,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<SignedExtensionMetadataV14>': Vec<SignedExtensionMetadataV14>;
|
||||
'Vec<SignedSubmission>': Vec<SignedSubmission>;
|
||||
'Vec<SignedSubmissionOf>': Vec<SignedSubmissionOf>;
|
||||
'Vec<SignedSubmissionTo276>': Vec<SignedSubmissionTo276>;
|
||||
'Vec<SignerPayload>': Vec<SignerPayload>;
|
||||
'Vec<SigningContext>': Vec<SigningContext>;
|
||||
'Vec<SiLookupTypeId>': Vec<SiLookupTypeId>;
|
||||
@@ -2106,6 +2129,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
CandidateInfo: CandidateInfo;
|
||||
CandidatePendingAvailability: CandidatePendingAvailability;
|
||||
CandidateReceipt: CandidateReceipt;
|
||||
ChainId: ChainId;
|
||||
ChainProperties: ChainProperties;
|
||||
ChainType: ChainType;
|
||||
ChangesTrieConfiguration: ChangesTrieConfiguration;
|
||||
@@ -2212,6 +2236,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
EncodedFinalityProofs: EncodedFinalityProofs;
|
||||
EncodedJustification: EncodedJustification;
|
||||
EpochAuthorship: EpochAuthorship;
|
||||
Era: Era;
|
||||
EraIndex: EraIndex;
|
||||
EraPoints: EraPoints;
|
||||
EraRewardPoints: EraRewardPoints;
|
||||
@@ -2221,6 +2246,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
ErrorMetadataV11: ErrorMetadataV11;
|
||||
ErrorMetadataV12: ErrorMetadataV12;
|
||||
ErrorMetadataV13: ErrorMetadataV13;
|
||||
ErrorMetadataV14: ErrorMetadataV14;
|
||||
ErrorMetadataV9: ErrorMetadataV9;
|
||||
EthAccount: EthAccount;
|
||||
EthBlock: EthBlock;
|
||||
@@ -2262,6 +2288,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
EventMetadataV11: EventMetadataV11;
|
||||
EventMetadataV12: EventMetadataV12;
|
||||
EventMetadataV13: EventMetadataV13;
|
||||
EventMetadataV14: EventMetadataV14;
|
||||
EventMetadataV9: EventMetadataV9;
|
||||
EventRecord: EventRecord;
|
||||
EvmAccount: EvmAccount;
|
||||
@@ -2309,12 +2336,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
FunctionArgumentMetadataV11: FunctionArgumentMetadataV11;
|
||||
FunctionArgumentMetadataV12: FunctionArgumentMetadataV12;
|
||||
FunctionArgumentMetadataV13: FunctionArgumentMetadataV13;
|
||||
FunctionArgumentMetadataV14: FunctionArgumentMetadataV14;
|
||||
FunctionArgumentMetadataV9: FunctionArgumentMetadataV9;
|
||||
FunctionMetadataLatest: FunctionMetadataLatest;
|
||||
FunctionMetadataV10: FunctionMetadataV10;
|
||||
FunctionMetadataV11: FunctionMetadataV11;
|
||||
FunctionMetadataV12: FunctionMetadataV12;
|
||||
FunctionMetadataV13: FunctionMetadataV13;
|
||||
FunctionMetadataV14: FunctionMetadataV14;
|
||||
FunctionMetadataV9: FunctionMetadataV9;
|
||||
FundIndex: FundIndex;
|
||||
FundInfo: FundInfo;
|
||||
@@ -2365,6 +2394,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
I64: I64;
|
||||
i8: i8;
|
||||
I8: I8;
|
||||
Id: Id;
|
||||
IdentificationTuple: IdentificationTuple;
|
||||
IdentityFields: IdentityFields;
|
||||
IdentityInfo: IdentityInfo;
|
||||
@@ -2406,6 +2436,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
KeyValue: KeyValue;
|
||||
KeyValueOption: KeyValueOption;
|
||||
Kind: Kind;
|
||||
LaneId: LaneId;
|
||||
LastContribution: LastContribution;
|
||||
LastRuntimeUpgradeInfo: LastRuntimeUpgradeInfo;
|
||||
LeasePeriod: LeasePeriod;
|
||||
@@ -2423,6 +2454,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
MembershipProof: MembershipProof;
|
||||
MessageId: MessageId;
|
||||
MessageIngestionType: MessageIngestionType;
|
||||
MessageKey: MessageKey;
|
||||
MessageNonce: MessageNonce;
|
||||
MessageQueueChain: MessageQueueChain;
|
||||
MessagingStateSnapshot: MessagingStateSnapshot;
|
||||
MessagingStateSnapshotEgressEntry: MessagingStateSnapshotEgressEntry;
|
||||
@@ -2697,6 +2730,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
SignedExtensionMetadataV14: SignedExtensionMetadataV14;
|
||||
SignedSubmission: SignedSubmission;
|
||||
SignedSubmissionOf: SignedSubmissionOf;
|
||||
SignedSubmissionTo276: SignedSubmissionTo276;
|
||||
SignerPayload: SignerPayload;
|
||||
SigningContext: SigningContext;
|
||||
SiLookupTypeId: SiLookupTypeId;
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { AnyJson, Codec, Registry } from '../types';
|
||||
|
||||
import { compactToU8a, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { compareArray } from './utils';
|
||||
import { compareArray } from './utils/compareArray';
|
||||
|
||||
/**
|
||||
* @name AbstractArray
|
||||
|
||||
@@ -18,7 +18,7 @@ export class DoNotConstruct implements Codec {
|
||||
|
||||
constructor (registry: Registry, typeName = 'DoNotConstruct') {
|
||||
this.registry = registry;
|
||||
this.#neverError = new Error(`Cannot construct unknown type ${typeName}`);
|
||||
this.#neverError = new Error(`DoNotConstruct: Cannot construct unknown type ${typeName}`);
|
||||
|
||||
throw this.#neverError;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ export class Enum implements Codec {
|
||||
} else if (this.#isBasic && isString(other)) {
|
||||
return this.type === other;
|
||||
} else if (isU8a(other)) {
|
||||
return !this.toU8a().some((entry, index): boolean => entry !== other[index]);
|
||||
return !this.toU8a().some((entry, index) => entry !== other[index]);
|
||||
} else if (isHex(other)) {
|
||||
return this.toHex() === other;
|
||||
} else if (other instanceof Enum) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { CodecTo } from '../types';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import rpcMetadata from '../metadata/static';
|
||||
import rpcMetadata from '../metadata/static-substrate';
|
||||
import { Text, U32, u128 as U128 } from '../primitive';
|
||||
import { Tuple } from '.';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
import { createTypeUnsafe, TypeRegistry } from '../create';
|
||||
import { GenericAccountId as AccountId } from '../generic';
|
||||
import { Metadata } from '../metadata';
|
||||
import rpcMetadata from '../metadata/static';
|
||||
import rpcMetadata from '../metadata/static-substrate';
|
||||
import { Text } from '../primitive';
|
||||
import { Tuple, Vec } from '.';
|
||||
|
||||
|
||||
@@ -1,58 +1,71 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Codec } from '../../types';
|
||||
import type { Enum } from '../Enum';
|
||||
|
||||
import { AbstractArray } from '../AbstractArray';
|
||||
import { AbstractInt } from '../AbstractInt';
|
||||
import { Enum, Struct } from '..';
|
||||
import { bnToBn, isBigInt, isBn, isFunction, isNumber, stringify } from '@polkadot/util';
|
||||
|
||||
type SortArg = Codec | Codec[] | number[] | number | Uint8Array
|
||||
type SortArg = Codec | Codec[] | number[] | BN | bigint | number | Uint8Array;
|
||||
|
||||
/** @internal **/
|
||||
function isArrayLike (arg: SortArg): arg is AbstractArray<Codec> | Uint8Array | Codec[] | number[] {
|
||||
return arg instanceof AbstractArray || arg instanceof Uint8Array || Array.isArray(arg);
|
||||
function isArrayLike (arg: SortArg): arg is Uint8Array | Codec[] | number[] {
|
||||
return arg instanceof Uint8Array || Array.isArray(arg);
|
||||
}
|
||||
|
||||
/** @internal **/
|
||||
function isCodec (arg: SortArg): arg is Codec {
|
||||
return !!(arg && typeof (arg as Codec).toU8a === 'function');
|
||||
return isFunction(arg && (arg as Codec).toU8a);
|
||||
}
|
||||
|
||||
/** @internal **/
|
||||
function isEnum (arg: SortArg): arg is Enum {
|
||||
return isCodec(arg) && isNumber((arg as Enum).index) && isCodec((arg as Enum).value);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function isNumberLike (arg: SortArg): arg is BN | bigint | number {
|
||||
return isNumber(arg) || isBn(arg) || isBigInt(arg);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function sortArray (a: Uint8Array | Codec[] | number[], b: Uint8Array | Codec[] | number[]): number {
|
||||
// Vec, Tuple, Bytes etc.
|
||||
let sortRes = 0;
|
||||
const minLen = Math.min(a.length, b.length);
|
||||
|
||||
for (let i = 0; i < minLen; ++i) {
|
||||
sortRes = sortAsc(a[i], b[i]);
|
||||
|
||||
if (sortRes !== 0) {
|
||||
return sortRes;
|
||||
}
|
||||
}
|
||||
|
||||
return a.length - b.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort keys/values of BTreeSet/BTreeMap in acending order for encoding compatibility with Rust's BTreeSet/BTreeMap
|
||||
* Sort keys/values of BTreeSet/BTreeMap in ascending order for encoding compatibility with Rust's BTreeSet/BTreeMap
|
||||
* (https://doc.rust-lang.org/stable/std/collections/struct.BTreeSet.html)
|
||||
* (https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html)
|
||||
*/
|
||||
export function sortAsc<V extends SortArg = Codec> (a: V, b: V): number {
|
||||
if (typeof a === 'number' && typeof b === 'number') {
|
||||
return a - b;
|
||||
} else if (a instanceof Struct && b instanceof Struct) {
|
||||
if (isNumberLike(a) && isNumberLike(b)) {
|
||||
return bnToBn(a).cmp(bnToBn(b));
|
||||
} else if (a instanceof Map && b instanceof Map) {
|
||||
return sortAsc(Array.from(a.values()), Array.from(b.values()));
|
||||
} else if (a instanceof Enum && b instanceof Enum) {
|
||||
} else if (isEnum(a) && isEnum(b)) {
|
||||
return sortAsc(a.index, b.index) || sortAsc(a.value, b.value);
|
||||
} else if (isArrayLike(a) && isArrayLike(b)) {
|
||||
// Vec, Tuple, Bytes etc.
|
||||
let sortRes = 0; const lenA = a.length; const lenB = b.length;
|
||||
const minLen = Math.min(lenA, lenB);
|
||||
|
||||
for (let i = 0; i < minLen; ++i) {
|
||||
sortRes = sortAsc(a[i], b[i]);
|
||||
|
||||
if (sortRes !== 0) {
|
||||
return sortRes;
|
||||
}
|
||||
}
|
||||
|
||||
return lenA - lenB;
|
||||
} else if (a instanceof AbstractInt && b instanceof AbstractInt) {
|
||||
return a.cmp(b);
|
||||
return sortArray(a, b);
|
||||
} else if (isCodec(a) && isCodec(b)) {
|
||||
// Text, Bool etc.
|
||||
return sortAsc(a.toU8a(true), b.toU8a(true));
|
||||
} else {
|
||||
throw new Error(`Attempting to sort unrecognized value: ${JSON.stringify(a)}`);
|
||||
}
|
||||
|
||||
throw new Error(`Attempting to sort unrecognized values: ${stringify(a)} (typeof ${typeof a}) <-> ${stringify(b)} (typeof ${typeof b})`);
|
||||
}
|
||||
|
||||
export function sortSet<V extends Codec = Codec> (set: Set<V>): Set<V> {
|
||||
|
||||
@@ -78,7 +78,7 @@ function encodeStruct (registry: Registry, typeDef: TypeDef): string {
|
||||
return encodeSubTypes(registry, typeDef.sub, false, {
|
||||
...(
|
||||
typeDef.alias
|
||||
? { alias: [...typeDef.alias.entries()].reduce<Record<string, string>>((all, [k, v]) => ({
|
||||
? { _alias: [...typeDef.alias.entries()].reduce<Record<string, string>>((all, [k, v]) => ({
|
||||
...all,
|
||||
[k]: v
|
||||
}), {}) }
|
||||
@@ -153,12 +153,14 @@ const encoders: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef) => st
|
||||
encodeVecFixed(registry, typeDef)
|
||||
};
|
||||
|
||||
function encodeType (registry: Registry, typeDef: TypeDef): string {
|
||||
function encodeType (registry: Registry, typeDef: TypeDef, withLookup = true): string {
|
||||
const encoder = encoders[typeDef.info];
|
||||
|
||||
assert(encoder, () => `Cannot encode type ${stringify(typeDef)}`);
|
||||
|
||||
return typeDef.lookupName || encoder(registry, typeDef);
|
||||
return withLookup && typeDef.lookupName
|
||||
? typeDef.lookupName
|
||||
: encoder(registry, typeDef);
|
||||
}
|
||||
|
||||
export function encodeTypeDef (registry: Registry, typeDef: TypeDef): string {
|
||||
@@ -175,13 +177,8 @@ export function encodeTypeDef (registry: Registry, typeDef: TypeDef): string {
|
||||
}
|
||||
|
||||
export function withTypeString (registry: Registry, typeDef: Omit<TypeDef, 'type'>): TypeDef {
|
||||
const partial = { ...typeDef } as TypeDef;
|
||||
|
||||
// for the outer-most type, we ignore the lookupName
|
||||
delete partial.lookupName;
|
||||
|
||||
return {
|
||||
...typeDef,
|
||||
type: encodeType(registry, partial)
|
||||
type: encodeType(registry, typeDef as TypeDef, false)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,11 +31,13 @@ function injectErrors (_: Registry, metadata: Metadata, metadataErrors: Record<s
|
||||
const modules = metadata.asLatest.modules;
|
||||
|
||||
// decorate the errors
|
||||
modules.forEach((section, _sectionIndex): void => {
|
||||
const sectionIndex = metadata.version >= 12 ? section.index.toNumber() : _sectionIndex;
|
||||
const sectionName = stringCamelCase(section.name);
|
||||
modules.forEach(({ errors, index, name }, _sectionIndex): void => {
|
||||
const sectionIndex = metadata.version >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const sectionName = stringCamelCase(name);
|
||||
|
||||
section.errors.forEach(({ docs, name }, index): void => {
|
||||
errors.forEach(({ docs, name }, index): void => {
|
||||
const eventIndex = new Uint8Array([sectionIndex, index]);
|
||||
|
||||
metadataErrors[u8aToHex(eventIndex)] = {
|
||||
@@ -54,13 +56,13 @@ function injectEvents (registry: Registry, metadata: Metadata, metadataEvents: R
|
||||
// decorate the events
|
||||
metadata.asLatest.modules
|
||||
.filter(({ events }) => events.isSome)
|
||||
.forEach((section, _sectionIndex): void => {
|
||||
.forEach(({ events, index, name }, _sectionIndex): void => {
|
||||
const sectionIndex = metadata.version >= 12
|
||||
? section.index.toNumber()
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const sectionName = stringCamelCase(section.name);
|
||||
const sectionName = stringCamelCase(name);
|
||||
|
||||
section.events.unwrap().forEach((meta, methodIndex): void => {
|
||||
events.unwrap().forEach((meta, methodIndex): void => {
|
||||
const methodName = meta.name.toString();
|
||||
const typeDef = meta.args.map((arg) => getTypeDef(arg));
|
||||
let Types: Constructor<Codec>[] | null = null;
|
||||
|
||||
@@ -42,6 +42,7 @@ export interface TypeDef {
|
||||
length?: number;
|
||||
lookupIndex?: number;
|
||||
lookupName?: string;
|
||||
lookupNameRoot?: string;
|
||||
name?: string;
|
||||
namespace?: string;
|
||||
sub?: TypeDef | TypeDef[];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import rpcMetadata from '../metadata/static';
|
||||
import rpcMetadata from '../metadata/static-substrate';
|
||||
import { GenericExtrinsic as Extrinsic } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import rpcMetadata from '../metadata/static';
|
||||
import rpcMetadata from '../metadata/static-substrate';
|
||||
import { GenericSignerPayload as SignerPayload } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BN } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { decorateExtrinsics, Metadata } from '../../metadata';
|
||||
import rpcMetadata from '../../metadata/static';
|
||||
import rpcMetadata from '../../metadata/static-substrate';
|
||||
import { GenericExtrinsicV4 as Extrinsic } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BN_ZERO } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { Metadata } from '../../metadata';
|
||||
import metadataStatic from '../../metadata/static';
|
||||
import metadataStatic from '../../metadata/static-substrate';
|
||||
import { GenericExtrinsicSignatureV4 as ExtrinsicSignature } from '.';
|
||||
|
||||
const signOptions = {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { TypeRegistry } from '../create';
|
||||
import block00300 from '../json/SignedBlock.003.00.json';
|
||||
import { Metadata } from '../metadata';
|
||||
import metadataStatic from '../metadata/static';
|
||||
import metadataStatic from '../metadata/static-substrate';
|
||||
import { GenericBlock as Block } from './Block';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import metadataStatic from '../metadata/static';
|
||||
import metadataStatic from '../metadata/static-substrate';
|
||||
import { GenericCall as Call } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
import type { Vec } from '../codec/Vec';
|
||||
import type { PortableType } from '../interfaces/metadata';
|
||||
import type { SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '../interfaces/scaleInfo';
|
||||
import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDefArray, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '../interfaces/scaleInfo';
|
||||
import type { Text } from '../primitive/Text';
|
||||
import type { Type } from '../primitive/Type';
|
||||
import type { Registry, TypeDef } from '../types';
|
||||
|
||||
@@ -20,61 +21,129 @@ const PRIMITIVE_ALIAS: Record<string, string> = {
|
||||
Str: 'Text'
|
||||
};
|
||||
|
||||
// ink! specific overrides
|
||||
const PRIMITIVE_INK = ['AccountId', 'AccountIndex', 'Address', 'Balance'];
|
||||
|
||||
// These are types where we have a specific decoding/encoding override + helpers
|
||||
const PRIMITIVE_SP = [
|
||||
const PRIMITIVE_PATHS = [
|
||||
// match {node, polkadot, ...}_runtime
|
||||
'*_runtime::Call',
|
||||
'*_runtime::Event',
|
||||
// these have a specific encoding or logic (for pallets)
|
||||
'pallet_democracy::vote::Vote',
|
||||
'pallet_identity::types::Data',
|
||||
// these are well-known types with additional encoding
|
||||
'sp_core::crypto::AccountId32',
|
||||
'sp_runtime::generic::era::Era',
|
||||
'sp_runtime::multiaddress::MultiAddress',
|
||||
'pallet_democracy::vote::Vote',
|
||||
'pallet_identity::types::Data',
|
||||
'primitive_types::H160',
|
||||
'primitive_types::H256',
|
||||
'primitive_types::H512'
|
||||
];
|
||||
// shorten some well-known types
|
||||
'primitive_types::*',
|
||||
'sp_arithmetic::per_things::*',
|
||||
// ink!
|
||||
'ink_env::types::*'
|
||||
].map((p) => p.split('::'));
|
||||
|
||||
// Mappings for types that should be converted to set via BitVec
|
||||
const SETS = [
|
||||
'pallet_identity::types::BitFlags'
|
||||
].map((p) => p.split('::'));
|
||||
|
||||
// These we never use these as top-level names, they are wrappers
|
||||
const WRAPPERS = ['Box', 'BTreeMap', 'Cow', 'Result', 'Option'];
|
||||
const WRAPPERS = ['BoundedBTreeMap', 'BoundedVec', 'Box', 'BTreeMap', 'Cow', 'Result', 'Option', 'WeakBoundedVec'];
|
||||
|
||||
// These are reserved and conflicts with built-in Codec definitions
|
||||
const RESERVED = ['entries', 'hash', 'keys', 'size'];
|
||||
// These are reserved and/or conflicts with built-in Codec definitions
|
||||
const RESERVED = ['call', 'entries', 'hash', 'keys', 'new', 'size'];
|
||||
|
||||
function removeDuplicateNames (names: (string | null)[]): (string | null)[] {
|
||||
return names.map((name, index): string | null =>
|
||||
!name || names.some((o, i) => index !== i && name === o)
|
||||
? null
|
||||
: name
|
||||
);
|
||||
function matchParts (first: string[], second: (string | Text)[]): boolean {
|
||||
return first.length === second.length && first.every((a, index) => {
|
||||
const b = second[index].toString();
|
||||
|
||||
return (a === '*') || (a === b) || (
|
||||
a.includes('*') &&
|
||||
a.includes('_') &&
|
||||
b.includes('_') &&
|
||||
matchParts(a.split('_'), b.split('_'))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function extractNames (types: PortableType[]): Record<number, string> {
|
||||
return removeDuplicateNames(
|
||||
types.map(({ type: { path } }): string | null => {
|
||||
if (!path.length) {
|
||||
return null;
|
||||
}
|
||||
// check if the path matches the PRIMITIVE_SP (with wildcards)
|
||||
function getPrimitivePath (path: SiPath): string | null {
|
||||
// TODO We need to handle ink! Balance in some way
|
||||
return path.length && PRIMITIVE_PATHS.some((p) => matchParts(p, path))
|
||||
? path[path.length - 1].toString()
|
||||
: null;
|
||||
}
|
||||
|
||||
const parts = path.map((p) => stringUpperFirst(stringCamelCase(p)));
|
||||
function removeDuplicateNames (names: [number, (string | null)][]): [number, (string | null)][] {
|
||||
return names.map(([lookupIndex, name]): [number, string | null] => [
|
||||
lookupIndex,
|
||||
(
|
||||
!name ||
|
||||
names.some(([oIndex, oName]) =>
|
||||
name === oName &&
|
||||
lookupIndex !== oIndex
|
||||
)
|
||||
)
|
||||
? null
|
||||
: name
|
||||
]);
|
||||
}
|
||||
|
||||
if (parts.length >= 2 && parts[parts.length - 1] === parts[parts.length - 2]) {
|
||||
parts.pop();
|
||||
}
|
||||
function extractName (types: PortableType[], id: SiLookupTypeId, { params, path }: SiType): [number, string | null] {
|
||||
const lookupIndex = id.toNumber();
|
||||
|
||||
const typeName = parts.join('');
|
||||
if (!path.length || WRAPPERS.includes(path[path.length - 1].toString())) {
|
||||
return [lookupIndex, null];
|
||||
}
|
||||
|
||||
return WRAPPERS.includes(typeName) || ['frame_support'].includes(path[0].toString())
|
||||
? null
|
||||
: typeName;
|
||||
})
|
||||
).reduce<Record<number, string>>((all, name, index) => {
|
||||
const parts = path
|
||||
.map((p) => stringUpperFirst(stringCamelCase(p)))
|
||||
.filter((p, index) =>
|
||||
(
|
||||
// Remove ::{pallet, traits, types}::
|
||||
index !== 1 ||
|
||||
!['Pallet', 'Traits', 'Types'].includes(p.toString())
|
||||
) &&
|
||||
(
|
||||
// sp_runtime::generic::digest::Digest -> sp_runtime::generic::Digest
|
||||
// sp_runtime::multiaddress::MultiAddress -> sp_runtime::MultiAddress
|
||||
index === path.length - 1 ||
|
||||
p.toLowerCase() !== path[index + 1].toLowerCase()
|
||||
)
|
||||
);
|
||||
let typeName = parts.join('');
|
||||
|
||||
if (parts.length === 2 && parts[parts.length - 1] === 'RawOrigin' && params.length === 2 && params[1].type.isSome) {
|
||||
// Do magic for RawOrigin lookup
|
||||
const instanceType = types[params[1].type.unwrap().toNumber()];
|
||||
|
||||
if (instanceType.type.path.length === 2) {
|
||||
typeName = `${typeName}${instanceType.type.path[1].toString()}`;
|
||||
}
|
||||
}
|
||||
|
||||
return [lookupIndex, typeName];
|
||||
}
|
||||
|
||||
function extractNames (registry: Registry, types: PortableType[]): Record<number, string> {
|
||||
const dedup = removeDuplicateNames(
|
||||
types.map(({ id, type }) =>
|
||||
extractName(types, id, type)
|
||||
)
|
||||
);
|
||||
const [names, typesNew] = dedup.reduce<[Record<number, string>, Record<string, string>]>(([names, types], [lookupIndex, name], index) => {
|
||||
if (name) {
|
||||
all[index] = name;
|
||||
// We set the name for this specific type
|
||||
names[index] = name;
|
||||
|
||||
// we map to the actual lookupIndex
|
||||
types[name] = registry.createLookupType(lookupIndex);
|
||||
}
|
||||
|
||||
return all;
|
||||
}, {});
|
||||
return [names, types];
|
||||
}, [{}, {}]);
|
||||
|
||||
registry.register(typesNew);
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
export class GenericPortableRegistry extends Struct {
|
||||
@@ -86,7 +155,7 @@ export class GenericPortableRegistry extends Struct {
|
||||
types: 'Vec<PortableType>'
|
||||
}, value);
|
||||
|
||||
this.#names = extractNames(this.types);
|
||||
this.#names = extractNames(registry, this.types);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,10 +193,18 @@ export class GenericPortableRegistry extends Struct {
|
||||
|
||||
const extracted = this.#extract(this.getSiType(lookupId), lookupIndex);
|
||||
|
||||
Object.keys(extracted).forEach((key): void => {
|
||||
// these are safe since we are looking through the keys as set
|
||||
this.#typeDefs[lookupIndex][key as 'info'] = extracted[key as 'info'];
|
||||
Object.keys(extracted).forEach((k): void => {
|
||||
if (k !== 'lookupName' || extracted[k]) {
|
||||
// these are safe since we are looking through the keys as set
|
||||
this.#typeDefs[lookupIndex][k as 'info'] = extracted[k as 'info'];
|
||||
}
|
||||
});
|
||||
|
||||
// don't set lookupName on lower-level, we want to always direct to the type
|
||||
if (extracted.info === TypeDefInfo.Plain) {
|
||||
this.#typeDefs[lookupIndex].lookupNameRoot = this.#typeDefs[lookupIndex].lookupName;
|
||||
delete this.#typeDefs[lookupIndex].lookupName;
|
||||
}
|
||||
}
|
||||
|
||||
return this.#typeDefs[lookupIndex];
|
||||
@@ -138,7 +215,7 @@ export class GenericPortableRegistry extends Struct {
|
||||
const lookupIndex = lookupId.toNumber();
|
||||
|
||||
// Setup for a lookup on complex types
|
||||
return [TypeDefInfo.Enum, TypeDefInfo.Struct].includes(typeDef.info)
|
||||
return [TypeDefInfo.Enum, TypeDefInfo.Struct].includes(typeDef.info) && typeDef.lookupName
|
||||
? {
|
||||
docs: typeDef.docs,
|
||||
info: TypeDefInfo.Si,
|
||||
@@ -163,22 +240,12 @@ export class GenericPortableRegistry extends Struct {
|
||||
|
||||
#extract (type: SiType, lookupIndex: number): TypeDef {
|
||||
const path = [...type.path];
|
||||
|
||||
// We handle ink! here as well, although we still have a different registry there
|
||||
const isPrimitivePath = !!path.length && (
|
||||
(
|
||||
path.length > 2 &&
|
||||
path[0].eq('ink_env') &&
|
||||
path[1].eq('types')
|
||||
) ||
|
||||
PRIMITIVE_INK.includes(path[path.length - 1].toString()) ||
|
||||
PRIMITIVE_SP.includes(path.join('::'))
|
||||
);
|
||||
let typeDef: TypeDef;
|
||||
const primType = getPrimitivePath(type.path);
|
||||
|
||||
try {
|
||||
if (isPrimitivePath) {
|
||||
typeDef = this.#extractPrimitivePath(lookupIndex, type);
|
||||
if (primType) {
|
||||
typeDef = this.#extractPrimitivePath(lookupIndex, primType);
|
||||
} else if (type.def.isArray) {
|
||||
typeDef = this.#extractArray(lookupIndex, type.def.asArray);
|
||||
} else if (type.def.isCompact) {
|
||||
@@ -199,7 +266,7 @@ export class GenericPortableRegistry extends Struct {
|
||||
throw new Error(`Invalid type at index ${lookupIndex}: No handler for ${type.def.toString()}`);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error(`PortableRegistry: Error extracting ${stringify(type)}: ${(error as Error).message}`);
|
||||
throw new Error(`PortableRegistry: ${lookupIndex}: Error extracting ${stringify(type)}: ${(error as Error).message}`);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -209,8 +276,8 @@ export class GenericPortableRegistry extends Struct {
|
||||
};
|
||||
}
|
||||
|
||||
#extractArray (_: number, { len: length, type }: SiTypeDefArray): TypeDef {
|
||||
assert(!length || length.toNumber() <= 256, 'PortableRegistry: Only support for [Type; <length>], where length <= 256');
|
||||
#extractArray (lookupIndex: number, { len: length, type }: SiTypeDefArray): TypeDef {
|
||||
assert(!length || length.toNumber() <= 256, () => `PortableRegistry: ${lookupIndex}: Only support for [Type; <length>], where length <= 256`);
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.VecFixed,
|
||||
@@ -234,7 +301,25 @@ export class GenericPortableRegistry extends Struct {
|
||||
});
|
||||
}
|
||||
|
||||
return this.#extractFields(lookupIndex, fields);
|
||||
return SETS.some((p) => matchParts(p, path))
|
||||
? this.#extractCompositeSet(lookupIndex, params, fields)
|
||||
: this.#extractFields(lookupIndex, fields);
|
||||
}
|
||||
|
||||
#extractCompositeSet (lookupIndex: number, params: SiTypeParameter[], fields: SiField[]): TypeDef {
|
||||
assert(params.length === 1 && fields.length === 1, () => `PortableRegistry: ${lookupIndex}: Set handling expects since param and single field`);
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Set,
|
||||
length: this.registry.createType(this.registry.createLookupType(fields[0].type) as 'u32').bitLength(),
|
||||
sub: this.getSiType(params[0].type.unwrap()).def.asVariant.variants.map(({ index, name }): TypeDef => ({
|
||||
// This will be an issue > 2^53 - 1 ... don't have those (yet)
|
||||
index: index.toNumber(),
|
||||
info: TypeDefInfo.Plain,
|
||||
name: name.toString(),
|
||||
type: 'Null'
|
||||
}))
|
||||
});
|
||||
}
|
||||
|
||||
#extractFields (lookupIndex: number, fields: SiField[]): TypeDef {
|
||||
@@ -244,7 +329,7 @@ export class GenericPortableRegistry extends Struct {
|
||||
]),
|
||||
[true, true]);
|
||||
|
||||
assert(isTuple || isStruct, 'PortableRegistry: Invalid fields type detected, expected either Tuple or Struct');
|
||||
assert(isTuple || isStruct, () => `PortableRegistry: ${lookupIndex}: Invalid fields type detected, expected either Tuple (all unnamed) or Struct (all named)`);
|
||||
|
||||
if (fields.length === 0) {
|
||||
return {
|
||||
@@ -252,7 +337,20 @@ export class GenericPortableRegistry extends Struct {
|
||||
type: 'Null'
|
||||
};
|
||||
} else if (isTuple && fields.length === 1) {
|
||||
return this.#createSiDef(fields[0].type);
|
||||
const typeDef = this.#createSiDef(fields[0].type);
|
||||
|
||||
return {
|
||||
...typeDef,
|
||||
...(
|
||||
lookupIndex === -1
|
||||
? {}
|
||||
: {
|
||||
lookupIndex,
|
||||
lookupName: this.#names[lookupIndex],
|
||||
lookupNameRoot: typeDef.lookupName
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
const [sub, alias] = this.#extractFieldsAlias(fields);
|
||||
@@ -261,6 +359,11 @@ export class GenericPortableRegistry extends Struct {
|
||||
info: isTuple // Tuple check first
|
||||
? TypeDefInfo.Tuple
|
||||
: TypeDefInfo.Struct,
|
||||
...(
|
||||
alias.size
|
||||
? { alias }
|
||||
: {}
|
||||
),
|
||||
...(
|
||||
lookupIndex === -1
|
||||
? {}
|
||||
@@ -269,11 +372,6 @@ export class GenericPortableRegistry extends Struct {
|
||||
lookupName: this.#names[lookupIndex]
|
||||
}
|
||||
),
|
||||
...(
|
||||
alias.size
|
||||
? { alias }
|
||||
: {}
|
||||
),
|
||||
sub
|
||||
});
|
||||
}
|
||||
@@ -329,19 +427,23 @@ export class GenericPortableRegistry extends Struct {
|
||||
};
|
||||
}
|
||||
|
||||
#extractPrimitivePath (_: number, type: SiType): TypeDef {
|
||||
const displayName = type.path[type.path.length - 1].toString();
|
||||
|
||||
#extractPrimitivePath (_: number, type: string): TypeDef {
|
||||
return {
|
||||
displayName,
|
||||
info: TypeDefInfo.Plain,
|
||||
type: displayName
|
||||
type
|
||||
};
|
||||
}
|
||||
|
||||
#extractSequence (lookupIndex: number, { type }: SiTypeDefSequence): TypeDef {
|
||||
const sub = this.#createSiDef(type);
|
||||
|
||||
if (sub.type === 'u8') {
|
||||
return {
|
||||
info: TypeDefInfo.Plain,
|
||||
type: 'Bytes'
|
||||
};
|
||||
}
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Vec,
|
||||
lookupIndex,
|
||||
@@ -400,7 +502,8 @@ export class GenericPortableRegistry extends Struct {
|
||||
const sub: (TypeDef & { name: string })[] = [];
|
||||
|
||||
// we may get entries out of order, arrange them first before creating with gaps filled
|
||||
variants
|
||||
// NOTE: Since we mutate, use a copy of the array as an input
|
||||
[...variants]
|
||||
.sort((a, b) => a.index.cmp(b.index))
|
||||
.forEach(({ fields, index, name }) => {
|
||||
const desired = index.toNumber();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { Codec } from './types';
|
||||
|
||||
import * as definitions from './interfaces/definitions';
|
||||
import metadataStatic from './metadata/static';
|
||||
import metadataStatic from './metadata/static-substrate';
|
||||
import { createTypeUnsafe, TypeRegistry } from './create';
|
||||
import * as exported from './index.types';
|
||||
import { Metadata } from './metadata';
|
||||
|
||||
@@ -17,6 +17,16 @@ export default {
|
||||
authorityList: 'AuthorityList',
|
||||
setId: 'SetId',
|
||||
isHalted: 'bool'
|
||||
},
|
||||
Id: '[u8; 4]',
|
||||
ChainId: 'Id',
|
||||
LaneId: 'Id',
|
||||
MessageNonce: 'u64',
|
||||
// Overrides what is in cumulus, however needed - needs an alias
|
||||
// MessageId: '(Id, u64)',
|
||||
MessageKey: {
|
||||
laneId: 'LaneId',
|
||||
nonce: 'MessageNonce'
|
||||
}
|
||||
}
|
||||
} as Definitions;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Struct, bool } from '@polkadot/types';
|
||||
import type { Struct, U8aFixed, bool, u64 } from '@polkadot/types';
|
||||
import type { AuthorityList, SetId } from '@polkadot/types/interfaces/grandpa';
|
||||
import type { BlockNumber, H256, Header } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
@@ -14,6 +14,12 @@ export interface BridgedBlockNumber extends BlockNumber {}
|
||||
/** @name BridgedHeader */
|
||||
export interface BridgedHeader extends Header {}
|
||||
|
||||
/** @name ChainId */
|
||||
export interface ChainId extends Id {}
|
||||
|
||||
/** @name Id */
|
||||
export interface Id extends U8aFixed {}
|
||||
|
||||
/** @name InitializationData */
|
||||
export interface InitializationData extends Struct {
|
||||
readonly header: Header;
|
||||
@@ -22,4 +28,16 @@ export interface InitializationData extends Struct {
|
||||
readonly isHalted: bool;
|
||||
}
|
||||
|
||||
/** @name LaneId */
|
||||
export interface LaneId extends Id {}
|
||||
|
||||
/** @name MessageKey */
|
||||
export interface MessageKey extends Struct {
|
||||
readonly laneId: LaneId;
|
||||
readonly nonce: MessageNonce;
|
||||
}
|
||||
|
||||
/** @name MessageNonce */
|
||||
export interface MessageNonce extends u64 {}
|
||||
|
||||
export type PHANTOM_BRIDGES = 'bridges';
|
||||
|
||||
@@ -20,6 +20,7 @@ export default {
|
||||
ExtrinsicPayloadUnknown: 'GenericExtrinsicPayloadUnknown',
|
||||
|
||||
// eras
|
||||
Era: 'ExtrinsicEra',
|
||||
ImmortalEra: 'GenericImmortalEra',
|
||||
MortalEra: 'GenericMortalEra',
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ export interface EcdsaSignature extends U8aFixed {}
|
||||
/** @name Ed25519Signature */
|
||||
export interface Ed25519Signature extends H512 {}
|
||||
|
||||
/** @name Era */
|
||||
export interface Era extends ExtrinsicEra {}
|
||||
|
||||
/** @name Extrinsic */
|
||||
export interface Extrinsic extends GenericExtrinsic {}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Bytes, Enum, GenericPortableRegistry, Option, Struct, Text, Type, Vec, bool, u8 } from '@polkadot/types';
|
||||
import type { SiLookupTypeId, SiType } from '@polkadot/types/interfaces/scaleInfo';
|
||||
import type { SiField, SiLookupTypeId, SiType } from '@polkadot/types/interfaces/scaleInfo';
|
||||
|
||||
/** @name ErrorMetadataLatest */
|
||||
export interface ErrorMetadataLatest extends ErrorMetadataV13 {}
|
||||
@@ -19,6 +19,15 @@ export interface ErrorMetadataV12 extends ErrorMetadataV11 {}
|
||||
/** @name ErrorMetadataV13 */
|
||||
export interface ErrorMetadataV13 extends ErrorMetadataV12 {}
|
||||
|
||||
/** @name ErrorMetadataV14 */
|
||||
export interface ErrorMetadataV14 extends Struct {
|
||||
readonly name: Text;
|
||||
readonly fields: Vec<SiField>;
|
||||
readonly index: u8;
|
||||
readonly docs: Vec<Text>;
|
||||
readonly args: Vec<Type>;
|
||||
}
|
||||
|
||||
/** @name ErrorMetadataV9 */
|
||||
export interface ErrorMetadataV9 extends Struct {
|
||||
readonly name: Text;
|
||||
@@ -40,6 +49,15 @@ export interface EventMetadataV12 extends EventMetadataV11 {}
|
||||
/** @name EventMetadataV13 */
|
||||
export interface EventMetadataV13 extends EventMetadataV12 {}
|
||||
|
||||
/** @name EventMetadataV14 */
|
||||
export interface EventMetadataV14 extends Struct {
|
||||
readonly name: Text;
|
||||
readonly fields: Vec<SiField>;
|
||||
readonly index: u8;
|
||||
readonly docs: Vec<Text>;
|
||||
readonly args: Vec<Type>;
|
||||
}
|
||||
|
||||
/** @name EventMetadataV9 */
|
||||
export interface EventMetadataV9 extends Struct {
|
||||
readonly name: Text;
|
||||
@@ -84,6 +102,9 @@ export interface FunctionArgumentMetadataV12 extends FunctionArgumentMetadataV11
|
||||
/** @name FunctionArgumentMetadataV13 */
|
||||
export interface FunctionArgumentMetadataV13 extends FunctionArgumentMetadataV12 {}
|
||||
|
||||
/** @name FunctionArgumentMetadataV14 */
|
||||
export interface FunctionArgumentMetadataV14 extends FunctionArgumentMetadataV13 {}
|
||||
|
||||
/** @name FunctionArgumentMetadataV9 */
|
||||
export interface FunctionArgumentMetadataV9 extends Struct {
|
||||
readonly name: Text;
|
||||
@@ -105,6 +126,15 @@ export interface FunctionMetadataV12 extends FunctionMetadataV11 {}
|
||||
/** @name FunctionMetadataV13 */
|
||||
export interface FunctionMetadataV13 extends FunctionMetadataV12 {}
|
||||
|
||||
/** @name FunctionMetadataV14 */
|
||||
export interface FunctionMetadataV14 extends Struct {
|
||||
readonly name: Text;
|
||||
readonly fields: Vec<SiField>;
|
||||
readonly index: u8;
|
||||
readonly docs: Vec<Text>;
|
||||
readonly args: Vec<FunctionArgumentMetadataLatest>;
|
||||
}
|
||||
|
||||
/** @name FunctionMetadataV9 */
|
||||
export interface FunctionMetadataV9 extends Struct {
|
||||
readonly name: Text;
|
||||
@@ -405,9 +435,20 @@ export interface StorageEntryTypeV10 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: Type;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: { hasher: StorageHasherV10; key: Type; value: Type; linked: bool; } & Struct;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV10;
|
||||
readonly key: Type;
|
||||
readonly value: Type;
|
||||
readonly linked: bool;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: { hasher: StorageHasherV10; key1: Type; key2: Type; value: Type; key2Hasher: StorageHasherV10; } & Struct;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV10;
|
||||
readonly key1: Type;
|
||||
readonly key2: Type;
|
||||
readonly value: Type;
|
||||
readonly key2Hasher: StorageHasherV10;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV11 */
|
||||
@@ -415,9 +456,20 @@ export interface StorageEntryTypeV11 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: Type;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: { hasher: StorageHasherV11; key: Type; value: Type; linked: bool; } & Struct;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV11;
|
||||
readonly key: Type;
|
||||
readonly value: Type;
|
||||
readonly linked: bool;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: { hasher: StorageHasherV11; key1: Type; key2: Type; value: Type; key2Hasher: StorageHasherV11; } & Struct;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV11;
|
||||
readonly key1: Type;
|
||||
readonly key2: Type;
|
||||
readonly value: Type;
|
||||
readonly key2Hasher: StorageHasherV11;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV12 */
|
||||
@@ -428,11 +480,26 @@ export interface StorageEntryTypeV13 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: Type;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: { hasher: StorageHasherV13; key: Type; value: Type; linked: bool; } & Struct;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV13;
|
||||
readonly key: Type;
|
||||
readonly value: Type;
|
||||
readonly linked: bool;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: { hasher: StorageHasherV13; key1: Type; key2: Type; value: Type; key2Hasher: StorageHasherV13; } & Struct;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV13;
|
||||
readonly key1: Type;
|
||||
readonly key2: Type;
|
||||
readonly value: Type;
|
||||
readonly key2Hasher: StorageHasherV13;
|
||||
} & Struct;
|
||||
readonly isNMap: boolean;
|
||||
readonly asNMap: { keyVec: Vec<Type>; hashers: Vec<StorageHasherV13>; value: Type; } & Struct;
|
||||
readonly asNMap: {
|
||||
readonly keyVec: Vec<Type>;
|
||||
readonly hashers: Vec<StorageHasherV13>;
|
||||
readonly value: Type;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV14 */
|
||||
@@ -440,11 +507,25 @@ export interface StorageEntryTypeV14 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: SiLookupTypeId;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: { hasher: StorageHasherV14; key: SiLookupTypeId; value: SiLookupTypeId; } & Struct;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV14;
|
||||
readonly key: SiLookupTypeId;
|
||||
readonly value: SiLookupTypeId;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: { hasher: StorageHasherV14; key1: SiLookupTypeId; key2: SiLookupTypeId; value: SiLookupTypeId; key2Hasher: StorageHasherV14; } & Struct;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV14;
|
||||
readonly key1: SiLookupTypeId;
|
||||
readonly key2: SiLookupTypeId;
|
||||
readonly value: SiLookupTypeId;
|
||||
readonly key2Hasher: StorageHasherV14;
|
||||
} & Struct;
|
||||
readonly isNMap: boolean;
|
||||
readonly asNMap: { key: SiLookupTypeId; hashers: Vec<StorageHasherV14>; value: SiLookupTypeId; } & Struct;
|
||||
readonly asNMap: {
|
||||
readonly key: SiLookupTypeId;
|
||||
readonly hashers: Vec<StorageHasherV14>;
|
||||
readonly value: SiLookupTypeId;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV9 */
|
||||
@@ -452,9 +533,20 @@ export interface StorageEntryTypeV9 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: Type;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: { hasher: StorageHasherV9; key: Type; value: Type; linked: bool; } & Struct;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV9;
|
||||
readonly key: Type;
|
||||
readonly value: Type;
|
||||
readonly linked: bool;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: { hasher: StorageHasherV9; key1: Type; key2: Type; value: Type; key2Hasher: StorageHasherV9; } & Struct;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV9;
|
||||
readonly key1: Type;
|
||||
readonly key2: Type;
|
||||
readonly value: Type;
|
||||
readonly key2Hasher: StorageHasherV9;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageHasher */
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
import type { DefinitionsTypes } from '../../types';
|
||||
|
||||
import { SiVariant } from '../scaleInfo/definitions';
|
||||
|
||||
export const v14: DefinitionsTypes = {
|
||||
// registry
|
||||
PortableRegistry: 'GenericPortableRegistry',
|
||||
@@ -14,6 +16,21 @@ export const v14: DefinitionsTypes = {
|
||||
type: 'SiType'
|
||||
},
|
||||
|
||||
// compatibility with earlier layouts, i.e. don't break previous users
|
||||
ErrorMetadataV14: {
|
||||
...SiVariant,
|
||||
args: 'Vec<Type>'
|
||||
},
|
||||
EventMetadataV14: {
|
||||
...SiVariant,
|
||||
args: 'Vec<Type>'
|
||||
},
|
||||
FunctionArgumentMetadataV14: 'FunctionArgumentMetadataV13',
|
||||
FunctionMetadataV14: {
|
||||
...SiVariant,
|
||||
args: 'Vec<FunctionArgumentMetadataLatest>'
|
||||
},
|
||||
|
||||
// V14
|
||||
ExtrinsicMetadataV14: {
|
||||
type: 'SiLookupTypeId',
|
||||
|
||||
@@ -8,6 +8,13 @@ import { v0 } from './v0';
|
||||
// order important in structs... :)
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
export const SiVariant = {
|
||||
name: 'Text',
|
||||
fields: 'Vec<SiField>',
|
||||
index: 'u8',
|
||||
docs: 'Vec<Text>'
|
||||
};
|
||||
|
||||
export default {
|
||||
rpc: {},
|
||||
types: {
|
||||
@@ -69,11 +76,6 @@ export default {
|
||||
name: 'Text',
|
||||
type: 'Option<SiLookupTypeId>'
|
||||
},
|
||||
SiVariant: {
|
||||
name: 'Text',
|
||||
fields: 'Vec<SiField>',
|
||||
index: 'u8',
|
||||
docs: 'Vec<Text>'
|
||||
}
|
||||
SiVariant
|
||||
}
|
||||
} as Definitions;
|
||||
|
||||
@@ -139,6 +139,13 @@ const phragmen = {
|
||||
deposit: 'Balance'
|
||||
},
|
||||
SignedSubmission: {
|
||||
_fallback: 'SignedSubmissionTo276',
|
||||
who: 'AccountId',
|
||||
deposit: 'Balance',
|
||||
solution: 'RawSolution',
|
||||
reward: 'Balance'
|
||||
},
|
||||
SignedSubmissionTo276: {
|
||||
who: 'AccountId',
|
||||
deposit: 'Balance',
|
||||
solution: 'RawSolution'
|
||||
|
||||
@@ -265,11 +265,19 @@ export interface SignedSubmission extends Struct {
|
||||
readonly who: AccountId;
|
||||
readonly deposit: Balance;
|
||||
readonly solution: RawSolution;
|
||||
readonly reward: Balance;
|
||||
}
|
||||
|
||||
/** @name SignedSubmissionOf */
|
||||
export interface SignedSubmissionOf extends SignedSubmission {}
|
||||
|
||||
/** @name SignedSubmissionTo276 */
|
||||
export interface SignedSubmissionTo276 extends Struct {
|
||||
readonly who: AccountId;
|
||||
readonly deposit: Balance;
|
||||
readonly solution: RawSolution;
|
||||
}
|
||||
|
||||
/** @name SlashingSpans */
|
||||
export interface SlashingSpans extends Struct {
|
||||
readonly spanIndex: SpanIndex;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TypeRegistry } from '../../create';
|
||||
import json1 from '../../json/EventRecord.001.json';
|
||||
import json3 from '../../json/EventRecord.003.json';
|
||||
import { Metadata } from '../../metadata';
|
||||
import rpcMetadata from '../../metadata/static';
|
||||
import rpcMetadata from '../../metadata/static-substrate';
|
||||
|
||||
describe('EventRecord', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from './Metadata';
|
||||
import substrateData from './static';
|
||||
import substrateData from './static-substrate';
|
||||
|
||||
describe('Metadata', (): void => {
|
||||
it('allows creation from hex with JSON equivalence', (): void => {
|
||||
|
||||
@@ -6,8 +6,8 @@ import type { Constants } from '../types';
|
||||
|
||||
import { TypeRegistry } from '../../../create';
|
||||
import { Metadata } from '../../Metadata';
|
||||
import rpcMetadata from '../../static';
|
||||
import rpcMetadataV10 from '../../v10/static';
|
||||
import rpcMetadata from '../../static-substrate';
|
||||
import rpcMetadataV10 from '../../v10/substrate-hex';
|
||||
import { decorateConstants } from '..';
|
||||
|
||||
function init (meta: string): [Constants, TypeRegistry] {
|
||||
|
||||
@@ -18,7 +18,9 @@ export function decorateErrors (_: Registry, { modules }: MetadataLatest, metaVe
|
||||
return result;
|
||||
}
|
||||
|
||||
const sectionIndex = metaVersion >= 12 ? index.toNumber() : _sectionIndex;
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
|
||||
result[stringCamelCase(name)] = errors.reduce((newModule: ModuleErrors, meta, errorIndex): ModuleErrors => {
|
||||
// we don't camelCase the error name
|
||||
|
||||
@@ -16,7 +16,9 @@ export function decorateEvents (_: Registry, { modules }: MetadataLatest, metaVe
|
||||
return modules
|
||||
.filter(({ events }) => events.isSome)
|
||||
.reduce((result: Events, { events, index, name }, _sectionIndex): Events => {
|
||||
const sectionIndex = metaVersion >= 12 ? index.toNumber() : _sectionIndex;
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
|
||||
result[stringCamelCase(name)] = events.unwrap().reduce((newModule: ModuleEvents, meta, eventIndex): ModuleEvents => {
|
||||
// we don't camelCase the event name
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BN } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../../create';
|
||||
import { Metadata } from '../../Metadata';
|
||||
import metadataStatic from '../../static';
|
||||
import metadataStatic from '../../static-substrate';
|
||||
import { decorateExtrinsics } from '..';
|
||||
|
||||
const keyring = createTestPairs({ type: 'ed25519' }, false);
|
||||
|
||||
@@ -14,7 +14,9 @@ export function decorateExtrinsics (registry: Registry, { modules }: MetadataLat
|
||||
return modules
|
||||
.filter(({ calls }) => calls.isSome)
|
||||
.reduce((result: Extrinsics, { calls, index, name }, _sectionIndex): Extrinsics => {
|
||||
const sectionIndex = metaVersion >= 12 ? index.toNumber() : _sectionIndex;
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const section = stringCamelCase(name);
|
||||
|
||||
result[section] = calls.unwrap().reduce((newModule: ModuleExtrinsics, callMetadata, methodIndex): ModuleExtrinsics => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { Metadata } from '../Metadata';
|
||||
import json from '../static';
|
||||
import json from '../static-substrate';
|
||||
import { decorateConstants, decorateExtrinsics, decorateStorage } from './';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../../create';
|
||||
import { Metadata } from '../../';
|
||||
import rpcMetadata from '../../static';
|
||||
import rpcMetadata from '../../static-substrate';
|
||||
import { decorateStorage } from '..';
|
||||
|
||||
const keyring = createTestPairs({ type: 'ed25519' });
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import metadata from './v13/static';
|
||||
import metadata from './v13/polkadot-hex';
|
||||
|
||||
export default metadata;
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import metadata from './v13/substrate-hex';
|
||||
|
||||
export default metadata;
|
||||
@@ -3,24 +3,26 @@
|
||||
|
||||
import type { Codec, Registry } from '../../types';
|
||||
import type { MetadataInterface } from '../types';
|
||||
import type { Check } from './types';
|
||||
|
||||
import { assert, hexToU8a, stringify, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { unwrapStorageType } from '../../primitive/StorageKey';
|
||||
import { Metadata } from '../Metadata';
|
||||
import { getUniqTypes } from './getUniqTypes';
|
||||
|
||||
/** @internal */
|
||||
export function decodeLatestSubstrate<Modules extends Codec> (registry: Registry, version: number, rpcData: string, staticSubstrate: Record<string, unknown>): void {
|
||||
it('decodes latest substrate properly', (): void => {
|
||||
const metadata = new Metadata(registry, rpcData);
|
||||
export function decodeLatestMeta<Modules extends Codec> (registry: Registry, version: number, { compare, data }: Check): void {
|
||||
it('decodes metadata properly', (): void => {
|
||||
const metadata = new Metadata(registry, data);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
|
||||
try {
|
||||
expect(metadata.version).toBe(version);
|
||||
expect((metadata[`asV${version}` as keyof Metadata] as unknown as MetadataInterface<Modules>).modules.length).not.toBe(0);
|
||||
expect(metadata.toJSON()).toEqual(staticSubstrate);
|
||||
expect(metadata.toJSON()).toEqual(compare);
|
||||
} catch (error) {
|
||||
console.error(stringify(metadata.toJSON()));
|
||||
|
||||
@@ -57,7 +59,7 @@ export function defaultValues (registry: Registry, rpcData: string, withThrow =
|
||||
const inner = unwrapStorageType(registry, type, modifier.isOptional);
|
||||
const location = `${mod.name.toString()}.${name.toString()}: ${inner}`;
|
||||
|
||||
it(`creates default types for ${location}`, (): void => {
|
||||
it(location, (): void => {
|
||||
expect((): void => {
|
||||
try {
|
||||
const type = registry.createType(inner, hexToU8a(fallback.toHex()));
|
||||
@@ -82,3 +84,18 @@ export function defaultValues (registry: Registry, rpcData: string, withThrow =
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function testMeta (version: number, matchers: Record<string, Check>, withFallback = true): void {
|
||||
describe(`MetadataV${version}`, (): void => {
|
||||
describe.each(Object.keys(matchers))('%s', (type): void => {
|
||||
const matcher = matchers[type];
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
decodeLatestMeta(registry, version, matcher);
|
||||
|
||||
toLatest(registry, version, matcher.data);
|
||||
|
||||
defaultValues(registry, matcher.data, true, withFallback);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { Metadata } from '../Metadata';
|
||||
import staticData from '../static';
|
||||
import staticData from '../static-substrate';
|
||||
|
||||
describe('toCallsOnly', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export interface Check {
|
||||
compare: Record<string, unknown>;
|
||||
data: string;
|
||||
types?: Record<string, unknown>;
|
||||
}
|
||||
@@ -1,17 +1,13 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { decodeLatestSubstrate, defaultValues, toLatest } from '../util/testUtil';
|
||||
import substrateData from './static';
|
||||
import substrateJson from './static-substrate.json';
|
||||
import { testMeta } from '../util/testUtil';
|
||||
import substrateData from './substrate-hex';
|
||||
import substrateJson from './substrate-json.json';
|
||||
|
||||
describe('MetadataV10 (substrate)', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
decodeLatestSubstrate(registry, 10, substrateData, substrateJson);
|
||||
|
||||
toLatest(registry, 10, substrateData);
|
||||
|
||||
defaultValues(registry, substrateData);
|
||||
});
|
||||
testMeta(10, {
|
||||
substrate: {
|
||||
compare: substrateJson as Record<string, unknown>,
|
||||
data: substrateData
|
||||
}
|
||||
}, false);
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { decodeLatestSubstrate, defaultValues, toLatest } from '../util/testUtil';
|
||||
import substrateData from './static';
|
||||
import substrateJson from './static-substrate.json';
|
||||
import { testMeta } from '../util/testUtil';
|
||||
import substrateData from './substrate-hex';
|
||||
import substrateJson from './substrate-json.json';
|
||||
|
||||
describe('MetadataV11 (substrate)', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
decodeLatestSubstrate(registry, 11, substrateData, substrateJson);
|
||||
|
||||
toLatest(registry, 11, substrateData);
|
||||
|
||||
defaultValues(registry, substrateData);
|
||||
});
|
||||
testMeta(11, {
|
||||
substrate: {
|
||||
compare: substrateJson as Record<string, unknown>,
|
||||
data: substrateData
|
||||
}
|
||||
}, false);
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { Registry } from '../../types';
|
||||
* @internal
|
||||
**/
|
||||
export function toV12 (registry: Registry, { extrinsic, modules }: MetadataV11): MetadataV12 {
|
||||
return registry.createType('MetadataLatest', {
|
||||
return registry.createType('MetadataV12', {
|
||||
extrinsic,
|
||||
modules: modules.map((mod): ModuleMetadataV12 =>
|
||||
registry.createType('ModuleMetadataV12', {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { decodeLatestSubstrate, defaultValues, toLatest } from '../util/testUtil';
|
||||
import substrateData from './static';
|
||||
import substrateJson from './static-substrate.json';
|
||||
import { testMeta } from '../util/testUtil';
|
||||
import substrateData from './substrate-hex';
|
||||
import substrateJson from './substrate-json.json';
|
||||
|
||||
describe('MetadataV12 (substrate)', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
decodeLatestSubstrate(registry, 12, substrateData, substrateJson);
|
||||
|
||||
toLatest(registry, 12, substrateData);
|
||||
|
||||
defaultValues(registry, substrateData, true, true);
|
||||
testMeta(12, {
|
||||
substrate: {
|
||||
compare: substrateJson as Record<string, unknown>,
|
||||
data: substrateData
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { decodeLatestSubstrate, defaultValues, toLatest } from '../util/testUtil';
|
||||
import substrateData from './static';
|
||||
import substrateJson from './static-substrate.json';
|
||||
import { testMeta } from '../util/testUtil';
|
||||
import polkadotData from './polkadot-hex';
|
||||
import polkadotJson from './polkadot-json.json';
|
||||
import substrateData from './substrate-hex';
|
||||
import substrateJson from './substrate-json.json';
|
||||
|
||||
describe('MetadataV13 (substrate)', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
decodeLatestSubstrate(registry, 13, substrateData, substrateJson);
|
||||
|
||||
toLatest(registry, 13, substrateData);
|
||||
|
||||
defaultValues(registry, substrateData, true, true);
|
||||
testMeta(13, {
|
||||
polkadot: {
|
||||
compare: polkadotJson as Record<string, unknown>,
|
||||
data: polkadotData
|
||||
},
|
||||
substrate: {
|
||||
compare: substrateJson as Record<string, unknown>,
|
||||
data: substrateData
|
||||
}
|
||||
});
|
||||
|
||||
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 one or more lines are too long
File diff suppressed because one or more lines are too long
+293
-25
@@ -659,6 +659,13 @@
|
||||
"docs": [
|
||||
" Batch of dispatches completed fully with no error."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ItemCompleted",
|
||||
"args": [],
|
||||
"docs": [
|
||||
" A single item within a Batch of dispatches has completed with no error."
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [],
|
||||
@@ -1119,7 +1126,18 @@
|
||||
}
|
||||
],
|
||||
"events": null,
|
||||
"constants": [],
|
||||
"constants": [
|
||||
{
|
||||
"name": "UncleGenerations",
|
||||
"type": "BlockNumber",
|
||||
"value": "0x05000000",
|
||||
"docs": [
|
||||
" The number of blocks back we should accept uncles.",
|
||||
" This means that we will deal with uncle-parents that are",
|
||||
" `UncleGenerations + 1` before `now`."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
{
|
||||
"name": "InvalidUncleParent",
|
||||
@@ -1771,6 +1789,23 @@
|
||||
"docs": [
|
||||
" The minimum amount required to keep an account open."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxLocks",
|
||||
"type": "u32",
|
||||
"value": "0x32000000",
|
||||
"docs": [
|
||||
" The maximum number of locks that should exist on an account.",
|
||||
" Not strictly enforced, but used for weight estimation."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxReserves",
|
||||
"type": "u32",
|
||||
"value": "0x32000000",
|
||||
"docs": [
|
||||
" The maximum number of named reserves that can exist on an account."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
@@ -2001,7 +2036,7 @@
|
||||
"linked": false
|
||||
}
|
||||
},
|
||||
"fallback": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000",
|
||||
"fallback": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000",
|
||||
"docs": [
|
||||
" Unchecked, signed solutions.",
|
||||
"",
|
||||
@@ -2224,6 +2259,34 @@
|
||||
" to submit the worker's solution."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MinerTxPriority",
|
||||
"type": "TransactionPriority",
|
||||
"value": "0xfeffffffffffff7f",
|
||||
"docs": [
|
||||
" The priority of the unsigned transaction submitted in the unsigned-phase"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MinerMaxIterations",
|
||||
"type": "u32",
|
||||
"value": "0x0a000000",
|
||||
"docs": [
|
||||
" Maximum number of iteration of balancing that will be executed in the embedded miner of",
|
||||
" the pallet."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MinerMaxWeight",
|
||||
"type": "Weight",
|
||||
"value": "0xc07c907c2d010000",
|
||||
"docs": [
|
||||
" Maximum weight that the miner should consume.",
|
||||
"",
|
||||
" The miner will ensure that the total weight of the unsigned solution will not exceed",
|
||||
" this value, based on [`WeightInfo::submit_unsigned`]."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SignedMaxSubmissions",
|
||||
"type": "u32",
|
||||
@@ -2279,6 +2342,17 @@
|
||||
"docs": [
|
||||
" Per-weight deposit for a signed solution."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MinerMaxLength",
|
||||
"type": "u32",
|
||||
"value": "0x00003600",
|
||||
"docs": [
|
||||
" Maximum length (bytes) that the mined solution should consume.",
|
||||
"",
|
||||
" The miner will ensure that the total length of the unsigned solution will not exceed",
|
||||
" this value."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
@@ -2886,7 +2960,7 @@
|
||||
"docs": [
|
||||
" The last planned session scheduled by the session pallet.",
|
||||
"",
|
||||
" This is basically in sync with the call to [`SessionManager::new_session`]."
|
||||
" This is basically in sync with the call to [`pallet_session::SessionManager::new_session`]."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -2970,8 +3044,8 @@
|
||||
" The dispatch origin for this call must be _Signed_ by the stash, not the controller.",
|
||||
"",
|
||||
" Use this if there are additional funds in your stash account that you wish to bond.",
|
||||
" Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount",
|
||||
" that can be added.",
|
||||
" Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose any limitation",
|
||||
" on the amount that can be added.",
|
||||
"",
|
||||
" Emits `Bonded`.",
|
||||
"",
|
||||
@@ -3179,7 +3253,7 @@
|
||||
" The dispatch origin must be Root.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" Same as [`set_validator_count`].",
|
||||
" Same as [`Self::set_validator_count`].",
|
||||
" # </weight>"
|
||||
]
|
||||
},
|
||||
@@ -3197,7 +3271,7 @@
|
||||
" The dispatch origin must be Root.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" Same as [`set_validator_count`].",
|
||||
" Same as [`Self::set_validator_count`].",
|
||||
" # </weight>"
|
||||
]
|
||||
},
|
||||
@@ -3549,14 +3623,13 @@
|
||||
" bond required.",
|
||||
"",
|
||||
" This can be helpful if bond requirements are updated, and we need to remove old users",
|
||||
" who do not satisfy these requirements.",
|
||||
""
|
||||
" who do not satisfy these requirements."
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"name": "EraPayout",
|
||||
"name": "EraPaid",
|
||||
"args": [
|
||||
"EraIndex",
|
||||
"Balance",
|
||||
@@ -3569,17 +3642,17 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Reward",
|
||||
"name": "Rewarded",
|
||||
"args": [
|
||||
"AccountId",
|
||||
"Balance"
|
||||
],
|
||||
"docs": [
|
||||
" The staker has been rewarded by this amount. \\[stash, amount\\]"
|
||||
" The nominator has been rewarded by this amount. \\[stash, amount\\]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Slash",
|
||||
"name": "Slashed",
|
||||
"args": [
|
||||
"AccountId",
|
||||
"Balance"
|
||||
@@ -3600,7 +3673,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "StakingElection",
|
||||
"name": "StakersElected",
|
||||
"args": [],
|
||||
"docs": [
|
||||
" A new set of stakers was elected."
|
||||
@@ -3666,6 +3739,16 @@
|
||||
" An account has stopped participating as either a validator or nominator.",
|
||||
" \\[stash\\]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PayoutStarted",
|
||||
"args": [
|
||||
"EraIndex",
|
||||
"AccountId"
|
||||
],
|
||||
"docs": [
|
||||
" The stakers' rewards are getting paid. \\[era_index, validator_stash\\]"
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
@@ -4903,10 +4986,10 @@
|
||||
"name": "Executed",
|
||||
"args": [
|
||||
"ReferendumIndex",
|
||||
"bool"
|
||||
"DispatchResult"
|
||||
],
|
||||
"docs": [
|
||||
" A proposal has been enacted. \\[ref_index, is_ok\\]"
|
||||
" A proposal has been enacted. \\[ref_index, result\\]"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -5053,6 +5136,16 @@
|
||||
" The minimum amount to be used as a deposit for a public referendum proposal."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "InstantAllowed",
|
||||
"type": "bool",
|
||||
"value": "0x01",
|
||||
"docs": [
|
||||
" Indicator for whether an emergency origin is even allowed to happen. Some chains may want",
|
||||
" to set this permanently to `false`, others may want to condition it on things such as",
|
||||
" an upgrade having happened recently."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FastTrackVotingPeriod",
|
||||
"type": "BlockNumber",
|
||||
@@ -5087,6 +5180,14 @@
|
||||
" Also used to compute weight, an overly big value can",
|
||||
" lead to extrinsic with very big weight: see `delegate` for instance."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxProposals",
|
||||
"type": "u32",
|
||||
"value": "0x64000000",
|
||||
"docs": [
|
||||
" The maximum number of public proposals that can exist at any time."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
@@ -6383,8 +6484,9 @@
|
||||
" origin is removed as a runner-up.",
|
||||
" - `origin` is a current member. In this case, the deposit is unreserved and origin is",
|
||||
" removed as a member, consequently not being a candidate for the next round anymore.",
|
||||
" Similar to [`remove_members`], if replacement runners exists, they are immediately",
|
||||
" used. If the prime is renouncing, then no prime will exist until the next round.",
|
||||
" Similar to [`remove_member`](Self::remove_member), if replacement runners exists,",
|
||||
" they are immediately used. If the prime is renouncing, then no prime will exist until",
|
||||
" the next round.",
|
||||
"",
|
||||
" The dispatch origin of this call must be signed, and have one of the above roles.",
|
||||
"",
|
||||
@@ -7328,7 +7430,15 @@
|
||||
"type": "PalletId",
|
||||
"value": "0x70792f7472737279",
|
||||
"docs": [
|
||||
" The treasury's module id, used for deriving its sovereign account ID."
|
||||
" The treasury's pallet id, used for deriving its sovereign account ID."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxApprovals",
|
||||
"type": "u32",
|
||||
"value": "0x64000000",
|
||||
"docs": [
|
||||
" The maximum number of approvals that can wait in the spending queue."
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -8309,7 +8419,19 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [],
|
||||
"constants": [
|
||||
{
|
||||
"name": "UnsignedPriority",
|
||||
"type": "TransactionPriority",
|
||||
"value": "0xffffffffffffffff",
|
||||
"docs": [
|
||||
" A configuration for base priority of unsigned transactions.",
|
||||
"",
|
||||
" This is exposed so that it can be tuned for particular runtime, when",
|
||||
" multiple pallets send unsigned transactions."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
{
|
||||
"name": "InvalidKey",
|
||||
@@ -11156,7 +11278,7 @@
|
||||
" Schedule a named task after a delay.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" Same as [`schedule_named`].",
|
||||
" Same as [`schedule_named`](Self::schedule_named).",
|
||||
" # </weight>"
|
||||
]
|
||||
}
|
||||
@@ -11194,7 +11316,26 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [],
|
||||
"constants": [
|
||||
{
|
||||
"name": "MaximumWeight",
|
||||
"type": "Weight",
|
||||
"value": "0x00806e8774010000",
|
||||
"docs": [
|
||||
" The maximum weight that may be scheduled per block for any dispatchables of less priority",
|
||||
" than `schedule::HARD_DEADLINE`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxScheduledPerBlock",
|
||||
"type": "u32",
|
||||
"value": "0x32000000",
|
||||
"docs": [
|
||||
" The maximum number of scheduled calls in the queue for a single block.",
|
||||
" Not strictly enforced, but used for weight estimation."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
{
|
||||
"name": "FailedToSchedule",
|
||||
@@ -14068,7 +14209,49 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [],
|
||||
"constants": [
|
||||
{
|
||||
"name": "AssetDeposit",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x0000c16ff28623000000000000000000",
|
||||
"docs": [
|
||||
" The basic amount of funds that must be reserved for an asset."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MetadataDepositBase",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x0080c6a47e8d03000000000000000000",
|
||||
"docs": [
|
||||
" The basic amount of funds that must be reserved when adding metadata to your asset."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MetadataDepositPerByte",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x00407a10f35a00000000000000000000",
|
||||
"docs": [
|
||||
" The additional funds that must be reserved for the number of bytes you store in your",
|
||||
" metadata."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ApprovalDeposit",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x00407a10f35a00000000000000000000",
|
||||
"docs": [
|
||||
" The amount of funds that must be reserved when creating a new approval."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "StringLimit",
|
||||
"type": "u32",
|
||||
"value": "0x32000000",
|
||||
"docs": [
|
||||
" The maximum length of a name or symbol stored on-chain."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
{
|
||||
"name": "BalanceLow",
|
||||
@@ -14148,7 +14331,7 @@
|
||||
{
|
||||
"name": "Mmr",
|
||||
"storage": {
|
||||
"prefix": "MerkleMountainRange",
|
||||
"prefix": "Mmr",
|
||||
"items": [
|
||||
{
|
||||
"name": "RootHash",
|
||||
@@ -14420,6 +14603,16 @@
|
||||
"docs": [
|
||||
" The max number of calls available in a single lottery."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxGenerateRandom",
|
||||
"type": "u32",
|
||||
"value": "0x0a000000",
|
||||
"docs": [
|
||||
" Number of time we should try to generate a random number that has no modulo bias.",
|
||||
" The larger this number, the more potential computation is used for picking the winner,",
|
||||
" but also the more likely that the chosen winner is done fairly."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
@@ -14673,6 +14866,15 @@
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"name": "IgnoredIssuance",
|
||||
"type": "BalanceOf",
|
||||
"value": "0x00000000000000000000000000000000",
|
||||
"docs": [
|
||||
" The issuance to ignore. This is subtracted from the `Currency`'s `total_issuance` to get",
|
||||
" the issuance by which we inflate or deflate the gilt."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "QueueCount",
|
||||
"type": "u32",
|
||||
@@ -15855,7 +16057,73 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [],
|
||||
"constants": [
|
||||
{
|
||||
"name": "ClassDeposit",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x0000c16ff28623000000000000000000",
|
||||
"docs": [
|
||||
" The basic amount of funds that must be reserved for an asset class."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "InstanceDeposit",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x00407a10f35a00000000000000000000",
|
||||
"docs": [
|
||||
" The basic amount of funds that must be reserved for an asset instance."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MetadataDepositBase",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x0080c6a47e8d03000000000000000000",
|
||||
"docs": [
|
||||
" The basic amount of funds that must be reserved when adding metadata to your asset."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "AttributeDepositBase",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x0080c6a47e8d03000000000000000000",
|
||||
"docs": [
|
||||
" The basic amount of funds that must be reserved when adding an attribute to an asset."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "DepositPerByte",
|
||||
"type": "DepositBalanceOf",
|
||||
"value": "0x00407a10f35a00000000000000000000",
|
||||
"docs": [
|
||||
" The additional funds that must be reserved for the number of bytes store in metadata,",
|
||||
" either \"normal\" metadata or attribute metadata."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "StringLimit",
|
||||
"type": "u32",
|
||||
"value": "0x32000000",
|
||||
"docs": [
|
||||
" The maximum length of data stored on-chain."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "KeyLimit",
|
||||
"type": "u32",
|
||||
"value": "0x20000000",
|
||||
"docs": [
|
||||
" The maximum length of an attribute key."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ValueLimit",
|
||||
"type": "u32",
|
||||
"value": "0x00010000",
|
||||
"docs": [
|
||||
" The maximum length of an attribute value."
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
{
|
||||
"name": "NoPermission",
|
||||
@@ -5,9 +5,12 @@ import type { MetadataAll } from '../../interfaces/metadata';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { Metadata } from '../Metadata';
|
||||
import substrateData from './static';
|
||||
import substrateJson from './static-substrate.json';
|
||||
import substrateTypes from './static-types.json';
|
||||
import polkadotData from './polkadot-hex';
|
||||
import polkadotJson from './polkadot-json.json';
|
||||
import polkadotTypes from './polkadot-types.json';
|
||||
import substrateData from './substrate-hex';
|
||||
import substrateJson from './substrate-json.json';
|
||||
import substrateTypes from './substrate-types.json';
|
||||
|
||||
describe('MetadataV14 (substrate)', (): void => {
|
||||
// FIXME This is to be replaced with the proper version (here as a stop-gap)
|
||||
@@ -45,3 +48,40 @@ describe('MetadataV14 (substrate)', (): void => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('MetadataV14 (polkadot)', (): void => {
|
||||
// FIXME This is to be replaced with the proper version (here as a stop-gap)
|
||||
it('parses', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
const metadata = new Metadata(registry, polkadotData);
|
||||
const all = metadata.get('metadata') as MetadataAll;
|
||||
const v14 = all.asV14;
|
||||
const jsonStruct = v14.toJSON();
|
||||
const jsonTypes = v14.lookup.types.toJSON();
|
||||
|
||||
delete (jsonStruct as Record<string, unknown>).lookup;
|
||||
|
||||
const allJson = {
|
||||
magicNumber: 1635018093,
|
||||
metadata: {
|
||||
v14: jsonStruct
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
expect(allJson).toEqual(polkadotJson);
|
||||
} catch (error) {
|
||||
console.error(JSON.stringify(allJson));
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
try {
|
||||
expect(jsonTypes).toEqual(polkadotTypes);
|
||||
} catch (error) {
|
||||
console.error(JSON.stringify(jsonTypes));
|
||||
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user