Skip to content

Commit

Permalink
Map Vector -> Array for queries
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Oct 9, 2018
1 parent 4986897 commit 37456fe
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions packages/api-observable/src/Queries.ts
Expand Up @@ -9,7 +9,7 @@ import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import storage from '@polkadot/storage/static';
import { AccountId, Balance, bool as Bool, BlockNumber, Index, Moment, Perbill, PropIndex, ReferendumIndex, u32 } from '@polkadot/types/index';
import { Tuple } from '@polkadot/types/codec';
import { Tuple, Vector } from '@polkadot/types/codec';

import ApiBase from './Base';
import { RxProposal, RxProposalDeposits, RxReferendum } from './classes';
Expand Down Expand Up @@ -62,7 +62,7 @@ export default class ApiQueries extends ApiBase {
.rawStorage(storage.democracy.publicProps)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((proposals: Array<Tuple> = []) =>
map((proposals: Vector<Tuple> = []) =>
proposals
.map((result: Tuple): RxProposal | undefined =>
result
Expand Down Expand Up @@ -102,8 +102,10 @@ export default class ApiQueries extends ApiBase {
.rawStorage(storage.democracy.votersFor, index)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((voters: Array<AccountId> = []) =>
voters
map((voters: Vector<AccountId> = []) =>
voters.map((accountId) =>
accountId
)
)
);
}
Expand Down Expand Up @@ -170,8 +172,10 @@ export default class ApiQueries extends ApiBase {
.rawStorage(storage.session.validators)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((validators: Array<AccountId> = []) =>
validators
map((validators: Vector<AccountId> = []) =>
validators.map((authorityId) =>
authorityId
)
)
);
}
Expand All @@ -181,8 +185,10 @@ export default class ApiQueries extends ApiBase {
.rawStorage(storage.staking.intentions)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((intentions: Array<AccountId> = []) =>
intentions
map((intentions: Vector<AccountId> = []) =>
intentions.map((accountId) =>
accountId
)
)
);
}
Expand All @@ -192,8 +198,10 @@ export default class ApiQueries extends ApiBase {
.rawStorage(storage.staking.nominatorsFor, address)
.pipe(
// @ts-ignore After upgrade to 6.3.2
map((nominators: Array<AccountId> = []) =>
nominators
map((nominators: Vector<AccountId> = []) =>
nominators.map((accountId) =>
accountId
)
)
);
}
Expand Down

0 comments on commit 37456fe

Please sign in to comment.