mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-12-03 18:57:05 +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:
1 parent
e64f846b0d
commit
7a4bbeac25
570 files changed
+3281
-3030
No files matched your search
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
import type { Option } from '@pezkuwi/types';
|
||||
import type { PalletConvictionVotingVoteCasting, PalletConvictionVotingVoteVoting, PalletReferendaReferendumInfoConvictionVotingTally } from '@pezkuwi/types/lookup';
|
||||
import type { PezpalletConvictionVotingVoteCasting, PezpalletConvictionVotingVoteVoting, PezpalletReferendaReferendumInfoConvictionVotingTally } from '@pezkuwi/types/lookup';
|
||||
import type { BN } from '@pezkuwi/util';
|
||||
import type { Lock, PalletReferenda, PalletVote } from './types.js';
|
||||
|
||||
@@ -19,9 +19,9 @@ const OPT_CLASS = {
|
||||
};
|
||||
|
||||
const OPT_VOTES = {
|
||||
transform: ([[params], votes]: [[[string, BN][]], PalletConvictionVotingVoteVoting[]]): [classId: BN, refIds: BN[], casting: PalletConvictionVotingVoteCasting][] =>
|
||||
transform: ([[params], votes]: [[[string, BN][]], PezpalletConvictionVotingVoteVoting[]]): [classId: BN, refIds: BN[], casting: PezpalletConvictionVotingVoteCasting][] =>
|
||||
votes
|
||||
.map((v, index): null | [BN, BN[], PalletConvictionVotingVoteCasting] => {
|
||||
.map((v, index): null | [BN, BN[], PezpalletConvictionVotingVoteCasting] => {
|
||||
if (!v.isCasting) {
|
||||
return null;
|
||||
}
|
||||
@@ -34,19 +34,19 @@ const OPT_VOTES = {
|
||||
casting
|
||||
];
|
||||
})
|
||||
.filter((v): v is [BN, BN[], PalletConvictionVotingVoteCasting] => !!v),
|
||||
.filter((v): v is [BN, BN[], PezpalletConvictionVotingVoteCasting] => !!v),
|
||||
withParamsTransform: true
|
||||
};
|
||||
|
||||
const OPT_REFS = {
|
||||
transform: ([[params], optTally]: [[BN[]], Option<PalletReferendaReferendumInfoConvictionVotingTally>[]]): [BN, PalletReferendaReferendumInfoConvictionVotingTally][] =>
|
||||
transform: ([[params], optTally]: [[BN[]], Option<PezpalletReferendaReferendumInfoConvictionVotingTally>[]]): [BN, PezpalletReferendaReferendumInfoConvictionVotingTally][] =>
|
||||
optTally
|
||||
.map((v, index): null | [BN, PalletReferendaReferendumInfoConvictionVotingTally] =>
|
||||
.map((v, index): null | [BN, PezpalletReferendaReferendumInfoConvictionVotingTally] =>
|
||||
v.isSome
|
||||
? [params[index], v.unwrap()]
|
||||
: null
|
||||
)
|
||||
.filter((v): v is [BN, PalletReferendaReferendumInfoConvictionVotingTally] => !!v),
|
||||
.filter((v): v is [BN, PezpalletReferendaReferendumInfoConvictionVotingTally] => !!v),
|
||||
withParamsTransform: true
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ function getVoteParams (accountId: string, lockClasses?: BN[]): [[accountId: str
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getRefParams (votes?: [classId: BN, refIds: BN[], casting: PalletConvictionVotingVoteCasting][]): [BN[]] | undefined {
|
||||
function getRefParams (votes?: [classId: BN, refIds: BN[], casting: PezpalletConvictionVotingVoteCasting][]): [BN[]] | undefined {
|
||||
if (votes?.length) {
|
||||
const refIds = votes.reduce<BN[]>((all, [, refIds]) => all.concat(refIds), []);
|
||||
|
||||
@@ -70,7 +70,7 @@ function getRefParams (votes?: [classId: BN, refIds: BN[], casting: PalletConvic
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getLocks (api: ApiPromise, palletVote: PalletVote, votes: [classId: BN, refIds: BN[], casting: PalletConvictionVotingVoteCasting][], referenda: [BN, PalletReferendaReferendumInfoConvictionVotingTally][]): Lock[] {
|
||||
function getLocks (api: ApiPromise, palletVote: PalletVote, votes: [classId: BN, refIds: BN[], casting: PezpalletConvictionVotingVoteCasting][], referenda: [BN, PezpalletReferendaReferendumInfoConvictionVotingTally][]): Lock[] {
|
||||
const lockPeriod = api.consts[palletVote].voteLockingPeriod as BN;
|
||||
const locks: Lock[] = [];
|
||||
|
||||
@@ -157,7 +157,7 @@ function useAccountLocksImpl (palletReferenda: PalletReferenda, palletVote: Pall
|
||||
[accountId, lockClasses]
|
||||
);
|
||||
|
||||
const votes = useCall<[BN, BN[], PalletConvictionVotingVoteCasting][] | undefined>(voteParams && api.query[palletVote]?.votingFor.multi, voteParams, OPT_VOTES);
|
||||
const votes = useCall<[BN, BN[], PezpalletConvictionVotingVoteCasting][] | undefined>(voteParams && api.query[palletVote]?.votingFor.multi, voteParams, OPT_VOTES);
|
||||
|
||||
// retrieve the referendums that were voted on
|
||||
const refParams = useMemo(
|
||||
|
||||
Reference in new issue
Block a user