Files
pwap/pezkuwi-sdk-ui/packages/page-staking2/src/Pools/usePoolAccounts.ts
T
pezkuwichain 971df8edba Rebrand: Remove 3rd party chains, update domains to PezkuwiChain
- Remove all 3rd party parachain configurations from endpoints:
  - productionRelayPolkadot.ts: Keep only system parachains
  - productionRelayDicle.ts: Keep only system parachains
  - testingRelayZagros.ts: Keep only system parachains
  - testingRelayTeyrChain.ts: Keep only system parachains

- Update domain references:
  - polkadot.js.org → pezkuwichain.app
  - wiki.polkadot.network → wiki.pezkuwichain.io
  - dotapps.io → pezkuwichain.app
  - statement.polkadot.network → docs.pezkuwichain.io/statement
  - support.polkadot.network → docs.pezkuwichain.io

- Update repository references:
  - github.com/pezkuwi-js/apps → github.com/pezkuwichain/pwap

- Rename system parachains to Pezkuwi ecosystem:
  - PolkadotAssetHub → PezkuwiAssetHub
  - polkadotBridgeHub → pezkuwiBridgeHub
  - polkadotCollectives → pezkuwiCollectives
  - polkadotCoretime → pezkuwiCoretime
  - polkadotPeople → pezkuwiPeople

- Update network name in claims utility:
  - Polkadot → Pezkuwi
2026-01-09 03:08:11 +03:00

46 lines
1.3 KiB
TypeScript

// Copyright 2017-2026 @pezkuwi/app-staking authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiPromise } from '@pezkuwi/api';
import type { BN } from '@pezkuwi/util';
import type { PoolAccounts } from './types.js';
import { useMemo } from 'react';
import { createNamedHook, useApi } from '@pezkuwi/react-hooks';
import { bnToU8a, stringToU8a, u8aConcat } from '@pezkuwi/util';
const EMPTY_H256 = new Uint8Array(32);
const MOD_PREFIX = stringToU8a('modl');
const U32_OPTS = { bitLength: 32, isLe: true };
function createAccount (api: ApiPromise, palletId: Uint8Array, poolId: BN, index: number): string {
return api.registry.createType('AccountId32', u8aConcat(
MOD_PREFIX,
palletId,
new Uint8Array([index]),
bnToU8a(poolId, U32_OPTS),
EMPTY_H256
)).toString();
}
export function createAccounts (api: ApiPromise, poolId: BN): PoolAccounts {
const palletId = api.consts.nominationPools.palletId.toU8a();
return {
rewardId: createAccount(api, palletId, poolId, 1),
stashId: createAccount(api, palletId, poolId, 0)
};
}
function usePoolAccountsImpl (poolId: BN): PoolAccounts {
const { api } = useApi();
return useMemo(
() => createAccounts(api, poolId),
[api, poolId]
);
}
export default createNamedHook('usePoolAccounts', usePoolAccountsImpl);