From 97344da107148bb69c03ae7fc9b643e9cde606e8 Mon Sep 17 00:00:00 2001 From: Jaco Date: Thu, 5 May 2022 13:30:47 +0200 Subject: [PATCH] Use palletId correctly for nominationPools (#7533) --- packages/page-staking/src/usePoolAccounts.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/page-staking/src/usePoolAccounts.ts b/packages/page-staking/src/usePoolAccounts.ts index 9c66958a9e..d497db02c8 100644 --- a/packages/page-staking/src/usePoolAccounts.ts +++ b/packages/page-staking/src/usePoolAccounts.ts @@ -11,20 +11,14 @@ import { createNamedHook, useApi } from '@polkadot/react-hooks'; import { bnToU8a, stringToU8a, u8aConcat } from '@polkadot/util'; const EMPTY_H256 = new Uint8Array(32); -const ADDR_PREFIX_SUB = stringToU8a('modlpy/npols'); -const ADDR_PREFIX_POL = stringToU8a('modlpy/nopls'); +const MOD_PREFIX = stringToU8a('modl'); export function createAccount (api: ApiPromise, poolId: BN, index: number): string { return api.registry.createType( 'AccountId32', u8aConcat( - // HACK: We have a naming issue between Substrate master as well as Westend. Since - // we don't quite have access to palletId, we here check the specName and adjust - // accordingly (We assume that all Polkadot will follow Westend, so keep Substrate - // as the odd one out... this may bite us) - api.runtimeVersion.specName.eq('node') - ? ADDR_PREFIX_SUB - : ADDR_PREFIX_POL, + MOD_PREFIX, + api.consts.nominationPools.palletId.toU8a(), new Uint8Array([index]), bnToU8a(poolId, { bitLength: 32 }), EMPTY_H256