Bump deps, export elections (#1146)
This commit is contained in:
+4
-4
@@ -29,10 +29,10 @@
|
||||
"test:watch": "jest --coverage --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.4",
|
||||
"@babel/register": "^7.4.4",
|
||||
"@babel/runtime": "^7.5.4",
|
||||
"@polkadot/dev": "^0.30.0-beta.22",
|
||||
"@babel/core": "^7.5.5",
|
||||
"@babel/register": "^7.5.5",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/dev": "^0.30.0-beta.23",
|
||||
"@polkadot/ts": "^0.1.62",
|
||||
"gh-pages": "^2.0.1"
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.4",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/types": "^0.82.0-beta.71"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.4",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/api": "^0.82.0-beta.71",
|
||||
"@polkadot/types": "^0.82.0-beta.71",
|
||||
"@types/memoizee": "^0.4.2",
|
||||
"memoizee": "^0.4.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^0.94.0-beta.15"
|
||||
"@polkadot/keyring": "^0.94.0-beta.16"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
import BN from 'bn.js';
|
||||
// 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 { Observable } from 'rxjs';
|
||||
import { switchMap, map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { AccountId, Vector, SetIndex, ApprovalFlag } from '@polkadot/types';
|
||||
import { drr } from '../util/drr';
|
||||
|
||||
export function approvalFlagToBool (flags: Vector<ApprovalFlag>): boolean[] {
|
||||
const bools: boolean[] = [];
|
||||
for (const flag of flags) {
|
||||
for (const bit of [...Array(flag.bitLength())].map((_, i): number => i)) {
|
||||
bools.push(!flag.toBn().uand((new BN(1)).shln(bit)).isZero());
|
||||
}
|
||||
}
|
||||
const lastApproval: number = bools.lastIndexOf(true);
|
||||
return lastApproval >= 0 ? bools.slice(0, lastApproval + 1) : [];
|
||||
}
|
||||
|
||||
export function approvalsOf (api: ApiInterfaceRx): (who: AccountId) => Observable<Vector<ApprovalFlag>> {
|
||||
return (who: AccountId): Observable<Vector<ApprovalFlag>> =>
|
||||
api.query.elections.nextVoterSet<SetIndex>().pipe(
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// 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.
|
||||
|
||||
export * from './approvalsOf';
|
||||
export * from './voters';
|
||||
@@ -1,3 +1,7 @@
|
||||
// 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 { Observable } from 'rxjs';
|
||||
import { switchMap, map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
|
||||
@@ -12,6 +12,7 @@ import * as balances from './balances';
|
||||
import * as chain from './chain';
|
||||
import * as contracts from './contracts';
|
||||
import * as democracy from './democracy';
|
||||
import * as elections from './elections';
|
||||
import * as session from './session';
|
||||
import * as staking from './staking';
|
||||
|
||||
@@ -55,7 +56,7 @@ function injectFunctions<AllSections> (api: ApiInterfaceRx, allSections: AllSect
|
||||
}, {} as unknown as DeriveSections<AllSections>);
|
||||
}
|
||||
|
||||
export const derive = { accounts, balances, chain, contracts, democracy, session, staking };
|
||||
export const derive = { accounts, balances, chain, contracts, democracy, elections, session, staking };
|
||||
export type Derive = typeof derive;
|
||||
|
||||
// FIXME I have no idea how to get this done
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 BN from 'bn.js';
|
||||
import { Vector, ApprovalFlag } from '@polkadot/types';
|
||||
|
||||
export function approvalFlagToBool (flags: Vector<ApprovalFlag>): boolean[] {
|
||||
const bools: boolean[] = [];
|
||||
for (const flag of flags) {
|
||||
for (const bit of [...Array(flag.bitLength())].map((_, i): number => i)) {
|
||||
bools.push(!flag.toBn().uand((new BN(1)).shln(bit)).isZero());
|
||||
}
|
||||
}
|
||||
const lastApproval: number = bools.lastIndexOf(true);
|
||||
return lastApproval >= 0 ? bools.slice(0, lastApproval + 1) : [];
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// 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.
|
||||
|
||||
export * from './approvalFlagToBool';
|
||||
@@ -26,12 +26,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.4",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/types": "^0.82.0-beta.71",
|
||||
"@polkadot/util": "^0.94.0-beta.15",
|
||||
"@polkadot/util-crypto": "^0.94.0-beta.15"
|
||||
"@polkadot/util": "^0.94.0-beta.16",
|
||||
"@polkadot/util-crypto": "^0.94.0-beta.16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^0.94.0-beta.15"
|
||||
"@polkadot/keyring": "^0.94.0-beta.16"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,15 +26,15 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.4",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/api-derive": "^0.82.0-beta.71",
|
||||
"@polkadot/api-metadata": "^0.82.0-beta.71",
|
||||
"@polkadot/rpc-core": "^0.82.0-beta.71",
|
||||
"@polkadot/rpc-provider": "^0.82.0-beta.71",
|
||||
"@polkadot/types": "^0.82.0-beta.71",
|
||||
"@polkadot/util-crypto": "^0.94.0-beta.15"
|
||||
"@polkadot/util-crypto": "^0.94.0-beta.16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^0.94.0-beta.15"
|
||||
"@polkadot/keyring": "^0.94.0-beta.16"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.4",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/jsonrpc": "^0.82.0-beta.71",
|
||||
"@polkadot/rpc-provider": "^0.82.0-beta.71",
|
||||
"@polkadot/types": "^0.82.0-beta.71",
|
||||
"@polkadot/util": "^0.94.0-beta.15",
|
||||
"@polkadot/util": "^0.94.0-beta.16",
|
||||
"memoizee": "^0.4.14",
|
||||
"rxjs": "^6.5.2"
|
||||
}
|
||||
|
||||
@@ -26,17 +26,17 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.4",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/api-metadata": "^0.82.0-beta.71",
|
||||
"@polkadot/util": "^0.94.0-beta.15",
|
||||
"@polkadot/util-crypto": "^0.94.0-beta.15",
|
||||
"@polkadot/util": "^0.94.0-beta.16",
|
||||
"@polkadot/util-crypto": "^0.94.0-beta.16",
|
||||
"@types/nock": "^10.0.3",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"websocket": "^1.0.29"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^0.94.0-beta.15",
|
||||
"@polkadot/keyring": "^0.94.0-beta.16",
|
||||
"mock-socket": "^8.0.5",
|
||||
"nock": "^10.0.4"
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-jsonrpc#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.4"
|
||||
"@babel/runtime": "^7.5.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.5.4",
|
||||
"@polkadot/util": "^0.94.0-beta.15",
|
||||
"@polkadot/util-crypto": "^0.94.0-beta.15"
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"@polkadot/util": "^0.94.0-beta.16",
|
||||
"@polkadot/util-crypto": "^0.94.0-beta.16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^0.94.0-beta.15"
|
||||
"@polkadot/keyring": "^0.94.0-beta.16"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user