diff --git a/CHANGELOG.md b/CHANGELOG.md index a6b563da7c5d..a77dacae2036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # CHANGELOG ## vNext +... + +## 0.24.0 - Added Type Bundle for Cere Mainnet to be able to see all historical blocks ## 0.23.0 diff --git a/package.json b/package.json index 72e7898248ff..54e216e50502 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "url": "https://github.com/polkadot-js/apps.git" }, "sideEffects": false, - "version": "0.23.0", + "version": "0.24.0", "workspaces": [ "packages/*" ], diff --git a/packages/apps-config/src/api/chain/cere.ts b/packages/apps-config/src/api/chain/cere.ts index 9b23ffe3ecdb..a62f1996d2d3 100644 --- a/packages/apps-config/src/api/chain/cere.ts +++ b/packages/apps-config/src/api/chain/cere.ts @@ -1,28 +1,82 @@ -// Copyright 2017-2021 @polkadot/apps-config authors & contributors +// Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -// structs need to be in order -/* eslint-disable sort-keys */ +import type { OverrideBundleDefinition } from '@polkadot/types/types'; -export default { - 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' +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 new file mode 100644 index 000000000000..3db012621cc3 --- /dev/null +++ b/packages/apps-config/src/api/chain/index.ts @@ -0,0 +1,13 @@ +// Copyright 2017-2023 @polkadot/apps-config authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +import cere from './cere.js'; + +// NOTE: The mapping is done from chain name in system.chain +const chain: Record = { + 'Cere Mainnet Beta': cere +}; + +export default chain; diff --git a/packages/apps-config/src/api/typesBundle.spec.ts b/packages/apps-config/src/api/typesBundle.spec.ts index 846629fa7990..139c0372218b 100644 --- a/packages/apps-config/src/api/typesBundle.spec.ts +++ b/packages/apps-config/src/api/typesBundle.spec.ts @@ -5,11 +5,16 @@ import fs from 'fs'; import { objectSpread } from '@polkadot/util'; +import chain from './chain/index.js'; import spec from './spec'; it('generates the typesBundle', (): void => { const specEntries = Object.entries(spec); - const typesBundle: { spec: Record } = { spec: {} }; + const chainEntries = Object.entries(chain); + const typesBundle: { + chain: Record + spec: Record + } = { chain: {}, spec: {} }; specEntries.forEach(([k, v]): void => { const value = objectSpread<{ derives: unknown }>({}, v); @@ -19,6 +24,14 @@ it('generates the typesBundle', (): void => { typesBundle.spec[k] = value; }); + chainEntries.forEach(([k, v]): void => { + const value = objectSpread<{ derives: unknown }>({}, v); + + delete value.derives; + + typesBundle.chain[k] = value; + }); + fs.writeFileSync('packages/apps-config/src/api/typesBundle.ts', `// Copyright 2017-2022 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 diff --git a/packages/apps-config/src/api/typesBundle.ts b/packages/apps-config/src/api/typesBundle.ts index b257252a91f8..73b50b4597b3 100644 --- a/packages/apps-config/src/api/typesBundle.ts +++ b/packages/apps-config/src/api/typesBundle.ts @@ -81,11 +81,14 @@ export const typesBundle = { } }, { - "minmax": [295, null], + "minmax": [ + 295, + null + ], "types": {} } ] - }, + } }, "spec": { "Crab": {