Compare commits

...
71 Commits
Author SHA1 Message Date
Github Actions 4fd74a04c8 [CI Skip] 1.6.2
skip-checks: true
2020-03-12 14:03:53 +00:00
Jaco Greeff 421594b0eb Fix .at check, disable (release 1.6.2) (#2034)
* Fix .at check, disable (release 1.6.2)

* Remove isAt (keep at revert only)

* Grrr....

* yarn installl (really need to add this to version bump script)
2020-03-12 14:53:25 +01:00
Github Actions 2e79c25da1 [CI Skip] 1.6.1
skip-checks: true
2020-03-12 09:10:00 +00:00
Jaco Greeff ca2a313aec 1.6 (#2031)
* 1.6 CHANGELOG

* 1.6

* yarn
2020-03-12 09:57:09 +01:00
Github Actions 693315dad3 [CI Skip] 1.6.0-beta.30
skip-checks: true
2020-03-12 08:22:52 +00:00
Jaco Greeff c2f9ef7ca8 Add .keys on storage entries (#2032)
* Add .keys on storage entries

* Pass isOptional to storage type unwrap

* Linked maps TS types
2020-03-12 09:12:11 +01:00
Github Actions fc477b98bd [CI Skip] 1.6.0-beta.29
skip-checks: true
2020-03-12 06:41:19 +00:00
Jaco Greeff b8cdfd226a Validate storage args (#1507)
* Validate storage args

* Fix linting

* Update imports

* Update type extraction

* Move storage extraction to util

* Re-add CHANGELOG entry

* Add DoubleMap tests

* Adjust error for linked

* formatting

* Split map/doublemap

* Cleanups

* Update error sigs

* Just join
2020-03-12 07:29:18 +01:00
Github Actions a5725d7bd6 [CI Skip] 1.6.0-beta.28
skip-checks: true
2020-03-11 16:12:55 +00:00
Jaco Greeff 8995ef6ae2 dedupKeyPrefix as const 2020-03-11 17:01:07 +01:00
Github Actions 742baa3dad [CI Skip] 1.6.0-beta.27
skip-checks: true
2020-03-11 15:10:58 +00:00
Jaco Greeff 3a37bf1e6b Add multi variants for derive staking query & rewards (#2029) 2020-03-11 15:59:36 +01:00
Github Actions f4b51f6311 [CI Skip] 1.6.0-beta.26
skip-checks: true
2020-03-11 11:44:04 +00:00
Jaco Greeff a09fc51693 Add stakerRewards for available reward calcs (#2028) 2020-03-11 12:33:12 +01:00
Jaco Greeff 1d8b6a79ef Rework rpc.queryStorage to return [Hash, Codec[]][] (#2025) 2020-03-11 12:21:09 +01:00
Dylan Galea 164a1b6867 Updated users of the polkadot-js/api (#2027)
* Update README.md

Updated the README.md to include the PANIC for Polkadot, and Polkadot API Server projects as users.

* Update README.md

Fixed links.
2020-03-11 12:20:16 +01:00
Keith Ingram 032f2dc040 Remove parachains.watermark (#2026) 2020-03-11 12:18:47 +01:00
Github Actions 3dbe33378c [CI Skip] 1.6.0-beta.25
skip-checks: true
2020-03-11 08:22:30 +00:00
Jaco Greeff bb08ac4a28 Align CHANGELOG, bump @polkadot/util (#2024) 2020-03-11 09:11:29 +01:00
Github Actions 4656d32e22 [CI Skip] 1.6.0-beta.24
skip-checks: true
2020-03-10 18:55:55 +00:00
Jaco Greeff 60c982ed95 Fix range & entries with Option decoding (#2023) 2020-03-10 19:44:50 +01:00
Github Actions cacafab912 [CI Skip] 1.6.0-beta.23
skip-checks: true
2020-03-10 17:07:44 +00:00
Jaco Greeff 99d4806a0d Enable new indexes queries (#2022)
* Enable new indexes queries

* update mock for state_getKeys
2020-03-10 17:56:20 +01:00
Github Actions 59a194a48d [CI Skip] 1.6.0-beta.22
skip-checks: true
2020-03-10 14:17:03 +00:00
Jaco Greeff d818f61dc8 Support new map nextKeys in derives (#2021)
* Support new map nextKeys in derives

* Update packages/api-derive/src/staking/query.ts
2020-03-10 15:07:02 +01:00
Github Actions f1cbfff5a6 [CI Skip] 1.6.0-beta.21
skip-checks: true
2020-03-10 12:27:53 +00:00
Jaco Greeff 92cdc6c840 Query exposure via clipped (#2020) 2020-03-10 13:16:15 +01:00
Github Actions 1ff864ea2f [CI Skip] 1.6.0-beta.20
skip-checks: true
2020-03-10 11:20:22 +00:00
Jaco Greeff 071b5ba7cb Re-add erasRewards (#2019) 2020-03-10 12:09:18 +01:00
Github Actions 2e6d89a093 [CI Skip] 1.6.0-beta.19
skip-checks: true
2020-03-10 07:32:04 +00:00
Jaco Greeff 049a1a59f5 Rework eras* calls with minimum information (#2018) 2020-03-10 08:20:54 +01:00
Github Actions 201098e9f6 [CI Skip] 1.6.0-beta.18
skip-checks: true
2020-03-09 22:07:14 +00:00
Jaco Greeff 423227d385 Merge branch 'master' of github.com:polkadot-js/api 2020-03-09 22:57:13 +01:00
Jaco Greeff c1facd8b1c memo for range & entries 2020-03-09 22:57:09 +01:00
Github Actions 842d371699 [CI Skip] 1.6.0-beta.17
skip-checks: true
2020-03-09 20:52:41 +00:00
Jaco Greeff bcbd4b8d40 linked maps with getStorage only 2020-03-09 21:42:56 +01:00
Github Actions b526873837 [CI Skip] 1.6.0-beta.16
skip-checks: true
2020-03-09 19:19:28 +00:00
Jaco Greeff 6f85c6783e Update .123trigger 2020-03-09 20:07:29 +01:00
Github Actions 672983f6c1 [CI Skip] 1.6.0-beta.15
skip-checks: true
2020-03-09 19:01:22 +00:00
Jaco Greeff 3ee3fb05cc Use first() for entries and linked maps 2020-03-09 19:50:21 +01:00
Github Actions 8ff32d9c1e [CI Skip] 1.6.0-beta.14
skip-checks: true
2020-03-09 17:54:21 +00:00
Jaco Greeff 8ad3d35dd2 Lock all indeeds locks all 2020-03-09 18:44:30 +01:00
Github Actions cb5fdc9078 [CI Skip] 1.6.0-beta.13
skip-checks: true
2020-03-09 13:32:56 +00:00
Jaco Greeff 77d894dd00 reset identityOf 2020-03-09 14:21:06 +01:00
Jaco Greeff 5b40d95b0f Disbale identity (#2016) 2020-03-09 14:12:52 +01:00
Github Actions 385d157f3f [CI Skip] 1.6.0-beta.12
skip-checks: true
2020-03-09 09:23:23 +00:00
Jaco Greeff 81a2a51610 Expose eraReward on derives (#2015) 2020-03-09 10:14:45 +01:00
Github Actions ff8383c5ed [CI Skip] 1.6.0-beta.11
skip-checks: true
2020-03-09 07:38:29 +00:00
Jaco Greeff ca9f671553 Re-format jsonrpc errors (#2014) 2020-03-09 08:27:00 +01:00
Github Actions eb17de0888 [CI Skip] 1.6.0-beta.10
skip-checks: true
2020-03-08 14:32:37 +00:00
Jaco Greeff 110c9d199d Add 'everything' on balance format with max 2020-03-08 15:22:06 +01:00
Github Actions b5cc8f193e [CI Skip] 1.6.0-beta.9
skip-checks: true
2020-03-08 12:30:09 +00:00
Jaco Greeff abebe9ef43 unwrapOr(undefined) for subs 2020-03-08 13:20:05 +01:00
Github Actions e55f69a009 [CI Skip] 1.6.0-beta.8
skip-checks: true
2020-03-08 12:08:20 +00:00
Jaco Greeff 9bf854445c Fix entries values decoding (#2011)
* Fix entries values decoding

* Linting

* Properly unwrap storage subs
2020-03-08 12:57:03 +01:00
Github Actions 17f7e4b753 [CI Skip] 1.6.0-beta.7
skip-checks: true
2020-03-08 08:39:09 +00:00
Jaco Greeff 0a6c6ec4c5 Combine points into stakerRewards (#2008)
* Combine points into stakerRewards

* Bump dev
2020-03-08 09:26:54 +01:00
Github Actions 7456113cef [CI Skip] 1.6.0-beta.6
skip-checks: true
2020-03-08 08:24:46 +00:00
Jaco Greeff 7051e20d59 StorageKey map decoding test (#2009) 2020-03-08 09:13:18 +01:00
Github Actions 79dba43f0f [CI Skip] 1.6.0-beta.5
skip-checks: true
2020-03-07 09:49:05 +00:00
Jaco Greeff 6bb421dac6 Fix StorageKey args throw 2020-03-07 10:37:28 +01:00
Github Actions 0ce28c519f [CI Skip] 1.6.0-beta.4
skip-checks: true
2020-03-06 21:00:28 +00:00
Jaco Greeff cdde702db7 Cover all hashers in map/doublemap key decoding (#2007) 2020-03-06 21:49:09 +01:00
Github Actions 6b4a76b54b [CI Skip] 1.6.0-beta.3
skip-checks: true
2020-03-06 15:28:04 +00:00
Jaco Greeff 57e2a9dc14 No BalanceLock override for Polkadot 2020-03-06 16:18:18 +01:00
Github Actions 798f1e6e91 [CI Skip] 1.6.0-beta.2
skip-checks: true
2020-03-06 15:10:40 +00:00
Jaco Greeff 0e264a029e Polkadot StakingLedger 2020-03-06 15:58:46 +01:00
Github Actions 8745c059f7 [CI Skip] 1.6.0-beta.1
skip-checks: true
2020-03-06 12:57:58 +00:00
Jaco Greeff adee447cd0 Add .args to decoded StorageKeys (#2004)
* Add .args to decoded StorageKeys

* Small opts

* Formatting
2020-03-06 13:47:40 +01:00
Github Actions 63c22414ce [CI Skip] 1.6.0-beta.0
skip-checks: true
2020-03-06 10:18:07 +00:00
Jaco Greeff 89992ea03e Era exposure cleanups via .entries (#2003) 2020-03-06 11:06:10 +01:00
63 changed files with 1291 additions and 575 deletions
+2 -2
View File
@@ -1,3 +1,3 @@
19
1.4.2
20
1.4.2
1.6.2
+18
View File
@@ -1,3 +1,21 @@
# 1.6.2 Feb 27, 2020
- Revert checks for arg, not working on `.at()` queries (proper fix in next version)
# 1.6.1 Mar 12, 2020
- **Breaking change** `api.rpc.state.queryStorage(...)` now fully decodes the `Vec<StorageChangeSet>` and returns a decoded `[Hash, Codec[]][]` when using this RPC.
- `StorageKey` now has an `.args` property, decoded from meta where `twox64_concat` or `blake128_concat` are used on maps
- Fix `api.query.*.*.entries` type conversions to return exact types (not `Option` in some cases)
- Add `api.query.*.*.keys` to retrieve only the storage keys, similar to `.entries`
- Full linked map retrievals will now use direct getStorage queries for faster operation
- Underlying rpc-core interfaces now unwraps `Error("...")` when found in responses
- Added `derive.eras*` interfaces for queries to new Substrate staking interfaces
- Update `derive.account` to cater for new indices module storage (detected with fallbacks)
- Adjust derive queries for session without module prefix (DoubleMap -> Map), detected on use
- Add runtime validation for map arguments to `api.query.*`
- TypeScript interfaces for linked maps now correctly generates as `[Type, Linkage<Next>]`
# 1.5.1 Mar 06, 2020
- **Important** Substrate master has updated staking, on older chains supply `StakingLedger: 'StakingLedgerTo223'`
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.5.1"
"version": "1.6.2"
}
+1 -1
View File
@@ -25,7 +25,7 @@
"@babel/core": "^7.8.4",
"@babel/register": "^7.8.3",
"@babel/runtime": "^7.8.4",
"@polkadot/dev": "^0.50.27",
"@polkadot/dev": "^0.50.30",
"@polkadot/ts": "^0.3.7",
"@polkadot/typegen": "workspace:packages/typegen",
"copyfiles": "^2.2.0"
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.5.1",
"version": "1.6.2",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -27,10 +27,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.8.4",
"@polkadot/api": "1.5.1",
"@polkadot/rpc-core": "1.5.1",
"@polkadot/types": "1.5.1",
"@polkadot/util": "^2.6.1",
"@polkadot/api": "1.6.2",
"@polkadot/rpc-core": "1.6.2",
"@polkadot/types": "1.6.2",
"@polkadot/util": "^2.6.2",
"bn.js": "^5.1.1",
"rxjs": "^6.5.4"
}
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.5.1",
"version": "1.6.2",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -28,17 +28,17 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.8.4",
"@polkadot/api": "1.5.1",
"@polkadot/rpc-core": "1.5.1",
"@polkadot/rpc-provider": "1.5.1",
"@polkadot/types": "1.5.1",
"@polkadot/util": "^2.6.1",
"@polkadot/util-crypto": "^2.6.1",
"@polkadot/api": "1.6.2",
"@polkadot/rpc-core": "1.6.2",
"@polkadot/rpc-provider": "1.6.2",
"@polkadot/types": "1.6.2",
"@polkadot/util": "^2.6.2",
"@polkadot/util-crypto": "^2.6.2",
"bn.js": "^5.1.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@polkadot/keyring": "^2.6.1"
"@polkadot/keyring": "^2.6.2"
}
}
@@ -6,7 +6,7 @@ import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import { AccountIndexes } from '../types';
import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { memo } from '../util';
@@ -28,7 +28,6 @@ import { memo } from '../util';
export function idToIndex (api: ApiInterfaceRx): (accountId: AccountId | string) => Observable<AccountIndex | undefined> {
return memo((accountId: AccountId | string): Observable<AccountIndex | undefined> =>
api.derive.accounts.indexes().pipe(
startWith({}),
map((indexes: AccountIndexes): AccountIndex | undefined =>
(indexes || {})[accountId.toString()]
)
+19 -9
View File
@@ -7,7 +7,7 @@ import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import { AccountIndexes } from '../types';
import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { map, startWith, switchMap } from 'rxjs/operators';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { Vec, createType } from '@polkadot/types';
@@ -25,24 +25,33 @@ function queryEnumSet (api: ApiInterfaceRx): Observable<AccountIndexes> {
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
),
map((all: AccountId[][]): AccountIndexes =>
all.reduce((result: AccountIndexes, list, outerIndex): AccountIndexes => {
all.reduce((indexes: AccountIndexes, list, outerIndex): AccountIndexes => {
(list || []).forEach((accountId, innerIndex): void => {
// re-create the index based on position 0 is [0][0] and likewise
// 64 (0..63 in first) is [1][0] (the first index value in set 2)
const index = (outerIndex * enumsetSize) + innerIndex;
result[accountId.toString()] = createType(api.registry, 'AccountIndex', index);
indexes[accountId.toString()] = createType(api.registry, 'AccountIndex', index);
});
return result;
return indexes;
}, {})
)
);
}
// TODO Reverse lookup (via query keys)
function query (): Observable<AccountIndexes> {
return of({} as AccountIndexes);
function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
return api.query.indices.accounts.entries().pipe(
map((entries): AccountIndexes =>
entries.reduce((indexes: AccountIndexes, [key, idOpt]): AccountIndexes => {
if (idOpt.isSome) {
indexes[idOpt.unwrap()[0].toString()] = key.args[0] as AccountIndex;
}
return indexes;
}, {})
)
);
}
/**
@@ -62,10 +71,11 @@ function query (): Observable<AccountIndexes> {
*/
export function indexes (api: ApiInterfaceRx): () => Observable<AccountIndexes> {
return memo((): Observable<AccountIndexes> =>
api.query.indices
(api.query.indices
? api.query.indices.accounts
? query()
? queryAccounts(api)
: queryEnumSet(api)
: of({} as AccountIndexes)
).pipe(startWith({}))
);
}
+4 -1
View File
@@ -20,6 +20,7 @@ type Result = [DerivedBalancesAccount, BlockNumber, ResultBalance];
function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBalance, frozenFee, frozenMisc, reservedBalance, votingBalance }, bestNumber, [vesting, locks]]: Result): DerivedBalancesAll {
let lockedBalance = createType(api.registry, 'Balance');
let lockedBreakdown: (BalanceLock | BalanceLockTo212)[] = [];
let allLocked = false;
if (Array.isArray(locks)) {
// only get the locks that are valid until passed the current block
@@ -27,6 +28,8 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
const notAll = lockedBreakdown.filter(({ amount }): boolean => !amount.isMax());
allLocked = lockedBreakdown.some(({ amount }): boolean => amount.isMax());
// get the maximum of the locks according to https://github.com/paritytech/substrate/blob/master/srml/balances/src/lib.rs#L699
if (notAll.length) {
lockedBalance = createType(api.registry, 'Balance', bnMax(...notAll.map(({ amount }): Balance => amount)));
@@ -50,7 +53,7 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
// ""
const floating = freeBalance.sub(lockedBalance);
const extraReceived = isVesting ? freeBalance.sub(vestingTotal) : new BN(0);
const availableBalance = createType(api.registry, 'Balance', bnMax(new BN(0), isVesting && floating.gt(vestedBalance) ? vestedBalance.add(extraReceived) : floating));
const availableBalance = createType(api.registry, 'Balance', allLocked ? 0 : bnMax(new BN(0), isVesting && floating.gt(vestedBalance) ? vestedBalance.add(extraReceived) : floating));
return {
accountId,
+5 -5
View File
@@ -29,13 +29,13 @@ export function fees (api: ApiInterfaceRx): () => Observable<DerivedFees> {
return memo((): Observable<DerivedFees> =>
of([
// deprecated - remove
(api.consts.balances.creationFee as Balance) || createType(api.registry, 'Balance'),
(api.consts.balances.transferFee as Balance) || createType(api.registry, 'Balance'),
(api.consts.balances?.creationFee as Balance) || createType(api.registry, 'Balance'),
(api.consts.balances?.transferFee as Balance) || createType(api.registry, 'Balance'),
// current
api.consts.balances.existentialDeposit,
api.consts.transactionPayment.transactionBaseFee,
api.consts.transactionPayment.transactionByteFee
(api.consts.balances?.existentialDeposit as Balance) || createType(api.registry, 'Balance'),
(api.consts.transactionPayment?.transactionBaseFee as Balance) || createType(api.registry, 'Balance'),
(api.consts.transactionPayment?.transactionByteFee as Balance) || createType(api.registry, 'Balance')
]).pipe(
map(([creationFee, transferFee, existentialDeposit, transactionBaseFee, transactionByteFee]): DerivedFees => ({
creationFee,
@@ -28,7 +28,7 @@ function parse ([hashes, proposals, votes]: Result): DerivedCollectiveProposal[]
export function proposals (api: ApiInterfaceRx, section: 'council' | 'technicalCommittee'): () => Observable<DerivedCollectiveProposal[]> {
return (): Observable<DerivedCollectiveProposal[]> =>
api.query[section]
api.query[section]?.proposals
? api.query[section].proposals().pipe(
switchMap((hashes: Hash[]): Observable<Result> =>
hashes.length
@@ -63,7 +63,7 @@ function parse (api: ApiInterfaceRx, { depositors, proposals, preimages }: Resul
export function proposals (api: ApiInterfaceRx): () => Observable<DeriveProposal[]> {
return memo((): Observable<DeriveProposal[]> =>
api.query.democracy?.publicProps
api.query.democracy?.publicProps && api.query.democracy?.preimages
? api.query.democracy.publicProps<Proposals>().pipe(
switchMap((proposals) =>
combineLatest([
+5 -8
View File
@@ -4,7 +4,7 @@
import { CollatorId, ParaId } from '@polkadot/types/interfaces';
import { DeriveParachainInfo, DeriveParachainFull, DeriveParachainActive } from '../types';
import { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQueue, RetryQueue, SelectedThreads, Watermarks } from './types';
import { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQueue, RetryQueue, SelectedThreads } from './types';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
@@ -21,8 +21,7 @@ type Result = [
ParaInfoResult,
PendingSwap,
Heads,
RelayDispatchQueue,
Watermarks
RelayDispatchQueue
];
function parseActive (id: ParaId, active: Active): DeriveParachainActive | null {
@@ -58,7 +57,7 @@ function parseCollators (id: ParaId, collatorQueue: SelectedThreads | RetryQueue
});
}
function parse (id: ParaId, [active, retryQueue, selectedThreads, didUpdate, info, pendingSwap, heads, relayDispatchQueue, watermarks]: Result): DeriveParachainFull | null {
function parse (id: ParaId, [active, retryQueue, selectedThreads, didUpdate, info, pendingSwap, heads, relayDispatchQueue]: Result): DeriveParachainFull | null {
if (info.isNone) {
return null;
}
@@ -74,8 +73,7 @@ function parse (id: ParaId, [active, retryQueue, selectedThreads, didUpdate, inf
pendingSwapId: pendingSwap.unwrapOr(null),
relayDispatchQueue,
retryCollators: parseCollators(id, retryQueue),
selectedCollators: parseCollators(id, selectedThreads),
watermark: watermarks.unwrapOr(null)
selectedCollators: parseCollators(id, selectedThreads)
};
}
@@ -90,8 +88,7 @@ export function info (api: ApiInterfaceRx): (id: ParaId | number) => Observable<
[api.query.registrar.paras, id],
[api.query.registrar.pendingSwap, id],
[api.query.parachains.heads, id],
[api.query.parachains.relayDispatchQueue, id],
[api.query.parachains.watermarks, id]
[api.query.parachains.relayDispatchQueue, id]
])
.pipe(
map((result: Result): DeriveParachainFull | null =>
@@ -4,7 +4,7 @@
import { ParaId } from '@polkadot/types/interfaces';
import { DeriveParachain, DeriveParachainInfo } from '../types';
import { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize, Watermarks } from './types';
import { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize } from './types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
@@ -17,11 +17,10 @@ type Result = [
DidUpdate,
ParaInfoResult[],
PendingSwap[],
RelayDispatchQueueSize[],
Watermarks[],
RelayDispatchQueueSize[]
];
function parse ([ids, didUpdate, infos, pendingSwaps, relayDispatchQueueSizes, watermarks]: Result): DeriveParachain[] {
function parse ([ids, didUpdate, infos, pendingSwaps, relayDispatchQueueSizes]: Result): DeriveParachain[] {
return ids.map((id, index): DeriveParachain => {
return {
didUpdate: didUpdate.isSome
@@ -30,8 +29,7 @@ function parse ([ids, didUpdate, infos, pendingSwaps, relayDispatchQueueSizes, w
id,
info: { id, ...infos[index].unwrapOr(null) } as DeriveParachainInfo,
pendingSwapId: pendingSwaps[index].unwrapOr(null),
relayDispatchQueueSize: relayDispatchQueueSizes[index][0].toNumber(),
watermark: watermarks[index].unwrapOr(null)
relayDispatchQueueSize: relayDispatchQueueSizes[index][0].toNumber()
};
});
}
@@ -46,8 +44,7 @@ export function overview (api: ApiInterfaceRx): () => Observable<DeriveParachain
api.query.parachains.didUpdate<DidUpdate>(),
api.query.registrar.paras.multi<ParaInfoResult>(paraIds),
api.query.registrar.pendingSwap.multi<PendingSwap>(paraIds),
api.query.parachains.relayDispatchQueueSize.multi<RelayDispatchQueueSize>(paraIds),
api.query.parachains.watermarks.multi<Watermarks>(paraIds)
api.query.parachains.relayDispatchQueueSize.multi<RelayDispatchQueueSize>(paraIds)
])
),
map((result: Result): DeriveParachain[] =>
+1 -3
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { BlockNumber, CollatorId, ParaId, ParaInfo, Retriable, UpwardMessage } from '@polkadot/types/interfaces';
import { CollatorId, ParaId, ParaInfo, Retriable, UpwardMessage } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { Bytes, Option, u32, Vec } from '@polkadot/types';
@@ -16,7 +16,6 @@ export type Code = Bytes;
export type Heads = Bytes;
export type RelayDispatchQueue = Vec<UpwardMessage>
export type RelayDispatchQueueSize = ITuple<[u32, u32]>;
export type Watermarks = Option<BlockNumber>;
export type DidUpdate = Option<Vec<ParaId>>;
export interface DeriveParachainActive {
@@ -38,7 +37,6 @@ export interface DeriveParachain {
id: ParaId;
info: DeriveParachainInfo | null;
relayDispatchQueueSize?: number;
watermark: BlockNumber | null;
}
export interface DeriveParachainFull extends DeriveParachain {
+2 -2
View File
@@ -27,12 +27,12 @@ export function member (api: ApiInterfaceRx): (accountId: AccountId) => Observab
[api.query.society.suspendedMembers, accountId],
[api.query.society.vouching, accountId]
]).pipe(
map(([payouts, strikes, defenderVote, suspended, vouching]: Result): DeriveSocietyMember => ({
map(([payouts, strikes, defenderVotes, suspended, vouching]: Result): DeriveSocietyMember => ({
accountId,
payouts,
isSuspended: suspended.isTrue,
strikes,
vote: defenderVote.unwrapOr(undefined),
vote: defenderVotes.unwrapOr(undefined),
vouching: vouching.unwrapOr(undefined)
}))
)
+41 -37
View File
@@ -4,52 +4,56 @@
import { ApiInterfaceRx } from '@polkadot/api/types';
import { EraIndex, Exposure } from '@polkadot/types/interfaces';
import { DeriveEraExposure } from '../types';
import { DeriveEraExposure, DeriveEraNominatorExposure, DeriveEraValidatorExposure } from '../types';
import BN from 'bn.js';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap, take } from 'rxjs/operators';
import { StorageKey } from '@polkadot/types';
import { memo } from '../util';
function queryClipped (api: ApiInterfaceRx): Observable<[[EraIndex, string][], Exposure[]]> {
return api.derive.staking.erasPoints().pipe(
switchMap((allPoints): Observable<[[EraIndex, string][], Exposure[]]> => {
const indexes: [EraIndex, string][] = [];
function mapStakers (era: EraIndex, stakers: [StorageKey, Exposure][]): DeriveEraExposure {
const nominators: DeriveEraNominatorExposure = {};
const validators: DeriveEraValidatorExposure = {};
allPoints.forEach(({ all, era }): void => {
Object.keys(all).forEach((validatorId): void => {
indexes.push([era, validatorId]);
});
});
stakers.forEach(([key, exposure]): void => {
const validatorId = key.args[1].toString();
// FIXME use prefix queries, get going first
return combineLatest([
of(indexes),
indexes.length
? api.query.staking.erasStakersClipped.multi<Exposure>(indexes)
: of([] as Exposure[])
]);
})
);
validators[validatorId] = exposure;
exposure.others.forEach(({ who }, index): void => {
const nominatorId = who.toString();
nominators[nominatorId] = nominators[nominatorId] || [];
nominators[nominatorId].push([validatorId, index]);
});
});
return { era, nominators, validators };
}
export function erasExposure (api: ApiInterfaceRx): () => Observable<DeriveEraExposure[]> {
return memo((): Observable<DeriveEraExposure[]> =>
queryClipped(api).pipe(
map(([indexes, exposures]): DeriveEraExposure[] =>
indexes.reduce((result: DeriveEraExposure[], [era, validatorId], index): DeriveEraExposure[] => {
let entry = result.find((entry): boolean => entry.era.eq(era));
if (!entry) {
entry = { all: {}, era };
result.push(entry);
}
entry.all[validatorId] = exposures[index];
return result;
}, [])
export function erasExposure (api: ApiInterfaceRx): (withActive?: boolean | BN | number) => Observable<DeriveEraExposure[]> {
return memo((withActive?: boolean | BN | number): Observable<DeriveEraExposure[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras): Observable<[EraIndex[], [StorageKey, Exposure][][]]> =>
combineLatest([
of(eras),
eras.length
? combineLatest(
// we could just do entries over the full set, however the set can be quite large - split it into
// batches - may need to re-visit this, or alternatively use pages keys for exceptionally large sets
eras.map((era): Observable<[StorageKey, Exposure][]> =>
api.query.staking.erasStakersClipped.entries(era).pipe(take(1))
)
)
: of([])
])
),
map(([eras, erasStakers]): DeriveEraExposure[] =>
eras.map((era, index): DeriveEraExposure =>
mapStakers(era, erasStakers[index])
)
)
)
);
@@ -0,0 +1,55 @@
// Copyright 2017-2020 @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 { ApiInterfaceRx } from '@polkadot/api/types';
import { ActiveEraInfo, EraIndex } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { Option, u32 } from '@polkadot/types';
import { isBoolean, isUndefined, bnToBn } from '@polkadot/util';
import { memo } from '../util';
export function erasHistoric (api: ApiInterfaceRx): (withActive?: boolean | BN | number) => Observable<EraIndex[]> {
return memo((withActive?: boolean | BN | number): Observable<EraIndex[]> =>
api.query.staking?.activeEra
? api.queryMulti<[Option<ActiveEraInfo>, u32]>([
api.query.staking.activeEra,
api.query.staking.historyDepth
]).pipe(
map(([activeEraOpt, historyDepth]): EraIndex[] => {
const result: (EraIndex | null)[] = [];
const max = historyDepth.toNumber();
const activeEra = activeEraOpt.unwrapOrDefault().index.toBn();
let lastEra = activeEra;
while (lastEra.gten(0) && (result.length < max)) {
result.push(
((lastEra !== activeEra) || (withActive === true))
? api.registry.createType('EraIndex', lastEra)
: null
);
lastEra = lastEra.subn(1);
}
const startEra = isUndefined(withActive) || isBoolean(withActive)
? new BN(0)
: bnToBn(withActive);
// go from oldest to newest
return result
.filter((era): era is EraIndex =>
era
? era.gte(startEra)
: false
)
.reverse();
})
)
: of([])
);
}
+21 -41
View File
@@ -3,61 +3,41 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ActiveEraInfo, EraIndex, EraRewardPoints, RewardPoint } from '@polkadot/types/interfaces';
import { DeriveEraPointsAll } from '../types';
import { EraIndex, EraRewardPoints } from '@polkadot/types/interfaces';
import { DeriveEraPoints, DeriveEraValPoints } from '../types';
import BN from 'bn.js';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option, u32 } from '@polkadot/types';
import { memo } from '../util';
function getAvailableIndexes (api: ApiInterfaceRx): Observable<EraIndex[]> {
return api.query.staking?.activeEra
? api.queryMulti<[Option<ActiveEraInfo>, u32]>([
api.query.staking.activeEra,
api.query.staking.historyDepth
]).pipe(
map(([activeEraOpt, historyDepth]): EraIndex[] => {
const result: EraIndex[] = [];
const max = historyDepth.toNumber();
let lastEra = activeEraOpt.unwrapOrDefault().index.subn(1);
function mapValidators ({ individual }: EraRewardPoints): DeriveEraValPoints {
return [...individual.entries()]
.filter(([, points]): boolean => points.gtn(0))
.reduce((result: DeriveEraValPoints, [validatorId, points]): DeriveEraValPoints => {
result[validatorId.toString()] = points;
while (lastEra.gten(0) && result.length < max) {
result.push(api.registry.createType('EraIndex', lastEra));
lastEra = lastEra.subn(1);
}
// go from oldest to newest
return result.reverse();
})
)
: of([]);
return result;
}, {});
}
export function erasPoints (api: ApiInterfaceRx): () => Observable<DeriveEraPointsAll[]> {
return memo((): Observable<DeriveEraPointsAll[]> =>
getAvailableIndexes(api).pipe(
switchMap((indexes): Observable<[EraIndex[], EraRewardPoints[]]> =>
export function erasPoints (api: ApiInterfaceRx): (withActive?: boolean | BN | number) => Observable<DeriveEraPoints[]> {
return memo((withActive?: boolean | number): Observable<DeriveEraPoints[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras): Observable<[EraIndex[], EraRewardPoints[]]> =>
combineLatest([
of(indexes),
indexes.length
? api.query.staking.erasRewardPoints.multi<EraRewardPoints>(indexes)
of(eras),
eras.length
? api.query.staking.erasRewardPoints.multi<EraRewardPoints>(eras)
: of([])
])
),
map(([eras, rewards]): DeriveEraPointsAll[] =>
eras.map((era, index): DeriveEraPointsAll => ({
all: [...rewards[index].individual.entries()]
.filter(([, points]): boolean => points.gtn(0))
.reduce((all: Record<string, RewardPoint>, [validatorId, points]): Record<string, RewardPoint> => {
all[validatorId.toString()] = points;
return all;
}, {}),
map(([eras, points]): DeriveEraPoints[] =>
eras.map((era, index): DeriveEraPoints => ({
era,
total: rewards[index].total
eraPoints: points[index].total,
validators: mapValidators(points[index])
}))
)
)
+22 -23
View File
@@ -3,33 +3,32 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveEraRewardsAll } from '../types';
import { Balance, EraIndex } from '@polkadot/types/interfaces';
import { DeriveEraRewards } from '../types';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import BN from 'bn.js';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option } from '@polkadot/types';
import { memo } from '../util';
export function erasRewards (api: ApiInterfaceRx): () => Observable<DeriveEraRewardsAll[]> {
return memo((): Observable<DeriveEraRewardsAll[]> =>
api.derive.staking.erasExposure().pipe(
map((exposures): DeriveEraRewardsAll[] =>
exposures.map(({ era, all }): DeriveEraRewardsAll =>
Object
.entries(all)
.reduce((rewards: DeriveEraRewardsAll, [validatorId, exposure]): DeriveEraRewardsAll => {
rewards.validators[validatorId] = exposure;
exposure.others.forEach(({ who }, index): void => {
const nominatorId = who.toString();
rewards.nominators[nominatorId] = rewards.nominators[nominatorId] || [];
rewards.nominators[nominatorId].push([validatorId, index]);
});
return rewards;
}, { era, nominators: {}, validators: {} })
)
export function erasRewards (api: ApiInterfaceRx): (withActive?: boolean | BN | number) => Observable<DeriveEraRewards[]> {
return memo((withActive?: boolean | BN | number): Observable<DeriveEraRewards[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras): Observable<[EraIndex[], Option<Balance>[]]> =>
combineLatest([
of(eras),
eras.length
? api.query.staking.erasValidatorReward.multi<Option<Balance>>(eras)
: of([])
])
),
map(([eras, rewards]): DeriveEraRewards[] =>
eras.map((era, index): DeriveEraRewards => ({
era,
eraReward: rewards[index].unwrapOrDefault()
}))
)
)
);
+3 -1
View File
@@ -4,12 +4,14 @@
export * from './account';
export * from './erasExposure';
export * from './erasHistoric';
export * from './erasPoints';
export * from './erasRewards';
export * from './controllers';
export * from './electedInfo';
export * from './overview';
export * from './query';
export * from './stakerExposure';
export * from './stakerPoints';
export * from './stakerRewards';
export * from './validators';
export * from './validatorPoints';
+3 -1
View File
@@ -41,7 +41,9 @@ export function overview (api: ApiInterfaceRx): () => Observable<DerivedStakingO
of({ ...indexes, nextElected, validators }),
api.query.staking.erasRewardPoints
? api.query.staking.erasRewardPoints<EraRewardPoints>(indexes.activeEra)
: retrievePointsPrev(api, indexes.activeEra, nextElected)
: api.query.staking.currentEraPointsEarned
? retrievePointsPrev(api, indexes.activeEra, nextElected)
: of(createType(api.registry, 'EraRewardPoints'))
])
),
map(([info, eraPoints]): DerivedStakingOverview => ({
+11 -1
View File
@@ -46,7 +46,9 @@ function retrieveCurr (api: ApiInterfaceRx, stashId: AccountId): Observable<Mult
[api.query.staking.nominators, stashId],
[api.query.staking.payee, stashId],
[api.query.staking.validators, stashId],
[api.query.session.nextKeys, [api.consts.session.dedupKeyPrefix, stashId]],
api.consts.session?.dedupKeyPrefix
? [api.query.session.nextKeys, [api.consts.session.dedupKeyPrefix, stashId]]
: [api.query.session.nextKeys, stashId],
[api.query.staking.erasStakers, [activeEra, stashId]]
])
)
@@ -92,3 +94,11 @@ export function query (api: ApiInterfaceRx): (accountId: Uint8Array | string) =>
);
});
}
export function queryMulti (api: ApiInterfaceRx): (...accountIds: (Uint8Array | string)[]) => Observable<DerivedStakingQuery[]> {
return memo((...accountIds: (Uint8Array | string)[]): Observable<DerivedStakingQuery[]> =>
combineLatest(
accountIds.map((accountId) => api.derive.staking.query(accountId))
)
);
}
@@ -0,0 +1,40 @@
// Copyright 2017-2020 @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 { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveStakerExposure, DeriveEraValidatorExposure } from '../types';
import BN from 'bn.js';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { memo } from '../util';
export function stakerExposure (api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean | BN | number) => Observable<DeriveStakerExposure[]> {
return memo((accountId: Uint8Array | string, withActive?: boolean | BN | number): Observable<DeriveStakerExposure[]> => {
const stakerId = api.registry.createType('AccountId', accountId).toString();
return api.derive.staking.erasExposure(withActive).pipe(
map((exposures): DeriveStakerExposure[] =>
exposures.map(({ era, nominators: allNominators, validators: allValidators }): DeriveStakerExposure => {
const isValidator = !!allValidators[stakerId];
const validators: DeriveEraValidatorExposure = {};
let nominating: [string, number][] = [];
if (isValidator) {
validators[stakerId] = allValidators[stakerId];
} else if (allNominators[stakerId]) {
nominating = allNominators[stakerId];
nominating.forEach(([validatorId]): void => {
validators[validatorId] = allValidators[validatorId];
});
}
return { era, isEmpty: !Object.keys(validators).length, isValidator, nominating, validators };
})
)
);
});
}
@@ -0,0 +1,30 @@
// Copyright 2017-2020 @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 { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveStakerPoints } from '../types';
import BN from 'bn.js';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { memo } from '../util';
export function stakerPoints (api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean | BN | number) => Observable<DeriveStakerPoints[]> {
return memo((accountId: Uint8Array | string, withActive?: boolean | BN | number): Observable<DeriveStakerPoints[]> => {
const stakerId = api.registry.createType('AccountId', accountId).toString();
return api.derive.staking.erasPoints(withActive).pipe(
map((points): DeriveStakerPoints[] =>
points.map(({ era, eraPoints, validators }): DeriveStakerPoints => ({
era,
eraPoints,
points: validators[stakerId]
? validators[stakerId]
: api.registry.createType('RewardPoint')
}))
)
);
});
}
@@ -3,40 +3,83 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Exposure } from '@polkadot/types/interfaces';
import { DeriveStakerReward } from '../types';
import { Balance } from '@polkadot/types/interfaces';
import { DeriveEraPoints, DeriveEraRewards, DeriveStakerExposure, DeriveStakerReward } from '../types';
import { Observable } from 'rxjs';
import BN from 'bn.js';
import { Observable, combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { memo } from '../util';
export function stakerRewards (api: ApiInterfaceRx): (accountId: Uint8Array | string) => Observable<DeriveStakerReward[]> {
return memo((accountId: Uint8Array | string): Observable<DeriveStakerReward[]> => {
type Result = [DeriveEraPoints[], DeriveEraRewards[], DeriveStakerExposure[]];
const ZERO = new BN(0);
function parseRewards (api: ApiInterfaceRx, stakerId: string, [erasPoints, erasRewards, exposures]: Result): DeriveStakerReward[] {
return exposures.map(({ era, isEmpty, isValidator, nominating, validators: eraValidators }): DeriveStakerReward => {
const { eraPoints, validators: allValPoints } = erasPoints.find((p) => p.era.eq(era)) || { eraPoints: new BN(0), validators: {} };
const { eraReward } = erasRewards.find((r) => r.era.eq(era)) || { eraReward: new BN(0) };
const validators: Record<string, Balance> = {};
let total = ZERO;
Object.entries(eraValidators).forEach(([validatorId, exposure]): void => {
const valPoints = allValPoints[validatorId] || new BN(0);
const expTotal = exposure.total.unwrap();
let value: BN | undefined;
if (!expTotal.isZero() && !valPoints.isZero()) {
let staked: BN;
if (validatorId === stakerId) {
staked = exposure.own.unwrap();
} else {
const stakerExp = exposure.others.find(({ who }): boolean => who.eq(stakerId));
staked = stakerExp
? stakerExp.value.unwrap()
: ZERO;
}
value = eraReward.mul(valPoints).mul(staked).div(eraPoints).div(expTotal);
total = total.add(value);
}
validators[validatorId] = api.registry.createType('Balance', value);
});
return {
era,
isEmpty,
isValidator,
nominating,
total: api.registry.createType('Balance', total),
validators
};
});
}
export function stakerRewards (api: ApiInterfaceRx): (accountId: Uint8Array | string, startEra: BN | number) => Observable<DeriveStakerReward[]> {
return memo((accountId: Uint8Array | string, startEra: BN | number): Observable<DeriveStakerReward[]> => {
const stakerId = api.registry.createType('AccountId', accountId).toString();
return api.derive.staking.erasRewards().pipe(
map((rewards): DeriveStakerReward[] =>
rewards
.map(({ era, nominators: allNominators, validators: allValidators }): DeriveStakerReward => {
const isValidator = !!allValidators[stakerId];
const validators: Record<string, Exposure> = {};
let nominating: [string, number][] = [];
if (isValidator) {
validators[stakerId] = allValidators[stakerId];
} else if (allNominators[stakerId]) {
nominating = allNominators[stakerId];
nominating.forEach(([validatorId]): void => {
validators[validatorId] = allValidators[validatorId];
});
}
return { era, isValidator, nominating, validators };
})
.filter(({ validators }): boolean => Object.keys(validators).length !== 0)
return combineLatest([
api.derive.staking.erasPoints(startEra),
api.derive.staking.erasRewards(startEra),
api.derive.staking.stakerExposure(stakerId, startEra)
]).pipe(
map((result): DeriveStakerReward[] =>
parseRewards(api, stakerId, result)
)
);
});
}
export function stakerRewardsMulti (api: ApiInterfaceRx): (...params: [Uint8Array | string, BN | number][]) => Observable<DeriveStakerReward[][]> {
return memo((...params: [Uint8Array | string, BN | number][]): Observable<DeriveStakerReward[][]> =>
combineLatest(
params.map(([accountId, startEra]) =>
api.derive.staking.stakerRewards(accountId, startEra)
)
)
);
}
+28 -12
View File
@@ -5,34 +5,50 @@
import { AccountId, Balance, BlockNumber, EraIndex, EraRewardPoints, Exposure, Keys, RewardDestination, RewardPoint, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
import { DeriveSessionIndexes } from '../session/types';
export interface DeriveEraPointsAll {
all: Record<string, RewardPoint>;
era: EraIndex;
total: RewardPoint;
}
export type DeriveEraValPoints = Record<string, RewardPoint>;
export interface DeriveEraPoints {
era: EraIndex;
own: RewardPoint;
total: RewardPoint;
eraPoints: RewardPoint;
validators: DeriveEraValPoints;
}
export interface DeriveEraRewards {
era: EraIndex;
eraReward: Balance;
}
export interface DeriveStakerPoints {
era: EraIndex;
eraPoints: RewardPoint;
points: RewardPoint;
}
export type DeriveEraNominatorExposure = Record<string, [string, number][]>;
export type DeriveEraValidatorExposure = Record<string, Exposure>;
export interface DeriveEraExposure {
all: Record<string, Exposure>;
era: EraIndex;
nominators: DeriveEraNominatorExposure;
validators: DeriveEraValidatorExposure;
}
export interface DeriveEraRewardsAll {
export interface DeriveStakerExposure {
era: EraIndex;
nominators: Record<string, [string, number][]>;
validators: Record<string, Exposure>;
isEmpty: boolean;
isValidator: boolean;
nominating: [string, number][];
validators: DeriveEraValidatorExposure;
}
export interface DeriveStakerReward {
era: EraIndex;
isEmpty: boolean;
isValidator: boolean;
nominating: [string, number][];
validators: Record<string, Exposure>;
validators: Record<string, Balance>;
total: Balance;
}
export interface DerivedStakingElected {
@@ -1,27 +0,0 @@
// Copyright 2017-2020 @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 { ApiInterfaceRx } from '@polkadot/api/types';
import { DeriveEraPoints } from '../types';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { memo } from '../util';
export function validatorPoints (api: ApiInterfaceRx): (accountId: Uint8Array | string) => Observable<DeriveEraPoints[]> {
return memo((_accountId: Uint8Array | string): Observable<DeriveEraPoints[]> => {
const accountId = api.registry.createType('AccountId', _accountId).toString();
return api.derive.staking.erasPoints().pipe(
map((all): DeriveEraPoints[] =>
all.map(({ all, era, total }): DeriveEraPoints => ({
era,
own: all[accountId] || api.registry.createType('RewardPoint'),
total
}))
)
);
});
}
+20 -5
View File
@@ -7,10 +7,24 @@ import { AccountId } from '@polkadot/types/interfaces';
import { DeriveStakingValidators } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { map, switchMap, take } from 'rxjs/operators';
import { StorageKey } from '@polkadot/types';
import { memo } from '../util';
function queryNextStakers (api: ApiInterfaceRx): Observable<AccountId[]> {
// only populate for next era in the last session, so track both here - entries are not
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
return api.derive.session.indexes().pipe(
switchMap(({ activeEra }): Observable<StorageKey[]> =>
api.query.staking.erasStakers.keys(activeEra.addn(1)).pipe(take(1))
),
map((keys): AccountId[] =>
keys.map((key): AccountId => key.args[1] as AccountId)
)
);
}
/**
* @description Retrieve latest list of validators
*/
@@ -23,15 +37,16 @@ export function validators (api: ApiInterfaceRx): () => Observable<DeriveStaking
api.query.session
? api.query.session.validators()
: of([]),
// FIXME need a replacement for currentElected in new
api.query.staking?.currentElected
api.query.staking
? api.query.staking.erasStakers
? of(null)
? queryNextStakers(api)
: api.query.staking.currentElected<AccountId[]>()
: of([])
]).pipe(
map(([validators, nextElected]): DeriveStakingValidators => ({
nextElected: nextElected || validators,
nextElected: nextElected.length
? nextElected
: validators,
validators
}))
));
+4
View File
@@ -2,5 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { drr } from '@polkadot/rpc-core/rxjs';
export * from './approvalFlagsToBools';
export * from './memo';
export { drr };
+1
View File
@@ -95,6 +95,7 @@ Some of the users of the API (let us know if you are missing from the list), inc
- [Polkabot](https://gitlab.com/Polkabot) Polkabot is a Matrix chatbot that keeps an eye on the Polkadot network. You can see Polkabot in action in https://matrix.to/#/#polkadot-network-status:matrix.org
- [Polkawallet.io](https://polkawallet.io) and [Polkawallet (Github)](https://github.com/polkawallet-io/polkawallet-RN/) A mobile wallet for the Polkadot network to manage funds and make transactions, available on both Androind and iOS
- [PolkaStats.io](https://polkastats.io), [PolkaStats frontend GitHub repository](https://github.com/Colm3na/polkastats-v2) and [PolkaStats backend GitHub repository](https://github.com/Colm3na/polkastats-backend-v2) Polkadot network statistics (currently Kusama and Alexander). Shows network information and staking details from validators and intentions.
- [Polkadot API Server (GitHub)](https://github.com/SimplyVC/polkadot_api_server) A lightweight server for querying Polkadot nodes from any language, built primarily as a backend for [PANIC for Polkadot (GitHub)](https://github.com/SimplyVC/panic_polkadot/), a validator monitoring and alerting tool.
## Classes
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.5.1",
"version": "1.6.2",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -27,19 +27,19 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.8.4",
"@polkadot/api-derive": "1.5.1",
"@polkadot/keyring": "^2.6.1",
"@polkadot/metadata": "1.5.1",
"@polkadot/rpc-core": "1.5.1",
"@polkadot/rpc-provider": "1.5.1",
"@polkadot/types": "1.5.1",
"@polkadot/util": "^2.6.1",
"@polkadot/util-crypto": "^2.6.1",
"@polkadot/api-derive": "1.6.2",
"@polkadot/keyring": "^2.6.2",
"@polkadot/metadata": "1.6.2",
"@polkadot/rpc-core": "1.6.2",
"@polkadot/rpc-provider": "1.6.2",
"@polkadot/types": "1.6.2",
"@polkadot/util": "^2.6.2",
"@polkadot/util-crypto": "^2.6.2",
"bn.js": "^5.1.1",
"eventemitter3": "^4.0.0",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@polkadot/keyring": "^2.6.1"
"@polkadot/keyring": "^2.6.2"
}
}
+5 -5
View File
@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
import { AnyNumber, ITuple } from '@polkadot/types/types';
import { Option, U8aFixed, Vec } from '@polkadot/types/codec';
import { Linkage, Option, U8aFixed, Vec } from '@polkadot/types/codec';
import { Bytes, Data, bool, u32, u64 } from '@polkadot/types/primitive';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BabeAuthorityWeight, MaybeVrf } from '@polkadot/types/interfaces/babe';
@@ -255,11 +255,11 @@ declare module '@polkadot/api/types/storage' {
/**
* The map from (wannabe) validator stash key to the preferences of that validator.
**/
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>> & QueryableStorageEntry<ApiType>;
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[ValidatorPrefs, Linkage<AccountId>]>>> & QueryableStorageEntry<ApiType>;
/**
* The map from nominator stash key to the set of stash keys of all validators to nominate.
**/
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Nominations>>> & QueryableStorageEntry<ApiType>;
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Nominations, Linkage<AccountId>]>>>> & QueryableStorageEntry<ApiType>;
/**
* The current era index.
* This is the latest planned era, depending on how session module queues the validator
@@ -459,7 +459,7 @@ declare module '@polkadot/api/types/storage' {
/**
* Get the account (and lock periods) to which another account is delegating vote.
**/
delegations: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[AccountId, Conviction]>>> & QueryableStorageEntry<ApiType>;
delegations: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[ITuple<[AccountId, Conviction]>, Linkage<AccountId>]>>> & QueryableStorageEntry<ApiType>;
/**
* Accounts for which there are locks in action which may be removed at some point in the
* future. The value is the block number at which the lock expires and may be removed.
@@ -560,7 +560,7 @@ declare module '@polkadot/api/types/storage' {
/**
* Votes of a particular voter, with the round index of the votes.
**/
votesOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
votesOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[Vec<AccountId>, Linkage<AccountId>]>>> & QueryableStorageEntry<ApiType>;
/**
* Locked stake of a voter.
**/
+10 -4
View File
@@ -7,7 +7,7 @@ import { Bytes, StorageKey, Text, bool, u32, u64 } from '@polkadot/types/primiti
import { Metadata } from '@polkadot/types';
import { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
import { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import { BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
import { BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion } from '@polkadot/types/interfaces/rpc';
import { AccountId, BlockNumber, H256, Hash, Header, Index, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
import { Observable } from 'rxjs';
@@ -138,7 +138,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
* Get the runtime version
**/
getRuntimeVersion: AugmentedRpc<(at?: BlockHash | string | Uint8Array) => Observable<RuntimeVersion>>;
getStorage: AugmentedRpc<<T = Codec>(key: any, block?: Hash | Uint8Array | string) => Observable<T>>;
/**
* Retrieves the storage for a key
**/
getStorage: AugmentedRpc<<T = Codec>(key: StorageKey | string | Uint8Array | any, block?: Hash | Uint8Array | string) => Observable<T>>;
/**
* Retrieves the storage hash
**/
@@ -150,12 +153,15 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
/**
* Query historical storage entries (by key) starting from a start block
**/
queryStorage: AugmentedRpc<(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], startBlock: Hash | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageChangeSet>>>;
queryStorage: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], fromBlock?: Hash | Uint8Array | string, toBlock?: Hash | Uint8Array | string) => Observable<[Hash, T][]>>;
/**
* Retrieves the runtime version via subscription
**/
subscribeRuntimeVersion: AugmentedRpc<() => Observable<RuntimeVersion>>;
subscribeStorage: AugmentedRpc<<T = Codec[]>(keys: any[]) => Observable<T>>;
/**
* Subscribes to storage changes for the provided keys
**/
subscribeStorage: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[]) => Observable<T>>;
};
system: {
/**
+52 -45
View File
@@ -4,28 +4,30 @@
import { Constants, Storage } from '@polkadot/metadata/Decorated/types';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { Call, Hash, RuntimeVersion, StorageChangeSet } from '@polkadot/types/interfaces';
import { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { AnyFunction, CallFunction, Codec, CodecArg as Arg, ITuple, InterfaceTypes, ModulesWithCalls, Registry, RegistryTypes } from '@polkadot/types/types';
import { SubmittableExtrinsic } from '../submittable/types';
import { ApiInterfaceRx, ApiOptions, ApiTypes, DecorateMethod, DecoratedRpc, DecoratedRpcSection, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import BN from 'bn.js';
import { BehaviorSubject, Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { map, switchMap, take } from 'rxjs/operators';
import decorateDerive, { ExactDerive } from '@polkadot/api-derive';
import { memo } from '@polkadot/api-derive/util';
import DecoratedMeta from '@polkadot/metadata/Decorated';
import getHasher from '@polkadot/metadata/Decorated/storage/fromMetadata/getHasher';
import RpcCore from '@polkadot/rpc-core';
import { WsProvider } from '@polkadot/rpc-provider';
import { Metadata, Null, Option, Text, TypeRegistry, u64, Vec } from '@polkadot/types';
import { Metadata, Null, Option, Raw, Text, TypeRegistry, u64 } from '@polkadot/types';
import Linkage, { LinkageResult } from '@polkadot/types/codec/Linkage';
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/extrinsic/constants';
import StorageKey, { StorageEntry, unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import { assert, compactStripLength, isNull, isUndefined, u8aConcat, u8aToHex } from '@polkadot/util';
import { createSubmittable } from '../submittable';
import { decorateSections, DeriveAllSections } from '../util/decorate';
import augmentObject from '../util/augmentObject';
import { decorateSections, DeriveAllSections } from '../util/decorate';
import { extractStorageArgs } from '../util/validate';
import Events from './Events';
interface MetaDecoration {
@@ -291,9 +293,7 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
private decorateStorageEntry<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): QueryableStorageEntry<ApiType> {
// get the storage arguments, with DoubleMap as an array entry, otherwise spread
const getArgs = (...args: any[]): any[] => creator.meta.type.isDoubleMap
? [creator, args]
: [creator, ...args];
const getArgs = (...args: any[]): any[] => extractStorageArgs(creator, args);
// FIXME We probably want to be able to query the full list with non-subs as well
const decorated = this.hasSubscriptions && creator.iterKey && creator.meta.type.isMap && creator.meta.type.asMap.linked.isTrue
@@ -314,8 +314,8 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
decorated.at = decorateMethod((hash: Hash, arg1?: Arg, arg2?: Arg): Observable<Codec> =>
this._rpcCore.state.getStorage(getArgs(arg1, arg2), hash));
decorated.entries = decorateMethod((doubleMapArg?: Arg): Observable<[StorageKey, Codec][]> =>
this.retrieveMapEntries(creator, doubleMapArg));
decorated.entries = decorateMethod(memo((doubleMapArg?: Arg): Observable<[StorageKey, Codec][]> =>
this.retrieveMapEntries(creator, doubleMapArg)));
decorated.hash = decorateMethod((arg1?: Arg, arg2?: Arg): Observable<Hash> =>
this._rpcCore.state.getStorageHash(getArgs(arg1, arg2)));
@@ -326,6 +326,9 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
decorated.keyPrefix = (): string =>
u8aToHex(creator.keyPrefix);
decorated.keys = decorateMethod(memo((doubleMapArg?: Arg): Observable<StorageKey[]> =>
this.retrieveMapKeys(creator, doubleMapArg)));
if (this.hasSubscriptions) {
// When using double map storage function, user need to pass double map key as an array
decorated.multi = decorateMethod((args: (Arg | Arg[])[]): Observable<Codec[]> =>
@@ -333,8 +336,8 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
args.map((arg: Arg[] | Arg): [StorageEntry, Arg | Arg[]] => [creator, arg])));
}
decorated.range = decorateMethod((range: [Hash, Hash?], arg1?: Arg, arg2?: Arg): Observable<[Hash, Codec][]> =>
this.decorateStorageRange(decorated, [arg1, arg2], range));
decorated.range = decorateMethod(memo((range: [Hash, Hash?], arg1?: Arg, arg2?: Arg): Observable<[Hash, Codec][]> =>
this.decorateStorageRange(decorated, [arg1, arg2], range)));
decorated.size = decorateMethod((arg1?: Arg, arg2?: Arg): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(arg1, arg2)));
@@ -343,17 +346,15 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
}
private decorateStorageRange<ApiType extends ApiTypes> (decorated: QueryableStorageEntry<ApiType>, args: [Arg?, Arg?], range: [Hash, Hash?]): Observable<[Hash, Codec][]> {
const outputType = unwrapStorageType(decorated.creator.meta.type);
const outputType = unwrapStorageType(decorated.creator.meta.type, decorated.creator.meta.modifier.isOptional);
return this._rpcCore.state
.queryStorage([decorated.key(...args)], ...range)
.pipe(map((result: StorageChangeSet[]): [Hash, Codec][] =>
result
.filter((change): change is StorageChangeSet => !!change.changes.length)
.map(({ block, changes: [[, value]] }): [Hash, Codec] => [
block,
this.createType(outputType, value.unwrapOrDefault())
])
.queryStorage<[Option<Raw>]>([decorated.key(...args)], ...range)
.pipe(map((result: [Hash, [Option<Raw>]][]): [Hash, Codec][] =>
result.map(([blockHash, [value]]): [Hash, Codec] => [
blockHash,
this.createType(outputType, value.isSome ? value.unwrap().toHex() : undefined)
])
));
}
@@ -366,8 +367,8 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
// entries can be re-linked in the middle of a list, we subscribe here to make
// sure we catch any updates, no matter the list position
const getNext = (key: Codec): Observable<LinkageResult> =>
this._rpcCore.state.subscribeStorage<[LinkageData | Option<LinkageData>]>([[creator, key]]).pipe(
switchMap(([_data]: [LinkageData | Option<LinkageData>]): Observable<LinkageResult> => {
this._rpcCore.state.getStorage<LinkageData | Option<LinkageData>>([creator, key]).pipe(
switchMap((_data: LinkageData | Option<LinkageData>): Observable<LinkageResult> => {
const data = creator.meta.modifier.isOptional
? (_data as Option<LinkageData>).unwrapOr(null)
: _data as LinkageData;
@@ -429,38 +430,44 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
);
}
private retrieveMapEntries (creator: StorageEntry, arg?: Arg): Observable<[StorageKey, Codec][]> {
assert(creator.iterKey && (creator.meta.type.isMap || creator.meta.type.isDoubleMap), 'entries can only be retrieved on maps, linked maps and double maps');
private retrieveMapKeys ({ iterKey, meta }: StorageEntry, arg?: Arg): Observable<StorageKey[]> {
assert(iterKey && (meta.type.isMap || meta.type.isDoubleMap), 'keys can only be retrieved on maps, linked maps and double maps');
const outputType = creator.meta.type.isMap
? creator.meta.type.asMap.value.toString()
: creator.meta.type.asDoubleMap.value.toString();
const startKey = this.createType('Raw', u8aConcat(
iterKey,
meta.type.isDoubleMap && !isUndefined(arg) && !isNull(arg)
? getHasher(meta.type.asDoubleMap.hasher)(
this.createType(meta.type.asDoubleMap.key1.toString() as 'Raw', arg).toU8a()
)
: new Uint8Array([])
));
return this._rpcCore.state
// FIXME This should really be some sort of subscription, so we can get stuff as
// it changes (as of now it is a one-shot query). Not sure how to do this though...
.getKeys(
this.createType('Raw', u8aConcat(
creator.iterKey,
creator.meta.type.isDoubleMap && !isUndefined(arg) && !isNull(arg)
? getHasher(creator.meta.type.asDoubleMap.hasher)(
this.createType(creator.meta.type.asDoubleMap.key1.toString() as 'Raw', arg).toU8a()
)
: new Uint8Array([])
))
return this._rpcCore.state.getKeys(startKey).pipe(
map((keys): StorageKey[] =>
keys.map((key) => key.decodeArgsFromMeta(meta))
)
);
}
private retrieveMapEntries (entry: StorageEntry, arg?: Arg): Observable<[StorageKey, Codec][]> {
const outputType = unwrapStorageType(entry.meta.type, entry.meta.modifier.isOptional);
return this.retrieveMapKeys(entry, arg)
.pipe(
switchMap((keys): Observable<[StorageKey[], Vec<Codec>]> =>
switchMap((keys): Observable<[StorageKey[], Option<Raw>[]]> =>
combineLatest([
of(keys),
// Not 100% sure about this, surely this is just a vec?
this._rpcCore.state.subscribeStorage<Vec<Codec>>(
keys.map((key) => key.setOutputType(outputType))
)
// Since we have a default constructed key, we have Option<Raw> as the result
// Don't keep the subscription here active, retrieve and get out of Dodge
// TODO Once we have a multiple key RPC available, use that via fallback
this._rpcCore.state.subscribeStorage<Option<Raw>[]>(keys).pipe(take(1))
])
),
map(([keys, values]): [StorageKey, Codec][] =>
keys.map((key, index): [StorageKey, Codec] => [key, values[index]])
keys.map((key, index): [StorageKey, Codec] => [
key,
this.createType(outputType, values[index].isSome ? values[index].unwrap().toHex() : undefined)
])
)
);
}
+1 -1
View File
@@ -6,7 +6,7 @@ import { detectPackage } from '@polkadot/util';
// FIXME This really should be `import(...).then(...)`, but need to check rejections
// eslint-disable-next-line @typescript-eslint/no-var-requires
detectPackage(require('./package.json'), __dirname);
detectPackage(require('./package.json'), typeof __dirname !== 'undefined' && __dirname);
export { Keyring } from '@polkadot/keyring';
export { WsProvider } from '@polkadot/rpc-provider';
+1
View File
@@ -32,6 +32,7 @@ export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunctio
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
key: (...args: Parameters<F>) => string;
keyPrefix: () => string;
keys: (arg?: any) => PromiseOrObs<ApiType, StorageKey[]>;
range: <T extends Codec | any = ObsInnerType<ReturnType<F>>>([from, to]: [Hash | Uint8Array | string, Hash | Uint8Array | string | undefined] | [Hash | Uint8Array | string], ...args: Parameters<F>) => PromiseOrObs<ApiType, [Hash, T][]>;
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
multi: ApiType extends 'rxjs' ? StorageEntryObservableMulti : StorageEntryPromiseMulti;
+95
View File
@@ -0,0 +1,95 @@
// Copyright 2017-2019 @polkadot/api 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 { Storage } from '@polkadot/metadata/Decorated/types';
import storageFromMeta from '@polkadot/metadata/Decorated/storage/fromMetadata';
import Metadata from '@polkadot/metadata/Metadata';
import metaStatic from '@polkadot/metadata/Metadata/static';
import { TypeRegistry } from '@polkadot/types';
import { extractStorageArgs } from './validate';
describe.skip('extractStorageArgs', (): void => {
const registry = new TypeRegistry();
let storage: Storage;
beforeEach((): void => {
const metadata = new Metadata(registry, metaStatic);
storage = storageFromMeta(registry, metadata);
});
it('validates no-arg plain', (): void => {
expect(
extractStorageArgs(storage.timestamp.now, [])
).toEqual([storage.timestamp.now]);
});
it('validates no-arg plain (failing when there are args)', (): void => {
expect(
(): any[] =>
extractStorageArgs(storage.timestamp.now, [123, 456])
).toThrow('timestamp.now() does not take any arguments, 2 found');
});
it('validates map, 1 arg', (): void => {
expect(
extractStorageArgs(storage.staking.payee, ['abc'])
).toEqual([storage.staking.payee, 'abc']);
});
it('validates map, 1 arg (failing with no args)', (): void => {
expect(
(): any =>
extractStorageArgs(storage.staking.payee, [])
).toThrow('staking.payee(AccountId) is a map, requiring 1 argument, 0 found');
});
it('validates map, 1 arg (failing with no args)', (): void => {
expect(
(): any =>
extractStorageArgs(storage.staking.payee, ['abc', 'def'])
).toThrow('staking.payee(AccountId) is a map, requiring 1 argument, 2 found');
});
it('validates doublemap, 2 args', (): void => {
expect(
extractStorageArgs(storage.staking.erasStakers, [1, '0x1234'])
).toEqual([storage.staking.erasStakers, [1, '0x1234']]);
});
it('validates doublemap, 2 args (failing with no args)', (): void => {
expect(
(): any =>
extractStorageArgs(storage.staking.erasStakers, [])
).toThrow('staking.erasStakers(EraIndex, AccountId) is a doublemap, requiring 2 arguments, 0 found');
});
it('validates doublemap, 2 args (failing with 1 arg)', (): void => {
expect(
(): any =>
extractStorageArgs(storage.staking.erasStakers, [123])
).toThrow('staking.erasStakers(EraIndex, AccountId) is a doublemap, requiring 2 arguments, 1 found');
});
it('validates linked map, no args', (): void => {
expect(
extractStorageArgs(storage.staking.validators, [])
).toEqual([storage.staking.validators]);
});
it('validates linked map, single arg', (): void => {
expect(
extractStorageArgs(storage.staking.validators, [123])
).toEqual([storage.staking.validators, 123]);
});
it('validates linked map (failing with extra args)', (): void => {
expect(
(): any[] =>
extractStorageArgs(storage.staking.validators, [123, 456])
).toThrow('staking.validators(AccountId) is a linked map, requiring either 0 arguments (retrieving all) or 1 argument, 2 found');
});
});
+55
View File
@@ -0,0 +1,55 @@
// Copyright 2017-2019 @polkadot/api 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 { StorageEntry } from '@polkadot/types/primitive/StorageKey';
// FIXME This breaks with .at(hash, ...)
// import { Type } from '@polkadot/types';
// import { assert } from '@polkadot/util';
// function sig ({ method, section }: StorageEntry, ...args: Type[]): string {
// return `${section}.${method}(${args.join(', ')})`;
// }
// function doDoubleMap (creator: StorageEntry, args: any[]): [StorageEntry, [any, any]] {
// const { key1, key2 } = creator.meta.type.asDoubleMap;
// assert(args.length === 2, `${sig(creator, key1, key2)} is a doublemap, requiring 2 arguments, ${args.length} found`);
// // pass as tuple
// return [creator, args as [any, any]];
// }
// function doMap (creator: StorageEntry, args: any[]): [StorageEntry] | [StorageEntry, any] {
// const { key, linked } = creator.meta.type.asMap;
// linked.isTrue
// ? assert(args.length <= 1, `${sig(creator, key)} is a linked map, requiring either 0 arguments (retrieving all) or 1 argument, ${args.length} found`)
// : assert(args.length === 1, `${sig(creator, key)} is a map, requiring 1 argument, ${args.length} found`);
// // expand
// return args.length
// ? [creator, args[0]]
// : [creator];
// }
// sets up the arguments in the form of [creator, args] ready to be used in a storage
// call. Additionally, it verifies that the correct number of arguments have been passed
export function extractStorageArgs (creator: StorageEntry, args: any[]): any[] {
return creator.meta.type.isDoubleMap
? [creator, args]
: [creator, ...args];
// if (creator.meta.type.isDoubleMap) {
// return doDoubleMap(creator, args);
// } else if (creator.meta.type.isMap) {
// return doMap(creator, args);
// }
// assert(args.length === 0, `${sig(creator)} does not take any arguments, ${args.length} found`);
// // no args
// return [creator, ...args];
}
+61
View File
@@ -0,0 +1,61 @@
// Copyright 2017-2020 @polkadot/api 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 { ApiPromise, WsProvider } from '@polkadot/api';
function createApi (): Promise<ApiPromise> {
process.env.NODE_ENV = 'test';
const provider = new WsProvider('wss://kusama-rpc.polkadot.io');
return new ApiPromise({ provider }).isReady;
}
describe.skip('misc quick tests', (): void => {
it.skip('retrieves balances correctly', async (): Promise<void> => {
const api = await createApi();
console.error(JSON.stringify(
await api.query.system.account('FPzukZw2mphWsXDqdkNzLaxnanjZEWH9i2vqwobTdtde5me')
));
console.error(JSON.stringify(
await api.query.system.account('HUewJvzVuEeyaxH2vx9XiyAPKrpu1Zj5r5Pi9VrGiBVty7q')
));
});
it.skip('handles map entries', async (): Promise<void> => {
const api = await createApi();
console.error(JSON.stringify(
await api.query.indices.accounts.entries()
));
});
it.skip('handles doublemap entries', async (): Promise<void> => {
const api = await createApi();
const activeEra = await api.query.staking.activeEra();
console.error(JSON.stringify(
await api.query.staking.erasStakers.entries(activeEra.unwrapOrDefault().index)
));
});
it.skip('does something in society', async (): Promise<void> => {
const api = await createApi();
console.error(JSON.stringify(
await api.query.society.defenderVotes('Dab4bfYTZRUDMWjYAUQuFbDreQ9mt7nULWu3Dw7jodbzVe9')
));
});
it.skip('allows for range queries', async (): Promise<void> => {
const api = await createApi();
const header = await api.rpc.chain.getHeader();
console.error(JSON.stringify(
(await api.query.staking.activeEra.range([header.parentHash, header.hash], 'Dab4bfYTZRUDMWjYAUQuFbDreQ9mt7nULWu3Dw7jodbzVe9'))
.map(([block, value]) => [block, value.toRawType(), value.toHuman()])
));
});
});
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/jsonrpc",
"version": "1.5.1",
"version": "1.6.2",
"description": "Method definitions for the Polkadot RPC layer",
"main": "index.js",
"publishConfig": {
@@ -27,7 +27,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/jsonrpc#readme",
"dependencies": {
"@babel/runtime": "^7.8.4",
"@polkadot/types": "1.5.1",
"@polkadot/util": "^2.6.1"
"@polkadot/types": "1.6.2",
"@polkadot/util": "^2.6.2"
}
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.5.1",
"version": "1.6.2",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -27,12 +27,12 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.8.4",
"@polkadot/types": "1.5.1",
"@polkadot/util": "^2.6.1",
"@polkadot/util-crypto": "^2.6.1",
"@polkadot/types": "1.6.2",
"@polkadot/util": "^2.6.2",
"@polkadot/util-crypto": "^2.6.2",
"bn.js": "^5.1.1"
},
"devDependencies": {
"@polkadot/keyring": "^2.6.1"
"@polkadot/keyring": "^2.6.2"
}
}
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.5.1",
"version": "1.6.2",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,15 +27,15 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.8.4",
"@polkadot/jsonrpc": "1.5.1",
"@polkadot/metadata": "1.5.1",
"@polkadot/rpc-provider": "1.5.1",
"@polkadot/types": "1.5.1",
"@polkadot/util": "^2.6.1",
"@polkadot/jsonrpc": "1.6.2",
"@polkadot/metadata": "1.6.2",
"@polkadot/rpc-provider": "1.6.2",
"@polkadot/types": "1.6.2",
"@polkadot/util": "^2.6.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@polkadot/keyring": "^2.6.1"
"@polkadot/keyring": "^2.6.2"
}
}
+29 -21
View File
@@ -4,6 +4,7 @@
import { ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types';
import { RpcMethod, RpcSection, RpcParam } from '@polkadot/jsonrpc/types';
import { Hash } from '@polkadot/types/interfaces';
import { AnyJson, Codec, Registry } from '@polkadot/types/types';
import { RpcInterface, RpcInterfaceMethod, UserRpc } from './types';
@@ -349,26 +350,12 @@ export default class Rpc implements RpcInterface {
throw error;
}
} else if (method.type === 'StorageChangeSet') {
// For StorageChangeSet, the changes has the [key, value] mappings
const changes: [string, string | null][] = result.changes;
const keys = params[0] as Vec<StorageKey>;
const withCache = keys.length !== 1;
// multiple return values (via state.storage subscription), decode the values
// one at a time, all based on the query types. Three values can be returned -
// - Codec - There is a valid value, non-empty
// - null - The storage key is empty
return keys.reduce((results, key: StorageKey): Codec[] => {
try {
results.push(this.formatStorageSet(key, changes, withCache));
} catch (error) {
console.error(`Unable to decode storage ${key.section}.${key.method}:`, error.message);
throw error;
}
return results;
}, [] as Codec[]);
return this.formatStorageSet(params[0] as Vec<StorageKey>, result.changes);
} else if (method.type === 'Vec<StorageChangeSet>') {
return result.map(({ block, changes }: { block: string; changes: [string, string | null][] }): [Hash, Codec[]] => [
this.registry.createType('Hash', block),
this.formatStorageSet(params[0] as Vec<StorageKey>, changes)
]);
}
return createTypeUnsafe(this.registry, method.type, [result]);
@@ -402,7 +389,28 @@ export default class Rpc implements RpcInterface {
return createTypeUnsafe(this.registry, type, [isEmpty ? meta.fallback : input], true);
}
private formatStorageSet (key: StorageKey, changes: [string, string | null][], witCache: boolean): Codec {
private formatStorageSet (keys: Vec<StorageKey>, changes: [string, string | null][]): Codec[] {
// For StorageChangeSet, the changes has the [key, value] mappings
const withCache = keys.length !== 1;
// multiple return values (via state.storage subscription), decode the values
// one at a time, all based on the query types. Three values can be returned -
// - Codec - There is a valid value, non-empty
// - null - The storage key is empty
return keys.reduce((results: Codec[], key: StorageKey): Codec[] => {
try {
results.push(this.formatStorageSetEntry(key, changes, withCache));
} catch (error) {
console.error(`Unable to decode storage ${key.section}.${key.method}:`, error.message);
throw error;
}
return results;
}, []);
}
private formatStorageSetEntry (key: StorageKey, changes: [string, string | null][], witCache: boolean): Codec {
// Fallback to Raw (i.e. just the encoding) if we don't have a specific type
const type = key.outputType || 'Raw';
const hexKey = key.toHex();
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.5.1",
"version": "1.6.2",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -27,18 +27,18 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.8.4",
"@polkadot/jsonrpc": "1.5.1",
"@polkadot/metadata": "1.5.1",
"@polkadot/types": "1.5.1",
"@polkadot/util": "^2.6.1",
"@polkadot/util-crypto": "^2.6.1",
"@polkadot/jsonrpc": "1.6.2",
"@polkadot/metadata": "1.6.2",
"@polkadot/types": "1.6.2",
"@polkadot/util": "^2.6.2",
"@polkadot/util-crypto": "^2.6.2",
"bn.js": "^5.1.1",
"eventemitter3": "^4.0.0",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31"
},
"devDependencies": {
"@polkadot/keyring": "^2.6.1",
"@polkadot/keyring": "^2.6.2",
"mock-socket": "^9.0.3",
"nock": "^12.0.1"
}
@@ -42,6 +42,12 @@ describe('decodeResponse', (): void => {
).toThrow(/123: test error/);
});
it('throws any error found, with data', (): void => {
expect(
(): any => coder.decodeResponse({ id: 1, jsonrpc: '2.0', error: { code: 123, data: 'Error("Some random error description")', message: 'test error' } } as JsonRpcResponse)
).toThrow(/123: test error: Some random error description/);
});
it('returns the result', (): void => {
expect(
coder.decodeResponse({ id: 1, jsonrpc: '2.0', result: 'some result' } as JsonRpcResponse)
+15 -7
View File
@@ -6,6 +6,20 @@ import { JsonRpcRequest, JsonRpcResponse, JsonRpcResponseBaseError } from '../ty
import { assert, isUndefined, isNumber, isString } from '@polkadot/util';
function formatErrorData (data?: string | number): string {
if (isUndefined(data)) {
return '';
}
const formatted = isString(data)
? data.replace('Error("', '').replace('")', '')
: JSON.stringify(data);
// We need some sort of cut-off here since these can be very large and
// very nested, pick a number and trim the result display to it
return `: ${formatted.substr(0, 35)}`;
}
/** @internal */
export default class RpcCoder {
#id = 0;
@@ -54,13 +68,7 @@ export default class RpcCoder {
if (error) {
const { code, data, message } = error;
// We need some sort of cut-off here since these can be very large and
// very nested, pick a number and trim the result display to it
const _data = isUndefined(data)
? ''
: `: ${isString(data) ? data : JSON.stringify(data)}`.substr(0, 35);
throw new Error(`${code}: ${message}${_data}`);
throw new Error(`${code}: ${message}${formatErrorData(data)}`);
}
}
}
+1
View File
@@ -59,6 +59,7 @@ export default class Mock implements ProviderInterface {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
chain_getBlockHash: (blockNumber: number): string => '0x1234',
chain_getHeader: (): any => this.registry.createType('Header', rpcHeader.result).toJSON(),
state_getKeys: (): string[] => [],
state_getRuntimeVersion: (): string => this.registry.createType('RuntimeVersion').toHex(),
state_getMetadata: (): string => rpcMetadata,
state_getStorage: (storage: MockStateDb, params: any[]): string => u8aToHex(storage[(params[0] as string)]),
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.5.1",
"version": "1.6.2",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
@@ -36,12 +36,12 @@
"@babel/core": "^7.8.3",
"@babel/register": "^7.8.3",
"@babel/runtime": "^7.8.4",
"@polkadot/api": "1.5.1",
"@polkadot/jsonrpc": "1.5.1",
"@polkadot/metadata": "1.5.1",
"@polkadot/rpc-provider": "1.5.1",
"@polkadot/types": "1.5.1",
"@polkadot/util": "^2.6.1",
"@polkadot/api": "1.6.2",
"@polkadot/jsonrpc": "1.6.2",
"@polkadot/metadata": "1.6.2",
"@polkadot/rpc-provider": "1.6.2",
"@polkadot/types": "1.6.2",
"@polkadot/util": "^2.6.2",
"websocket": "^1.0.31",
"yargs": "^15.1.0"
},
+5 -13
View File
@@ -8,30 +8,22 @@ import * as defaultDefs from '@polkadot/types/interfaces/definitions';
import staticData from '@polkadot/metadata/Metadata/static';
import Metadata from '@polkadot/metadata/Metadata';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import { TypeRegistry } from '@polkadot/types/create';
import { stringLowerFirst } from '@polkadot/util';
import { FOOTER, HEADER, TypeImports, createDocComments, createImportCode, createImports, formatType, getSimilarTypes, indent, registerDefinitions, setImports, writeFile } from '../util';
// If the StorageEntry returns T, output `Option<T>` if the modifier is optional
/** @internal */
function addModifier (storageEntry: StorageEntryMetadataLatest, returnType: string): string {
if (storageEntry.modifier.isOptional) {
return `Option<${returnType}>`;
}
return returnType;
}
// From a storage entry metadata, we return [args, returnType]
/** @internal */
function entrySignature (allDefs: object, registry: Registry, storageEntry: StorageEntryMetadataLatest, imports: TypeImports): [string, string] {
const format = (type: string): string => formatType(allDefs, type, imports);
const outputType = unwrapStorageType(storageEntry.type, storageEntry.modifier.isOptional);
if (storageEntry.type.isPlain) {
setImports(allDefs, imports, [storageEntry.type.asPlain.toString()]);
return ['', formatType(allDefs, addModifier(storageEntry, storageEntry.type.asPlain.toString()), imports)];
return ['', formatType(allDefs, outputType, imports)];
} else if (storageEntry.type.isMap) {
// Find similar types of the `key` type
const similarTypes = getSimilarTypes(allDefs, registry, storageEntry.type.asMap.key.toString(), imports);
@@ -43,7 +35,7 @@ function entrySignature (allDefs: object, registry: Registry, storageEntry: Stor
return [
`arg: ${similarTypes.map(format).join(' | ')}`,
formatType(allDefs, addModifier(storageEntry, storageEntry.type.asMap.value.toString()), imports)
formatType(allDefs, outputType, imports)
];
} else if (storageEntry.type.isDoubleMap) {
// Find similar types of `key1` and `key2` types
@@ -61,7 +53,7 @@ function entrySignature (allDefs: object, registry: Registry, storageEntry: Stor
return [
`key1: ${key1Types}, key2: ${key2Types}`,
formatType(allDefs, addModifier(storageEntry, storageEntry.type.asDoubleMap.value.toString()), imports)
formatType(allDefs, outputType, imports)
];
}
+11 -7
View File
@@ -8,6 +8,8 @@ import { TypeRegistry } from '@polkadot/types/create';
import { FOOTER, HEADER, createDocComments, createImportCode, createImports, getSimilarTypes, setImports, writeFile, indent } from '../util';
const StorageKeyTye = 'StorageKey | string | Uint8Array | any';
/** @internal */
export default function generateRpcTypes (dest = 'packages/api/src/augment/rpc.ts'): void {
writeFile(dest, (): string => {
@@ -21,19 +23,21 @@ export default function generateRpcTypes (dest = 'packages/api/src/augment/rpc.t
const allMethods = Object.keys(interfaces[section].methods).sort().map((key): string => {
const method = interfaces[section].methods[key];
setImports(allDefs, imports, [method.type]);
// FIXME These 2 are too hard to type, I give up
// These are too hard to type with generics, do manual overrides
if (section === 'state') {
if (method.method === 'getStorage') {
setImports(allDefs, imports, ['Codec']);
setImports(allDefs, imports, ['Codec', 'Hash', 'StorageKey', 'Vec']);
return indent(6)('getStorage: AugmentedRpc<<T = Codec>(key: any, block?: Hash | Uint8Array | string) => Observable<T>>;');
if (method.method === 'getStorage') {
return createDocComments(6, [method.description]) + indent(6)(`getStorage: AugmentedRpc<<T = Codec>(key: ${StorageKeyTye}, block?: Hash | Uint8Array | string) => Observable<T>>;`);
} else if (method.method === 'queryStorage') {
return createDocComments(6, [method.description]) + indent(6)(`queryStorage: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (${StorageKeyTye})[], fromBlock?: Hash | Uint8Array | string, toBlock?: Hash | Uint8Array | string) => Observable<[Hash, T][]>>;`);
} else if (method.method === 'subscribeStorage') {
return indent(6)('subscribeStorage: AugmentedRpc<<T = Codec[]>(keys: any[]) => Observable<T>>;');
return createDocComments(6, [method.description]) + indent(6)(`subscribeStorage: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (${StorageKeyTye})[]) => Observable<T>>;`);
}
}
setImports(allDefs, imports, [method.type]);
const args = method.params.map((param): string => {
const similarTypes = getSimilarTypes(definitions, registry, param.type, imports);
+17 -15
View File
@@ -3,7 +3,6 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { MetadataLatest } from '@polkadot/types/interfaces/metadata';
import { InterfaceTypes } from '@polkadot/types/types';
import fs from 'fs';
import interfaces from '@polkadot/jsonrpc';
@@ -64,20 +63,27 @@ function renderPage (page: Page): string {
}
// index
page.sections.forEach(section => {
page.sections.forEach((section) => {
md += `- **[${stringCamelCase(section.name)}](#${stringCamelCase(section.name).toLowerCase()})**\n\n`;
});
// contents
page.sections.forEach(section => {
md += `\n___\n\n\n## ${section.name}\n`;
if (section.description) { md += `\n_${section.description}_\n`; }
if (section.description) {
md += `\n_${section.description}_\n`;
}
section.items.forEach((item) => {
md += ` \n### ${item.name}`;
Object.keys(item).filter(i => i !== 'name').forEach(bullet => {
md += `\n- **${bullet}**: ${item[bullet] instanceof Vec ? documentationVecToMarkdown(item[bullet] as Vec<Text>, 2) : item[bullet]}`;
md += `\n- **${bullet}**: ${
item[bullet] instanceof Vec
? documentationVecToMarkdown(item[bullet] as Vec<Text>, 2)
: item[bullet]
}`;
});
md += '\n';
@@ -116,8 +122,8 @@ function addRpc (): string {
return {
name: `${methodName}(${args}): ${type}`,
jsonrpc: `${sectionName}_${methodName}`,
interface: `api.rpc.${sectionName}.${methodName}`,
jsonrpc: '`' + `${sectionName}_${methodName}` + '`',
interface: '`' + `api.rpc.${sectionName}.${methodName}` + '`',
...(method.description && { summary: method.description })
};
})
@@ -146,7 +152,7 @@ function addConstants (metadata: MetadataLatest): string {
return {
name: `${methodName}: ` + '`' + func.type + '`',
interface: `api.consts.${sectionName}.${methodName}`,
interface: '`' + `api.consts.${sectionName}.${methodName}` + '`',
...(func.documentation.length && { summary: func.documentation })
};
})
@@ -174,15 +180,11 @@ function addStorage (metadata: MetadataLatest): string {
? ('`' + func.type.asDoubleMap.key1.toString() + ', ' + func.type.asDoubleMap.key2.toString() + '`')
: '';
const methodName = stringLowerFirst(func.name.toString());
let result = unwrapStorageType(func.type);
if (func.modifier.isOptional) {
result = `Option<${result}>` as keyof InterfaceTypes;
}
const outputType = unwrapStorageType(func.type, func.modifier.isOptional);
return {
name: `${methodName}(${arg}): ` + '`' + result + '`',
interface: `api.query.${sectionName}.${methodName}`,
name: `${methodName}(${arg}): ` + '`' + outputType + '`',
interface: '`' + `api.query.${sectionName}.${methodName}` + '`',
...(func.documentation.length && { summary: func.documentation })
};
})
@@ -220,7 +222,7 @@ function addExtrinsics (metadata: MetadataLatest): string {
return {
name: `${methodName}(${args})`,
interface: `api.tx.${sectionName}.${methodName}`,
interface: '`' + `api.tx.${sectionName}.${methodName}` + '`',
...(func.documentation.length && { summary: func.documentation })
};
})
+15
View File
@@ -105,6 +105,14 @@ function formatHashMap (key: string, val: string): string {
return `HashMap<${key}, ${val}>`;
}
/**
* Given the inner `T`, return a `Vec<T>` string
*/
/** @internal */
function formatLinkage (inner: string): string {
return paramsNotation('Linkage', inner);
}
/**
* Given the inner `O` & `E`, return a `Result<O, E>` string
*/
@@ -221,6 +229,13 @@ export function formatType (definitions: object, type: string | TypeDef, imports
return formatHashMap(formatType(definitions, keyDef.type, imports), formatType(definitions, valDef.type, imports));
}
case TypeDefInfo.Linkage: {
const type = (typeDef.sub as TypeDef).type;
setImports(definitions, imports, ['Linkage']);
return formatLinkage(formatType(definitions, type, imports));
}
case TypeDefInfo.Result: {
setImports(definitions, imports, ['Result']);
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.5.1",
"version": "1.6.2",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -27,16 +27,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.8.4",
"@polkadot/metadata": "1.5.1",
"@polkadot/util": "^2.6.1",
"@polkadot/util-crypto": "^2.6.1",
"@polkadot/metadata": "1.6.2",
"@polkadot/util": "^2.6.2",
"@polkadot/util-crypto": "^2.6.2",
"@types/bn.js": "^4.11.6",
"bn.js": "^5.1.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@polkadot/keyring": "^2.6.1",
"@polkadot/keyring": "^2.6.2",
"@types/memoizee": "^0.4.3"
}
}
+3 -1
View File
@@ -156,7 +156,9 @@ export default abstract class AbstractInt extends BN implements Codec {
public toHuman (isExpanded?: boolean): any {
// FIXME we need proper expansion here
return this instanceof this.registry.createClass('Balance')
? formatBalance(this, { decimals: this.registry.chainDecimals, withSi: true, withUnit: this.registry.chainToken })
? this.isMax()
? 'everything'
: formatBalance(this, { decimals: this.registry.chainDecimals, withSi: true, withUnit: this.registry.chainToken })
: formatNumber(this);
}
+1 -1
View File
@@ -117,7 +117,7 @@ export default class Raw extends Uint8Array implements IU8a {
* @description Returns the base runtime type name for this instance
*/
public toRawType (): string {
return '&[u8]';
return 'Raw';
}
/**
+1
View File
@@ -14,6 +14,7 @@ export { default as Compact } from './Compact';
// export { default as Date } from './Date';
export { default as Enum } from './Enum';
export { default as HashMap } from './HashMap';
export { default as Linkage } from './Linkage';
export { default as Option } from './Option';
export { default as Result } from './Result';
export { default as Set } from './Set';
+1 -1
View File
@@ -6,7 +6,7 @@ import { detectPackage } from '@polkadot/util';
// FIXME This really should be `import(...).then(...)`, but need to check rejections
// eslint-disable-next-line @typescript-eslint/no-var-requires
detectPackage(require('./package.json'), __dirname);
detectPackage(require('./package.json'), typeof __dirname !== 'undefined' && __dirname);
export * from './codec';
export * from './create';
@@ -0,0 +1,23 @@
// Copyright 2017-2020 @polkadot/types 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 { TypeRegistry } from '../../create';
describe('Exposure', (): void => {
const registry = new TypeRegistry();
it('properly decodes an Exposure', (): void => {
expect(
registry.createType('Exposure', '0x0fd2c5f6bc904d990f94373671da716d04fe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e0f3e8ec04bb6db2b').toHuman()
).toEqual({
others: [{
value: '12.344k Unit',
who: '5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc'
}],
own: '30.805k Unit',
total: '43.150k Unit'
});
});
});
+5 -3
View File
@@ -43,7 +43,7 @@ const TYPES_MODULES: Record<string, OverrideModuleType> = {
// definition as applicable. (4 keys in substrate vs 5 in Polkadot/CC3).
const TYPES_POLKADOT_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1000, undefined],
minmax: [1000, 1003],
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
@@ -57,14 +57,14 @@ const TYPES_POLKADOT_VERSIONED: OverrideVersionedType[] = [
types: {
// Indices optional, not in transaction
Address: 'AccountId',
Keys: 'SessionKeys5',
StakingLedger: 'StakingLedgerTo223'
Keys: 'SessionKeys5'
}
}
];
const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
{
// 1020 is first CC3
minmax: [1019, 1031],
types: {
Address: 'GenericAddress',
@@ -88,6 +88,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
}
},
{
// actual at 1045 (1043-1044 is dev)
minmax: [1043, 1045],
types: {
Address: 'GenericAddress',
@@ -98,6 +99,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
}
},
{
// actual at 1050 (1046-1049 is dev)
minmax: [1046, undefined],
types: {
// Indices optional, not in transaction
@@ -9,6 +9,7 @@ import rpcDataV5 from '@polkadot/metadata/Metadata/v5/static';
import rpcDataV6 from '@polkadot/metadata/Metadata/v6/static';
import rpcDataV7 from '@polkadot/metadata/Metadata/v7/static';
import rpcDataV8 from '@polkadot/metadata/Metadata/v8/static';
import rpcDataV11 from '@polkadot/metadata/Metadata/v11/static';
import { hexToU8a } from '@polkadot/util';
import { TypeRegistry } from '../create';
@@ -230,4 +231,33 @@ describe('StorageKey', (): void => {
).toEqual(Uint8Array.from([1, 1, 48, 7, 201, 255, 112, 39, 246, 89, 0, 171, 205, 252, 164, 253, 177, 7, 234, 212, 126, 42, 158, 53, 88, 224, 27, 105, 27, 15, 74, 95, 133, 24, 212, 135, 50, 102, 20, 240, 102, 65, 99, 8, 191, 106, 164, 229, 4, 29, 25, 73, 146, 142, 75, 38, 237, 233, 142, 60, 235, 179, 106, 59, 23, 38]));
});
});
describe('with MetadataV11', (): void => {
const metadata = new Metadata(registry, rpcDataV11);
it('should allow decoding of a DoubleMap key', (): void => {
const key = new StorageKey(registry, '0x5f3e4907f716ac89b6347d15ececedca8bde0a0ea8864605e3b68ed9cb2da01b66ccada06515787c10000000e535263148daaf49be5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f');
key.setMeta(metadata.query.staking.erasStakers.meta);
expect(
key.args.map((arg) => arg.toHuman())
).toEqual([
'16',
'5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY'
]);
});
it('should allow decoding of a Map key', (): void => {
const key = new StorageKey(registry, '0x426e15054d267946093858132eb537f191ca57b0c4b20b29ae7e99d6201d680cc906f7710aa165d62c709012f807af8fc3f0d2abb0c51ca9a88d4ef24d1a092bf89dacf5ce63ea1d');
key.setMeta(metadata.query.society.defenderVotes.meta);
expect(
key.args.map((arg) => arg.toHuman())
).toEqual([
'5D4yQHKfqCQYThhHmTfN1JEDi47uyDJc1xg9eZfAG1R7FC7J'
]);
});
});
});
+128 -48
View File
@@ -2,11 +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 { StorageEntryMetadataLatest, StorageEntryTypeLatest } from '../interfaces/metadata';
import { StorageEntryMetadataLatest, StorageEntryTypeLatest, StorageHasher } from '../interfaces/metadata';
import { AnyU8a, Codec, InterfaceTypes, Registry } from '../types';
import { assert, isFunction, isString, isU8a } from '@polkadot/util';
import metadataDefs from '../interfaces/metadata/definitions';
import Bytes from './Bytes';
export interface StorageEntry {
@@ -31,9 +32,18 @@ interface StorageKeyExtra {
section: string;
}
// we unwrap the type here, turning into an output usable for createType
/** @internal */
export function unwrapStorageType (type: StorageEntryTypeLatest): keyof InterfaceTypes {
// order important, matching enum
const HASHER_MAP: Record<keyof typeof metadataDefs.types.StorageHasherV10._enum, [number, boolean]> = {
Blake2_128: [16, false], // eslint-disable-line @typescript-eslint/camelcase
Blake2_256: [32, false], // eslint-disable-line @typescript-eslint/camelcase
Blake2_128Concat: [16, true], // eslint-disable-line @typescript-eslint/camelcase
Twox128: [16, false],
Twox256: [32, false],
Twox64Concat: [8, true]
};
const HASHER_OPTS = Object.values(HASHER_MAP);
function getStorageType (type: StorageEntryTypeLatest): string {
if (type.isPlain) {
return type.asPlain.toString() as keyof InterfaceTypes;
} else if (type.isDoubleMap) {
@@ -46,7 +56,90 @@ export function unwrapStorageType (type: StorageEntryTypeLatest): keyof Interfac
return `(${map.value.toString()}, Linkage<${map.key.toString()}>)` as keyof InterfaceTypes;
}
return map.value.toString() as keyof InterfaceTypes;
return map.value.toString();
}
// we unwrap the type here, turning into an output usable for createType
/** @internal */
export function unwrapStorageType (type: StorageEntryTypeLatest, isOptional?: boolean): keyof InterfaceTypes {
const outputType = getStorageType(type);
return isOptional
? `Option<${outputType}>` as keyof InterfaceTypes
: outputType as keyof InterfaceTypes;
}
/** @internal */
function decodeStorageKey (value?: AnyU8a | StorageKey | StorageEntry | [StorageEntry, any]): Decoded {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (value instanceof StorageKey) {
return {
key: value,
method: value.method,
section: value.section
};
} else if (!value || isString(value) || isU8a(value)) {
// let Bytes handle these inputs
return { key: value };
} else if (isFunction(value)) {
return {
key: value(),
method: value.method,
section: value.section
};
} else if (Array.isArray(value)) {
const [fn, ...arg]: [StorageEntry, ...any[]] = value as any;
assert(isFunction(fn), 'Expected function input for key construction');
return {
key: fn(...arg),
method: fn.method,
section: fn.section
};
}
throw new Error(`Unable to convert input ${value} to StorageKey`);
}
function decodeHashers (registry: Registry, value: Uint8Array, hashers: [StorageHasher, string][]): Codec[] {
// the storage entry is xxhashAsU8a(prefix, 128) + xxhashAsU8a(method, 128), 256 bits total
const encoded = value.subarray(32);
let offset = 0;
return hashers.reduce((result: Codec[], [hasher, type]): Codec[] => {
const [hashLen, canDecode] = HASHER_OPTS[hasher.index];
const decoded = canDecode
? registry.createType(type as 'Raw', encoded.subarray(offset + hashLen))
: registry.createType('Raw', encoded.subarray(offset, offset + hashLen));
offset += hashLen + (canDecode ? decoded.encodedLength : 0);
result.push(decoded);
return result;
}, []);
}
/** @internal */
function decodeArgsFromMeta (registry: Registry, value: Uint8Array, meta?: StorageEntryMetadataLatest): Codec[] {
if (!meta || !(meta.type.isDoubleMap || meta.type.isMap)) {
return [];
}
if (meta.type.isMap) {
const mapInfo = meta.type.asMap;
return decodeHashers(registry, value, [
[mapInfo.hasher, mapInfo.key.toString()]
]);
}
const mapInfo = meta.type.asDoubleMap;
return decodeHashers(registry, value, [
[mapInfo.hasher, mapInfo.key1.toString()],
[mapInfo.key2Hasher, mapInfo.key2.toString()]
]);
}
/**
@@ -56,16 +149,20 @@ export function unwrapStorageType (type: StorageEntryTypeLatest): keyof Interfac
* constructed by passing in a raw key or a StorageEntry with (optional) arguments.
*/
export default class StorageKey extends Bytes {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore This is assigned via this.decodeArgsFromMeta()
private _args: Codec[];
private _meta?: StorageEntryMetadataLatest;
private _method?: string;
private readonly _method?: string;
private _outputType?: string;
private readonly _outputType: string;
private _section?: string;
private readonly _section?: string;
constructor (registry: Registry, value?: AnyU8a | StorageKey | StorageEntry | [StorageEntry, any], override: Partial<StorageKeyExtra> = {}) {
const { key, method, section } = StorageKey.decodeStorageKey(value);
const { key, method, section } = decodeStorageKey(value);
super(registry, key);
@@ -73,38 +170,9 @@ export default class StorageKey extends Bytes {
this._method = override.method || method;
this._outputType = StorageKey.getType(value as StorageKey);
this._section = override.section || section;
}
/** @internal */
public static decodeStorageKey (value?: AnyU8a | StorageKey | StorageEntry | [StorageEntry, any]): Decoded {
if (value instanceof StorageKey) {
return {
key: value,
method: value.method,
section: value.section
};
} else if (!value || isString(value) || isU8a(value)) {
// let Bytes handle these inputs
return { key: value };
} else if (isFunction(value)) {
return {
key: value(),
method: value.method,
section: value.section
};
} else if (Array.isArray(value)) {
const [fn, ...arg]: [StorageEntry, ...any[]] = value as any;
assert(isFunction(fn), 'Expected function input for key construction');
return {
key: fn(...arg),
method: fn.method,
section: fn.section
};
}
throw new Error(`Unable to convert input ${value} to StorageKey`);
// decode the args (as applicable based on the key and the hashers, after all init)
this.decodeArgsFromMeta();
}
public static getMeta (value: StorageKey | StorageEntry | [StorageEntry, any]): StorageEntryMetadataLatest | undefined {
@@ -121,7 +189,7 @@ export default class StorageKey extends Bytes {
return undefined;
}
public static getType (value: StorageKey | StorageEntry | [StorageEntry, any]): string | undefined {
public static getType (value: StorageKey | StorageEntry | [StorageEntry, any]): string {
if (value instanceof StorageKey) {
return value.outputType;
} else if (isFunction(value)) {
@@ -134,7 +202,15 @@ export default class StorageKey extends Bytes {
}
}
return undefined;
// If we have no type set, default to Raw
return 'Raw';
}
/**
* @description Return the decoded arguments (applicable to map/doublemap with decodable values)
*/
public get args (): Codec[] {
return this._args;
}
/**
@@ -152,9 +228,9 @@ export default class StorageKey extends Bytes {
}
/**
* @description The output type, `null` when not available
* @description The output type
*/
public get outputType (): string | undefined {
public get outputType (): string {
return this._outputType;
}
@@ -171,14 +247,18 @@ export default class StorageKey extends Bytes {
public setMeta (meta?: StorageEntryMetadataLatest): this {
this._meta = meta;
return this;
return this.decodeArgsFromMeta();
}
/**
* @description Sets the output type for this storage key
* @description Decode the args embedded in the key (assuming we have decodable hashers)
*/
public setOutputType (outputType?: string): this {
this._outputType = outputType;
public decodeArgsFromMeta (meta?: StorageEntryMetadataLatest): this {
try {
this._args = decodeArgsFromMeta(this.registry, this.toU8a(true), meta || this.meta);
} catch (error) {
// ignore...
}
return this;
}
+249 -128
View File
@@ -83,17 +83,17 @@ __metadata:
languageName: node
linkType: hard
"@babel/core@npm:^7.8.6":
version: 7.8.6
resolution: "@babel/core@npm:7.8.6"
"@babel/core@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/core@npm:7.8.7"
dependencies:
"@babel/code-frame": ^7.8.3
"@babel/generator": ^7.8.6
"@babel/generator": ^7.8.7
"@babel/helpers": ^7.8.4
"@babel/parser": ^7.8.6
"@babel/parser": ^7.8.7
"@babel/template": ^7.8.6
"@babel/traverse": ^7.8.6
"@babel/types": ^7.8.6
"@babel/types": ^7.8.7
convert-source-map: ^1.7.0
debug: ^4.1.0
gensync: ^1.0.0-beta.1
@@ -102,7 +102,7 @@ __metadata:
resolve: ^1.3.2
semver: ^5.4.1
source-map: ^0.5.0
checksum: 2/5bd2d3b0f3948cb0b42dac716dbfa573f3c165c3a5067970e76410eec745126062aecc6540a274aea7c6cdd21c2ad243d4bbe4a99084863ce2f79b0441cc8491
checksum: 2/7f6b1fb2e8c0decfb0d335538d488d15d701b65385fc3dbdca67f377ed32efa8c3794293bbfd29f000c551ef8d7f927e1f6323b76ee8bbb29b90d602c60691da
languageName: node
linkType: hard
@@ -130,6 +130,18 @@ __metadata:
languageName: node
linkType: hard
"@babel/generator@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/generator@npm:7.8.7"
dependencies:
"@babel/types": ^7.8.7
jsesc: ^2.5.1
lodash: ^4.17.13
source-map: ^0.5.0
checksum: 2/903799a224d1502bd1f5a42183f80ff83715d5b7593450209ccb828a2b61b63f2ca2c2ea35dbf7eb77b858f2913f95b52667a1ff64d87238e38b3d6fd5a4f830
languageName: node
linkType: hard
"@babel/helper-annotate-as-pure@npm:^7.0.0, @babel/helper-annotate-as-pure@npm:^7.8.3":
version: 7.8.3
resolution: "@babel/helper-annotate-as-pure@npm:7.8.3"
@@ -170,6 +182,17 @@ __metadata:
languageName: node
linkType: hard
"@babel/helper-call-delegate@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/helper-call-delegate@npm:7.8.7"
dependencies:
"@babel/helper-hoist-variables": ^7.8.3
"@babel/traverse": ^7.8.3
"@babel/types": ^7.8.7
checksum: 2/2af1df59a8eb4c295e9d659a2573d4ccd77f25599089d169dc9adf96d3ca3cde0fb02ab1ed47bb53c455334136e7a8e2b9f78898c0d5dd862b390dbcbe1e6ce5
languageName: node
linkType: hard
"@babel/helper-compilation-targets@npm:^7.8.4":
version: 7.8.4
resolution: "@babel/helper-compilation-targets@npm:7.8.4"
@@ -185,18 +208,18 @@ __metadata:
languageName: node
linkType: hard
"@babel/helper-compilation-targets@npm:^7.8.6":
version: 7.8.6
resolution: "@babel/helper-compilation-targets@npm:7.8.6"
"@babel/helper-compilation-targets@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/helper-compilation-targets@npm:7.8.7"
dependencies:
"@babel/compat-data": ^7.8.6
browserslist: ^4.8.5
browserslist: ^4.9.1
invariant: ^2.2.4
levenary: ^1.1.1
semver: ^5.5.0
peerDependencies:
"@babel/core": ^7.0.0
checksum: 2/2d807ec4063c5d9205945f446e20501641bd57b9325a9da2a8e296ffc7f94224a0f82f0cacefbe1228b69eaae55e013b3188baabe135b2904740d20256097a48
checksum: 2/7761feb66a93ac29a5e4a570ba434b08c85907ebcde1030dd93280258404119c7e10cba57e965cf6380457b5b1bac9061e04b74c3671b147e8c104e9f386bdb4
languageName: node
linkType: hard
@@ -443,6 +466,15 @@ __metadata:
languageName: node
linkType: hard
"@babel/parser@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/parser@npm:7.8.7"
bin:
parser: ./bin/babel-parser.js
checksum: 2/dbcfaa5c4a0da3a30aedf5db5fbcd07a9e29dbe2b4c7551bb09805c7291bf6ad3734093d697756a887dce52e68d59682ee79be5bee9964d533ce619b254c1362
languageName: node
linkType: hard
"@babel/plugin-proposal-async-generator-functions@npm:^7.8.3":
version: 7.8.3
resolution: "@babel/plugin-proposal-async-generator-functions@npm:7.8.3"
@@ -1062,6 +1094,19 @@ __metadata:
languageName: node
linkType: hard
"@babel/plugin-transform-parameters@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/plugin-transform-parameters@npm:7.8.7"
dependencies:
"@babel/helper-call-delegate": ^7.8.7
"@babel/helper-get-function-arity": ^7.8.3
"@babel/helper-plugin-utils": ^7.8.3
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: 2/0dc2d490ab481c80da26ccf8ca27963fbe9760acb2002482c7c1325f4dc1a002ef66aba8ae302796f97013391b1f4c17c935b67e0cc5e8e0c423359e7f7b7098
languageName: node
linkType: hard
"@babel/plugin-transform-property-literals@npm:^7.8.3":
version: 7.8.3
resolution: "@babel/plugin-transform-property-literals@npm:7.8.3"
@@ -1132,6 +1177,17 @@ __metadata:
languageName: node
linkType: hard
"@babel/plugin-transform-regenerator@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/plugin-transform-regenerator@npm:7.8.7"
dependencies:
regenerator-transform: ^0.14.2
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: 2/751116cb63719674a664eb54c1adc80ebc9eb5350eacd5bb4bc962109c30ebc1d4279ab3531903b934afbcfbc708c6a7db8c6ec329f406b9963e1b389352304e
languageName: node
linkType: hard
"@babel/plugin-transform-reserved-words@npm:^7.8.3":
version: 7.8.3
resolution: "@babel/plugin-transform-reserved-words@npm:7.8.3"
@@ -1306,12 +1362,12 @@ __metadata:
languageName: node
linkType: hard
"@babel/preset-env@npm:^7.8.6":
version: 7.8.6
resolution: "@babel/preset-env@npm:7.8.6"
"@babel/preset-env@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/preset-env@npm:7.8.7"
dependencies:
"@babel/compat-data": ^7.8.6
"@babel/helper-compilation-targets": ^7.8.6
"@babel/helper-compilation-targets": ^7.8.7
"@babel/helper-module-imports": ^7.8.3
"@babel/helper-plugin-utils": ^7.8.3
"@babel/plugin-proposal-async-generator-functions": ^7.8.3
@@ -1351,9 +1407,9 @@ __metadata:
"@babel/plugin-transform-named-capturing-groups-regex": ^7.8.3
"@babel/plugin-transform-new-target": ^7.8.3
"@babel/plugin-transform-object-super": ^7.8.3
"@babel/plugin-transform-parameters": ^7.8.4
"@babel/plugin-transform-parameters": ^7.8.7
"@babel/plugin-transform-property-literals": ^7.8.3
"@babel/plugin-transform-regenerator": ^7.8.3
"@babel/plugin-transform-regenerator": ^7.8.7
"@babel/plugin-transform-reserved-words": ^7.8.3
"@babel/plugin-transform-shorthand-properties": ^7.8.3
"@babel/plugin-transform-spread": ^7.8.3
@@ -1361,7 +1417,7 @@ __metadata:
"@babel/plugin-transform-template-literals": ^7.8.3
"@babel/plugin-transform-typeof-symbol": ^7.8.4
"@babel/plugin-transform-unicode-regex": ^7.8.3
"@babel/types": ^7.8.6
"@babel/types": ^7.8.7
browserslist: ^4.8.5
core-js-compat: ^3.6.2
invariant: ^2.2.2
@@ -1369,7 +1425,7 @@ __metadata:
semver: ^5.5.0
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: 2/8d15df527ee1b96c31cb03ae0254429ca55e2cc5ac5fa833f86f2900e02711edb0f8328d707f1b8d61d36e445bfa13845a846c140b612d50d8ad8a88aeca631a
checksum: 2/c4e20509f0de60d6aa93df50698969283b52303d0a132f9cce53391177f8be864a89438fc939d28acc395c36e88a5b4a180ee063980c4dba9fb8cdce18bfc026
languageName: node
linkType: hard
@@ -1430,6 +1486,16 @@ __metadata:
languageName: node
linkType: hard
"@babel/runtime-corejs3@npm:^7.8.3":
version: 7.8.7
resolution: "@babel/runtime-corejs3@npm:7.8.7"
dependencies:
core-js-pure: ^3.0.0
regenerator-runtime: ^0.13.4
checksum: 2/071241602450036d016a47c1ccfe45ab06c456941b14ba3b16d772a362b88903266541d0d7cb9fc66e858e4fa235c538a28d0be0d63c7e67c160be4e0ad549a7
languageName: node
linkType: hard
"@babel/runtime@npm:^7.8.4":
version: 7.8.4
resolution: "@babel/runtime@npm:7.8.4"
@@ -1439,6 +1505,15 @@ __metadata:
languageName: node
linkType: hard
"@babel/runtime@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/runtime@npm:7.8.7"
dependencies:
regenerator-runtime: ^0.13.4
checksum: 2/f7990173bfcbdfd9e00c63c27c887615e6c24dbf03540f8564b25001af838db6cdc5a7fbdcf8eea562a56daff4430177081a7355ebc2d162a9f7456f904bf17e
languageName: node
linkType: hard
"@babel/template@npm:^7.7.4, @babel/template@npm:^7.8.3":
version: 7.8.3
resolution: "@babel/template@npm:7.8.3"
@@ -1517,6 +1592,17 @@ __metadata:
languageName: node
linkType: hard
"@babel/types@npm:^7.8.7":
version: 7.8.7
resolution: "@babel/types@npm:7.8.7"
dependencies:
esutils: ^2.0.2
lodash: ^4.17.13
to-fast-properties: ^2.0.0
checksum: 2/b6401126e3b3ea6c98a4225547a52ccade5747237cd9d62f86b1b9b76598ab0957e698bae46a6159cc5dfa0045fe71d367788ebd325c4a94383574a44781589b
languageName: node
linkType: hard
"@bcoe/v8-coverage@npm:^0.2.3":
version: 0.2.3
resolution: "@bcoe/v8-coverage@npm:0.2.3"
@@ -2756,58 +2842,58 @@ __metadata:
resolution: "@polkadot/api-contract@workspace:packages/api-contract"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/api": 1.5.1
"@polkadot/rpc-core": 1.5.1
"@polkadot/types": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/api": 1.6.2
"@polkadot/rpc-core": 1.6.2
"@polkadot/types": 1.6.2
"@polkadot/util": ^2.6.2
bn.js: ^5.1.1
rxjs: ^6.5.4
languageName: unknown
linkType: soft
"@polkadot/api-derive@1.5.1, @polkadot/api-derive@workspace:packages/api-derive":
"@polkadot/api-derive@1.6.2, @polkadot/api-derive@workspace:packages/api-derive":
version: 0.0.0-use.local
resolution: "@polkadot/api-derive@workspace:packages/api-derive"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/api": 1.5.1
"@polkadot/keyring": ^2.6.1
"@polkadot/rpc-core": 1.5.1
"@polkadot/rpc-provider": 1.5.1
"@polkadot/types": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/util-crypto": ^2.6.1
"@polkadot/api": 1.6.2
"@polkadot/keyring": ^2.6.2
"@polkadot/rpc-core": 1.6.2
"@polkadot/rpc-provider": 1.6.2
"@polkadot/types": 1.6.2
"@polkadot/util": ^2.6.2
"@polkadot/util-crypto": ^2.6.2
bn.js: ^5.1.1
memoizee: ^0.4.14
rxjs: ^6.5.4
languageName: unknown
linkType: soft
"@polkadot/api@1.5.1, @polkadot/api@workspace:packages/api":
"@polkadot/api@1.6.2, @polkadot/api@workspace:packages/api":
version: 0.0.0-use.local
resolution: "@polkadot/api@workspace:packages/api"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/api-derive": 1.5.1
"@polkadot/keyring": ^2.6.1
"@polkadot/metadata": 1.5.1
"@polkadot/rpc-core": 1.5.1
"@polkadot/rpc-provider": 1.5.1
"@polkadot/types": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/util-crypto": ^2.6.1
"@polkadot/api-derive": 1.6.2
"@polkadot/keyring": ^2.6.2
"@polkadot/metadata": 1.6.2
"@polkadot/rpc-core": 1.6.2
"@polkadot/rpc-provider": 1.6.2
"@polkadot/types": 1.6.2
"@polkadot/util": ^2.6.2
"@polkadot/util-crypto": ^2.6.2
bn.js: ^5.1.1
eventemitter3: ^4.0.0
rxjs: ^6.5.4
languageName: unknown
linkType: soft
"@polkadot/dev@npm:^0.50.27":
version: 0.50.27
resolution: "@polkadot/dev@npm:0.50.27"
"@polkadot/dev@npm:^0.50.30":
version: 0.50.30
resolution: "@polkadot/dev@npm:0.50.30"
dependencies:
"@babel/cli": ^7.8.4
"@babel/core": ^7.8.6
"@babel/core": ^7.8.7
"@babel/plugin-proposal-class-properties": ^7.8.3
"@babel/plugin-proposal-decorators": ^7.8.3
"@babel/plugin-proposal-nullish-coalescing-operator": ^7.8.3
@@ -2821,13 +2907,13 @@ __metadata:
"@babel/plugin-syntax-import-meta": ^7.8.3
"@babel/plugin-syntax-top-level-await": ^7.8.3
"@babel/plugin-transform-runtime": ^7.8.3
"@babel/preset-env": ^7.8.6
"@babel/preset-env": ^7.8.7
"@babel/preset-react": ^7.8.3
"@babel/preset-typescript": ^7.8.3
"@babel/register": ^7.8.6
"@babel/runtime": ^7.8.4
"@types/jest": ^25.1.3
"@types/node": ^13.7.7
"@babel/runtime": ^7.8.7
"@types/jest": ^25.1.4
"@types/node": ^13.9.0
"@typescript-eslint/eslint-plugin": 2.22.0
"@typescript-eslint/parser": 2.22.0
"@vue/component-compiler-utils": ^3.1.1
@@ -2846,7 +2932,7 @@ __metadata:
eslint-plugin-import: ^2.20.1
eslint-plugin-node: ^11.0.0
eslint-plugin-promise: ^4.2.1
eslint-plugin-react: ^7.18.3
eslint-plugin-react: ^7.19.0
eslint-plugin-react-hooks: ^2.5.0
eslint-plugin-standard: ^4.0.1
fs-extra: ^8.1.0
@@ -2867,7 +2953,7 @@ __metadata:
vuepress: ^1.3.1
webpack: ^4.42.0
webpack-cli: ^3.3.11
yargs: ^15.2.0
yargs: ^15.3.0
bin:
polkadot-ci-ghact-build: scripts/polkadot-ci-ghact-build.js
polkadot-ci-ghact-docs: scripts/polkadot-ci-ghact-docs.js
@@ -2886,71 +2972,71 @@ __metadata:
polkadot-exec-typedoc: scripts/polkadot-exec-typedoc.js
polkadot-exec-vuepress: scripts/polkadot-exec-vuepress.js
polkadot-exec-webpack: scripts/polkadot-exec-webpack.js
checksum: 2/6198f095e351835d0491d0a9ea881add1e2eacb9b4ea342cf954d476ec11ef97faf54dac032b57f011d7074af2e891806b2c7ed21953e9208781450ae103faba
checksum: 2/4eb99659a5fec5bbdfeb196bfd79c14ecdd629a0cd207bb17ee86a5ef2928b8fb94a0b6cb3e4152e1364343c9bea5eb7e81a841c22aff04ea17d6e59dc2419b3
languageName: node
linkType: hard
"@polkadot/jsonrpc@1.5.1, @polkadot/jsonrpc@workspace:packages/jsonrpc":
"@polkadot/jsonrpc@1.6.2, @polkadot/jsonrpc@workspace:packages/jsonrpc":
version: 0.0.0-use.local
resolution: "@polkadot/jsonrpc@workspace:packages/jsonrpc"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/types": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/types": 1.6.2
"@polkadot/util": ^2.6.2
languageName: unknown
linkType: soft
"@polkadot/keyring@npm:^2.6.1":
version: 2.6.1
resolution: "@polkadot/keyring@npm:2.6.1"
"@polkadot/keyring@npm:^2.6.2":
version: 2.6.2
resolution: "@polkadot/keyring@npm:2.6.2"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/util": 2.6.1
"@polkadot/util-crypto": 2.6.1
checksum: 2/79b3d8f8842c153ff5cf39206ecabb4b5c61c6d5fc118da4c26e8a83ecb90fcc307c77c9d272248ede24890141d1235ff3a4ce94b2a18f3f780f59848ca2f115
"@babel/runtime": ^7.8.7
"@polkadot/util": 2.6.2
"@polkadot/util-crypto": 2.6.2
checksum: 2/72268d4b89c3e98ae76abb6fa5278edc23469b7d31e5f3fe78572e5b59e54e9e8f84cd18d5bb752bf0b3e8a78906f6bb80bc017a52da1c402e38b440e718c6d8
languageName: node
linkType: hard
"@polkadot/metadata@1.5.1, @polkadot/metadata@workspace:packages/metadata":
"@polkadot/metadata@1.6.2, @polkadot/metadata@workspace:packages/metadata":
version: 0.0.0-use.local
resolution: "@polkadot/metadata@workspace:packages/metadata"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/keyring": ^2.6.1
"@polkadot/types": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/util-crypto": ^2.6.1
"@polkadot/keyring": ^2.6.2
"@polkadot/types": 1.6.2
"@polkadot/util": ^2.6.2
"@polkadot/util-crypto": ^2.6.2
bn.js: ^5.1.1
languageName: unknown
linkType: soft
"@polkadot/rpc-core@1.5.1, @polkadot/rpc-core@workspace:packages/rpc-core":
"@polkadot/rpc-core@1.6.2, @polkadot/rpc-core@workspace:packages/rpc-core":
version: 0.0.0-use.local
resolution: "@polkadot/rpc-core@workspace:packages/rpc-core"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/jsonrpc": 1.5.1
"@polkadot/keyring": ^2.6.1
"@polkadot/metadata": 1.5.1
"@polkadot/rpc-provider": 1.5.1
"@polkadot/types": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/jsonrpc": 1.6.2
"@polkadot/keyring": ^2.6.2
"@polkadot/metadata": 1.6.2
"@polkadot/rpc-provider": 1.6.2
"@polkadot/types": 1.6.2
"@polkadot/util": ^2.6.2
memoizee: ^0.4.14
rxjs: ^6.5.4
languageName: unknown
linkType: soft
"@polkadot/rpc-provider@1.5.1, @polkadot/rpc-provider@workspace:packages/rpc-provider":
"@polkadot/rpc-provider@1.6.2, @polkadot/rpc-provider@workspace:packages/rpc-provider":
version: 0.0.0-use.local
resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/jsonrpc": 1.5.1
"@polkadot/keyring": ^2.6.1
"@polkadot/metadata": 1.5.1
"@polkadot/types": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/util-crypto": ^2.6.1
"@polkadot/jsonrpc": 1.6.2
"@polkadot/keyring": ^2.6.2
"@polkadot/metadata": 1.6.2
"@polkadot/types": 1.6.2
"@polkadot/util": ^2.6.2
"@polkadot/util-crypto": ^2.6.2
bn.js: ^5.1.1
eventemitter3: ^4.0.0
isomorphic-fetch: ^2.2.1
@@ -2976,12 +3062,12 @@ __metadata:
"@babel/core": ^7.8.3
"@babel/register": ^7.8.3
"@babel/runtime": ^7.8.4
"@polkadot/api": 1.5.1
"@polkadot/jsonrpc": 1.5.1
"@polkadot/metadata": 1.5.1
"@polkadot/rpc-provider": 1.5.1
"@polkadot/types": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/api": 1.6.2
"@polkadot/jsonrpc": 1.6.2
"@polkadot/metadata": 1.6.2
"@polkadot/rpc-provider": 1.6.2
"@polkadot/types": 1.6.2
"@polkadot/util": ^2.6.2
"@types/websocket": ^1.0.0
"@types/yargs": ^15.0.3
websocket: ^1.0.31
@@ -2995,15 +3081,15 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/types@1.5.1, @polkadot/types@workspace:packages/types":
"@polkadot/types@1.6.2, @polkadot/types@workspace:packages/types":
version: 0.0.0-use.local
resolution: "@polkadot/types@workspace:packages/types"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/keyring": ^2.6.1
"@polkadot/metadata": 1.5.1
"@polkadot/util": ^2.6.1
"@polkadot/util-crypto": ^2.6.1
"@polkadot/keyring": ^2.6.2
"@polkadot/metadata": 1.6.2
"@polkadot/util": ^2.6.2
"@polkadot/util-crypto": ^2.6.2
"@types/bn.js": ^4.11.6
"@types/memoizee": ^0.4.3
bn.js: ^5.1.1
@@ -3012,12 +3098,12 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/util-crypto@npm:2.6.1, @polkadot/util-crypto@npm:^2.6.1":
version: 2.6.1
resolution: "@polkadot/util-crypto@npm:2.6.1"
"@polkadot/util-crypto@npm:2.6.2, @polkadot/util-crypto@npm:^2.6.2":
version: 2.6.2
resolution: "@polkadot/util-crypto@npm:2.6.2"
dependencies:
"@babel/runtime": ^7.8.4
"@polkadot/util": 2.6.1
"@babel/runtime": ^7.8.7
"@polkadot/util": 2.6.2
"@polkadot/wasm-crypto": ^1.2.1
base-x: ^3.0.8
bip39: ^3.0.2
@@ -3029,21 +3115,21 @@ __metadata:
pbkdf2: ^3.0.17
tweetnacl: ^1.0.3
xxhashjs: ^0.2.2
checksum: 2/fc7030b34a574736f862e91932b8bfe46af61766b1495e132911a0dcda95905975a94474882d201123e07ca93d4d5c7fdd8017f0e5f4c1d9cdab606b8f8c014b
checksum: 2/39b0ac8298dae87412574ecfd0ed65bb5c5fc51f34570fde3d02bad9cce0be5abf35f584e620f8047e0639efdbea0473767b2f00d97fa585dbedd2347e9464d9
languageName: node
linkType: hard
"@polkadot/util@npm:2.6.1, @polkadot/util@npm:^2.6.1":
version: 2.6.1
resolution: "@polkadot/util@npm:2.6.1"
"@polkadot/util@npm:2.6.2, @polkadot/util@npm:^2.6.2":
version: 2.6.2
resolution: "@polkadot/util@npm:2.6.2"
dependencies:
"@babel/runtime": ^7.8.4
"@babel/runtime": ^7.8.7
"@types/bn.js": ^4.11.6
bn.js: ^5.1.1
camelcase: ^5.3.1
chalk: ^3.0.0
ip-regex: ^4.1.0
checksum: 2/92f412fee89b8c400e6f1ecab934304715b1e4b20bfb3d28964225e570c17a95383fde594f10f87780ab11c3826839d94f95ef6e2afa2fc91d4416ec98d53289
checksum: 2/cfa7e60c6f23775c20d40e05645e5504cb24b703410d0a06a5d8e6283b1d1987693aabc3c05a3318f83b8d66e18e9efdb6d1d3a0baca0a2aa27ca30ed2bf88ec
languageName: node
linkType: hard
@@ -3221,13 +3307,13 @@ __metadata:
languageName: node
linkType: hard
"@types/jest@npm:^25.1.3":
version: 25.1.3
resolution: "@types/jest@npm:25.1.3"
"@types/jest@npm:^25.1.4":
version: 25.1.4
resolution: "@types/jest@npm:25.1.4"
dependencies:
jest-diff: ^25.1.0
pretty-format: ^25.1.0
checksum: 2/3332df7e45a28cb388d0f143d02bb2e64744c2333904582bd8759e880c9fb9dd907895fa234bb6a4d96bf9c79ba71721dc4fd9dfb2f7b731d7ea36232f90885b
checksum: 2/1a60d1c9a3a964f08732bd46735fda513a4b4743554fbd3b7aa63f39e47a80353d0967cd138db412b3008cca6c4fe82e60f90f2bb272c0750069966d694f3177
languageName: node
linkType: hard
@@ -3266,10 +3352,10 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:^13.7.7":
version: 13.7.7
resolution: "@types/node@npm:13.7.7"
checksum: 2/7a4a7c5060f86b6f4010d10b0de9831f98f303513a7403e8bfb3ad3f1d6a9533d023e1b6e2331959525156b84c0daf98ad1569407309da1f798498301f227a37
"@types/node@npm:^13.9.0":
version: 13.9.0
resolution: "@types/node@npm:13.9.0"
checksum: 2/54c040abe4765c9be0e50e0aa5f9fb7d7bff67e1ff98d2c2587df14239a965e6543be2c3321ed81a946d400b9ec47d4f8304648f6eb6c0617a523697e8cb2d20
languageName: node
linkType: hard
@@ -6150,6 +6236,13 @@ __metadata:
languageName: node
linkType: hard
"core-js-pure@npm:^3.0.0":
version: 3.6.4
resolution: "core-js-pure@npm:3.6.4"
checksum: 2/23273f04eaa0dae33c9b9f07856c9b01a5dd00d4ef16d5e048eb403bf3a055f06c8a891ddaf0df4cacebaf0b398c958605ea294f47eb24d988a735656a4b11a0
languageName: node
linkType: hard
"core-js@npm:^2.4.0":
version: 2.6.11
resolution: "core-js@npm:2.6.11"
@@ -7699,9 +7792,9 @@ __metadata:
languageName: node
linkType: hard
"eslint-plugin-react@npm:^7.18.3":
version: 7.18.3
resolution: "eslint-plugin-react@npm:7.18.3"
"eslint-plugin-react@npm:^7.19.0":
version: 7.19.0
resolution: "eslint-plugin-react@npm:7.19.0"
dependencies:
array-includes: ^3.1.1
doctrine: ^2.1.0
@@ -7711,11 +7804,13 @@ __metadata:
object.fromentries: ^2.0.2
object.values: ^1.1.1
prop-types: ^15.7.2
resolve: ^1.14.2
resolve: ^1.15.1
semver: ^6.3.0
string.prototype.matchall: ^4.0.2
xregexp: ^4.3.0
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0
checksum: 2/7d775db2d6640b5b593e581fdbb10c357d27258cda50451370b0dc5f43056e1e64bb9022ae6f19d97eec5eae1a85b491c1456886b6829d6066e01fb9e31ffb11
checksum: 2/3e5b7bd3b2ea663716fd2518efd1eed359712711a3c0284ed04e5955e6b7019151d8b54dddad2a9116a54e251dd180bf5ba0ccf34a80ffbe8f4d535a0d03e6b3
languageName: node
linkType: hard
@@ -14541,7 +14636,7 @@ fsevents@^2.1.2:
languageName: node
linkType: hard
"private@npm:^0.1.6":
"private@npm:^0.1.6, private@npm:^0.1.8":
version: 0.1.8
resolution: "private@npm:0.1.8"
checksum: 2/4507890e0e59e27909b714e52d6e8de7e06c83c731721e8c974117bfa96c720173c2aeff048022a0ba5faefa8a354f15120fb4088729b1241fc22e78f3a25912
@@ -15138,6 +15233,13 @@ fsevents@^2.1.2:
languageName: node
linkType: hard
"regenerator-runtime@npm:^0.13.4":
version: 0.13.4
resolution: "regenerator-runtime@npm:0.13.4"
checksum: 2/d6165e7ba67f28f813a28fc07aa0c771ae8df913a3277c0aa837957d72debc4f1df4f53a6e98636c1cc87c6ba643ce8c522eb36542bbc4234c645af9d992c7c2
languageName: node
linkType: hard
"regenerator-transform@npm:^0.14.0":
version: 0.14.1
resolution: "regenerator-transform@npm:0.14.1"
@@ -15147,6 +15249,16 @@ fsevents@^2.1.2:
languageName: node
linkType: hard
"regenerator-transform@npm:^0.14.2":
version: 0.14.2
resolution: "regenerator-transform@npm:0.14.2"
dependencies:
"@babel/runtime": ^7.8.4
private: ^0.1.8
checksum: 2/c0d2768e20b0da61fcf8d9fcb7b3b1da4a2220668f938463b5f968e47e17030135f1f8334c4ee9902b361ba0c940d1e69d0d491dd16c9f30641867801120faac
languageName: node
linkType: hard
"regex-cache@npm:^0.4.2":
version: 0.4.4
resolution: "regex-cache@npm:0.4.4"
@@ -15468,7 +15580,7 @@ resolve@1.1.7:
languageName: node
linkType: hard
"resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.8.1":
"resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.8.1, resolve@npm:^1.15.1":
version: 1.15.1
resolution: "resolve@npm:1.15.1"
dependencies:
@@ -15591,7 +15703,7 @@ resolve@1.1.7:
"@babel/core": ^7.8.4
"@babel/register": ^7.8.3
"@babel/runtime": ^7.8.4
"@polkadot/dev": ^0.50.27
"@polkadot/dev": ^0.50.30
"@polkadot/ts": ^0.3.7
"@polkadot/typegen": "workspace:packages/typegen"
copyfiles: ^2.2.0
@@ -18616,6 +18728,15 @@ resolve@1.1.7:
languageName: node
linkType: hard
"xregexp@npm:^4.3.0":
version: 4.3.0
resolution: "xregexp@npm:4.3.0"
dependencies:
"@babel/runtime-corejs3": ^7.8.3
checksum: 2/2dcef4888ea32e7c01b8f42d1ee3df24970de14b299a8f534ccecf2252d297092f92d037502176ec334b6c8d7cd1dd3dba0d3cf949e26f418d50b46846268839
languageName: node
linkType: hard
"xtend@npm:^4.0.0, xtend@npm:~4.0.1":
version: 4.0.2
resolution: "xtend@npm:4.0.2"
@@ -18709,13 +18830,13 @@ resolve@1.1.7:
languageName: node
linkType: hard
"yargs-parser@npm:^17.1.0":
version: 17.1.0
resolution: "yargs-parser@npm:17.1.0"
"yargs-parser@npm:^18.1.0":
version: 18.1.0
resolution: "yargs-parser@npm:18.1.0"
dependencies:
camelcase: ^5.0.0
decamelize: ^1.2.0
checksum: 2/8e5cc4b16b9558b2cba63b45e574dd72680f44c064623bacfc1fa9805d4f7b9a2008cd261de6b8d78f6cedb1597e5d81728828714e3b5ec897eb1854e31eb0b8
checksum: 2/7997373a42b8512628787b52371b1e1f635c20f7b6273c217d8b4a1befa9778573279c702612ebcf4c05fae3846bf11d440f05fef7f09ebd5e45e0539a31544a
languageName: node
linkType: hard
@@ -18814,9 +18935,9 @@ resolve@1.1.7:
languageName: node
linkType: hard
"yargs@npm:^15.2.0":
version: 15.2.0
resolution: "yargs@npm:15.2.0"
"yargs@npm:^15.3.0":
version: 15.3.0
resolution: "yargs@npm:15.3.0"
dependencies:
cliui: ^6.0.0
decamelize: ^1.2.0
@@ -18828,8 +18949,8 @@ resolve@1.1.7:
string-width: ^4.2.0
which-module: ^2.0.0
y18n: ^4.0.0
yargs-parser: ^17.1.0
checksum: 2/809333561040bc4e7b752289098b652a0deb101c3903000d5cf198d6699c350bd4934baba440e707a784dcfaf0e72342c5bf28440e72626fe033b6b9efb03778
yargs-parser: ^18.1.0
checksum: 2/4fdf0dfa72c6e1db152e435040c53ab7acbb9e9b24b6c977f019eea0dce14075a9db949bb4b565e30c9a0acae9ac4b16f549ccea9bee594bb32ae1fc25f49996
languageName: node
linkType: hard