Convert RPC classes to primitive classes or /srml types (#1192)

* Convert RPC classes to primitive classes or /srml types

* Lint passes... lokking at tests next.

* Tests pass.

* Types with basic docs (lots of work here)

* Update StorageKey.spec.ts

* Add injector to metadata doc generation

* Fix import
This commit is contained in:
Jaco Greeff
2019-07-26 10:23:37 +02:00
committed by GitHub
parent 83515fc0a2
commit 478f54c703
144 changed files with 1824 additions and 2224 deletions
@@ -8,7 +8,7 @@ import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Option, Vector } from '@polkadot/types';
import { Option, Vec } from '@polkadot/types';
import { ReferendumInfoExtended } from '../type';
import { drr } from '../util/drr';
@@ -19,7 +19,7 @@ export function referendumInfos (api: ApiInterfaceRx): (ids?: (BN | number)[]) =
return (
!ids || !ids.length
? of([] as Option<ReferendumInfo>[])
: api.query.democracy.referendumInfoOf.multi(ids) as Observable<Vector<Option<ReferendumInfo>>>
: api.query.democracy.referendumInfoOf.multi(ids) as Observable<Vec<Option<ReferendumInfo>>>
).pipe(
map((infos): Option<ReferendumInfoExtended>[] =>
ids.map((id, index): Option<ReferendumInfoExtended> =>
@@ -8,7 +8,7 @@ import BN from 'bn.js';
import { combineLatest, Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, Vector, Vote, createType } from '@polkadot/types';
import { AccountId, Vec, Vote, createType } from '@polkadot/types';
import { DerivedBalances, DerivedReferendumVote } from '../types';
import { drr } from '../util/drr';
@@ -17,8 +17,8 @@ import { votingBalances } from '../balances/votingBalances';
export function referendumVotesFor (api: ApiInterfaceRx): (referendumId: BN | number) => Observable<DerivedReferendumVote[]> {
return (referendumId: BN | number): Observable<DerivedReferendumVote[]> =>
(api.query.democracy.votersFor<Vector<AccountId>>(referendumId)).pipe(
switchMap((votersFor): Observable<[Vector<AccountId>, Vote[], DerivedBalances[]]> =>
(api.query.democracy.votersFor<Vec<AccountId>>(referendumId)).pipe(
switchMap((votersFor): Observable<[Vec<AccountId>, Vote[], DerivedBalances[]]> =>
combineLatest([
of(votersFor),
votes(api)(referendumId as BN, votersFor),
+2 -2
View File
@@ -5,7 +5,7 @@
import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, Vector, Vote } from '@polkadot/types';
import { AccountId, Vec, Vote } from '@polkadot/types';
import { drr } from '../util/drr';
@@ -19,6 +19,6 @@ export function votes (api: ApiInterfaceRx): (referendumId: BN, accountIds?: Acc
[referendumId, accountId]
)
)
) as Observable<Vector<Vote>>).pipe(drr());
) as Observable<Vec<Vote>>).pipe(drr());
};
}