mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-04-28 21:47:55 +00:00
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:
@@ -9,7 +9,8 @@ import Component, { useCounter } from '@pezkuwi/app-democracy';
|
||||
function needsApiCheck (api: ApiPromise): boolean {
|
||||
try {
|
||||
// we need to be able to create an actual vote
|
||||
api.tx.democracy.vote(1, { Standard: { balance: 1, vote: { aye: true, conviction: 1 } } });
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
api.tx.democracy.vote(1, { Standard: { balance: 1, vote: { aye: true, conviction: 1 } } } as any);
|
||||
|
||||
return true;
|
||||
} catch {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { u32, Vec } from '@pezkuwi/types';
|
||||
import type { SpStakingPagedExposureMetadata } from '@pezkuwi/types/lookup';
|
||||
import type { PezspStakingPagedExposureMetadata } from '@pezkuwi/types/lookup';
|
||||
import type { Route, TFunction } from './types.js';
|
||||
|
||||
import Component from '@pezkuwi/app-staking';
|
||||
@@ -20,7 +20,7 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
|
||||
// we need a known Exposure type
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const { nominatorCount, own, pageCount, total } = api.registry.createType<SpStakingPagedExposureMetadata>(
|
||||
const { nominatorCount, own, pageCount, total } = api.registry.createType<PezspStakingPagedExposureMetadata>(
|
||||
unwrapStorageType(api.registry, api.query.staking.erasStakersOverview.creator.meta.type),
|
||||
{ nominatorCount: BN_ONE, own: BN_ONE, pageCount: BN_ONE, total: BN_ONE }
|
||||
);
|
||||
@@ -41,6 +41,7 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
api.tx.staking.bond(ZERO_ACCOUNT, BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else if (api.tx.staking.bond.meta.args.length === 2) {
|
||||
// current, no controller account
|
||||
// @ts-expect-error Runtime type format
|
||||
api.tx.staking.bond(BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else {
|
||||
// unknown
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { SpStakingExposure } from '@pezkuwi/types/lookup';
|
||||
import type { PezspStakingExposure } from '@pezkuwi/types/lookup';
|
||||
import type { Route, TFunction } from './types.js';
|
||||
|
||||
import Component from '@pezkuwi/app-staking2';
|
||||
@@ -14,7 +14,7 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
try {
|
||||
// we need a known Exposure type
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const { others: [{ value, who }], own, total } = api.registry.createType<SpStakingExposure>(
|
||||
const { others: [{ value, who }], own, total } = api.registry.createType<PezspStakingExposure>(
|
||||
unwrapStorageType(api.registry, api.query.staking.erasStakers.creator.meta.type),
|
||||
{ others: [{ value: BN_ONE, who: ZERO_ACCOUNT }], own: BN_ONE, total: BN_ONE }
|
||||
);
|
||||
@@ -35,6 +35,7 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
api.tx.staking.bond(ZERO_ACCOUNT, BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else if (api.tx.staking.bond.meta.args.length === 2) {
|
||||
// current, no controller account
|
||||
// @ts-expect-error Runtime type format
|
||||
api.tx.staking.bond(BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else {
|
||||
// unknown
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { u32, Vec } from '@pezkuwi/types';
|
||||
import type { PalletStakingStakingLedger, SpStakingExposure } from '@pezkuwi/types/lookup';
|
||||
import type { PezpalletStakingStakingLedger, PezspStakingExposure } from '@pezkuwi/types/lookup';
|
||||
import type { Route, TFunction } from './types.js';
|
||||
|
||||
import Component from '@pezkuwi/app-staking-legacy';
|
||||
@@ -18,7 +18,7 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
|
||||
try {
|
||||
// we need a known Exposure type
|
||||
const { others: [{ value, who }], own, total } = api.registry.createType<SpStakingExposure>(
|
||||
const { others: [{ value, who }], own, total } = api.registry.createType<PezspStakingExposure>(
|
||||
unwrapStorageType(api.registry, api.query.staking.erasStakers.creator.meta.type),
|
||||
{ others: [{ value: BN_ONE, who: ZERO_ACCOUNT }], own: BN_ONE, total: BN_ONE }
|
||||
);
|
||||
@@ -38,6 +38,7 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
api.tx.staking.bond(ZERO_ACCOUNT, BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else if (api.tx.staking.bond.meta.args.length === 2) {
|
||||
// current, no controller account
|
||||
// @ts-expect-error Runtime type format
|
||||
api.tx.staking.bond(BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else {
|
||||
// unknown
|
||||
@@ -51,7 +52,7 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
|
||||
// For compatibility - `api.query.staking.ledger` returns `legacyClaimedRewards` instead of `claimedRewards` as of v1.4
|
||||
try {
|
||||
const v = api.registry.createType<PalletStakingStakingLedger>(
|
||||
const v = api.registry.createType<PezpalletStakingStakingLedger>(
|
||||
unwrapStorageType(api.registry, api.query.staking.ledger.creator.meta.type),
|
||||
{ claimedRewards: [1, 2, 3] }
|
||||
);
|
||||
@@ -59,7 +60,7 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
if ((v as unknown as { claimedRewards: Vec<u32> }).claimedRewards) {
|
||||
assert((v as unknown as { claimedRewards: Vec<u32> }).claimedRewards.eq([1, 2, 3]), 'Needs a claimedRewards array');
|
||||
} else {
|
||||
const v = api.registry.createType<PalletStakingStakingLedger>(
|
||||
const v = api.registry.createType<PezpalletStakingStakingLedger>(
|
||||
unwrapStorageType(api.registry, api.query.staking.ledger.creator.meta.type),
|
||||
{ legacyClaimedRewards: [1, 2, 3] }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user