Elections derive (#1143)

* elections

* headers

* lint

* lint

* lint

* lint

* fixes

* lint

* voterSets
This commit is contained in:
kwingram25
2019-07-19 21:27:02 +02:00
committed by Jaco Greeff
parent cbd717ca65
commit ab74db5126
11 changed files with 252 additions and 29 deletions
@@ -0,0 +1,16 @@
// 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 { Vector, ApprovalFlag } from '@polkadot/types';
export function approvalFlagsToBools (flags: Vector<ApprovalFlag>): boolean[] {
const bools: boolean[] = [];
flags.forEach((flag: ApprovalFlag): void => {
const str = flag.toString(2);
for (const bit of str) {
bools.push(!!parseInt(bit, 10));
}
});
return bools;
}