diff --git a/src/config/networks.ts b/src/config/networks.ts index c4a33b74b3..feb863bc27 100644 --- a/src/config/networks.ts +++ b/src/config/networks.ts @@ -19,10 +19,15 @@ import BigNumber from 'bignumber.js'; // DEPRECATION: Paged Rewards // -// Temporary until paged rewards migration has completed on all networks. -export const NetworksWithPagedRewards: NetworkName[] = ['westend', 'kusama']; +// Temporary until paged rewards migration has completed on all networks. Wait 84 eras from Polkadot +// start: 1420 + 84 = 1504, when full history depth will be moved over to new paged rewards storage. +export const NetworksWithPagedRewards: NetworkName[] = [ + 'polkadot', + 'kusama', + 'westend', +]; export const PagedRewardsStartEra: Record = { - polkadot: null, + polkadot: new BigNumber(1420), kusama: new BigNumber(6514), westend: new BigNumber(7167), }; diff --git a/src/consts.ts b/src/consts.ts index 27b6c996e5..8198b4fae9 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -6,7 +6,7 @@ import { stringToU8a } from '@polkadot/util'; /* * Global Constants */ -export const AppVersion = '1.3.1'; +export const AppVersion = '1.4.2'; export const DappName = 'Polkadot Staking Dashboard'; export const PolkadotUrl = 'https://polkadot.network/features/staking/'; export const ManualSigners = ['ledger', 'vault']; diff --git a/src/controllers/IdentitiesController/index.ts b/src/controllers/IdentitiesController/index.ts index 7e2605ec4f..4aedf5013a 100644 --- a/src/controllers/IdentitiesController/index.ts +++ b/src/controllers/IdentitiesController/index.ts @@ -1,7 +1,7 @@ // Copyright 2024 @paritytech/polkadot-staking-dashboard authors & contributors // SPDX-License-Identifier: GPL-3.0-only -import type { AnyApi } from 'types'; +import type { AnyApi, AnyJson } from 'types'; import type { ApiPromise } from '@polkadot/api'; export class IdentitiesController { @@ -11,8 +11,16 @@ export class IdentitiesController { const result = (await api.query.identity.identityOf.multi(addresses)).map( (identity) => identity.toHuman() ); + + // Take identity data (first index) of results. + const data = result.map( + (resultArray: AnyJson | null) => resultArray?.[0] || null + ); + return Object.fromEntries( - result.map((k, i) => [addresses[i], k]).filter(([, v]) => v !== null) + data + .map((key: string, index: number) => [addresses[index], key]) + .filter(([, value]: AnyJson) => value !== null) ); }; @@ -21,6 +29,7 @@ export class IdentitiesController { const supersRaw = (await api.query.identity.superOf.multi(addresses)).map( (superOf) => superOf.toHuman() ); + const supers = Object.fromEntries( supersRaw .map((k, i) => [ @@ -38,12 +47,17 @@ export class IdentitiesController { ) ).map((superIdentity) => superIdentity.toHuman()); + // Take identity data (first index) of results. + const data = superIdentities.map( + (resultArray: AnyJson | null) => resultArray?.[0] || null + ); + const supersWithIdentity = Object.fromEntries( Object.entries(supers).map(([k, v]: AnyApi, i) => [ k, { ...v, - identity: superIdentities[i], + identity: data[i], }, ]) );