Adjust multi to infer return types (#4002)
* Adjust multi to infer return types * some linting * Additional * Dedupe
This commit is contained in:
@@ -113,8 +113,8 @@ export function hasIdentityMulti (instanceId: string, api: ApiInterfaceRx): (acc
|
||||
return memo(instanceId, (accountIds: (AccountId | Uint8Array | string)[]): Observable<DeriveHasIdentity[]> =>
|
||||
api.query.identity?.identityOf
|
||||
? combineLatest([
|
||||
api.query.identity.identityOf.multi<Option<Registration>>(accountIds),
|
||||
api.query.identity.superOf.multi<Option<ITuple<[AccountId, Data]>>>(accountIds)
|
||||
api.query.identity.identityOf.multi(accountIds),
|
||||
api.query.identity.superOf.multi(accountIds)
|
||||
]).pipe(
|
||||
map(([identities, supers]) =>
|
||||
identities.map((identityOfOpt, index): DeriveHasIdentity => {
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Bytes, Option } from '@polkadot/types';
|
||||
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
|
||||
import type { BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
|
||||
import type { PalletBountiesBounty } from '@polkadot/types/lookup';
|
||||
import type { DeriveBounties, DeriveCollectiveProposal } from '../types';
|
||||
|
||||
import { combineLatest, map, of, switchMap } from 'rxjs';
|
||||
@@ -12,7 +13,7 @@ import { combineLatest, map, of, switchMap } from 'rxjs';
|
||||
import { memo } from '../util';
|
||||
import { filterBountiesProposals } from './helpers/filterBountyProposals';
|
||||
|
||||
type Result = [Option<Bounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
|
||||
type Result = [Option<PalletBountiesBounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
|
||||
|
||||
function parseResult ([maybeBounties, maybeDescriptions, ids, bountyProposals]: Result): DeriveBounties {
|
||||
const bounties: DeriveBounties = [];
|
||||
@@ -53,8 +54,8 @@ export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observ
|
||||
const ids = keys.map(({ args: [id] }) => id);
|
||||
|
||||
return combineLatest([
|
||||
bountyBase.bounties.multi<Option<Bounty>>(ids),
|
||||
bountyBase.bountyDescriptions.multi<Option<Bytes>>(ids),
|
||||
bountyBase.bounties.multi(ids),
|
||||
bountyBase.bountyDescriptions.multi(ids),
|
||||
of(ids),
|
||||
of(filterBountiesProposals(api, proposals))
|
||||
]);
|
||||
|
||||
@@ -40,9 +40,6 @@ function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: strin
|
||||
// however we have had cases on Edgeware where the indices have moved around after an
|
||||
// upgrade, which results in invalid on-chain data
|
||||
combineLatest(hashes.map((hash) =>
|
||||
// this should simply be api.query[section].proposalOf.multi<Option<Proposal>>(hashes),
|
||||
// however we have had cases on Edgeware where the indices have moved around after an
|
||||
// upgrade, which results in invalid on-chain data
|
||||
api.query[section].proposalOf<Option<Proposal>>(hash).pipe(
|
||||
catchError(() => of(null))
|
||||
)
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option, u64, Vec } from '@polkadot/types';
|
||||
import type { BlockNumber, Hash, ReferendumIndex, Scheduled } from '@polkadot/types/interfaces';
|
||||
import type { Option, Vec } from '@polkadot/types';
|
||||
import type { BlockNumber, Hash, ReferendumIndex } from '@polkadot/types/interfaces';
|
||||
import type { PalletSchedulerScheduledV2 } from '@polkadot/types/lookup';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { DeriveDispatch, DeriveProposalImage } from '../types';
|
||||
|
||||
@@ -42,7 +43,7 @@ function queryQueue (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
|
||||
);
|
||||
}
|
||||
|
||||
function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], (Option<Scheduled>[] | null)[]]> {
|
||||
function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], (Option<PalletSchedulerScheduledV2>[] | null)[]]> {
|
||||
// We don't get entries, but rather we get the keys (triggered via finished referendums) and
|
||||
// the subscribe to those keys - this means we pickup when the schedulers actually executes
|
||||
// at a block, the entry for that block will become empty
|
||||
@@ -56,11 +57,11 @@ function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], (Opt
|
||||
return blockNumbers.length
|
||||
? combineLatest([
|
||||
of(blockNumbers),
|
||||
// this should simply be api.query.scheduler.agenda.multi<Vec<Option<Scheduled>>>,
|
||||
// this should simply be api.query.scheduler.agenda.multi,
|
||||
// however we have had cases on Darwinia where the indices have moved around after an
|
||||
// upgrade, which results in invalid on-chain data
|
||||
combineLatest(blockNumbers.map((blockNumber) =>
|
||||
api.query.scheduler.agenda<Vec<Option<Scheduled>>>(blockNumber).pipe(
|
||||
api.query.scheduler.agenda(blockNumber).pipe(
|
||||
// this does create an issue since it discards all at that block
|
||||
catchError(() => of(null))
|
||||
)
|
||||
@@ -86,7 +87,7 @@ function queryScheduler (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
|
||||
const id = scheduled.maybeId.unwrap().toHex();
|
||||
|
||||
if (id.startsWith(DEMOCRACY_ID)) {
|
||||
const [, index] = api.registry.createType<ITuple<[u64, ReferendumIndex]>>('(u64, ReferendumIndex)', id);
|
||||
const [, index] = api.registry.createType('(u64, ReferendumIndex)', id);
|
||||
const imageHash = scheduled.call.args[0] as Hash;
|
||||
|
||||
result.push({ at, imageHash, index });
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option } from '@polkadot/types';
|
||||
import type { AccountId, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
|
||||
import type { PalletDemocracyReferendumInfo } from '@polkadot/types/lookup';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { DeriveDemocracyLock } from '../types';
|
||||
|
||||
@@ -25,7 +25,7 @@ function parseEnd (api: ApiInterfaceRx, vote: Vote, { approved, end }: Referendu
|
||||
];
|
||||
}
|
||||
|
||||
function parseLock (api: ApiInterfaceRx, [referendumId, accountVote]: VotingDirectVote, referendum: ReferendumInfo): DeriveDemocracyLock {
|
||||
function parseLock (api: ApiInterfaceRx, [referendumId, accountVote]: VotingDirectVote, referendum: PalletDemocracyReferendumInfo): DeriveDemocracyLock {
|
||||
const { balance, vote } = accountVote.asStandard;
|
||||
const [referendumEnd, unlockAt] = referendum.isFinished
|
||||
? parseEnd(api, vote, referendum.asFinished)
|
||||
@@ -57,13 +57,13 @@ function directLocks (api: ApiInterfaceRx, { votes }: VotingDirect): Observable<
|
||||
return of([]);
|
||||
}
|
||||
|
||||
return api.query.democracy.referendumInfoOf.multi<Option<ReferendumInfo | ReferendumInfoTo239>>(votes.map(([referendumId]) => referendumId)).pipe(
|
||||
return api.query.democracy.referendumInfoOf.multi(votes.map(([referendumId]) => referendumId)).pipe(
|
||||
map((referendums) =>
|
||||
votes
|
||||
.map((vote, index): [VotingDirectVote, ReferendumInfo | ReferendumInfoTo239 | null] =>
|
||||
.map((vote, index): [VotingDirectVote, PalletDemocracyReferendumInfo | ReferendumInfoTo239 | null] =>
|
||||
[vote, referendums[index].unwrapOr(null)]
|
||||
)
|
||||
.filter((item): item is [VotingDirectVote, ReferendumInfo] =>
|
||||
.filter((item): item is [VotingDirectVote, PalletDemocracyReferendumInfo] =>
|
||||
!!item[1] && isUndefined((item[1] as ReferendumInfoTo239).end) && item[0][1].isStandard
|
||||
)
|
||||
.map(([directVote, referendum]) =>
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Bytes, Option } from '@polkadot/types';
|
||||
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { Hash } from '@polkadot/types/interfaces';
|
||||
import type { DeriveProposalImage } from '../types';
|
||||
|
||||
import { map, of } from 'rxjs';
|
||||
@@ -13,12 +11,10 @@ import { map, of } from 'rxjs';
|
||||
import { memo } from '../util';
|
||||
import { parseImage } from './util';
|
||||
|
||||
type PreImage = Option<ITuple<[Bytes, AccountId, Balance, BlockNumber]>>;
|
||||
|
||||
export function preimages (instanceId: string, api: ApiInterfaceRx): (hashes: Hash[]) => Observable<(DeriveProposalImage | undefined)[]> {
|
||||
return memo(instanceId, (hashes: Hash[]): Observable<(DeriveProposalImage | undefined)[]> =>
|
||||
hashes.length
|
||||
? api.query.democracy.preimages.multi<PreImage>(hashes).pipe(
|
||||
? api.query.democracy.preimages.multi(hashes).pipe(
|
||||
map((images): (DeriveProposalImage | undefined)[] =>
|
||||
images.map((imageOpt) => parseImage(api, imageOpt))
|
||||
)
|
||||
|
||||
@@ -58,9 +58,9 @@ export function proposals (instanceId: string, api: ApiInterfaceRx): () => Obser
|
||||
? combineLatest([
|
||||
of(proposals),
|
||||
api.derive.democracy.preimages(
|
||||
proposals.map(([, hash]): Hash => hash)),
|
||||
api.query.democracy.depositOf.multi<Depositors>(
|
||||
proposals.map(([index]): PropIndex => index))
|
||||
proposals.map(([, hash]) => hash)),
|
||||
api.query.democracy.depositOf.multi(
|
||||
proposals.map(([index]) => index))
|
||||
])
|
||||
: of<Result>([[], [], []])
|
||||
),
|
||||
|
||||
@@ -3,23 +3,24 @@
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option } from '@polkadot/types';
|
||||
import type { ReferendumInfo, ReferendumInfoFinished } from '@polkadot/types/interfaces';
|
||||
import type { PalletDemocracyReferendumInfo } from '@polkadot/types/lookup';
|
||||
|
||||
import { map, switchMap } from 'rxjs';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
type ReferendumInfoFinished = PalletDemocracyReferendumInfo['asFinished'];
|
||||
|
||||
export function referendumsFinished (instanceId: string, api: ApiInterfaceRx): () => Observable<ReferendumInfoFinished[]> {
|
||||
return memo(instanceId, (): Observable<ReferendumInfoFinished[]> =>
|
||||
api.derive.democracy.referendumIds().pipe(
|
||||
switchMap((ids) =>
|
||||
api.query.democracy.referendumInfoOf.multi<Option<ReferendumInfo>>(ids)
|
||||
api.query.democracy.referendumInfoOf.multi(ids)
|
||||
),
|
||||
map((infos): ReferendumInfoFinished[] =>
|
||||
infos
|
||||
.map((optInfo) => optInfo.unwrapOr(null))
|
||||
.filter((info): info is ReferendumInfo => !!info && info.isFinished)
|
||||
.filter((info): info is PalletDemocracyReferendumInfo => !!info && info.isFinished)
|
||||
.map((info) => info.asFinished)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option, Vec } from '@polkadot/types';
|
||||
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
|
||||
import type { PalletDemocracyReferendumInfo } from '@polkadot/types/lookup';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
|
||||
|
||||
@@ -123,8 +124,8 @@ export function _referendumsVotes (instanceId: string, api: ApiInterfaceRx): (re
|
||||
);
|
||||
}
|
||||
|
||||
export function _referendumInfo (instanceId: string, api: ApiInterfaceRx): (index: BN, info: Option<ReferendumInfo | ReferendumInfoTo239>) => Observable<DeriveReferendum | null> {
|
||||
return memo(instanceId, (index: BN, info: Option<ReferendumInfo | ReferendumInfoTo239>): Observable<DeriveReferendum | null> => {
|
||||
export function _referendumInfo (instanceId: string, api: ApiInterfaceRx): (index: BN, info: Option<PalletDemocracyReferendumInfo | ReferendumInfoTo239>) => Observable<DeriveReferendum | null> {
|
||||
return memo(instanceId, (index: BN, info: Option<PalletDemocracyReferendumInfo | ReferendumInfoTo239>): Observable<DeriveReferendum | null> => {
|
||||
const status = getStatus(info);
|
||||
|
||||
return status
|
||||
@@ -143,7 +144,7 @@ export function _referendumInfo (instanceId: string, api: ApiInterfaceRx): (inde
|
||||
export function referendumsInfo (instanceId: string, api: ApiInterfaceRx): (ids: BN[]) => Observable<DeriveReferendum[]> {
|
||||
return memo(instanceId, (ids: BN[]): Observable<DeriveReferendum[]> =>
|
||||
ids.length
|
||||
? api.query.democracy.referendumInfoOf.multi<Option<ReferendumInfo>>(ids).pipe(
|
||||
? api.query.democracy.referendumInfoOf.multi(ids).pipe(
|
||||
switchMap((infos): Observable<(DeriveReferendum | null)[]> =>
|
||||
combineLatest(
|
||||
ids.map((id, index): Observable<DeriveReferendum | null> =>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Vec } from '@polkadot/types';
|
||||
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, ReferendumStatus, Vote, VoteThreshold } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, Vote, VoteThreshold } from '@polkadot/types/interfaces';
|
||||
import type { PalletDemocracyReferendumStatus } from '@polkadot/types/lookup';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
export interface DeriveDemocracyLock {
|
||||
@@ -48,7 +49,7 @@ export interface DeriveReferendum {
|
||||
index: ReferendumIndex;
|
||||
image?: DeriveProposalImage;
|
||||
imageHash: Hash;
|
||||
status: ReferendumStatus | ReferendumInfoTo239;
|
||||
status: PalletDemocracyReferendumStatus | ReferendumInfoTo239;
|
||||
}
|
||||
|
||||
export interface DeriveReferendumVote {
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Bytes, Option } from '@polkadot/types';
|
||||
import type { AccountId, Balance, BlockNumber, PreimageStatus, Proposal, ReferendumInfo, ReferendumInfoTo239, ReferendumStatus, Tally, VoteThreshold } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, Balance, BlockNumber, PreimageStatus, Proposal, ReferendumInfoTo239, Tally } from '@polkadot/types/interfaces';
|
||||
import type { PalletDemocracyReferendumInfo, PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
|
||||
|
||||
@@ -18,12 +19,12 @@ interface ApproxState {
|
||||
votedTotal: BN;
|
||||
}
|
||||
|
||||
function isOldInfo (info: ReferendumInfo | ReferendumInfoTo239): info is ReferendumInfoTo239 {
|
||||
function isOldInfo (info: PalletDemocracyReferendumInfo | ReferendumInfoTo239): info is ReferendumInfoTo239 {
|
||||
return !!(info as ReferendumInfoTo239).proposalHash;
|
||||
}
|
||||
|
||||
function isCurrentStatus (status: ReferendumStatus | ReferendumInfoTo239): status is ReferendumStatus {
|
||||
return !!(status as ReferendumStatus).tally;
|
||||
function isCurrentStatus (status: PalletDemocracyReferendumStatus | ReferendumInfoTo239): status is PalletDemocracyReferendumStatus {
|
||||
return !!(status as PalletDemocracyReferendumStatus).tally;
|
||||
}
|
||||
|
||||
function isCurrentPreimage (api: ApiInterfaceRx, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): imageOpt is Option<PreimageStatus> {
|
||||
@@ -57,18 +58,18 @@ export function compareRationals (n1: BN, d1: BN, n2: BN, d2: BN): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
function calcPassingOther (threshold: VoteThreshold, sqrtElectorate: BN, { votedAye, votedNay, votedTotal }: ApproxState): boolean {
|
||||
function calcPassingOther (threshold: PalletDemocracyVoteThreshold, sqrtElectorate: BN, { votedAye, votedNay, votedTotal }: ApproxState): boolean {
|
||||
const sqrtVoters = bnSqrt(votedTotal);
|
||||
|
||||
return sqrtVoters.isZero()
|
||||
? false
|
||||
: threshold.isSupermajorityapproval
|
||||
: threshold.isSuperMajorityApprove
|
||||
? compareRationals(votedNay, sqrtVoters, votedAye, sqrtElectorate)
|
||||
: compareRationals(votedNay, sqrtElectorate, votedAye, sqrtVoters);
|
||||
}
|
||||
|
||||
export function calcPassing (threshold: VoteThreshold, sqrtElectorate: BN, state: ApproxState): boolean {
|
||||
return threshold.isSimplemajority
|
||||
export function calcPassing (threshold: PalletDemocracyVoteThreshold, sqrtElectorate: BN, state: ApproxState): boolean {
|
||||
return threshold.isSimpleMajority
|
||||
? state.votedAye.gt(state.votedNay)
|
||||
: calcPassingOther(threshold, sqrtElectorate, state);
|
||||
}
|
||||
@@ -134,7 +135,7 @@ export function calcVotes (sqrtElectorate: BN, referendum: DeriveReferendum, vot
|
||||
};
|
||||
}
|
||||
|
||||
export function getStatus (info: Option<ReferendumInfo | ReferendumInfoTo239>): ReferendumStatus | ReferendumInfoTo239 | null {
|
||||
export function getStatus (info: Option<PalletDemocracyReferendumInfo | ReferendumInfoTo239>): PalletDemocracyReferendumStatus | ReferendumInfoTo239 | null {
|
||||
if (info.isNone) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Bytes, Option, u32 } from '@polkadot/types';
|
||||
import type { Option, u32, WrapperOpaque } from '@polkadot/types';
|
||||
import type { AccountId } from '@polkadot/types/interfaces';
|
||||
import type { PalletImOnlineBoundedOpaqueNetworkState } from '@polkadot/types/lookup';
|
||||
import type { DeriveHeartbeats } from '../types';
|
||||
|
||||
import { combineLatest, map, of, switchMap } from 'rxjs';
|
||||
@@ -13,7 +14,9 @@ import { BN_ZERO } from '@polkadot/util';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
function mapResult ([result, validators, heartbeats, numBlocks]: [DeriveHeartbeats, AccountId[], Option<Bytes>[], u32[]]): DeriveHeartbeats {
|
||||
type HeartbeatsOpt = Option<WrapperOpaque<PalletImOnlineBoundedOpaqueNetworkState>>;
|
||||
|
||||
function mapResult ([result, validators, heartbeats, numBlocks]: [DeriveHeartbeats, AccountId[], HeartbeatsOpt[], u32[]]): DeriveHeartbeats {
|
||||
validators.forEach((validator, index): void => {
|
||||
const validatorId = validator.toString();
|
||||
const blockCount = numBlocks[index];
|
||||
@@ -39,13 +42,13 @@ export function receivedHeartbeats (instanceId: string, api: ApiInterfaceRx): ()
|
||||
return memo(instanceId, (): Observable<DeriveHeartbeats> =>
|
||||
api.query.imOnline?.receivedHeartbeats
|
||||
? api.derive.staking.overview().pipe(
|
||||
switchMap(({ currentIndex, validators }): Observable<[DeriveHeartbeats, AccountId[], Option<Bytes>[], u32[]]> =>
|
||||
switchMap(({ currentIndex, validators }): Observable<[DeriveHeartbeats, AccountId[], HeartbeatsOpt[], u32[]]> =>
|
||||
combineLatest([
|
||||
of({}),
|
||||
of(validators),
|
||||
api.query.imOnline.receivedHeartbeats.multi<Option<Bytes>>(
|
||||
api.query.imOnline.receivedHeartbeats.multi(
|
||||
validators.map((_address, index) => [currentIndex, index])),
|
||||
api.query.imOnline.authoredBlocks.multi<u32>(
|
||||
api.query.imOnline.authoredBlocks.multi(
|
||||
validators.map((address) => [currentIndex, address]))
|
||||
])
|
||||
),
|
||||
|
||||
@@ -24,7 +24,7 @@ export function candidates (instanceId: string, api: ApiInterfaceRx): () => Obse
|
||||
switchMap((candidates: Vec<Bid>): Observable<Result> =>
|
||||
combineLatest([
|
||||
of(candidates),
|
||||
api.query.society.suspendedCandidates.multi<ResultSuspend>(
|
||||
api.query.society.suspendedCandidates.multi(
|
||||
candidates.map(({ who }): AccountId => who))
|
||||
])
|
||||
),
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { bool, Option, Vec } from '@polkadot/types';
|
||||
import type { AccountId, Balance, BlockNumber, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { AccountId } from '@polkadot/types/interfaces';
|
||||
import type { DeriveSocietyMember } from '../types';
|
||||
|
||||
import { combineLatest, map, of, switchMap } from 'rxjs';
|
||||
@@ -16,11 +14,11 @@ export function _members (instanceId: string, api: ApiInterfaceRx): (accountIds:
|
||||
return memo(instanceId, (accountIds: AccountId[]): Observable<DeriveSocietyMember[]> =>
|
||||
combineLatest([
|
||||
of(accountIds),
|
||||
api.query.society.payouts.multi<Vec<ITuple<[BlockNumber, Balance]>>>(accountIds),
|
||||
api.query.society.strikes.multi<StrikeCount>(accountIds),
|
||||
api.query.society.defenderVotes.multi<Option<SocietyVote>>(accountIds),
|
||||
api.query.society.suspendedMembers.multi<bool>(accountIds),
|
||||
api.query.society.vouching.multi<Option<VouchingStatus>>(accountIds)
|
||||
api.query.society.payouts.multi(accountIds),
|
||||
api.query.society.strikes.multi(accountIds),
|
||||
api.query.society.defenderVotes.multi(accountIds),
|
||||
api.query.society.suspendedMembers.multi(accountIds),
|
||||
api.query.society.vouching.multi(accountIds)
|
||||
]).pipe(
|
||||
map(([accountIds, payouts, strikes, defenderVotes, suspended, vouching]) =>
|
||||
accountIds.map((accountId, index) => ({
|
||||
|
||||
@@ -48,7 +48,7 @@ export function _erasPoints (instanceId: string, api: ApiInterfaceRx): (eras: Er
|
||||
|
||||
return !remaining.length
|
||||
? of(cached)
|
||||
: api.query.staking.erasRewardPoints.multi<EraRewardPoints>(remaining).pipe(
|
||||
: api.query.staking.erasRewardPoints.multi(remaining).pipe(
|
||||
map((points): DeriveEraPoints[] => {
|
||||
const query = mapPoints(remaining, points);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export function _erasRewards (instanceId: string, api: ApiInterfaceRx): (eras: E
|
||||
return of(cached);
|
||||
}
|
||||
|
||||
return api.query.staking.erasValidatorReward.multi<Option<Balance>>(remaining).pipe(
|
||||
return api.query.staking.erasValidatorReward.multi(remaining).pipe(
|
||||
map((optRewards) => {
|
||||
const query = mapRewards(remaining, optRewards);
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option, Vec } from '@polkadot/types';
|
||||
import type { AccountId, Keys } from '@polkadot/types/interfaces';
|
||||
import type { AccountId } from '@polkadot/types/interfaces';
|
||||
import type { NodeRuntimeSessionKeys } from '@polkadot/types/lookup';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { DeriveStakingKeys } from './types';
|
||||
|
||||
@@ -12,13 +13,17 @@ import { combineLatest, map, of, switchMap } from 'rxjs';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
function extractsIds (stashId: Uint8Array | string, queuedKeys: [AccountId, Keys][], nextKeys: Option<Keys>): DeriveStakingKeys {
|
||||
function extractsIds (stashId: Uint8Array | string, queuedKeys: [AccountId, NodeRuntimeSessionKeys | AccountId[]][], nextKeys: Option<NodeRuntimeSessionKeys>): DeriveStakingKeys {
|
||||
const sessionIds = (queuedKeys.find(([currentId]) => currentId.eq(stashId)) || [undefined, [] as AccountId[]])[1];
|
||||
const nextSessionIds = nextKeys.unwrapOr([] as AccountId[]);
|
||||
|
||||
return {
|
||||
nextSessionIds,
|
||||
sessionIds
|
||||
nextSessionIds: Array.isArray(nextSessionIds)
|
||||
? nextSessionIds
|
||||
: [...nextSessionIds.values()] as AccountId[],
|
||||
sessionIds: Array.isArray(sessionIds)
|
||||
? sessionIds
|
||||
: [...sessionIds.values()] as AccountId[]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,13 +38,13 @@ export function keys (instanceId: string, api: ApiInterfaceRx): (stashId: Uint8A
|
||||
export function keysMulti (instanceId: string, api: ApiInterfaceRx): (stashIds: (Uint8Array | string)[]) => Observable<DeriveStakingKeys[]> {
|
||||
return memo(instanceId, (stashIds: (Uint8Array | string)[]): Observable<DeriveStakingKeys[]> =>
|
||||
stashIds.length
|
||||
? api.query.session.queuedKeys<Vec<ITuple<[AccountId, Keys]>>>().pipe(
|
||||
switchMap((queuedKeys): Observable<[Vec<ITuple<[AccountId, Keys]>>, Option<Keys>[]]> =>
|
||||
? api.query.session.queuedKeys().pipe(
|
||||
switchMap((queuedKeys): Observable<[Vec<ITuple<[AccountId, NodeRuntimeSessionKeys]>>, Option<NodeRuntimeSessionKeys>[]]> =>
|
||||
combineLatest([
|
||||
of(queuedKeys),
|
||||
api.consts.session?.dedupKeyPrefix
|
||||
? api.query.session.nextKeys.multi<Option<Keys>>(stashIds.map((stashId) => [api.consts.session.dedupKeyPrefix, stashId]))
|
||||
: api.query.session.nextKeys.multi<Option<Keys>>(stashIds)
|
||||
? api.query.session.nextKeys.multi(stashIds.map((stashId) => [api.consts.session.dedupKeyPrefix, stashId]))
|
||||
: api.query.session.nextKeys.multi(stashIds)
|
||||
])
|
||||
),
|
||||
map(([queuedKeys, nextKeys]) =>
|
||||
|
||||
@@ -34,7 +34,7 @@ function getLedgers (api: ApiInterfaceRx, optIds: (Option<AccountId> | null)[],
|
||||
|
||||
return (
|
||||
ids.length
|
||||
? api.query.staking.ledger.multi<Option<StakingLedger>>(ids)
|
||||
? api.query.staking.ledger.multi(ids)
|
||||
: of([])
|
||||
).pipe(
|
||||
map((optLedgers): Option<StakingLedger>[] => {
|
||||
@@ -57,19 +57,19 @@ function getStashInfo (api: ApiInterfaceRx, stashIds: AccountId[], activeEra: Er
|
||||
|
||||
return combineLatest([
|
||||
withController || withLedger
|
||||
? api.query.staking.bonded.multi<Option<AccountId>>(stashIds)
|
||||
? api.query.staking.bonded.multi(stashIds)
|
||||
: of(stashIds.map(() => null)),
|
||||
withNominations
|
||||
? api.query.staking.nominators.multi<Option<Nominations>>(stashIds)
|
||||
? api.query.staking.nominators.multi(stashIds)
|
||||
: of(stashIds.map(() => emptyNoms)),
|
||||
withDestination
|
||||
? api.query.staking.payee.multi<RewardDestination>(stashIds)
|
||||
? api.query.staking.payee.multi(stashIds)
|
||||
: of(stashIds.map(() => emptyRewa)),
|
||||
withPrefs
|
||||
? api.query.staking.validators.multi<ValidatorPrefs>(stashIds)
|
||||
? api.query.staking.validators.multi(stashIds)
|
||||
: of(stashIds.map(() => emptyPrefs)),
|
||||
withExposure
|
||||
? api.query.staking.erasStakers.multi<Exposure>(stashIds.map((stashId) => [activeEra, stashId]))
|
||||
? api.query.staking.erasStakers.multi(stashIds.map((stashId) => [activeEra, stashId]))
|
||||
: of(stashIds.map(() => emptyExpo))
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { EraIndex, ValidatorPrefs } from '@polkadot/types/interfaces';
|
||||
import type { EraIndex } from '@polkadot/types/interfaces';
|
||||
import type { DeriveStakerPrefs } from '../types';
|
||||
|
||||
import { map, switchMap } from 'rxjs';
|
||||
@@ -13,7 +13,7 @@ import { memo } from '../util';
|
||||
export function _stakerPrefs (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerPrefs[]> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveStakerPrefs[]> =>
|
||||
api.query.staking.erasValidatorPrefs.multi<ValidatorPrefs>(eras.map((era) => [era, accountId])).pipe(
|
||||
api.query.staking.erasValidatorPrefs.multi(eras.map((era) => [era, accountId])).pipe(
|
||||
map((all): DeriveStakerPrefs[] =>
|
||||
all.map((validatorPrefs, index): DeriveStakerPrefs => ({
|
||||
era: eras[index],
|
||||
|
||||
@@ -59,7 +59,7 @@ function retrieveProposals (api: ApiInterfaceRx, proposalCount: ProposalIndex, a
|
||||
const allIds = [...proposalIds, ...approvalIds];
|
||||
|
||||
return combineLatest([
|
||||
api.query.treasury.proposals.multi<Option<TreasuryProposal>>(allIds),
|
||||
api.query.treasury.proposals.multi(allIds),
|
||||
api.derive.council
|
||||
? api.derive.council.proposals()
|
||||
: of([] as DeriveCollectiveProposal[])
|
||||
|
||||
@@ -82,7 +82,7 @@ async function query (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
|
||||
const oldBal = await api.query.balances.totalIssuance.at('abcd');
|
||||
// It's hard to correctly type .multi. Expected: `Balance[]`, actual: Codec[].
|
||||
// In the meantime, we can case with `<Balance>` (this is not available on recent chains)
|
||||
const multi = await api.query.balances.freeBalance.multi<Balance>([pairs.alice.address, pairs.bob.address]);
|
||||
const multi = await api.query.balances.freeBalance.multi([pairs.alice.address, pairs.bob.address]);
|
||||
|
||||
console.log('query types:', bar, bal, bal2, override, oldBal, multi);
|
||||
|
||||
|
||||
@@ -8,13 +8,19 @@ import type { StorageEntry } from '@polkadot/types/primitive/types';
|
||||
import type { AnyFunction, AnyTuple, Callback, Codec, IStorageKey } from '@polkadot/types/types';
|
||||
import type { ApiTypes, DropLast, MethodResult, ObsInnerType, PaginationOptions, PromiseOrObs, UnsubscribePromise } from './base';
|
||||
|
||||
interface StorageEntryObservableMulti {
|
||||
<T extends Codec>(args: (unknown[] | unknown)[]): Observable<T[]>;
|
||||
type AsCodec<R extends Codec | any> = R extends Codec
|
||||
? R
|
||||
: Codec;
|
||||
|
||||
type ReturnCodec<F extends AnyFunction> = AsCodec<ObsInnerType<ReturnType<F>>>;
|
||||
|
||||
interface StorageEntryObservableMulti<R extends Codec = Codec> {
|
||||
<T extends Codec = R>(args: (unknown[] | unknown)[]): Observable<T[]>;
|
||||
}
|
||||
|
||||
interface StorageEntryPromiseMulti {
|
||||
<T extends Codec>(args: (unknown[] | unknown)[]): Promise<T[]>;
|
||||
<T extends Codec>(args: (unknown[] | unknown)[], callback: Callback<T[]>): UnsubscribePromise;
|
||||
interface StorageEntryPromiseMulti<R extends Codec = Codec> {
|
||||
<T extends Codec = R>(args: (unknown[] | unknown)[]): Promise<T[]>;
|
||||
<T extends Codec = R>(args: (unknown[] | unknown)[], callback: Callback<T[]>): UnsubscribePromise;
|
||||
}
|
||||
|
||||
export interface StorageEntryPromiseOverloads {
|
||||
@@ -52,28 +58,23 @@ export interface QueryableStorageAt<ApiType extends ApiTypes> extends AugmentedQ
|
||||
[key: string]: QueryableModuleStorageAt<ApiType>;
|
||||
}
|
||||
|
||||
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> {
|
||||
at: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
|
||||
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> extends StorageEntryBaseAt<ApiType, F, A> {
|
||||
at: <T extends Codec | any = ReturnCodec<F>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
|
||||
creator: StorageEntry;
|
||||
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
entriesAt: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
entriesPaged: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
|
||||
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
|
||||
key: (...args: Parameters<F>) => string;
|
||||
keyPrefix: (...args: DropLast<Parameters<F>>) => string;
|
||||
keys: <K extends AnyTuple = A> (...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
|
||||
entriesAt: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
entriesPaged: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
keysAt: <K extends AnyTuple = A> (hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
|
||||
keysPaged: <K extends AnyTuple = A> (opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
|
||||
// @deprecated The underlying RPC this been marked unsafe and is generally not exposed
|
||||
range: <T extends Codec | any = ObsInnerType<ReturnType<F>>>([from, to]: [Hash | Uint8Array | string, Hash | Uint8Array | string | undefined] | [Hash | Uint8Array | string], ...args: Parameters<F>) => PromiseOrObs<ApiType, [Hash, T][]>;
|
||||
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
|
||||
range: <T extends Codec | any = ReturnCodec<F>>([from, to]: [Hash | Uint8Array | string, Hash | Uint8Array | string | undefined] | [Hash | Uint8Array | string], ...args: Parameters<F>) => PromiseOrObs<ApiType, [Hash, T][]>;
|
||||
sizeAt: (hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
|
||||
multi: ApiType extends 'rxjs' ? StorageEntryObservableMulti : StorageEntryPromiseMulti;
|
||||
multi: ApiType extends 'rxjs'
|
||||
? StorageEntryObservableMulti<ReturnCodec<F>>
|
||||
: StorageEntryPromiseMulti<ReturnCodec<F>>;
|
||||
}
|
||||
|
||||
export interface StorageEntryBaseAt<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> {
|
||||
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
entries: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
|
||||
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
|
||||
key: (...args: Parameters<F>) => string;
|
||||
|
||||
@@ -41,10 +41,6 @@ function entrySignature (lookup: PortableRegistry, allDefs: Record<string, Modul
|
||||
const keyTypes = similarTypes.map((t) => t.join(' | '));
|
||||
const defValue = lookup.getTypeDef(value);
|
||||
|
||||
if (value.toNumber() === 416) {
|
||||
console.log(JSON.stringify(defValue));
|
||||
}
|
||||
|
||||
setImports(allDefs, imports, [
|
||||
...similarTypes.reduce<string[]>((all, t) => all.concat(t), []),
|
||||
storageEntry.modifier.isOptional
|
||||
|
||||
@@ -138,12 +138,9 @@ export default {
|
||||
xcm: 'XcmV2Xcm',
|
||||
},
|
||||
Transact: {
|
||||
_alias: {
|
||||
call_: 'call',
|
||||
},
|
||||
originType: 'XcmV0OriginKind',
|
||||
requireWeightAtMost: 'Compact<u64>',
|
||||
call_: 'XcmDoubleEncoded',
|
||||
call: 'XcmDoubleEncoded',
|
||||
},
|
||||
HrmpNewChannelOpenRequest: {
|
||||
sender: 'Compact<u32>',
|
||||
@@ -501,12 +498,9 @@ export default {
|
||||
effects: 'Vec<XcmV0Order>',
|
||||
},
|
||||
Transact: {
|
||||
_alias: {
|
||||
call_: 'call',
|
||||
},
|
||||
originType: 'XcmV0OriginKind',
|
||||
requireWeightAtMost: 'u64',
|
||||
call_: 'XcmDoubleEncoded',
|
||||
call: 'XcmDoubleEncoded',
|
||||
},
|
||||
HrmpNewChannelOpenRequest: {
|
||||
sender: 'Compact<u32>',
|
||||
@@ -609,12 +603,9 @@ export default {
|
||||
effects: 'Vec<XcmV1Order>',
|
||||
},
|
||||
Transact: {
|
||||
_alias: {
|
||||
call_: 'call',
|
||||
},
|
||||
originType: 'XcmV0OriginKind',
|
||||
requireWeightAtMost: 'u64',
|
||||
call_: 'XcmDoubleEncoded',
|
||||
call: 'XcmDoubleEncoded',
|
||||
},
|
||||
HrmpNewChannelOpenRequest: {
|
||||
sender: 'Compact<u32>',
|
||||
|
||||
@@ -965,8 +965,7 @@ export default {
|
||||
**/
|
||||
PalletContractsScheduleInstructionWeights: {
|
||||
_alias: {
|
||||
r_if: 'r#if',
|
||||
call_: 'call'
|
||||
r_if: 'r#if'
|
||||
},
|
||||
version: 'u32',
|
||||
i64Const: 'u32',
|
||||
@@ -978,7 +977,7 @@ export default {
|
||||
brIf: 'u32',
|
||||
brTable: 'u32',
|
||||
brTablePerEntry: 'u32',
|
||||
call_: 'u32',
|
||||
call: 'u32',
|
||||
callIndirect: 'u32',
|
||||
callIndirectPerParam: 'u32',
|
||||
localGet: 'u32',
|
||||
@@ -1026,8 +1025,7 @@ export default {
|
||||
**/
|
||||
PalletContractsScheduleHostFnWeights: {
|
||||
_alias: {
|
||||
r_return: 'r#return',
|
||||
call_: 'call'
|
||||
r_return: 'r#return'
|
||||
},
|
||||
caller: 'u64',
|
||||
address: 'u64',
|
||||
@@ -1056,7 +1054,7 @@ export default {
|
||||
getStorage: 'u64',
|
||||
getStoragePerByte: 'u64',
|
||||
transfer: 'u64',
|
||||
call_: 'u64',
|
||||
call: 'u64',
|
||||
callTransferSurcharge: 'u64',
|
||||
callPerInputByte: 'u64',
|
||||
callPerOutputByte: 'u64',
|
||||
@@ -1160,12 +1158,9 @@ export default {
|
||||
* Lookup454: pallet_scheduler::ScheduledV2<node_runtime::Call, BlockNumber, node_runtime::OriginCaller, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletSchedulerScheduledV2: {
|
||||
_alias: {
|
||||
call_: 'call'
|
||||
},
|
||||
maybeId: 'Option<Bytes>',
|
||||
priority: 'u8',
|
||||
call_: 'Call',
|
||||
call: 'Call',
|
||||
maybePeriodic: 'Option<(u32,u32)>',
|
||||
origin: 'NodeRuntimeOriginCaller'
|
||||
},
|
||||
|
||||
@@ -156,7 +156,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asTransact: {
|
||||
readonly originType: XcmV0OriginKind;
|
||||
readonly requireWeightAtMost: Compact<u64>;
|
||||
readonly call_: XcmDoubleEncoded;
|
||||
readonly call: XcmDoubleEncoded;
|
||||
} & Struct;
|
||||
readonly isHrmpNewChannelOpenRequest: boolean;
|
||||
readonly asHrmpNewChannelOpenRequest: {
|
||||
@@ -539,7 +539,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asTransact: {
|
||||
readonly originType: XcmV0OriginKind;
|
||||
readonly requireWeightAtMost: u64;
|
||||
readonly call_: XcmDoubleEncoded;
|
||||
readonly call: XcmDoubleEncoded;
|
||||
} & Struct;
|
||||
readonly isHrmpNewChannelOpenRequest: boolean;
|
||||
readonly asHrmpNewChannelOpenRequest: {
|
||||
@@ -654,7 +654,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asTransact: {
|
||||
readonly originType: XcmV0OriginKind;
|
||||
readonly requireWeightAtMost: u64;
|
||||
readonly call_: XcmDoubleEncoded;
|
||||
readonly call: XcmDoubleEncoded;
|
||||
} & Struct;
|
||||
readonly isHrmpNewChannelOpenRequest: boolean;
|
||||
readonly asHrmpNewChannelOpenRequest: {
|
||||
|
||||
@@ -1029,7 +1029,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly brIf: u32;
|
||||
readonly brTable: u32;
|
||||
readonly brTablePerEntry: u32;
|
||||
readonly call_: u32;
|
||||
readonly call: u32;
|
||||
readonly callIndirect: u32;
|
||||
readonly callIndirectPerParam: u32;
|
||||
readonly localGet: u32;
|
||||
@@ -1102,7 +1102,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly getStorage: u64;
|
||||
readonly getStoragePerByte: u64;
|
||||
readonly transfer: u64;
|
||||
readonly call_: u64;
|
||||
readonly call: u64;
|
||||
readonly callTransferSurcharge: u64;
|
||||
readonly callPerInputByte: u64;
|
||||
readonly callPerOutputByte: u64;
|
||||
@@ -1200,7 +1200,7 @@ declare module '@polkadot/types/lookup' {
|
||||
export interface PalletSchedulerScheduledV2 extends Struct {
|
||||
readonly maybeId: Option<Bytes>;
|
||||
readonly priority: u8;
|
||||
readonly call_: Call;
|
||||
readonly call: Call;
|
||||
readonly maybePeriodic: Option<ITuple<[u32, u32]>>;
|
||||
readonly origin: NodeRuntimeOriginCaller;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ const SETS = [
|
||||
// These we never use these as top-level names, they are wrappers
|
||||
const WRAPPERS = ['BoundedBTreeMap', 'BoundedVec', 'Box', 'BTreeMap', 'Cow', 'Result', 'Option', 'WeakBoundedVec', 'WrapperOpaque'];
|
||||
|
||||
// These are reserved and/or conflicts with built-in Codec definitions
|
||||
const RESERVED = ['call', 'entries', 'hash', 'keys', 'new', 'size'];
|
||||
// These are reserved and/or conflicts with built-in Codec or JS definitions
|
||||
const RESERVED = ['entries', 'hash', 'keys', 'new', 'size'];
|
||||
|
||||
function matchParts (first: string[], second: (string | Text)[]): boolean {
|
||||
return first.length === second.length && first.every((a, index) => {
|
||||
|
||||
@@ -33,9 +33,9 @@ export default {
|
||||
},
|
||||
VoteThreshold: {
|
||||
_enum: [
|
||||
'Super majority approval',
|
||||
'Super majority rejection',
|
||||
'Simple majority'
|
||||
'Super Majority Approve',
|
||||
'Super Majority Against',
|
||||
'Simple Majority'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ export interface VoterInfo extends Struct {
|
||||
|
||||
/** @name VoteThreshold */
|
||||
export interface VoteThreshold extends Enum {
|
||||
readonly isSupermajorityapproval: boolean;
|
||||
readonly isSupermajorityrejection: boolean;
|
||||
readonly isSimplemajority: boolean;
|
||||
readonly isSuperMajorityApprove: boolean;
|
||||
readonly isSuperMajorityAgainst: boolean;
|
||||
readonly isSimpleMajority: boolean;
|
||||
}
|
||||
|
||||
export type PHANTOM_ELECTIONS = 'elections';
|
||||
|
||||
Reference in New Issue
Block a user