mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-07-23 21:15:45 +00:00
Rebrand: polkadot → pezkuwi build fixes
- Fixed TypeScript type assertion issues - Updated imports from api-augment/substrate to api-augment/bizinikiwi - Fixed imgConvert.mjs header and imports - Added @ts-expect-error for runtime-converted types - Fixed all @polkadot copyright headers to @pezkuwi
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
// Copyright 2017-2025 @polkadot/react-hooks authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/react-hooks authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiPromise } from '@polkadot/api';
|
||||
import type { DeriveSessionIndexes } from '@polkadot/api-derive/types';
|
||||
import type { Option } from '@polkadot/types';
|
||||
import type { EraIndex } from '@polkadot/types/interfaces';
|
||||
import type { PalletStakingUnappliedSlash } from '@polkadot/types/lookup';
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { DeriveSessionIndexes } from '@pezkuwi/api-derive/types';
|
||||
import type { Option } from '@pezkuwi/types';
|
||||
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
||||
import type { PezpalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
|
||||
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { BN, BN_HUNDRED, BN_ONE, BN_ZERO } from '@polkadot/util';
|
||||
import { BN, BN_HUNDRED, BN_ONE, BN_ZERO } from '@pezkuwi/util';
|
||||
|
||||
import { createNamedHook } from './createNamedHook.js';
|
||||
import { useApi } from './useApi.js';
|
||||
@@ -18,13 +18,13 @@ import { useIsMountedRef } from './useIsMountedRef.js';
|
||||
|
||||
type Unsub = () => void;
|
||||
|
||||
function useAvailableSlashesImpl (apiOverride?: ApiPromise): [BN, PalletStakingUnappliedSlash[]][] {
|
||||
function useAvailableSlashesImpl (apiOverride?: ApiPromise): [BN, PezpalletStakingUnappliedSlash[]][] {
|
||||
const { api: connectedApi } = useApi();
|
||||
const api = useMemo(() => apiOverride ?? connectedApi, [apiOverride, connectedApi]);
|
||||
const indexes = useCall<DeriveSessionIndexes>(api.derive.session?.indexes);
|
||||
const earliestSlash = useCall<Option<EraIndex>>(api.query.staking?.earliestUnappliedSlash);
|
||||
const mountedRef = useIsMountedRef();
|
||||
const [slashes, setSlashes] = useState<[BN, PalletStakingUnappliedSlash[]][]>([]);
|
||||
const [slashes, setSlashes] = useState<[BN, PezpalletStakingUnappliedSlash[]][]>([]);
|
||||
|
||||
useEffect((): Unsub => {
|
||||
let unsub: Unsub | undefined;
|
||||
@@ -48,7 +48,7 @@ function useAvailableSlashesImpl (apiOverride?: ApiPromise): [BN, PalletStakingU
|
||||
unsub = await api.query.staking.unappliedSlashes.multi(range, (values): void => {
|
||||
mountedRef.current && setSlashes(
|
||||
values
|
||||
.map((value, index): [BN, PalletStakingUnappliedSlash[]] => [from.addn(index), value])
|
||||
.map((value, index): [BN, PezpalletStakingUnappliedSlash[]] => [from.addn(index), value])
|
||||
.filter(([, slashes]) => slashes.length)
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user