From 2e5b0a2213bf5e86819505411ddc9cb113aa40c6 Mon Sep 17 00:00:00 2001 From: Shamilkhan <32759781+shamilkhan@users.noreply.github.com> Date: Fri, 18 Aug 2023 00:08:49 +0400 Subject: [PATCH] Add typeBundle for Cere Network (#9789) * Add typeBundle for Cere Network * Add auto generation of Cere Network type bundle. --- packages/apps-config/src/api/chain/cere.ts | 83 +++++++++++++++++++++ packages/apps-config/src/api/chain/index.ts | 2 + packages/apps-config/src/api/typesBundle.ts | 78 +++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 packages/apps-config/src/api/chain/cere.ts diff --git a/packages/apps-config/src/api/chain/cere.ts b/packages/apps-config/src/api/chain/cere.ts new file mode 100644 index 0000000000..4a6117a0de --- /dev/null +++ b/packages/apps-config/src/api/chain/cere.ts @@ -0,0 +1,83 @@ +// Copyright 2017-2023 @polkadot/apps-config authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +/* eslint-disable sort-keys */ +const definitions: OverrideBundleDefinition = { + types: [ + { + minmax: [ + 266, + 281 + ], + types: { + ChainId: 'u8', + DepositNonce: 'u64', + ResourceId: '[u8; 32]', + ProposalStatus: { + _enum: [ + 'Initiated', + 'Approved', + 'Rejected' + ] + }, + ProposalVotes: { + votes_for: 'Vec', + votes_against: 'Vec', + status: 'ProposalStatus', + expiry: 'BlockNumber' + }, + TokenId: 'u256', + Erc721Token: { + id: 'TokenId', + metadata: 'Vec' + }, + Address: 'IndicesLookupSource', + LookupSource: 'IndicesLookupSource', + AccountInfo: 'AccountInfoWithDualRefCount', + ValidatorPrefs: { + commission: 'Compact' + } + } + }, + { + minmax: [ + 282, + 294 + ], + types: { + ChainId: 'u8', + DepositNonce: 'u64', + ResourceId: '[u8; 32]', + ProposalStatus: { + _enum: [ + 'Initiated', + 'Approved', + 'Rejected' + ] + }, + ProposalVotes: { + votes_for: 'Vec', + votes_against: 'Vec', + status: 'ProposalStatus', + expiry: 'BlockNumber' + }, + TokenId: 'u256', + Erc721Token: { + id: 'TokenId', + metadata: 'Vec' + }, + Address: 'MultiAddress', + LookupSource: 'MultiAddress', + AccountInfo: 'AccountInfoWithDualRefCount' + } + }, + { + minmax: [295, null], + types: {} + } + ] +}; + +export default definitions; diff --git a/packages/apps-config/src/api/chain/index.ts b/packages/apps-config/src/api/chain/index.ts index 34faa6ff4a..0c8f8053bc 100644 --- a/packages/apps-config/src/api/chain/index.ts +++ b/packages/apps-config/src/api/chain/index.ts @@ -3,10 +3,12 @@ import type { OverrideBundleDefinition } from '@polkadot/types/types'; +import cere from './cere.js'; import kilt from './kilt.js'; // NOTE: The mapping is done from chain name in system.chain const chain: Record = { + 'Cere Mainnet Beta': cere, 'KILT Mashnet': kilt['KILT Mashnet'], 'KILT Peregrine': kilt['KILT Peregrine'], 'KILT Peregrine Stagenet': kilt['KILT Peregrine Stagenet'], diff --git a/packages/apps-config/src/api/typesBundle.ts b/packages/apps-config/src/api/typesBundle.ts index 19e2c2b3fb..bb44285769 100644 --- a/packages/apps-config/src/api/typesBundle.ts +++ b/packages/apps-config/src/api/typesBundle.ts @@ -11,6 +11,84 @@ import type { OverrideBundleType } from '@polkadot/types/types'; export const typesBundle = { "chain": { + "Cere Mainnet Beta": { + "types": [ + { + "minmax": [ + 266, + 281 + ], + "types": { + "ChainId": "u8", + "DepositNonce": "u64", + "ResourceId": "[u8; 32]", + "ProposalStatus": { + "_enum": [ + "Initiated", + "Approved", + "Rejected" + ] + }, + "ProposalVotes": { + "votes_for": "Vec", + "votes_against": "Vec", + "status": "ProposalStatus", + "expiry": "BlockNumber" + }, + "TokenId": "u256", + "Erc721Token": { + "id": "TokenId", + "metadata": "Vec" + }, + "Address": "IndicesLookupSource", + "LookupSource": "IndicesLookupSource", + "AccountInfo": "AccountInfoWithDualRefCount", + "ValidatorPrefs": { + "commission": "Compact" + } + } + }, + { + "minmax": [ + 282, + 294 + ], + "types": { + "ChainId": "u8", + "DepositNonce": "u64", + "ResourceId": "[u8; 32]", + "ProposalStatus": { + "_enum": [ + "Initiated", + "Approved", + "Rejected" + ] + }, + "ProposalVotes": { + "votes_for": "Vec", + "votes_against": "Vec", + "status": "ProposalStatus", + "expiry": "BlockNumber" + }, + "TokenId": "u256", + "Erc721Token": { + "id": "TokenId", + "metadata": "Vec" + }, + "Address": "MultiAddress", + "LookupSource": "MultiAddress", + "AccountInfo": "AccountInfoWithDualRefCount" + } + }, + { + "minmax": [ + 295, + null + ], + "types": {} + } + ] + }, "KILT Mashnet": { "runtime": { "DidApi": [