Skip to content

Commit

Permalink
Merge pull request #87 from Cerebellum-Network/release/0.24.0
Browse files Browse the repository at this point in the history
Release 0.24.0
  • Loading branch information
shamilkhan authored Aug 17, 2023
2 parents 85ac72e + ee6ba3c commit ed72d21
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 26 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## vNext
...

## 0.24.0
- Added Type Bundle for Cere Mainnet to be able to see all historical blocks

## 0.23.0
- Reverted to commit `f778359c` (between tags `v0.121.1` and `v0.122.1` of Polkadot-JS Apps) to align with our node version and fix the Smart Contract Page

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/polkadot-js/apps.git"
},
"sideEffects": false,
"version": "0.23.0",
"version": "0.24.0",
"workspaces": [
"packages/*"
],
Expand Down
102 changes: 78 additions & 24 deletions packages/apps-config/src/api/chain/cere.ts
Original file line number Diff line number Diff line change
@@ -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<AccountId>',
votes_against: 'Vec<AccountId>',
status: 'ProposalStatus',
expiry: 'BlockNumber'
},
TokenId: 'u256',
Erc721Token: {
id: 'TokenId',
metadata: 'Vec<u8>'
},
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<AccountId>',
votes_against: 'Vec<AccountId>',
status: 'ProposalStatus',
expiry: 'BlockNumber'
},
TokenId: 'u256',
Erc721Token: {
id: 'TokenId',
metadata: 'Vec<u8>'
},
Address: 'IndicesLookupSource',
LookupSource: 'IndicesLookupSource',
AccountInfo: 'AccountInfoWithDualRefCount',
ValidatorPrefs: {
commission: 'Compact<Perbill>'
}
}
},
{
minmax: [
282,
294
],
types: {
ChainId: 'u8',
DepositNonce: 'u64',
ResourceId: '[u8; 32]',
ProposalStatus: {
_enum: [
'Initiated',
'Approved',
'Rejected'
]
},
ProposalVotes: {
votes_for: 'Vec<AccountId>',
votes_against: 'Vec<AccountId>',
status: 'ProposalStatus',
expiry: 'BlockNumber'
},
TokenId: 'u256',
Erc721Token: {
id: 'TokenId',
metadata: 'Vec<u8>'
},
Address: 'MultiAddress',
LookupSource: 'MultiAddress',
AccountInfo: 'AccountInfoWithDualRefCount'
}
},
{
minmax: [295, null],
types: {}
}
]
};

export default definitions;
13 changes: 13 additions & 0 deletions packages/apps-config/src/api/chain/index.ts
Original file line number Diff line number Diff line change
@@ -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<string, OverrideBundleDefinition> = {
'Cere Mainnet Beta': cere
};

export default chain;
15 changes: 14 additions & 1 deletion packages/apps-config/src/api/typesBundle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown> } = { spec: {} };
const chainEntries = Object.entries(chain);
const typesBundle: {
chain: Record<string, unknown>
spec: Record<string, unknown>
} = { chain: {}, spec: {} };

specEntries.forEach(([k, v]): void => {
const value = objectSpread<{ derives: unknown }>({}, v);
Expand All @@ -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
Expand Down
80 changes: 80 additions & 0 deletions packages/apps-config/src/api/typesBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,86 @@ import type { OverrideBundleType } from '@polkadot/types/types';
/* eslint-disable sort-keys */

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<AccountId>",
"votes_against": "Vec<AccountId>",
"status": "ProposalStatus",
"expiry": "BlockNumber"
},
"TokenId": "u256",
"Erc721Token": {
"id": "TokenId",
"metadata": "Vec<u8>"
},
"Address": "IndicesLookupSource",
"LookupSource": "IndicesLookupSource",
"AccountInfo": "AccountInfoWithDualRefCount",
"ValidatorPrefs": {
"commission": "Compact<Perbill>"
}
}
},
{
"minmax": [
282,
294
],
"types": {
"ChainId": "u8",
"DepositNonce": "u64",
"ResourceId": "[u8; 32]",
"ProposalStatus": {
"_enum": [
"Initiated",
"Approved",
"Rejected"
]
},
"ProposalVotes": {
"votes_for": "Vec<AccountId>",
"votes_against": "Vec<AccountId>",
"status": "ProposalStatus",
"expiry": "BlockNumber"
},
"TokenId": "u256",
"Erc721Token": {
"id": "TokenId",
"metadata": "Vec<u8>"
},
"Address": "MultiAddress",
"LookupSource": "MultiAddress",
"AccountInfo": "AccountInfoWithDualRefCount"
}
},
{
"minmax": [
295,
null
],
"types": {}
}
]
}
},
"spec": {
"Crab": {
"alias": {},
Expand Down

0 comments on commit ed72d21

Please sign in to comment.