Compare commits

...
24 Commits
Author SHA1 Message Date
Github Actions 97cb408f36 [CI Skip] 1.15.1
skip-checks: true
2020-05-23 09:35:31 +00:00
Jaco Greeff dde7c8085a 1.15 (#2301) 2020-05-23 11:26:05 +02:00
Github Actions 8b02fafb99 [CI Skip] 1.15.0-beta.9
skip-checks: true
2020-05-23 09:05:12 +00:00
Jaco Greeff 393f46ba4a Bump metadata (#2300) 2020-05-23 10:54:28 +02:00
455f5ad834 Allow keyPrefix to accept an additional argument for double maps (#2230)
* Allow keyPrefix to accept an additional argument for double maps

* Make key creators accept an optional parameter for key construction

* Remove .only from a test case

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>

* Cache prefix key when no arguments are supplied

* Address review comments

* Update packages/metadata/src/Decorated/storage/fromMetadata/createFunction.spec.ts

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-05-23 10:51:38 +02:00
Github Actions 674324e7f9 [CI Skip] 1.15.0-beta.8
skip-checks: true
2020-05-21 09:08:13 +00:00
Jaco Greeff b0dc7cf451 Bump metadata (#2297)
* Bump metadata

* Deps

* Regen

* Update sig for new signed extensions
2020-05-21 10:56:56 +02:00
Github Actions cbe1b2b1ce [CI Skip] 1.15.0-beta.7
skip-checks: true
2020-05-20 22:08:39 +00:00
Dan Forbes 4bd2f2fc32 Add WeightToFeeCoefficient type (#2296)
Added to support paritytech/substrate#6076
2020-05-20 23:56:04 +02:00
Github Actions 053112470d [CI Skip] 1.15.0-beta.6
skip-checks: true
2020-05-19 14:38:35 +00:00
Joshy Orndorff acdf27a272 spelling; efect -> effect (#2295) 2020-05-19 16:15:58 +02:00
Github Actions f70b32ba76 [CI Skip] 1.15.0-beta.5
skip-checks: true
2020-05-19 08:41:46 +00:00
Jaco Greeff 67a3376ef8 POC for a rough derive cache (#2293)
* POC for a rough derive cache

* With expiry

* Cache cleanups

* Memory cache

* Small cleanups
2020-05-19 10:29:40 +02:00
Github Actions eb06bb6e93 [CI Skip] 1.15.0-beta.4
skip-checks: true
2020-05-19 05:42:16 +00:00
Paweł Nguyen f8f7e92da4 Fix a minor typo in cookbook blocks docs (#2294) 2020-05-19 07:29:27 +02:00
Github Actions d0fd3eca25 [CI Skip] 1.15.0-beta.3
skip-checks: true
2020-05-18 08:32:29 +00:00
Jaco Greeff dac1df35de stakerRewards filters, re-org (#2292) 2020-05-18 10:20:09 +02:00
Github Actions 597563d2bb [CI Skip] 1.15.0-beta.2
skip-checks: true
2020-05-16 12:04:58 +00:00
Jaco Greeff f825c7f187 Fixed128 -> Fixed64 in old versions 2020-05-16 13:54:36 +02:00
Jaco Greeff 2e71a6160e Multiplier -> Fixed128 (#2290) 2020-05-16 13:52:56 +02:00
Github Actions c076c37119 [CI Skip] 1.15.0-beta.1
skip-checks: true
2020-05-16 06:49:21 +00:00
Amaury Martiny 0e18fdbccc Add transactionVersion to ExtrinsicPayload (#2287) 2020-05-16 08:37:29 +02:00
Github Actions c3eebd8fbe [CI Skip] 1.15.0-beta.0
skip-checks: true
2020-05-15 11:46:27 +00:00
Jaco Greeff 45786b31da Bump deps (#2286)
* Bump deps

* Linting cleanups
2020-05-15 13:35:15 +02:00
75 changed files with 2541 additions and 878 deletions
+12
View File
@@ -1,3 +1,15 @@
# 1.15.1 May 23, 2020
- Adjust `keyPrefix()` with DoubleMap args (Thanks to https://github.com/KiChjang)
- Added `WeightToFeeCoefficient` type (Thanks to https://github.com/danforbes)
- Spelling fixes for console logs (Thanks to https://github.com/JoshOrndorff)
- Spelling fixes in cookbook (Thanks to https://github.com/pawelnguyen)
- Add `transactionVersion` getter in payloads (Thanks to https://github.com/amaurymartiny)
- Adjust `stakerRewards` derive ordering for improved on-payout refreshes
- Baseline implementation for derive caching infrastructure
- Adjust `Multiplier` type to `Fixed128` (as per latest Substrate)
- Updated to latest Substrate metadata & add new types
# 1.14.1 May 14, 2020
- **Important** `DispatchInfo` changed `paysFee` to an enum, if using an older version use, `DispatchInfo: 'DispatchInfoTo244'`
+1 -1
View File
@@ -25,7 +25,7 @@ signedBlock.block.extrinsics.forEach((ex, index) => {
## How do I extract the block author?
Th block author is encoded inside the consensus logs for the block. To extract, you need to decode the log (which the API does do) and then map the index of the validator to the list of session validators. This extraction is however available on the api derive for new head subscriptions, which returns an extended header with the author populated (assuming that the digest logs are known).
The block author is encoded inside the consensus logs for the block. To extract, you need to decode the log (which the API does do) and then map the index of the validator to the list of session validators. This extraction is however available on the api derive for new head subscriptions, which returns an extended header with the author populated (assuming that the digest logs are known).
```js
// subscribe to all new headers (with extended info)
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.14.1"
"version": "1.15.1"
}
+5 -5
View File
@@ -7,7 +7,7 @@
"packages/*"
],
"resolutions": {
"typescript": "^3.8.3"
"babel-core": "^7.0.0-bridge.0"
},
"scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts && (cd packages/typegen && copyfiles scripts/* build)",
@@ -27,11 +27,11 @@
"@babel/core": "^7.9.6",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.6",
"@polkadot/dev": "^0.52.19",
"@polkadot/ts": "^0.3.21",
"@polkadot/dev": "^0.53.5",
"@polkadot/ts": "^0.3.22",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^25.2.1",
"@vuepress/plugin-search": "^1.4.1",
"@types/jest": "^25.2.3",
"@vuepress/plugin-search": "^1.5.0",
"copyfiles": "^2.2.0"
}
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.14.1",
"version": "1.15.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -27,11 +27,11 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/api": "1.14.1",
"@polkadot/rpc-core": "1.14.1",
"@polkadot/types": "1.14.1",
"@polkadot/api": "1.15.1",
"@polkadot/rpc-core": "1.15.1",
"@polkadot/types": "1.15.1",
"@polkadot/util": "^2.10.1",
"bn.js": "^5.1.1",
"bn.js": "^5.1.2",
"rxjs": "^6.5.5"
}
}
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.14.1",
"version": "1.15.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -28,13 +28,13 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/api": "1.14.1",
"@polkadot/rpc-core": "1.14.1",
"@polkadot/rpc-provider": "1.14.1",
"@polkadot/types": "1.14.1",
"@polkadot/api": "1.15.1",
"@polkadot/rpc-core": "1.15.1",
"@polkadot/rpc-provider": "1.15.1",
"@polkadot/types": "1.15.1",
"@polkadot/util": "^2.10.1",
"@polkadot/util-crypto": "^2.10.1",
"bn.js": "^5.1.1",
"bn.js": "^5.1.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
},
@@ -10,6 +10,7 @@ import { map, startWith } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { Option, Vec } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -51,7 +52,7 @@ function query (api: ApiInterfaceRx, accountIndex: AccountIndex | string): Obser
export function indexToId (api: ApiInterfaceRx): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined> {
return memo((accountIndex: AccountIndex | string): Observable<AccountId | undefined> =>
api.query.indices
? api.query.indices.accounts
? isFunction(api.query.indices.accounts)
? query(api, accountIndex)
: queryEnumSet(api, accountIndex)
: of(undefined)
+2 -1
View File
@@ -10,6 +10,7 @@ import { Observable, of } from 'rxjs';
import { map, startWith, switchMap } from 'rxjs/operators';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { Vec } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -72,7 +73,7 @@ function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
export function indexes (api: ApiInterfaceRx): () => Observable<AccountIndexes> {
return memo((): Observable<AccountIndexes> =>
(api.query.indices
? api.query.indices.accounts
? isFunction(api.query.indices.accounts)
? queryAccounts(api)
: queryEnumSet(api)
: of({} as AccountIndexes)
+3 -2
View File
@@ -9,6 +9,7 @@ import { DeriveBalancesAccount } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -86,9 +87,9 @@ export function account (api: ApiInterfaceRx): (address: AccountIndex | AccountI
(accountId
? combineLatest([
of(accountId),
api.query.system.account
isFunction(api.query.system.account)
? queryCurrent(api, accountId)
: api.query.balances.account
: isFunction(api.query.balances.account)
? queryBalancesAccount(api, accountId)
: queryBalancesFree(api, accountId)
])
+2 -2
View File
@@ -10,7 +10,7 @@ import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Option, Vec } from '@polkadot/types';
import { bnMax } from '@polkadot/util';
import { bnMax, isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -135,7 +135,7 @@ export function all (api: ApiInterfaceRx): (address: AccountIndex | AccountId |
? combineLatest([
of(account),
api.derive.chain.bestNumber(),
api.query.balances.account
isFunction(api.query.balances.account)
? queryCurrent(api, account.accountId)
: queryOld(api, account.accountId)
])
+3 -3
View File
@@ -28,12 +28,12 @@ export function fees (api: ApiInterfaceRx): () => Observable<DeriveFees> {
return memo((): Observable<DeriveFees> =>
of([
// deprecated - remove
(api.consts.balances?.creationFee as Balance) || api.registry.createType('Balance'),
(api.consts.balances?.transferFee as Balance) || api.registry.createType('Balance'),
(api.consts.balances?.creationFee as unknown as Balance) || api.registry.createType('Balance'),
(api.consts.balances?.transferFee as unknown as Balance) || api.registry.createType('Balance'),
// current
(api.consts.balances?.existentialDeposit as Balance) || api.registry.createType('Balance'),
(api.consts.transactionPayment?.transactionBaseFee as Balance) || api.registry.createType('Balance'),
(api.consts.transactionPayment?.transactionBaseFee as unknown as Balance) || api.registry.createType('Balance'),
(api.consts.transactionPayment?.transactionByteFee as Balance) || api.registry.createType('Balance')
]).pipe(
map(([creationFee, transferFee, existentialDeposit, transactionBaseFee, transactionByteFee]): DeriveFees => ({
@@ -9,6 +9,7 @@ import { DeriveCollectiveProposal } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -30,7 +31,7 @@ function parse ([hashes, proposals, votes]: Result): DeriveCollectiveProposal[]
export function proposals (api: ApiInterfaceRx, section: 'council' | 'technicalCommittee'): () => Observable<DeriveCollectiveProposal[]> {
return memo((): Observable<DeriveCollectiveProposal[]> =>
api.query[section]?.proposals
isFunction(api.query[section]?.proposals)
? api.query[section].proposals().pipe(
switchMap((hashes: Hash[]): Observable<Result> =>
hashes.length
@@ -10,7 +10,7 @@ import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Option, Vec, u64 } from '@polkadot/types';
import { stringToHex } from '@polkadot/util';
import { isFunction, stringToHex } from '@polkadot/util';
import { memo } from '../util';
@@ -96,7 +96,7 @@ function queryScheduler (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
export function dispatchQueue (api: ApiInterfaceRx): () => Observable<DeriveDispatch[]> {
return memo((): Observable<DeriveDispatch[]> =>
api.query.scheduler?.agenda
isFunction(api.query.scheduler?.agenda)
? queryScheduler(api)
: api.query.democracy.dispatchQueue
? queryQueue(api)
@@ -10,6 +10,7 @@ import BN from 'bn.js';
import { Observable, of, combineLatest } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option, Vec } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { calcVotes, getStatus, parseImage } from './util';
@@ -95,7 +96,7 @@ export function _referendumVotes (api: ApiInterfaceRx): (referendum: DeriveRefer
return memo((referendum: DeriveReferendum): Observable<DeriveReferendumVotes> =>
combineLatest([
api.derive.democracy.sqrtElectorate(),
api.query.democracy.votingOf
isFunction(api.query.democracy.votingOf)
? votesCurr(api, referendum.index)
: votesPrev(api, referendum.index)
]).pipe(
+2 -1
View File
@@ -9,6 +9,7 @@ import { DeriveSessionIndexes } from '../types';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { Option, u32 } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -79,7 +80,7 @@ export function indexes (api: ApiInterfaceRx): () => Observable<DeriveSessionInd
return memo((): Observable<DeriveSessionIndexes> =>
(
api.query.session && api.query.staking
? api.query.staking.activeEra
? isFunction(api.query.staking.activeEra)
? query(api)
: queryNoActive(api)
: empty(api)
+5 -3
View File
@@ -9,6 +9,7 @@ import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Option, u64 } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -77,9 +78,10 @@ function queryBabeNoHistory (api: ApiInterfaceRx): Observable<[DeriveSessionInfo
export function progress (api: ApiInterfaceRx): () => Observable<DeriveSessionProgress> {
return memo((): Observable<DeriveSessionProgress> =>
api.consts.babe
? (api.query.staking.erasStartSessionIndex
? queryBabe(api) // 2.x with Babe
: queryBabeNoHistory(api)
? (
isFunction(api.query.staking.erasStartSessionIndex)
? queryBabe(api) // 2.x with Babe
: queryBabeNoHistory(api)
).pipe(
map(([info, slots]: [DeriveSessionInfo, ResultSlotsFlat]): DeriveSessionProgress =>
createDerive(api, info, slots)
@@ -10,10 +10,12 @@ import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { StorageKey } from '@polkadot/types';
import { memo } from '../util';
import { deriveCache, memo } from '../util';
type KeysAndExposures = [StorageKey, Exposure][];
const CACHE_KEY = 'eraExposure';
function mapStakers (era: EraIndex, stakers: KeysAndExposures): DeriveEraExposure {
const nominators: DeriveEraNominatorExposure = {};
const validators: DeriveEraValidatorExposure = {};
@@ -34,26 +36,45 @@ function mapStakers (era: EraIndex, stakers: KeysAndExposures): DeriveEraExposur
return { era, nominators, validators };
}
export function _eraExposure (api: ApiInterfaceRx): (era: EraIndex, withActive: boolean) => Observable<DeriveEraExposure> {
return memo((era: EraIndex, withActive: boolean): Observable<DeriveEraExposure> => {
const cacheKey = `${CACHE_KEY}-${era}`;
const cached = withActive
? undefined
: deriveCache.get<DeriveEraExposure>(cacheKey);
return cached
? of(cached)
: api.query.staking.erasStakersClipped.entries(era).pipe(
map((stakers): DeriveEraExposure => {
const value = mapStakers(era, stakers);
!withActive && deriveCache.set(cacheKey, value);
return value;
})
);
});
}
export function eraExposure (api: ApiInterfaceRx): (era: EraIndex) => Observable<DeriveEraExposure> {
return memo((era: EraIndex): Observable<DeriveEraExposure> =>
api.query.staking.erasStakersClipped.entries(era).pipe(
map((stakers) => mapStakers(era, stakers))
)
api.derive.staking._eraExposure(era, true)
);
}
export function _erasExposure (api: ApiInterfaceRx): (eras: EraIndex[]) => Observable<DeriveEraExposure[]> {
return memo((eras: EraIndex[]): Observable<DeriveEraExposure[]> =>
export function _erasExposure (api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraExposure[]> {
return memo((eras: EraIndex[], withActive: boolean): Observable<DeriveEraExposure[]> =>
eras.length
? combineLatest(eras.map((era) => api.derive.staking.eraExposure(era)))
? combineLatest(eras.map((era) => api.derive.staking._eraExposure(era, withActive)))
: of([])
);
}
export function erasExposure (api: ApiInterfaceRx): (withActive?: boolean) => Observable<DeriveEraExposure[]> {
return memo((withActive?: boolean): Observable<DeriveEraExposure[]> =>
return memo((withActive = false): Observable<DeriveEraExposure[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._erasExposure(eras))
switchMap((eras) => api.derive.staking._erasExposure(eras, withActive))
)
);
}
+41 -17
View File
@@ -9,7 +9,9 @@ import { DeriveEraPoints, DeriveEraValPoints } from '../types';
import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { memo } from '../util';
import { deriveCache, memo } from '../util';
const CACHE_KEY = 'eraPoints';
function mapValidators ({ individual }: EraRewardPoints): DeriveEraValPoints {
return [...individual.entries()]
@@ -21,26 +23,48 @@ function mapValidators ({ individual }: EraRewardPoints): DeriveEraValPoints {
}, {});
}
export function _erasPoints (api: ApiInterfaceRx): (eras: EraIndex[]) => Observable<DeriveEraPoints[]> {
return memo((eras: EraIndex[]): Observable<DeriveEraPoints[]> =>
eras.length
? api.query.staking.erasRewardPoints.multi<EraRewardPoints>(eras).pipe(
map((points) =>
eras.map((era, index): DeriveEraPoints => ({
era,
eraPoints: points[index].total,
validators: mapValidators(points[index])
}))
)
)
: of([])
);
function mapPoints (eras: EraIndex[], points: EraRewardPoints[]): DeriveEraPoints[] {
return eras.map((era, index): DeriveEraPoints => ({
era,
eraPoints: points[index].total,
validators: mapValidators(points[index])
}));
}
export function _erasPoints (api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraPoints[]> {
return memo((eras: EraIndex[], withActive: boolean): Observable<DeriveEraPoints[]> => {
if (!eras.length) {
return of([]);
}
const cached: DeriveEraPoints[] = withActive
? []
: eras
.map((era) => deriveCache.get(`${CACHE_KEY}-${era}`))
.filter((value): value is DeriveEraPoints => !!value);
const remaining = eras.filter((era) => !cached.some((cached) => era.eq(cached.era)));
return !remaining.length
? of(cached)
: api.query.staking.erasRewardPoints.multi<EraRewardPoints>(remaining).pipe(
map((points): DeriveEraPoints[] => {
const query = mapPoints(remaining, points);
!withActive && query.forEach((q) => deriveCache.set(`${CACHE_KEY}-${q.era}`, q));
return eras.map((era): DeriveEraPoints =>
cached.find((cached) => era.eq(cached.era)) ||
query.find((query) => era.eq(query.era)) as DeriveEraPoints
);
})
);
});
}
export function erasPoints (api: ApiInterfaceRx): (withActive?: boolean) => Observable<DeriveEraPoints[]> {
return memo((withActive?: boolean): Observable<DeriveEraPoints[]> =>
return memo((withActive = false): Observable<DeriveEraPoints[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._erasPoints(eras))
switchMap((eras) => api.derive.staking._erasPoints(eras, withActive))
)
);
}
+30 -9
View File
@@ -10,7 +10,9 @@ import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { StorageKey } from '@polkadot/types';
import { memo } from '../util';
import { deriveCache, memo } from '../util';
const CACHE_KEY = 'eraPrefs';
function mapPrefs (era: EraIndex, all: [StorageKey, ValidatorPrefs][]): DeriveEraPrefs {
const validators: DeriveEraValPrefs = {};
@@ -22,26 +24,45 @@ function mapPrefs (era: EraIndex, all: [StorageKey, ValidatorPrefs][]): DeriveEr
return { era, validators };
}
export function _eraPrefs (api: ApiInterfaceRx): (era: EraIndex, withActive: boolean) => Observable<DeriveEraPrefs> {
return memo((era: EraIndex, withActive: boolean): Observable<DeriveEraPrefs> => {
const cacheKey = `${CACHE_KEY}-${era}`;
const cached = withActive
? undefined
: deriveCache.get<DeriveEraPrefs>(cacheKey);
return cached
? of(cached)
: api.query.staking.erasValidatorPrefs.entries(era).pipe(
map((prefs): DeriveEraPrefs => {
const value = mapPrefs(era, prefs);
!withActive && deriveCache.set(cacheKey, value);
return value;
})
);
});
}
export function eraPrefs (api: ApiInterfaceRx): (era: EraIndex) => Observable<DeriveEraPrefs> {
return memo((era: EraIndex): Observable<DeriveEraPrefs> =>
api.query.staking.erasValidatorPrefs.entries(era).pipe(
map((prefs) => mapPrefs(era, prefs))
)
api.derive.staking._eraPrefs(era, true)
);
}
export function _erasPrefs (api: ApiInterfaceRx): (eras: EraIndex[]) => Observable<DeriveEraPrefs[]> {
return memo((eras: EraIndex[]): Observable<DeriveEraPrefs[]> =>
export function _erasPrefs (api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraPrefs[]> {
return memo((eras: EraIndex[], withActive: boolean): Observable<DeriveEraPrefs[]> =>
eras.length
? combineLatest(eras.map((era) => api.derive.staking.eraPrefs(era)))
? combineLatest(eras.map((era) => api.derive.staking._eraPrefs(era, withActive)))
: of([])
);
}
export function erasPrefs (api: ApiInterfaceRx): (withActive?: boolean) => Observable<DeriveEraPrefs[]> {
return memo((withActive?: boolean): Observable<DeriveEraPrefs[]> =>
return memo((withActive = false): Observable<DeriveEraPrefs[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._erasPrefs(eras))
switchMap((eras) => api.derive.staking._erasPrefs(eras, withActive))
)
);
}
+42 -14
View File
@@ -10,25 +10,53 @@ import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option } from '@polkadot/types';
import { memo } from '../util';
import { deriveCache, memo } from '../util';
export function _erasRewards (api: ApiInterfaceRx): (eras: EraIndex[]) => Observable<DeriveEraRewards[]> {
return memo((eras: EraIndex[]): Observable<DeriveEraRewards[]> =>
eras.length
? api.query.staking.erasValidatorReward.multi<Option<Balance>>(eras).pipe(
map((rewards) => eras.map((era, index): DeriveEraRewards => ({
era,
eraReward: rewards[index].unwrapOrDefault()
})))
)
: of([])
);
const CACHE_KEY = 'eraRewards';
function mapRewards (eras: EraIndex[], optRewards: Option<Balance>[]): DeriveEraRewards[] {
return eras.map((era, index): DeriveEraRewards => ({
era,
eraReward: optRewards[index].unwrapOrDefault()
}));
}
export function _erasRewards (api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraRewards[]> {
return memo((eras: EraIndex[], withActive: boolean): Observable<DeriveEraRewards[]> => {
if (!eras.length) {
return of([]);
}
const cached: DeriveEraRewards[] = withActive
? []
: eras
.map((era) => deriveCache.get(`${CACHE_KEY}-${era}`))
.filter((value): value is DeriveEraRewards => !!value);
const remaining = eras.filter((era) => !cached.some((cached) => era.eq(cached.era)));
if (!remaining.length) {
return of(cached);
}
return api.query.staking.erasValidatorReward.multi<Option<Balance>>(remaining).pipe(
map((optRewards) => {
const query = mapRewards(remaining, optRewards);
!withActive && query.forEach((q) => deriveCache.set(`${CACHE_KEY}-${q.era}`, q));
return eras.map((era): DeriveEraRewards =>
cached.find((cached) => era.eq(cached.era)) ||
query.find((query) => era.eq(query.era)) as DeriveEraRewards
);
})
);
});
}
export function erasRewards (api: ApiInterfaceRx): (withActive?: boolean) => Observable<DeriveEraRewards[]> {
return memo((withActive?: boolean): Observable<DeriveEraRewards[]> =>
return memo((withActive = false): Observable<DeriveEraRewards[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._erasRewards(eras))
switchMap((eras) => api.derive.staking._erasRewards(eras, withActive))
)
);
}
+33 -12
View File
@@ -11,7 +11,9 @@ import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option, StorageKey } from '@polkadot/types';
import { memo } from '../util';
import { deriveCache, memo } from '../util';
const CACHE_KEY = 'eraSlashes';
function mapSlashes (era: EraIndex, noms: [StorageKey, Option<BalanceOf>][], vals: [StorageKey, Option<ITuple<[Perbill, BalanceOf]>>][]): DeriveEraSlashes {
const nominators: DeriveEraValSlash = {};
@@ -28,31 +30,50 @@ function mapSlashes (era: EraIndex, noms: [StorageKey, Option<BalanceOf>][], val
return { era, nominators, validators };
}
export function _eraSlashes (api: ApiInterfaceRx): (era: EraIndex, withActive: boolean) => Observable<DeriveEraSlashes> {
return memo((era: EraIndex, withActive: boolean): Observable<DeriveEraSlashes> => {
const cacheKey = `${CACHE_KEY}-${era}`;
const cached = withActive
? undefined
: deriveCache.get<DeriveEraSlashes>(cacheKey);
return cached
? of(cached)
: combineLatest([
api.query.staking.nominatorSlashInEra.entries(era),
api.query.staking.validatorSlashInEra.entries(era)
]).pipe(
map(([noms, vals]): DeriveEraSlashes => {
const value = mapSlashes(era, noms, vals);
!withActive && deriveCache.set(cacheKey, value);
return value;
})
);
});
}
export function eraSlashes (api: ApiInterfaceRx): (era: EraIndex) => Observable<DeriveEraSlashes> {
return memo((era: EraIndex): Observable<DeriveEraSlashes> =>
combineLatest([
api.query.staking.nominatorSlashInEra.entries(era),
api.query.staking.validatorSlashInEra.entries(era)
]).pipe(
map(([noms, vals]) => mapSlashes(era, noms, vals))
)
api.derive.staking._eraSlashes(era, true)
);
}
export function _erasSlashes (api: ApiInterfaceRx): (eras: EraIndex[]) => Observable<DeriveEraSlashes[]> {
return memo((eras: EraIndex[]): Observable<DeriveEraSlashes[]> =>
export function _erasSlashes (api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraSlashes[]> {
return memo((eras: EraIndex[], withActive: boolean): Observable<DeriveEraSlashes[]> =>
eras.length
? combineLatest(
eras.map((era) => api.derive.staking.eraSlashes(era))
eras.map((era) => api.derive.staking._eraSlashes(era, withActive))
)
: of([])
);
}
export function erasSlashes (api: ApiInterfaceRx): (withActive?: boolean) => Observable<DeriveEraSlashes[]> {
return memo((withActive?: boolean): Observable<DeriveEraSlashes[]> =>
return memo((withActive = false): Observable<DeriveEraSlashes[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._erasSlashes(eras))
switchMap((eras) => api.derive.staking._erasSlashes(eras, withActive))
)
);
}
@@ -11,7 +11,7 @@ import { map, switchMap } from 'rxjs/operators';
import { memo } from '../util';
export function ownSlashes (api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerSlashes[]> {
return memo((accountId: Uint8Array | string, withActive?: boolean): Observable<DeriveStakerSlashes[]> => {
return memo((accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerSlashes[]> => {
return api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) =>
eras.length
+2 -1
View File
@@ -10,6 +10,7 @@ import { DeriveStakingQuery } from '../types';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option, Vec } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
@@ -87,7 +88,7 @@ export function queryWithQueued (api: ApiInterfaceRx): (accountId: Uint8Array |
const stashId = api.registry.createType('AccountId', accountId);
return (
api.query.staking.erasStakers
isFunction(api.query.staking.erasStakers)
? retrieveCurr(api, stashId)
: retrievePrev(api, stashId)
).pipe(
@@ -11,11 +11,11 @@ import { map, switchMap } from 'rxjs/operators';
import { memo } from '../util';
export function _stakerExposure (api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[]) => Observable<DeriveStakerExposure[]> {
return memo((accountId: Uint8Array | string, eras: EraIndex[]): Observable<DeriveStakerExposure[]> => {
export function _stakerExposure (api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerExposure[]> {
return memo((accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerExposure[]> => {
const stakerId = api.registry.createType('AccountId', accountId).toString();
return api.derive.staking._erasExposure(eras).pipe(
return api.derive.staking._erasExposure(eras, withActive).pipe(
map((exposures): DeriveStakerExposure[] =>
exposures.map(({ era, nominators: allNominators, validators: allValidators }): DeriveStakerExposure => {
const isValidator = !!allValidators[stakerId];
@@ -38,9 +38,9 @@ export function _stakerExposure (api: ApiInterfaceRx): (accountId: Uint8Array |
}
export function stakerExposure (api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerExposure[]> {
return memo((accountId: Uint8Array | string, withActive?: boolean): Observable<DeriveStakerExposure[]> =>
return memo((accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerExposure[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._stakerExposure(accountId, eras))
switchMap((eras) => api.derive.staking._stakerExposure(accountId, eras, withActive))
)
);
}
@@ -11,11 +11,11 @@ import { map, switchMap } from 'rxjs/operators';
import { memo } from '../util';
export function _stakerPoints (api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[]) => Observable<DeriveStakerPoints[]> {
return memo((accountId: Uint8Array | string, eras: EraIndex[]): Observable<DeriveStakerPoints[]> => {
export function _stakerPoints (api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerPoints[]> {
return memo((accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerPoints[]> => {
const stakerId = api.registry.createType('AccountId', accountId).toString();
return api.derive.staking._erasPoints(eras).pipe(
return api.derive.staking._erasPoints(eras, withActive).pipe(
map((points): DeriveStakerPoints[] =>
points.map(({ era, eraPoints, validators }): DeriveStakerPoints => ({
era,
@@ -28,9 +28,9 @@ export function _stakerPoints (api: ApiInterfaceRx): (accountId: Uint8Array | st
}
export function stakerPoints (api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerPoints[]> {
return memo((accountId: Uint8Array | string, withActive?: boolean): Observable<DeriveStakerPoints[]> =>
return memo((accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerPoints[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._stakerPoints(accountId, eras))
switchMap((eras) => api.derive.staking._stakerPoints(accountId, eras, withActive))
)
);
}
@@ -10,17 +10,18 @@ import BN from 'bn.js';
import { Observable, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Option } from '@polkadot/types';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
type Result = [DeriveEraPoints[], DeriveEraPrefs[], DeriveEraRewards[], DeriveStakerExposure[]];
type ErasResult = [{ unwrapOr: (value: BN) => BN }, DeriveEraPoints[], DeriveEraPrefs[], DeriveEraRewards[]];
const ZERO = new BN(0);
const MIN_ONE = new BN(-1);
const COMM_DIV = new BN(1_000_000_000);
const MAX_ERAS = new BN(1_000_000_000);
function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [erasPoints, erasPrefs, erasRewards, exposures]: Result): DeriveStakerReward[] {
function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [, erasPoints, erasPrefs, erasRewards]: ErasResult, exposures: DeriveStakerExposure[]): DeriveStakerReward[] {
return exposures.map(({ era, isEmpty, isValidator, nominating, validators: eraValidators }): DeriveStakerReward => {
const { eraPoints, validators: allValPoints } = erasPoints.find((p) => p.era.eq(era)) || { eraPoints: ZERO, validators: {} };
const { eraReward } = erasRewards.find((r) => r.era.eq(era)) || { eraReward: api.registry.createType('Balance') };
@@ -97,28 +98,29 @@ function filterEras (eras: EraIndex[], stakingLedger: StakingLedger): EraIndex[]
return eras.filter((era) => filterEra(era, stakingLedger));
}
function filterRewards (api: ApiInterfaceRx, rewards: DeriveStakerReward[], stakingLedger: StakingLedger, withActive?: boolean): Observable<DeriveStakerReward[]> {
function filterRewards (api: ApiInterfaceRx, eras: EraIndex[], migrateEra: BN, rewards: DeriveStakerReward[], stakingLedger: StakingLedger, withActive: boolean): Observable<DeriveStakerReward[]> {
if (withActive) {
return of(rewards);
}
const validators = uniqValidators(rewards);
return combineLatest([
api.query.staking.migrateEra
? api.query.staking.migrateEra<Option<EraIndex>>()
: of({ unwrapOr: () => api.tx.staking.payoutStakers ? ZERO : MAX_ERAS }),
api.tx.staking.payoutStakers
return (
isFunction(api.tx.staking.payoutStakers)
? api.derive.staking.queryMulti(validators)
: of([])
]).pipe(
map(([optMigrate, queryValidators]): DeriveStakerReward[] => {
const migrateEra: BN = optMigrate.unwrapOr(ZERO);
).pipe(
map((queryValidators): DeriveStakerReward[] => {
const filter = withActive
? eras
: filterEras(eras, stakingLedger);
return rewards
.filter(({ isEmpty }) => !isEmpty)
.filter((reward): boolean => {
if (reward.era.lt(migrateEra)) {
if (!filter.some((filter) => reward.era.eq(filter))) {
return false;
} else if (reward.era.lt(migrateEra)) {
// we filter again here, the actual ledger may have changed, e.g. something has been claimed
return filterEra(reward.era, stakingLedger);
}
@@ -154,35 +156,41 @@ function filterRewards (api: ApiInterfaceRx, rewards: DeriveStakerReward[], stak
);
}
export function _stakerRewards (api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive?: boolean) => Observable<DeriveStakerReward[]> {
return memo((accountId: Uint8Array | string, _eras: EraIndex[], withActive?: boolean): Observable<DeriveStakerReward[]> =>
api.derive.staking.query(accountId).pipe(
switchMap(({ stakingLedger, stashId }): Observable<DeriveStakerReward[]> => {
export function _stakerRewardsEras (api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<ErasResult> {
return memo((eras: EraIndex[], withActive: boolean): Observable<ErasResult> =>
combineLatest([
isFunction(api.query.staking.migrateEra)
? api.query.staking.migrateEra<Option<EraIndex>>()
: of({ unwrapOr: () => isFunction(api.tx.staking.payoutStakers) ? ZERO : MAX_ERAS }),
api.derive.staking._erasPoints(eras, withActive),
api.derive.staking._erasPrefs(eras, withActive),
api.derive.staking._erasRewards(eras, withActive)
])
);
}
export function _stakerRewards (api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerReward[]> {
return memo((accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerReward[]> =>
combineLatest([
api.derive.staking.query(accountId),
api.derive.staking._stakerExposure(accountId, eras, withActive),
api.derive.staking._stakerRewardsEras(eras, withActive)
]).pipe(
switchMap(([{ stakingLedger, stashId }, exposures, erasResult]): Observable<DeriveStakerReward[]> => {
const migrateEra: BN = erasResult[0].unwrapOr(ZERO);
if (!stashId || !stakingLedger) {
return of([]);
}
const eras = withActive
? _eras
: filterEras(_eras, stakingLedger);
return combineLatest([
api.derive.staking._erasPoints(eras),
api.derive.staking._erasPrefs(eras),
api.derive.staking._erasRewards(eras),
api.derive.staking._stakerExposure(stashId, eras)
]).pipe(
switchMap((result): Observable<DeriveStakerReward[]> =>
filterRewards(api, parseRewards(api, stashId, result), stakingLedger, withActive)
)
);
return filterRewards(api, eras, migrateEra, parseRewards(api, stashId, erasResult, exposures), stakingLedger, withActive);
})
)
);
}
export function stakerRewards (api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerReward[]> {
return memo((accountId: Uint8Array | string, withActive?: boolean): Observable<DeriveStakerReward[]> =>
return memo((accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerReward[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._stakerRewards(accountId, eras, withActive))
)
@@ -190,7 +198,7 @@ export function stakerRewards (api: ApiInterfaceRx): (accountId: Uint8Array | st
}
export function stakerRewardsMulti (api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], withActive?: boolean) => Observable<DeriveStakerReward[][]> {
return memo((accountIds: (Uint8Array | string)[], withActive?: boolean): Observable<DeriveStakerReward[][]> =>
return memo((accountIds: (Uint8Array | string)[], withActive = false): Observable<DeriveStakerReward[][]> =>
accountIds.length
? api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) =>
@@ -11,11 +11,11 @@ import { map, switchMap } from 'rxjs/operators';
import { memo } from '../util';
export function _stakerSlashes (api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[]) => Observable<DeriveStakerSlashes[]> {
return memo((accountId: Uint8Array | string, eras: EraIndex[]): Observable<DeriveStakerSlashes[]> => {
export function _stakerSlashes (api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerSlashes[]> {
return memo((accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerSlashes[]> => {
const stakerId = api.registry.createType('AccountId', accountId).toString();
return api.derive.staking._erasSlashes(eras).pipe(
return api.derive.staking._erasSlashes(eras, withActive).pipe(
map((slashes): DeriveStakerSlashes[] =>
slashes.map(({ era, nominators, validators }): DeriveStakerSlashes => ({
era,
@@ -27,9 +27,9 @@ export function _stakerSlashes (api: ApiInterfaceRx): (accountId: Uint8Array | s
}
export function stakerSlashes (api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerSlashes[]> {
return memo((accountId: Uint8Array | string, withActive?: boolean): Observable<DeriveStakerSlashes[]> =>
return memo((accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerSlashes[]> =>
api.derive.staking.erasHistoric(withActive).pipe(
switchMap((eras) => api.derive.staking._stakerSlashes(accountId, eras))
switchMap((eras) => api.derive.staking._stakerSlashes(accountId, eras, withActive))
)
);
}
+66
View File
@@ -0,0 +1,66 @@
// 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 { DeriveCache } from './types';
import { deriveNoopCache } from './cacheImpl';
interface CacheValue<T> {
v: T;
x: number;
}
const CHACHE_EXPIRY = 7 * (24 * 60) * (60 * 1000);
let deriveCache: DeriveCache;
function wrapCache (keyStart: string, cache: DeriveCache): DeriveCache {
return {
del: (partial: string): void => cache.del(`${keyStart}${partial}`),
forEach: cache.forEach,
get: <T = any> (partial: string): T | undefined => {
const key = `${keyStart}${partial}`;
const cached = cache.get<CacheValue<T>>(key);
if (cached) {
cached.x = Date.now();
cache.set(key, cached);
return cached.v;
}
return undefined;
},
set: (partial: string, v: any): void => {
cache.set(`${keyStart}${partial}`, { v, x: Date.now() });
}
};
}
function clearCache (cache: DeriveCache): void {
// clear all expired values
const now = Date.now();
const all: any[] = [];
cache.forEach((key: string, { x }: CacheValue<any>): void => {
((now - x) > CHACHE_EXPIRY) && all.push(key);
});
// don't do delete inside loop, just in-case
all.forEach((key) => cache.del(key));
}
export function setDeriveCache (prefix = '', cache?: DeriveCache): void {
deriveCache = cache
? wrapCache(`derive:${prefix}:`, cache)
: deriveNoopCache;
if (cache) {
clearCache(cache);
}
}
setDeriveCache();
export { deriveCache };
+35
View File
@@ -0,0 +1,35 @@
// 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 { DeriveCache } from './types';
const mapCache: Map<string, any> = new Map();
const deriveMapCache: DeriveCache = {
del: (key: string): void => {
mapCache.delete(key);
},
forEach: (cb: (key: string, value: any) => void): void => {
const entries = mapCache.entries();
for (const entry in entries) {
cb(entry[0], entry[1]);
}
},
get: <T = any> (key: string): T | undefined => {
return mapCache.get(key);
},
set: (key: string, value: any): void => {
mapCache.set(key, value);
}
};
const deriveNoopCache: DeriveCache = {
del: (): void => undefined,
forEach: () => undefined,
get: (): undefined => undefined,
set: (_: string, value: any): any => value
};
export { deriveMapCache, deriveNoopCache };
+2
View File
@@ -5,6 +5,8 @@
import { drr } from '@polkadot/rpc-core/rxjs';
export * from './approvalFlagsToBools';
export * from './cache';
export * from './cacheImpl';
export * from './memo';
export { drr };
+10
View File
@@ -0,0 +1,10 @@
// 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.
export interface DeriveCache {
del: (key: string) => void;
forEach: (cb: (key: string, value: any) => void) => void;
get: <T = any> (key: string) => T | undefined;
set: (key: string, value: any) => void;
}
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.14.1",
"version": "1.15.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -27,17 +27,17 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/api-derive": "1.14.1",
"@polkadot/api-derive": "1.15.1",
"@polkadot/keyring": "^2.10.1",
"@polkadot/metadata": "1.14.1",
"@polkadot/rpc-core": "1.14.1",
"@polkadot/rpc-provider": "1.14.1",
"@polkadot/types": "1.14.1",
"@polkadot/types-known": "1.14.1",
"@polkadot/metadata": "1.15.1",
"@polkadot/rpc-core": "1.15.1",
"@polkadot/rpc-provider": "1.15.1",
"@polkadot/types": "1.15.1",
"@polkadot/types-known": "1.15.1",
"@polkadot/util": "^2.10.1",
"@polkadot/util-crypto": "^2.10.1",
"bn.js": "^5.1.1",
"eventemitter3": "^4.0.1",
"bn.js": "^5.1.2",
"eventemitter3": "^4.0.4",
"rxjs": "^6.5.5"
},
"devDependencies": {
+10
View File
@@ -2,10 +2,12 @@
/* eslint-disable */
import { Codec } from '@polkadot/types/types';
import { Vec } from '@polkadot/types/codec';
import { u32, u64 } from '@polkadot/types/primitive';
import { Balance, BalanceOf, BlockNumber, LockIdentifier, ModuleId, Moment, Percent, Permill, RuntimeDbWeight, Weight } from '@polkadot/types/interfaces/runtime';
import { SessionIndex } from '@polkadot/types/interfaces/session';
import { EraIndex } from '@polkadot/types/interfaces/staking';
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
declare module '@polkadot/metadata/Decorated/consts/types' {
export interface Constants {
@@ -102,6 +104,10 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* How often (in blocks) new public referenda are launched.
**/
launchPeriod: AugmentedConst<BlockNumber>;
/**
* The maximum number of votes for an account.
**/
maxVotes: AugmentedConst<u32>;
/**
* The minimum amount to be used as a deposit for a public referendum proposal.
**/
@@ -253,6 +259,10 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: AugmentedConst<BalanceOf>;
/**
* The polynomial that is applied in order to derive fee from weight.
**/
weightToFee: AugmentedConst<Vec<WeightToFeeCoefficient>>;
};
treasury: {
[index: string]: AugmentedConst<object & Codec>;
+40 -7
View File
@@ -5,12 +5,12 @@ import { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
import { 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, MaybeRandomness, Randomness } from '@polkadot/types/interfaces/babe';
import { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
import { AccountData, BalanceLock, ReleasesBalances } from '@polkadot/types/interfaces/balances';
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { CodeHash, ContractInfo, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
import { PreimageStatus, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy';
import { PreimageStatus, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReleasesDemocracy, Voting } from '@polkadot/types/interfaces/democracy';
import { VoteThreshold } from '@polkadot/types/interfaces/elections';
import { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
import { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
@@ -78,6 +78,10 @@ declare module '@polkadot/api/types/storage' {
* execution context should always yield zero.
**/
lateness: AugmentedQuery<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
/**
* Next epoch configuration, if changed.
**/
nextEpochConfig: AugmentedQuery<ApiType, () => Observable<Option<NextConfigDescriptor>>> & QueryableStorageEntry<ApiType>;
/**
* Next epoch randomness.
**/
@@ -107,6 +111,9 @@ declare module '@polkadot/api/types/storage' {
* epoch.
**/
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
/**
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
**/
underConstruction: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Randomness>>> & QueryableStorageEntry<ApiType>;
};
balances: {
@@ -148,6 +155,8 @@ declare module '@polkadot/api/types/storage' {
codeStorage: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<PrefabWasmModule>>> & QueryableStorageEntry<ApiType>;
/**
* The code associated with a given account.
*
* TWOX-NOTE: SAFE since `AccountId` is a secure hash.
**/
contractInfoOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ContractInfo>>> & QueryableStorageEntry<ApiType>;
/**
@@ -200,8 +209,10 @@ declare module '@polkadot/api/types/storage' {
cancellations: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<bool>> & QueryableStorageEntry<ApiType>;
/**
* Those who have locked a deposit.
*
* TWOX-NOTE: Safe, as increasing integer keys are safe.
**/
depositOf: AugmentedQuery<ApiType, (arg: PropIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[BalanceOf, Vec<AccountId>]>>>> & QueryableStorageEntry<ApiType>;
depositOf: AugmentedQuery<ApiType, (arg: PropIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[Vec<AccountId>, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
/**
* True if the last referendum tabled was submitted externally. False if it was a public
* proposal.
@@ -210,6 +221,8 @@ declare module '@polkadot/api/types/storage' {
/**
* 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.
*
* TWOX-NOTE: OK ― `AccountId` is a secure hash.
**/
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<BlockNumber>>> & QueryableStorageEntry<ApiType>;
/**
@@ -232,6 +245,8 @@ declare module '@polkadot/api/types/storage' {
/**
* Who is able to vote for whom. Value is the fund-holding account, key is the
* vote-transaction-sending account.
*
* TWOX-NOTE: OK ― `AccountId` is a secure hash.
**/
proxy: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ProxyState>>> & QueryableStorageEntry<ApiType>;
/**
@@ -248,11 +263,21 @@ declare module '@polkadot/api/types/storage' {
referendumCount: AugmentedQuery<ApiType, () => Observable<ReferendumIndex>> & QueryableStorageEntry<ApiType>;
/**
* Information concerning any given referendum.
*
* TWOX-NOTE: SAFE as indexes are not under an attacker’s control.
**/
referendumInfoOf: AugmentedQuery<ApiType, (arg: ReferendumIndex | AnyNumber | Uint8Array) => Observable<Option<ReferendumInfo>>> & QueryableStorageEntry<ApiType>;
/**
* Storage version of the pallet.
*
* New networks start with last version.
**/
storageVersion: AugmentedQuery<ApiType, () => Observable<Option<ReleasesDemocracy>>> & QueryableStorageEntry<ApiType>;
/**
* All votes for a particular voter. We store the balance for the number of votes that we
* have recorded. The second item is the total amount of delegations, that will be added.
*
* TWOX-NOTE: SAFE as `AccountId`s are crypto hashes anyway.
**/
votingOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Voting>> & QueryableStorageEntry<ApiType>;
};
@@ -277,6 +302,8 @@ declare module '@polkadot/api/types/storage' {
runnersUp: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
/**
* Votes and locked stake of a particular voter.
*
* TWOX-NOTE: SAFE as `AccountId` is a crypto hash
**/
voting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>> & QueryableStorageEntry<ApiType>;
};
@@ -298,6 +325,8 @@ declare module '@polkadot/api/types/storage' {
/**
* A mapping from grandpa set ID to the index of the *most recent* session for which its
* members were responsible.
*
* TWOX-NOTE: `SetId` is not under user control.
**/
setIdSession: AugmentedQuery<ApiType, (arg: SetId | AnyNumber | Uint8Array) => Observable<Option<SessionIndex>>> & QueryableStorageEntry<ApiType>;
/**
@@ -313,6 +342,8 @@ declare module '@polkadot/api/types/storage' {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Information that is pertinent to identify the entity behind an account.
*
* TWOX-NOTE: OK ― `AccountId` is a secure hash.
**/
identityOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Registration>>> & QueryableStorageEntry<ApiType>;
/**
@@ -326,6 +357,8 @@ declare module '@polkadot/api/types/storage' {
* Alternative "sub" identities of this account.
*
* The first item is the deposit, the second is a vector of the accounts.
*
* TWOX-NOTE: OK ― `AccountId` is a secure hash.
**/
subsOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>> & QueryableStorageEntry<ApiType>;
/**
@@ -753,14 +786,14 @@ declare module '@polkadot/api/types/storage' {
* Total length (in bytes) for all extrinsics put together, for the current block.
**/
allExtrinsicsLen: AugmentedQuery<ApiType, () => Observable<Option<u32>>> & QueryableStorageEntry<ApiType>;
/**
* Total weight for all extrinsics for the current block.
**/
allExtrinsicsWeight: AugmentedQuery<ApiType, () => Observable<ExtrinsicsWeight>> & QueryableStorageEntry<ApiType>;
/**
* Map of block numbers to block hashes.
**/
blockHash: AugmentedQuery<ApiType, (arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Hash>> & QueryableStorageEntry<ApiType>;
/**
* The current weight for the block.
**/
blockWeight: AugmentedQuery<ApiType, () => Observable<ExtrinsicsWeight>> & QueryableStorageEntry<ApiType>;
/**
* Digest of the current block, also part of the block header.
**/
File diff suppressed because it is too large Load Diff
+8 -13
View File
@@ -15,14 +15,13 @@ import { map, switchMap, take, tap, toArray } 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, 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, logger, u8aConcat, u8aToHex } from '@polkadot/util';
import { assert, compactStripLength, logger, u8aToHex } from '@polkadot/util';
import { createSubmittable } from '../submittable';
import augmentObject from '../util/augmentObject';
@@ -344,8 +343,8 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
decorated.key = (arg1?: Arg, arg2?: Arg): string =>
u8aToHex(compactStripLength(creator(creator.meta.type.isDoubleMap ? [arg1, arg2] : arg1))[1]);
decorated.keyPrefix = (): string =>
u8aToHex(creator.keyPrefix);
decorated.keyPrefix = (key1?: Arg): string =>
u8aToHex(creator.keyPrefix(key1));
decorated.range = decorateMethod((range: [Hash, Hash?], arg1?: Arg, arg2?: Arg): Observable<[Hash, Codec][]> =>
this._decorateStorageRange(decorated, [arg1, arg2], range));
@@ -392,6 +391,9 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
const result: Map<Codec, ITuple<[Codec, Linkage<Codec>]> | null> = new Map();
let subject: BehaviorSubject<LinkageResult>;
let head: Codec | null = null;
const iterKey = creator.iterKey;
assert(iterKey, 'iterKey field is missing');
// retrieve a value based on the key, iterating if it has a next entry. Since
// entries can be re-linked in the middle of a list, we subscribe here to make
@@ -455,7 +457,7 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
.subscribeStorage<[[Codec, Linkage<Codec>]]>([[creator, ...args]])
.pipe(map(([data]): [Codec, Linkage<Codec>] => data))
: this._rpcCore.state
.subscribeStorage<[LinkageResult]>([creator.iterKey])
.subscribeStorage<[LinkageResult]>([iterKey()])
.pipe(switchMap(([key]): Observable<LinkageResult> => getNext(head = key)))
);
}
@@ -463,14 +465,7 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
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 headKey = 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([])
)).toHex();
const headKey = iterKey(arg).toHex();
const startSubject = new BehaviorSubject<string>(headKey);
return this._rpcCore.state.getKeysPaged
+1 -1
View File
@@ -159,7 +159,7 @@ async function tx (api: ApiPromise, keyring: TestKeyringMap): Promise<void> {
});
// it allows for query & then using the submittable
const second = api.tx.democracy.second(123);
const second = api.tx.democracy.second(123, 5);
second.signAndSend('123', (result): void => {
console.log(result);
+1 -1
View File
@@ -13,7 +13,7 @@ import { hexToU8a } from '@polkadot/util';
import { SingleAccountSigner } from '../../test/util';
import ApiPromise from './Api';
const TRANSFER_SIG = '0xa1d493ab6b74550da434fbc153a739429be68c9d30e59e631fb5d08f348504deefb5577f4824e138741ad102f479109827e8fa9552812a3e5f505a24d10e820f';
const TRANSFER_SIG = '0x7a10e5ed9a14284eca7bea53f81631981dddda5a3d2dee973b136475947264801465726e4829ae3994d9058df638d959d4e043c7f1924299546790dda1dea20a';
describe('ApiPromise', (): void => {
const registry = new TypeRegistry();
+1
View File
@@ -40,6 +40,7 @@ export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunctio
export interface StorageEntryDoubleMap<ApiType extends ApiTypes, F extends AnyFunction> extends StorageEntryBase<ApiType, F> {
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey, T][]>;
keyPrefix: (key1?: Parameters<F>[0]) => string;
}
interface StorageEntryObservableMulti {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.14.1",
"version": "1.15.1",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -27,11 +27,11 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/types": "1.14.1",
"@polkadot/types-known": "1.14.1",
"@polkadot/types": "1.15.1",
"@polkadot/types-known": "1.15.1",
"@polkadot/util": "^2.10.1",
"@polkadot/util-crypto": "^2.10.1",
"bn.js": "^5.1.1"
"bn.js": "^5.1.2"
},
"devDependencies": {
"@polkadot/keyring": "^2.10.1"
@@ -4,7 +4,7 @@
import { Text, TypeRegistry } from '@polkadot/types';
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { stringToU8a, u8aConcat, u8aToHex } from '@polkadot/util';
import { assert, stringToU8a, u8aConcat, u8aToHex } from '@polkadot/util';
import createFunction from './createFunction';
@@ -104,6 +104,17 @@ describe('createFunction', (): void => {
(): Uint8Array => storageFn(['5DXUeE5N5LtkW97F2PzqYPyqNkxqSWESdGSPTX6AvkUAhwKP'])
).toThrow(/requires two arguments/);
});
it('accepts an optional parameter for key construction', (): void => {
const iterKey = storageFn.iterKey;
assert(iterKey, 'storageFn.iterKey is undefined');
const result = iterKey('5DXUeE5N5LtkW97F2PzqYPyqNkxqSWESdGSPTX6AvkUAhwKP');
expect(u8aToHex(result)).toEqual('0x223416315e3dddca3b5a47fd0ac8e4916482b9ade7bc6657aaca787ba1add3b4c4303117deb55aad9858c8a873273280f78d172b398d5e77e43a2db5e42163e9');
expect(u8aToHex(iterKey())).toEqual('0x223416315e3dddca3b5a47fd0ac8e4916482b9ade7bc6657aaca787ba1add3b4');
});
});
it('allows creates double map function with a Null type key', (): void => {
@@ -142,7 +142,7 @@ function expandWithMeta ({ meta, method, prefix, section }: CreateItemFn, storag
}
/** @internal */
function extendHeadMeta (registry: Registry, { meta: { documentation, name, type }, section }: CreateItemFn, { method }: StorageEntry, iterFn: (arg?: any) => Raw): StorageKey {
function extendHeadMeta (registry: Registry, { meta: { documentation, name, type }, section }: CreateItemFn, { method }: StorageEntry, iterFn: (arg?: any) => Raw): (arg?: any) => StorageKey {
const outputType = type.isMap
? type.asMap.key.toString()
: type.asDoubleMap.key1.toString();
@@ -157,7 +157,12 @@ function extendHeadMeta (registry: Registry, { meta: { documentation, name, type
type: registry.createType('StorageEntryTypeLatest', registry.createType('PlainTypeLatest', type.isMap ? type.asMap.key : type.asDoubleMap.key1), 0)
});
return registry.createType('StorageKey', iterFn, { method, section });
const prefixKey = registry.createType('StorageKey', iterFn, { method, section });
return (arg?: any): StorageKey =>
!isUndefined(arg) && !isNull(arg)
? registry.createType('StorageKey', iterFn(arg), { method, section })
: prefixKey;
}
// attach the head key hashing for linked maps
@@ -177,8 +182,12 @@ function extendLinkedMap (registry: Registry, itemFn: CreateItemFn, storageFn: S
// attach the full list hashing for prefixed maps
/** @internal */
function extendPrefixedMap (registry: Registry, itemFn: CreateItemFn, storageFn: StorageEntry): StorageEntry {
storageFn.iterKey = extendHeadMeta(registry, itemFn, storageFn, (): Raw =>
new Raw(registry, createPrefixedKey(itemFn))
const { meta: { type } } = itemFn;
storageFn.iterKey = extendHeadMeta(registry, itemFn, storageFn, (arg?: any): Raw =>
type.isDoubleMap && !isUndefined(arg) && !isNull(arg)
? new Raw(registry, u8aConcat(createPrefixedKey(itemFn), getHasher(type.asDoubleMap.hasher)(registry.createType(type.asDoubleMap.key1.toString() as 'Raw', arg).toU8a())))
: new Raw(registry, createPrefixedKey(itemFn))
);
return storageFn;
@@ -219,7 +228,8 @@ export default function createFunction (registry: Registry, itemFn: CreateItemFn
extendDoubleMap(registry, itemFn, storageFn);
}
storageFn.keyPrefix = storageFn.iterKey || compactStripLength(storageFn())[1];
storageFn.keyPrefix = (arg?: any): Uint8Array =>
(storageFn.iterKey && storageFn.iterKey(arg)) || compactStripLength(storageFn())[1];
return storageFn;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.14.1",
"version": "1.15.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,9 +27,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/metadata": "1.14.1",
"@polkadot/rpc-provider": "1.14.1",
"@polkadot/types": "1.14.1",
"@polkadot/metadata": "1.15.1",
"@polkadot/rpc-provider": "1.15.1",
"@polkadot/types": "1.15.1",
"@polkadot/util": "^2.10.1",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
@@ -153,7 +153,7 @@ function formattingTests (version: string, decorated: Metadata, encodedValues: [
}
api.state
.subscribeStorage([iterKey])
.subscribeStorage([iterKey()])
.subscribe((value: Codec[]): void => {
expect(value).toHaveLength(1);
// console.error('head fallback', value);
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.14.1",
"version": "1.15.1",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -27,12 +27,12 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/metadata": "1.14.1",
"@polkadot/types": "1.14.1",
"@polkadot/metadata": "1.15.1",
"@polkadot/types": "1.15.1",
"@polkadot/util": "^2.10.1",
"@polkadot/util-crypto": "^2.10.1",
"bn.js": "^5.1.1",
"eventemitter3": "^4.0.1",
"bn.js": "^5.1.2",
"eventemitter3": "^4.0.4",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31"
},
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.14.1",
"version": "1.15.1",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
@@ -36,10 +36,10 @@
"@babel/core": "^7.9.6",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.6",
"@polkadot/api": "1.14.1",
"@polkadot/metadata": "1.14.1",
"@polkadot/rpc-provider": "1.14.1",
"@polkadot/types": "1.14.1",
"@polkadot/api": "1.15.1",
"@polkadot/metadata": "1.15.1",
"@polkadot/rpc-provider": "1.15.1",
"@polkadot/types": "1.15.1",
"@polkadot/util": "^2.10.1",
"handlebars": "^4.7.6",
"websocket": "^1.0.31",
@@ -47,6 +47,6 @@
},
"devDependencies": {
"@types/websocket": "^1.0.0",
"@types/yargs": "^15.0.4"
"@types/yargs": "^15.0.5"
}
}
+1
View File
@@ -57,6 +57,7 @@ function tsEnum (definitions: object, { name: enumName, sub }: TypeDef, imports:
const isGetter = createGetter(definitions, `is${getter}`, 'boolean', imports);
switch (info) {
case TypeDefInfo.Compact:
case TypeDefInfo.Plain:
case TypeDefInfo.Tuple:
case TypeDefInfo.Vec:
+2 -4
View File
@@ -196,8 +196,7 @@ function addStorage (metadata: MetadataLatest): string {
};
});
const options = { encoding: 'utf8', flags: 'r' };
const knownSection = JSON.parse(fs.readFileSync('docs/substrate/storage-known-section.json', options));
const knownSection = JSON.parse(fs.readFileSync('docs/substrate/storage-known-section.json', 'utf8'));
return renderPage({
description: DESC_STORAGE,
@@ -283,8 +282,7 @@ function addErrors (metadata: MetadataLatest): string {
/** @internal */
function writeFile (name: string, ...chunks: any[]): void {
const options = { encoding: 'utf8', flags: 'w' };
const writeStream = fs.createWriteStream(name, options);
const writeStream = fs.createWriteStream(name, { encoding: 'utf8', flags: 'w' });
writeStream.on('finish', (): void => {
console.log(`Completed writing ${name}`);
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "1.14.1",
"version": "1.15.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,9 +27,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/types": "1.14.1",
"@polkadot/types": "1.15.1",
"@polkadot/util": "^2.10.1",
"bn.js": "^5.1.1"
"bn.js": "^5.1.2"
},
"devDependencies": {
"@types/bn.js": "^4.11.6"
+3
View File
@@ -16,6 +16,9 @@ const typesModules: Record<string, OverrideModuleType> = {
contracts: {
StorageKey: 'ContractStorageKey'
},
democracy: {
Releases: 'ReleasesDemocracy'
},
identity: {
Judgement: 'IdentityJudgement'
},
@@ -11,6 +11,7 @@ const versioned: OverrideVersionedType[] = [
types: {
Address: 'AccountId',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
+5
View File
@@ -15,6 +15,7 @@ const versioned: OverrideVersionedType[] = [
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
ReferendumInfo: 'ReferendumInfoTo239',
SlashingSpans: 'SlashingSpansTo204',
StakingLedger: 'StakingLedgerTo223',
@@ -30,6 +31,7 @@ const versioned: OverrideVersionedType[] = [
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
ReferendumInfo: 'ReferendumInfoTo239',
SlashingSpans: 'SlashingSpansTo204',
StakingLedger: 'StakingLedgerTo223',
@@ -46,6 +48,7 @@ const versioned: OverrideVersionedType[] = [
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230',
@@ -60,6 +63,7 @@ const versioned: OverrideVersionedType[] = [
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
@@ -72,6 +76,7 @@ const versioned: OverrideVersionedType[] = [
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
@@ -16,6 +16,7 @@ const versioned: OverrideVersionedType[] = [
BalanceLock: 'BalanceLockTo212',
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230',
Weight: 'u32'
@@ -28,6 +29,7 @@ const versioned: OverrideVersionedType[] = [
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
@@ -39,6 +41,7 @@ const versioned: OverrideVersionedType[] = [
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
@@ -49,6 +52,7 @@ const versioned: OverrideVersionedType[] = [
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
Weight: 'u32'
}
},
+1
View File
@@ -11,6 +11,7 @@ const versioned: OverrideVersionedType[] = [
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
Weight: 'u32'
}
},
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.14.1",
"version": "1.15.1",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -27,11 +27,11 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.9.6",
"@polkadot/metadata": "1.14.1",
"@polkadot/metadata": "1.15.1",
"@polkadot/util": "^2.10.1",
"@polkadot/util-crypto": "^2.10.1",
"@types/bn.js": "^4.11.6",
"bn.js": "^5.1.1",
"bn.js": "^5.1.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
},
+25 -3
View File
@@ -7,7 +7,7 @@ import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/t
import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
import { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BabeAuthorityWeight, BabeBlockWeight, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondary, RawBabePreDigestSecondaryTo159, RawBabePreDigestTo159, SlotNumber, VrfData, VrfProof } from '@polkadot/types/interfaces/babe';
import { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondary, RawBabePreDigestSecondaryTo159, RawBabePreDigestTo159, SlotNumber, VrfData, VrfProof } from '@polkadot/types/interfaces/babe';
import { AccountData, BalanceLock, BalanceLockTo212, Reasons, ReleasesBalances, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import { BlockHash } from '@polkadot/types/interfaces/chain';
import { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
@@ -15,8 +15,8 @@ import { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claim
import { MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
import { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
import { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, ReleasesDemocracy, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
import { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
import { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
import { Account, Log, Vicinity } from '@polkadot/types/interfaces/evm';
import { EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
@@ -37,6 +37,7 @@ import { FullIdentification, IdentificationTuple, Keys, MembershipProof, Session
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, OffchainAccuracy, PerU16, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import { AccountInfo, ChainProperties, ChainType, DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount } from '@polkadot/types/interfaces/system';
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
@@ -301,6 +302,9 @@ declare module '@polkadot/types/types/registry' {
RawAuraPreDigest: RawAuraPreDigest;
'Option<RawAuraPreDigest>': Option<RawAuraPreDigest>;
'Vec<RawAuraPreDigest>': Vec<RawAuraPreDigest>;
AllowedSlots: AllowedSlots;
'Option<AllowedSlots>': Option<AllowedSlots>;
'Vec<AllowedSlots>': Vec<AllowedSlots>;
BabeAuthorityWeight: BabeAuthorityWeight;
'Compact<BabeAuthorityWeight>': Compact<BabeAuthorityWeight>;
'Option<BabeAuthorityWeight>': Option<BabeAuthorityWeight>;
@@ -322,6 +326,12 @@ declare module '@polkadot/types/types/registry' {
EpochAuthorship: EpochAuthorship;
'Option<EpochAuthorship>': Option<EpochAuthorship>;
'Vec<EpochAuthorship>': Vec<EpochAuthorship>;
NextConfigDescriptor: NextConfigDescriptor;
'Option<NextConfigDescriptor>': Option<NextConfigDescriptor>;
'Vec<NextConfigDescriptor>': Vec<NextConfigDescriptor>;
NextConfigDescriptorV1: NextConfigDescriptorV1;
'Option<NextConfigDescriptorV1>': Option<NextConfigDescriptorV1>;
'Vec<NextConfigDescriptorV1>': Vec<NextConfigDescriptorV1>;
Randomness: Randomness;
'Option<Randomness>': Option<Randomness>;
'Vec<Randomness>': Vec<Randomness>;
@@ -493,6 +503,9 @@ declare module '@polkadot/types/types/registry' {
ReferendumStatus: ReferendumStatus;
'Option<ReferendumStatus>': Option<ReferendumStatus>;
'Vec<ReferendumStatus>': Vec<ReferendumStatus>;
ReleasesDemocracy: ReleasesDemocracy;
'Option<ReleasesDemocracy>': Option<ReleasesDemocracy>;
'Vec<ReleasesDemocracy>': Vec<ReleasesDemocracy>;
Tally: Tally;
'Option<Tally>': Option<Tally>;
'Vec<Tally>': Vec<Tally>;
@@ -512,6 +525,12 @@ declare module '@polkadot/types/types/registry' {
'Compact<ApprovalFlag>': Compact<ApprovalFlag>;
'Option<ApprovalFlag>': Option<ApprovalFlag>;
'Vec<ApprovalFlag>': Vec<ApprovalFlag>;
DefunctVoter: DefunctVoter;
'Option<DefunctVoter>': Option<DefunctVoter>;
'Vec<DefunctVoter>': Vec<DefunctVoter>;
Renouncing: Renouncing;
'Option<Renouncing>': Option<Renouncing>;
'Vec<Renouncing>': Vec<Renouncing>;
SetIndex: SetIndex;
'Compact<SetIndex>': Compact<SetIndex>;
'Option<SetIndex>': Option<SetIndex>;
@@ -965,6 +984,9 @@ declare module '@polkadot/types/types/registry' {
ValidatorPrefsTo145: ValidatorPrefsTo145;
'Option<ValidatorPrefsTo145>': Option<ValidatorPrefsTo145>;
'Vec<ValidatorPrefsTo145>': Vec<ValidatorPrefsTo145>;
WeightToFeeCoefficient: WeightToFeeCoefficient;
'Option<WeightToFeeCoefficient>': Option<WeightToFeeCoefficient>;
'Vec<WeightToFeeCoefficient>': Vec<WeightToFeeCoefficient>;
AccountInfo: AccountInfo;
'Option<AccountInfo>': Option<AccountInfo>;
'Vec<AccountInfo>': Vec<AccountInfo>;
+1 -1
View File
@@ -332,7 +332,7 @@ export class TypeRegistry implements Registry {
const unknown = findUnknownExtensions(this.#signedExtensions);
if (unknown.length) {
console.warn(`Unknown signed extensions ${unknown.join(', ')} found, treating them as no-efect`);
console.warn(`Unknown signed extensions ${unknown.join(', ')} found, treating them as no-effect`);
}
}
}
@@ -102,6 +102,14 @@ export default class ExtrinsicPayload extends Base<ExtrinsicPayloadVx> {
return (this._raw as ExtrinsicPayloadV2).tip || this.registry.createType('Compact<Balance>');
}
/**
* @description The transaction version as a [[u32]] for this payload
*/
public get transactionVersion (): u32 {
// NOTE only v4+
return (this._raw as ExtrinsicPayloadV4).transactionVersion || this.registry.createType('u32');
}
/**
* @description Compares the value of the input to see if there is a match
*/
@@ -16,6 +16,9 @@ export default {
}
},
types: {
AllowedSlots: {
_enum: ['PrimarySlots', 'PrimaryAndSecondaryPlainSlots', 'PrimaryAndSecondaryVRFSlots']
},
BabeAuthorityWeight: 'u64',
BabeBlockWeight: 'u32',
MaybeRandomness: 'Option<Randomness>',
@@ -26,6 +29,16 @@ export default {
primary: 'Vec<u64>',
secondary: 'Vec<u64>'
},
NextConfigDescriptor: {
_enum: {
V0: 'Null',
V1: 'NextConfigDescriptorV1'
}
},
NextConfigDescriptorV1: {
c: '(u64, u64)',
allowedSlots: 'AllowedSlots'
},
Randomness: 'Hash',
RawBabePreDigest: {
_enum: {
@@ -1,10 +1,18 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import { ITuple } from '@polkadot/types/types';
import { Enum, Option, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { u32, u64 } from '@polkadot/types/primitive';
import { Hash } from '@polkadot/types/interfaces/runtime';
/** @name AllowedSlots */
export interface AllowedSlots extends Enum {
readonly isPrimarySlots: boolean;
readonly isPrimaryAndSecondaryPlainSlots: boolean;
readonly isPrimaryAndSecondaryVrfSlots: boolean;
}
/** @name BabeAuthorityWeight */
export interface BabeAuthorityWeight extends u64 {}
@@ -26,6 +34,19 @@ export interface MaybeRandomness extends Option<Randomness> {}
/** @name MaybeVrf */
export interface MaybeVrf extends Option<VrfData> {}
/** @name NextConfigDescriptor */
export interface NextConfigDescriptor extends Enum {
readonly isV0: boolean;
readonly isV1: boolean;
readonly asV1: NextConfigDescriptorV1;
}
/** @name NextConfigDescriptorV1 */
export interface NextConfigDescriptorV1 extends Struct {
readonly c: ITuple<[u64, u64]>;
readonly allowedSlots: AllowedSlots;
}
/** @name Randomness */
export interface Randomness extends Hash {}
@@ -28,6 +28,7 @@ export { default as scheduler } from './scheduler/definitions';
export { default as session } from './session/definitions';
export { default as society } from './society/definitions';
export { default as staking } from './staking/definitions';
export { default as support } from './support/definitions';
export { default as system } from './system/definitions';
export { default as treasury } from './treasury/definitions';
export { default as txpayment } from './txpayment/definitions';
@@ -96,6 +96,9 @@ export default {
delay: 'BlockNumber',
tally: 'Tally'
},
ReleasesDemocracy: {
_enum: ['V1']
},
Tally: {
ayes: 'Balance',
nays: 'Balance',
@@ -112,6 +112,11 @@ export interface ReferendumStatus extends Struct {
readonly tally: Tally;
}
/** @name ReleasesDemocracy */
export interface ReleasesDemocracy extends Enum {
readonly isV1: boolean;
}
/** @name Tally */
export interface Tally extends Struct {
readonly ayes: Balance;
@@ -11,6 +11,18 @@ export default {
rpc: {},
types: {
ApprovalFlag: 'u32',
DefunctVoter: {
who: 'AccountId',
voteCount: 'Compact<u32>',
candidateCount: 'Compact<u32>'
},
Renouncing: {
_enum: {
Member: 'Null',
RunnerUp: 'Null',
Candidate: 'Compact<u32>'
}
},
SetIndex: 'u32',
Vote: 'GenericVote',
VoteIndex: 'u32',
@@ -1,14 +1,29 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import { Enum, Struct } from '@polkadot/types/codec';
import { Compact, Enum, Struct } from '@polkadot/types/codec';
import { GenericVote } from '@polkadot/types/generic';
import { u32 } from '@polkadot/types/primitive';
import { Balance } from '@polkadot/types/interfaces/runtime';
import { AccountId, Balance } from '@polkadot/types/interfaces/runtime';
/** @name ApprovalFlag */
export interface ApprovalFlag extends u32 {}
/** @name DefunctVoter */
export interface DefunctVoter extends Struct {
readonly who: AccountId;
readonly voteCount: Compact<u32>;
readonly candidateCount: Compact<u32>;
}
/** @name Renouncing */
export interface Renouncing extends Enum {
readonly isMember: boolean;
readonly isRunnerUp: boolean;
readonly isCandidate: boolean;
readonly asCandidate: Compact<u32>;
}
/** @name SetIndex */
export interface SetIndex extends u32 {}
@@ -0,0 +1,20 @@
// 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.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
rpc: {},
types: {
WeightToFeeCoefficient: {
coeffInteger: 'Balance',
coeffFrac: 'Perbill',
negative: 'bool',
degree: 'u8'
}
}
} as Definitions;
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types';
@@ -0,0 +1,16 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import { Struct } from '@polkadot/types/codec';
import { bool, u8 } from '@polkadot/types/primitive';
import { Balance, Perbill } from '@polkadot/types/interfaces/runtime';
/** @name WeightToFeeCoefficient */
export interface WeightToFeeCoefficient extends Struct {
readonly coeffInteger: Balance;
readonly coeffFrac: Perbill;
readonly negative: bool;
readonly degree: u8;
}
export type PHANTOM_SUPPORT = 'support';
@@ -7,6 +7,6 @@ import { Definitions } from '../../types';
export default {
rpc: {},
types: {
Multiplier: 'Fixed64'
Multiplier: 'Fixed128'
}
} as Definitions;
@@ -1,9 +1,9 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import { Fixed64 } from '@polkadot/types/interfaces/runtime';
import { Fixed128 } from '@polkadot/types/interfaces/runtime';
/** @name Multiplier */
export interface Multiplier extends Fixed64 {}
export interface Multiplier extends Fixed128 {}
export type PHANTOM_TXPAYMENT = 'txpayment';
+1
View File
@@ -24,6 +24,7 @@ export * from './scheduler/types';
export * from './session/types';
export * from './society/types';
export * from './staking/types';
export * from './support/types';
export * from './system/types';
export * from './treasury/types';
export * from './txpayment/types';
+2 -2
View File
@@ -12,8 +12,8 @@ import Bytes from './Bytes';
export interface StorageEntry {
(arg?: any): Uint8Array;
iterKey?: Uint8Array & Codec;
keyPrefix: Uint8Array;
iterKey?: (arg?: any) => Uint8Array & Codec;
keyPrefix: (arg?: any) => Uint8Array;
meta: StorageEntryMetadataLatest;
method: string;
prefix: string;
+454 -379
View File
File diff suppressed because it is too large Load Diff