Use tsconfig references (#4328)
* Use tsconfig references * Move types-known (temp until lower-level split) * Sources * Adjust * tesconfig.eslint.json * Bumps * AdjustAdjust * Linting passing... a start... * Adjust * Merge derive * Merge * api-contract-support * It builds? * compare locations
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { packageInfo as knownInfo } from '@polkadot/types-known/packageInfo';
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, [knownInfo]);
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, []);
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { AnyNumber, AnyU8a, Registry } from '../types';
|
||||
import { Struct } from '../codec/Struct';
|
||||
|
||||
export interface HeaderValue {
|
||||
digest?: Digest | { logs: DigestItem[] };
|
||||
digest?: Digest | { logs: DigestItem[] | string[] };
|
||||
extrinsicsRoot?: AnyU8a;
|
||||
number?: AnyNumber;
|
||||
parentHash?: AnyU8a;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
import type { Definitions } from '../../types';
|
||||
|
||||
import { mapXcmTypes } from '@polkadot/types-known';
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
import { mapXcmTypes } from '../../known';
|
||||
import { v0 } from './v0';
|
||||
import { v1 } from './v1';
|
||||
import { v2 } from './v2';
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
// Type overrides based on specific nodes
|
||||
const typesChain: Record<string, OverrideVersionedType[]> = {};
|
||||
|
||||
export default typesChain;
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create/registry';
|
||||
import { getModuleTypes } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registry.setKnownTypes({
|
||||
typesAlias: {
|
||||
identity: {
|
||||
Id: 'IdentityId'
|
||||
},
|
||||
testModule: {
|
||||
Proposal: 'TestProposal'
|
||||
},
|
||||
treasury: {
|
||||
Proposal: 'TreasuryProposals2'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
describe('getModuleTypes', (): void => {
|
||||
it('collects the pre-defined types for contracts', (): void => {
|
||||
expect(getModuleTypes(registry, 'contracts')).toEqual({
|
||||
StorageKey: 'ContractStorageKey'
|
||||
});
|
||||
});
|
||||
|
||||
it('collects the user-defined types for testModule', (): void => {
|
||||
expect(getModuleTypes(registry, 'testModule')).toEqual({
|
||||
Proposal: 'TestProposal'
|
||||
});
|
||||
});
|
||||
|
||||
it('overrides pre-defined with user-defined for treasury', (): void => {
|
||||
expect(getModuleTypes(registry, 'treasury')).toEqual({
|
||||
Proposal: 'TreasuryProposals2'
|
||||
});
|
||||
});
|
||||
|
||||
it('merges pre-defined and user-defined for identity', (): void => {
|
||||
expect(getModuleTypes(registry, 'identity')).toEqual({
|
||||
Id: 'IdentityId',
|
||||
Judgement: 'IdentityJudgement'
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,133 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { ExtDef } from '../extrinsic/signedExtensions/types';
|
||||
import type { Hash } from '../interfaces';
|
||||
import type { Text } from '../primitive';
|
||||
import type { ChainUpgradeVersion, CodecHasher, DefinitionRpc, DefinitionRpcSub, OverrideModuleType, OverrideVersionedType, Registry, RegistryTypes } from '../types';
|
||||
|
||||
import { bnToBn, isNull, isUndefined, objectSpread } from '@polkadot/util';
|
||||
|
||||
import typesChain from './chain';
|
||||
import typesModules from './modules';
|
||||
import typesSpec from './spec';
|
||||
import upgrades from './upgrades';
|
||||
|
||||
export { knownOrigins } from './knownOrigins';
|
||||
export { mapXcmTypes } from './xcm';
|
||||
|
||||
function withNames <T> (chainName: Text | string, specName: Text | string, fn: (c: string, s: string) => T): T {
|
||||
return fn(chainName.toString(), specName.toString());
|
||||
}
|
||||
|
||||
// flatten a VersionedType[] into a Record<string, string>
|
||||
/** @internal */
|
||||
function filterVersions (versions: OverrideVersionedType[] = [], specVersion: number): RegistryTypes {
|
||||
return versions
|
||||
.filter(({ minmax: [min, max] }) =>
|
||||
(isUndefined(min) || isNull(min) || specVersion >= min) &&
|
||||
(isUndefined(max) || isNull(max) || specVersion <= max)
|
||||
)
|
||||
.reduce((result: RegistryTypes, { types }): RegistryTypes =>
|
||||
objectSpread(result, types), {}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Get types for specific modules (metadata override)
|
||||
*/
|
||||
export function getModuleTypes ({ knownTypes }: Registry, section: string): OverrideModuleType {
|
||||
return objectSpread({},
|
||||
typesModules[section],
|
||||
knownTypes.typesAlias?.[section]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Based on the chain and runtimeVersion, get the applicable signed extensions (ready for registration)
|
||||
*/
|
||||
export function getSpecExtensions ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): ExtDef {
|
||||
return withNames(chainName, specName, (c, s) =>
|
||||
objectSpread({},
|
||||
knownTypes.typesBundle?.spec?.[s]?.signedExtensions,
|
||||
knownTypes.typesBundle?.chain?.[c]?.signedExtensions
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Based on the chain and runtimeVersion, get the applicable types (ready for registration)
|
||||
*/
|
||||
export function getSpecTypes ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string, specVersion: bigint | BN | number): RegistryTypes {
|
||||
const _specVersion = bnToBn(specVersion).toNumber();
|
||||
|
||||
return withNames(chainName, specName, (c, s) =>
|
||||
// The order here is always, based on -
|
||||
// - spec then chain
|
||||
// - typesBundle takes higher precedence
|
||||
// - types is the final catch-all override
|
||||
objectSpread({},
|
||||
filterVersions(typesSpec[s], _specVersion),
|
||||
filterVersions(typesChain[c], _specVersion),
|
||||
filterVersions(knownTypes.typesBundle?.spec?.[s]?.types, _specVersion),
|
||||
filterVersions(knownTypes.typesBundle?.chain?.[c]?.types, _specVersion),
|
||||
knownTypes.typesSpec?.[s],
|
||||
knownTypes.typesChain?.[c],
|
||||
knownTypes.types
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function getSpecHasher ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): CodecHasher | null {
|
||||
return withNames(chainName, specName, (c, s) =>
|
||||
knownTypes.hasher ||
|
||||
knownTypes.typesBundle?.chain?.[c]?.hasher ||
|
||||
knownTypes.typesBundle?.spec?.[s]?.hasher ||
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Based on the chain and runtimeVersion, get the applicable rpc definitions (ready for registration)
|
||||
*/
|
||||
export function getSpecRpc ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>> {
|
||||
return withNames(chainName, specName, (c, s) =>
|
||||
objectSpread({},
|
||||
knownTypes.typesBundle?.spec?.[s]?.rpc,
|
||||
knownTypes.typesBundle?.chain?.[c]?.rpc
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Based on the chain and runtimeVersion, get the applicable alias definitions (ready for registration)
|
||||
*/
|
||||
export function getSpecAlias ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): Record<string, OverrideModuleType> {
|
||||
return withNames(chainName, specName, (c, s) =>
|
||||
// as per versions, first spec, then chain then finally non-versioned
|
||||
objectSpread({},
|
||||
knownTypes.typesBundle?.spec?.[s]?.alias,
|
||||
knownTypes.typesBundle?.chain?.[c]?.alias,
|
||||
knownTypes.typesAlias
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns a version record for known chains where upgrades are being tracked
|
||||
*/
|
||||
export function getUpgradeVersion (genesisHash: Hash, blockNumber: BN): [ChainUpgradeVersion | undefined, ChainUpgradeVersion | undefined] {
|
||||
const known = upgrades.find((u) => genesisHash.eq(u.genesisHash));
|
||||
|
||||
return known
|
||||
? [
|
||||
known.versions.reduce<ChainUpgradeVersion | undefined>((last, version) => {
|
||||
return blockNumber.gt(version.blockNumber)
|
||||
? version
|
||||
: last;
|
||||
}, undefined),
|
||||
known.versions.find((version) => blockNumber.lte(version.blockNumber))
|
||||
]
|
||||
: [undefined, undefined];
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// We want predictive ordering (manually managed)
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
// Since we don't have insight into the origin specification, we can only define what we know about
|
||||
// in a pure Substrate/Polkadot implementation, any other custom origins won't be handled at all
|
||||
export const knownOrigins: Record<string, string> = {
|
||||
//
|
||||
// (1) Defaults from Substrate
|
||||
//
|
||||
Council: 'CollectiveOrigin',
|
||||
System: 'SystemOrigin',
|
||||
TechnicalCommittee: 'CollectiveOrigin',
|
||||
//
|
||||
// (2) Defaults from Polkadot
|
||||
//
|
||||
Xcm: 'XcmOrigin',
|
||||
XcmPallet: 'XcmOrigin',
|
||||
//
|
||||
// (3) Defaults from Acala
|
||||
//
|
||||
Authority: 'AuthorityOrigin',
|
||||
GeneralCouncil: 'CollectiveOrigin'
|
||||
};
|
||||
@@ -0,0 +1,108 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { OverrideModuleType } from '../types';
|
||||
|
||||
// type overrides for modules (where duplication between modules exist)
|
||||
const typesModules: Record<string, OverrideModuleType> = {
|
||||
assets: {
|
||||
Approval: 'AssetApproval',
|
||||
ApprovalKey: 'AssetApprovalKey',
|
||||
Balance: 'TAssetBalance',
|
||||
DestroyWitness: 'AssetDestroyWitness'
|
||||
},
|
||||
babe: {
|
||||
EquivocationProof: 'BabeEquivocationProof'
|
||||
},
|
||||
balances: {
|
||||
Status: 'BalanceStatus'
|
||||
},
|
||||
beefy: {
|
||||
AuthorityId: 'BeefyId'
|
||||
},
|
||||
contracts: {
|
||||
StorageKey: 'ContractStorageKey'
|
||||
},
|
||||
electionProviderMultiPhase: {
|
||||
Phase: 'ElectionPhase'
|
||||
},
|
||||
ethereum: {
|
||||
Block: 'EthBlock',
|
||||
Header: 'EthHeader',
|
||||
Receipt: 'EthReceipt',
|
||||
Transaction: 'EthTransaction',
|
||||
TransactionStatus: 'EthTransactionStatus'
|
||||
},
|
||||
evm: {
|
||||
Account: 'EvmAccount',
|
||||
Log: 'EvmLog',
|
||||
Vicinity: 'EvmVicinity'
|
||||
},
|
||||
grandpa: {
|
||||
Equivocation: 'GrandpaEquivocation',
|
||||
EquivocationProof: 'GrandpaEquivocationProof'
|
||||
},
|
||||
identity: {
|
||||
Judgement: 'IdentityJudgement'
|
||||
},
|
||||
inclusion: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
paraDisputes: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
paraInclusion: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
paraScheduler: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
paraShared: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
parachains: {
|
||||
Id: 'ParaId'
|
||||
},
|
||||
parasDisputes: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
parasInclusion: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
parasScheduler: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
parasShared: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
proposeParachain: {
|
||||
Proposal: 'ParachainProposal'
|
||||
},
|
||||
proxy: {
|
||||
Announcement: 'ProxyAnnouncement'
|
||||
},
|
||||
scheduler: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
shared: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
society: {
|
||||
Judgement: 'SocietyJudgement',
|
||||
Vote: 'SocietyVote'
|
||||
},
|
||||
staking: {
|
||||
Compact: 'CompactAssignments'
|
||||
},
|
||||
treasury: {
|
||||
Proposal: 'TreasuryProposal'
|
||||
},
|
||||
xcm: {
|
||||
AssetId: 'XcmAssetId'
|
||||
},
|
||||
xcmPallet: {
|
||||
AssetId: 'XcmAssetId'
|
||||
}
|
||||
};
|
||||
|
||||
export default typesModules;
|
||||
@@ -0,0 +1,117 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
const sharedTypes = {
|
||||
// Anchor
|
||||
AnchorData: {
|
||||
anchoredBlock: 'u64',
|
||||
docRoot: 'H256',
|
||||
id: 'H256'
|
||||
},
|
||||
PreCommitData: {
|
||||
expirationBlock: 'u64',
|
||||
identity: 'H256',
|
||||
signingRoot: 'H256'
|
||||
},
|
||||
|
||||
// Fees
|
||||
Fee: {
|
||||
key: 'Hash',
|
||||
price: 'Balance'
|
||||
},
|
||||
|
||||
// MultiAccount
|
||||
MultiAccountData: {
|
||||
deposit: 'Balance',
|
||||
depositor: 'AccountId',
|
||||
signatories: 'Vec<AccountId>',
|
||||
threshold: 'u16'
|
||||
},
|
||||
|
||||
// Bridge
|
||||
ChainId: 'u8',
|
||||
DepositNonce: 'u64',
|
||||
ResourceId: '[u8; 32]',
|
||||
'chainbridge::ChainId': 'u8',
|
||||
|
||||
// NFT
|
||||
RegistryId: 'H160',
|
||||
TokenId: 'U256',
|
||||
AssetId: {
|
||||
registryId: 'RegistryId',
|
||||
tokenId: 'TokenId'
|
||||
},
|
||||
AssetInfo: {
|
||||
metadata: 'Bytes'
|
||||
},
|
||||
MintInfo: {
|
||||
anchorId: 'Hash',
|
||||
proofs: 'Vec<ProofMint>',
|
||||
staticHashes: '[Hash; 3]'
|
||||
},
|
||||
Proof: {
|
||||
leafHash: 'H256',
|
||||
sortedHashes: 'H256'
|
||||
},
|
||||
ProofMint: {
|
||||
hashes: 'Vec<Hash>',
|
||||
property: 'Bytes',
|
||||
salt: '[u8; 32]',
|
||||
value: 'Bytes'
|
||||
},
|
||||
RegistryInfo: {
|
||||
fields: 'Vec<Bytes>',
|
||||
ownerCanBurn: 'bool'
|
||||
},
|
||||
|
||||
ProxyType: {
|
||||
_enum: [
|
||||
'Any',
|
||||
'NonTransfer',
|
||||
'Governance',
|
||||
'Staking',
|
||||
'NonProxy'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
const standaloneTypes = objectSpread({}, sharedTypes, {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'LookupSource',
|
||||
LookupSource: 'IndicesLookupSource',
|
||||
Multiplier: 'Fixed64',
|
||||
RefCount: 'RefCountTo259'
|
||||
});
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [240, 243],
|
||||
types: objectSpread({}, standaloneTypes, {
|
||||
ProxyType: {
|
||||
_enum: [
|
||||
'Any',
|
||||
'NonTransfer',
|
||||
'Governance',
|
||||
'Staking',
|
||||
'Vesting'
|
||||
]
|
||||
}
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [244, 999],
|
||||
types: objectSpread({}, standaloneTypes)
|
||||
},
|
||||
{
|
||||
minmax: [1000, undefined],
|
||||
types: objectSpread({}, sharedTypes)
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
import centrifugeChain from './centrifuge-chain';
|
||||
import kusama from './kusama';
|
||||
import node from './node';
|
||||
import nodeTemplate from './node-template';
|
||||
import polkadot from './polkadot';
|
||||
import rococo from './rococo';
|
||||
import shell from './shell';
|
||||
import statemint from './statemint';
|
||||
import westend from './westend';
|
||||
|
||||
// Type overrides for specific spec types & versions as given in runtimeVersion
|
||||
const typesSpec: Record<string, OverrideVersionedType[]> = {
|
||||
'centrifuge-chain': centrifugeChain,
|
||||
kusama,
|
||||
node,
|
||||
'node-template': nodeTemplate,
|
||||
polkadot,
|
||||
rococo,
|
||||
shell,
|
||||
statemine: statemint,
|
||||
statemint,
|
||||
westend,
|
||||
westmint: statemint
|
||||
};
|
||||
|
||||
export default typesSpec;
|
||||
@@ -0,0 +1,192 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
import { mapXcmTypes } from '../xcm';
|
||||
|
||||
const sharedTypes = {
|
||||
CompactAssignments: 'CompactAssignmentsWith24',
|
||||
RawSolution: 'RawSolutionWith24',
|
||||
Keys: 'SessionKeys6',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy', 'Auction']
|
||||
}
|
||||
};
|
||||
|
||||
const addrIndicesTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'LookupSource',
|
||||
CompactAssignments: 'CompactAssignmentsWith16',
|
||||
RawSolution: 'RawSolutionWith16',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'IndicesLookupSource',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
CompactAssignments: 'CompactAssignmentsWith16',
|
||||
RawSolution: 'RawSolutionWith16',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
// 1020 is first CC3
|
||||
minmax: [1019, 1031],
|
||||
types: objectSpread({}, addrIndicesTypes, {
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchError: 'DispatchErrorTo198',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
IdentityInfo: 'IdentityInfoTo198',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
ReferendumInfo: 'ReferendumInfoTo239',
|
||||
SlashingSpans: 'SlashingSpansTo204',
|
||||
StakingLedger: 'StakingLedgerTo223',
|
||||
Votes: 'VotesTo230',
|
||||
Weight: 'u32'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [1032, 1042],
|
||||
types: objectSpread({}, addrIndicesTypes, {
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
ReferendumInfo: 'ReferendumInfoTo239',
|
||||
SlashingSpans: 'SlashingSpansTo204',
|
||||
StakingLedger: 'StakingLedgerTo223',
|
||||
Votes: 'VotesTo230',
|
||||
Weight: 'u32'
|
||||
})
|
||||
},
|
||||
{
|
||||
// actual at 1045 (1043-1044 is dev)
|
||||
minmax: [1043, 1045],
|
||||
types: objectSpread({}, addrIndicesTypes, {
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
ReferendumInfo: 'ReferendumInfoTo239',
|
||||
StakingLedger: 'StakingLedgerTo223',
|
||||
Votes: 'VotesTo230',
|
||||
Weight: 'u32'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [1046, 1054],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
ReferendumInfo: 'ReferendumInfoTo239',
|
||||
StakingLedger: 'StakingLedgerTo240',
|
||||
Weight: 'u32'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [1055, 1056],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
StakingLedger: 'StakingLedgerTo240',
|
||||
Weight: 'u32'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [1057, 1061],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [1062, 2012],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [2013, 2022],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [2023, 2024],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [2025, 2027],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes)
|
||||
},
|
||||
{
|
||||
minmax: [2028, 2029],
|
||||
types: objectSpread({}, sharedTypes, {
|
||||
AccountInfo: 'AccountInfoWithDualRefCount',
|
||||
CompactAssignments: 'CompactAssignmentsWith16',
|
||||
RawSolution: 'RawSolutionWith16'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [2030, 9000],
|
||||
types: objectSpread({}, sharedTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsWith16',
|
||||
RawSolution: 'RawSolutionWith16'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [9010, 9099],
|
||||
types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
|
||||
},
|
||||
{
|
||||
// jump from 9100 to 9110, however align with Rococo
|
||||
minmax: [9100, 9105],
|
||||
types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
|
||||
},
|
||||
{
|
||||
// metadata v14
|
||||
minmax: [9106, undefined],
|
||||
types: {}
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, undefined],
|
||||
types: {
|
||||
// nothing, API tracks master
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, undefined],
|
||||
types: {
|
||||
// nothing, API tracks master
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
const sharedTypes = {
|
||||
CompactAssignments: 'CompactAssignmentsWith16',
|
||||
RawSolution: 'RawSolutionWith16',
|
||||
Keys: 'SessionKeys6',
|
||||
ProxyType: {
|
||||
_enum: {
|
||||
Any: 0,
|
||||
NonTransfer: 1,
|
||||
Governance: 2,
|
||||
Staking: 3,
|
||||
UnusedSudoBalances: 4,
|
||||
IdentityJudgement: 5,
|
||||
CancelProxy: 6,
|
||||
Auction: 7
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
// these are override types for Polkadot
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, 12],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [13, 22],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [23, 24],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [25, 27],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes)
|
||||
},
|
||||
{
|
||||
minmax: [28, 29],
|
||||
types: objectSpread({}, sharedTypes, {
|
||||
AccountInfo: 'AccountInfoWithDualRefCount'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [30, 9109],
|
||||
types: objectSpread({}, sharedTypes)
|
||||
},
|
||||
{
|
||||
// metadata v14
|
||||
minmax: [9110, undefined],
|
||||
types: {}
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
import { mapXcmTypes } from '../xcm';
|
||||
|
||||
// structs need to be in order
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
const sharedTypes = {
|
||||
FullIdentification: '()', // No staking, only session (as per config)
|
||||
Keys: 'SessionKeys7B'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, 200],
|
||||
types: objectSpread({}, sharedTypes, {
|
||||
AccountInfo: 'AccountInfoWithDualRefCount',
|
||||
Address: 'AccountId',
|
||||
LookupSource: 'AccountId'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [201, 214],
|
||||
types: objectSpread({}, sharedTypes, {
|
||||
AccountInfo: 'AccountInfoWithDualRefCount'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [215, 228],
|
||||
types: objectSpread({}, sharedTypes, {
|
||||
Keys: 'SessionKeys6'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [229, 9099],
|
||||
types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
|
||||
},
|
||||
{
|
||||
minmax: [9100, 9105],
|
||||
types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
|
||||
},
|
||||
{
|
||||
// metadata v14
|
||||
minmax: [9106, undefined],
|
||||
types: {}
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, undefined],
|
||||
types: {
|
||||
// nothing, limited runtime
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
import { mapXcmTypes } from '../xcm';
|
||||
|
||||
const sharedTypes = {
|
||||
TAssetBalance: 'u128',
|
||||
ProxyType: {
|
||||
_enum: [
|
||||
'Any',
|
||||
'NonTransfer',
|
||||
'CancelProxy',
|
||||
'Assets',
|
||||
'AssetOwner',
|
||||
'AssetManager',
|
||||
'Staking'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
// these are override types for Statemine, Statemint, Westmint
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, 3],
|
||||
types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
|
||||
},
|
||||
{
|
||||
minmax: [4, 5],
|
||||
types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
|
||||
},
|
||||
{
|
||||
// metadata V14
|
||||
minmax: [500, undefined],
|
||||
types: {}
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,98 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { OverrideVersionedType } from '../../types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
import { mapXcmTypes } from '../xcm';
|
||||
|
||||
const sharedTypes = {
|
||||
// 16 validators
|
||||
CompactAssignments: 'CompactAssignmentsWith16',
|
||||
RawSolution: 'RawSolutionWith16',
|
||||
// general
|
||||
Keys: 'SessionKeys6',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances', 'IdentityJudgement', 'CancelProxy']
|
||||
}
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
CompactAssignments: 'CompactAssignmentsWith16',
|
||||
LookupSource: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
RawSolution: 'RawSolutionWith16',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [1, 2],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
Weight: 'u32'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [3, 22],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [23, 42],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [43, 44],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes, {
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
RefCount: 'RefCountTo259'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [45, 47],
|
||||
types: objectSpread({}, sharedTypes, addrAccountIdTypes)
|
||||
},
|
||||
{
|
||||
minmax: [48, 49],
|
||||
types: objectSpread({}, sharedTypes, {
|
||||
AccountInfo: 'AccountInfoWithDualRefCount'
|
||||
})
|
||||
},
|
||||
{
|
||||
minmax: [50, 9099],
|
||||
types: objectSpread({}, sharedTypes, mapXcmTypes('V0'))
|
||||
},
|
||||
{
|
||||
minmax: [9100, 9105],
|
||||
types: objectSpread({}, sharedTypes, mapXcmTypes('V1'))
|
||||
},
|
||||
{
|
||||
// metadata v14
|
||||
minmax: [9106, undefined],
|
||||
types: {}
|
||||
}
|
||||
];
|
||||
|
||||
export default versioned;
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { assert, u8aEq } from '@polkadot/util';
|
||||
|
||||
import all from '.';
|
||||
|
||||
interface TestDef {
|
||||
genesisHash: string;
|
||||
network: string;
|
||||
versions: [number, [number, number]][];
|
||||
}
|
||||
|
||||
const TESTS: TestDef[] = [
|
||||
{
|
||||
genesisHash: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe',
|
||||
network: 'kusama',
|
||||
versions: [
|
||||
[0, [0, 1020]],
|
||||
[17, [901442, 1045]]
|
||||
]
|
||||
},
|
||||
{
|
||||
genesisHash: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3',
|
||||
network: 'polkadot',
|
||||
versions: [
|
||||
[0, [0, 0]],
|
||||
[19, [2436698, 26]]
|
||||
]
|
||||
},
|
||||
{
|
||||
genesisHash: '0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e',
|
||||
network: 'westend',
|
||||
versions: [
|
||||
[0, [214356, 4]],
|
||||
[23, [4207800, 48]]
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
describe('upgrades', (): void => {
|
||||
TESTS.forEach(({ genesisHash, network, versions }): void => {
|
||||
describe(network, (): void => {
|
||||
const chain = all.find((n) => n.network === network);
|
||||
|
||||
assert(chain, `Unable to find the entry for ${network}`);
|
||||
|
||||
it('has a valid genesisHash', (): void => {
|
||||
expect(u8aEq(chain.genesisHash, genesisHash)).toBe(true);
|
||||
});
|
||||
|
||||
versions.forEach(([index, [blockNumber, specVersion]]): void => {
|
||||
it(`has a valid entry at index ${index}`, (): void => {
|
||||
const version = chain.versions[index];
|
||||
|
||||
expect(version.blockNumber.eqn(blockNumber)).toBe(true);
|
||||
expect(version.specVersion.eqn(specVersion)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ChainUpgrades } from '../../types';
|
||||
import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
import { selectableNetworks } from '@polkadot/networks';
|
||||
import { assert, BN, hexToU8a, stringify } from '@polkadot/util';
|
||||
|
||||
import kusama from './kusama';
|
||||
import polkadot from './polkadot';
|
||||
import westend from './westend';
|
||||
|
||||
const allKnown = { kusama, polkadot, westend };
|
||||
|
||||
// testnets are not available in the networks map
|
||||
const NET_EXTRA: Record<string, { genesisHash: string[] }> = {
|
||||
westend: {
|
||||
genesisHash: ['0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e']
|
||||
}
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
function checkOrder (network: string, versions: ChainUpgradesRaw): [number, number][] {
|
||||
const ooo = versions.filter((curr, index): boolean => {
|
||||
const prev = versions[index - 1];
|
||||
|
||||
return index === 0
|
||||
? false
|
||||
: curr[0] <= prev[0] || curr[1] <= prev[1];
|
||||
});
|
||||
|
||||
assert(!ooo.length, () => `${network}: Mismatched upgrade ordering: ${stringify(ooo)}`);
|
||||
|
||||
return versions;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function mapRaw ([network, versions]: [string, ChainUpgradesRaw]): ChainUpgrades {
|
||||
const chain = selectableNetworks.find((n) => n.network === network) || NET_EXTRA[network];
|
||||
|
||||
assert(chain, () => `Unable to find info for chain ${network}`);
|
||||
|
||||
return {
|
||||
genesisHash: hexToU8a(chain.genesisHash[0]),
|
||||
network,
|
||||
versions: checkOrder(network, versions).map(([blockNumber, specVersion]) => ({
|
||||
blockNumber: new BN(blockNumber),
|
||||
specVersion: new BN(specVersion)
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
// Type overrides for specific spec types & versions as given in runtimeVersion
|
||||
const upgrades = Object.entries(allKnown).map(mapRaw);
|
||||
|
||||
export default upgrades;
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
const upgrades: ChainUpgradesRaw = [
|
||||
[0, 1020], [26669, 1021], [38245, 1022], [54248, 1023], [59659, 1024],
|
||||
[67651, 1025], [82191, 1027], [83238, 1028], [101503, 1029], [203466, 1030],
|
||||
[295787, 1031], [461692, 1032], [504329, 1033], [569327, 1038], [587687, 1039],
|
||||
[653183, 1040], [693488, 1042], [901442, 1045], [1375086, 1050], [1445458, 1051],
|
||||
[1472960, 1052], [1475648, 1053], [1491596, 1054], [1574408, 1055], [2064961, 1058],
|
||||
[2201991, 1062], [2671528, 2005], [2704202, 2007], [2728002, 2008], [2832534, 2011],
|
||||
[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], [8555825, 9080], [8945245, 9090],
|
||||
[9611377, 9100], [9625129, 9111], [9866422, 9122], [10403784, 9130]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
const upgrades: ChainUpgradesRaw = [
|
||||
[0, 0], [29231, 1], [188836, 5], [199405, 6], [214264, 7],
|
||||
[244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12],
|
||||
[528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
|
||||
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
|
||||
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050],
|
||||
[6321619, 9080], [6713249, 9090], [7217907, 9100], [7229126, 9110], [7560558, 9122]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export type ChainUpgradesRaw = [number, number][];
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
const upgrades: ChainUpgradesRaw = [
|
||||
[214356, 4], [392764, 7], [409740, 8], [809976, 20], [877581, 24],
|
||||
[879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29],
|
||||
[1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35],
|
||||
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
|
||||
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
|
||||
[5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030],
|
||||
[5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070],
|
||||
[6379314, 9080], [6979141, 9090], [7568453, 9100], [7766394, 9111], [7911691, 9120],
|
||||
[7968866, 9121], [7982889, 9122]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
export const XCM_MAPPINGS = ['AssetInstance', 'Fungibility', 'Junction', 'Junctions', 'MultiAsset', 'MultiAssetFilter', 'MultiLocation', 'Response', 'WildFungibility', 'WildMultiAsset', 'Xcm', 'XcmError', 'XcmOrder'];
|
||||
|
||||
export function mapXcmTypes (version: 'V0' | 'V1' | 'V2'): Record<string, string> {
|
||||
return XCM_MAPPINGS.reduce<Record<string, string>>((all, key) =>
|
||||
objectSpread(all, { [key]: `${key}${version}` }), {}
|
||||
);
|
||||
}
|
||||
@@ -7,5 +7,5 @@ export interface Check {
|
||||
compare: Record<string, unknown>;
|
||||
data: HexString;
|
||||
fails?: string[];
|
||||
types?: Record<string, unknown>;
|
||||
types?: unknown[];
|
||||
}
|
||||
|
||||
@@ -7,9 +7,10 @@ import type { Text } from '../../primitive/Text';
|
||||
import type { Type } from '../../primitive/Type';
|
||||
import type { OverrideModuleType, Registry } from '../../types';
|
||||
|
||||
import { getModuleTypes, knownOrigins } from '@polkadot/types-known';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { getModuleTypes, knownOrigins } from '../../known';
|
||||
|
||||
interface MapDef {
|
||||
hashers: StorageHasherV13[];
|
||||
keys: Type[];
|
||||
|
||||
@@ -17,16 +17,16 @@ testMeta(14, {
|
||||
kusama: {
|
||||
compare: kusamaJson as Record<string, unknown>,
|
||||
data: kusamaData,
|
||||
types: kusamaTypes as Record<string, unknown>
|
||||
types: kusamaTypes as unknown[]
|
||||
},
|
||||
polkadot: {
|
||||
compare: polkadotJson as Record<string, unknown>,
|
||||
data: polkadotData,
|
||||
types: polkadotTypes as Record<string, unknown>
|
||||
types: polkadotTypes as unknown[]
|
||||
},
|
||||
substrate: {
|
||||
compare: substrateJson as Record<string, unknown>,
|
||||
data: substrateData,
|
||||
types: substrateTypes as Record<string, unknown>
|
||||
types: substrateTypes as unknown[]
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user