Rebrand: polkadot → pezkuwi, substrate → bizinikiwi, kusama → dicle

This commit is contained in:
2026-01-07 02:29:40 +03:00
commit d5f038faea
1383 changed files with 1088018 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
# @pezkuwi/types-known
Specific known base type overrides (e.g. `Address`, etc) for chains & specs. This does not contain user-specific types.
+34
View File
@@ -0,0 +1,34 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/pezkuwichain/pezkuwi-api/issues",
"description": "Known type definitions",
"engines": {
"node": ">=18"
},
"homepage": "https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/types-known#readme",
"license": "Apache-2.0",
"name": "@pezkuwi/types-known",
"repository": {
"directory": "packages/types-known",
"type": "git",
"url": "https://github.com/pezkuwichain/pezkuwi-api.git"
},
"sideEffects": [
"./packageDetect.js",
"./packageDetect.cjs"
],
"type": "module",
"version": "16.5.6",
"main": "index.js",
"dependencies": {
"@pezkuwi/networks": "^14.0.1",
"@pezkuwi/types": "16.5.4",
"@pezkuwi/types-codec": "16.5.4",
"@pezkuwi/types-create": "16.5.4",
"@pezkuwi/util": "^14.0.1",
"tslib": "^2.8.1"
},
"devDependencies": {
"@pezkuwi/api": "16.5.4"
}
}
+11
View File
@@ -0,0 +1,11 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
// all external
export { mapXcmTypes } from '@pezkuwi/types-create';
// all named
export { packageInfo } from './packageInfo.js';
// all starred
export * from './util.js';
+7
View File
@@ -0,0 +1,7 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { OverrideVersionedType } from '@pezkuwi/types/types';
// Type overrides based on specific nodes
export const typesChain: Record<string, OverrideVersionedType[]> = {};
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './packageDetect.js';
export * from './bundle.js';
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index.js';
+12
View File
@@ -0,0 +1,12 @@
// Copyright 2017-2026 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @pezkuwi/dev
// (packageInfo imports will be kept as-is, user-editable)
import { packageInfo as typesInfo } from '@pezkuwi/types/packageInfo';
import { detectPackage } from '@pezkuwi/util';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, [typesInfo]);
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2017-2026 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @pezkuwi/dev
export const packageInfo = { name: '@pezkuwi/types-known', path: 'auto', type: 'auto', version: '16.5.4' };
@@ -0,0 +1,116 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
const sharedTypes = {
// Anchor
AnchorData: {
anchoredBlock: 'u64',
docRoot: 'H256',
id: 'H256'
},
DispatchErrorModule: 'DispatchErrorModuleU8',
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 = {
...sharedTypes,
AccountInfo: 'AccountInfoWithRefCount',
Address: 'LookupSource',
LookupSource: 'IndicesLookupSource',
Multiplier: 'Fixed64',
RefCount: 'RefCountTo259'
};
export const versioned: OverrideVersionedType[] = [
{
minmax: [240, 243],
types: {
...standaloneTypes,
ProxyType: {
_enum: [
'Any',
'NonTransfer',
'Governance',
'Staking',
'Vesting'
]
}
}
},
{
minmax: [244, 999],
types: { ...standaloneTypes }
},
{
minmax: [1000, undefined],
types: { ...sharedTypes }
}
];
+125
View File
@@ -0,0 +1,125 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
import { mapXcmTypes } from '@pezkuwi/types-create';
const sharedTypes = {
// 16 validators
CompactAssignments: 'CompactAssignmentsWith16',
DispatchErrorModule: 'DispatchErrorModuleU8',
RawSolution: 'RawSolutionWith16',
// general
Keys: 'SessionKeys6',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances', 'IdentityJudgement', 'CancelProxy']
},
Weight: 'WeightV1'
};
const addrAccountIdTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
CompactAssignments: 'CompactAssignmentsWith16',
DispatchErrorModule: 'DispatchErrorModuleU8',
LookupSource: 'AccountId',
Keys: 'SessionKeys5',
RawSolution: 'RawSolutionWith16',
ValidatorPrefs: 'ValidatorPrefsWithCommission'
};
export const versioned: OverrideVersionedType[] = [
{
minmax: [1, 2],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
Weight: 'u32'
}
},
{
minmax: [3, 22],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259'
}
},
{
minmax: [23, 42],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
RefCount: 'RefCountTo259'
}
},
{
minmax: [43, 44],
types: {
...sharedTypes,
...addrAccountIdTypes,
DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
RefCount: 'RefCountTo259'
}
},
{
minmax: [45, 47],
types: {
...sharedTypes,
...addrAccountIdTypes
}
},
{
minmax: [48, 49],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount'
}
},
{
minmax: [50, 9099],
types: {
...sharedTypes,
...mapXcmTypes('V0')
}
},
{
minmax: [9100, 9105],
types: {
...sharedTypes,
...mapXcmTypes('V1')
}
},
{
// metadata v14
minmax: [9106, undefined],
types: {
Weight: 'WeightV1'
}
}
// ,
// {
// // weight v2 introduction
// minmax: [9300, undefined],
// types: {
// Weight: 'WeightV2'
// }
// }
];
+31
View File
@@ -0,0 +1,31 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { OverrideVersionedType } from '@pezkuwi/types/types';
import { versioned as centrifugeChain } from './centrifuge-chain.js';
import { versioned as dicle } from './dicle.js';
import { versioned as node } from './node.js';
import { versioned as nodeTemplate } from './node-template.js';
import { versioned as pezkuwi } from './pezkuwi.js';
import { versioned as pezkuwichain } from './pezkuwichain.js';
import { versioned as shell } from './shell.js';
import { versioned as statemine } from './statemine.js';
import { versioned as statemint } from './statemint.js';
import { versioned as westmint } from './westmint.js';
import { versioned as zagros } from './zagros.js';
// Type overrides for specific spec types & versions as given in runtimeVersion
export const typesSpec: Record<string, OverrideVersionedType[]> = {
'centrifuge-chain': centrifugeChain,
dicle,
node,
'node-template': nodeTemplate,
pezkuwi,
pezkuwichain,
shell,
statemine,
statemint,
zagros,
westmint
};
@@ -0,0 +1,17 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
export const versioned: OverrideVersionedType[] = [
{
minmax: [0, undefined],
types: {
// nothing, API tracks master
// (v2 weights are not yet the default)
Weight: 'WeightV2'
}
}
];
+17
View File
@@ -0,0 +1,17 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
export const versioned: OverrideVersionedType[] = [
{
minmax: [0, undefined],
types: {
// nothing, API tracks master
// (v2 weights are not yet the default)
Weight: 'WeightV2'
}
}
];
+112
View File
@@ -0,0 +1,112 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
const sharedTypes = {
CompactAssignments: 'CompactAssignmentsWith16',
DispatchErrorModule: 'DispatchErrorModuleU8',
RawSolution: 'RawSolutionWith16',
Keys: 'SessionKeys6',
ProxyType: {
_enum: {
Any: 0,
NonTransfer: 1,
Governance: 2,
Staking: 3,
UnusedSudoBalances: 4,
IdentityJudgement: 5,
CancelProxy: 6,
Auction: 7
}
},
Weight: 'WeightV1'
};
const addrAccountIdTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
DispatchErrorModule: 'DispatchErrorModuleU8',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ValidatorPrefs: 'ValidatorPrefsWithCommission'
};
// these are override types for Pezkuwi
export const versioned: OverrideVersionedType[] = [
{
minmax: [0, 10],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
ElectionResult: 'ElectionResultToSpec10'
}
},
{
minmax: [11, 12],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259'
}
},
{
minmax: [13, 22],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
RefCount: 'RefCountTo259'
}
},
{
minmax: [23, 24],
types: {
...sharedTypes,
...addrAccountIdTypes,
RefCount: 'RefCountTo259'
}
},
{
minmax: [25, 27],
types: {
...sharedTypes,
...addrAccountIdTypes
}
},
{
minmax: [28, 29],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount'
}
},
{
minmax: [30, 9109],
types: {
...sharedTypes
}
},
{
// metadata v14
minmax: [9110, undefined],
types: {
Weight: 'WeightV1'
}
}
// ,
// {
// // weight v2 introduction
// minmax: [9300, undefined],
// types: {
// Weight: 'WeightV2'
// }
// }
];
@@ -0,0 +1,73 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
import { mapXcmTypes } from '@pezkuwi/types-create';
// structs need to be in order
/* eslint-disable sort-keys */
const sharedTypes = {
DispatchErrorModule: 'DispatchErrorModuleU8',
FullIdentification: '()', // No staking, only session (as per config)
Keys: 'SessionKeys7B',
Weight: 'WeightV1'
};
export const versioned: OverrideVersionedType[] = [
{
minmax: [0, 200],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount',
Address: 'AccountId',
LookupSource: 'AccountId'
}
},
{
minmax: [201, 214],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount'
}
},
{
minmax: [215, 228],
types: {
...sharedTypes,
Keys: 'SessionKeys6'
}
},
{
minmax: [229, 9099],
types: {
...sharedTypes,
...mapXcmTypes('V0')
}
},
{
minmax: [9100, 9105],
types: {
...sharedTypes,
...mapXcmTypes('V1')
}
},
{
// metadata v14
minmax: [9106, undefined],
types: {
Weight: 'WeightV1'
}
}
// ,
// {
// // weight v2 introduction
// minmax: [9300, undefined],
// types: {
// Weight: 'WeightV2'
// }
// }
];
+15
View File
@@ -0,0 +1,15 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
export const versioned: OverrideVersionedType[] = [
{
minmax: [0, undefined],
types: {
// nothing, limited runtime
}
}
];
@@ -0,0 +1,62 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
import { mapXcmTypes } from '@pezkuwi/types-create';
const sharedTypes = {
DispatchErrorModule: 'DispatchErrorModuleU8',
TAssetBalance: 'u128',
ProxyType: {
_enum: [
'Any',
'NonTransfer',
'CancelProxy',
'Assets',
'AssetOwner',
'AssetManager',
'Staking'
]
},
Weight: 'WeightV1'
};
// these are override types for Statemine, Westmint
export const versioned: OverrideVersionedType[] = [
{
minmax: [0, 3],
types: {
// Enum was modified mid-flight -
// https://github.com/pezkuwichain/bizinikiwi/pull/10382/files#diff-e4e016b33a82268b6208dc974eea841bad47597865a749fee2f937eb6fdf67b4R498
DispatchError: 'DispatchErrorPre6First',
...sharedTypes,
...mapXcmTypes('V0')
}
},
{
minmax: [4, 5],
types: {
// As above, see https://github.com/pezkuwichain/pezkuwi-api/issues/5301
DispatchError: 'DispatchErrorPre6First',
...sharedTypes,
...mapXcmTypes('V1')
}
},
{
// metadata V14
minmax: [500, 9999],
types: {
Weight: 'WeightV1',
TAssetConversion: 'Option<AssetId>'
}
},
{
minmax: [10000, undefined],
types: {
Weight: 'WeightV1'
}
}
];
@@ -0,0 +1,74 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
import { mapXcmTypes } from '@pezkuwi/types-create';
const sharedTypes = {
DispatchErrorModule: 'DispatchErrorModuleU8',
TAssetBalance: 'u128',
ProxyType: {
_enum: [
'Any',
'NonTransfer',
'CancelProxy',
'Assets',
'AssetOwner',
'AssetManager',
'Staking'
]
},
Weight: 'WeightV1'
};
// these are override types for Statemine, Statemint, Westmint
export const versioned: OverrideVersionedType[] = [
{
minmax: [0, 3],
types: {
// Enum was modified mid-flight -
// https://github.com/pezkuwichain/bizinikiwi/pull/10382/files#diff-e4e016b33a82268b6208dc974eea841bad47597865a749fee2f937eb6fdf67b4R498
DispatchError: 'DispatchErrorPre6First',
...sharedTypes,
...mapXcmTypes('V0')
}
},
{
minmax: [4, 5],
types: {
// As above, see https://github.com/pezkuwichain/pezkuwi-api/issues/5301
DispatchError: 'DispatchErrorPre6First',
...sharedTypes,
...mapXcmTypes('V1')
}
},
{
// metadata V14
minmax: [500, 1001003],
types: {
Weight: 'WeightV1',
TAssetConversion: 'Option<AssetId>'
}
},
// ref: https://github.com/pezkuwichain/pezkuwi-api/pull/6208
// The following patches an issue where pezkuwi asset hub block 9686187, can't be decoding using xcm v5
// mappings.
{
minmax: [1002000, undefined],
types: {
Weight: 'WeightV1',
...mapXcmTypes('V4')
}
}
// ,
// {
// // weight v2 introduction
// minmax: [9300, undefined],
// types: {
// Weight: 'WeightV2'
// }
// }
];
+62
View File
@@ -0,0 +1,62 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
import { mapXcmTypes } from '@pezkuwi/types-create';
const sharedTypes = {
DispatchErrorModule: 'DispatchErrorModuleU8',
TAssetBalance: 'u128',
ProxyType: {
_enum: [
'Any',
'NonTransfer',
'CancelProxy',
'Assets',
'AssetOwner',
'AssetManager',
'Staking'
]
},
Weight: 'WeightV1'
};
// these are override types for Statemine, Westmint
export const versioned: OverrideVersionedType[] = [
{
minmax: [0, 3],
types: {
// Enum was modified mid-flight -
// https://github.com/pezkuwichain/bizinikiwi/pull/10382/files#diff-e4e016b33a82268b6208dc974eea841bad47597865a749fee2f937eb6fdf67b4R498
DispatchError: 'DispatchErrorPre6First',
...sharedTypes,
...mapXcmTypes('V0')
}
},
{
minmax: [4, 5],
types: {
// As above, see https://github.com/pezkuwichain/pezkuwi-api/issues/5301
DispatchError: 'DispatchErrorPre6First',
...sharedTypes,
...mapXcmTypes('V1')
}
},
{
// metadata V14
minmax: [500, 9434],
types: {
Weight: 'WeightV1',
TAssetConversion: 'Option<AssetId>'
}
},
{
minmax: [9435, undefined],
types: {
Weight: 'WeightV1'
}
}
];
+125
View File
@@ -0,0 +1,125 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import type { OverrideVersionedType } from '@pezkuwi/types/types';
import { mapXcmTypes } from '@pezkuwi/types-create';
const sharedTypes = {
// 16 validators
CompactAssignments: 'CompactAssignmentsWith16',
DispatchErrorModule: 'DispatchErrorModuleU8',
RawSolution: 'RawSolutionWith16',
// general
Keys: 'SessionKeys6',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances', 'IdentityJudgement', 'CancelProxy']
},
Weight: 'WeightV1'
};
const addrAccountIdTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
CompactAssignments: 'CompactAssignmentsWith16',
DispatchErrorModule: 'DispatchErrorModuleU8',
LookupSource: 'AccountId',
Keys: 'SessionKeys5',
RawSolution: 'RawSolutionWith16',
ValidatorPrefs: 'ValidatorPrefsWithCommission'
};
export const versioned: OverrideVersionedType[] = [
{
minmax: [1, 2],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
Weight: 'u32'
}
},
{
minmax: [3, 22],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259'
}
},
{
minmax: [23, 42],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
RefCount: 'RefCountTo259'
}
},
{
minmax: [43, 44],
types: {
...sharedTypes,
...addrAccountIdTypes,
DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
RefCount: 'RefCountTo259'
}
},
{
minmax: [45, 47],
types: {
...sharedTypes,
...addrAccountIdTypes
}
},
{
minmax: [48, 49],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount'
}
},
{
minmax: [50, 9099],
types: {
...sharedTypes,
...mapXcmTypes('V0')
}
},
{
minmax: [9100, 9105],
types: {
...sharedTypes,
...mapXcmTypes('V1')
}
},
{
// metadata v14
minmax: [9106, undefined],
types: {
Weight: 'WeightV1'
}
}
// ,
// {
// // weight v2 introduction
// minmax: [9300, undefined],
// types: {
// Weight: 'WeightV2'
// }
// }
];
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,66 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
import type { HexString } from '@pezkuwi/util/types';
import type { ChainUpgradesExpanded } from '../types.js';
import fs from 'node:fs';
import { ApiPromise, WsProvider } from '@pezkuwi/api';
import { stringify } from '@pezkuwi/util';
import * as allMan from '../manual/index.js';
import * as allGen from './index.js';
const keys = ['dicle', 'pezkuwi'] as const;
const urls = {
'asset-hub-dicle': 'wss://dicle-asset-hub-rpc.pezkuwichain.io',
'asset-hub-pezkuwi': 'wss://pezkuwi-asset-hub-rpc.pezkuwichain.io',
dicle: 'wss://dicle-rpc.pezkuwichain.io',
pezkuwi: 'wss://rpc.pezkuwichain.io'
};
for (const chain of keys) {
describe(`generate ${chain}`, (): void => {
const avail = allGen[chain];
const final: ChainUpgradesExpanded = [];
let api: ApiPromise;
beforeAll(async (): Promise<void> => {
api = await ApiPromise.create({ provider: new WsProvider(urls[chain]) });
});
afterAll(async (): Promise<void> => {
fs.writeFileSync(`packages/types-known/src/upgrades/e2e/${chain}.ts`, `// Copyright 2017-${new Date().getFullYear()} @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Auto-generated from on-chain data & manual definitions, do not edit
/* eslint-disable quotes, comma-spacing */
import type { ChainUpgradesExpanded } from '../types.js';
export const upgrades: ChainUpgradesExpanded = ${stringify(final, 2)};
`);
await api.disconnect();
});
for (const [blockNumber, specVersion] of allMan[chain]) {
// eslint-disable-next-line jest/expect-expect
it(`blockNumber=${blockNumber}, specVersion=${specVersion}`, async (): Promise<void> => {
const found = avail.find(([n, s]) => n === blockNumber && s === specVersion);
if (found) {
final.push(found);
} else {
const blockHash = await api.rpc.chain.getBlockHash(blockNumber + 1);
const runtime = await api.rpc.state.getRuntimeVersion(blockHash);
const apis = runtime.apis.map(([api, version]): [HexString, number] => [api.toHex(), version.toNumber()]);
final.push([blockNumber, specVersion, apis]);
}
});
}
});
}
@@ -0,0 +1,6 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { upgrades as dicle } from './dicle.js';
export { upgrades as pezkuwi } from './pezkuwi.js';
export { upgrades as zagros } from './zagros.js';
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,118 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
import type { ChainUpgradesExpanded, ChainUpgradesRaw } from './types.js';
import { stringify, u8aEq } from '@pezkuwi/util';
import * as allGen from './e2e/index.js';
import * as allMan from './manual/index.js';
import { upgrades } from './index.js';
interface TestDef {
genesisHash: string;
network: string;
versions: [number, [number, number]][];
}
const TESTS: TestDef[] = [
{
genesisHash: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe',
network: 'dicle',
versions: [
[0, [0, 1020]],
[17, [901442, 1045]]
]
},
{
genesisHash: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3',
network: 'pezkuwi',
versions: [
[0, [0, 0]],
[19, [2436698, 26]]
]
},
{
genesisHash: '0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e',
network: 'dicle',
versions: [
[0, [214356, 4]],
[23, [4207800, 48]]
]
}
];
function checkOrder (network: string, versions: [number, number, ...unknown[]][]): void {
const ooo = versions.filter((curr, index): boolean => {
const prev = versions[index - 1];
return index === 0
? false
: curr[0] <= prev[0] || curr[1] <= prev[1];
});
if (ooo.length) {
throw new Error(`${network}: Mismatched upgrade ordering: ${stringify(ooo)}`);
}
}
describe('generated', (): void => {
it('should have all the chains', (): void => {
expect(Object.keys(allMan).sort()).toEqual(Object.keys(allGen).sort());
});
for (const chain of Object.keys(allMan)) {
describe(`${chain}`, (): void => {
// eslint-disable-next-line jest/expect-expect
it('should have all generated', (): void => {
const missing = allMan[chain as keyof typeof allMan].filter(([na, sa]) =>
!allGen[chain as keyof typeof allGen].some(([nb, sb]) =>
nb === na &&
sb === sa
)
);
if (missing.length !== 0) {
throw new Error(`${chain}:: missing generated apis found, run yarn test:one packages/types-known/src/upgrades/e2e`);
}
});
// eslint-disable-next-line jest/expect-expect
it('manual should be correctly ordered', (): void => {
checkOrder(chain, (allGen as Record<string, ChainUpgradesExpanded>)[chain]);
});
// eslint-disable-next-line jest/expect-expect
it('generated should be correctly ordered', (): void => {
checkOrder(chain, (allMan as Record<string, ChainUpgradesRaw>)[chain]);
});
});
}
});
describe('upgrades', (): void => {
TESTS.forEach(({ genesisHash, network, versions }): void => {
describe(`${network}`, (): void => {
const chain = upgrades.find((n) => n.network === network);
if (!chain) {
throw new Error(`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,40 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ChainUpgrades } from '@pezkuwi/types/types';
import type { HexString } from '@pezkuwi/util/types';
import type { ChainUpgradesExpanded } from './types.js';
import { selectableNetworks } from '@pezkuwi/networks';
import { BN, hexToU8a } from '@pezkuwi/util';
import * as allKnown from './e2e/index.js';
// testnets are not available in the networks map
const NET_EXTRA: Record<string, { genesisHash: HexString[] }> = {
dicle: {
genesisHash: ['0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e']
}
};
/** @internal */
function mapRaw ([network, versions]: [string, ChainUpgradesExpanded]): ChainUpgrades {
const chain = selectableNetworks.find((n) => n.network === network) || NET_EXTRA[network];
if (!chain) {
throw new Error(`Unable to find info for chain ${network}`);
}
return {
genesisHash: hexToU8a(chain.genesisHash[0]),
network,
versions: versions.map(([blockNumber, specVersion, apis]) => ({
apis,
blockNumber: new BN(blockNumber),
specVersion: new BN(specVersion)
}))
};
}
// Type overrides for specific spec types & versions as given in runtimeVersion
export const upgrades = Object.entries<ChainUpgradesExpanded>(allKnown).map(mapRaw);
@@ -0,0 +1,27 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ChainUpgradesRaw } from '../types.js';
export 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], [8514322, 9130], [9091726, 9140], [9091774, 9150],
[9406726, 9160], [9921066, 9170], [10007115, 9180], [10480973, 9190], [10578091, 9200],
[10678509, 9210], [10811001, 9220], [11096116, 9230], [11409279, 9250], [11584820, 9251],
[11716837, 9260], [11876919, 9261], [11987927, 9270], [12077324, 9271], [12301871, 9280],
[12604343, 9290], [12841034, 9300], [13128237, 9310], [13272363, 9320], [13483497, 9330],
[13649433, 9340], [13761100, 9350], [13847400, 9360], [14249200, 9370], [14576855, 9380],
[14849830, 9390], [15146832, 9400], [15332317, 9401], [15661793, 9420], [16165469, 9430],
[18293984, 102000], [18293991, 103000], [18451783, 104000], [18679741, 1005000], [19166695, 1006000],
[19234157, 1006001], [19542944, 1007000], [19621258, 1007001], [19761406, 1008000], [20056997, 1009000],
[20368318, 1010000], [20649086, 1011000], [21217837, 1011001], [21300429, 1013000], [21460051, 1014000],
[21925427, 1015000], [22500517, 1016000], [22759684, 1016001], [23056976, 1016002], [23544582, 1017000],
[24002343, 1017001]
];
@@ -0,0 +1,6 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { upgrades as dicle } from './dicle.js';
export { upgrades as pezkuwi } from './pezkuwi.js';
export { upgrades as zagros } from './zagros.js';
@@ -0,0 +1,19 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ChainUpgradesRaw } from '../types.js';
export 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],
[8115869, 9140], [8638103, 9151], [9280179, 9170], [9738717, 9180], [10156856, 9190],
[10458576, 9200], [10655116, 9220], [10879371, 9230], [11328884, 9250], [11532856, 9260],
[11933818, 9270], [12217535, 9280], [12245277, 9281], [12532644, 9291], [12876189, 9300],
[13800015, 9340], [14188833, 9360], [14543918, 9370], [15978362, 9420], [16450000, 9430],
[17840000, 9431], [18407475, 1000001], [19551000, 1001002], [20181758, 1001003],
[20438530, 1002000], [21169168, 1002004], [21455374, 1002005], [21558004, 1002006], [21800141, 1002007]
];
@@ -0,0 +1,27 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ChainUpgradesRaw } from '../types.js';
export 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], [8514322, 9130], [9091726, 9140], [9091774, 9150],
[9406726, 9160], [9921066, 9170], [10007115, 9180], [10480973, 9190], [10578091, 9200],
[10678509, 9210], [10811001, 9220], [11096116, 9230], [11409279, 9250], [11584820, 9251],
[11716837, 9260], [11876919, 9261], [11987927, 9270], [12077324, 9271], [12301871, 9280],
[12604343, 9290], [12841034, 9300], [13128237, 9310], [13272363, 9320], [13483497, 9330],
[13649433, 9340], [13761100, 9350], [13847400, 9360], [14249200, 9370], [14576855, 9380],
[14849830, 9390], [15146832, 9400], [15332317, 9401], [15661793, 9420], [16165469, 9430],
[18293984, 102000], [18293991, 103000], [18451783, 104000], [18679741, 1005000], [19166695, 1006000],
[19234157, 1006001], [19542944, 1007000], [19621258, 1007001], [19761406, 1008000], [20056997, 1009000],
[20368318, 1010000], [20649086, 1011000], [21217837, 1011001], [21300429, 1013000], [21460051, 1014000],
[21925427, 1015000], [22500517, 1016000], [22759684, 1016001], [23056976, 1016002], [23544582, 1017000],
[24002343, 1017001]
];
@@ -0,0 +1,8 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@pezkuwi/util/types';
export type ChainUpgradesRaw = [blockNumber: number, specVersion: number][];
export type ChainUpgradesExpanded = [blockNumber: number, specVersion: number, runtimeApis: [apiHash: HexString, apiVersion: number][]][];
+128
View File
@@ -0,0 +1,128 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ExtDef } from '@pezkuwi/types/extrinsic/signedExtensions/types';
import type { Hash } from '@pezkuwi/types/interfaces';
import type { ChainUpgradeVersion, CodecHasher, DefinitionRpc, DefinitionRpcSub, DefinitionsCall, OverrideModuleType, OverrideVersionedType, Registry, RegistryTypes } from '@pezkuwi/types/types';
import type { Text } from '@pezkuwi/types-codec';
import type { BN } from '@pezkuwi/util';
import { bnToBn } from '@pezkuwi/util';
import { typesChain } from './chain/index.js';
import { typesSpec } from './spec/index.js';
import { upgrades } from './upgrades/index.js';
/**
* @description Perform the callback function using the stringified spec/chain
* @internal
* */
function withNames <T> (chainName: Text | string, specName: Text | string, fn: (c: string, s: string) => T): T {
return fn(chainName.toString(), specName.toString());
}
/**
* @descriptionFflatten a VersionedType[] into a Record<string, string>
* @internal
* */
function filterVersions (versions: OverrideVersionedType[] = [], specVersion: number): RegistryTypes {
return versions
.filter(({ minmax: [min, max] }) =>
(min === undefined || min === null || specVersion >= min) &&
(max === undefined || max === null || specVersion <= max)
)
.reduce((result: RegistryTypes, { types }) => ({ ...result, ...types }), {});
}
/**
* @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) => ({
...(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
...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 ?? {})
}));
}
/**
* @description Based on the chain or spec, return the hasher used
*/
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) => ({
...(knownTypes.typesBundle?.spec?.[s]?.rpc ?? {}),
...(knownTypes.typesBundle?.chain?.[c]?.rpc ?? {})
}));
}
/**
* @description Based on the chain and runtimeVersion, get the applicable runtime definitions (ready for registration)
*/
export function getSpecRuntime ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): DefinitionsCall {
return withNames(chainName, specName, (c, s) => ({
...(knownTypes.typesBundle?.spec?.[s]?.runtime ?? {}),
...(knownTypes.typesBundle?.chain?.[c]?.runtime ?? {})
}));
}
/**
* @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
...(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];
}
+17
View File
@@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src"
},
"exclude": [
"**/*.spec.ts",
"**/mod.ts"
],
"references": [
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-create/tsconfig.build.json" }
]
}
+19
View File
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
"emitDeclarationOnly": false,
"noEmit": true
},
"include": [
"**/*.spec.ts"
],
"references": [
{ "path": "../api/tsconfig.build.json" },
{ "path": "../types/tsconfig.build.json" },
{ "path": "../types-codec/tsconfig.build.json" },
{ "path": "../types-create/tsconfig.build.json" }
]
}