Adjust object index typings (#5671)
* Adjust object index typings * CHANGELOG * Remove dot-notation overrides * Align overrides * Ordering * Revert lint formatting changes * Bump common
This commit is contained in:
@@ -53,7 +53,7 @@ function isBounded (call: FrameSupportPreimagesBounded | FrameSupportScheduleMay
|
||||
}
|
||||
|
||||
function queryQueue (api: DeriveApi): Observable<DeriveDispatch[]> {
|
||||
return api.query.democracy.dispatchQueue<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>().pipe(
|
||||
return api.query.democracy['dispatchQueue']<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>().pipe(
|
||||
switchMap((dispatches) =>
|
||||
combineLatest([
|
||||
of(dispatches),
|
||||
@@ -142,7 +142,7 @@ export function dispatchQueue (instanceId: string, api: DeriveApi): () => Observ
|
||||
return memo(instanceId, (): Observable<DeriveDispatch[]> =>
|
||||
isFunction(api.query.scheduler?.agenda)
|
||||
? queryScheduler(api)
|
||||
: api.query.democracy.dispatchQueue
|
||||
: api.query.democracy['dispatchQueue']
|
||||
? queryQueue(api)
|
||||
: of([])
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
|
||||
type OldPreimage = ITuple<PreimageInfo>;
|
||||
|
||||
function isDemocracyPreimage (api: DeriveApi, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): imageOpt is Option<PreimageStatus> {
|
||||
return !!imageOpt && !api.query.democracy.dispatchQueue;
|
||||
return !!imageOpt && !api.query.democracy['dispatchQueue'];
|
||||
}
|
||||
|
||||
function constructProposal (api: DeriveApi, [bytes, proposer, balance, at]: PreimageInfo): DeriveProposalImage {
|
||||
@@ -79,7 +79,7 @@ function parseImage (api: DeriveApi, [proposalHash, status, bytes]: [HexString,
|
||||
function getDemocracyImages (api: DeriveApi, bounded: (Hash | Uint8Array | string | FrameSupportPreimagesBounded)[]): Observable<(DeriveProposalImage | undefined)[]> {
|
||||
const hashes = bounded.map((b) => getImageHashBounded(b));
|
||||
|
||||
return api.query.democracy.preimages.multi<Option<PreimageStatus>>(hashes).pipe(
|
||||
return api.query.democracy['preimages'].multi<Option<PreimageStatus>>(hashes).pipe(
|
||||
map((images): (DeriveProposalImage | undefined)[] =>
|
||||
images.map((imageOpt) => parseDemocracy(api, imageOpt))
|
||||
)
|
||||
@@ -127,7 +127,7 @@ function getImages (api: DeriveApi, bounded: (FrameSupportPreimagesBounded | Uin
|
||||
export function preimages (instanceId: string, api: DeriveApi): (hashes: (Hash | Uint8Array | string | FrameSupportPreimagesBounded)[]) => Observable<(DeriveProposalImage | undefined)[]> {
|
||||
return memo(instanceId, (hashes: (Hash | Uint8Array | string | FrameSupportPreimagesBounded)[]): Observable<(DeriveProposalImage | undefined)[]> =>
|
||||
hashes.length
|
||||
? isFunction(api.query.democracy.preimages)
|
||||
? isFunction(api.query.democracy['preimages'])
|
||||
? getDemocracyImages(api, hashes)
|
||||
: isFunction(api.query.preimage.preimageFor)
|
||||
? getImages(api, hashes)
|
||||
|
||||
@@ -23,7 +23,6 @@ type Result = [Proposals, (DeriveProposalImage | undefined)[], Depositors[]];
|
||||
|
||||
function isNewDepositors (depositors: ITuple<[Vec<AccountId>, Balance]> | ITuple<[Balance, Vec<AccountId>]>): depositors is ITuple<[Vec<AccountId>, Balance]> {
|
||||
// Detect balance...
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
return isFunction((depositors[1] as Balance).mul);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ type VotingDirect = PalletDemocracyVoteVoting['asDirect'];
|
||||
type VotingDirectVote = VotingDirect['votes'][0];
|
||||
|
||||
function votesPrev (api: DeriveApi, referendumId: BN): Observable<DeriveReferendumVote[]> {
|
||||
return api.query.democracy.votersFor<Vec<AccountId>>(referendumId).pipe(
|
||||
return api.query.democracy['votersFor']<Vec<AccountId>>(referendumId).pipe(
|
||||
switchMap((votersFor): Observable<[Vec<AccountId>, Vote[], DeriveBalancesAccount[]]> =>
|
||||
combineLatest([
|
||||
of(votersFor),
|
||||
votersFor.length
|
||||
? api.query.democracy.voteOf.multi<Vote>(
|
||||
? api.query.democracy['voteOf'].multi<Vote>(
|
||||
votersFor.map((accountId): [BN | number, AccountId] =>
|
||||
[referendumId, accountId]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user