Alias votingBalance -> all

This commit is contained in:
Jaco Greeff
2019-05-27 16:00:38 +02:00
parent 96b40d041c
commit 2d94ac7d24
3 changed files with 11 additions and 15 deletions
+9 -2
View File
@@ -2,8 +2,15 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
export * from './all';
import { all } from './all';
export * from './fees';
export * from './votingBalance';
export * from './votingBalances';
export * from './votingBalancesNominatorsFor';
const votingBalance = all;
export {
all,
votingBalance
};
@@ -1,11 +0,0 @@
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { ApiInterface$Rx } from '@polkadot/api/types';
import { all } from './all';
export function votingBalance (api: ApiInterface$Rx) {
return all(api);
}
@@ -9,14 +9,14 @@ import { AccountId, AccountIndex, Address, VectorAny } from '@polkadot/types';
import { DerivedBalances } from '../types';
import { drr } from '../util/drr';
import { votingBalance } from './votingBalance';
import { all } from './all';
export function votingBalances (api: ApiInterface$Rx) {
return (addresses?: Array<AccountId | AccountIndex | Address | string>): Observable<VectorAny<DerivedBalances>> => {
return (
!addresses || !addresses.length
? of([] as Array<DerivedBalances>)
: combineLatest(addresses.map(votingBalance(api)))
: combineLatest(addresses.map(all(api)))
).pipe(
map((balances) =>
new VectorAny(...balances)