Move Event, Address, AccountId, AccountIndex to generic (#1202)

* Move Event, Address, AccountId, AccountIndex to generic

* Move AccountId, AccountIndex, Address & Event to generic

* Move Vote
This commit is contained in:
Jaco Greeff
2019-07-26 16:39:28 +02:00
committed by GitHub
parent 894f07e3c9
commit 02cd1331aa
69 changed files with 247 additions and 246 deletions
@@ -2,11 +2,13 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, Vote } from '@polkadot/types/interfaces';
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, Vec, Vote, createType } from '@polkadot/types';
import { Vec, createType } from '@polkadot/types';
import { DerivedBalances, DerivedReferendumVote } from '../types';
import { drr } from '../util/drr';
@@ -26,8 +28,8 @@ export function referendumVotesFor (api: ApiInterfaceRx): (referendumId: BN | nu
map(([votersFor, votes, balances]): DerivedReferendumVote[] =>
votersFor.map((accountId, index): DerivedReferendumVote => ({
accountId,
balance: balances[index].votingBalance || createType('Balance', 0),
vote: votes[index] || new Vote(0)
balance: balances[index].votingBalance || createType('Balance'),
vote: votes[index] || createType('Vote')
} as unknown as DerivedReferendumVote))
),
drr()
+3 -1
View File
@@ -2,10 +2,12 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, Vote } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, Vec, Vote } from '@polkadot/types';
import { Vec } from '@polkadot/types';
import { drr } from '../util/drr';