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
@@ -4,7 +4,7 @@
import type { DeriveBalancesAll } from '@pezkuwi/api-derive/types';
import type { Option } from '@pezkuwi/types';
import type { AccountId } from '@pezkuwi/types/interfaces';
import type { PalletStakingStakingLedger } from '@pezkuwi/types/lookup';
import type { PezpalletStakingStakingLedger } from '@pezkuwi/types/lookup';
import React, { useEffect, useState } from 'react';
@@ -33,7 +33,7 @@ const OPT_BOND = {
};
const OPT_STASH = {
transform: (value: Option<PalletStakingStakingLedger>): string | null =>
transform: (value: Option<PezpalletStakingStakingLedger>): string | null =>
value.isSome
? value.unwrap().stash.toString()
: null
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { DeriveBalancesAll } from '@pezkuwi/api-derive/types';
import type { PalletStakingRewardDestination } from '@pezkuwi/types/lookup';
import type { PezpalletStakingRewardDestination } from '@pezkuwi/types/lookup';
import type { DestinationType } from '../types.js';
import React, { useMemo, useState } from 'react';
@@ -15,7 +15,7 @@ import { createDestCurr } from '../destOptions.js';
import SenderInfo from '../partials/SenderInfo.js';
interface Props {
defaultDestination?: PalletStakingRewardDestination | null;
defaultDestination?: PezpalletStakingRewardDestination | null;
controllerId: string;
onClose: () => void;
stashId: string;
@@ -1,7 +1,7 @@
// Copyright 2017-2026 @pezkuwi/app-staking authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletStakingStakingLedger } from '@pezkuwi/types/lookup';
import type { PezpalletStakingStakingLedger } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import React, { useState } from 'react';
@@ -18,7 +18,7 @@ import useUnbondDuration from '../useUnbondDuration.js';
interface Props {
controllerId?: string | null;
onClose: () => void;
stakingLedger?: PalletStakingStakingLedger;
stakingLedger?: PezpalletStakingStakingLedger;
stashId: string;
}
@@ -4,7 +4,7 @@
import type { ApiPromise } from '@pezkuwi/api';
import type { DeriveBalancesAll, DeriveStakingAccount } from '@pezkuwi/api-derive/types';
import type { StakerState } from '@pezkuwi/react-hooks/types';
import type { PalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
import type { PezpalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import type { SortedTargets } from '../../types.js';
import type { Slash } from '../types.js';
@@ -31,7 +31,7 @@ import Validate from './Validate.js';
import WarnBond from './WarnBond.js';
interface Props {
allSlashes?: [BN, PalletStakingUnappliedSlash[]][];
allSlashes?: [BN, PezpalletStakingUnappliedSlash[]][];
className?: string;
isDisabled?: boolean;
info: StakerState;
@@ -41,7 +41,7 @@ interface Props {
validators?: string[];
}
function extractSlashes (stashId: string, allSlashes: [BN, PalletStakingUnappliedSlash[]][] = []): Slash[] {
function extractSlashes (stashId: string, allSlashes: [BN, PezpalletStakingUnappliedSlash[]][] = []): Slash[] {
return allSlashes
.map(([era, all]) => ({
era,
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { StakerState } from '@pezkuwi/react-hooks/types';
import type { PalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
import type { PezpalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import type { SortedTargets } from '../types.js';
@@ -14,7 +14,7 @@ import { useTranslation } from '../translate.js';
import Account from './Account/index.js';
interface Props {
allSlashes: [BN, PalletStakingUnappliedSlash[]][];
allSlashes: [BN, PezpalletStakingUnappliedSlash[]][];
className?: string;
footer: React.ReactNode;
isInElection?: boolean;
@@ -3,7 +3,7 @@
import type { DeriveSessionProgress, DeriveUnlocking } from '@pezkuwi/api-derive/types';
import type { PoolInfo } from '@pezkuwi/app-staking2/Pools/types';
import type { PalletNominationPoolsPoolMember, PalletNominationPoolsPoolRoles } from '@pezkuwi/types/lookup';
import type { PezpalletNominationPoolsPoolMember, PezpalletNominationPoolsPoolRoles } from '@pezkuwi/types/lookup';
import type { SortedTargets } from '../../types.js';
import React, { useCallback, useMemo } from 'react';
@@ -35,13 +35,13 @@ interface Roles {
isNominator: boolean;
}
function extractRoles (accountId: string, { nominator, root }: PalletNominationPoolsPoolRoles): Roles {
function extractRoles (accountId: string, { nominator, root }: PezpalletNominationPoolsPoolRoles): Roles {
return {
isNominator: nominator.eq(accountId) || root.eq(accountId)
};
}
function calcUnbonding (accountId: string, stashId: string, { activeEra }: DeriveSessionProgress, { unbondingEras }: PalletNominationPoolsPoolMember): { accountId: string, controllerId: string, redeemable: BN, stashId: string, unlocking: DeriveUnlocking[] } {
function calcUnbonding (accountId: string, stashId: string, { activeEra }: DeriveSessionProgress, { unbondingEras }: PezpalletNominationPoolsPoolMember): { accountId: string, controllerId: string, redeemable: BN, stashId: string, unlocking: DeriveUnlocking[] } {
const unlocking: DeriveUnlocking[] = [];
const redeemable = new BN(0);
@@ -3,7 +3,7 @@
import type { DeriveSessionProgress } from '@pezkuwi/api-derive/types';
import type { u32 } from '@pezkuwi/types';
import type { PalletNominationPoolsPoolMember } from '@pezkuwi/types/lookup';
import type { PezpalletNominationPoolsPoolMember } from '@pezkuwi/types/lookup';
import type { SortedTargets } from '../../types.js';
import React from 'react';
@@ -15,7 +15,7 @@ import Account from './Account.js';
interface Props {
count: number;
className?: string;
members: Record<string, PalletNominationPoolsPoolMember>;
members: Record<string, PezpalletNominationPoolsPoolMember>;
poolId: u32;
sessionProgress?: DeriveSessionProgress;
targets: SortedTargets;
@@ -1,10 +1,10 @@
// Copyright 2017-2026 @pezkuwi/app-staking authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletNominationPoolsPoolMember } from '@pezkuwi/types/lookup';
import type { PezpalletNominationPoolsPoolMember } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
export interface AccountInfo {
claimable: BN;
member: PalletNominationPoolsPoolMember;
member: PezpalletNominationPoolsPoolMember;
}
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Option } from '@pezkuwi/types';
import type { PalletNominationPoolsPoolMember } from '@pezkuwi/types/lookup';
import type { PezpalletNominationPoolsPoolMember } from '@pezkuwi/types/lookup';
import type { AccountInfo } from './types.js';
import { useEffect, useState } from 'react';
@@ -10,7 +10,7 @@ import { useEffect, useState } from 'react';
import { createNamedHook, useApi, useCall, useIsMountedRef } from '@pezkuwi/react-hooks';
const OPT_DEL = {
transform: (opt: Option<PalletNominationPoolsPoolMember>): PalletNominationPoolsPoolMember | null =>
transform: (opt: Option<PezpalletNominationPoolsPoolMember>): PezpalletNominationPoolsPoolMember | null =>
opt.unwrapOr(null)
};
+2 -2
View File
@@ -3,7 +3,7 @@
import type { DeriveSessionProgress } from '@pezkuwi/api-derive/types';
import type { OwnPool } from '@pezkuwi/app-staking2/Pools/types';
import type { PalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
import type { PezpalletStakingUnappliedSlash } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import type { SortedTargets } from '../types.js';
@@ -16,7 +16,7 @@ import { useTranslation } from '../translate.js';
import Pool from './Pool/index.js';
interface Props {
allSlashes: [BN, PalletStakingUnappliedSlash[]][];
allSlashes: [BN, PezpalletStakingUnappliedSlash[]][];
className?: string;
isInElection?: boolean;
list?: OwnPool[];
@@ -93,6 +93,7 @@ function Bond ({ className = '', isNominating, minNominated, minNominatorBond, m
// we have a batch with setController at the end
// @ts-expect-error Previous generation
? api.tx.staking.bond(stashId, amount, bondDest)
// @ts-expect-error Runtime type format
: api.tx.staking.bond(amount, bondDest),
controllerId: mapControllerId,
controllerTx: needsController
@@ -44,10 +44,11 @@ function Validate ({ className = '', controllerId, minCommission, onChange, stas
useEffect((): void => {
try {
onChange({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
validateTx: api.tx.staking.validate({
blocked: !allowNoms,
commission
})
} as any)
});
} catch {
onChange({ validateTx: null });
@@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
import type { Option } from '@pezkuwi/types';
import type { PalletStakingSlashingSlashingSpans } from '@pezkuwi/types/lookup';
import type { PezpalletStakingSlashingSlashingSpans } from '@pezkuwi/types/lookup';
import { createNamedHook, useApi, useCall } from '@pezkuwi/react-hooks';
const OPT_SPAN = {
transform: (optSpans: Option<PalletStakingSlashingSlashingSpans>): number =>
transform: (optSpans: Option<PezpalletStakingSlashingSlashingSpans>): number =>
optSpans.isNone
? 0
: optSpans.unwrap().prior.length + 1
+2 -2
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { AccountId32 } from '@pezkuwi/types/interfaces';
import type { PalletBagsListListBag } from '@pezkuwi/types/lookup';
import type { PezpalletBagsListListBag } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import type { ListNode, StashNode } from './types.js';
@@ -20,7 +20,7 @@ interface Props {
bagLower: BN;
bagUpper: BN;
index: number;
info: PalletBagsListListBag;
info: PezpalletBagsListListBag;
nodesOwn?: StashNode[];
}
+3 -3
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2026 @pezkuwi/app-staking authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PalletBagsListListBag, PalletBagsListListNode } from '@pezkuwi/types/lookup';
import type { PezpalletBagsListListBag, PezpalletBagsListListNode } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
export interface StashNode {
stashId: string;
node: PalletBagsListListNode;
node: PezpalletBagsListListNode;
}
export interface ListNode {
@@ -20,7 +20,7 @@ export interface BagInfo {
bagLower: BN;
bagUpper: BN;
index: number;
info: PalletBagsListListBag;
info: PezpalletBagsListListBag;
key: string;
}
@@ -3,7 +3,7 @@
import type { Option } from '@pezkuwi/types';
import type { AccountId32 } from '@pezkuwi/types/interfaces';
import type { PalletBagsListListNode } from '@pezkuwi/types/lookup';
import type { PezpalletBagsListListNode } from '@pezkuwi/types/lookup';
import { useEffect, useState } from 'react';
@@ -22,7 +22,7 @@ const EMPTY_LIST: AccountId32[] = [];
function useBagEntriesImpl (headId: AccountId32 | null, trigger: number): [boolean, AccountId32[]] {
const mod = useQueryModule();
const [[currId, { isCompleted, list }], setCurrent] = useState<[AccountId32 | null, Result]>(EMPTY);
const node = useCall<Option<PalletBagsListListNode>>(!!currId && mod.listNodes, [currId]);
const node = useCall<Option<PezpalletBagsListListNode>>(!!currId && mod.listNodes, [currId]);
useEffect(
() => setCurrent(
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Option, StorageKey, u64 } from '@pezkuwi/types';
import type { PalletBagsListListBag } from '@pezkuwi/types/lookup';
import type { PezpalletBagsListListBag } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
import type { BagInfo } from './types.js';
@@ -19,9 +19,9 @@ const KEY_OPTS = {
};
const MULTI_OPTS = {
transform: ([[ids], opts]: [[BN[]], Option<PalletBagsListListBag>[]]): BagInfo[] => {
transform: ([[ids], opts]: [[BN[]], Option<PezpalletBagsListListBag>[]]): BagInfo[] => {
const sorted = ids
.map((id, index): [BN, Option<PalletBagsListListBag>] => [id, opts[index]])
.map((id, index): [BN, Option<PezpalletBagsListListBag>] => [id, opts[index]])
.filter(([, o]) => o.isSome)
.sort(([a], [b]) => b.cmp(a))
.map(([bagUpper, o], index): BagInfo => ({
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Option } from '@pezkuwi/types';
import type { PalletBagsListListNode } from '@pezkuwi/types/lookup';
import type { PezpalletBagsListListNode } from '@pezkuwi/types/lookup';
import type { BagMap } from './types.js';
import { useEffect, useState } from 'react';
@@ -12,10 +12,10 @@ import { createNamedHook, useCall } from '@pezkuwi/react-hooks';
import useQueryModule from './useQueryModule.js';
const MULTI_OPTS = {
transform: (opts: Option<PalletBagsListListNode>[]): BagMap =>
transform: (opts: Option<PezpalletBagsListListNode>[]): BagMap =>
opts
.filter((o) => o.isSome)
.map((o): PalletBagsListListNode => o.unwrap())
.map((o): PezpalletBagsListListNode => o.unwrap())
.reduce((all: BagMap, node): BagMap => {
const id = node.bagUpper.toString();
+3 -3
View File
@@ -3,7 +3,7 @@
import type { Inflation } from '@pezkuwi/react-hooks/types';
import type { AccountId, Balance, BlockNumber, EraIndex, Hash, SessionIndex, ValidatorPrefs, ValidatorPrefsTo196 } from '@pezkuwi/types/interfaces';
import type { SpStakingExposurePage, SpStakingPagedExposureMetadata } from '@pezkuwi/types/lookup';
import type { PezspStakingExposurePage, PezspStakingPagedExposureMetadata } from '@pezkuwi/types/lookup';
import type { BN } from '@pezkuwi/util';
export type Nominators = Record<string, string[]>;
@@ -52,8 +52,8 @@ export interface ValidatorInfo extends ValidatorInfoRank {
bondShare: number;
bondTotal: BN;
commissionPer: number;
exposurePaged: SpStakingExposurePage;
exposureMeta: SpStakingPagedExposureMetadata
exposurePaged: PezspStakingExposurePage;
exposureMeta: PezspStakingPagedExposureMetadata
isActive: boolean;
isBlocking: boolean;
isElected: boolean;
@@ -5,7 +5,7 @@ import type { ApiPromise } from '@pezkuwi/api';
import type { DeriveSessionInfo, DeriveStakingElected, DeriveStakingWaiting } from '@pezkuwi/api-derive/types';
import type { Inflation } from '@pezkuwi/react-hooks/types';
import type { Option, u32, Vec } from '@pezkuwi/types';
import type { PalletStakingStakingLedger } from '@pezkuwi/types/lookup';
import type { PezpalletStakingStakingLedger } from '@pezkuwi/types/lookup';
import type { SortedTargets, TargetSortBy, ValidatorInfo } from './types.js';
import { useMemo } from 'react';
@@ -68,7 +68,7 @@ const OPT_MULTI = {
})
};
function getLegacyRewards (ledger: PalletStakingStakingLedger, claimedRewardsEras: Vec<u32>): u32[] {
function getLegacyRewards (ledger: PezpalletStakingStakingLedger, claimedRewardsEras: Vec<u32>): u32[] {
const legacyRewards = ledger.legacyClaimedRewards || (ledger as unknown as OldLedger).claimedRewards || [];
return legacyRewards.concat(claimedRewardsEras.toArray());
@@ -130,8 +130,8 @@ function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] {
function extractSingle (api: ApiPromise, allAccounts: string[], derive: DeriveStakingElected | DeriveStakingWaiting, favorites: string[], { activeEra, eraLength, lastEra, sessionLength }: LastEra, historyDepth?: BN, withReturns?: boolean): [ValidatorInfo[], Record<string, BN>] {
const nominators: Record<string, BN> = {};
const emptyExposure = api.createType('SpStakingExposurePage');
const emptyExposureMeta = api.createType('SpStakingPagedExposureMetadata');
const emptyExposure = api.createType('PezspStakingExposurePage');
const emptyExposureMeta = api.createType('PezspStakingPagedExposureMetadata');
const earliestEra = historyDepth && lastEra.sub(historyDepth).iadd(BN_ONE);
const list = new Array<ValidatorInfo>(derive.info.length);