mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-05-08 22:57:56 +00:00
d21bfb1320
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
31 lines
969 B
TypeScript
31 lines
969 B
TypeScript
// Copyright 2017-2025 @pezkuwi/app-staking authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { DeriveHasIdentity } from '@pezkuwi/api-derive/types';
|
|
|
|
import { createNamedHook, useApi, useCall } from '@pezkuwi/react-hooks';
|
|
|
|
type Result = Record<string, DeriveHasIdentity>;
|
|
|
|
const OPT_CALL = {
|
|
transform: ([[validatorIds], hasIdentities]: [[string[]], DeriveHasIdentity[]]): Record<string, DeriveHasIdentity> => {
|
|
const result: Record<string, DeriveHasIdentity> = {};
|
|
|
|
for (let i = 0; i < validatorIds.length; i++) {
|
|
result[validatorIds[i]] = hasIdentities[i];
|
|
}
|
|
|
|
return result;
|
|
},
|
|
withParamsTransform: true
|
|
};
|
|
|
|
function useIdentitiesImpl (validatorIds: string[] = []): Result | undefined {
|
|
const { api } = useApi();
|
|
const allIdentity = useCall<Result>(api.derive.accounts.hasIdentityMulti, [validatorIds], OPT_CALL);
|
|
|
|
return allIdentity;
|
|
}
|
|
|
|
export default createNamedHook('useIdentities', useIdentitiesImpl);
|