fix: update extension packages and fix type compatibility for pezkuwi-sdk

- Update @pezkuwi/extension-inject to ^0.62.13 with proper /types exports
- Update @pezkuwi/extension-dapp to ^0.62.13
- Update @pezkuwi/extension-compat-metamask to ^0.62.13
- Fix IconTheme type to include 'bizinikiwi' and 'pezkuwi' themes
- Fix endpoint array issues (getTeleports -> direct array references)
- Add type assertions for external package compatibility (acala, moonbeam, parallel)
- Fix subspace.ts dynamic class typing
- Fix conviction type in page-referenda
- Update Pallet type names to Pezpallet prefix across codebase
- Define InjectedExtension types locally for module resolution
- Add styled-components DefaultTheme augmentation
- Add react-copy-to-clipboard type declaration for React 18

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-08 16:24:19 +03:00
parent e64f846b0d
commit 7a4bbeac25
570 changed files with 3281 additions and 3030 deletions
+25 -1
View File
@@ -4,14 +4,38 @@
import type { Blockchain } from '@acala-network/chopsticks-core';
import type { ApiPromise } from '@pezkuwi/api';
import type { SubmittableExtrinsicFunction } from '@pezkuwi/api/promise/types';
import type { Signer as InjectedSigner } from '@pezkuwi/api/types';
import type { HeaderExtended } from '@pezkuwi/api-derive/types';
import type { LinkOption } from '@pezkuwi/apps-config/endpoints/types';
import type { InjectedExtension } from '@pezkuwi/extension-inject/types';
import type { ProviderStats } from '@pezkuwi/rpc-provider/types';
import type { BlockNumber, EventRecord, Moment } from '@pezkuwi/types/interfaces';
import type { BN } from '@pezkuwi/util';
import type { AssetInfoComplete } from '../types.js';
// InjectedExtension type from extension-inject (defined locally for module resolution)
interface InjectedExtensionInfo {
name: string;
version: string;
}
interface InjectedAccount {
address: string;
genesisHash?: string | null;
name?: string;
}
interface InjectedAccounts {
get: (anyType?: boolean) => Promise<InjectedAccount[]>;
subscribe: (cb: (accounts: InjectedAccount[]) => void | Promise<void>) => () => void;
}
interface Injected {
accounts: InjectedAccounts;
signer: InjectedSigner;
}
export interface InjectedExtension extends InjectedExtensionInfo, Injected {}
export interface ApiState {
apiDefaultTx: SubmittableExtrinsicFunction;
apiDefaultTxSudo: SubmittableExtrinsicFunction;
+12
View File
@@ -0,0 +1,12 @@
// Copyright 2017-2026 @pezkuwi/react-hooks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import 'styled-components';
import type { ThemeDef } from '@pezkuwi/react-components/types';
declare module 'styled-components' {
export interface DefaultTheme {
theme: ThemeDef['theme'];
}
}
+14 -14
View File
@@ -9,7 +9,7 @@ import type { SubmittableExtrinsic } from '@pezkuwi/api/types';
import type { DeriveAccountFlags, DeriveAccountRegistration } from '@pezkuwi/api-derive/types';
import type { Option, u32, u128, Vec } from '@pezkuwi/types';
import type { AccountId, BlockNumber, Call, Hash, SessionIndex, ValidatorPrefs } from '@pezkuwi/types/interfaces';
import type { PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletPreimageRequestStatus, PalletStakingRewardDestination, PalletStakingStakingLedger, PezkuwiRuntimeTeyrchainsAssignerCoretimeCoreDescriptor, SpStakingExposurePage, SpStakingPagedExposureMetadata } from '@pezkuwi/types/lookup';
import type { PezpalletAssetsAssetDetails, PezpalletAssetsAssetMetadata, PezpalletPreimageRequestStatus, PezpalletStakingRewardDestination, PezpalletStakingStakingLedger, PezkuwiRuntimeTeyrchainsAssignerCoretimeCoreDescriptor, PezspStakingExposurePage, PezspStakingPagedExposureMetadata } from '@pezkuwi/types/lookup';
import type { ICompact, IExtrinsic, INumber } from '@pezkuwi/types/types';
import type { KeyringJson$Meta } from '@pezkuwi/ui-keyring/types';
import type { BN } from '@pezkuwi/util';
@@ -54,19 +54,19 @@ export interface Inflation {
}
export interface AssetInfo {
details: PalletAssetsAssetDetails | null;
details: PezpalletAssetsAssetDetails | null;
id: BN;
isAdminMe: boolean;
isIssuerMe: boolean;
isFreezerMe: boolean;
isOwnerMe: boolean;
key: string;
metadata: PalletAssetsAssetMetadata | null;
metadata: PezpalletAssetsAssetMetadata | null;
}
export interface AssetInfoComplete extends AssetInfo {
details: PalletAssetsAssetDetails;
metadata: PalletAssetsAssetMetadata;
details: PezpalletAssetsAssetDetails;
metadata: PezpalletAssetsAssetMetadata;
}
export interface Slash {
@@ -159,9 +159,9 @@ export interface UseAccountInfo {
export interface StakerState {
controllerId: string | null;
destination?: PalletStakingRewardDestination | null;
exposurePaged?: Option<SpStakingExposurePage>;
exposureMeta?: Option<SpStakingPagedExposureMetadata>
destination?: PezpalletStakingRewardDestination | null;
exposurePaged?: Option<PezspStakingExposurePage>;
exposureMeta?: Option<PezspStakingPagedExposureMetadata>
claimedRewardsEras?: Vec<u32>
hexSessionIdNext: string | null;
hexSessionIdQueue: string | null;
@@ -172,7 +172,7 @@ export interface StakerState {
isStashValidating: boolean;
nominating?: string[];
sessionIds: string[];
stakingLedger?: PalletStakingStakingLedger;
stakingLedger?: PezpalletStakingStakingLedger;
stashId: string;
validatorPrefs?: ValidatorPrefs;
}
@@ -201,7 +201,7 @@ export interface PreimageStatus {
isHashParam: boolean;
proposalHash: HexString;
proposalLength?: BN;
status: PalletPreimageRequestStatus | null;
status: PezpalletPreimageRequestStatus | null;
}
export interface PreimageBytes {
@@ -307,7 +307,7 @@ export interface LegacyLease {
task: string
}
export interface PalletBrokerSaleInfoRecord {
export interface PezpalletBrokerSaleInfoRecord {
saleStart: number;
leadinLength: number;
endPrice: BN;
@@ -320,7 +320,7 @@ export interface PalletBrokerSaleInfoRecord {
coresSold: number;
}
export interface PalletBrokerConfigRecord {
export interface PezpalletBrokerConfigRecord {
advanceNotice: number;
interludeLength: number;
leadinLength: number;
@@ -360,10 +360,10 @@ export interface ChainConstants {
export interface CoretimeInformation {
constants: ChainConstants,
chainInfo: Record<number, ChainInformation>,
salesInfo: PalletBrokerSaleInfoRecord,
salesInfo: PezpalletBrokerSaleInfoRecord,
status: BrokerStatus,
region: RegionInfo[],
config: PalletBrokerConfigRecord
config: PezpalletBrokerConfigRecord
taskIds: number[]
}
+4 -4
View File
@@ -3,7 +3,7 @@
import type { Option } from '@pezkuwi/types';
import type { AccountId } from '@pezkuwi/types/interfaces';
import type { PalletAssetsAssetDetails, PalletAssetsAssetMetadata } from '@pezkuwi/types/lookup';
import type { PezpalletAssetsAssetDetails, PezpalletAssetsAssetMetadata } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import type { AssetInfo } from './types.js';
@@ -26,7 +26,7 @@ function isAccount (allAccounts: string[], accountId: AccountId): boolean {
return allAccounts.some((a) => a === address);
}
function extractInfo (allAccounts: string[], id: BN, optDetails: Option<PalletAssetsAssetDetails>, metadata: PalletAssetsAssetMetadata): AssetInfo {
function extractInfo (allAccounts: string[], id: BN, optDetails: Option<PezpalletAssetsAssetDetails>, metadata: PezpalletAssetsAssetMetadata): AssetInfo {
const details = optDetails.unwrapOr(null);
return {
@@ -54,8 +54,8 @@ function useAssetInfosImpl (ids?: BN[]): AssetInfo[] | undefined {
const isReady = useMemo(() => !!ids?.length && !!api.tx.assets?.setMetadata && !!api.tx.assets?.transferKeepAlive, [api.tx.assets?.setMetadata, api.tx.assets?.transferKeepAlive, ids?.length]);
const metadata = useCall<[[BN[]], PalletAssetsAssetMetadata[]]>(isReady && api.query.assets.metadata.multi, [ids], QUERY_OPTS);
const details = useCall<[[BN[]], Option<PalletAssetsAssetDetails>[]]>(isReady && api.query.assets.asset.multi, [ids], QUERY_OPTS);
const metadata = useCall<[[BN[]], PezpalletAssetsAssetMetadata[]]>(isReady && api.query.assets.metadata.multi, [ids], QUERY_OPTS);
const details = useCall<[[BN[]], Option<PezpalletAssetsAssetDetails>[]]>(isReady && api.query.assets.asset.multi, [ids], QUERY_OPTS);
const [state, setState] = useState<AssetInfo[] | undefined>();
useEffect((): void => {
@@ -5,7 +5,7 @@ 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 { PalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
import type { PezpalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
import { useEffect, useMemo, useState } from 'react';
@@ -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)
);
});
+5 -5
View File
@@ -3,14 +3,14 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Option } from '@pezkuwi/types';
import type { PalletBrokerConfigRecord } from '@pezkuwi/types/lookup';
import type { PalletBrokerConfigRecord as SimplifiedPalletBrokerConfigRecord } from './types.js';
import type { PezpalletBrokerConfigRecord } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerConfigRecord as SimplifiedPezpalletBrokerConfigRecord } from './types.js';
import { useEffect, useState } from 'react';
import { createNamedHook, useCall } from '@pezkuwi/react-hooks';
function extractInfo (config: Option<PalletBrokerConfigRecord>): SimplifiedPalletBrokerConfigRecord {
function extractInfo (config: Option<PezpalletBrokerConfigRecord>): SimplifiedPezpalletBrokerConfigRecord {
const c = config.unwrap();
return {
@@ -26,9 +26,9 @@ function extractInfo (config: Option<PalletBrokerConfigRecord>): SimplifiedPalle
}
function useBrokerConfigImpl (api: ApiPromise, ready: boolean) {
const config = useCall<Option<PalletBrokerConfigRecord>>(ready && api?.query.broker.configuration);
const config = useCall<Option<PezpalletBrokerConfigRecord>>(ready && api?.query.broker.configuration);
const [state, setState] = useState<SimplifiedPalletBrokerConfigRecord | undefined>();
const [state, setState] = useState<SimplifiedPezpalletBrokerConfigRecord | undefined>();
useEffect((): void => {
!!config && !!config.isSome && !!config.toJSON() &&
+2 -2
View File
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Vec } from '@pezkuwi/types';
import type { PalletBrokerLeaseRecordItem } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerLeaseRecordItem } from '@pezkuwi/types/lookup';
import type { LegacyLease } from './types.js';
import { useEffect, useState } from 'react';
@@ -11,7 +11,7 @@ import { useEffect, useState } from 'react';
import { createNamedHook, useCall } from '@pezkuwi/react-hooks';
function useBrokerLeasesImpl (api: ApiPromise, ready: boolean): LegacyLease[] | undefined {
const leases = useCall<Vec<PalletBrokerLeaseRecordItem>>(ready && api?.query?.broker?.leases);
const leases = useCall<Vec<PezpalletBrokerLeaseRecordItem>>(ready && api?.query?.broker?.leases);
const [state, setState] = useState<LegacyLease[]>();
useEffect((): void => {
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Option, StorageKey, u32 } from '@pezkuwi/types';
import type { PalletBrokerPotentialRenewalId, PalletBrokerPotentialRenewalRecord } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerPotentialRenewalId, PezpalletBrokerPotentialRenewalRecord } from '@pezkuwi/types/lookup';
import type { PotentialRenewal } from './types.js';
import { useEffect, useState } from 'react';
@@ -13,8 +13,8 @@ import { BN_ZERO } from '@pezkuwi/util';
import { processHexMask } from './utils/dataProcessing.js';
function extractInfo (info: Option<PalletBrokerPotentialRenewalRecord>, item: PalletBrokerPotentialRenewalId): PotentialRenewal | undefined {
const unwrapped: PalletBrokerPotentialRenewalRecord | null = info.isSome ? info.unwrap() : null;
function extractInfo (info: Option<PezpalletBrokerPotentialRenewalRecord>, item: PezpalletBrokerPotentialRenewalId): PotentialRenewal | undefined {
const unwrapped: PezpalletBrokerPotentialRenewalRecord | null = info.isSome ? info.unwrap() : null;
let mask: string[] = [];
let task = '';
@@ -55,7 +55,7 @@ const OPT_KEY = {
function useBrokerPotentialRenewalsImpl (api: ApiPromise, ready: boolean): PotentialRenewal[] | undefined {
const keys = useMapKeys(ready && api?.query.broker.potentialRenewals, [], OPT_KEY);
const potentialRenewals = useCall<[[PalletBrokerPotentialRenewalId[]], Option<PalletBrokerPotentialRenewalRecord>[]]>(ready && api?.query.broker.potentialRenewals.multi, [keys], { withParams: true });
const potentialRenewals = useCall<[[PezpalletBrokerPotentialRenewalId[]], Option<PezpalletBrokerPotentialRenewalRecord>[]]>(ready && api?.query.broker.potentialRenewals.multi, [keys], { withParams: true });
const [state, setState] = useState<PotentialRenewal[] | undefined>();
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Vec } from '@pezkuwi/types';
import type { PalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
import type { Reservation } from './types.js';
import { useEffect, useState } from 'react';
@@ -13,7 +13,7 @@ import { createNamedHook, useCall } from '@pezkuwi/react-hooks';
import { processHexMask } from './utils/dataProcessing.js';
function useBrokerReservationsImpl (api: ApiPromise, ready: boolean): Reservation[] | undefined {
const reservations = useCall<[any, Vec<Vec<PalletBrokerScheduleItem>>[]]>(ready && api?.query.broker.reservations);
const reservations = useCall<[any, Vec<Vec<PezpalletBrokerScheduleItem>>[]]>(ready && api?.query.broker.reservations);
const [state, setState] = useState<Reservation[]>();
useEffect((): void => {
@@ -22,7 +22,7 @@ function useBrokerReservationsImpl (api: ApiPromise, ready: boolean): Reservatio
}
setState(
reservations.map((info: PalletBrokerScheduleItem[]) => {
reservations.map((info: PezpalletBrokerScheduleItem[]) => {
return {
mask: processHexMask(info[0]?.mask),
maskBits: processHexMask(info[0]?.mask)?.length ?? 0,
@@ -3,15 +3,15 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Option } from '@pezkuwi/types';
import type { PalletBrokerSaleInfoRecord } from '@pezkuwi/types/lookup';
import type { PalletBrokerSaleInfoRecord as SimplifiedPalletBrokerSaleInfoRecord } from './types.js';
import type { PezpalletBrokerSaleInfoRecord } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerSaleInfoRecord as SimplifiedPezpalletBrokerSaleInfoRecord } from './types.js';
import { useEffect, useState } from 'react';
import { createNamedHook, useCall } from '@pezkuwi/react-hooks';
import { BN } from '@pezkuwi/util';
function extractInfo (record: Option<PalletBrokerSaleInfoRecord>): SimplifiedPalletBrokerSaleInfoRecord {
function extractInfo (record: Option<PezpalletBrokerSaleInfoRecord>): SimplifiedPezpalletBrokerSaleInfoRecord {
const v = record.unwrap();
return {
@@ -29,9 +29,9 @@ function extractInfo (record: Option<PalletBrokerSaleInfoRecord>): SimplifiedPal
}
function useBrokerSalesInfoImpl (api: ApiPromise, ready: boolean) {
const record = useCall<Option<PalletBrokerSaleInfoRecord>>(ready && api?.query.broker.saleInfo);
const record = useCall<Option<PezpalletBrokerSaleInfoRecord>>(ready && api?.query.broker.saleInfo);
const [state, setState] = useState<SimplifiedPalletBrokerSaleInfoRecord | undefined>();
const [state, setState] = useState<SimplifiedPezpalletBrokerSaleInfoRecord | undefined>();
useEffect((): void => {
!!record && !!record.isSome && !!record.toJSON() &&
+2 -2
View File
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Option } from '@pezkuwi/types';
import type { PalletBrokerStatusRecord } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerStatusRecord } from '@pezkuwi/types/lookup';
import type { BrokerStatus } from './types.js';
import { useEffect, useState } from 'react';
@@ -11,7 +11,7 @@ import { useEffect, useState } from 'react';
import { createNamedHook, useCall } from '@pezkuwi/react-hooks';
function useBrokerStatusImpl (api: ApiPromise, ready: boolean): BrokerStatus | undefined {
const status = useCall<Option<PalletBrokerStatusRecord>>(ready && api?.query.broker?.status);
const status = useCall<Option<PezpalletBrokerStatusRecord>>(ready && api?.query.broker?.status);
const [state, setState] = useState<BrokerStatus | undefined>();
useEffect((): void => {
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { StorageKey, u32 } from '@pezkuwi/types';
import type { PalletBrokerCoretimeInterfaceCoreAssignment, PezkuwiRuntimeTeyrchainsAssignerCoretimeAssignmentState, PezkuwiRuntimeTeyrchainsAssignerCoretimeCoreDescriptor, PezkuwiRuntimeTeyrchainsAssignerCoretimeQueueDescriptor, PezkuwiRuntimeTeyrchainsAssignerCoretimeWorkState } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerCoretimeInterfaceCoreAssignment, PezkuwiRuntimeTeyrchainsAssignerCoretimeAssignmentState, PezkuwiRuntimeTeyrchainsAssignerCoretimeCoreDescriptor, PezkuwiRuntimeTeyrchainsAssignerCoretimeQueueDescriptor, PezkuwiRuntimeTeyrchainsAssignerCoretimeWorkState } from '@pezkuwi/types/lookup';
import type { CoreDescriptor } from './types.js';
import { useEffect, useState } from 'react';
@@ -20,7 +20,7 @@ function extractInfo (info: PezkuwiRuntimeTeyrchainsAssignerCoretimeCoreDescript
core,
info: {
currentWork: {
assignments: assignments?.map((one: [PalletBrokerCoretimeInterfaceCoreAssignment, PezkuwiRuntimeTeyrchainsAssignerCoretimeAssignmentState]) => {
assignments: assignments?.map((one: [PezpalletBrokerCoretimeInterfaceCoreAssignment, PezkuwiRuntimeTeyrchainsAssignerCoretimeAssignmentState]) => {
return ({
isPool: one[0]?.isPool,
isTask: one[0]?.isTask,
+3 -3
View File
@@ -1,17 +1,17 @@
// Copyright 2017-2026 @pezkuwi/react-hooks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletDemocracyVoteVoting } from '@pezkuwi/types/lookup';
import type { PezpalletDemocracyVoteVoting } from '@pezkuwi/types/lookup';
import { useAccounts, useApi, useCall } from '@pezkuwi/react-hooks';
import { createNamedHook } from './createNamedHook.js';
function useDelegationsImpl (): PalletDemocracyVoteVoting[] | undefined {
function useDelegationsImpl (): PezpalletDemocracyVoteVoting[] | undefined {
const { api } = useApi();
const { allAccounts } = useAccounts();
return useCall<PalletDemocracyVoteVoting[]>(api.query.democracy?.votingOf?.multi, [allAccounts]);
return useCall<PezpalletDemocracyVoteVoting[]>(api.query.democracy?.votingOf?.multi, [allAccounts]);
}
export const useDelegations = createNamedHook('useDelegations', useDelegationsImpl);
+2 -2
View File
@@ -6,7 +6,7 @@ import type { ApiPromise } from '@pezkuwi/api';
import type { DeriveEraPoints, DeriveEraRewards, DeriveStakerReward } from '@pezkuwi/api-derive/types';
import type { u32, Vec } from '@pezkuwi/types';
import type { EraIndex } from '@pezkuwi/types/interfaces';
import type { PalletStakingStakingLedger } from '@pezkuwi/types/lookup';
import type { PezpalletStakingStakingLedger } from '@pezkuwi/types/lookup';
import type { StakerState } from './types.js';
import { useCallback, useEffect, useState } from 'react';
@@ -46,7 +46,7 @@ const EMPTY_STATE: State = {
rewardCount: 0
};
function getLegacyRewards (ledger: PalletStakingStakingLedger, claimedRewardsEras?: Vec<u32>): u32[] {
function getLegacyRewards (ledger: PezpalletStakingStakingLedger, claimedRewardsEras?: Vec<u32>): u32[] {
const legacyRewards = ledger.legacyClaimedRewards || (ledger as unknown as { claimedRewards: u32[] }).claimedRewards || [];
return legacyRewards.concat(claimedRewardsEras?.toArray() || []);
+8 -8
View File
@@ -4,7 +4,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Bytes, u32, u128 } from '@pezkuwi/types';
import type { AccountId, Hash } from '@pezkuwi/types/interfaces';
import type { FrameSupportPreimagesBounded, PalletPreimageRequestStatus } from '@pezkuwi/types/lookup';
import type { PezframeSupportPreimagesBounded, PezpalletPreimageRequestStatus } from '@pezkuwi/types/lookup';
import type { ITuple } from '@pezkuwi/types/types';
import type { HexString } from '@pezkuwi/util/types';
import type { Preimage, PreimageDeposit, PreimageStatus } from './types.js';
@@ -65,7 +65,7 @@ export function getParamType (api: ApiPromise): Result {
}
/** @internal Unwraps a passed preimage hash into components */
export function getPreimageHash (api: ApiPromise, hashOrBounded: Hash | HexString | FrameSupportPreimagesBounded): StatusParams {
export function getPreimageHash (api: ApiPromise, hashOrBounded: Hash | HexString | PezframeSupportPreimagesBounded): StatusParams {
let proposalHash: HexString | undefined;
let inlineData: Uint8Array | undefined;
@@ -84,7 +84,7 @@ export function getPreimageHash (api: ApiPromise, hashOrBounded: Hash | HexStrin
} else if (hashOrBounded.isLookup) {
proposalHash = hashOrBounded.asLookup.hash_.toHex();
} else {
console.error(`Unhandled FrameSupportPreimagesBounded type ${hashOrBounded.type}`);
console.error(`Unhandled PezframeSupportPreimagesBounded type ${hashOrBounded.type}`);
}
}
@@ -165,7 +165,7 @@ function convertDeposit (deposit?: [AccountId, u128] | null): PreimageDeposit |
}
/** @internal Returns the parameters required for a call to bytes */
function getBytesParams (interimResult: PreimageStatus, someOptStatus: Option<PalletPreimageRequestStatus>): BytesParams {
function getBytesParams (interimResult: PreimageStatus, someOptStatus: Option<PezpalletPreimageRequestStatus>): BytesParams {
const result = objectSpread<PreimageStatus>({}, interimResult, {
status: someOptStatus.unwrapOr(null)
});
@@ -201,7 +201,7 @@ function getBytesParams (interimResult: PreimageStatus, someOptStatus: Option<Pa
result.proposalLength = asUnrequested.len;
}
} else {
console.error(`Unhandled PalletPreimageRequestStatus type: ${result.status.type}`);
console.error(`Unhandled PezpalletPreimageRequestStatus type: ${result.status.type}`);
}
}
@@ -213,7 +213,7 @@ function getBytesParams (interimResult: PreimageStatus, someOptStatus: Option<Pa
};
}
function usePreimageImpl (hashOrBounded?: Hash | HexString | FrameSupportPreimagesBounded | null): Preimage | undefined {
function usePreimageImpl (hashOrBounded?: Hash | HexString | PezframeSupportPreimagesBounded | null): Preimage | undefined {
const { api } = useApi();
// retrieve the status using only the hash of the image
@@ -226,8 +226,8 @@ function usePreimageImpl (hashOrBounded?: Hash | HexString | FrameSupportPreimag
// api.query.preimage.statusFor has been deprecated in favor of api.query.preimage.requestStatusFor.
// To ensure we get all preimages correctly we query both storages. see: https://github.com/pezkuwichain/pezkuwi-apps/pull/10310
const optStatus = useCall<Option<PalletPreimageRequestStatus>>(!inlineData && paramsStatus && api.query.preimage?.statusFor, paramsStatus);
const optRequstStatus = useCall<Option<PalletPreimageRequestStatus>>(!inlineData && paramsStatus && api.query.preimage?.requestStatusFor, paramsStatus);
const optStatus = useCall<Option<PezpalletPreimageRequestStatus>>(!inlineData && paramsStatus && api.query.preimage?.statusFor, paramsStatus);
const optRequstStatus = useCall<Option<PezpalletPreimageRequestStatus>>(!inlineData && paramsStatus && api.query.preimage?.requestStatusFor, paramsStatus);
const someOptStatus = optStatus?.isSome ? optStatus : optRequstStatus;
// from the retrieved status (if any), get the on-chain stored bytes
+7 -7
View File
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { AccountId } from '@pezkuwi/types/interfaces';
import type { KitchensinkRuntimeProxyType, PalletProxyProxyDefinition } from '@pezkuwi/types/lookup';
import type { KitchensinkRuntimeProxyType, PezpalletProxyProxyDefinition } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import { createNamedHook } from './createNamedHook.js';
@@ -12,11 +12,11 @@ import { useApi } from './useApi.js';
import { useCall } from './useCall.js';
const OPTS = {
transform: (result: [([AccountId, KitchensinkRuntimeProxyType] | PalletProxyProxyDefinition)[], BN][], api: ApiPromise): [PalletProxyProxyDefinition[], BN][] =>
transform: (result: [([AccountId, KitchensinkRuntimeProxyType] | PezpalletProxyProxyDefinition)[], BN][], api: ApiPromise): [PezpalletProxyProxyDefinition[], BN][] =>
api.tx.proxy.addProxy.meta.args.length === 3
? result as [PalletProxyProxyDefinition[], BN][]
: (result as [[AccountId, KitchensinkRuntimeProxyType][], BN][]).map(([arr, bn]): [PalletProxyProxyDefinition[], BN] =>
[arr.map(([delegate, proxyType]): PalletProxyProxyDefinition =>
? result as [PezpalletProxyProxyDefinition[], BN][]
: (result as [[AccountId, KitchensinkRuntimeProxyType][], BN][]).map(([arr, bn]): [PezpalletProxyProxyDefinition[], BN] =>
[arr.map(([delegate, proxyType]): PezpalletProxyProxyDefinition =>
api.createType('ProxyDefinition', {
delegate,
proxyType
@@ -24,11 +24,11 @@ const OPTS = {
)
};
function useProxiesImpl (): [PalletProxyProxyDefinition[], BN][] | undefined {
function useProxiesImpl (): [PezpalletProxyProxyDefinition[], BN][] | undefined {
const { api } = useApi();
const { allAccounts } = useAccounts();
return useCall<[PalletProxyProxyDefinition[], BN][]>(api.query.proxy?.proxies.multi, [allAccounts], OPTS);
return useCall<[PezpalletProxyProxyDefinition[], BN][]>(api.query.proxy?.proxies.multi, [allAccounts], OPTS);
}
export const useProxies = createNamedHook('useProxies', useProxiesImpl);
+3 -3
View File
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Option, StorageKey } from '@pezkuwi/types';
import type { PalletBrokerRegionId, PalletBrokerRegionRecord } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerRegionId, PezpalletBrokerRegionRecord } from '@pezkuwi/types/lookup';
import type { RegionInfo } from './types.js';
import { useEffect, useState } from 'react';
@@ -22,14 +22,14 @@ function extractInfo (core: number, start: number, end: number, owner: string, p
}
const OPT_KEY = {
transform: (keys: StorageKey<[PalletBrokerRegionId]>[]): PalletBrokerRegionId[] =>
transform: (keys: StorageKey<[PezpalletBrokerRegionId]>[]): PezpalletBrokerRegionId[] =>
keys.map(({ args: [regionId] }) => regionId)
};
function useRegionsImpl (api: ApiPromise): RegionInfo[] | undefined {
const regionKeys = useMapKeys(api?.query?.broker.regions, [], OPT_KEY);
const regionInfo = useCall<[[PalletBrokerRegionId[]], Option<PalletBrokerRegionRecord>[]]>(api?.query?.broker.regions.multi, [regionKeys], { withParams: true });
const regionInfo = useCall<[[PezpalletBrokerRegionId[]], Option<PezpalletBrokerRegionRecord>[]]>(api?.query?.broker.regions.multi, [regionKeys], { withParams: true });
const [state, setState] = useState<RegionInfo[] | undefined>();
+3 -3
View File
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { StorageKey, u32, Vec } from '@pezkuwi/types';
import type { PalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import type { CoreWorkload } from './types.js';
@@ -23,7 +23,7 @@ export function sortByCore<T extends { core: number }> (dataArray?: T | T[]): T[
return sanitized.sort((a, b) => a.core - b.core);
}
function extractInfo (info: PalletBrokerScheduleItem[], core: number): CoreWorkload {
function extractInfo (info: PezpalletBrokerScheduleItem[], core: number): CoreWorkload {
const mask: string[] = processHexMask(info[0]?.mask);
const assignment = info[0].assignment;
@@ -46,7 +46,7 @@ const OPT_KEY = {
function useWorkloadInfosImpl (api: ApiPromise, ready: boolean): CoreWorkload[] | undefined {
const cores = useMapKeys(ready && api?.query.broker.workload, [], OPT_KEY);
const workloadInfo = useCall<[[BN[]], Vec<PalletBrokerScheduleItem>[]]>(ready && api?.query.broker.workload.multi, [cores], { withParams: true });
const workloadInfo = useCall<[[BN[]], Vec<PezpalletBrokerScheduleItem>[]]>(ready && api?.query.broker.workload.multi, [cores], { withParams: true });
const [state, setState] = useState<CoreWorkload[] | undefined>();
useEffect((): void => {
+3 -3
View File
@@ -3,7 +3,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { Option, StorageKey, u16, u32, Vec } from '@pezkuwi/types';
import type { PalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import type { CoreWorkplan } from './types.js';
@@ -23,7 +23,7 @@ export function sortByCore<T extends { core: number }> (dataArray?: T | T[]): T[
return sanitized.sort((a, b) => a.core - b.core);
}
function extractInfo (info: Vec<PalletBrokerScheduleItem>, core: number, timeslice: number): CoreWorkplan {
function extractInfo (info: Vec<PezpalletBrokerScheduleItem>, core: number, timeslice: number): CoreWorkplan {
const mask: string[] = processHexMask(info[0]?.mask);
const assignment = info[0].assignment;
@@ -52,7 +52,7 @@ function useWorkplanInfosImpl (api: ApiPromise, ready: boolean): CoreWorkplan[]
return value[0];
});
const workplanInfo = useCall<[[[u32, u16][]], Option<Vec<PalletBrokerScheduleItem>>[]]>(ready && api?.query.broker.workplan.multi, [sanitizedKeys], { withParams: true });
const workplanInfo = useCall<[[[u32, u16][]], Option<Vec<PezpalletBrokerScheduleItem>>[]]>(ready && api?.query.broker.workplan.multi, [sanitizedKeys], { withParams: true });
const [state, setState] = useState<CoreWorkplan[] | undefined>();
@@ -1,7 +1,7 @@
// Copyright 2017-2026 @pezkuwi/react-hooks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
import type { PezpalletBrokerScheduleItem } from '@pezkuwi/types/lookup';
import { BN } from '@pezkuwi/util';
@@ -9,7 +9,7 @@ export function hexToBin (hex: string): string {
return parseInt(hex, 16).toString(2);
}
export function processHexMask (mask: PalletBrokerScheduleItem['mask'] | undefined): string[] {
export function processHexMask (mask: PezpalletBrokerScheduleItem['mask'] | undefined): string[] {
if (!mask) {
return [];
}