From acaca67385d0314be7a667e3c2450b1ae51a9226 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 27 May 2019 12:49:19 +0200 Subject: [PATCH] derive.{balances, contracts, staking, session} returns Codec (#953) * derive.{balances, contracts, staking, session} returns Codec * Json -> StructAny (as per VectorAny) * multi returns VectorAny * VectorAny casts * Bump common --- packages/api-derive/src/balances/all.ts | 38 +++--- packages/api-derive/src/balances/fees.ts | 23 ++-- packages/api-derive/src/balances/index.ts | 2 - .../src/balances/validatingBalance.ts | 41 ------- .../src/balances/validatingBalances.ts | 31 ----- .../api-derive/src/balances/votingBalance.ts | 40 +------ .../api-derive/src/balances/votingBalances.ts | 18 ++- .../balances/votingBalancesNominatorsFor.ts | 4 +- packages/api-derive/src/contract/fees.ts | 9 +- .../src/democracy/referendumInfo.ts | 37 +----- .../src/democracy/referendumInfos.ts | 17 +-- .../src/democracy/referendumVotesFor.ts | 18 +-- .../api-derive/src/democracy/referendums.ts | 2 +- packages/api-derive/src/democracy/votes.ts | 16 +-- packages/api-derive/src/index.spec.ts | 2 - packages/api-derive/src/session/info.ts | 6 +- packages/api-derive/src/staking/index.ts | 1 - packages/api-derive/src/staking/info.ts | 58 +++++----- .../src/staking/intentionsBalances.ts | 25 ---- .../src/type/ReferendumInfoExtended.ts | 40 +++++++ packages/api-derive/src/type/index.ts | 1 + packages/api-derive/src/types.ts | 109 +++++++++--------- packages/api/package.json | 2 +- packages/api/src/Base.ts | 12 +- packages/rpc-core/package.json | 2 +- packages/rpc-provider/package.json | 6 +- packages/type-extrinsics/package.json | 2 +- packages/type-storage/package.json | 6 +- packages/types/README.md | 2 +- packages/types/package.json | 4 +- .../src/{rpc/Json.ts => codec/StructAny.ts} | 24 +++- packages/types/src/codec/index.ts | 2 + packages/types/src/rpc/ChainProperties.ts | 4 +- packages/types/src/rpc/NetworkState.ts | 4 +- packages/types/src/rpc/index.ts | 1 - yarn.lock | 30 ++--- 36 files changed, 276 insertions(+), 363 deletions(-) delete mode 100644 packages/api-derive/src/balances/validatingBalance.ts delete mode 100644 packages/api-derive/src/balances/validatingBalances.ts delete mode 100644 packages/api-derive/src/staking/intentionsBalances.ts create mode 100644 packages/api-derive/src/type/ReferendumInfoExtended.ts rename packages/types/src/{rpc/Json.ts => codec/StructAny.ts} (77%) diff --git a/packages/api-derive/src/balances/all.ts b/packages/api-derive/src/balances/all.ts index 610c2519e6..98d452396b 100644 --- a/packages/api-derive/src/balances/all.ts +++ b/packages/api-derive/src/balances/all.ts @@ -5,46 +5,45 @@ import { combineLatest, of, Observable } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, AccountIndex, Address, Balance, BalanceLock, BlockNumber, Option, VestingSchedule } from '@polkadot/types'; +import { AccountId, AccountIndex, Address, Balance, BalanceLock, BlockNumber, Index, StructAny, Option, VestingSchedule } from '@polkadot/types'; import { bnMax } from '@polkadot/util'; import { idAndIndex } from '../accounts/idAndIndex'; import { DerivedBalances } from '../types'; import { drr } from '../util/drr'; -type Result = [AccountId | undefined, BlockNumber | undefined, [Balance?, Balance?, Array?, Option?]]; +type Result = [AccountId | undefined, BlockNumber | undefined, [Balance?, Balance?, Array?, Option?, Index?]]; const EMPTY_ACCOUNT = new AccountId(); -function calcBalances ([accountId = EMPTY_ACCOUNT, bestNumber = new BlockNumber(0), [freeBalance = new Balance(0), reservedBalance = new Balance(0), locks = [], vesting = new Option(VestingSchedule, null)]]: Result): DerivedBalances { +function calcBalances ([accountId = EMPTY_ACCOUNT, bestNumber = new BlockNumber(0), [freeBalance = new Balance(0), reservedBalance = new Balance(0), locks = [], vesting = new Option(VestingSchedule, null), accountNonce = new Index(0)]]: Result): DerivedBalances { let lockedBalance = new Balance(0); if (Array.isArray(locks)) { // only get the locks that are valid until passed the current block const totals = locks.filter((value) => bestNumber && value.until.gt(bestNumber)); // get the maximum of the locks according to https://github.com/paritytech/substrate/blob/master/srml/balances/src/lib.rs#L699 - lockedBalance = totals[0] ? bnMax(...totals.map(({ amount }) => amount)) as Balance : new Balance(0); + lockedBalance = totals[0] + ? bnMax(...totals.map(({ amount }) => amount)) as Balance + : new Balance(0); } - const { offset, perBlock } = vesting.unwrapOr({ - offset: new Balance(0), - perBlock: new Balance(0) - } as VestingSchedule); - + const { offset, perBlock } = vesting.unwrapOr(new VestingSchedule()); const vestedBalance = new Balance(perBlock.mul(bestNumber).add(freeBalance.sub(offset))); const availableBalance = new Balance(vestedBalance.sub(lockedBalance)); - return { + return new StructAny({ accountId, - freeBalance, - reservedBalance, - votingBalance: new Balance( - freeBalance.add(reservedBalance) - ), + accountNonce, availableBalance, + freeBalance, lockedBalance, - vestedBalance: vestedBalance.lt(new Balance(0)) ? new Balance(0) : vestedBalance - }; + reservedBalance, + vestedBalance: vestedBalance.lt(new Balance(0)) + ? new Balance(0) + : vestedBalance, + votingBalance: new Balance(freeBalance.add(reservedBalance)) + }) as DerivedBalances; } /** @@ -75,10 +74,11 @@ export function all (api: ApiInterface$Rx) { [api.query.balances.freeBalance, accountId], [api.query.balances.reservedBalance, accountId], [api.query.balances.locks, accountId], - [api.query.balances.vesting, accountId] + [api.query.balances.vesting, accountId], + [api.query.system.accountNonce, accountId] ]) ]) - : of([undefined, undefined, [undefined, undefined, undefined, undefined]]) + : of([undefined, undefined, [undefined, undefined, undefined, undefined, undefined]]) ) as any as Observable ), map(calcBalances), diff --git a/packages/api-derive/src/balances/fees.ts b/packages/api-derive/src/balances/fees.ts index 313a7c929e..6950eeb524 100644 --- a/packages/api-derive/src/balances/fees.ts +++ b/packages/api-derive/src/balances/fees.ts @@ -2,12 +2,14 @@ // 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 { map } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; +import { DerivedFees } from '../types'; import BN from 'bn.js'; -import { DerivedFees } from '../types'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { StructAny } from '@polkadot/types'; + import { drr } from '../util/drr'; /** @@ -32,13 +34,14 @@ export function fees (api: ApiInterface$Rx) { api.query.balances.transactionByteFee, api.query.balances.transferFee ]) as any as Observable<[BN, BN, BN, BN, BN]>).pipe( - map(([creationFee, existentialDeposit, transactionBaseFee, transactionByteFee, transferFee]) => ({ - creationFee, - existentialDeposit, - transactionBaseFee, - transactionByteFee, - transferFee - })), + map(([creationFee, existentialDeposit, transactionBaseFee, transactionByteFee, transferFee]) => + new StructAny({ + creationFee, + existentialDeposit, + transactionBaseFee, + transactionByteFee, + transferFee + }) as DerivedFees), drr() ); }; diff --git a/packages/api-derive/src/balances/index.ts b/packages/api-derive/src/balances/index.ts index 054b575ac1..fb6684fa78 100644 --- a/packages/api-derive/src/balances/index.ts +++ b/packages/api-derive/src/balances/index.ts @@ -4,8 +4,6 @@ export * from './all'; export * from './fees'; -export * from './validatingBalance'; -export * from './validatingBalances'; export * from './votingBalance'; export * from './votingBalances'; export * from './votingBalancesNominatorsFor'; diff --git a/packages/api-derive/src/balances/validatingBalance.ts b/packages/api-derive/src/balances/validatingBalance.ts deleted file mode 100644 index be364a9c01..0000000000 --- a/packages/api-derive/src/balances/validatingBalance.ts +++ /dev/null @@ -1,41 +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 BN from 'bn.js'; -import { combineLatest, Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; -import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, AccountIndex, Address, Balance } from '@polkadot/types'; - -import { DerivedBalances } from '../types'; -import { drr } from '../util/drr'; -import { votingBalance } from './votingBalance'; -import { votingBalancesNominatorsFor } from './votingBalancesNominatorsFor'; - -export function validatingBalance (api: ApiInterface$Rx) { - return (address: AccountId | AccountIndex | Address | string): Observable => { - return combineLatest([ - votingBalance(api)(address), - votingBalancesNominatorsFor(api)(address) - ]).pipe( - map(([balance, nominators]) => { - const nominatedBalance = nominators.reduce( - (total: BN, nominatorBalance: DerivedBalances) => - total.add(nominatorBalance.votingBalance), - new BN(0) - ); - - return { - ...balance, - nominators, - nominatedBalance: new Balance(nominatedBalance), - stakingBalance: new Balance( - nominatedBalance.add(balance.votingBalance) - ) - }; - }), - drr() - ); - }; -} diff --git a/packages/api-derive/src/balances/validatingBalances.ts b/packages/api-derive/src/balances/validatingBalances.ts deleted file mode 100644 index f08fa0d100..0000000000 --- a/packages/api-derive/src/balances/validatingBalances.ts +++ /dev/null @@ -1,31 +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 { combineLatest, Observable, of } from 'rxjs'; -import { map } from 'rxjs/operators'; -import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, Address } from '@polkadot/types'; - -import { DerivedBalancesMap } from '../types'; -import { drr } from '../util/drr'; -import { validatingBalance } from './validatingBalance'; - -export function validatingBalances (api: ApiInterface$Rx) { - return (accountIds: Array): Observable => { - return !accountIds || !accountIds.length - ? of({}).pipe(drr()) - : combineLatest( - accountIds.map(validatingBalance(api)) - ).pipe( - map((result) => { - return result.reduce((balances, balance) => { - balances[balance.accountId.toString()] = balance; - - return balances; - }, {} as DerivedBalancesMap); - }), - drr() - ); - }; -} diff --git a/packages/api-derive/src/balances/votingBalance.ts b/packages/api-derive/src/balances/votingBalance.ts index 9efa1d0659..5e47c1af1e 100644 --- a/packages/api-derive/src/balances/votingBalance.ts +++ b/packages/api-derive/src/balances/votingBalance.ts @@ -2,46 +2,10 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { combineLatest, of, Observable } from 'rxjs'; -import { map, switchMap } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, AccountIndex, Address, Balance } from '@polkadot/types'; -import { idAndIndex } from '../accounts/idAndIndex'; -import { DerivedBalances } from '../types'; -import { drr } from '../util/drr'; - -const EMPTY_ACCOUNT = new AccountId(new Uint8Array(32)); +import { all } from './all'; export function votingBalance (api: ApiInterface$Rx) { - return (address: AccountIndex | AccountId | Address | string): Observable => { - return idAndIndex(api)(address).pipe( - switchMap(([accountId]) => - (accountId - ? combineLatest([ - of(accountId), - api.query.balances.freeBalance(accountId), - api.query.balances.reservedBalance(accountId) - ]) - : of([undefined, undefined, undefined]) - ) as Observable<[AccountId?, Balance?, Balance?]> - ), - map(([accountId = EMPTY_ACCOUNT, freeBalance = new Balance(0), reservedBalance = new Balance(0)]) => { - return { - accountId, - freeBalance, - nominatedBalance: new Balance(0), - reservedBalance, - stakingBalance: new Balance(0), - votingBalance: new Balance( - freeBalance.add(reservedBalance) - ), - availableBalance: new Balance(0), - lockedBalance: new Balance(0), - vestedBalance: new Balance(0) - }; - }), - drr() - ); - }; + return all(api); } diff --git a/packages/api-derive/src/balances/votingBalances.ts b/packages/api-derive/src/balances/votingBalances.ts index 3c00700806..4aa43e658f 100644 --- a/packages/api-derive/src/balances/votingBalances.ts +++ b/packages/api-derive/src/balances/votingBalances.ts @@ -3,17 +3,25 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { combineLatest, Observable, of } from 'rxjs'; +import { map } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, AccountIndex, Address } from '@polkadot/types'; +import { AccountId, AccountIndex, Address, VectorAny } from '@polkadot/types'; import { DerivedBalances } from '../types'; import { drr } from '../util/drr'; import { votingBalance } from './votingBalance'; export function votingBalances (api: ApiInterface$Rx) { - return (addresses?: Array): Observable> => { - return !addresses || !addresses.length - ? of([]).pipe(drr()) - : combineLatest(addresses.map(votingBalance(api))).pipe(drr()); + return (addresses?: Array): Observable> => { + return ( + !addresses || !addresses.length + ? of([] as Array) + : combineLatest(addresses.map(votingBalance(api))) + ).pipe( + map((balances) => + new VectorAny(...balances) + ), + drr() + ); }; } diff --git a/packages/api-derive/src/balances/votingBalancesNominatorsFor.ts b/packages/api-derive/src/balances/votingBalancesNominatorsFor.ts index d7d104b5ea..08599211c8 100644 --- a/packages/api-derive/src/balances/votingBalancesNominatorsFor.ts +++ b/packages/api-derive/src/balances/votingBalancesNominatorsFor.ts @@ -5,7 +5,7 @@ import { Observable, of } from 'rxjs'; import { switchMap } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, AccountIndex, Address, Vector } from '@polkadot/types'; +import { AccountId, AccountIndex, Address, Vector, VectorAny } from '@polkadot/types'; import { idAndIndex } from '../accounts/idAndIndex'; import { DerivedBalances } from '../types'; @@ -13,7 +13,7 @@ import { drr } from '../util/drr'; import { votingBalances } from './votingBalances'; export function votingBalancesNominatorsFor (api: ApiInterface$Rx) { - return (address: AccountId | AccountIndex | Address | string): Observable> => { + return (address: AccountId | AccountIndex | Address | string): Observable> => { return idAndIndex(api)(address).pipe( switchMap(([accountId]) => accountId diff --git a/packages/api-derive/src/contract/fees.ts b/packages/api-derive/src/contract/fees.ts index e39ebd4663..412c1b202c 100644 --- a/packages/api-derive/src/contract/fees.ts +++ b/packages/api-derive/src/contract/fees.ts @@ -8,6 +8,7 @@ import { DerivedContractFees } from '../types'; import BN from 'bn.js'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; +import { StructAny } from '@polkadot/types'; import { drr } from '../util/drr'; @@ -28,8 +29,8 @@ export function fees (api: ApiInterface$Rx) { api.query.contract.transferFee, api.query.contract.tombstoneDeposit ]) as any as Observable>).pipe( - map(([callBaseFee, contractFee, createBaseFee, creationFee, rentByteFee, rentDepositOffset, transactionBaseFee, transactionByteFee, transferFee, tombstoneDeposit]) => { - return { + map(([callBaseFee, contractFee, createBaseFee, creationFee, rentByteFee, rentDepositOffset, transactionBaseFee, transactionByteFee, transferFee, tombstoneDeposit]) => + new StructAny({ callBaseFee, contractFee, createBaseFee, @@ -40,8 +41,8 @@ export function fees (api: ApiInterface$Rx) { transactionByteFee, transferFee, tombstoneDeposit - }; - }), + }) as DerivedContractFees + ), drr() ); }; diff --git a/packages/api-derive/src/democracy/referendumInfo.ts b/packages/api-derive/src/democracy/referendumInfo.ts index 0c4f328bf8..2b9527e94d 100644 --- a/packages/api-derive/src/democracy/referendumInfo.ts +++ b/packages/api-derive/src/democracy/referendumInfo.ts @@ -6,45 +6,12 @@ import BN from 'bn.js'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { Option, ReferendumInfo, ReferendumIndex } from '@polkadot/types'; +import { Option, ReferendumInfo } from '@polkadot/types'; import { isNull } from '@polkadot/util'; +import { ReferendumInfoExtended } from '../type'; import { drr } from '../util/drr'; -/** - * @name ReferendumInfoExtended - * @description - * A [[ReferendumInfo]] with an additional `index` field - */ -export class ReferendumInfoExtended extends ReferendumInfo { - private _index: ReferendumIndex; - - constructor (value: ReferendumInfo | ReferendumInfoExtended, index?: BN | number) { - super(value); - - this._index = value instanceof ReferendumInfoExtended - ? value.index - : new ReferendumIndex(index); - } - - /** - * @description Convenience getter, returns the referendumIndex - */ - get index (): ReferendumIndex { - return this._index; - } - - /** - * @description Creates the JSON representation - */ - toJSON (): any { - return { - ...super.toJSON(), - index: this.index.toJSON() - }; - } -} - export function constructInfo (index: BN | number, optionInfo?: Option): Option { const info = optionInfo ? optionInfo.unwrapOr(null) diff --git a/packages/api-derive/src/democracy/referendumInfos.ts b/packages/api-derive/src/democracy/referendumInfos.ts index 6c1513bc5c..4418cf5d02 100644 --- a/packages/api-derive/src/democracy/referendumInfos.ts +++ b/packages/api-derive/src/democracy/referendumInfos.ts @@ -6,21 +6,24 @@ import BN from 'bn.js'; import { Observable, of } from 'rxjs'; import { map } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { Option, ReferendumInfo } from '@polkadot/types'; +import { Option, ReferendumInfo, VectorAny } from '@polkadot/types'; +import { ReferendumInfoExtended } from '../type'; import { drr } from '../util/drr'; -import { constructInfo, ReferendumInfoExtended } from './referendumInfo'; +import { constructInfo } from './referendumInfo'; export function referendumInfos (api: ApiInterface$Rx) { - return (ids: Array = []): Observable>> => { + return (ids: Array = []): Observable>> => { return ( !ids || !ids.length - ? of([]) - : api.query.democracy.referendumInfoOf.multi(ids) as any as Observable>> + ? of([] as Array>) + : api.query.democracy.referendumInfoOf.multi(ids) as Observable>> ).pipe( map((infos) => - ids.map((id, index) => - constructInfo(id, infos[index]) + new VectorAny( + ...ids.map((id, index) => + constructInfo(id, infos[index]) + ) ) ), drr() diff --git a/packages/api-derive/src/democracy/referendumVotesFor.ts b/packages/api-derive/src/democracy/referendumVotesFor.ts index d0b86302ef..4684323fae 100644 --- a/packages/api-derive/src/democracy/referendumVotesFor.ts +++ b/packages/api-derive/src/democracy/referendumVotesFor.ts @@ -6,7 +6,7 @@ import BN from 'bn.js'; import { combineLatest, Observable, of } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, Balance, Vector, Vote } from '@polkadot/types'; +import { AccountId, Balance, StructAny, Vector, VectorAny, Vote } from '@polkadot/types'; import { DerivedReferendumVote } from '../types'; import { drr } from '../util/drr'; @@ -14,7 +14,7 @@ import { votes } from './votes'; import { votingBalances } from '../balances/votingBalances'; export function referendumVotesFor (api: ApiInterface$Rx) { - return (referendumId: BN | number): Observable> => + return (referendumId: BN | number): Observable> => (api.query.democracy.votersFor(referendumId) as Observable>).pipe( switchMap((votersFor) => combineLatest([ @@ -24,11 +24,15 @@ export function referendumVotesFor (api: ApiInterface$Rx) { ]) ), map(([votersFor, votes, balances]) => - votersFor.map((accountId, index): DerivedReferendumVote => ({ - accountId, - balance: balances[index].votingBalance || new Balance(0), - vote: votes[index] || new Vote(0) - })) + new VectorAny( + ...votersFor.map((accountId, index): DerivedReferendumVote => + new StructAny({ + accountId, + balance: balances[index].votingBalance || new Balance(0), + vote: votes[index] || new Vote(0) + }) as DerivedReferendumVote + ) + ) ), drr() ); diff --git a/packages/api-derive/src/democracy/referendums.ts b/packages/api-derive/src/democracy/referendums.ts index c25fcfaa3c..4d190efb94 100644 --- a/packages/api-derive/src/democracy/referendums.ts +++ b/packages/api-derive/src/democracy/referendums.ts @@ -7,8 +7,8 @@ import { switchMap } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; import { Option, ReferendumIndex } from '@polkadot/types'; +import { ReferendumInfoExtended } from '../type'; import { drr } from '../util/drr'; -import { ReferendumInfoExtended } from './referendumInfo'; import { referendumInfos } from './referendumInfos'; export function referendums (api: ApiInterface$Rx) { diff --git a/packages/api-derive/src/democracy/votes.ts b/packages/api-derive/src/democracy/votes.ts index d8beff079b..059845a425 100644 --- a/packages/api-derive/src/democracy/votes.ts +++ b/packages/api-derive/src/democracy/votes.ts @@ -5,22 +5,18 @@ import BN from 'bn.js'; import { Observable, of } from 'rxjs'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, Vote } from '@polkadot/types'; +import { AccountId, VectorAny, Vote } from '@polkadot/types'; import { drr } from '../util/drr'; export function votes (api: ApiInterface$Rx) { - return (referendumId: BN, accountIds: Array = []): Observable> => { + return (referendumId: BN, accountIds: Array = []): Observable> => { return ( !accountIds || !accountIds.length - ? of([]) + ? of(new VectorAny()) : api.query.democracy.voteOf.multi( - accountIds.map(accountId => - [referendumId, accountId] - ) - ) as any as Observable> - ).pipe( - drr() - ); + accountIds.map(accountId => [referendumId, accountId]) + ) as Observable> + ).pipe(drr()); }; } diff --git a/packages/api-derive/src/index.spec.ts b/packages/api-derive/src/index.spec.ts index 3f566e409c..6d43b96352 100644 --- a/packages/api-derive/src/index.spec.ts +++ b/packages/api-derive/src/index.spec.ts @@ -41,8 +41,6 @@ describe('derive', () => { testFunction(api)('balances', 'all', []); testFunction(api)('balances', 'fees', []); - testFunction(api)('balances', 'validatingBalance', []); - testFunction(api)('balances', 'validatingBalances', []); testFunction(api)('balances', 'votingBalance', []); testFunction(api)('balances', 'votingBalances', []); testFunction(api)('balances', 'votingBalancesNominatorsFor', []); diff --git a/packages/api-derive/src/session/info.ts b/packages/api-derive/src/session/info.ts index 4b925c060b..b10aef8597 100644 --- a/packages/api-derive/src/session/info.ts +++ b/packages/api-derive/src/session/info.ts @@ -8,7 +8,7 @@ import BN from 'bn.js'; import { Observable, combineLatest } from 'rxjs'; import { map } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { BlockNumber, Option } from '@polkadot/types'; +import { BlockNumber, Option, StructAny } from '@polkadot/types'; import { drr } from '../util/drr'; import { bestNumber } from '../chain'; @@ -33,7 +33,7 @@ function createDerived ([bestNumber, [currentIndex, _lastLengthChange, sessionLe .mul(sessionLength) .add(sessionProgress); - return { + return new StructAny({ currentIndex, eraLength, eraProgress, @@ -42,7 +42,7 @@ function createDerived ([bestNumber, [currentIndex, _lastLengthChange, sessionLe sessionLength, sessionsPerEra, sessionProgress - }; + }) as DerivedSessionInfo; } /** diff --git a/packages/api-derive/src/staking/index.ts b/packages/api-derive/src/staking/index.ts index 1e3da9f76b..e207bed584 100644 --- a/packages/api-derive/src/staking/index.ts +++ b/packages/api-derive/src/staking/index.ts @@ -4,4 +4,3 @@ export * from './controllers'; export * from './info'; -export * from './intentionsBalances'; diff --git a/packages/api-derive/src/staking/info.ts b/packages/api-derive/src/staking/info.ts index 56eb4acd0f..d5bae6042c 100644 --- a/packages/api-derive/src/staking/info.ts +++ b/packages/api-derive/src/staking/info.ts @@ -7,7 +7,7 @@ import { DerivedStaking } from '../types'; import { Observable, of } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, Exposure, Option, StakingLedger, ValidatorPrefs } from '@polkadot/types'; +import { AccountId, Exposure, Option, StakingLedger, StructAny, ValidatorPrefs } from '@polkadot/types'; import { drr } from '../util/drr'; @@ -23,20 +23,21 @@ function withStashController (api: ApiInterface$Rx, accountId: AccountId, contro [api.query.staking.validators, stashId] ]) as any as Observable<[Option, Option, [Array], Exposure, [ValidatorPrefs]]> ).pipe( - map(([nextKeyFor, stakingLedger, [nominators], stakers, [validatorPrefs]]) => ({ - accountId, - controllerId, - nextSessionId: nextKeyFor.isSome - ? nextKeyFor.unwrap() - : undefined, - nominators, - stakers, - stakingLedger: stakingLedger.isSome - ? stakingLedger.unwrap() - : undefined, - stashId, - validatorPrefs - })), + map(([nextKeyFor, stakingLedger, [nominators], stakers, [validatorPrefs]]) => + new StructAny({ + accountId, + controllerId, + nextSessionId: nextKeyFor.isSome + ? nextKeyFor.unwrap() + : undefined, + nominators, + stakers, + stakingLedger: stakingLedger.isSome + ? stakingLedger.unwrap() + : undefined, + stashId, + validatorPrefs + }) as DerivedStaking), drr() ); } @@ -53,18 +54,19 @@ function withControllerLedger (api: ApiInterface$Rx, accountId: AccountId, staki [api.query.staking.validators, stashId] ]) as any as Observable<[Option, [Array], Exposure, [ValidatorPrefs]]> ).pipe( - map(([nextKeyFor, [nominators], stakers, [validatorPrefs]]) => ({ - accountId, - controllerId, - nextSessionId: nextKeyFor.isSome - ? nextKeyFor.unwrap() - : undefined, - nominators, - stakers, - stakingLedger, - stashId, - validatorPrefs - })), + map(([nextKeyFor, [nominators], stakers, [validatorPrefs]]) => + new StructAny({ + accountId, + controllerId, + nextSessionId: nextKeyFor.isSome + ? nextKeyFor.unwrap() + : undefined, + nominators, + stakers, + stakingLedger, + stashId, + validatorPrefs + }) as DerivedStaking), drr() ); } @@ -90,7 +92,7 @@ export function info (api: ApiInterface$Rx) { stakingLedger.isSome ? withControllerLedger(api, accountId, stakingLedger.unwrap()) // dangit, this is something else, ok, we are done - : of({ accountId }) + : of(new StructAny({ accountId }) as DerivedStaking) ) ), drr() diff --git a/packages/api-derive/src/staking/intentionsBalances.ts b/packages/api-derive/src/staking/intentionsBalances.ts deleted file mode 100644 index 76312de38a..0000000000 --- a/packages/api-derive/src/staking/intentionsBalances.ts +++ /dev/null @@ -1,25 +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 { Observable } from 'rxjs'; -import { switchMap } from 'rxjs/operators'; -import { ApiInterface$Rx } from '@polkadot/api/types'; -import { AccountId, Vector } from '@polkadot/types'; - -import { DerivedBalancesMap } from '../types'; -import { validatingBalances } from '../balances'; -import { drr } from '../util/drr'; - -/** - * Get the balances for all intentions and their nominators - */ -export function intentionsBalances (api: ApiInterface$Rx) { - return (): Observable => - // tslint:disable-next-line - (api.query.staking.intentions() as Observable>) - .pipe( - switchMap(validatingBalances(api)), - drr() - ) as Observable; -} diff --git a/packages/api-derive/src/type/ReferendumInfoExtended.ts b/packages/api-derive/src/type/ReferendumInfoExtended.ts new file mode 100644 index 0000000000..65f6b51857 --- /dev/null +++ b/packages/api-derive/src/type/ReferendumInfoExtended.ts @@ -0,0 +1,40 @@ +// 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 { ReferendumInfo, ReferendumIndex } from '@polkadot/types'; + +/** + * @name ReferendumInfoExtended + * @description + * A [[ReferendumInfo]] with an additional `index` field + */ +export default class ReferendumInfoExtended extends ReferendumInfo { + private _index: ReferendumIndex; + + constructor (value: ReferendumInfo | ReferendumInfoExtended, index?: BN | number) { + super(value); + + this._index = value instanceof ReferendumInfoExtended + ? value.index + : new ReferendumIndex(index); + } + + /** + * @description Convenience getter, returns the referendumIndex + */ + get index (): ReferendumIndex { + return this._index; + } + + /** + * @description Creates the JSON representation + */ + toJSON (): any { + return { + ...super.toJSON(), + index: this.index.toJSON() + }; + } +} diff --git a/packages/api-derive/src/type/index.ts b/packages/api-derive/src/type/index.ts index 8145e0d27c..9627511b15 100644 --- a/packages/api-derive/src/type/index.ts +++ b/packages/api-derive/src/type/index.ts @@ -3,3 +3,4 @@ // of the Apache-2.0 license. See the LICENSE file for details. export { default as HeaderExtended } from './HeaderExtended'; +export { default as ReferendumInfoExtended } from './ReferendumInfoExtended'; diff --git a/packages/api-derive/src/types.ts b/packages/api-derive/src/types.ts index 5bb5d80133..d212241f56 100644 --- a/packages/api-derive/src/types.ts +++ b/packages/api-derive/src/types.ts @@ -3,67 +3,68 @@ // of the Apache-2.0 license. See the LICENSE file for details. import BN from 'bn.js'; -import { AccountId, Balance, BlockNumber, Exposure, StakingLedger, ValidatorPrefs, Vote } from '@polkadot/types'; +import { AccountId, Balance, BlockNumber, Exposure, Index, StakingLedger, StructAny, ValidatorPrefs, Vote } from '@polkadot/types'; -export type DerivedBalances = { - accountId: AccountId, - freeBalance: Balance, - lockedBalance: Balance, - availableBalance: Balance, - reservedBalance: Balance, - votingBalance: Balance, - vestedBalance: Balance -}; +export interface DerivedBalances extends StructAny { + accountId: AccountId; + accountNonce: Index; + freeBalance: Balance; + lockedBalance: Balance; + availableBalance: Balance; + reservedBalance: Balance; + votingBalance: Balance; + vestedBalance: Balance; +} export type DerivedBalancesMap = { [index: string]: DerivedBalances }; -export type DerivedContractFees = { - callBaseFee: BN, - contractFee: BN, - createBaseFee: BN, - creationFee: BN, - rentByteFee: BN, - rentDepositOffset: BN, - transactionBaseFee: BN, - transactionByteFee: BN, - transferFee: BN, - tombstoneDeposit: BN -}; +export interface DerivedContractFees extends StructAny { + callBaseFee: BN; + contractFee: BN; + createBaseFee: BN; + creationFee: BN; + rentByteFee: BN; + rentDepositOffset: BN; + transactionBaseFee: BN; + transactionByteFee: BN; + transferFee: BN; + tombstoneDeposit: BN; +} -export type DerivedFees = { - creationFee: BN, - existentialDeposit: BN, - transactionBaseFee: BN, - transactionByteFee: BN, - transferFee: BN -}; +export interface DerivedFees extends StructAny { + creationFee: BN; + existentialDeposit: BN; + transactionBaseFee: BN; + transactionByteFee: BN; + transferFee: BN; +} -export type DerivedReferendumVote = { - accountId: AccountId, - balance: Balance, - vote: Vote -}; +export interface DerivedReferendumVote extends StructAny { + accountId: AccountId; + balance: Balance; + vote: Vote; +} -export type DerivedSessionInfo = { - currentIndex: BlockNumber, - eraLength: BN, - eraProgress: BN, - lastEraLengthChange: BlockNumber, - lastLengthChange: BN, - sessionLength: BlockNumber, - sessionsPerEra: BlockNumber, - sessionProgress: BN -}; +export interface DerivedSessionInfo extends StructAny { + currentIndex: BlockNumber; + eraLength: BN; + eraProgress: BN; + lastEraLengthChange: BlockNumber; + lastLengthChange: BN; + sessionLength: BlockNumber; + sessionsPerEra: BlockNumber; + sessionProgress: BN; +} -export type DerivedStaking = { - accountId: AccountId, - controllerId?: AccountId, - nextSessionId?: AccountId, - nominators?: Array, - stakers?: Exposure, - stakingLedger?: StakingLedger, - stashId?: AccountId, - validatorPrefs?: ValidatorPrefs -}; +export interface DerivedStaking extends StructAny { + accountId: AccountId; + controllerId?: AccountId; + nextSessionId?: AccountId; + nominators?: Array; + stakers?: Exposure; + stakingLedger?: StakingLedger; + stashId?: AccountId; + validatorPrefs?: ValidatorPrefs; +} diff --git a/packages/api/package.json b/packages/api/package.json index 659412fc7a..2e03d57549 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -33,6 +33,6 @@ "@polkadot/rpc-rx": "^0.80.0-beta.2", "@polkadot/storage": "^0.80.0-beta.2", "@polkadot/types": "^0.80.0-beta.2", - "@polkadot/util-crypto": "^0.91.1" + "@polkadot/util-crypto": "^0.92.0-beta.0" } } diff --git a/packages/api/src/Base.ts b/packages/api/src/Base.ts index d882cf79ce..9b39dd2635 100644 --- a/packages/api/src/Base.ts +++ b/packages/api/src/Base.ts @@ -23,7 +23,7 @@ import extrinsicsFromMeta from '@polkadot/extrinsics/fromMetadata'; import RpcBase from '@polkadot/rpc-core'; import RpcRx from '@polkadot/rpc-rx'; import storageFromMeta from '@polkadot/storage/fromMetadata'; -import { Event, getTypeRegistry, Hash, Metadata, Method, RuntimeVersion, Null } from '@polkadot/types'; +import { Event, getTypeRegistry, Hash, Metadata, Method, RuntimeVersion, Null, VectorAny } from '@polkadot/types'; import Linkage, { LinkageResult } from '@polkadot/types/codec/Linkage'; import { MethodFunction, ModulesWithMethods } from '@polkadot/types/primitive/Method'; import { StorageFunction } from '@polkadot/types/primitive/StorageKey'; @@ -506,7 +506,10 @@ export default abstract class ApiBase implement ); return onCall( - () => this._rpcRx.state.subscribeStorage(mapped), + () => + this._rpcRx.state + .subscribeStorage(mapped) + .pipe(map((results) => new VectorAny(...results))), [], callback ) as S; @@ -605,7 +608,10 @@ export default abstract class ApiBase implement decorated.multi = (args: Array, callback?: CodecCallback): S => onCall( - () => this._rpcRx.state.subscribeStorage(args.map((arg) => [creator, arg])), + () => + this._rpcRx.state + .subscribeStorage(args.map((arg) => [creator, arg])) + .pipe(map((results) => new VectorAny(...results))), [], callback ) as unknown as S; diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index ea78038c15..e56734d632 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -30,6 +30,6 @@ "@polkadot/jsonrpc": "^0.80.0-beta.2", "@polkadot/rpc-provider": "^0.80.0-beta.2", "@polkadot/types": "^0.80.0-beta.2", - "@polkadot/util": "^0.91.1" + "@polkadot/util": "^0.92.0-beta.0" } } diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index 2517abe463..302bee7e10 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -27,10 +27,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "dependencies": { "@babel/runtime": "^7.4.5", - "@polkadot/keyring": "^0.91.1", + "@polkadot/keyring": "^0.92.0-beta.0", "@polkadot/storage": "^0.80.0-beta.2", - "@polkadot/util": "^0.91.1", - "@polkadot/util-crypto": "^0.91.1", + "@polkadot/util": "^0.92.0-beta.0", + "@polkadot/util-crypto": "^0.92.0-beta.0", "@types/nock": "^10.0.3", "eventemitter3": "^3.1.0", "isomorphic-fetch": "^2.2.1", diff --git a/packages/type-extrinsics/package.json b/packages/type-extrinsics/package.json index 8e213916a9..70452f5106 100644 --- a/packages/type-extrinsics/package.json +++ b/packages/type-extrinsics/package.json @@ -12,6 +12,6 @@ "dependencies": { "@babel/runtime": "^7.4.5", "@polkadot/types": "^0.80.0-beta.2", - "@polkadot/util": "^0.91.1" + "@polkadot/util": "^0.92.0-beta.0" } } diff --git a/packages/type-storage/package.json b/packages/type-storage/package.json index 73a18d9403..b8d6398174 100644 --- a/packages/type-storage/package.json +++ b/packages/type-storage/package.json @@ -27,9 +27,9 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme", "dependencies": { "@babel/runtime": "^7.4.5", - "@polkadot/keyring": "^0.91.1", + "@polkadot/keyring": "^0.92.0-beta.0", "@polkadot/types": "^0.80.0-beta.2", - "@polkadot/util": "^0.91.1", - "@polkadot/util-crypto": "^0.91.1" + "@polkadot/util": "^0.92.0-beta.0", + "@polkadot/util-crypto": "^0.92.0-beta.0" } } diff --git a/packages/types/README.md b/packages/types/README.md index 6dfddb4609..c721dbfb5c 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -18,6 +18,7 @@ These are the base types of the codec. They are typically not used directly, but | [[Option]] | An Option is an optional field. The first byte indicates that there is is value to follow | | [[Set]] | An Set is an array of string values, represented an an encoded type by a bitwise representation of the values | | [[Struct]] | A Struct defines an Object with key-value pairs - where the values are Codec values. | +| [[StructAny]] | Wraps the a JSON structure retrieve via RPC. It extends the standard JS Map | | [[Tuple]] | A Tuple defines an anonymous fixed-length array, where each element has its own type | | [[U8a]] | A basic wrapper around Uint8Array. It will consume the full Uint8Array as passed to it | | [[U8aFixed]] | A U8a that manages a a sequence of bytes up to the specified bitLength | @@ -150,7 +151,6 @@ These types are not used in the runtime, but are rather used in RPC results: | [[ExtrinsicStatus]] | An EnumType that indicates the status of the Extrinsic as been submitted | | [[Header]] | A [[Block]] header | | [[Health]] | A system health indicator, reported back over RPC | -| [[Json]] | Wraps the a JSON structure retrieve via RPC. It extends the standard JS Map | | [[NetworkState]] | Wraps the properties retrieved from the chain via the `system.network_state` RPC call | | [[Metadata]] | The versioned runtime metadata as a decoded structure | | [[PeerInfo]] | A system peer info indicator, reported back over RPC | diff --git a/packages/types/package.json b/packages/types/package.json index 16abe1778e..4005b32ee9 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -27,7 +27,7 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "dependencies": { "@babel/runtime": "^7.4.5", - "@polkadot/keyring": "^0.91.1", - "@polkadot/util": "^0.91.1" + "@polkadot/keyring": "^0.92.0-beta.0", + "@polkadot/util": "^0.92.0-beta.0" } } diff --git a/packages/types/src/rpc/Json.ts b/packages/types/src/codec/StructAny.ts similarity index 77% rename from packages/types/src/rpc/Json.ts rename to packages/types/src/codec/StructAny.ts index b9e3b5749e..279f8f7cbe 100644 --- a/packages/types/src/rpc/Json.ts +++ b/packages/types/src/codec/StructAny.ts @@ -3,7 +3,10 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { Codec } from '../types'; -import { compareMap } from '../codec/utils'; + +import { isUndefined } from '@polkadot/util'; + +import { compareMap } from './utils'; /** * @name Json @@ -13,9 +16,24 @@ import { compareMap } from '../codec/utils'; * i.e. no hex decoding. Unlike a struct, this waps a JSON object with unknown keys * @noInheritDoc */ -export default class Json extends Map implements Codec { +export default class StructAny extends Map implements Codec { constructor (value?: { [index: string]: any } | null) { - super(Json.decodeJson(value)); + const decoded = StructAny.decodeJson(value); + + super(decoded); + + // like we are doing with structs, add the keys as getters + decoded.forEach(([key]) => { + // do not clobber existing properties on the object + if (!isUndefined((this as any)[key])) { + return; + } + + Object.defineProperty(this, key, { + enumerable: true, + get: () => this.get(key) + }); + }); } private static decodeJson (value?: { [index: string]: any } | null): Array<[string, any]> { diff --git a/packages/types/src/codec/index.ts b/packages/types/src/codec/index.ts index d838a9e49e..b981a9d1a5 100644 --- a/packages/types/src/codec/index.ts +++ b/packages/types/src/codec/index.ts @@ -14,8 +14,10 @@ export { default as EnumType } from './EnumType'; export { default as Option } from './Option'; export { default as Set } from './Set'; export { default as Struct } from './Struct'; +export { default as StructAny } from './StructAny'; export { default as Tuple } from './Tuple'; export { default as Vector } from './Vector'; +export { default as VectorAny } from './VectorAny'; // Convenience base classes, used as "anything of this type" bases export { default as U8a } from './U8a'; diff --git a/packages/types/src/rpc/ChainProperties.ts b/packages/types/src/rpc/ChainProperties.ts index 910d500c5b..02a5dae5fc 100644 --- a/packages/types/src/rpc/ChainProperties.ts +++ b/packages/types/src/rpc/ChainProperties.ts @@ -2,14 +2,14 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import Json from './Json'; +import StructAny from '../codec/StructAny'; /** * @name ChainProperties * @description * Wraps the properties retrieved from the chain via the `system.properties` RPC call. */ -export default class ChainProperties extends Json { +export default class ChainProperties extends StructAny { /** * @description The token decimals, if defined (de-facto standard only) */ diff --git a/packages/types/src/rpc/NetworkState.ts b/packages/types/src/rpc/NetworkState.ts index 10ab8c1332..301f80457c 100644 --- a/packages/types/src/rpc/NetworkState.ts +++ b/packages/types/src/rpc/NetworkState.ts @@ -2,12 +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 Json from './Json'; +import StructAny from '../codec/StructAny'; /** * @name NetworkState * @description * Wraps the properties retrieved from the chain via the `system.network_state` RPC call. */ -export default class NetworkState extends Json { +export default class NetworkState extends StructAny { } diff --git a/packages/types/src/rpc/index.ts b/packages/types/src/rpc/index.ts index 0c445949ef..7d68d68bf1 100644 --- a/packages/types/src/rpc/index.ts +++ b/packages/types/src/rpc/index.ts @@ -14,7 +14,6 @@ export { default as Digest, DigestItem } from './Digest'; export { default as ExtrinsicStatus } from './ExtrinsicStatus'; export { default as Header } from './Header'; export { default as Health } from './Health'; -export { default as Json } from './Json'; export { default as NetworkState } from './NetworkState'; export { default as PeerInfo } from './PeerInfo'; export { default as PendingExtrinsics } from './PendingExtrinsics'; diff --git a/yarn.lock b/yarn.lock index d7444e30d4..86a0aa713d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1720,14 +1720,14 @@ typescript "^3.4.5" vuepress "^1.0.0-alpha.47" -"@polkadot/keyring@^0.91.1": - version "0.91.1" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.91.1.tgz#9d0d06ffb7c1ebc575304cab0e3699c76637a694" - integrity sha512-XYWbqWK8CAeuPFg1llS65r2sO7k2qTalJMHPQiaIVETPXQGx4SCzzMzBkD9eVvHTs9KfamynOQrspflhjHtgbg== +"@polkadot/keyring@^0.92.0-beta.0": + version "0.92.0-beta.0" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.92.0-beta.0.tgz#2409af8986b272d65bff3aa01db56b6279dfcf09" + integrity sha512-0IFreNVDP8JwhKR2Ydd9RGJsRUN3XRvmj528ZO/D6UT9kfyxOk+7/9juyw3mdjt4eZoJel3eUepg//KixoQFJA== dependencies: "@babel/runtime" "^7.4.5" - "@polkadot/util" "^0.91.1" - "@polkadot/util-crypto" "^0.91.1" + "@polkadot/util" "^0.92.0-beta.0" + "@polkadot/util-crypto" "^0.92.0-beta.0" "@types/bs58" "^4.0.0" bs58 "^4.0.1" @@ -1736,13 +1736,13 @@ resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.56.tgz#ffd6e9c95704a7fb90b918193b9dc5c440114b27" integrity sha512-wnt4zXxZXyz6WaubTO/I+nUElwV2DogFzdl6CrKfVn2PTWp8uHN06W9s40FH57ORtmQfDr9rLRP8Nq+oIyElbg== -"@polkadot/util-crypto@^0.91.1": - version "0.91.1" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.91.1.tgz#c9e48df45588af7fa7822652d9938764274e548f" - integrity sha512-o1CU1fwf0zxTJfuXgWs+IBJ8qIsZK9Pk7dSKR+YcDP3RYYCF8kRp+PDw/BHtvOhSerLKn9rxECjmtk+5sVVzkQ== +"@polkadot/util-crypto@^0.92.0-beta.0": + version "0.92.0-beta.0" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.92.0-beta.0.tgz#1b9b20ee7a2fa95d414c1ca62d701bf387d8ace7" + integrity sha512-N3wd66BoAYhBfe0lFbZn+92Ad3/28Vm9663ejCMqLA+Z4CEN8Sm4bf3rLgxz6r67NrWzHjUcwRACLosO1u90fA== dependencies: "@babel/runtime" "^7.4.5" - "@polkadot/util" "^0.91.1" + "@polkadot/util" "^0.92.0-beta.0" "@polkadot/wasm-crypto" "^0.10.1" "@types/bip39" "^2.4.2" "@types/pbkdf2" "^3.0.0" @@ -1756,10 +1756,10 @@ tweetnacl "^1.0.1" xxhashjs "^0.2.2" -"@polkadot/util@^0.91.1": - version "0.91.1" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.91.1.tgz#f5f2323e1bad387ab136d198f7293331b060b348" - integrity sha512-NqW3FlKQl0wh4mt/QpmGduE0VLBSsb6S45pyjgM3P7Fz37EyrOOZa8s7IBdIck2dtY3MwAy8JWGJjpTnMHXh8Q== +"@polkadot/util@^0.92.0-beta.0": + version "0.92.0-beta.0" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.92.0-beta.0.tgz#e9cd2f0851985d30f01b2946911092dd013cb2c1" + integrity sha512-TUwQhuqcPIv8uF5eKg/KLaSx76TxxWMgeOoAy4dDudGWb/+VJ1jJkYR9SE2spRFWOYPEyYZhvspQWkg+0NzVEQ== dependencies: "@babel/runtime" "^7.4.5" "@types/bn.js" "^4.11.5"