mirror of
https://github.com/pezkuwichain/pezkuwi-sdk-ui.git
synced 2026-06-16 13:11:05 +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>
26 lines
761 B
TypeScript
26 lines
761 B
TypeScript
// Copyright 2017-2026 @pezkuwi/app-alliance authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { Option } from '@pezkuwi/types';
|
|
import type { PezpalletAllianceCid } from '@pezkuwi/types/lookup';
|
|
import type { Rule } from './types.js';
|
|
|
|
import { createNamedHook, useApi, useCall } from '@pezkuwi/react-hooks';
|
|
|
|
import { createCid } from './util.js';
|
|
|
|
const OPT_RULE = {
|
|
transform: (opt: Option<PezpalletAllianceCid>): Rule =>
|
|
opt.isSome
|
|
? { cid: createCid(opt.unwrap()), hasRule: true }
|
|
: { cid: null, hasRule: false }
|
|
};
|
|
|
|
function useRuleImpl (): Rule | undefined {
|
|
const { api } = useApi();
|
|
|
|
return useCall<Rule>(api.query.alliance.rule, [], OPT_RULE);
|
|
}
|
|
|
|
export default createNamedHook('useRule', useRuleImpl);
|