mirror of
https://github.com/pezkuwichain/pezkuwi-sdk-ui.git
synced 2026-06-12 20:31:10 +00:00
d949863789
Comprehensive web interface for interacting with Pezkuwi blockchain. Features: - Blockchain explorer - Wallet management - Staking interface - Governance participation - Developer tools Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
// Copyright 2017-2026 @pezkuwi/app-alliance authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { bool, Option, UInt } from '@pezkuwi/types';
|
|
import type { MemberInfo } from './types.js';
|
|
|
|
import { useMemo } from 'react';
|
|
|
|
import { createNamedHook, useApi, useCall } from '@pezkuwi/react-hooks';
|
|
|
|
function useMemberInfoImpl (accountId: string): MemberInfo | undefined {
|
|
const { api } = useApi();
|
|
const upForKicking = useCall<bool>(api.query.alliance.upForKicking, [accountId]);
|
|
const retiringAt = useCall<Option<UInt>>(api.query.alliance.retiringMembers, [accountId]);
|
|
const depositOf = useCall<Option<UInt>>(api.query.alliance.depositOf, [accountId]);
|
|
|
|
return useMemo(
|
|
() => depositOf && {
|
|
accountId,
|
|
deposit: depositOf.unwrapOr(null),
|
|
isUpForKicking: upForKicking && upForKicking.isTrue,
|
|
retiringAt: retiringAt?.unwrapOr(null)
|
|
},
|
|
[accountId, depositOf, retiringAt, upForKicking]
|
|
);
|
|
}
|
|
|
|
export default createNamedHook('useMemberInfo', useMemberInfoImpl);
|