Add AssetHub to types-support and test generation (#6022)
* Add AssetHub to types-support and test generation * lint
This commit is contained in:
@@ -16,6 +16,8 @@ import * as allGen from './index.js';
|
||||
|
||||
const keys = ['kusama', 'polkadot', 'westend'] as const;
|
||||
const urls = {
|
||||
'asset-hub-kusama': 'wss://kusama-asset-hub-rpc.polkadot.io',
|
||||
'asset-hub-polkadot': 'wss://polkadot-asset-hub-rpc.polkadot.io',
|
||||
kusama: 'wss://kusama-rpc.polkadot.io',
|
||||
polkadot: 'wss://rpc.polkadot.io',
|
||||
westend: 'wss://westend-rpc.polkadot.io'
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,122 @@
|
||||
// Copyright 2017-2024 @polkadot/types-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
//To run a asset-hub-kusama node please refer to types-support/src/metadata/README.md
|
||||
|
||||
export default {
|
||||
"methods": [
|
||||
"account_nextIndex",
|
||||
"archive_unstable_body",
|
||||
"archive_unstable_call",
|
||||
"archive_unstable_finalizedHeight",
|
||||
"archive_unstable_genesisHash",
|
||||
"archive_unstable_hashByHeight",
|
||||
"archive_unstable_header",
|
||||
"archive_unstable_storage",
|
||||
"author_hasKey",
|
||||
"author_hasSessionKeys",
|
||||
"author_insertKey",
|
||||
"author_pendingExtrinsics",
|
||||
"author_removeExtrinsic",
|
||||
"author_rotateKeys",
|
||||
"author_submitAndWatchExtrinsic",
|
||||
"author_submitExtrinsic",
|
||||
"author_unwatchExtrinsic",
|
||||
"chainHead_v1_body",
|
||||
"chainHead_v1_call",
|
||||
"chainHead_v1_continue",
|
||||
"chainHead_v1_follow",
|
||||
"chainHead_v1_header",
|
||||
"chainHead_v1_stopOperation",
|
||||
"chainHead_v1_storage",
|
||||
"chainHead_v1_unfollow",
|
||||
"chainHead_v1_unpin",
|
||||
"chainSpec_v1_chainName",
|
||||
"chainSpec_v1_genesisHash",
|
||||
"chainSpec_v1_properties",
|
||||
"chain_getBlock",
|
||||
"chain_getBlockHash",
|
||||
"chain_getFinalisedHead",
|
||||
"chain_getFinalizedHead",
|
||||
"chain_getHead",
|
||||
"chain_getHeader",
|
||||
"chain_getRuntimeVersion",
|
||||
"chain_subscribeAllHeads",
|
||||
"chain_subscribeFinalisedHeads",
|
||||
"chain_subscribeFinalizedHeads",
|
||||
"chain_subscribeNewHead",
|
||||
"chain_subscribeNewHeads",
|
||||
"chain_subscribeRuntimeVersion",
|
||||
"chain_unsubscribeAllHeads",
|
||||
"chain_unsubscribeFinalisedHeads",
|
||||
"chain_unsubscribeFinalizedHeads",
|
||||
"chain_unsubscribeNewHead",
|
||||
"chain_unsubscribeNewHeads",
|
||||
"chain_unsubscribeRuntimeVersion",
|
||||
"childstate_getKeys",
|
||||
"childstate_getKeysPaged",
|
||||
"childstate_getKeysPagedAt",
|
||||
"childstate_getStorage",
|
||||
"childstate_getStorageEntries",
|
||||
"childstate_getStorageHash",
|
||||
"childstate_getStorageSize",
|
||||
"dev_getBlockStats",
|
||||
"offchain_localStorageGet",
|
||||
"offchain_localStorageSet",
|
||||
"payment_queryFeeDetails",
|
||||
"payment_queryInfo",
|
||||
"rpc_methods",
|
||||
"state_call",
|
||||
"state_callAt",
|
||||
"state_getChildReadProof",
|
||||
"state_getKeys",
|
||||
"state_getKeysPaged",
|
||||
"state_getKeysPagedAt",
|
||||
"state_getMetadata",
|
||||
"state_getPairs",
|
||||
"state_getReadProof",
|
||||
"state_getRuntimeVersion",
|
||||
"state_getStorage",
|
||||
"state_getStorageAt",
|
||||
"state_getStorageHash",
|
||||
"state_getStorageHashAt",
|
||||
"state_getStorageSize",
|
||||
"state_getStorageSizeAt",
|
||||
"state_queryStorage",
|
||||
"state_queryStorageAt",
|
||||
"state_subscribeRuntimeVersion",
|
||||
"state_subscribeStorage",
|
||||
"state_traceBlock",
|
||||
"state_trieMigrationStatus",
|
||||
"state_unsubscribeRuntimeVersion",
|
||||
"state_unsubscribeStorage",
|
||||
"subscribe_newHead",
|
||||
"system_accountNextIndex",
|
||||
"system_addLogFilter",
|
||||
"system_addReservedPeer",
|
||||
"system_chain",
|
||||
"system_chainType",
|
||||
"system_dryRun",
|
||||
"system_dryRunAt",
|
||||
"system_health",
|
||||
"system_localListenAddresses",
|
||||
"system_localPeerId",
|
||||
"system_name",
|
||||
"system_nodeRoles",
|
||||
"system_peers",
|
||||
"system_properties",
|
||||
"system_removeReservedPeer",
|
||||
"system_reservedPeers",
|
||||
"system_resetLogFilter",
|
||||
"system_syncState",
|
||||
"system_unstable_networkState",
|
||||
"system_version",
|
||||
"transactionWatch_v1_submitAndWatch",
|
||||
"transactionWatch_v1_unwatch",
|
||||
"transaction_v1_broadcast",
|
||||
"transaction_v1_stop",
|
||||
"unsubscribe_newHead"
|
||||
]
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
// Copyright 2017-2024 @polkadot/types-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
//To run a asset-hub-kusama node please refer to types-support/src/metadata/README.md
|
||||
|
||||
export default {
|
||||
"specName": "statemine",
|
||||
"implName": "statemine",
|
||||
"authoringVersion": 1,
|
||||
"specVersion": 1003000,
|
||||
"implVersion": 0,
|
||||
"apis": [
|
||||
[
|
||||
"0xdd718d5cc53262d4",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xd7bdd8a272ca0d65",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xdf6acb689907609b",
|
||||
5
|
||||
],
|
||||
[
|
||||
"0x37e397fc7c91f5e4",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0x40fe3ad401f8959a",
|
||||
6
|
||||
],
|
||||
[
|
||||
"0xd2bc9897eed08f15",
|
||||
3
|
||||
],
|
||||
[
|
||||
"0xf78b278be53f454c",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0xab3c0572291feb8b",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xbc9d89904f5b923f",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x8a8047a53a8277ec",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x37c8bb1350a9a2a8",
|
||||
4
|
||||
],
|
||||
[
|
||||
"0xf3ff14d5ab527059",
|
||||
3
|
||||
],
|
||||
[
|
||||
"0x6ff52ee858e6c5bd",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x91b1c8b16328eb92",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x9ffb505aa738d69c",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xde92b8a0426b9bf6",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0xea93e3f16f3d6962",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0xfbc577b9d747efd6",
|
||||
1
|
||||
]
|
||||
],
|
||||
"transactionVersion": 15,
|
||||
"stateVersion": 0
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,122 @@
|
||||
// Copyright 2017-2024 @polkadot/types-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
//To run a asset-hub-polkadot node please refer to types-support/src/metadata/README.md
|
||||
|
||||
export default {
|
||||
"methods": [
|
||||
"account_nextIndex",
|
||||
"archive_unstable_body",
|
||||
"archive_unstable_call",
|
||||
"archive_unstable_finalizedHeight",
|
||||
"archive_unstable_genesisHash",
|
||||
"archive_unstable_hashByHeight",
|
||||
"archive_unstable_header",
|
||||
"archive_unstable_storage",
|
||||
"author_hasKey",
|
||||
"author_hasSessionKeys",
|
||||
"author_insertKey",
|
||||
"author_pendingExtrinsics",
|
||||
"author_removeExtrinsic",
|
||||
"author_rotateKeys",
|
||||
"author_submitAndWatchExtrinsic",
|
||||
"author_submitExtrinsic",
|
||||
"author_unwatchExtrinsic",
|
||||
"chainHead_v1_body",
|
||||
"chainHead_v1_call",
|
||||
"chainHead_v1_continue",
|
||||
"chainHead_v1_follow",
|
||||
"chainHead_v1_header",
|
||||
"chainHead_v1_stopOperation",
|
||||
"chainHead_v1_storage",
|
||||
"chainHead_v1_unfollow",
|
||||
"chainHead_v1_unpin",
|
||||
"chainSpec_v1_chainName",
|
||||
"chainSpec_v1_genesisHash",
|
||||
"chainSpec_v1_properties",
|
||||
"chain_getBlock",
|
||||
"chain_getBlockHash",
|
||||
"chain_getFinalisedHead",
|
||||
"chain_getFinalizedHead",
|
||||
"chain_getHead",
|
||||
"chain_getHeader",
|
||||
"chain_getRuntimeVersion",
|
||||
"chain_subscribeAllHeads",
|
||||
"chain_subscribeFinalisedHeads",
|
||||
"chain_subscribeFinalizedHeads",
|
||||
"chain_subscribeNewHead",
|
||||
"chain_subscribeNewHeads",
|
||||
"chain_subscribeRuntimeVersion",
|
||||
"chain_unsubscribeAllHeads",
|
||||
"chain_unsubscribeFinalisedHeads",
|
||||
"chain_unsubscribeFinalizedHeads",
|
||||
"chain_unsubscribeNewHead",
|
||||
"chain_unsubscribeNewHeads",
|
||||
"chain_unsubscribeRuntimeVersion",
|
||||
"childstate_getKeys",
|
||||
"childstate_getKeysPaged",
|
||||
"childstate_getKeysPagedAt",
|
||||
"childstate_getStorage",
|
||||
"childstate_getStorageEntries",
|
||||
"childstate_getStorageHash",
|
||||
"childstate_getStorageSize",
|
||||
"dev_getBlockStats",
|
||||
"offchain_localStorageGet",
|
||||
"offchain_localStorageSet",
|
||||
"payment_queryFeeDetails",
|
||||
"payment_queryInfo",
|
||||
"rpc_methods",
|
||||
"state_call",
|
||||
"state_callAt",
|
||||
"state_getChildReadProof",
|
||||
"state_getKeys",
|
||||
"state_getKeysPaged",
|
||||
"state_getKeysPagedAt",
|
||||
"state_getMetadata",
|
||||
"state_getPairs",
|
||||
"state_getReadProof",
|
||||
"state_getRuntimeVersion",
|
||||
"state_getStorage",
|
||||
"state_getStorageAt",
|
||||
"state_getStorageHash",
|
||||
"state_getStorageHashAt",
|
||||
"state_getStorageSize",
|
||||
"state_getStorageSizeAt",
|
||||
"state_queryStorage",
|
||||
"state_queryStorageAt",
|
||||
"state_subscribeRuntimeVersion",
|
||||
"state_subscribeStorage",
|
||||
"state_traceBlock",
|
||||
"state_trieMigrationStatus",
|
||||
"state_unsubscribeRuntimeVersion",
|
||||
"state_unsubscribeStorage",
|
||||
"subscribe_newHead",
|
||||
"system_accountNextIndex",
|
||||
"system_addLogFilter",
|
||||
"system_addReservedPeer",
|
||||
"system_chain",
|
||||
"system_chainType",
|
||||
"system_dryRun",
|
||||
"system_dryRunAt",
|
||||
"system_health",
|
||||
"system_localListenAddresses",
|
||||
"system_localPeerId",
|
||||
"system_name",
|
||||
"system_nodeRoles",
|
||||
"system_peers",
|
||||
"system_properties",
|
||||
"system_removeReservedPeer",
|
||||
"system_reservedPeers",
|
||||
"system_resetLogFilter",
|
||||
"system_syncState",
|
||||
"system_unstable_networkState",
|
||||
"system_version",
|
||||
"transactionWatch_v1_submitAndWatch",
|
||||
"transactionWatch_v1_unwatch",
|
||||
"transaction_v1_broadcast",
|
||||
"transaction_v1_stop",
|
||||
"unsubscribe_newHead"
|
||||
]
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
// Copyright 2017-2024 @polkadot/types-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
//To run a asset-hub-polkadot node please refer to types-support/src/metadata/README.md
|
||||
|
||||
export default {
|
||||
"specName": "statemint",
|
||||
"implName": "statemint",
|
||||
"authoringVersion": 1,
|
||||
"specVersion": 1003003,
|
||||
"implVersion": 0,
|
||||
"apis": [
|
||||
[
|
||||
"0xdd718d5cc53262d4",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xd7bdd8a272ca0d65",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xdf6acb689907609b",
|
||||
5
|
||||
],
|
||||
[
|
||||
"0x37e397fc7c91f5e4",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0x40fe3ad401f8959a",
|
||||
6
|
||||
],
|
||||
[
|
||||
"0xd2bc9897eed08f15",
|
||||
3
|
||||
],
|
||||
[
|
||||
"0xf78b278be53f454c",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0xab3c0572291feb8b",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xbc9d89904f5b923f",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x37c8bb1350a9a2a8",
|
||||
4
|
||||
],
|
||||
[
|
||||
"0xf3ff14d5ab527059",
|
||||
3
|
||||
],
|
||||
[
|
||||
"0x6ff52ee858e6c5bd",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x91b1c8b16328eb92",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x9ffb505aa738d69c",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0xde92b8a0426b9bf6",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0xea93e3f16f3d6962",
|
||||
2
|
||||
],
|
||||
[
|
||||
"0xfbc577b9d747efd6",
|
||||
1
|
||||
],
|
||||
[
|
||||
"0x8a8047a53a8277ec",
|
||||
1
|
||||
]
|
||||
],
|
||||
"transactionVersion": 15,
|
||||
"stateVersion": 0
|
||||
};
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2024 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import assetHubKusamaData from '@polkadot/types-support/metadata/v15/asset-hub-kusama-hex';
|
||||
import assetHubPolkadotData from '@polkadot/types-support/metadata/v15/asset-hub-polkadot-hex';
|
||||
import kusamaData from '@polkadot/types-support/metadata/v15/kusama-hex';
|
||||
import polkadotData from '@polkadot/types-support/metadata/v15/polkadot-hex';
|
||||
import substrateData from '@polkadot/types-support/metadata/v15/substrate-hex';
|
||||
@@ -8,6 +10,12 @@ import substrateData from '@polkadot/types-support/metadata/v15/substrate-hex';
|
||||
import { testMeta } from '../util/testUtil.js';
|
||||
|
||||
testMeta(15, {
|
||||
'asset-hub-kusama': {
|
||||
data: assetHubKusamaData
|
||||
},
|
||||
'asset-hub-polkadot': {
|
||||
data: assetHubPolkadotData
|
||||
},
|
||||
kusama: {
|
||||
data: kusamaData
|
||||
},
|
||||
|
||||
@@ -7,6 +7,8 @@ import { fetch } from '@polkadot/x-fetch';
|
||||
|
||||
const PREAMBLE = '// Copyright 2017-2024 @polkadot/types-support authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable */\n\n';
|
||||
const CMD = {
|
||||
'asset-hub-kusama': `${PREAMBLE}//To run a asset-hub-kusama node please refer to types-support/src/metadata/README.md\n\nexport default`,
|
||||
'asset-hub-polkadot': `${PREAMBLE}//To run a asset-hub-polkadot node please refer to types-support/src/metadata/README.md\n\nexport default`,
|
||||
kusama: `${PREAMBLE}// cargo run --release -- purge-chain -y --chain kusama-dev && cargo run --release -- --chain kusama-dev --alice --force-authoring\n\nexport default`,
|
||||
polkadot: `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`,
|
||||
substrate: `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`,
|
||||
@@ -17,6 +19,25 @@ const CMD = {
|
||||
const META_VERSION_HEX = '0x0f000000';
|
||||
const META_VERSION = 15;
|
||||
|
||||
/**
|
||||
* Parse the specName given any exceptions.
|
||||
*
|
||||
* @param {'polkadot' | 'kusama' | 'node' | 'statemint' | 'statemine'} specName
|
||||
* @returns {'polkadot' | 'kusama' | 'substrate' | 'asset-hub-kusama' | 'asset-hub-polkadot'}
|
||||
*/
|
||||
const parseChainName = (specName) => {
|
||||
switch (specName) {
|
||||
case 'node':
|
||||
return 'substrate';
|
||||
case 'statemine':
|
||||
return 'asset-hub-kusama';
|
||||
case 'statemint':
|
||||
return 'asset-hub-polkadot';
|
||||
default:
|
||||
return specName;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Small CLI parser.
|
||||
*
|
||||
@@ -64,16 +85,14 @@ const main = async () => {
|
||||
return body.result;
|
||||
}
|
||||
|
||||
/** @type {[string[], string, { specName: 'polkadot' | 'kusama' | 'node'; specVersion: string; }]} */
|
||||
/** @type {[string[], string, { specName: 'polkadot' | 'kusama' | 'node' | 'statemine' | 'statemint'; specVersion: string; }]} */
|
||||
const [methods, metadata, version] = await Promise.all([
|
||||
get('rpc_methods'),
|
||||
get('state_call', ['Metadata_metadata_at_version', META_VERSION_HEX]),
|
||||
get('state_getRuntimeVersion')
|
||||
]);
|
||||
const chain = version.specName === 'node'
|
||||
? 'substrate'
|
||||
: version.specName;
|
||||
const metaVer = parseInt(metadata.substring(10, 12), 16);
|
||||
const chain = parseChainName(version.specName);
|
||||
const metaVer = parseInt(metadata.substring(20, 22), 16);
|
||||
const path = `packages/types-support/src/metadata/v${META_VERSION}/${chain}`;
|
||||
|
||||
fs.writeFileSync(`${path}-hex.ts`, `${CMD[chain]} '${metadata}';\n`);
|
||||
|
||||
Reference in New Issue
Block a user