Compare commits

..
51 Commits
Author SHA1 Message Date
Github Actions f6490217ec [CI Skip] 1.1.1
skip-checks: true
2020-02-06 15:12:35 +00:00
Jaco Greeff 601cc62d70 1.1 (#1815) 2020-02-06 16:05:04 +01:00
Github Actions 201480be56 [CI Skip] 1.1.0-beta.22
skip-checks: true
2020-02-06 14:17:09 +00:00
Jaco Greeff 519823bc0e Add resolver for jest (#1813) 2020-02-06 15:09:36 +01:00
Github Actions 0b134c1eb8 [CI Skip] 1.1.0-beta.21
skip-checks: true
2020-02-06 13:16:34 +00:00
Jaco Greeff e6e96aa9c9 Make indices module optional (#1812)
* Make indices optional

* Updtae contracts with optional creation

* Flatten contract fees
2020-02-06 14:09:29 +01:00
Github Actions 84d0d8594e [CI Skip] 1.1.0-beta.20
skip-checks: true
2020-02-06 09:54:57 +00:00
Jaco Greeff 6be25966d8 Enum .toJSON() to return type name as specified (#1811)
* Enum `.toJSON()` to return type name as specified

* Fix text compares
2020-02-06 10:48:33 +01:00
Github Actions a5eb11e5f3 [CI Skip] 1.1.0-beta.19
skip-checks: true
2020-02-05 15:22:43 +00:00
Jaco Greeff 19f87aac4d Council memebrs with no election info (#1810) 2020-02-05 16:15:36 +01:00
Github Actions b217a59310 [CI Skip] 1.1.0-beta.18
skip-checks: true
2020-02-05 14:23:56 +00:00
Jaco Greeff 2de7a3c130 Add .keyPrefix for storage keys (#1809)
* Add .keyPrefix for storage keys

* Fix hex length
2020-02-05 15:15:49 +01:00
Github Actions deecf4853e [CI Skip] 1.1.0-beta.17
skip-checks: true
2020-02-04 15:19:57 +00:00
Jaco Greeff 8889e69341 Bump common (#1807)
* Bump common

* yarn.lock
2020-02-04 16:12:18 +01:00
Github Actions 14194a363e [CI Skip] 1.1.0-beta.16
skip-checks: true
2020-02-04 11:23:05 +00:00
Jaco Greeff 9c50e81ab9 Cleanup sanitize boxes (#1805)
* Cleanup sanitize boxes

* yarn.lock

* Add space before box as allowed
2020-02-04 12:16:18 +01:00
Jaco Greeff 6505e73355 Adjust submittable augmentation (#1806)
* Adjust submittable augmentation

* Add missing extends
2020-02-04 12:15:42 +01:00
Github Actions cefeb37ae6 [CI Skip] 1.1.0-beta.15
skip-checks: true
2020-02-03 16:32:53 +00:00
Jaco Greeff 9e29e89baf Update known extensions (with Polkadot) (#1800)
* Update known extensions (with Polkadot)

* Split definitions for signed extensions
2020-02-03 17:25:33 +01:00
Github Actions b82c90679d [CI Skip] 1.1.0-beta.14
skip-checks: true
2020-02-03 12:49:36 +00:00
Jaco Greeff eeb8d20e58 Bump common (detection) (#1799) 2020-02-03 13:42:49 +01:00
Github Actions b891edbd37 [CI Skip] 1.1.0-beta.13
skip-checks: true
2020-02-03 11:03:16 +00:00
Jaco Greeff 2ee3afcd61 Expand enum & struct defnitions, generator strict mode (#1798) 2020-02-03 11:56:06 +01:00
Github Actions 328630fb17 [CI Skip] 1.1.0-beta.12
skip-checks: true
2020-02-03 09:27:36 +00:00
Jaco Greeff 325080cf71 Cleanup some generation duplication (#1797)
* Cleanup some generation duplicaton

* Override for Metadata import

* Import order in generators
2020-02-03 10:20:33 +01:00
Github Actions 549a536328 [CI Skip] 1.1.0-beta.11
skip-checks: true
2020-02-02 19:26:52 +00:00
Jaco Greeff 23f41a0bab Exclude all augment from cc 2020-02-02 20:19:41 +01:00
Jaco Greeff 5e0c0ba91a Align jsonrpc augmentation with others (#1796) 2020-02-02 20:16:41 +01:00
Github Actions 812a077e63 [CI Skip] 1.1.0-beta.10
skip-checks: true
2020-02-02 18:54:18 +00:00
Jaco Greeff 6ba28c8ad2 Expand simple enums in type generation (#1795) 2020-02-02 19:47:19 +01:00
Github Actions 6cd0074ce4 [CI Skip] 1.1.0-beta.9
skip-checks: true
2020-02-02 18:24:56 +00:00
Jaco Greeff b3d592357f Override for Vote type (not a struct, not caught) (#1794)
* Override for Vote type (not a struct, not caught)

* Generate simple Vote object (first, Struct to be done)

* Comment for hex type (string)

* Expand conviction (like we should on enum)

* Cool, use conviction def for input

* aye is required

* Remove FIXMEs
2020-02-02 19:17:33 +01:00
Github Actions f499946f1f [CI Skip] 1.1.0-beta.8
skip-checks: true
2020-02-02 08:19:04 +00:00
Jaco Greeff 56e28bed7f Rename frozenFee (#1792) 2020-02-02 09:11:49 +01:00
Github Actions c76fb20a83 [CI Skip] 1.1.0-beta.7
skip-checks: true
2020-02-02 07:57:22 +00:00
Jaco Greeff 9d4b0ea56a Update Substrate with vesting (#1790)
* Update Substrate with vesting

* Update balances & vesting queries with compat)

* Split base account queries

* Linting, simpler referendum voters

* Fix (some) tests
2020-02-02 08:50:37 +01:00
Github Actions f9d569ddd1 [CI Skip] 1.1.0-beta.6
skip-checks: true
2020-02-01 20:27:44 +00:00
Jaco Greeff 7221a3637c Add UInt .isMax() (#1791)
* Add UInt .isMax()

* Filter lockedBlance by max
2020-02-01 21:20:48 +01:00
Github Actions 438c830366 [CI Skip] 1.1.0-beta.5
skip-checks: true
2020-02-01 17:47:00 +00:00
Jaco Greeff 3d0fd5a6a8 Warn on unknown extensions (once per registry) (#1788) 2020-02-01 18:40:45 +01:00
Github Actions de57876c7f [CI Skip] 1.1.0-beta.4
skip-checks: true
2020-02-01 13:24:47 +00:00
Jaco Greeff b24a1ff350 SignedExtension injection into payload (#1778)
* Make a start ... V11 definitions

* V11 conversion

* Fix ErrorMetadataV11

* Extension point for signed extensions

* Add V11 to mapped

* Expand toLatest comments

* Make a start at signer extension defs

* exports

* Extract extension definitions

* Add extension registration

* Remove old override

* Get definition on extrinsic creation

* Add missing V4 base

* Optional extrinsic

* Pull extrinsic version from metadata (if available)

* asLatest.extrinsic should now be available

* Don't export non-types for Extrinsic

* Setup registry with default extensions

* Async test really runs async

* Trace test failures (V1 orig, V4 now)

* CHANGELOG

* Add extension data to actual signature

* Cleanups

* Return cleanups

* Mark all type deocde static internal

* Apply extensions fully to payload

* Cleanup duplication

* ExtrinsicSignature* via createType
2020-02-01 14:17:17 +01:00
Github Actions 5f8c623179 [CI Skip] 1.1.0-beta.3
skip-checks: true
2020-02-01 11:07:19 +00:00
Jaco Greeff 00026a173f Keep original doc-line formats (#1787) 2020-02-01 11:59:47 +01:00
Github Actions 8da895efd4 [CI Skip] 1.1.0-beta.2
skip-checks: true
2020-02-01 10:23:48 +00:00
Jaco Greeff 89d029eca3 Expand bool & Enum generation (#1785)
* Expand bool & Enum generation

* Swap consts to Augmented (align with others)
2020-02-01 11:16:27 +01:00
Github Actions ac2a7eea67 [CI Skip] 1.1.0-beta.1
skip-checks: true
2020-01-31 21:42:23 +00:00
Jaco Greeff 4f0e573adf Cleanup to tx generation (#1784) 2020-01-31 22:34:24 +01:00
Github Actions 8417eff2b3 [CI Skip] 1.1.0-beta.0
skip-checks: true
2020-01-31 14:41:36 +00:00
Jaco Greeff 4aa5693906 Extend type generation (#1783)
* Cleanup type overrides

* Generate (with catch-all removal)

* Progress

* Re-gen tx types

* Remove unneeded option check

* Linting updates

* Update CHANGELOG (cleanups as per comments)
2020-01-31 15:34:06 +01:00
Jaco Greeff 982665c337 Update CHANGELOG with missing change (#1782) 2020-01-30 17:22:56 +01:00
170 changed files with 7711 additions and 4486 deletions
+1 -1
View File
@@ -4,6 +4,6 @@ exclude_patterns:
- "**/*.test.js"
- "**/*.test.ts"
- "docs/**/*.js"
- "packages/api/src/query.types.ts"
- "packages/api/src/types/augment/"
- "packages/types/src/interfaces/"
- "packages/types/src/scripts/"
+20 -6
View File
@@ -1,19 +1,33 @@
# 1.1.1
- Add support for `balances.account` in all applicable derives (incl. `vesting` module)
- Inject and use SignedExtensions by name from V11 metadata (V4 extrinsics only)
- Add typings for `api.tx.*.*` - the `polkadot-types-from-chain` now also generates these
- Remove additional V1-only derives `(staking.recentlyOffline`, `balances.nominatorsFor`)
- Add `.isMax()` on int values, an opposite of `isZero()` (e.g. `u128`, as well as derived, e.g. `Balances`)
- Add `.keyPrefix()` to all `api.query.*` complementing the `.key()` call, both returning a hex string
- Council derives now takes bootstrapping (member, no elections) into account
- Account derives now allow for an optional indices module (not required)
- Adjust balances fees derivation with optional transfer and creation fees (removed in Substrate)
- Adjust enum `.toJSON()` to return type name as specified
# 1.0.1
- **Breaking change** Drop support for Substrate v1 chain in all derives
- Return unsub functions from provider .on emitters (Thanks to https://github.com/jak-pan)
- `ApiPromise.isReady` now rejects on unrecoverable errors (Thanks to https://github.com/laec)
- Add `polkadot-types-from-chain` & `polkadot-types-from-defs` TypeScript generators to `@polkadot/types`
- Only decorate derives where relevant parent `api.query.*` is available
- Support `.entries(arg?: any)` lookups on DoubleMaps (in addition to previously supported maps)
- Remove un-deployed support for v11 metadata (this was decided against on Substrate)
- Allow v9 metadata to parse even in cases where it was wrongly deployed pre-v10
- Allow type-aliasses on a per-module basis (e.g. `Judgement` in identity as well as society)
- Allow type-aliases on a per-module basis (e.g. `Judgement` in identity as well as society)
- Allow passing `{ signer }` to both `api.tx.*` and `api.sign` (in addition to `api.setSigner`)
- Add derives for the society module
- Don't map empy tuples, e.. `()` to `Null`, rather keep them empty
- Add lookups to the metadata erros via `findMetaError`
- Update metadata and types for the lastest Substrate & Polkadot versions
- Support metadata V11 as per lastest Substrate
- Don't map empty tuples, e.. `()` to `Null`, rather keep them empty
- Add lookups to the metadata errors via `findMetaError`
- Update metadata and types for the latest Substrate & Polkadot versions
- Support metadata V11 as per latest Substrate
- Remove support for un-deployed metadata
- Remove old known types for Substrate V1
# 0.100.1
+2 -1
View File
@@ -31,5 +31,6 @@ module.exports = Object.assign({}, config, {
ws_local_polkadot_alex: 'ws://127.0.0.1:9949/',
ws_substrate_1: 'wss://substrate-rpc.parity.io/',
ws_polkadot_alex: 'wss://poc3-rpc.polkadot.io/'
}
},
resolver: './jest.resolver.js'
});
+15
View File
@@ -0,0 +1,15 @@
// Copyright 2017-2020 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('path');
module.exports = function resolver (file, config) {
if (file.includes('package.json')) {
console.error(file, config);
return path.join(config.basedir.replace('/src', '/'), file);
}
return config.defaultResolver(file, config);
};
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.0.1"
"version": "1.1.1"
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "1.1.1",
"private": true,
"engines": {
"yarn": "^1.10.1"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.0.1",
"version": "1.1.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -27,6 +27,6 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/types": "^1.0.1"
"@polkadot/types": "^1.1.1"
}
}
+2 -2
View File
@@ -3,9 +3,9 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { ApiTypes, DecorateMethod, DecoratedRpc, SubmittableModuleExtrinsics } from '@polkadot/api/types';
import { ApiObject, ContractABIMessage, ContractABIPre, ContractBase, ContractMessage } from '../types';
import { RpcInterface } from '@polkadot/rpc-core/jsonrpc.types';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { Registry } from '@polkadot/types/types';
import { ApiObject, ContractABIMessage, ContractABIPre, ContractBase, ContractMessage } from '../types';
import { assert, isFunction, stringCamelCase } from '@polkadot/util';
import Abi from '../Abi';
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.0.1",
"version": "1.1.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -28,10 +28,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/api": "^1.0.1",
"@polkadot/types": "^1.0.1"
"@polkadot/api": "^1.1.1",
"@polkadot/types": "^1.1.1"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.1"
"@polkadot/keyring": "^2.2.1"
}
}
@@ -4,7 +4,7 @@
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import { Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ENUMSET_SIZE } from '@polkadot/types/primitive/Generic/AccountIndex';
@@ -26,18 +26,18 @@ import { memo } from '../util';
* ```
*/
export function indexToId (api: ApiInterfaceRx): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined> {
const querySection = api.query.indices || api.query.balances;
return memo((_accountIndex: AccountIndex | string): Observable<AccountId | undefined> => {
const accountIndex = _accountIndex instanceof ClassOf(api.registry, 'AccountIndex')
? _accountIndex
: createType(api.registry, 'AccountIndex', _accountIndex);
return querySection.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)).pipe(
startWith([]),
map((accounts): AccountId | undefined =>
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
return api.query.indices.enumSet
? api.query.indices.enumSet<Vec<AccountId>>(accountIndex.div(ENUMSET_SIZE)).pipe(
startWith([]),
map((accounts): AccountId | undefined =>
(accounts || [])[accountIndex.mod(ENUMSET_SIZE).toNumber()]
)
)
);
: of(undefined);
});
}
+13 -9
View File
@@ -6,7 +6,7 @@ import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import { AccountIndexes } from '../types';
import { Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ENUMSET_SIZE } from '@polkadot/types/primitive/Generic/AccountIndex';
import { Vec, createType } from '@polkadot/types';
@@ -32,14 +32,18 @@ const enumsetSize = ENUMSET_SIZE.toNumber();
*/
export function indexes (api: ApiInterfaceRx): () => Observable<AccountIndexes> {
return memo((): Observable<AccountIndexes> =>
api.query.indices.nextEnumSet<AccountIndex>().pipe(
// use the nextEnumSet (which is a counter of the number of sets) to construct
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
// containing an AccountId
switchMap((next: AccountIndex): Observable<Vec<AccountId>[]> =>
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
),
(api.query.indices.nextEnumSet
? api.query.indices.nextEnumSet<AccountIndex>().pipe(
// use the nextEnumSet (which is a counter of the number of sets) to construct
// a range of values to query [0, 1, 2, ...]. Retrieve the full enum set for the
// specific index - each query can return up to ENUMSET_SIZE (64) records, each
// containing an AccountId
switchMap((next: AccountIndex): Observable<Vec<AccountId>[]> =>
api.query.indices.enumSet.multi<Vec<AccountId>>([...Array(next.toNumber() + 1).keys()])
)
)
: of([] as AccountId[][])
).pipe(
map((all: AccountId[][]): AccountIndexes =>
all.reduce((result: AccountIndexes, list, outerIndex): AccountIndexes => {
(list || []).forEach((accountId, innerIndex): void => {
@@ -0,0 +1,84 @@
// 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 { AccountId, AccountData, AccountIndex, Address, Balance, Index } from '@polkadot/types/interfaces';
import { DerivedBalancesAccount } from '../types';
import { combineLatest, of, Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { createType } from '@polkadot/types';
import { memo } from '../util';
type Result = [Balance, Balance, Balance, Balance, Index];
function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBalance, frozenFee, frozenMisc, accountNonce]]: [AccountId, Result]): DerivedBalancesAccount {
return {
accountId,
accountNonce,
freeBalance,
frozenFee,
frozenMisc,
reservedBalance,
votingBalance: createType(api.registry, 'Balance', freeBalance.add(reservedBalance))
};
}
// old
function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[Balance, Balance, Index]>([
[api.query.balances.freeBalance, accountId],
[api.query.balances.reservedBalance, accountId],
[api.query.system.accountNonce, accountId]
]).pipe(
map(([freeBalance, reservedBalance, accountNonce]): Result =>
[freeBalance, reservedBalance, createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), accountNonce]
)
);
}
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
return api.queryMulti<[AccountData, Index]>([
[api.query.balances.account, accountId],
[api.query.system.accountNonce, accountId]
]).pipe(
map(([{ free, reserved, miscFrozen, feeFrozen }, accountNonce]): Result =>
[free, reserved, feeFrozen, miscFrozen, accountNonce]
)
);
}
/**
* @name account
* @param {( AccountIndex | AccountId | Address | string )} address - An accounts Id in different formats.
* @returns An object containing the results of various balance queries
* @example
* <BR>
*
* ```javascript
* const ALICE = 'F7Hs';
*
* api.derive.balances.all(ALICE, ({ accountId, lockedBalance }) => {
* console.log(`The account ${accountId} has a locked balance ${lockedBalance} units.`);
* });
* ```
*/
export function account (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalancesAccount> {
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalancesAccount> =>
api.derive.accounts.info(address).pipe(
switchMap(({ accountId }): Observable<[AccountId, Result]> =>
(accountId
? combineLatest([
of(accountId),
api.query.balances.account
? queryCurrent(api, accountId)
: queryOld(api, accountId)
])
: of([createType(api.registry, 'AccountId'), [createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Index')]])
)
),
map((result): DerivedBalancesAccount => calcBalances(api, result))
));
}
+70 -29
View File
@@ -2,8 +2,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountIndex, Address, Balance, BalanceLock, BlockNumber, Index, VestingSchedule } from '@polkadot/types/interfaces';
import { DerivedBalances } from '../types';
import { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
import { DerivedBalancesAccount, DerivedBalancesAll } from '../types';
import BN from 'bn.js';
import { combineLatest, of, Observable } from 'rxjs';
@@ -14,29 +14,32 @@ import { bnMax } from '@polkadot/util';
import { memo } from '../util';
type ResultBalance = [Balance, Balance, BalanceLock[], Option<VestingSchedule>, Index];
type Result = [AccountId, BlockNumber, ResultBalance];
type ResultBalance = [VestingInfo | null, (BalanceLock | BalanceLockTo212)[]];
type Result = [DerivedBalancesAccount, BlockNumber, ResultBalance];
function calcBalances (api: ApiInterfaceRx, [accountId, bestNumber, [freeBalance, reservedBalance, locks, vesting, accountNonce]]: Result): DerivedBalances {
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[] = [];
let lockedBreakdown: (BalanceLock | BalanceLockTo212)[] = [];
if (Array.isArray(locks)) {
// only get the locks that are valid until passed the current block
lockedBreakdown = locks.filter(({ until }): boolean => bestNumber && until.gt(bestNumber));
lockedBreakdown = (locks as BalanceLockTo212[]).filter(({ until }): boolean => !until || (bestNumber && until.gt(bestNumber)));
const notAll = lockedBreakdown.filter(({ 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 (lockedBreakdown.length) {
lockedBalance = createType(api.registry, 'Balance', bnMax(...lockedBreakdown.map(({ amount }): Balance => amount)));
if (notAll.length) {
lockedBalance = createType(api.registry, 'Balance', bnMax(...notAll.map(({ amount }): Balance => amount)));
}
}
// Calculate the vesting balances,
// - offset = balance locked at genesis,
// - offset = balance locked at startingBlock
// - perBlock is the unlock amount
const { offset: vestingTotal, perBlock } = vesting.unwrapOr(createType(api.registry, 'VestingSchedule'));
const vestedBalance = createType(api.registry, 'Balance', perBlock.mul(bestNumber));
const isVesting = vestedBalance.lt(vestingTotal);
const { locked: vestingTotal, perBlock, startingBlock } = vesting || createType(api.registry, 'VestingInfo');
const isStarted = bestNumber.gt(startingBlock);
const vestedBalance = createType(api.registry, 'Balance', isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : 0);
const isVesting = isStarted && vestedBalance.lt(vestingTotal);
// The available balance & vested has an interplay here
// "
@@ -54,16 +57,58 @@ function calcBalances (api: ApiInterfaceRx, [accountId, bestNumber, [freeBalance
accountNonce,
availableBalance,
freeBalance,
frozenFee,
frozenMisc,
isVesting,
lockedBalance,
lockedBreakdown,
reservedBalance,
vestedBalance,
vestingTotal,
votingBalance: createType(api.registry, 'Balance', freeBalance.add(reservedBalance))
votingBalance
};
}
// old
function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
return api.queryMulti<[Vec<BalanceLock>, Option<VestingSchedule>]>([
[api.query.balances.locks, accountId],
[api.query.balances.vesting, accountId]
]).pipe(
map(([locks, optVesting]): ResultBalance => {
let vestingNew = null;
if (optVesting.isSome) {
const { offset: locked, perBlock, startingBlock } = optVesting.unwrap();
vestingNew = createType(api.registry, 'VestingInfo', { locked, perBlock, startingBlock });
}
return [vestingNew, locks];
})
);
}
// current (balances vesting)
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
return (
api.query.vesting.vesting
? api.queryMulti<[Vec<BalanceLock>, Option<VestingInfo>]>([
[api.query.balances.locks, accountId],
[api.query.vesting.vesting, accountId]
])
: api.query.balances.locks(accountId).pipe(
map((locks): [Vec<BalanceLock>, Option<VestingInfo>] =>
[locks, createType(api.registry, 'Option<VestingInfo>')]
)
)
).pipe(
map(([locks, optVesting]): ResultBalance =>
[optVesting.unwrapOr(null), locks]
)
);
}
/**
* @name all
* @param {( AccountIndex | AccountId | Address | string )} address - An accounts Id in different formats.
@@ -79,25 +124,21 @@ function calcBalances (api: ApiInterfaceRx, [accountId, bestNumber, [freeBalance
* });
* ```
*/
export function all (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalances> {
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalances> =>
api.derive.accounts.info(address).pipe(
switchMap(({ accountId }): Observable<Result> =>
(accountId
export function all (api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DerivedBalancesAll> {
return memo((address: AccountIndex | AccountId | Address | string): Observable<DerivedBalancesAll> =>
api.derive.balances.account(address).pipe(
switchMap((account): Observable<Result> =>
(!account.accountId.isEmpty
? combineLatest([
of(accountId),
of(account),
api.derive.chain.bestNumber(),
api.queryMulti<[Balance, Balance, Vec<BalanceLock>, Option<VestingSchedule>, Index]>([
[api.query.balances.freeBalance, accountId],
[api.query.balances.reservedBalance, accountId],
[api.query.balances.locks, accountId],
[api.query.balances.vesting, accountId],
[api.query.system.accountNonce, accountId]
])
api.query.balances.account
? queryCurrent(api, account.accountId)
: queryOld(api, account.accountId)
])
: of([createType(api.registry, 'AccountId'), createType(api.registry, 'BlockNumber'), [createType(api.registry, 'Balance'), createType(api.registry, 'Balance'), createType(api.registry, 'Vec<BalanceLock>'), createType(api.registry, 'Option<VestingSchedule>', null), createType(api.registry, 'Index')]])
: of([account, createType(api.registry, 'BlockNumber'), [null, createType(api.registry, 'Vec<BalanceLock>')]])
)
),
map((result): DerivedBalances => calcBalances(api, result))
map((result): DerivedBalancesAll => calcBalances(api, result))
));
}
+9 -9
View File
@@ -8,22 +8,22 @@ import { DerivedFees } from '../types';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { createType } from '@polkadot/types';
import { memo } from '../util';
type Result = [Balance, Balance, Balance, Balance, Balance];
function query (api: ApiInterfaceRx): Observable<Result> {
const paymentBase = api.consts.transactionPayment || api.consts.balances;
return of([
// get values from api.const for substrate versions post spec_version: 101
// https://github.com/paritytech/substrate/pull/2883/files#diff-5e5e1c3aec9ddfde0a9054d062ab3db9R131
api.consts.balances.creationFee,
// deprecated - remove
(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.balances.transferFee,
paymentBase.transactionBaseFee as Balance,
paymentBase.transactionByteFee as Balance
api.consts.transactionPayment.transactionBaseFee,
api.consts.transactionPayment.transactionByteFee
]);
}
@@ -43,7 +43,7 @@ function query (api: ApiInterfaceRx): Observable<Result> {
export function fees (api: ApiInterfaceRx): () => Observable<DerivedFees> {
return memo((): Observable<DerivedFees> =>
query(api).pipe(
map(([creationFee, existentialDeposit, transferFee, transactionBaseFee, transactionByteFee]): DerivedFees => ({
map(([creationFee, transferFee, existentialDeposit, transactionBaseFee, transactionByteFee]): DerivedFees => ({
creationFee,
existentialDeposit,
transactionBaseFee,
+1 -1
View File
@@ -4,9 +4,9 @@
import { all } from './all';
export * from './account';
export * from './fees';
export * from './votingBalances';
export * from './votingBalancesNominatorsFor';
const votingBalance = all;
@@ -3,20 +3,20 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import { DerivedBalances } from '../types';
import { DerivedBalancesAccount } from '../types';
import { combineLatest, Observable, of } from 'rxjs';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { memo } from '../util';
export function votingBalances (api: ApiInterfaceRx): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DerivedBalances[]> {
return memo((addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DerivedBalances[]> =>
export function votingBalances (api: ApiInterfaceRx): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DerivedBalancesAccount[]> {
return memo((addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DerivedBalancesAccount[]> =>
!addresses || !addresses.length
? of([] as DerivedBalances[])
? of([] as DerivedBalancesAccount[])
: combineLatest(
addresses.map((accountId): Observable<DerivedBalances> =>
api.derive.balances.all(accountId))
addresses.map((accountId): Observable<DerivedBalancesAccount> =>
api.derive.balances.account(accountId))
)
);
}
@@ -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 { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import { DerivedBalances } from '../types';
import { Observable, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Vec } from '@polkadot/types';
import { memo } from '../util';
export function votingBalancesNominatorsFor (api: ApiInterfaceRx): (address: AccountId | AccountIndex | Address | string) => Observable<DerivedBalances[]> {
return memo((address: AccountId | AccountIndex | Address | string): Observable<DerivedBalances[]> =>
api.derive.accounts.info(address).pipe(
switchMap(({ accountId }): Observable<AccountId[]> =>
accountId
? api.query.staking.nominatorsFor<Vec<AccountId>>(accountId)
: of([] as AccountId[])
),
switchMap((accounts): Observable<DerivedBalances[]> =>
api.derive.balances.votingBalances(accounts)
)
));
}
+20 -34
View File
@@ -8,42 +8,27 @@ import { DerivedContractFees } from '../types';
import BN from 'bn.js';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { createType } from '@polkadot/types';
import { memo } from '../util';
type ResultV2 = [BN, BN, BN, BN, BN, BN, BN, BN, BN, BN];
const ZERO = new BN(0);
// parse the result
function parseResult ([callBaseFee, contractFee, createBaseFee, creationFee, rentByteFee, rentDepositOffset, tombstoneDeposit, transactionBaseFee, transactionByteFee, transferFee]: ResultV2): DerivedContractFees {
return {
callBaseFee,
contractFee,
createBaseFee,
creationFee,
rentByteFee,
rentDepositOffset,
tombstoneDeposit,
transactionBaseFee,
transactionByteFee,
transferFee
};
}
type ResultV2 = [BN, BN, BN, BN, BN, BN, BN, BN, BN];
// query via constants (current applicable path)
function queryConstants (api: ApiInterfaceRx): Observable<ResultV2> {
return of([
// deprecated
api.consts.contracts.creationFee || createType(api.registry, 'Balance'),
api.consts.contracts.transferFee || createType(api.registry, 'Balance'),
// current
api.consts.contracts.callBaseFee,
api.consts.contracts.contractFee,
api.consts.contracts.createBaseFee,
api.consts.contracts.creationFee,
api.consts.contracts.rentByteFee,
api.consts.contracts.rentDepositOffset,
api.consts.contracts.tombstoneDeposit,
api.consts.contracts.transactionBaseFee,
api.consts.contracts.transactionByteFee,
api.consts.contracts.transferFee
api.consts.contracts.transactionByteFee
]) as unknown as Observable<ResultV2>;
}
@@ -62,17 +47,18 @@ function queryConstants (api: ApiInterfaceRx): Observable<ResultV2> {
*/
export function fees (api: ApiInterfaceRx): () => Observable<DerivedContractFees> {
return memo((): Observable<DerivedContractFees> => {
return (
api.consts.contracts
? queryConstants(api)
: of([ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO, ZERO])
).pipe(
map(([callBaseFee, contractFee, createBaseFee, creationFee, rentByteFee, rentDepositOffset, tombstoneDeposit, transactionBaseFee, transactionByteFee, transferFee]): DerivedContractFees =>
// We've done this on purpose, i.e. so we can just copy the name/order from the parse above and see gaps
parseResult([
callBaseFee, contractFee, createBaseFee, creationFee, rentByteFee, rentDepositOffset, tombstoneDeposit, transactionBaseFee, transactionByteFee, transferFee
])
)
return queryConstants(api).pipe(
map(([creationFee, transferFee, callBaseFee, contractFee, rentByteFee, rentDepositOffset, tombstoneDeposit, transactionBaseFee, transactionByteFee]): DerivedContractFees => ({
callBaseFee,
contractFee,
creationFee,
rentByteFee,
rentDepositOffset,
tombstoneDeposit,
transactionBaseFee,
transactionByteFee,
transferFee
}))
);
});
}
@@ -10,13 +10,13 @@ import { map, switchMap } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Vec, createType } from '@polkadot/types';
import { DerivedBalances, DerivedReferendumVote } from '../types';
import { DerivedBalancesAccount, DerivedReferendumVote } from '../types';
import { memo } from '../util';
export function referendumVotesFor (api: ApiInterfaceRx): (referendumId: BN | number) => Observable<DerivedReferendumVote[]> {
return memo((referendumId: BN | number): Observable<DerivedReferendumVote[]> =>
api.query.democracy.votersFor<Vec<AccountId>>(referendumId).pipe(
switchMap((votersFor): Observable<[Vec<AccountId>, Vote[], DerivedBalances[]]> =>
switchMap((votersFor): Observable<[Vec<AccountId>, Vote[], DerivedBalancesAccount[]]> =>
combineLatest([
of(votersFor),
api.derive.democracy.votes(referendumId, votersFor),
+11 -4
View File
@@ -13,21 +13,28 @@ import { createType, Vec, u32 } from '@polkadot/types';
import { DerivedElectionsInfo } from '../types';
import { memo } from '../util';
function sortAccounts ([, balanceA]: ITuple<[AccountId, Balance]>, [, balanceB]: ITuple<[AccountId, Balance]>): number {
return balanceB.cmp(balanceA);
}
function queryElections (api: ApiInterfaceRx): Observable<DerivedElectionsInfo> {
const section = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections';
return api.queryMulti<[Vec<AccountId>, Vec<ITuple<[AccountId, Balance]>>, Vec<ITuple<[AccountId, Balance]>>]>([
return api.queryMulti<[Vec<AccountId>, Vec<AccountId>, Vec<ITuple<[AccountId, Balance]>>, Vec<ITuple<[AccountId, Balance]>>]>([
api.query.council.members,
api.query[section].candidates,
api.query[section].members,
api.query[section].runnersUp
]).pipe(
map(([candidates, members, runnersUp]): DerivedElectionsInfo => ({
map(([councilMembers, candidates, members, runnersUp]): DerivedElectionsInfo => ({
candidates,
candidateCount: createType(api.registry, 'u32', candidates.length),
candidacyBond: api.consts[section].candidacyBond as Balance,
desiredSeats: api.consts[section].desiredMembers as u32,
members: members.sort((a, b): number => b[1].cmp(a[1])),
runnersUp: runnersUp.sort((a, b): number => b[1].cmp(a[1])),
members: members.length
? members.sort(sortAccounts)
: councilMembers.map((accountId): [AccountId, Balance] => [accountId, createType(api.registry, 'Balance')]),
runnersUp: runnersUp.sort(sortAccounts),
termDuration: api.consts[section].termDuration as BlockNumber,
votingBond: api.consts[section].votingBond as Balance
}))
-2
View File
@@ -45,7 +45,6 @@ describe('derive', (): void => {
testFunction(api)('balances', 'fees', []);
testFunction(api)('balances', 'votingBalance', []);
testFunction(api)('balances', 'votingBalances', []);
testFunction(api)('balances', 'votingBalancesNominatorsFor', []);
testFunction(api)('chain', 'bestNumber', []);
testFunction(api)('chain', 'bestNumberFinalized', []);
@@ -62,7 +61,6 @@ describe('derive', (): void => {
testFunction(api)('session', 'sessionProgress', []);
testFunction(api)('staking', 'account', []);
testFunction(api)('staking', 'recentlyOffline', []);
testFunction(api)('staking', 'controllers', []);
});
-1
View File
@@ -7,5 +7,4 @@ export * from './controllers';
export * from './electedInfo';
export * from './overview';
export * from './query';
export * from './recentlyOffline';
export * from './validators';
+8 -9
View File
@@ -3,24 +3,23 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, Exposure, Keys, RewardDestination, ValidatorPrefs } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { AccountId, Exposure, Keys, Nominations, RewardDestination, ValidatorPrefs } from '@polkadot/types/interfaces';
import { DerivedStakingStash } from '../types';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Option, Vec } from '@polkadot/types';
import { Option } from '@polkadot/types';
import { memo } from '../util';
type Result = [Option<AccountId>, [Vec<AccountId>], RewardDestination, Exposure, ValidatorPrefs, Option<Keys>?];
type ResultV2 = [Option<AccountId>, ITuple<[Vec<AccountId>]>, RewardDestination, Exposure, ValidatorPrefs, Option<Keys>];
type Result = [Option<AccountId>, Nominations, RewardDestination, Exposure, ValidatorPrefs, Option<Keys>];
function parse (stashId: AccountId, [_controllerId, [nominators], rewardDestination, stakers, validatorPrefs, _nextKeys]: Result): DerivedStakingStash {
function parse (stashId: AccountId, [_controllerId, nominators, rewardDestination, stakers, validatorPrefs, _nextKeys]: Result): DerivedStakingStash {
return {
controllerId: _controllerId.unwrapOr(undefined),
nextKeys: _nextKeys?.unwrapOr(undefined),
nominators,
nextKeys: _nextKeys.unwrapOr(undefined),
nominators: nominators.targets,
nominateAt: nominators.submittedIn,
rewardDestination,
stakers,
stashId,
@@ -29,7 +28,7 @@ function parse (stashId: AccountId, [_controllerId, [nominators], rewardDestinat
}
function query (api: ApiInterfaceRx, stashId: AccountId): Observable<Result> {
return api.queryMulti<ResultV2>([
return api.queryMulti<Result>([
[api.query.staking.bonded, stashId],
[api.query.staking.nominators, stashId],
[api.query.staking.payee, stashId],
@@ -1,49 +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 { AccountId, BlockNumber } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DerivedRecentlyOffline } from '../types';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { Vec, u32 } from '@polkadot/types';
import { memo } from '../util';
type OfflineResult = Vec<ITuple<[AccountId, BlockNumber, u32]>>;
function expandDerived (recentlyOffline: OfflineResult): DerivedRecentlyOffline {
return recentlyOffline.reduce((result: DerivedRecentlyOffline, [accountId, blockNumber, count]): DerivedRecentlyOffline => {
const key = accountId.toString();
if (!result[key]) {
result[key] = [];
}
result[key].push({
blockNumber,
count
});
return result;
}, {});
}
/**
* @description Retrieve a keyed record of accounts recently reported to be offline
*/
export function recentlyOffline (api: ApiInterfaceRx): () => Observable<DerivedRecentlyOffline> {
return memo((): Observable<DerivedRecentlyOffline> =>
(
// TODO recentlyOffline has been dropped for 2.x and replaced, figure out the
// replacement as actually use and implement it
api.query.staking.recentlyOffline
? api.query.staking.recentlyOffline<OfflineResult>()
: of([] as unknown as OfflineResult)
).pipe(
map(expandDerived)
));
}
+12 -6
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 { AccountId, AccountIndex, Balance, BalanceLock, BalanceOf, Bid, BidKind, BlockNumber, EraIndex, EraPoints, Exposure, Hash, Index, Keys, Proposal, PropIndex, ProposalIndex, ReferendumInfo, RegistrationJudgement, RewardDestination, SessionIndex, SetIndex, SocietyVote, StakingLedger, StrikeCount, TreasuryProposal, ValidatorPrefs, Vote, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import { AccountId, AccountIndex, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, EraIndex, EraPoints, Exposure, Hash, Index, Keys, Proposal, PropIndex, ProposalIndex, ReferendumInfo, RegistrationJudgement, RewardDestination, SessionIndex, SetIndex, SocietyVote, StakingLedger, StrikeCount, TreasuryProposal, ValidatorPrefs, Vote, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import { u32, Vec } from '@polkadot/types';
@@ -30,26 +30,31 @@ export interface DeriveAccountInfo {
nickname?: string;
}
export interface DerivedBalances {
export interface DerivedBalancesAccount {
accountId: AccountId;
accountNonce: Index;
freeBalance: Balance;
frozenFee: Balance;
frozenMisc: Balance;
reservedBalance: Balance;
votingBalance: Balance;
}
export interface DerivedBalancesAll extends DerivedBalancesAccount {
isVesting: boolean;
lockedBalance: Balance;
lockedBreakdown: BalanceLock[];
lockedBreakdown: (BalanceLock | BalanceLockTo212)[];
availableBalance: Balance;
reservedBalance: Balance;
votingBalance: Balance;
vestedBalance: Balance;
vestingTotal: Balance;
}
export type DerivedBalancesMap = Record<string, DerivedBalances>;
export type DerivedBalancesMap = Record<string, DerivedBalancesAll>;
export interface DerivedContractFees {
callBaseFee: BN;
contractFee: BN;
createBaseFee: BN;
creationFee: BN;
rentByteFee: BN;
rentDepositOffset: BN;
@@ -188,6 +193,7 @@ export interface DeriveStakingValidators {
export interface DerivedStakingStash {
controllerId?: AccountId;
nominators?: AccountId[];
nominateAt?: EraIndex;
rewardDestination?: RewardDestination;
nextKeys?: Keys;
stakers?: Exposure;
+9 -12
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.0.1",
"version": "1.1.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -25,20 +25,17 @@
"url": "https://github.com/polkadot-js/api/issues"
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"browser": {
"../package.json": "./package.json"
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/api-derive": "^1.0.1",
"@polkadot/keyring": "^2.0.1",
"@polkadot/metadata": "^1.0.1",
"@polkadot/rpc-core": "^1.0.1",
"@polkadot/rpc-provider": "^1.0.1",
"@polkadot/types": "^1.0.1",
"@polkadot/util-crypto": "^2.0.1"
"@polkadot/api-derive": "^1.1.1",
"@polkadot/keyring": "^2.2.1",
"@polkadot/metadata": "^1.1.1",
"@polkadot/rpc-core": "^1.1.1",
"@polkadot/rpc-provider": "^1.1.1",
"@polkadot/types": "^1.1.1",
"@polkadot/util-crypto": "^2.2.1"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.1"
"@polkadot/keyring": "^2.2.1"
}
}
+4 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { Constants, Storage } from '@polkadot/metadata/Decorated/types';
import { RpcInterface } from '@polkadot/rpc-core/jsonrpc.types';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { InterfaceRegistry } from '@polkadot/types/interfaceRegistry';
import { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { AnyFunction, CallFunction, Codec, CodecArg as Arg, ITuple, InterfaceTypes, ModulesWithCalls, Registry, RegistryTypes } from '@polkadot/types/types';
@@ -285,6 +285,9 @@ 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);
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[]> =>
+4 -1
View File
@@ -128,9 +128,12 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
this.registerTypes(getMetadataTypes(metadata.version));
const decoratedMeta = new DecoratedMeta(this.registry, metadata);
const metaExtrinsic = metadata.asLatest.extrinsic;
// only inject if we are not a clone (global init)
if (!this._options.source) {
if (metaExtrinsic.version.gtn(0)) {
this._extrinsicType = metaExtrinsic.version.toNumber();
} else if (!this._options.source) {
// detect the extrinsic version in-use based on the last block
const { block: { extrinsics: [firstTx] } }: SignedBlock = await this._rpcCore.chain.getBlock().toPromise();
+1 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { Constants } from '@polkadot/metadata/Decorated/types';
import { RpcInterface } from '@polkadot/rpc-core/jsonrpc.types';
import { RpcInterface } from '@polkadot/rpc-core/types';
import { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { InterfaceRegistry } from '@polkadot/types/interfaceRegistry';
import { CallFunction, InterfaceTypes, RegistryError, RegistryTypes, SignerPayloadRawBase } from '@polkadot/types/types';
+8 -1
View File
@@ -35,7 +35,7 @@ async function derive (api: ApiPromise): Promise<void> {
}
async function query (api: ApiPromise, keyring: TestKeyringMap): Promise<void> {
const intentions = await api.query.staking.intentions();
const intentions = await api.query.staking.bonded();
console.log('intentions:', intentions);
// api.query.*.* is well-typed
@@ -116,6 +116,13 @@ async function tx (api: ApiPromise, keyring: TestKeyringMap): Promise<void> {
unsub2();
});
// it allows for query & then using the submittable
const second = api.tx.democracy.second(123);
second.signAndSend('123', (result): void => {
console.log(result);
});
}
async function main (): Promise<void> {
-105
View File
@@ -1,105 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Bytes, u32, u64 } from '@polkadot/types';
import { Balance, BalanceOf, BlockNumber, Moment, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import { Gas } from '@polkadot/types/interfaces/contracts';
import { SessionIndex } from '@polkadot/types/interfaces/session';
import { EraIndex } from '@polkadot/types/interfaces/staking';
import { Codec } from '@polkadot/types/types';
declare module '@polkadot/metadata/Decorated/types' {
export interface Constants {
babe: {
[index: string]: Codec;
epochDuration: u64 & ConstantCodec;
expectedBlockTime: Moment & ConstantCodec;
};
timestamp: {
[index: string]: Codec;
minimumPeriod: Moment & ConstantCodec;
};
balances: {
[index: string]: Codec;
existentialDeposit: Balance & ConstantCodec;
transferFee: Balance & ConstantCodec;
creationFee: Balance & ConstantCodec;
};
transactionPayment: {
[index: string]: Codec;
transactionBaseFee: BalanceOf & ConstantCodec;
transactionByteFee: BalanceOf & ConstantCodec;
};
staking: {
[index: string]: Codec;
sessionsPerEra: SessionIndex & ConstantCodec;
bondingDuration: EraIndex & ConstantCodec;
};
session: {
[index: string]: Codec;
dedupKeyPrefix: Bytes & ConstantCodec;
};
democracy: {
[index: string]: Codec;
enactmentPeriod: BlockNumber & ConstantCodec;
launchPeriod: BlockNumber & ConstantCodec;
votingPeriod: BlockNumber & ConstantCodec;
minimumDeposit: BalanceOf & ConstantCodec;
emergencyVotingPeriod: BlockNumber & ConstantCodec;
cooloffPeriod: BlockNumber & ConstantCodec;
preimageByteDeposit: BalanceOf & ConstantCodec;
};
elections: {
[index: string]: Codec;
candidacyBond: BalanceOf & ConstantCodec;
votingBond: BalanceOf & ConstantCodec;
desiredMembers: u32 & ConstantCodec;
desiredRunnersUp: u32 & ConstantCodec;
termDuration: BlockNumber & ConstantCodec;
};
finalityTracker: {
[index: string]: Codec;
windowSize: BlockNumber & ConstantCodec;
reportLatency: BlockNumber & ConstantCodec;
};
treasury: {
[index: string]: Codec;
proposalBond: Permill & ConstantCodec;
proposalBondMinimum: BalanceOf & ConstantCodec;
spendPeriod: BlockNumber & ConstantCodec;
burn: Permill & ConstantCodec;
tipCountdown: BlockNumber & ConstantCodec;
tipFindersFee: Percent & ConstantCodec;
tipReportDepositBase: BalanceOf & ConstantCodec;
tipReportDepositPerByte: BalanceOf & ConstantCodec;
};
contracts: {
[index: string]: Codec;
signedClaimHandicap: BlockNumber & ConstantCodec;
tombstoneDeposit: BalanceOf & ConstantCodec;
storageSizeOffset: u32 & ConstantCodec;
rentByteFee: BalanceOf & ConstantCodec;
rentDepositOffset: BalanceOf & ConstantCodec;
surchargeReward: BalanceOf & ConstantCodec;
transferFee: BalanceOf & ConstantCodec;
creationFee: BalanceOf & ConstantCodec;
transactionBaseFee: BalanceOf & ConstantCodec;
transactionByteFee: BalanceOf & ConstantCodec;
contractFee: BalanceOf & ConstantCodec;
callBaseFee: Gas & ConstantCodec;
instantiateBaseFee: Gas & ConstantCodec;
maxDepth: u32 & ConstantCodec;
maxValueSize: u32 & ConstantCodec;
blockGasLimit: Gas & ConstantCodec;
};
society: {
[index: string]: Codec;
candidateDeposit: BalanceOf & ConstantCodec;
wrongSideDeduction: BalanceOf & ConstantCodec;
maxStrikes: u32 & ConstantCodec;
periodSpend: BalanceOf & ConstantCodec;
rotationPeriod: BlockNumber & ConstantCodec;
challengePeriod: BlockNumber & ConstantCodec;
};
}
}
+4 -6
View File
@@ -4,16 +4,14 @@
import { detectPackage } from '@polkadot/util';
let pkgJson;
// eslint-disable-next-line no-useless-catch
try {
pkgJson = require('./package.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
detectPackage(require('./package.json'), __dirname);
} catch (error) {
pkgJson = require('../package.json');
throw error;
}
detectPackage(pkgJson);
export { Keyring } from '@polkadot/keyring';
export { WsProvider } from '@polkadot/rpc-provider';
+5 -2
View File
@@ -122,10 +122,13 @@ describe('ApiPromise', (): void => {
const api = await ApiPromise.create({ provider, registry, signer });
const transfer = api.tx.balances.transfer(keyring.getPair('0xe659a7a1628cdd93febc04a4e0646ea20e9f5f0ce097d9a05290d4a9e054df4e').address, 12345);
await transfer.signAsync(aliceEd, {});
await transfer.signAsync(aliceEd.address, {});
expect(transfer.signature.toHex()).toEqual(
'0x6b9ccc95afbd4e916d30c65c720f4f7b70a77db545735b48a763844aa5210e695aa346686bad1224af77d00bcfbf6fc8d2c216a60731027835d5a414186a2607'
// v1 extrinsic
// '0x6b9ccc95afbd4e916d30c65c720f4f7b70a77db545735b48a763844aa5210e695aa346686bad1224af77d00bcfbf6fc8d2c216a60731027835d5a414186a2607'
// v4 extrinsic
'0x0716cbdc3b649dad8741238bcc8e4336f859c518cf2b17a3427b2f5d0b8a79cf518da71b9ac71d92c517342e0978f297f5e05362babf5987d3f1c5ba3314af08'
);
});
});
-261
View File
@@ -1,261 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Observable } from 'rxjs';
import { Option, Raw, Vec } from '@polkadot/types/codec';
import { Bytes, Data, bool, u32, u64 } from '@polkadot/types';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, Index, KeyTypeId, Moment, Perbill, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BabeAuthorityWeight, MaybeVrf } from '@polkadot/types/interfaces/babe';
import { BalanceLock, VestingSchedule } from '@polkadot/types/interfaces/balances';
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { CodeHash, ContractInfo, Gas, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from '@polkadot/types/interfaces/democracy';
import { Vote, VoteThreshold } from '@polkadot/types/interfaces/elections';
import { AuthorityList, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
import { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
import { AuthIndex } from '@polkadot/types/interfaces/imOnline';
import { Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { EraIndex, EraPoints, Exposure, Forcing, MomentOf, Nominations, RewardDestination, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
import { DigestOf, EventIndex, EventRecord } from '@polkadot/types/interfaces/system';
import { OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig } from '@polkadot/types/interfaces/utility';
import { ITuple } from '@polkadot/types/types';
declare module '@polkadot/api/types' {
export interface QueryableStorageExact<ApiType> {
system: {
[index: string]: QueryableStorageEntry<ApiType>;
accountNonce: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Index>> & QueryableStorageEntry<ApiType>;
extrinsicCount: StorageEntryExact<ApiType, () => Observable<Option<u32>>> & QueryableStorageEntry<ApiType>;
allExtrinsicsWeight: StorageEntryExact<ApiType, () => Observable<Option<Weight>>> & QueryableStorageEntry<ApiType>;
allExtrinsicsLen: StorageEntryExact<ApiType, () => Observable<Option<u32>>> & QueryableStorageEntry<ApiType>;
blockHash: StorageEntryExact<ApiType, (arg: BlockNumber | Uint8Array | number | string) => Observable<Hash>> & QueryableStorageEntry<ApiType>;
extrinsicData: StorageEntryExact<ApiType, (arg: u32 | Uint8Array | number | string) => Observable<Bytes>> & QueryableStorageEntry<ApiType>;
number: StorageEntryExact<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
parentHash: StorageEntryExact<ApiType, () => Observable<Hash>> & QueryableStorageEntry<ApiType>;
extrinsicsRoot: StorageEntryExact<ApiType, () => Observable<Hash>> & QueryableStorageEntry<ApiType>;
digest: StorageEntryExact<ApiType, () => Observable<DigestOf>> & QueryableStorageEntry<ApiType>;
events: StorageEntryExact<ApiType, () => Observable<Vec<EventRecord>>> & QueryableStorageEntry<ApiType>;
eventCount: StorageEntryExact<ApiType, () => Observable<EventIndex>> & QueryableStorageEntry<ApiType>;
eventTopics: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Vec<ITuple<[BlockNumber, EventIndex]>>>> & QueryableStorageEntry<ApiType>;
};
utility: {
[index: string]: QueryableStorageEntry<ApiType>;
multisigs: StorageEntryExact<ApiType, (key1: AccountId | Uint8Array | string, key2: Raw | Uint8Array | string) => Observable<Option<Multisig>>> & QueryableStorageEntry<ApiType>;
};
babe: {
[index: string]: QueryableStorageEntry<ApiType>;
epochIndex: StorageEntryExact<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
authorities: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[AuthorityId, BabeAuthorityWeight]>>>> & QueryableStorageEntry<ApiType>;
genesisSlot: StorageEntryExact<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
currentSlot: StorageEntryExact<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
randomness: StorageEntryExact<ApiType, () => Observable<Raw>> & QueryableStorageEntry<ApiType>;
nextRandomness: StorageEntryExact<ApiType, () => Observable<Raw>> & QueryableStorageEntry<ApiType>;
segmentIndex: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
underConstruction: StorageEntryExact<ApiType, (arg: u32 | Uint8Array | number | string) => Observable<Vec<Raw>>> & QueryableStorageEntry<ApiType>;
initialized: StorageEntryExact<ApiType, () => Observable<Option<MaybeVrf>>> & QueryableStorageEntry<ApiType>;
};
timestamp: {
[index: string]: QueryableStorageEntry<ApiType>;
now: StorageEntryExact<ApiType, () => Observable<Moment>> & QueryableStorageEntry<ApiType>;
didUpdate: StorageEntryExact<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
authorship: {
[index: string]: QueryableStorageEntry<ApiType>;
uncles: StorageEntryExact<ApiType, () => Observable<Vec<UncleEntryItem>>> & QueryableStorageEntry<ApiType>;
author: StorageEntryExact<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
didSetUncles: StorageEntryExact<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
indices: {
[index: string]: QueryableStorageEntry<ApiType>;
nextEnumSet: StorageEntryExact<ApiType, () => Observable<AccountIndex>> & QueryableStorageEntry<ApiType>;
enumSet: StorageEntryExact<ApiType, (arg: AccountIndex | Uint8Array | number | string) => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
balances: {
[index: string]: QueryableStorageEntry<ApiType>;
totalIssuance: StorageEntryExact<ApiType, () => Observable<Balance>> & QueryableStorageEntry<ApiType>;
vesting: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<VestingSchedule>>> & QueryableStorageEntry<ApiType>;
freeBalance: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Balance>> & QueryableStorageEntry<ApiType>;
reservedBalance: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Balance>> & QueryableStorageEntry<ApiType>;
locks: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Vec<BalanceLock>>> & QueryableStorageEntry<ApiType>;
};
transactionPayment: {
[index: string]: QueryableStorageEntry<ApiType>;
nextFeeMultiplier: StorageEntryExact<ApiType, () => Observable<Multiplier>> & QueryableStorageEntry<ApiType>;
};
staking: {
[index: string]: QueryableStorageEntry<ApiType>;
validatorCount: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
minimumValidatorCount: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
invulnerables: StorageEntryExact<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
bonded: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
ledger: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<StakingLedger>>> & QueryableStorageEntry<ApiType>;
payee: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<RewardDestination>> & QueryableStorageEntry<ApiType>;
validators: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<ValidatorPrefs>> & QueryableStorageEntry<ApiType>;
nominators: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<Nominations>>> & QueryableStorageEntry<ApiType>;
stakers: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Exposure>> & QueryableStorageEntry<ApiType>;
currentElected: StorageEntryExact<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
currentEra: StorageEntryExact<ApiType, () => Observable<EraIndex>> & QueryableStorageEntry<ApiType>;
currentEraStart: StorageEntryExact<ApiType, () => Observable<MomentOf>> & QueryableStorageEntry<ApiType>;
currentEraStartSessionIndex: StorageEntryExact<ApiType, () => Observable<SessionIndex>> & QueryableStorageEntry<ApiType>;
currentEraPointsEarned: StorageEntryExact<ApiType, () => Observable<EraPoints>> & QueryableStorageEntry<ApiType>;
slotStake: StorageEntryExact<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
forceEra: StorageEntryExact<ApiType, () => Observable<Forcing>> & QueryableStorageEntry<ApiType>;
slashRewardFraction: StorageEntryExact<ApiType, () => Observable<Perbill>> & QueryableStorageEntry<ApiType>;
canceledSlashPayout: StorageEntryExact<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
unappliedSlashes: StorageEntryExact<ApiType, (arg: EraIndex | Uint8Array | number | string) => Observable<Vec<UnappliedSlash>>> & QueryableStorageEntry<ApiType>;
bondedEras: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[EraIndex, SessionIndex]>>>> & QueryableStorageEntry<ApiType>;
validatorSlashInEra: StorageEntryExact<ApiType, (key1: EraIndex | Uint8Array | number | string, key2: AccountId | Uint8Array | string) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
nominatorSlashInEra: StorageEntryExact<ApiType, (key1: EraIndex | Uint8Array | number | string, key2: AccountId | Uint8Array | string) => Observable<Option<BalanceOf>>> & QueryableStorageEntry<ApiType>;
slashingSpans: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<SlashingSpans>>> & QueryableStorageEntry<ApiType>;
spanSlash: StorageEntryExact<ApiType, (arg: ITuple<[AccountId, SpanIndex]>) => Observable<SpanRecord>> & QueryableStorageEntry<ApiType>;
earliestUnappliedSlash: StorageEntryExact<ApiType, () => Observable<Option<EraIndex>>> & QueryableStorageEntry<ApiType>;
storageVersion: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
};
session: {
[index: string]: QueryableStorageEntry<ApiType>;
validators: StorageEntryExact<ApiType, () => Observable<Vec<ValidatorId>>> & QueryableStorageEntry<ApiType>;
currentIndex: StorageEntryExact<ApiType, () => Observable<SessionIndex>> & QueryableStorageEntry<ApiType>;
queuedChanged: StorageEntryExact<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
queuedKeys: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[ValidatorId, Keys]>>>> & QueryableStorageEntry<ApiType>;
disabledValidators: StorageEntryExact<ApiType, () => Observable<Vec<u32>>> & QueryableStorageEntry<ApiType>;
nextKeys: StorageEntryExact<ApiType, (key1: Bytes | Uint8Array | string, key2: ValidatorId | Uint8Array | string) => Observable<Option<Keys>>> & QueryableStorageEntry<ApiType>;
keyOwner: StorageEntryExact<ApiType, (key1: Bytes | Uint8Array | string, key2: ITuple<[KeyTypeId, Bytes]>) => Observable<Option<ValidatorId>>> & QueryableStorageEntry<ApiType>;
};
democracy: {
[index: string]: QueryableStorageEntry<ApiType>;
publicPropCount: StorageEntryExact<ApiType, () => Observable<PropIndex>> & QueryableStorageEntry<ApiType>;
publicProps: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[PropIndex, Hash, AccountId]>>>> & QueryableStorageEntry<ApiType>;
preimages: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Option<ITuple<[Bytes, AccountId, BalanceOf, BlockNumber]>>>> & QueryableStorageEntry<ApiType>;
depositOf: StorageEntryExact<ApiType, (arg: PropIndex | Uint8Array | number | string) => Observable<Option<ITuple<[BalanceOf, Vec<AccountId>]>>>> & QueryableStorageEntry<ApiType>;
referendumCount: StorageEntryExact<ApiType, () => Observable<ReferendumIndex>> & QueryableStorageEntry<ApiType>;
lowestUnbaked: StorageEntryExact<ApiType, () => Observable<ReferendumIndex>> & QueryableStorageEntry<ApiType>;
referendumInfoOf: StorageEntryExact<ApiType, (arg: ReferendumIndex | Uint8Array | number | string) => Observable<Option<ReferendumInfo>>> & QueryableStorageEntry<ApiType>;
dispatchQueue: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>> & QueryableStorageEntry<ApiType>;
votersFor: StorageEntryExact<ApiType, (arg: ReferendumIndex | Uint8Array | number | string) => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
voteOf: StorageEntryExact<ApiType, (arg: ITuple<[ReferendumIndex, AccountId]>) => Observable<Vote>> & QueryableStorageEntry<ApiType>;
proxy: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
delegations: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<ITuple<[AccountId, Conviction]>>> & QueryableStorageEntry<ApiType>;
lastTabledWasExternal: StorageEntryExact<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
nextExternal: StorageEntryExact<ApiType, () => Observable<Option<ITuple<[Hash, VoteThreshold]>>>> & QueryableStorageEntry<ApiType>;
blacklist: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Option<ITuple<[BlockNumber, Vec<AccountId>]>>>> & QueryableStorageEntry<ApiType>;
cancellations: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
council: {
[index: string]: QueryableStorageEntry<ApiType>;
proposals: StorageEntryExact<ApiType, () => Observable<Vec<Hash>>> & QueryableStorageEntry<ApiType>;
proposalOf: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Option<Proposal>>> & QueryableStorageEntry<ApiType>;
voting: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Option<Votes>>> & QueryableStorageEntry<ApiType>;
proposalCount: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
members: StorageEntryExact<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
technicalCommittee: {
[index: string]: QueryableStorageEntry<ApiType>;
proposals: StorageEntryExact<ApiType, () => Observable<Vec<Hash>>> & QueryableStorageEntry<ApiType>;
proposalOf: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Option<Proposal>>> & QueryableStorageEntry<ApiType>;
voting: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Option<Votes>>> & QueryableStorageEntry<ApiType>;
proposalCount: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
members: StorageEntryExact<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
elections: {
[index: string]: QueryableStorageEntry<ApiType>;
members: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
runnersUp: StorageEntryExact<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
electionRounds: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
votesOf: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
stakeOf: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
candidates: StorageEntryExact<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
technicalMembership: {
[index: string]: QueryableStorageEntry<ApiType>;
members: StorageEntryExact<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
grandpa: {
[index: string]: QueryableStorageEntry<ApiType>;
authorities: StorageEntryExact<ApiType, () => Observable<AuthorityList>> & QueryableStorageEntry<ApiType>;
state: StorageEntryExact<ApiType, () => Observable<StoredState>> & QueryableStorageEntry<ApiType>;
pendingChange: StorageEntryExact<ApiType, () => Observable<Option<StoredPendingChange>>> & QueryableStorageEntry<ApiType>;
nextForced: StorageEntryExact<ApiType, () => Observable<Option<BlockNumber>>> & QueryableStorageEntry<ApiType>;
stalled: StorageEntryExact<ApiType, () => Observable<Option<ITuple<[BlockNumber, BlockNumber]>>>> & QueryableStorageEntry<ApiType>;
currentSetId: StorageEntryExact<ApiType, () => Observable<SetId>> & QueryableStorageEntry<ApiType>;
setIdSession: StorageEntryExact<ApiType, (arg: SetId | Uint8Array | number | string) => Observable<Option<SessionIndex>>> & QueryableStorageEntry<ApiType>;
};
treasury: {
[index: string]: QueryableStorageEntry<ApiType>;
proposalCount: StorageEntryExact<ApiType, () => Observable<ProposalIndex>> & QueryableStorageEntry<ApiType>;
proposals: StorageEntryExact<ApiType, (arg: ProposalIndex | Uint8Array | number | string) => Observable<Option<TreasuryProposal>>> & QueryableStorageEntry<ApiType>;
approvals: StorageEntryExact<ApiType, () => Observable<Vec<ProposalIndex>>> & QueryableStorageEntry<ApiType>;
tips: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Option<OpenTip>>> & QueryableStorageEntry<ApiType>;
reasons: StorageEntryExact<ApiType, (arg: Hash | Uint8Array | string) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
};
contracts: {
[index: string]: QueryableStorageEntry<ApiType>;
gasSpent: StorageEntryExact<ApiType, () => Observable<Gas>> & QueryableStorageEntry<ApiType>;
currentSchedule: StorageEntryExact<ApiType, () => Observable<Schedule>> & QueryableStorageEntry<ApiType>;
pristineCode: StorageEntryExact<ApiType, (arg: CodeHash | Uint8Array | string) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
codeStorage: StorageEntryExact<ApiType, (arg: CodeHash | Uint8Array | string) => Observable<Option<PrefabWasmModule>>> & QueryableStorageEntry<ApiType>;
accountCounter: StorageEntryExact<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
contractInfoOf: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<ContractInfo>>> & QueryableStorageEntry<ApiType>;
gasPrice: StorageEntryExact<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
};
sudo: {
[index: string]: QueryableStorageEntry<ApiType>;
key: StorageEntryExact<ApiType, () => Observable<AccountId>> & QueryableStorageEntry<ApiType>;
};
imOnline: {
[index: string]: QueryableStorageEntry<ApiType>;
gossipAt: StorageEntryExact<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
keys: StorageEntryExact<ApiType, () => Observable<Vec<AuthorityId>>> & QueryableStorageEntry<ApiType>;
receivedHeartbeats: StorageEntryExact<ApiType, (key1: SessionIndex | Uint8Array | number | string, key2: AuthIndex | Uint8Array | number | string) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
authoredBlocks: StorageEntryExact<ApiType, (key1: SessionIndex | Uint8Array | number | string, key2: ValidatorId | Uint8Array | string) => Observable<u32>> & QueryableStorageEntry<ApiType>;
};
offences: {
[index: string]: QueryableStorageEntry<ApiType>;
reports: StorageEntryExact<ApiType, (arg: ReportIdOf | Uint8Array | string) => Observable<Option<OffenceDetails>>> & QueryableStorageEntry<ApiType>;
concurrentReportsIndex: StorageEntryExact<ApiType, (key1: Kind | Uint8Array | string, key2: OpaqueTimeSlot | Uint8Array | string) => Observable<Vec<ReportIdOf>>> & QueryableStorageEntry<ApiType>;
reportsByKindIndex: StorageEntryExact<ApiType, (arg: Kind | Uint8Array | string) => Observable<Bytes>> & QueryableStorageEntry<ApiType>;
};
randomnessCollectiveFlip: {
[index: string]: QueryableStorageEntry<ApiType>;
randomMaterial: StorageEntryExact<ApiType, () => Observable<Vec<Hash>>> & QueryableStorageEntry<ApiType>;
};
identity: {
[index: string]: QueryableStorageEntry<ApiType>;
identityOf: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<Registration>>> & QueryableStorageEntry<ApiType>;
superOf: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<ITuple<[AccountId, Data]>>>> & QueryableStorageEntry<ApiType>;
subsOf: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>> & QueryableStorageEntry<ApiType>;
registrars: StorageEntryExact<ApiType, () => Observable<Vec<Option<RegistrarInfo>>>> & QueryableStorageEntry<ApiType>;
};
society: {
[index: string]: QueryableStorageEntry<ApiType>;
founder: StorageEntryExact<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
rules: StorageEntryExact<ApiType, () => Observable<Option<Hash>>> & QueryableStorageEntry<ApiType>;
candidates: StorageEntryExact<ApiType, () => Observable<Vec<Bid>>> & QueryableStorageEntry<ApiType>;
suspendedCandidates: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<ITuple<[BalanceOf, BidKind]>>>> & QueryableStorageEntry<ApiType>;
pot: StorageEntryExact<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
head: StorageEntryExact<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
members: StorageEntryExact<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
suspendedMembers: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<bool>> & QueryableStorageEntry<ApiType>;
bids: StorageEntryExact<ApiType, () => Observable<Vec<Bid>>> & QueryableStorageEntry<ApiType>;
vouching: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<VouchingStatus>>> & QueryableStorageEntry<ApiType>;
payouts: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Vec<ITuple<[BlockNumber, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
strikes: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<StrikeCount>> & QueryableStorageEntry<ApiType>;
votes: StorageEntryExact<ApiType, (key1: AccountId | Uint8Array | string, key2: AccountId | Uint8Array | string) => Observable<Option<SocietyVote>>> & QueryableStorageEntry<ApiType>;
defender: StorageEntryExact<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
defenderVotes: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<SocietyVote>>> & QueryableStorageEntry<ApiType>;
maxMembers: StorageEntryExact<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
};
recovery: {
[index: string]: QueryableStorageEntry<ApiType>;
recoverable: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<RecoveryConfig>>> & QueryableStorageEntry<ApiType>;
activeRecoveries: StorageEntryExact<ApiType, (key1: AccountId | Uint8Array | string, key2: AccountId | Uint8Array | string) => Observable<Option<ActiveRecovery>>> & QueryableStorageEntry<ApiType>;
recovered: StorageEntryExact<ApiType, (arg: AccountId | Uint8Array | string) => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
};
}
}
-283
View File
@@ -1,283 +0,0 @@
// 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.
// These two files add module augmentation so that `api.{query,consts}.*.*`
// get typed. Import them to make these types effective.
import './consts.types';
import './query.types';
import { Constants } from '@polkadot/metadata/Decorated/types';
import { UserRpc } from '@polkadot/rpc-core/types';
import { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { AnyFunction, Callback, CallFunction, Codec, CodecArg, RegistryTypes, SignatureOptions, SignerPayloadJSON, SignerPayloadRaw, Registry } from '@polkadot/types/types';
import { SubmittableResultImpl, SubmittableExtrinsic } from './submittable/types';
import { DeriveAllSections } from './util/decorate';
import BN from 'bn.js';
import { Observable } from 'rxjs';
import { DeriveCustom, ExactDerive } from '@polkadot/api-derive';
import { RpcInterface } from '@polkadot/rpc-core/jsonrpc.types';
import { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import { Metadata, u64 } from '@polkadot/types';
import StorageKey, { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import ApiBase from './base';
export * from './submittable/types';
// Prepend an element V onto the beginning of a tuple T.
// Cons<1, [2,3,4]> is [1,2,3,4]
type Cons<V, T extends any[]> = ((v: V, ...t: T) => void) extends ((...r: infer R) => void)
? R
: never;
// Append an element V onto the end of a tuple T
// Push<[1,2,3],4> is [1,2,3,4]
// note that this DOES NOT PRESERVE optionality/readonly in tuples.
// So unfortunately Push<[1, 2?, 3?], 4> is [1,2|undefined,3|undefined,4]
type Push<T extends any[], V> = (
(
Cons<any, Required<T>> extends infer R
? { [K in keyof R]: K extends keyof T ? T[K] : V }
: never
) extends infer P
? P extends any[] ? P : never
: never
);
// Returns the inner type of an Observable
export type ObsInnerType<O extends Observable<any>> = O extends Observable<infer U> ? U : never;
export type UnsubscribePromise = Promise<() => void>;
// In the abstract `decorateMethod` in Base.ts, we can also pass in some meta-
// information. This describes it.
export interface DecorateMethodOptions {
methodName?: string;
}
export type DecorateMethod<ApiType extends ApiTypes> = <Method extends (...args: any[]) => Observable<any>>(method: Method, options?: DecorateMethodOptions) => any;
// Here are the return types of these parts of the api:
// - api.query.*.*: no exact typings
// - api.tx.*.*: SubmittableExtrinsic<ApiType extends ApiTypes>
// - api.derive.*.*: MethodResult<ApiType, F>
// - api.rpc.*.*: no exact typings (for now, FIXME: should be MethodResult<ApiType, F>, like in derive)
// These are the types that don't lose type information (used for api.derive.*)
// Also use these for api.rpc.* https://github.com/polkadot-js/api/issues/1009
export interface RxResult<F extends AnyFunction> {
(...args: Parameters<F>): Observable<ObsInnerType<ReturnType<F>>>;
<T>(...args: Parameters<F>): Observable<T>;
}
export interface PromiseResult<F extends AnyFunction> {
(...args: Parameters<F>): Promise<ObsInnerType<ReturnType<F>>>;
(...args: Push<Parameters<F>, Callback<ObsInnerType<ReturnType<F>>>>): UnsubscribePromise;
<T extends Codec | Codec[]>(...args: Parameters<F>): Promise<T>;
<T extends Codec | Codec[]>(...args: Push<Parameters<F>, Callback<T>>): UnsubscribePromise;
}
// FIXME The day TS has higher-kinded types, we can remove this hardcoded stuff
export type PromiseOrObs<ApiType extends ApiTypes, T> = ApiType extends 'rxjs'
? Observable<T>
: Promise<T>
// FIXME The day TS has higher-kinded types, we can remove this hardcoded stuff
export type MethodResult<ApiType extends ApiTypes, F extends AnyFunction> = ApiType extends 'rxjs'
? RxResult<F>
: PromiseResult<F>;
export type DecoratedRpcSection<ApiType extends ApiTypes, Section> = {
[Method in keyof Section]: Section[Method] extends AnyFunction
? MethodResult<ApiType, Section[Method]>
: never
}
export type DecoratedRpc<ApiType extends ApiTypes, AllSections> = {
[Section in keyof AllSections]: DecoratedRpcSection<ApiType, AllSections[Section]>
}
interface StorageEntryObservableMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Observable<T[]>;
}
interface StorageEntryPromiseMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Promise<T[]>;
<T extends Codec>(args: (CodecArg[] | CodecArg)[], callback: Callback<T[]>): UnsubscribePromise;
}
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction> {
at: (hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, ObsInnerType<ReturnType<F>>>;
creator: StorageEntry;
entries: () => PromiseOrObs<ApiType, [StorageKey, ObsInnerType<ReturnType<F>>][]>;
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
key: (...args: Parameters<F>) => string;
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
multi: ApiType extends 'rxjs' ? StorageEntryObservableMulti : StorageEntryPromiseMulti;
}
export interface StorageEntryPromiseOverloads {
(arg1?: CodecArg, arg2?: CodecArg): Promise<Codec>;
<T extends Codec>(arg1?: CodecArg, arg2?: CodecArg): Promise<T>;
<T extends Codec>(callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg: CodecArg, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: CodecArg, arg2: CodecArg, callback: Callback<T>): UnsubscribePromise;
}
export type StorageEntryExact<ApiType extends ApiTypes, F extends AnyFunction> = MethodResult<ApiType, F> & StorageEntryBase<ApiType, F>
// This is the most generic typings we can have for a storage entry function
type GenericStorageEntryFunction = (arg1?: CodecArg, arg2?: CodecArg) => Observable<Codec>
export type QueryableStorageEntry<ApiType extends ApiTypes> =
ApiType extends 'rxjs'
? StorageEntryExact<'rxjs', GenericStorageEntryFunction>
: StorageEntryExact<'promise', GenericStorageEntryFunction> & StorageEntryPromiseOverloads;
export interface QueryableModuleStorage<ApiType extends ApiTypes> {
[index: string]: QueryableStorageEntry<ApiType>;
}
export type QueryableStorageMultiArg<ApiType extends ApiTypes> =
QueryableStorageEntry<ApiType> |
[QueryableStorageEntry<ApiType>, ...CodecArg[]];
export interface QueryableStorageMultiBase<ApiType extends ApiTypes> {
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[]): Observable<T>;
}
export interface QueryableStorageMultiPromise<ApiType extends ApiTypes> {
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[], callback: Callback<T>): UnsubscribePromise;
}
export type QueryableStorageMulti<ApiType extends ApiTypes> =
ApiType extends 'rxjs'
? QueryableStorageMultiBase<ApiType>
: QueryableStorageMultiPromise<ApiType>;
// QueryableStorageExact will hold the exact typed api.query.*.* generated from
// metadata. For now it's empty, it's ready to be module augmented.
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface QueryableStorageExact<ApiType extends ApiTypes> { }
export interface QueryableStorage<ApiType extends ApiTypes> extends QueryableStorageExact<ApiType> {
[index: string]: QueryableModuleStorage<ApiType>;
}
export interface SubmittableExtrinsicFunction<ApiType extends ApiTypes> extends CallFunction {
(...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
}
export interface SubmittableModuleExtrinsics<ApiType extends ApiTypes> {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
}
export interface SubmittableExtrinsics<ApiType extends ApiTypes> {
(extrinsic: Uint8Array | string): SubmittableExtrinsic<ApiType>;
[index: string]: SubmittableModuleExtrinsics<ApiType>;
}
export interface ApiOptions {
/**
* @description Add custom derives to be injected
*/
derives?: DeriveCustom;
/**
* @description prebundles is a map of 'genesis hash and runtime spec version' as key to metadata's hex string
* if genesis hash and runtime spec version matches, then use metadata, else fetch it from chain
*/
metadata?: Record<string, string>;
/**
* @description Transport Provider from rpc-provider. If not specified, it will default to
* connecting to a WsProvider connecting localhost with the default port, i.e. `ws://127.0.0.1:9944`
*/
provider?: ProviderInterface;
/**
* @description A type registry to use along with this instance
*/
registry?: Registry;
/**
* @description User-defined RPC methods
*/
rpc?: UserRpc;
/**
* @description An external signer which will be used to sign extrinsic when account passed in is not KeyringPair
*/
signer?: Signer;
/**
* @description The source object to use for runtime information (only used when cloning)
*/
source?: ApiBase<any>;
/**
* @description Additional types used by runtime modules. This is nessusary if the runtime modules
* uses types not available in the base Substrate runtime.
*/
types?: RegistryTypes;
/**
* @description Additional types that are injected based on the chain we are connecting to. There are keyed by the chain, i.e. `{ 'Kusama CC1': { ... } }`
*/
typesChain?: Record<string, RegistryTypes>;
/**
* @description Additional types that are injected based on the type of node we are connecting to, as set via specName in the runtime version. There are keyed by the node, i.e. `{ 'edgeware': { ... } }`
*/
typesSpec?: Record<string, RegistryTypes>;
}
// A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
export interface ApiInterfaceRx {
consts: Constants;
// TODO This needs to be typed correctly
derive: DeriveAllSections<'rxjs', ExactDerive>;
extrinsicType: number;
genesisHash: Hash;
hasSubscriptions: boolean;
registry: Registry;
runtimeMetadata: Metadata;
runtimeVersion: RuntimeVersion;
query: QueryableStorage<'rxjs'>;
queryMulti: QueryableStorageMulti<'rxjs'>;
rpc: DecoratedRpc<'rxjs', RpcInterface>;
tx: SubmittableExtrinsics<'rxjs'>;
signer?: Signer;
}
export type ApiInterfaceEvents = ProviderInterfaceEmitted | 'ready';
export type ApiTypes = 'promise' | 'rxjs';
export interface SignerOptions extends SignatureOptions {
blockNumber: BN;
genesisHash: Hash;
}
export interface SignerResult {
/**
* @description The id for this request
*/
id: number;
/**
* @description The resulting signature in hex
*/
signature: string;
}
export interface Signer {
/**
* @description signs an extrinsic payload from a serialized form
*/
signPayload?: (payload: SignerPayloadJSON) => Promise<SignerResult>;
/**
* @description signs a raw payload, only the bytes data as supplied
*/
signRaw?: (raw: SignerPayloadRaw) => Promise<SignerResult>;
/**
* @description Receives an update for the extrinsic signed by a `signer.sign`
*/
update?: (id: number, status: Hash | SubmittableResultImpl) => void;
}
export { ApiBase };
+276
View File
@@ -0,0 +1,276 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Codec } from '@polkadot/types/types';
import { Bytes, u32, u64 } from '@polkadot/types/primitive';
import { Balance, BalanceOf, BlockNumber, Moment, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import { Gas } from '@polkadot/types/interfaces/contracts';
import { SessionIndex } from '@polkadot/types/interfaces/session';
import { EraIndex } from '@polkadot/types/interfaces/staking';
declare module '@polkadot/metadata/Decorated/consts/types' {
export interface Constants {
babe: {
[index: string]: Codec;
/**
* The number of **slots** that an epoch takes. We couple sessions to
* epochs, i.e. we start a new session once the new epoch begins.
**/
epochDuration: AugmentedConst<u64>;
/**
* The expected average block time at which BABE should be creating
* blocks. Since BABE is probabilistic it is not trivial to figure out
* what the expected average block time should be based on the slot
* duration and the security parameter `c` (where `1 - c` represents
* the probability of a slot being empty).
**/
expectedBlockTime: AugmentedConst<Moment>;
};
timestamp: {
[index: string]: Codec;
/**
* The minimum period between blocks. Beware that this is different to the *expected* period
* that the block production apparatus provides. Your chosen consensus system will generally
* work with this to determine a sensible block time. e.g. For Aura, it will be double this
* period on default settings.
**/
minimumPeriod: AugmentedConst<Moment>;
};
balances: {
[index: string]: Codec;
/**
* The minimum amount required to keep an account open.
**/
existentialDeposit: AugmentedConst<Balance>;
/**
* The fee required to create an account.
**/
creationFee: AugmentedConst<Balance>;
};
transactionPayment: {
[index: string]: Codec;
/**
* The fee to be paid for making a transaction; the base.
**/
transactionBaseFee: AugmentedConst<BalanceOf>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: AugmentedConst<BalanceOf>;
};
staking: {
[index: string]: Codec;
/**
* Number of sessions per era.
**/
sessionsPerEra: AugmentedConst<SessionIndex>;
/**
* Number of eras that staked funds must remain bonded for.
**/
bondingDuration: AugmentedConst<EraIndex>;
};
session: {
[index: string]: Codec;
/**
* Used as first key for `NextKeys` and `KeyOwner` to put all the data into the same branch
* of the trie.
**/
dedupKeyPrefix: AugmentedConst<Bytes>;
};
democracy: {
[index: string]: Codec;
/**
* The minimum period of locking and the period between a proposal being approved and enacted.
* It should generally be a little more than the unstake period to ensure that
* voting stakers have an opportunity to remove themselves from the system in the case where
* they are on the losing side of a vote.
**/
enactmentPeriod: AugmentedConst<BlockNumber>;
/**
* How often (in blocks) new public referenda are launched.
**/
launchPeriod: AugmentedConst<BlockNumber>;
/**
* How often (in blocks) to check for new votes.
**/
votingPeriod: AugmentedConst<BlockNumber>;
/**
* The minimum amount to be used as a deposit for a public referendum proposal.
**/
minimumDeposit: AugmentedConst<BalanceOf>;
/**
* Minimum voting period allowed for an emergency referendum.
**/
emergencyVotingPeriod: AugmentedConst<BlockNumber>;
/**
* Period in blocks where an external proposal may not be re-submitted after being vetoed.
**/
cooloffPeriod: AugmentedConst<BlockNumber>;
/**
* The amount of balance that must be deposited per byte of preimage stored.
**/
preimageByteDeposit: AugmentedConst<BalanceOf>;
};
elections: {
[index: string]: Codec;
candidacyBond: AugmentedConst<BalanceOf>;
votingBond: AugmentedConst<BalanceOf>;
desiredMembers: AugmentedConst<u32>;
desiredRunnersUp: AugmentedConst<u32>;
termDuration: AugmentedConst<BlockNumber>;
};
finalityTracker: {
[index: string]: Codec;
/**
* The number of recent samples to keep from this chain. Default is 101.
**/
windowSize: AugmentedConst<BlockNumber>;
/**
* The delay after which point things become suspicious. Default is 1000.
**/
reportLatency: AugmentedConst<BlockNumber>;
};
treasury: {
[index: string]: Codec;
/**
* Fraction of a proposal's value that should be bonded in order to place the proposal.
* An accepted proposal gets these back. A rejected proposal does not.
**/
proposalBond: AugmentedConst<Permill>;
/**
* Minimum amount of funds that should be placed in a deposit for making a proposal.
**/
proposalBondMinimum: AugmentedConst<BalanceOf>;
/**
* Period between successive spends.
**/
spendPeriod: AugmentedConst<BlockNumber>;
/**
* Percentage of spare funds (if any) that are burnt per spend period.
**/
burn: AugmentedConst<Permill>;
/**
* The period for which a tip remains open after is has achieved threshold tippers.
**/
tipCountdown: AugmentedConst<BlockNumber>;
/**
* The amount of the final tip which goes to the original reporter of the tip.
**/
tipFindersFee: AugmentedConst<Percent>;
/**
* The amount held on deposit for placing a tip report.
**/
tipReportDepositBase: AugmentedConst<BalanceOf>;
/**
* The amount held on deposit per byte within the tip report reason.
**/
tipReportDepositPerByte: AugmentedConst<BalanceOf>;
};
contracts: {
[index: string]: Codec;
/**
* Number of block delay an extrinsic claim surcharge has.
* When claim surcharge is called by an extrinsic the rent is checked
* for current_block - delay
**/
signedClaimHandicap: AugmentedConst<BlockNumber>;
/**
* The minimum amount required to generate a tombstone.
**/
tombstoneDeposit: AugmentedConst<BalanceOf>;
/**
* Size of a contract at the time of instantiaion. This is a simple way to ensure that
* empty contracts eventually gets deleted.
**/
storageSizeOffset: AugmentedConst<u32>;
/**
* Price of a byte of storage per one block interval. Should be greater than 0.
**/
rentByteFee: AugmentedConst<BalanceOf>;
/**
* The amount of funds a contract should deposit in order to offset
* the cost of one byte.
* Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day,
* then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent.
* But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000,
* then it would pay 500 BU/day.
**/
rentDepositOffset: AugmentedConst<BalanceOf>;
/**
* Reward that is received by the party whose touch has led
* to removal of a contract.
**/
surchargeReward: AugmentedConst<BalanceOf>;
/**
* The fee required to create an account.
**/
creationFee: AugmentedConst<BalanceOf>;
/**
* The fee to be paid for making a transaction; the base.
**/
transactionBaseFee: AugmentedConst<BalanceOf>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
transactionByteFee: AugmentedConst<BalanceOf>;
/**
* The fee required to instantiate a contract instance. A reasonable default value
* is 21.
**/
contractFee: AugmentedConst<BalanceOf>;
/**
* The base fee charged for calling into a contract. A reasonable default
* value is 135.
**/
callBaseFee: AugmentedConst<Gas>;
/**
* The base fee charged for instantiating a contract. A reasonable default value
* is 175.
**/
instantiateBaseFee: AugmentedConst<Gas>;
/**
* The maximum nesting level of a call/instantiate stack. A reasonable default
* value is 100.
**/
maxDepth: AugmentedConst<u32>;
/**
* The maximum size of a storage value in bytes. A reasonable default is 16 KiB.
**/
maxValueSize: AugmentedConst<u32>;
/**
* The maximum amount of gas that could be expended per block. A reasonable
* default value is 10_000_000.
**/
blockGasLimit: AugmentedConst<Gas>;
};
society: {
[index: string]: Codec;
/**
* The minimum amount of a deposit required for a bid to be made.
**/
candidateDeposit: AugmentedConst<BalanceOf>;
/**
* The amount of the unpaid reward that gets deducted in the case that either a skeptic
* doesn't vote or someone votes in the wrong way.
**/
wrongSideDeduction: AugmentedConst<BalanceOf>;
/**
* The number of times a member may vote the wrong way (or not at all, when they are a skeptic)
* before they become suspended.
**/
maxStrikes: AugmentedConst<u32>;
/**
* The amount of incentive paid within each period. Doesn't include VoterTip.
**/
periodSpend: AugmentedConst<BalanceOf>;
/**
* The number of blocks between candidate/membership rotation periods.
**/
rotationPeriod: AugmentedConst<BlockNumber>;
/**
* The number of blocks between membership challenges.
**/
challengePeriod: AugmentedConst<BlockNumber>;
};
}
}
+8
View File
@@ -0,0 +1,8 @@
// 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 './consts';
import './query';
import './rpc';
import './tx';
+804
View File
@@ -0,0 +1,804 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { AnyNumber, ITuple } from '@polkadot/types/types';
import { Option, Raw, Vec } from '@polkadot/types/codec';
import { Bytes, Data, bool, u32, u64 } from '@polkadot/types/primitive';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, Index, KeyTypeId, Moment, Perbill, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BabeAuthorityWeight, MaybeVrf } from '@polkadot/types/interfaces/babe';
import { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { CodeHash, ContractInfo, Gas, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from '@polkadot/types/interfaces/democracy';
import { Vote, VoteThreshold } from '@polkadot/types/interfaces/elections';
import { AuthorityList, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
import { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
import { AuthIndex } from '@polkadot/types/interfaces/imOnline';
import { Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { EraIndex, EraPoints, Exposure, Forcing, MomentOf, Nominations, RewardDestination, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
import { DigestOf, EventIndex, EventRecord } from '@polkadot/types/interfaces/system';
import { OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
import { Observable } from 'rxjs';
declare module '@polkadot/api/types/storage' {
export interface AugmentedQueries<ApiType> {
system: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Extrinsics nonce for accounts.
**/
accountNonce: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Index>> & QueryableStorageEntry<ApiType>;
/**
* Total extrinsics count for the current block.
**/
extrinsicCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>> & QueryableStorageEntry<ApiType>;
/**
* Total weight for all extrinsics put together, for the current block.
**/
allExtrinsicsWeight: AugmentedQuery<ApiType, () => Observable<Option<Weight>>> & QueryableStorageEntry<ApiType>;
/**
* Total length (in bytes) for all extrinsics put together, for the current block.
**/
allExtrinsicsLen: AugmentedQuery<ApiType, () => Observable<Option<u32>>> & QueryableStorageEntry<ApiType>;
/**
* Map of block numbers to block hashes.
**/
blockHash: AugmentedQuery<ApiType, (arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Hash>> & QueryableStorageEntry<ApiType>;
/**
* Extrinsics data for the current block (maps an extrinsic's index to its data).
**/
extrinsicData: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Bytes>> & QueryableStorageEntry<ApiType>;
/**
* The current block number being processed. Set by `execute_block`.
**/
number: AugmentedQuery<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
/**
* Hash of the previous block.
**/
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>> & QueryableStorageEntry<ApiType>;
/**
* Extrinsics root of the current block, also part of the block header.
**/
extrinsicsRoot: AugmentedQuery<ApiType, () => Observable<Hash>> & QueryableStorageEntry<ApiType>;
/**
* Digest of the current block, also part of the block header.
**/
digest: AugmentedQuery<ApiType, () => Observable<DigestOf>> & QueryableStorageEntry<ApiType>;
/**
* Events deposited for the current block.
**/
events: AugmentedQuery<ApiType, () => Observable<Vec<EventRecord>>> & QueryableStorageEntry<ApiType>;
/**
* The number of events in the `Events<T>` list.
**/
eventCount: AugmentedQuery<ApiType, () => Observable<EventIndex>> & QueryableStorageEntry<ApiType>;
/**
* Mapping between a topic (represented by T::Hash) and a vector of indexes
* of events in the `<Events<T>>` list.
* All topic vectors have deterministic storage locations depending on the topic. This
* allows light-clients to leverage the changes trie storage tracking mechanism and
* in case of changes fetch the list of events of interest.
* The value has the type `(T::BlockNumber, EventIndex)` because if we used only just
* the `EventIndex` then in case if the topic has the same contents on the next block
* no notification will be triggered thus the event might be lost.
**/
eventTopics: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Vec<ITuple<[BlockNumber, EventIndex]>>>> & QueryableStorageEntry<ApiType>;
};
utility: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The set of open multisig operations.
**/
multisigs: AugmentedQuery<ApiType, (key1: AccountId | string | Uint8Array, key2: Raw | string | Uint8Array) => Observable<Option<Multisig>>> & QueryableStorageEntry<ApiType>;
};
babe: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Current epoch index.
**/
epochIndex: AugmentedQuery<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
/**
* Current epoch authorities.
**/
authorities: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AuthorityId, BabeAuthorityWeight]>>>> & QueryableStorageEntry<ApiType>;
/**
* The slot at which the first epoch actually started. This is 0
* until the first block of the chain.
**/
genesisSlot: AugmentedQuery<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
/**
* Current slot number.
**/
currentSlot: AugmentedQuery<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
/**
* The epoch randomness for the *current* epoch.
* # Security
* This MUST NOT be used for gambling, as it can be influenced by a
* malicious validator in the short term. It MAY be used in many
* cryptographic protocols, however, so long as one remembers that this
* (like everything else on-chain) it is public. For example, it can be
* used where a number is needed that cannot have been chosen by an
* adversary, for purposes such as public-coin zero-knowledge proofs.
**/
randomness: AugmentedQuery<ApiType, () => Observable<Raw>> & QueryableStorageEntry<ApiType>;
/**
* Next epoch randomness.
**/
nextRandomness: AugmentedQuery<ApiType, () => Observable<Raw>> & QueryableStorageEntry<ApiType>;
/**
* Randomness under construction.
* We make a tradeoff between storage accesses and list length.
* We store the under-construction randomness in segments of up to
* `UNDER_CONSTRUCTION_SEGMENT_LENGTH`.
* Once a segment reaches this length, we begin the next one.
* We reset all segments and return to `0` at the beginning of every
* epoch.
**/
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
underConstruction: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Raw>>> & QueryableStorageEntry<ApiType>;
/**
* Temporary value (cleared at block finalization) which is `Some`
* if per-block initialization has already been called for current block.
**/
initialized: AugmentedQuery<ApiType, () => Observable<Option<MaybeVrf>>> & QueryableStorageEntry<ApiType>;
};
timestamp: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Current time for the current block.
**/
now: AugmentedQuery<ApiType, () => Observable<Moment>> & QueryableStorageEntry<ApiType>;
/**
* Did the timestamp get updated in this block?
**/
didUpdate: AugmentedQuery<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
authorship: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Uncles
**/
uncles: AugmentedQuery<ApiType, () => Observable<Vec<UncleEntryItem>>> & QueryableStorageEntry<ApiType>;
/**
* Author of current block.
**/
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* Whether uncles were already set in this block.
**/
didSetUncles: AugmentedQuery<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
indices: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The next free enumeration set.
**/
nextEnumSet: AugmentedQuery<ApiType, () => Observable<AccountIndex>> & QueryableStorageEntry<ApiType>;
/**
* The enumeration sets.
**/
enumSet: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
balances: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The total units issued in the system.
**/
totalIssuance: AugmentedQuery<ApiType, () => Observable<Balance>> & QueryableStorageEntry<ApiType>;
/**
* The balance of an account.
* NOTE: THIS MAY NEVER BE IN EXISTENCE AND YET HAVE A `total().is_zero()`. If the total
* is ever zero, then the entry *MUST* be removed.
**/
account: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<AccountData>> & QueryableStorageEntry<ApiType>;
/**
* Any liquidity locks on some account balances.
* NOTE: Should only be accessed when setting, changing and freeing a lock.
**/
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<BalanceLock>>> & QueryableStorageEntry<ApiType>;
/**
* True if network has been upgraded to this version.
* True for new networks.
**/
isUpgraded: AugmentedQuery<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
transactionPayment: {
[index: string]: QueryableStorageEntry<ApiType>;
nextFeeMultiplier: AugmentedQuery<ApiType, () => Observable<Multiplier>> & QueryableStorageEntry<ApiType>;
};
staking: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The ideal number of staking participants.
**/
validatorCount: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
/**
* Minimum number of staking participants before emergency conditions are imposed.
**/
minimumValidatorCount: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
/**
* Any validators that may never be slashed or forcibly kicked. It's a Vec since they're
* easy to initialize and the performance hit is minimal (we expect no more than four
* invulnerables) and restricted to testnets.
**/
invulnerables: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* Map from all locked "stash" accounts to the controller account.
**/
bonded: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* Map from all (unlocked) "controller" accounts to the info regarding the staking.
**/
ledger: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<StakingLedger>>> & QueryableStorageEntry<ApiType>;
/**
* Where the reward payment should be made. Keyed by stash.
**/
payee: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<RewardDestination>> & QueryableStorageEntry<ApiType>;
/**
* The map from (wannabe) validator stash key to the preferences of that validator.
**/
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>> & QueryableStorageEntry<ApiType>;
/**
* The map from nominator stash key to the set of stash keys of all validators to nominate.
* NOTE: is private so that we can ensure upgraded before all typical accesses.
* Direct storage APIs can still bypass this protection.
**/
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Nominations>>> & QueryableStorageEntry<ApiType>;
/**
* Nominators for a particular account that is in action right now. You can't iterate
* through validators here, but you can find them in the Session module.
* This is keyed by the stash account.
**/
stakers: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Exposure>> & QueryableStorageEntry<ApiType>;
/**
* The currently elected validator set keyed by stash account ID.
**/
currentElected: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* The current era index.
**/
currentEra: AugmentedQuery<ApiType, () => Observable<EraIndex>> & QueryableStorageEntry<ApiType>;
/**
* The start of the current era.
**/
currentEraStart: AugmentedQuery<ApiType, () => Observable<MomentOf>> & QueryableStorageEntry<ApiType>;
/**
* The session index at which the current era started.
**/
currentEraStartSessionIndex: AugmentedQuery<ApiType, () => Observable<SessionIndex>> & QueryableStorageEntry<ApiType>;
/**
* Rewards for the current era. Using indices of current elected set.
**/
currentEraPointsEarned: AugmentedQuery<ApiType, () => Observable<EraPoints>> & QueryableStorageEntry<ApiType>;
/**
* The amount of balance actively at stake for each validator slot, currently.
* This is used to derive rewards and punishments.
**/
slotStake: AugmentedQuery<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
/**
* True if the next session change will be a new era regardless of index.
**/
forceEra: AugmentedQuery<ApiType, () => Observable<Forcing>> & QueryableStorageEntry<ApiType>;
/**
* The percentage of the slash that is distributed to reporters.
* The rest of the slashed value is handled by the `Slash`.
**/
slashRewardFraction: AugmentedQuery<ApiType, () => Observable<Perbill>> & QueryableStorageEntry<ApiType>;
/**
* The amount of currency given to reporters of a slash event which was
* canceled by extraordinary circumstances (e.g. governance).
**/
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
/**
* All unapplied slashes that are queued for later.
**/
unappliedSlashes: AugmentedQuery<ApiType, (arg: EraIndex | AnyNumber | Uint8Array) => Observable<Vec<UnappliedSlash>>> & QueryableStorageEntry<ApiType>;
/**
* A mapping from still-bonded eras to the first session index of that era.
**/
bondedEras: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[EraIndex, SessionIndex]>>>> & QueryableStorageEntry<ApiType>;
/**
* All slashing events on validators, mapped by era to the highest slash proportion
* and slash value of the era.
**/
validatorSlashInEra: AugmentedQuery<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ITuple<[Perbill, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
/**
* All slashing events on nominators, mapped by era to the highest slash value of the era.
**/
nominatorSlashInEra: AugmentedQuery<ApiType, (key1: EraIndex | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<BalanceOf>>> & QueryableStorageEntry<ApiType>;
/**
* Slashing spans for stash accounts.
**/
slashingSpans: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<SlashingSpans>>> & QueryableStorageEntry<ApiType>;
/**
* Records information about the maximum slash of a stash within a slashing span,
* as well as how much reward has been paid out.
**/
spanSlash: AugmentedQuery<ApiType, (arg: ITuple<[AccountId, SpanIndex]>) => Observable<SpanRecord>> & QueryableStorageEntry<ApiType>;
/**
* The earliest era for which we have a pending, unapplied slash.
**/
earliestUnappliedSlash: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>> & QueryableStorageEntry<ApiType>;
/**
* The version of storage for upgrade.
**/
storageVersion: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
};
session: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The current set of validators.
**/
validators: AugmentedQuery<ApiType, () => Observable<Vec<ValidatorId>>> & QueryableStorageEntry<ApiType>;
/**
* Current index of the session.
**/
currentIndex: AugmentedQuery<ApiType, () => Observable<SessionIndex>> & QueryableStorageEntry<ApiType>;
/**
* True if the underlying economic identities or weighting behind the validators
* has changed in the queued validator set.
**/
queuedChanged: AugmentedQuery<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
/**
* The queued keys for the next session. When the next session begins, these keys
* will be used to determine the validator's session keys.
**/
queuedKeys: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[ValidatorId, Keys]>>>> & QueryableStorageEntry<ApiType>;
/**
* Indices of disabled validators.
* The set is cleared when `on_session_ending` returns a new set of identities.
**/
disabledValidators: AugmentedQuery<ApiType, () => Observable<Vec<u32>>> & QueryableStorageEntry<ApiType>;
/**
* The next session keys for a validator.
* The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of
* the trie. Having all data in the same branch should prevent slowing down other queries.
**/
nextKeys: AugmentedQuery<ApiType, (key1: Bytes | string | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<Option<Keys>>> & QueryableStorageEntry<ApiType>;
/**
* The owner of a key. The second key is the `KeyTypeId` + the encoded key.
* The first key is always `DEDUP_KEY_PREFIX` to have all the data in the same branch of
* the trie. Having all data in the same branch should prevent slowing down other queries.
**/
keyOwner: AugmentedQuery<ApiType, (key1: Bytes | string | Uint8Array, key2: ITuple<[KeyTypeId, Bytes]>) => Observable<Option<ValidatorId>>> & QueryableStorageEntry<ApiType>;
};
democracy: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The number of (public) proposals that have been made so far.
**/
publicPropCount: AugmentedQuery<ApiType, () => Observable<PropIndex>> & QueryableStorageEntry<ApiType>;
/**
* The public proposals. Unsorted. The second item is the proposal's hash.
**/
publicProps: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[PropIndex, Hash, AccountId]>>>> & QueryableStorageEntry<ApiType>;
/**
* Map of hashes to the proposal preimage, along with who registered it and their deposit.
* The block number is the block at which it was deposited.
**/
preimages: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ITuple<[Bytes, AccountId, BalanceOf, BlockNumber]>>>> & QueryableStorageEntry<ApiType>;
/**
* Those who have locked a deposit.
**/
depositOf: AugmentedQuery<ApiType, (arg: PropIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[BalanceOf, Vec<AccountId>]>>>> & QueryableStorageEntry<ApiType>;
/**
* The next free referendum index, aka the number of referenda started so far.
**/
referendumCount: AugmentedQuery<ApiType, () => Observable<ReferendumIndex>> & QueryableStorageEntry<ApiType>;
/**
* The lowest referendum index representing an unbaked referendum. Equal to
* `ReferendumCount` if there isn't a unbaked referendum.
**/
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<ReferendumIndex>> & QueryableStorageEntry<ApiType>;
/**
* Information concerning any given referendum.
**/
referendumInfoOf: AugmentedQuery<ApiType, (arg: ReferendumIndex | AnyNumber | Uint8Array) => Observable<Option<ReferendumInfo>>> & QueryableStorageEntry<ApiType>;
/**
* Queue of successful referenda to be dispatched. Stored ordered by block number.
**/
dispatchQueue: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>> & QueryableStorageEntry<ApiType>;
/**
* Get the voters for the current proposal.
**/
votersFor: AugmentedQuery<ApiType, (arg: ReferendumIndex | AnyNumber | Uint8Array) => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* Get the vote in a given referendum of a particular voter. The result is meaningful only
* if `voters_for` includes the voter when called with the referendum (you'll get the
* default `Vote` value otherwise). If you don't want to check `voters_for`, then you can
* also check for simple existence with `VoteOf::exists` first.
**/
voteOf: AugmentedQuery<ApiType, (arg: ITuple<[ReferendumIndex, AccountId]>) => Observable<Vote>> & QueryableStorageEntry<ApiType>;
/**
* Who is able to vote for whom. Value is the fund-holding account, key is the
* vote-transaction-sending account.
**/
proxy: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* 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>;
/**
* 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.
**/
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<BlockNumber>>> & QueryableStorageEntry<ApiType>;
/**
* True if the last referendum tabled was submitted externally. False if it was a public
* proposal.
**/
lastTabledWasExternal: AugmentedQuery<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
/**
* The referendum to be tabled whenever it would be valid to table an external proposal.
* This happens when a referendum needs to be tabled and one of two conditions are met:
* - `LastTabledWasExternal` is `false`; or
* - `PublicProps` is empty.
**/
nextExternal: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[Hash, VoteThreshold]>>>> & QueryableStorageEntry<ApiType>;
/**
* A record of who vetoed what. Maps proposal hash to a possible existent block number
* (until when it may not be resubmitted) and who vetoed it.
**/
blacklist: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ITuple<[BlockNumber, Vec<AccountId>]>>>> & QueryableStorageEntry<ApiType>;
/**
* Record of all proposals that have been subject to emergency cancellation.
**/
cancellations: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
council: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The hashes of the active proposals.
**/
proposals: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>> & QueryableStorageEntry<ApiType>;
/**
* Actual proposal for a given hash, if it's current.
**/
proposalOf: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Proposal>>> & QueryableStorageEntry<ApiType>;
/**
* Votes on a given proposal, if it is ongoing.
**/
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>> & QueryableStorageEntry<ApiType>;
/**
* Proposals so far.
**/
proposalCount: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
/**
* The current members of the collective. This is stored sorted (just by value).
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
technicalCommittee: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The hashes of the active proposals.
**/
proposals: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>> & QueryableStorageEntry<ApiType>;
/**
* Actual proposal for a given hash, if it's current.
**/
proposalOf: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Proposal>>> & QueryableStorageEntry<ApiType>;
/**
* Votes on a given proposal, if it is ongoing.
**/
voting: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Votes>>> & QueryableStorageEntry<ApiType>;
/**
* Proposals so far.
**/
proposalCount: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
/**
* The current members of the collective. This is stored sorted (just by value).
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
elections: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The current elected membership. Sorted based on account id.
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
/**
* The current runners_up. Sorted based on low to high merit (worse to best runner).
**/
runnersUp: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
/**
* The total number of vote rounds that have happened, excluding the upcoming one.
**/
electionRounds: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
/**
* Votes of a particular voter, with the round index of the votes.
**/
votesOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* Locked stake of a voter.
**/
stakeOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
/**
* The present candidate list. Sorted based on account-id. A current member or a runner can
* never enter this vector and is always implicitly assumed to be a candidate.
**/
candidates: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
technicalMembership: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The current membership, stored as an ordered Vec.
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
};
grandpa: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* DEPRECATED
* This used to store the current authority set, which has been migrated to the well-known
* GRANDPA_AUTHORITES_KEY unhashed key.
**/
authorities: AugmentedQuery<ApiType, () => Observable<AuthorityList>> & QueryableStorageEntry<ApiType>;
/**
* State of the current authority set.
**/
state: AugmentedQuery<ApiType, () => Observable<StoredState>> & QueryableStorageEntry<ApiType>;
/**
* Pending change: (signaled at, scheduled change).
**/
pendingChange: AugmentedQuery<ApiType, () => Observable<Option<StoredPendingChange>>> & QueryableStorageEntry<ApiType>;
/**
* next block number where we can force a change.
**/
nextForced: AugmentedQuery<ApiType, () => Observable<Option<BlockNumber>>> & QueryableStorageEntry<ApiType>;
/**
* `true` if we are currently stalled.
**/
stalled: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[BlockNumber, BlockNumber]>>>> & QueryableStorageEntry<ApiType>;
/**
* The number of changes (both in terms of keys and underlying economic responsibilities)
* in the "set" of Grandpa validators from genesis.
**/
currentSetId: AugmentedQuery<ApiType, () => Observable<SetId>> & QueryableStorageEntry<ApiType>;
/**
* A mapping from grandpa set ID to the index of the *most recent* session for which its members were responsible.
**/
setIdSession: AugmentedQuery<ApiType, (arg: SetId | AnyNumber | Uint8Array) => Observable<Option<SessionIndex>>> & QueryableStorageEntry<ApiType>;
};
treasury: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Number of proposals that have been made.
**/
proposalCount: AugmentedQuery<ApiType, () => Observable<ProposalIndex>> & QueryableStorageEntry<ApiType>;
/**
* Proposals that have been made.
**/
proposals: AugmentedQuery<ApiType, (arg: ProposalIndex | AnyNumber | Uint8Array) => Observable<Option<TreasuryProposal>>> & QueryableStorageEntry<ApiType>;
/**
* Proposal indices that have been approved but not yet awarded.
**/
approvals: AugmentedQuery<ApiType, () => Observable<Vec<ProposalIndex>>> & QueryableStorageEntry<ApiType>;
/**
* Tips that are not yet completed. Keyed by the hash of `(reason, who)` from the value.
* This has the insecure enumerable hash function since the key itself is already
* guaranteed to be a secure hash.
**/
tips: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<OpenTip>>> & QueryableStorageEntry<ApiType>;
/**
* Simple preimage lookup from the reason's hash to the original data. Again, has an
* insecure enumerable hash since the key is guaranteed to be the result of a secure hash.
**/
reasons: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
};
contracts: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Gas spent so far in this block.
**/
gasSpent: AugmentedQuery<ApiType, () => Observable<Gas>> & QueryableStorageEntry<ApiType>;
/**
* Current cost schedule for contracts.
**/
currentSchedule: AugmentedQuery<ApiType, () => Observable<Schedule>> & QueryableStorageEntry<ApiType>;
/**
* A mapping from an original code hash to the original code, untouched by instrumentation.
**/
pristineCode: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
/**
* A mapping between an original code hash and instrumented wasm code, ready for execution.
**/
codeStorage: AugmentedQuery<ApiType, (arg: CodeHash | string | Uint8Array) => Observable<Option<PrefabWasmModule>>> & QueryableStorageEntry<ApiType>;
/**
* The subtrie counter.
**/
accountCounter: AugmentedQuery<ApiType, () => Observable<u64>> & QueryableStorageEntry<ApiType>;
/**
* The code associated with a given account.
**/
contractInfoOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ContractInfo>>> & QueryableStorageEntry<ApiType>;
/**
* The price of one unit of gas.
**/
gasPrice: AugmentedQuery<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
};
sudo: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The `AccountId` of the sudo key.
**/
key: AugmentedQuery<ApiType, () => Observable<AccountId>> & QueryableStorageEntry<ApiType>;
};
imOnline: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The block number after which it's ok to send heartbeats in current session.
* At the beginning of each session we set this to a value that should
* fall roughly in the middle of the session duration.
* The idea is to first wait for the validators to produce a block
* in the current session, so that the heartbeat later on will not be necessary.
**/
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
/**
* The current set of keys that may issue a heartbeat.
**/
keys: AugmentedQuery<ApiType, () => Observable<Vec<AuthorityId>>> & QueryableStorageEntry<ApiType>;
/**
* For each session index, we keep a mapping of `AuthIndex`
* to `offchain::OpaqueNetworkState`.
**/
receivedHeartbeats: AugmentedQuery<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: AuthIndex | AnyNumber | Uint8Array) => Observable<Option<Bytes>>> & QueryableStorageEntry<ApiType>;
/**
* For each session index, we keep a mapping of `T::ValidatorId` to the
* number of blocks authored by the given authority.
**/
authoredBlocks: AugmentedQuery<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>> & QueryableStorageEntry<ApiType>;
};
offences: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The primary structure that holds all offence records keyed by report identifiers.
**/
reports: AugmentedQuery<ApiType, (arg: ReportIdOf | string | Uint8Array) => Observable<Option<OffenceDetails>>> & QueryableStorageEntry<ApiType>;
/**
* A vector of reports of the same kind that happened at the same time slot.
**/
concurrentReportsIndex: AugmentedQuery<ApiType, (key1: Kind | string | Uint8Array, key2: OpaqueTimeSlot | string | Uint8Array) => Observable<Vec<ReportIdOf>>> & QueryableStorageEntry<ApiType>;
/**
* Enumerates all reports of a kind along with the time they happened.
* All reports are sorted by the time of offence.
* Note that the actual type of this mapping is `Vec<u8>`, this is because values of
* different types are not supported at the moment so we are doing the manual serialization.
**/
reportsByKindIndex: AugmentedQuery<ApiType, (arg: Kind | string | Uint8Array) => Observable<Bytes>> & QueryableStorageEntry<ApiType>;
};
randomnessCollectiveFlip: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Series of block headers from the last 81 blocks that acts as random seed material. This
* is arranged as a ring buffer with `block_number % 81` being the index into the `Vec` of
* the oldest hash.
**/
randomMaterial: AugmentedQuery<ApiType, () => Observable<Vec<Hash>>> & QueryableStorageEntry<ApiType>;
};
identity: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Information that is pertinent to identify the entity behind an account.
**/
identityOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Registration>>> & QueryableStorageEntry<ApiType>;
/**
* The super-identity of an alternative "sub" identity together with its name, within that
* context. If the account is not some other account's sub-identity, then just `None`.
**/
superOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[AccountId, Data]>>>> & QueryableStorageEntry<ApiType>;
/**
* Alternative "sub" identities of this account.
* The first item is the deposit, the second is a vector of the accounts.
**/
subsOf: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>> & QueryableStorageEntry<ApiType>;
/**
* The set of registrars. Not expected to get very big as can only be added through a
* special origin (likely a council motion).
* The index into this can be cast to `RegistrarIndex` to get a valid value.
**/
registrars: AugmentedQuery<ApiType, () => Observable<Vec<Option<RegistrarInfo>>>> & QueryableStorageEntry<ApiType>;
};
society: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The first member.
**/
founder: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* A hash of the rules of this society concerning membership. Can only be set once and
* only by the founder.
**/
rules: AugmentedQuery<ApiType, () => Observable<Option<Hash>>> & QueryableStorageEntry<ApiType>;
/**
* The current set of candidates; bidders that are attempting to become members.
**/
candidates: AugmentedQuery<ApiType, () => Observable<Vec<Bid>>> & QueryableStorageEntry<ApiType>;
/**
* The set of suspended candidates.
**/
suspendedCandidates: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<ITuple<[BalanceOf, BidKind]>>>> & QueryableStorageEntry<ApiType>;
/**
* Amount of our account balance that is specifically for the next round's bid(s).
**/
pot: AugmentedQuery<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
/**
* The most primary from the most recently approved members.
**/
head: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* The current set of members, ordered.
**/
members: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* The set of suspended members.
**/
suspendedMembers: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<bool>> & QueryableStorageEntry<ApiType>;
/**
* The current bids, stored ordered by the value of the bid.
**/
bids: AugmentedQuery<ApiType, () => Observable<Vec<Bid>>> & QueryableStorageEntry<ApiType>;
/**
* Members currently vouching or banned from vouching again
**/
vouching: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VouchingStatus>>> & QueryableStorageEntry<ApiType>;
/**
* Pending payouts; ordered by block number, with the amount that should be paid out.
**/
payouts: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<ITuple<[BlockNumber, BalanceOf]>>>> & QueryableStorageEntry<ApiType>;
/**
* The ongoing number of losing votes cast by the member.
**/
strikes: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<StrikeCount>> & QueryableStorageEntry<ApiType>;
/**
* Double map from Candidate -> Voter -> (Maybe) Vote.
**/
votes: AugmentedQuery<ApiType, (key1: AccountId | string | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<SocietyVote>>> & QueryableStorageEntry<ApiType>;
/**
* The defending member currently being challenged.
**/
defender: AugmentedQuery<ApiType, () => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
/**
* Votes for the defender.
**/
defenderVotes: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<SocietyVote>>> & QueryableStorageEntry<ApiType>;
/**
* The max number of members for the society at one time.
**/
maxMembers: AugmentedQuery<ApiType, () => Observable<u32>> & QueryableStorageEntry<ApiType>;
};
recovery: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The set of recoverable accounts and their recovery configuration.
**/
recoverable: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<RecoveryConfig>>> & QueryableStorageEntry<ApiType>;
/**
* Active recovery attempts.
* First account is the account to be recovered, and the second account
* is the user trying to recover the account.
**/
activeRecoveries: AugmentedQuery<ApiType, (key1: AccountId | string | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<Option<ActiveRecovery>>> & QueryableStorageEntry<ApiType>;
/**
* The final list of recovered accounts.
* Map from the recovered account to the user who can access it.
**/
recovered: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
};
vesting: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Information regarding the vesting of a given account.
**/
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingInfo>>> & QueryableStorageEntry<ApiType>;
};
}
}
+178
View File
@@ -0,0 +1,178 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { AnyNumber, Codec, IExtrinsic } from '@polkadot/types/types';
import { Option, Vec } from '@polkadot/types/codec';
import { Bytes, H256, StorageData, StorageKey, Text, u32, u64 } from '@polkadot/types/primitive';
import { Metadata } from '@polkadot/types';
import { AccountId, BlockNumber, Extrinsic, Hash, Header, Index, SignedBlock } from '@polkadot/types/interfaces/runtime';
import { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
import { BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
import { Observable } from 'rxjs';
declare module '@polkadot/rpc-core/types.jsonrpc' {
export interface RpcInterface {
account: {
/**
* Retrieves the next accountIndex as available on the node
**/
nextIndex(accountId: AccountId | string | Uint8Array): Observable<Index>;
};
author: {
/**
* Insert a key into the keystore.
**/
insertKey(keyType: Text | string, suri: Text | string, publicKey: Bytes | string | Uint8Array): Observable<Bytes>;
/**
* Returns all pending extrinsics, potentially grouped by sender
**/
pendingExtrinsics(): Observable<Vec<Extrinsic>>;
/**
* Remove given extrinsic from the pool and temporarily ban it to prevent reimporting
**/
removeExtrinsic(bytesOrHash: Vec<ExtrinsicOrHash> | (ExtrinsicOrHash | { hash: any } | { extrinsic: any } | string | Uint8Array)[]): Observable<Vec<Hash>>;
/**
* Generate new session keys and returns the corresponding public keys
**/
rotateKeys(): Observable<Bytes>;
/**
* Submit and subscribe to watch an extrinsic until unsubscribed
**/
submitAndWatchExtrinsic(extrinsic: IExtrinsic): Observable<ExtrinsicStatus>;
/**
* Submit a fully formatted extrinsic for block inclusion
**/
submitExtrinsic(extrinsic: IExtrinsic): Observable<Hash>;
};
chain: {
/**
* Get header and body of a relay chain block
**/
getBlock(hash?: BlockHash | string | Uint8Array): Observable<SignedBlock>;
/**
* Get the block hash for a specific block
**/
getBlockHash(blockNumber?: BlockNumber | AnyNumber | Uint8Array): Observable<BlockHash>;
/**
* Get hash of the last finalized block in the canon chain
**/
getFinalizedHead(): Observable<BlockHash>;
/**
* Retrieves the header for a specific block
**/
getHeader(hash?: BlockHash | string | Uint8Array): Observable<Header>;
/**
* Retrieves the best finalized header via subscription
**/
subscribeFinalizedHeads(): Observable<Header>;
/**
* Retrieves the best header via subscription
**/
subscribeNewHeads(): Observable<Header>;
};
contracts: {
/**
* Executes a call to a contract
**/
call(callRequest: ContractCallRequest | { origin?: any; dest?: any; value?: any; gasLimit?: any; inputData?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array): Observable<ContractExecResult>;
/**
* Returns the value under a specified storage key in a contract
**/
getStorage(address: AccountId | string | Uint8Array, key: H256 | string | Uint8Array, at?: BlockHash | string | Uint8Array): Observable<Option<Bytes>>;
};
payment: {
/**
* Retrieves the fee information for an encoded extrinsic
**/
queryInfo(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array): Observable<RuntimeDispatchInfo>;
};
rpc: {
/**
* Retrieves the list of RPC methods that are exposed by the node
**/
methods(): Observable<RpcMethods>;
};
state: {
/**
* Perform a call to a builtin on the chain
**/
call(method: Text | string, data: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array): Observable<Bytes>;
/**
* Retrieves the keys with prefix of a specific child storage
**/
getChildKeys(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array): Observable<Vec<StorageKey>>;
/**
* Retrieves the child storage for a key
**/
getChildStorage(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array): Observable<StorageData>;
/**
* Retrieves the child storage hash
**/
getChildStorageHash(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array): Observable<Hash>;
/**
* Retrieves the child storage size
**/
getChildStorageSize(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array): Observable<u64>;
/**
* Retrieves the keys with a certain prefix
**/
getKeys(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array): Observable<Vec<StorageKey>>;
/**
* Returns the runtime metadata
**/
getMetadata(at?: BlockHash | string | Uint8Array): Observable<Metadata>;
/**
* Get the runtime version
**/
getRuntimeVersion(at?: BlockHash | string | Uint8Array): Observable<RuntimeVersion>;
getStorage<T = Codec>(key: any, block?: Hash | Uint8Array | string): Observable<T>;
/**
* Retrieves the storage hash
**/
getStorageHash(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array): Observable<Hash>;
/**
* Retrieves the storage size
**/
getStorageSize(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array): Observable<u64>;
/**
* Query historical storage entries (by key) starting from a start block
**/
queryStorage(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], startBlock: Hash | string | Uint8Array, at?: BlockHash | string | Uint8Array): Observable<Vec<StorageChangeSet>>;
/**
* Retrieves the runtime version via subscription
**/
subscribeRuntimeVersion(): Observable<RuntimeVersion>;
subscribeStorage<T = Codec[]>(keys: any[]): Observable<T>;
};
system: {
/**
* Retrieves the chain
**/
chain(): Observable<Text>;
/**
* Return health status of the node
**/
health(): Observable<Health>;
/**
* Retrieves the node name
**/
name(): Observable<Text>;
/**
* Returns current state of the network
**/
networkState(): Observable<NetworkState>;
/**
* Returns the currently connected peers
**/
peers(): Observable<Vec<PeerInfo>>;
/**
* Get a custom set of properties as a JSON object, defined in the chain spec
**/
properties(): Observable<ChainProperties>;
/**
* Retrieves the version of the node
**/
version(): Observable<Text>;
};
}
}
File diff suppressed because it is too large Load Diff
+70
View File
@@ -0,0 +1,70 @@
// 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 { Observable } from 'rxjs';
import { AnyFunction, Callback, Codec } from '@polkadot/types/types';
// Prepend an element V onto the beginning of a tuple T.
// Cons<1, [2,3,4]> is [1,2,3,4]
type Cons<V, T extends any[]> = ((v: V, ...t: T) => void) extends ((...r: infer R) => void)
? R
: never;
// Append an element V onto the end of a tuple T
// Push<[1,2,3],4> is [1,2,3,4]
// note that this DOES NOT PRESERVE optionality/readonly in tuples.
// So unfortunately Push<[1, 2?, 3?], 4> is [1,2|undefined,3|undefined,4]
type Push<T extends any[], V> = (
(
Cons<any, Required<T>> extends infer R
? { [K in keyof R]: K extends keyof T ? T[K] : V }
: never
) extends infer P
? P extends any[] ? P : never
: never
);
export type ApiTypes = 'promise' | 'rxjs';
// Returns the inner type of an Observable
export type ObsInnerType<O extends Observable<any>> = O extends Observable<infer U> ? U : never;
export type UnsubscribePromise = Promise<() => void>;
// FIXME The day TS has higher-kinded types, we can remove this hardcoded stuff
export type PromiseOrObs<ApiType extends ApiTypes, T> = ApiType extends 'rxjs'
? Observable<T>
: Promise<T>;
// Here are the return types of these parts of the api:
// - api.query.*.*: no exact typings
// - api.tx.*.*: SubmittableExtrinsic<ApiType extends ApiTypes>
// - api.derive.*.*: MethodResult<ApiType, F>
// - api.rpc.*.*: no exact typings (for now, FIXME: should be MethodResult<ApiType, F>, like in derive)
// These are the types that don't lose type information (used for api.derive.*)
// Also use these for api.rpc.* https://github.com/polkadot-js/api/issues/1009
export interface RxResult<F extends AnyFunction> {
(...args: Parameters<F>): Observable<ObsInnerType<ReturnType<F>>>;
<T>(...args: Parameters<F>): Observable<T>;
}
export interface PromiseResult<F extends AnyFunction> {
(...args: Parameters<F>): Promise<ObsInnerType<ReturnType<F>>>;
(...args: Push<Parameters<F>, Callback<ObsInnerType<ReturnType<F>>>>): UnsubscribePromise;
<T extends Codec | Codec[]>(...args: Parameters<F>): Promise<T>;
<T extends Codec | Codec[]>(...args: Push<Parameters<F>, Callback<T>>): UnsubscribePromise;
}
// FIXME The day TS has higher-kinded types, we can remove this hardcoded stuff
export type MethodResult<ApiType extends ApiTypes, F extends AnyFunction> = ApiType extends 'rxjs'
? RxResult<F>
: PromiseResult<F>;
// In the abstract `decorateMethod` in Base.ts, we can also pass in some meta-
// information. This describes it.
export interface DecorateMethodOptions {
methodName?: string;
}
export type DecorateMethod<ApiType extends ApiTypes> = <Method extends (...args: any[]) => Observable<any>>(method: Method, options?: DecorateMethodOptions) => any;
+130
View File
@@ -0,0 +1,130 @@
// 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.
// Module augmentation so that `api.{consts,query,rpc,tx}.*.*` work
import './augment';
import BN from 'bn.js';
import { DeriveCustom, ExactDerive } from '@polkadot/api-derive';
import { Constants } from '@polkadot/metadata/Decorated/types';
import { RpcInterface, UserRpc } from '@polkadot/rpc-core/types';
import { Metadata } from '@polkadot/types';
import { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import { RegistryTypes, SignatureOptions, SignerPayloadJSON, SignerPayloadRaw, Registry } from '@polkadot/types/types';
import ApiBase from '../base';
import { SubmittableResultImpl } from '../submittable/types';
import { DeriveAllSections } from '../util/decorate';
import { DecoratedRpc } from './rpc';
import { QueryableStorage, QueryableStorageMulti } from './storage';
import { SubmittableExtrinsics } from './submittable';
import { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
export * from '../submittable/types';
export * from './base';
export * from './rpc';
export * from './storage';
export * from './submittable';
export interface ApiOptions {
/**
* @description Add custom derives to be injected
*/
derives?: DeriveCustom;
/**
* @description prebundles is a map of 'genesis hash and runtime spec version' as key to metadata's hex string
* if genesis hash and runtime spec version matches, then use metadata, else fetch it from chain
*/
metadata?: Record<string, string>;
/**
* @description Transport Provider from rpc-provider. If not specified, it will default to
* connecting to a WsProvider connecting localhost with the default port, i.e. `ws://127.0.0.1:9944`
*/
provider?: ProviderInterface;
/**
* @description A type registry to use along with this instance
*/
registry?: Registry;
/**
* @description User-defined RPC methods
*/
rpc?: UserRpc;
/**
* @description An external signer which will be used to sign extrinsic when account passed in is not KeyringPair
*/
signer?: Signer;
/**
* @description The source object to use for runtime information (only used when cloning)
*/
source?: ApiBase<any>;
/**
* @description Additional types used by runtime modules. This is nessusary if the runtime modules
* uses types not available in the base Substrate runtime.
*/
types?: RegistryTypes;
/**
* @description Additional types that are injected based on the chain we are connecting to. There are keyed by the chain, i.e. `{ 'Kusama CC1': { ... } }`
*/
typesChain?: Record<string, RegistryTypes>;
/**
* @description Additional types that are injected based on the type of node we are connecting to, as set via specName in the runtime version. There are keyed by the node, i.e. `{ 'edgeware': { ... } }`
*/
typesSpec?: Record<string, RegistryTypes>;
}
// A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
export interface ApiInterfaceRx {
consts: Constants;
// TODO This needs to be typed correctly
derive: DeriveAllSections<'rxjs', ExactDerive>;
extrinsicType: number;
genesisHash: Hash;
hasSubscriptions: boolean;
registry: Registry;
runtimeMetadata: Metadata;
runtimeVersion: RuntimeVersion;
query: QueryableStorage<'rxjs'>;
queryMulti: QueryableStorageMulti<'rxjs'>;
rpc: DecoratedRpc<'rxjs', RpcInterface>;
tx: SubmittableExtrinsics<'rxjs'>;
signer?: Signer;
}
export type ApiInterfaceEvents = ProviderInterfaceEmitted | 'ready';
export interface SignerOptions extends SignatureOptions {
blockNumber: BN;
genesisHash: Hash;
}
export interface SignerResult {
/**
* @description The id for this request
*/
id: number;
/**
* @description The resulting signature in hex
*/
signature: string;
}
export interface Signer {
/**
* @description signs an extrinsic payload from a serialized form
*/
signPayload?: (payload: SignerPayloadJSON) => Promise<SignerResult>;
/**
* @description signs a raw payload, only the bytes data as supplied
*/
signRaw?: (raw: SignerPayloadRaw) => Promise<SignerResult>;
/**
* @description Receives an update for the extrinsic signed by a `signer.sign`
*/
update?: (id: number, status: Hash | SubmittableResultImpl) => void;
}
export { ApiBase };
+17
View File
@@ -0,0 +1,17 @@
// 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 { AnyFunction } from '@polkadot/types/types';
import { ApiTypes, MethodResult } from './base';
export type DecoratedRpcSection<ApiType extends ApiTypes, Section> = {
[Method in keyof Section]: Section[Method] extends AnyFunction
? MethodResult<ApiType, Section[Method]>
: never
}
export type DecoratedRpc<ApiType extends ApiTypes, AllSections> = {
[Section in keyof AllSections]: DecoratedRpcSection<ApiType, AllSections[Section]>
}
+77
View File
@@ -0,0 +1,77 @@
// 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 { Observable } from 'rxjs';
import { u64 } from '@polkadot/types';
import { Hash } from '@polkadot/types/interfaces';
import { AnyFunction, Callback, Codec, CodecArg } from '@polkadot/types/types';
import StorageKey, { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { ApiTypes, MethodResult, ObsInnerType, PromiseOrObs, UnsubscribePromise } from './base';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedQueries<ApiType extends ApiTypes> { }
export type AugmentedQuery<ApiType extends ApiTypes, F extends AnyFunction> = MethodResult<ApiType, F> & StorageEntryBase<ApiType, F>
// This is the most generic typings we can have for a storage entry function
type GenericStorageEntryFunction = (arg1?: CodecArg, arg2?: CodecArg) => Observable<Codec>
export type QueryableStorageEntry<ApiType extends ApiTypes> =
ApiType extends 'rxjs'
? AugmentedQuery<'rxjs', GenericStorageEntryFunction>
: AugmentedQuery<'promise', GenericStorageEntryFunction> & StorageEntryPromiseOverloads;
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction> {
at: (hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, ObsInnerType<ReturnType<F>>>;
creator: StorageEntry;
entries: () => PromiseOrObs<ApiType, [StorageKey, ObsInnerType<ReturnType<F>>][]>;
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
key: (...args: Parameters<F>) => string;
keyPrefix: () => string;
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
multi: ApiType extends 'rxjs' ? StorageEntryObservableMulti : StorageEntryPromiseMulti;
}
interface StorageEntryObservableMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Observable<T[]>;
}
interface StorageEntryPromiseMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Promise<T[]>;
<T extends Codec>(args: (CodecArg[] | CodecArg)[], callback: Callback<T[]>): UnsubscribePromise;
}
export interface StorageEntryPromiseOverloads {
(arg1?: CodecArg, arg2?: CodecArg): Promise<Codec>;
<T extends Codec>(arg1?: CodecArg, arg2?: CodecArg): Promise<T>;
<T extends Codec>(callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg: CodecArg, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: CodecArg, arg2: CodecArg, callback: Callback<T>): UnsubscribePromise;
}
export interface QueryableModuleStorage<ApiType extends ApiTypes> {
[index: string]: QueryableStorageEntry<ApiType>;
}
export type QueryableStorageMultiArg<ApiType extends ApiTypes> =
QueryableStorageEntry<ApiType> |
[QueryableStorageEntry<ApiType>, ...CodecArg[]];
export interface QueryableStorageMultiBase<ApiType extends ApiTypes> {
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[]): Observable<T>;
}
export interface QueryableStorageMultiPromise<ApiType extends ApiTypes> {
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[], callback: Callback<T>): UnsubscribePromise;
}
export type QueryableStorageMulti<ApiType extends ApiTypes> =
ApiType extends 'rxjs'
? QueryableStorageMultiBase<ApiType>
: QueryableStorageMultiPromise<ApiType>;
export interface QueryableStorage<ApiType extends ApiTypes> extends AugmentedQueries<ApiType> {
[index: string]: QueryableModuleStorage<ApiType>;
}
+26
View File
@@ -0,0 +1,26 @@
// 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 { AnyFunction, CallBase } from '@polkadot/types/types';
import { SubmittableExtrinsic } from '../submittable/types';
import { ApiTypes } from './base';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AugmentedSubmittables<ApiType extends ApiTypes> { }
export type AugmentedSubmittable<T extends AnyFunction> = T & CallBase;
export interface SubmittableExtrinsicFunction<ApiType extends ApiTypes> extends CallBase {
(...params: any[]): SubmittableExtrinsic<ApiType>;
}
export interface SubmittableModuleExtrinsics<ApiType extends ApiTypes> {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
}
export interface SubmittableExtrinsics<ApiType extends ApiTypes> extends AugmentedSubmittables<ApiType> {
(extrinsic: Uint8Array | string): SubmittableExtrinsic<ApiType>;
[index: string]: SubmittableModuleExtrinsics<ApiType>;
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.0.1",
"version": "1.1.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.8.3",
"@polkadot/types": "^1.0.1",
"@polkadot/util": "^2.0.1",
"@polkadot/util-crypto": "^2.0.1"
"@polkadot/types": "^1.1.1",
"@polkadot/util": "^2.2.1",
"@polkadot/util-crypto": "^2.2.1"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.1"
"@polkadot/keyring": "^2.2.1"
}
}
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { ClassOf, createType, TypeRegistry } from '@polkadot/types/codec/create';
import { hexToU8a } from '@polkadot/util';
import { u8aToHex } from '@polkadot/util';
import Decorated from './Decorated';
import json from '../Metadata/static';
@@ -12,15 +12,13 @@ const registry = new TypeRegistry();
const decorated = new Decorated(registry, json);
describe('Decorated', () => {
it('should correctly get Alice\'s freeBalance storage key (u8a)', (): void => {
it('should correctly get Alice\'s nonce storage key (u8a)', (): void => {
expect(
decorated.query
.balances
.freeBalance('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
).toEqual(
hexToU8a(
'0x0101c2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
u8aToHex(
decorated.query.system.accountNonce('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY')
)
).toEqual(
'0x010126aa394eea5630e07c48ae0c9558cef79c2f82b23e5fd031fb54c292794b4cc42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
);
});
@@ -0,0 +1,19 @@
// Copyright 2017-2020 @polkadot/metadata 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 { Codec } from '@polkadot/types/types';
import { ModuleConstantMetadataLatest } from '@polkadot/types/interfaces';
export type AugmentedConst<T extends Codec> = T & ConstantCodec;
export type ModuleConstants = Record<string, Codec>;
export interface Constants {
[index: string]: ModuleConstants;
}
export interface ConstantCodec extends Codec {
meta: ModuleConstantMetadataLatest;
}
@@ -8,7 +8,7 @@ import { Codec, Registry } from '@polkadot/types/types';
import BN from 'bn.js';
import { Compact, Raw, createType, createTypeUnsafe } from '@polkadot/types/codec';
import StorageKey, { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { assert, isNull, isUndefined, stringLowerFirst, stringToU8a, u8aConcat } from '@polkadot/util';
import { assert, compactStripLength, isNull, isUndefined, stringLowerFirst, stringToU8a, u8aConcat } from '@polkadot/util';
import { xxhashAsU8a } from '@polkadot/util-crypto';
import getHasher, { HasherFunction } from './getHasher';
@@ -218,5 +218,7 @@ export default function createFunction (registry: Registry, itemFn: CreateItemFn
extendDoubleMap(registry, itemFn, storageFn);
}
storageFn.keyPrefix = storageFn.iterKey || compactStripLength(storageFn())[1];
return storageFn;
}
@@ -18,7 +18,7 @@ describe('fromMetadata', (): void => {
const decorated = new Decorated(registry, rpcMetadata);
it('should throw if the storage function expects an argument', (): void => {
expect((): any => decorated.query.balances.freeBalance()).toThrowError(/requires one argument/);
expect((): any => decorated.query.balances.account()).toThrowError(/requires one argument/);
});
it('should return a value if the storage function does not expect an argument', (): void => {
@@ -28,11 +28,11 @@ describe('fromMetadata', (): void => {
it('should return the correct length-prefixed storage key', (): void => {
expect(
u8aToHex(
decorated.query.balances.freeBalance(keyring.alice.address)
decorated.query.system.accountNonce(keyring.alice.address)
)
).toEqual(
// new storage key format
'0x0101c2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
'0x010126aa394eea5630e07c48ae0c9558cef79c2f82b23e5fd031fb54c292794b4cc42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba'
);
});
});
+1 -11
View File
@@ -3,18 +3,8 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { Codec } from '@polkadot/types/types';
import { ModuleConstantMetadataLatest } from '@polkadot/types/interfaces';
export interface ConstantCodec extends Codec {
meta: ModuleConstantMetadataLatest;
}
export type ModuleConstants = Record<string, Codec>;
export interface Constants {
[index: string]: ModuleConstants;
}
export * from './consts/types';
export interface ModuleStorage {
[key: string]: StorageEntry;
@@ -438,7 +438,7 @@
"functions": [
{
"name": "AccountNonce",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -450,7 +450,7 @@
},
{
"name": "ExtrinsicCount",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "u32"
},
@@ -459,7 +459,7 @@
},
{
"name": "BlockHash",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "BlockNumber",
@@ -471,7 +471,7 @@
},
{
"name": "ExtrinsicData",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "u32",
@@ -483,7 +483,7 @@
},
{
"name": "RandomSeed",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Hash"
},
@@ -492,7 +492,7 @@
},
{
"name": "Number",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -503,7 +503,7 @@
},
{
"name": "ParentHash",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Hash"
},
@@ -512,7 +512,7 @@
},
{
"name": "ExtrinsicsRoot",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Hash"
},
@@ -521,7 +521,7 @@
},
{
"name": "Digest",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Digest"
},
@@ -530,7 +530,7 @@
},
{
"name": "Events",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<EventRecord>"
},
@@ -586,7 +586,7 @@
"functions": [
{
"name": "Now",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Moment"
},
@@ -597,7 +597,7 @@
},
{
"name": "BlockPeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Moment"
},
@@ -608,7 +608,7 @@
},
{
"name": "DidUpdate",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "bool"
},
@@ -713,7 +713,7 @@
"functions": [
{
"name": "OriginalAuthorities",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "Vec<SessionKey>"
},
@@ -737,7 +737,7 @@
"functions": [
{
"name": "NextEnumSet",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "AccountIndex"
},
@@ -748,7 +748,7 @@
},
{
"name": "EnumSet",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountIndex",
@@ -816,7 +816,7 @@
"functions": [
{
"name": "TotalIssuance",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -827,7 +827,7 @@
},
{
"name": "ExistentialDeposit",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -838,7 +838,7 @@
},
{
"name": "TransferFee",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -849,7 +849,7 @@
},
{
"name": "CreationFee",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -860,7 +860,7 @@
},
{
"name": "FreeBalance",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -884,7 +884,7 @@
},
{
"name": "ReservedBalance",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -909,7 +909,7 @@
},
{
"name": "TransactionBaseFee",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -920,7 +920,7 @@
},
{
"name": "TransactionByteFee",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -987,7 +987,7 @@
"functions": [
{
"name": "Validators",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -998,7 +998,7 @@
},
{
"name": "SessionLength",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1009,7 +1009,7 @@
},
{
"name": "CurrentIndex",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1020,7 +1020,7 @@
},
{
"name": "CurrentStart",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Moment"
},
@@ -1031,7 +1031,7 @@
},
{
"name": "ForcingNewSession",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "bool"
},
@@ -1043,7 +1043,7 @@
},
{
"name": "LastLengthChange",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "BlockNumber"
},
@@ -1054,7 +1054,7 @@
},
{
"name": "NextKeyFor",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "AccountId",
@@ -1068,7 +1068,7 @@
},
{
"name": "NextSessionLength",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "BlockNumber"
},
@@ -1243,7 +1243,7 @@
"functions": [
{
"name": "ValidatorCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "u32"
},
@@ -1254,7 +1254,7 @@
},
{
"name": "MinimumValidatorCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "u32"
},
@@ -1265,7 +1265,7 @@
},
{
"name": "SessionsPerEra",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1276,7 +1276,7 @@
},
{
"name": "SessionReward",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Perbill"
},
@@ -1287,7 +1287,7 @@
},
{
"name": "OfflineSlash",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Perbill"
},
@@ -1298,7 +1298,7 @@
},
{
"name": "OfflineSlashGrace",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "u32"
},
@@ -1309,7 +1309,7 @@
},
{
"name": "BondingDuration",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1320,7 +1320,7 @@
},
{
"name": "Invulerables",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -1332,7 +1332,7 @@
},
{
"name": "CurrentEra",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1343,7 +1343,7 @@
},
{
"name": "ValidatorPreferences",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -1357,7 +1357,7 @@
},
{
"name": "Intentions",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -1368,7 +1368,7 @@
},
{
"name": "Nominating",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "AccountId",
@@ -1382,7 +1382,7 @@
},
{
"name": "NominatorsFor",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -1396,7 +1396,7 @@
},
{
"name": "CurrentNominatorsFor",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -1410,7 +1410,7 @@
},
{
"name": "CurrentSessionReward",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -1421,7 +1421,7 @@
},
{
"name": "CurrentOfflineSlash",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -1432,7 +1432,7 @@
},
{
"name": "NextSessionsPerEra",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "BlockNumber"
},
@@ -1443,7 +1443,7 @@
},
{
"name": "LastEraLengthChange",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1454,7 +1454,7 @@
},
{
"name": "StakeRange",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "(Balance,Balance)"
},
@@ -1465,7 +1465,7 @@
},
{
"name": "Bondage",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -1479,7 +1479,7 @@
},
{
"name": "SlashCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -1493,7 +1493,7 @@
},
{
"name": "ForcingNewEra",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "()"
},
@@ -1619,7 +1619,7 @@
"functions": [
{
"name": "PublicPropCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "PropIndex"
},
@@ -1630,7 +1630,7 @@
},
{
"name": "PublicProps",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<(PropIndex,Proposal,AccountId)>"
},
@@ -1641,7 +1641,7 @@
},
{
"name": "DepositOf",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "PropIndex",
@@ -1655,7 +1655,7 @@
},
{
"name": "LaunchPeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1666,7 +1666,7 @@
},
{
"name": "MinimumDeposit",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -1677,7 +1677,7 @@
},
{
"name": "PublicDelay",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1688,7 +1688,7 @@
},
{
"name": "MaxLockPeriods",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "LockPeriods"
},
@@ -1699,7 +1699,7 @@
},
{
"name": "VotingPeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -1710,7 +1710,7 @@
},
{
"name": "ReferendumCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "ReferendumIndex"
},
@@ -1721,7 +1721,7 @@
},
{
"name": "NextTally",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "ReferendumIndex"
},
@@ -1732,7 +1732,7 @@
},
{
"name": "ReferendumInfoOf",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "ReferendumIndex",
@@ -1746,7 +1746,7 @@
},
{
"name": "DispatchQueue",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "BlockNumber",
@@ -1760,7 +1760,7 @@
},
{
"name": "Bondage",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -1774,7 +1774,7 @@
},
{
"name": "VotersFor",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "ReferendumIndex",
@@ -1788,7 +1788,7 @@
},
{
"name": "VoteOf",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "(ReferendumIndex,AccountId)",
@@ -1976,7 +1976,7 @@
"functions": [
{
"name": "CandidacyBond",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -1987,7 +1987,7 @@
},
{
"name": "VotingBond",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -1998,7 +1998,7 @@
},
{
"name": "PresentSlashPerVoter",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -2009,7 +2009,7 @@
},
{
"name": "CarryCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "u32"
},
@@ -2020,7 +2020,7 @@
},
{
"name": "PresentationDuration",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -2031,7 +2031,7 @@
},
{
"name": "InactiveGracePeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "VoteIndex"
},
@@ -2043,7 +2043,7 @@
},
{
"name": "VotingPeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -2054,7 +2054,7 @@
},
{
"name": "TermDuration",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -2065,7 +2065,7 @@
},
{
"name": "DesiredSeats",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "u32"
},
@@ -2076,7 +2076,7 @@
},
{
"name": "ActiveCouncil",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<(AccountId,BlockNumber)>"
},
@@ -2090,7 +2090,7 @@
},
{
"name": "VoteCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "VoteIndex"
},
@@ -2101,7 +2101,7 @@
},
{
"name": "ApprovalsOf",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "AccountId",
@@ -2116,7 +2116,7 @@
},
{
"name": "RegisterInfoOf",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "AccountId",
@@ -2131,7 +2131,7 @@
},
{
"name": "LastActiveOf",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "AccountId",
@@ -2145,7 +2145,7 @@
},
{
"name": "Voters",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -2156,7 +2156,7 @@
},
{
"name": "Candidates",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<AccountId>"
},
@@ -2167,7 +2167,7 @@
},
{
"name": "CandidateCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "u32"
},
@@ -2176,7 +2176,7 @@
},
{
"name": "NextFinalise",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "(BlockNumber,u32,Vec<AccountId>)"
},
@@ -2187,7 +2187,7 @@
},
{
"name": "SnapshotedStakes",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<Balance>"
},
@@ -2198,7 +2198,7 @@
},
{
"name": "Leaderboard",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "Vec<(Balance,AccountId)>"
},
@@ -2284,7 +2284,7 @@
"functions": [
{
"name": "CooloffPeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -2293,7 +2293,7 @@
},
{
"name": "VotingPeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -2302,7 +2302,7 @@
},
{
"name": "EnactDelayPeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -2313,7 +2313,7 @@
},
{
"name": "Proposals",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<(BlockNumber,Hash)>"
},
@@ -2322,7 +2322,7 @@
},
{
"name": "ProposalOf",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "Hash",
@@ -2334,7 +2334,7 @@
},
{
"name": "ProposalVoters",
"modifier": "default",
"modifier": "Default",
"type": {
"Map": {
"key": "Hash",
@@ -2346,7 +2346,7 @@
},
{
"name": "CouncilVoteOf",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "(Hash,AccountId)",
@@ -2358,7 +2358,7 @@
},
{
"name": "VetoedProposal",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "Hash",
@@ -2420,7 +2420,7 @@
"functions": [
{
"name": "Proposals",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<Hash>"
},
@@ -2431,7 +2431,7 @@
},
{
"name": "ProposalOf",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "Hash",
@@ -2445,7 +2445,7 @@
},
{
"name": "Voting",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "Hash",
@@ -2459,7 +2459,7 @@
},
{
"name": "ProposalCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "u32"
},
@@ -2499,7 +2499,7 @@
"functions": [
{
"name": "PendingChange",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Plain": "StoredPendingChange"
},
@@ -2608,7 +2608,7 @@
"functions": [
{
"name": "ProposalBond",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Permill"
},
@@ -2620,7 +2620,7 @@
},
{
"name": "ProposalBondMinimum",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -2631,7 +2631,7 @@
},
{
"name": "SpendPeriod",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "BlockNumber"
},
@@ -2642,7 +2642,7 @@
},
{
"name": "Burn",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Permill"
},
@@ -2653,7 +2653,7 @@
},
{
"name": "Pot",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Balance"
},
@@ -2664,7 +2664,7 @@
},
{
"name": "ProposalCount",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "ProposalIndex"
},
@@ -2675,7 +2675,7 @@
},
{
"name": "Proposals",
"modifier": "optional",
"modifier": "Optional",
"type": {
"Map": {
"key": "ProposalIndex",
@@ -2689,7 +2689,7 @@
},
{
"name": "Approvals",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "Vec<ProposalIndex>"
},
@@ -2809,7 +2809,7 @@
"functions": [
{
"name": "Key",
"modifier": "default",
"modifier": "Default",
"type": {
"Plain": "AccountId"
},
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.0.1",
"version": "1.1.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,10 +27,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/jsonrpc": "^1.0.1",
"@polkadot/rpc-provider": "^1.0.1",
"@polkadot/types": "^1.0.1",
"@polkadot/util": "^2.0.1",
"@polkadot/jsonrpc": "^1.1.1",
"@polkadot/rpc-provider": "^1.1.1",
"@polkadot/types": "^1.1.1",
"@polkadot/util": "^2.2.1",
"rxjs": "^6.5.4"
}
}
+1 -2
View File
@@ -5,8 +5,7 @@
import { ProviderInterface } from '@polkadot/rpc-provider/types';
import { RpcMethod, RpcSection, RpcParam } from '@polkadot/jsonrpc/types';
import { AnyJson, Codec, Registry } from '@polkadot/types/types';
import { RpcInterface } from './jsonrpc.types';
import { RpcInterfaceMethod, UserRpc } from './types';
import { RpcInterface, RpcInterfaceMethod, UserRpc } from './types';
import memoizee from 'memoizee';
import { combineLatest, from, Observable, Observer, of, throwError } from 'rxjs';
-67
View File
@@ -1,67 +0,0 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Observable } from 'rxjs';
import { Option, Vec } from '@polkadot/types/codec';
import { Bytes, H256, Metadata, StorageData, StorageKey, Text, u32, u64 } from '@polkadot/types';
import { AccountId, BlockNumber, Extrinsic, Hash, Header, Index, SignedBlock } from '@polkadot/types/interfaces/runtime';
import { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
import { BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
import { Codec, IExtrinsic } from '@polkadot/types/types';
export interface RpcInterface {
account: {
nextIndex(accountId: AccountId | Uint8Array | string): Observable<Index>;
};
author: {
insertKey(keyType: Text | string, suri: Text | string, publicKey: Bytes | Uint8Array | string): Observable<Bytes>;
pendingExtrinsics(): Observable<Vec<Extrinsic>>;
removeExtrinsic(bytesOrHash: (ExtrinsicOrHash)[]): Observable<Vec<Hash>>;
rotateKeys(): Observable<Bytes>;
submitAndWatchExtrinsic(extrinsic: IExtrinsic): Observable<ExtrinsicStatus>;
submitExtrinsic(extrinsic: IExtrinsic): Observable<Hash>;
};
chain: {
getBlock(hash?: BlockHash | Uint8Array | string): Observable<SignedBlock>;
getBlockHash(blockNumber?: BlockNumber | Uint8Array | number | string): Observable<BlockHash>;
getFinalizedHead(): Observable<BlockHash>;
getHeader(hash?: BlockHash | Uint8Array | string): Observable<Header>;
subscribeFinalizedHeads(): Observable<Header>;
subscribeNewHeads(): Observable<Header>;
};
contracts: {
call(callRequest: ContractCallRequest, at?: BlockHash | Uint8Array | string): Observable<ContractExecResult>;
getStorage(address: AccountId | Uint8Array | string, key: H256 | Uint8Array | string, at?: BlockHash | Uint8Array | string): Observable<Option<Bytes>>;
};
payment: {
queryInfo(extrinsic: Bytes | Uint8Array | string, at?: BlockHash | Uint8Array | string): Observable<RuntimeDispatchInfo>;
};
rpc: {
methods(): Observable<RpcMethods>;
};
state: {
call(method: Text | string, data: Bytes | Uint8Array | string, at?: BlockHash | Uint8Array | string): Observable<Bytes>;
getChildKeys(childStorageKey: any, childDefinition: any, childType: u32 | Uint8Array | number | string, key: any, at?: BlockHash | Uint8Array | string): Observable<Vec<StorageKey>>;
getChildStorage(childStorageKey: any, childDefinition: any, childType: u32 | Uint8Array | number | string, key: any, at?: BlockHash | Uint8Array | string): Observable<StorageData>;
getChildStorageHash(childStorageKey: any, childDefinition: any, childType: u32 | Uint8Array | number | string, key: any, at?: BlockHash | Uint8Array | string): Observable<Hash>;
getChildStorageSize(childStorageKey: any, childDefinition: any, childType: u32 | Uint8Array | number | string, key: any, at?: BlockHash | Uint8Array | string): Observable<u64>;
getKeys(key: any, at?: BlockHash | Uint8Array | string): Observable<Vec<StorageKey>>;
getMetadata(at?: BlockHash | Uint8Array | string): Observable<Metadata>;
getRuntimeVersion(at?: BlockHash | Uint8Array | string): Observable<RuntimeVersion>;
getStorage<T = Codec>(key: any, block?: Hash | Uint8Array | string): Observable<T>;
getStorageHash(key: any, at?: BlockHash | Uint8Array | string): Observable<Hash>;
getStorageSize(key: any, at?: BlockHash | Uint8Array | string): Observable<u64>;
queryStorage(keys: (any)[], startBlock: Hash | Uint8Array | string, at?: BlockHash | Uint8Array | string): Observable<Vec<StorageChangeSet>>;
subscribeRuntimeVersion(): Observable<RuntimeVersion>;
subscribeStorage<T = Codec[]>(keys: any[]): Observable<T>;
};
system: {
chain(): Observable<Text>;
health(): Observable<Health>;
name(): Observable<Text>;
networkState(): Observable<NetworkState>;
peers(): Observable<Vec<PeerInfo>>;
properties(): Observable<ChainProperties>;
version(): Observable<Text>;
};
}
+6
View File
@@ -0,0 +1,6 @@
// Copyright 2017-2020 @polkadot/rpc-core authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface RpcInterface {}
+2
View File
@@ -4,6 +4,8 @@
import { Observable } from 'rxjs';
export * from './types.jsonrpc';
export interface RpcInterfaceMethod {
(...params: any[]): Observable<any>;
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.0.1",
"version": "1.1.1",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -27,15 +27,15 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/metadata": "^1.0.1",
"@polkadot/util": "^2.0.1",
"@polkadot/util-crypto": "^2.0.1",
"@polkadot/metadata": "^1.1.1",
"@polkadot/util": "^2.2.1",
"@polkadot/util-crypto": "^2.2.1",
"eventemitter3": "^4.0.0",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.1",
"@polkadot/keyring": "^2.2.1",
"mock-socket": "^9.0.3",
"nock": "^11.7.2"
}
+1 -1
View File
@@ -176,7 +176,7 @@ export default class Mock implements ProviderInterface {
// increment the balances and nonce for each account
keyring.getPairs().forEach(({ publicKey }, index): void => {
this.setStateBn(metadata.query.balances.freeBalance(publicKey), newHead.number.toBn().muln(3).iaddn(index));
// this.setStateBn(metadata.query.balances.freeBalance(publicKey), newHead.number.toBn().muln(3).iaddn(index));
this.setStateBn(metadata.query.system.accountNonce(publicKey), newHead.number.toBn().addn(index));
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/jsonrpc",
"version": "1.0.1",
"version": "1.1.1",
"description": "Method definitions for the Polkadot RPC layer",
"main": "index.js",
"publishConfig": {
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.0.1",
"version": "1.1.1",
"description": "Implementation of the Parity codec",
"main": "index.js",
"bin": {
@@ -34,14 +34,14 @@
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"@polkadot/metadata": "^1.0.1",
"@polkadot/util": "^2.0.1",
"@polkadot/util-crypto": "^2.0.1",
"@polkadot/metadata": "^1.1.1",
"@polkadot/util": "^2.2.1",
"@polkadot/util-crypto": "^2.2.1",
"memoizee": "^0.4.14",
"yargs": "^15.1.0"
},
"devDependencies": {
"@polkadot/keyring": "^2.0.1",
"@polkadot/keyring": "^2.2.1",
"@types/memoizee": "^0.4.3",
"@types/yargs": "^15.0.2"
}
+11
View File
@@ -39,6 +39,7 @@ export default abstract class AbstractInt extends BN implements Codec {
this._isNegative = isNegative;
}
/** @internal */
public static decodeAbstracInt (value: AnyNumber, bitLength: UIntBitLength, isNegative: boolean): string {
// This function returns a string, which will be passed in the BN
// constructor. It would be ideal to actually return a BN, but there's a
@@ -54,6 +55,7 @@ export default abstract class AbstractInt extends BN implements Codec {
return bnToBn(value).toString();
}
/** @internal */
private static decodeAbstracIntU8a (value: Uint8Array, bitLength: UIntBitLength, isNegative: boolean): string {
if (!value.length) {
return '0';
@@ -109,6 +111,15 @@ export default abstract class AbstractInt extends BN implements Codec {
);
}
/**
* @description True if this value is the max of the type
*/
public isMax (): boolean {
const u8a = this.toU8a().filter((byte): boolean => byte === 0xff);
return u8a.length === (this._bitLength / 8);
}
/**
* @description Returns the BN representation of the number. (Compatibility)
*/
+3
View File
@@ -42,6 +42,7 @@ export default class BTreeMap<K extends Codec = Codec, V extends Codec = Codec>
* - Map<any, any>, where both key and value types are either
* constructors or decodeable values for their types.
* @param jsonMap
* @internal
*/
private static decodeBTreeMap<K extends Codec = Codec, V extends Codec = Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, value: Uint8Array | string | Map<any, any>): Map<K, V> {
if (!value) {
@@ -57,6 +58,7 @@ export default class BTreeMap<K extends Codec = Codec, V extends Codec = Codec>
throw new Error('BTreeMap: cannot decode type');
}
/** @internal */
private static decodeBTreeMapFromU8a<K extends Codec = Codec, V extends Codec = Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, u8a: Uint8Array): Map<K, V> {
const output = new Map<K, V>();
const [offset, length] = Compact.decodeU8a(u8a);
@@ -75,6 +77,7 @@ export default class BTreeMap<K extends Codec = Codec, V extends Codec = Codec>
return output;
}
/** @internal */
private static decodeBTreeMapFromMap<K extends Codec = Codec, V extends Codec = Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, value: Map<any, any>): Map<K, V> {
const output = new Map<K, V>();
+3
View File
@@ -37,6 +37,7 @@ export default class BTreeSet<V extends Codec = Codec> extends Set<V> implements
* - Set<any>, where both key and value types are either
* constructors or decodeable values for their types.
* @param jsonSet
* @internal
*/
private static decodeBTreeSet<V extends Codec = Codec> (registry: Registry, ValClass: Constructor<V>, value: Uint8Array | string | Set<any>): Set<V> {
if (!value) {
@@ -52,6 +53,7 @@ export default class BTreeSet<V extends Codec = Codec> extends Set<V> implements
throw new Error('BTreeSet: cannot decode type');
}
/** @internal */
private static decodeBTreeSetFromU8a<V extends Codec = Codec> (registry: Registry, ValClass: Constructor<V>, u8a: Uint8Array): Set<V> {
const output = new Set<V>();
const [offset, length] = Compact.decodeU8a(u8a);
@@ -70,6 +72,7 @@ export default class BTreeSet<V extends Codec = Codec> extends Set<V> implements
return output;
}
/** @internal */
private static decodeBTreeSetFromSet<V extends Codec = Codec> (registry: Registry, ValClass: Constructor<V>, value: Set<any>): Set<V> {
const output = new Set<V>();
+1
View File
@@ -56,6 +56,7 @@ export default class Compact<T extends CompactEncodable> extends Base<T> impleme
return value;
}
/** @internal */
public static decodeCompact<T extends CompactEncodable> (registry: Registry, Type: Constructor<T>, value: Compact<T> | AnyNumber): CompactEncodable {
if (value instanceof Compact) {
return new Type(registry, value.raw);
+1
View File
@@ -35,6 +35,7 @@ export default class CodecDate extends Date implements Codec {
this.raw = this;
}
/** @internal */
public static decodeDate (value: CodecDate | Date | AnyNumber): Date {
if (value instanceof Date) {
return value;
+1 -1
View File
@@ -191,7 +191,7 @@ describe('Enum', (): void => {
testDecode('Uint8Array', Uint8Array.from([0]), 'foo');
testDecode('Uint8Array', Uint8Array.from([1]), 'bar');
testEncode('toJSON', 'bar');
testEncode('toJSON', 'Bar');
testEncode('toNumber', 1);
testEncode('toString', 'Bar');
testEncode('toU8a', Uint8Array.from([1]));
+25 -3
View File
@@ -121,6 +121,7 @@ export default class Enum extends Base<Codec> {
this._index = this._indexes.indexOf(decoded.index) || 0;
}
/** @internal */
private static decodeEnum (registry: Registry, def: TypesDef, value?: any, index?: number): Decoded {
// NOTE We check the index path first, before looking at values - this allows treating
// the optional indexes before anything else, more-specific > less-specific
@@ -181,6 +182,13 @@ export default class Enum extends Base<Codec> {
return this._index;
}
/**
* @description true if this is a basic enum (no values)
*/
public get isBasic (): boolean {
return this._isBasic;
}
/**
* @description Checks if the Enum points to a [[Null]] type
*/
@@ -195,11 +203,25 @@ export default class Enum extends Base<Codec> {
return this.raw instanceof Null;
}
/**
* @description The available keys for this enum
*/
public get defEntries (): string[] {
return Object.keys(this._def);
}
/**
* @description The available keys for this enum
*/
public get defKeys (): string[] {
return Object.keys(this._def);
}
/**
* @description The name of the type this enum value represents
*/
public get type (): string {
return Object.keys(this._def)[this._index];
return this.defKeys[this._index];
}
/**
@@ -244,7 +266,7 @@ export default class Enum extends Base<Codec> {
*/
public toJSON (): AnyJson {
return this._isBasic
? stringCamelCase(this.toString())
? this.type
: { [this.type]: this.raw.toJSON() };
}
@@ -260,7 +282,7 @@ export default class Enum extends Base<Codec> {
*/
protected toRawStruct (): string[] | Record<string, string> {
return this._isBasic
? Object.keys(this._def)
? this.defKeys
: Struct.typesToMap(this.registry, this._def);
}
+2
View File
@@ -29,6 +29,7 @@ export default class Option<T extends Codec> extends Base<T> {
this._Type = Clazz;
}
/** @internal */
public static decodeOption (registry: Registry, Type: Constructor, value?: any): Codec {
if (isNull(value) || isUndefined(value) || value instanceof Null) {
return new Null(registry);
@@ -46,6 +47,7 @@ export default class Option<T extends Codec> extends Base<T> {
return new Type(registry, value);
}
/** @internal */
private static decodeOptionU8a (registry: Registry, Type: Constructor, value: Uint8Array): Codec {
return !value.length || value[0] === 0
? new Null(registry)
+1
View File
@@ -25,6 +25,7 @@ export default class Raw extends Uint8Array implements IU8a {
this.registry = registry;
}
/** @internal */
private static decodeU8a (value?: any): Uint8Array {
if (isU8a(value)) {
return value;
+3
View File
@@ -32,6 +32,7 @@ export default class CodecSet extends Set<string> implements Codec {
this._setValues = setValues;
}
/** @internal */
public static decodeSet (setValues: SetValues, value: string[] | Set<string> | Uint8Array | BN | number | string = 0): string[] {
if (isString(value)) {
return CodecSet.decodeSet(setValues, u8aToU8a(value));
@@ -48,6 +49,7 @@ export default class CodecSet extends Set<string> implements Codec {
return CodecSet.decodeSetNumber(setValues, value);
}
/** @internal */
private static decodeSetArray (setValues: SetValues, value: string[]): string[] {
return value.reduce((result, key): string[] => {
assert(!isUndefined(setValues[key]), `Set: Invalid key '${key}' passed to Set, allowed ${Object.keys(setValues).join(', ')}`);
@@ -58,6 +60,7 @@ export default class CodecSet extends Set<string> implements Codec {
}, [] as string[]);
}
/** @internal */
private static decodeSetNumber (setValues: SetValues, _value: BN | number): string[] {
const bn = bnToBn(_value);
const result = Object.keys(setValues).reduce((result, key): string[] => {
+9
View File
@@ -62,6 +62,7 @@ export default class Struct<
* - array with `[value1, value2]` assuming the array has the same length as
* `Object.keys(Types)`
* @param jsonMap
* @internal
*/
private static decodeStruct <T> (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<any, string>): T {
if (isHex(value)) {
@@ -84,6 +85,7 @@ export default class Struct<
return Struct.decodeStructFromObject(registry, Types, value, jsonMap);
}
/** @internal */
private static decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<any, string>): T {
return Object.keys(Types).reduce((raw, key, index): T => {
// The key in the JSON can be snake_case (or other cases), but in our
@@ -137,6 +139,13 @@ export default class Struct<
};
}
/**
* @description The available keys for this enum
*/
public get defKeys (): string[] {
return Object.keys(this._Types);
}
/**
* @description Checks if the value is an empty value
*/
+1
View File
@@ -43,6 +43,7 @@ export default class StructAny extends Map<string, any> implements Codec {
});
}
/** @internal */
private static decodeJson (value?: { [index: string]: any } | null): [string, any][] {
return Object.entries(value || {});
}
+1
View File
@@ -36,6 +36,7 @@ export default class Tuple extends AbstractArray<Codec> {
this._Types = Clazzes;
}
/** @internal */
private static decodeTuple (registry: Registry, _Types: TupleConstructors, value: AnyU8a | string | (AnyU8a | AnyNumber | AnyString | undefined | null)[]): Codec[] {
if (isU8a(value)) {
return decodeU8a(registry, value, _Types);
+1
View File
@@ -24,6 +24,7 @@ export default class U8aFixed extends Raw {
super(registry, U8aFixed.decodeU8aFixed(value, bitLength));
}
/** @internal */
private static decodeU8aFixed (value: AnyU8a, bitLength: BitLength): AnyU8a {
if (Array.isArray(value) || isString(value)) {
return U8aFixed.decodeU8aFixed(u8aToU8a(value), bitLength);
+13
View File
@@ -70,4 +70,17 @@ describe('UInt', (): void => {
expect(test.eq('0x3039')).toBe(true);
});
});
describe('isMax()', (): void => {
it('is false where not full', (): void => {
expect(new UInt(registry, '0x1234', 32).isMax()).toEqual(false);
expect(new UInt(registry, '0xffffff', 32).isMax()).toEqual(false);
expect(new UInt(registry, '0x12345678', 32).isMax()).toEqual(false);
expect(new UInt(registry, '0xfffffff0', 32).isMax()).toEqual(false);
});
it('is true when full', (): void => {
expect(new UInt(registry, '0xffffffff', 32).isMax()).toEqual(true);
});
});
});
+1
View File
@@ -30,6 +30,7 @@ export default class Vec<T extends Codec> extends AbstractArray<T> {
this._Type = Clazz;
}
/** @internal */
public static decodeVec<T extends Codec> (registry: Registry, Type: Constructor<T>, value: Vec<any> | Uint8Array | string | any[]): T[] {
if (Array.isArray(value)) {
return value.map((entry, index): T => {
+1
View File
@@ -25,6 +25,7 @@ export default class VecFixed<T extends Codec> extends AbstractArray<T> {
this._Type = Clazz;
}
/** @internal */
public static decodeVecFixed<T extends Codec> (registry: Registry, Type: Constructor<T>, allocLength: number, value: VecFixed<any> | Uint8Array | string | any[]): T[] {
const values = Vec.decodeVec(
registry,
@@ -47,7 +47,7 @@ describe('createType', (): void => {
it('allows creation of a Enum (simple)', (): void => {
expect(
createTypeUnsafe(registry, '{"_enum": ["A", "B", "C"]}', [1]).toJSON()
).toEqual('b');
).toEqual('B');
});
it('allows creation of a Enum (parametrised)', (): void => {
@@ -95,7 +95,7 @@ function hasWrapper (type: string, [start, end]: [string, string, TypeDefInfo, a
return false;
}
assert(type.endsWith(end), `Expected '${start}' closing with '${end}'`);
assert(type.endsWith(end), `Expected '${start}' closing with '${end}' on ${type}`);
return true;
}
+23 -1
View File
@@ -3,13 +3,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { CallFunction, Codec, Constructor, RegistryError, RegistryTypes, Registry, RegistryMetadata, TypeDef } from '../../types';
import { CallFunction, Codec, Constructor, InterfaceTypes, RegistryError, RegistryTypes, Registry, RegistryMetadata, TypeDef } from '../../types';
import extrinsicsFromMeta from '@polkadot/metadata/Decorated/extrinsics/fromMetadata';
import { assert, isFunction, isString, isUndefined, stringCamelCase, u8aToHex } from '@polkadot/util';
import Raw from '../Raw';
import { EventData } from '../../primitive/Generic/Event';
import { defaultExtensions, expandExtensionTypes, findUnknownExtensions } from '../../primitive/Extrinsic/signedExtensions';
import { createClass } from './createClass';
import { getTypeClass } from './getTypeClass';
import { getTypeDef } from './getTypeDef';
@@ -85,6 +86,8 @@ export class TypeRegistry implements Registry {
private _metadataEvents: Record<string, Constructor<EventData>> = {};
private _metadataExtensions: string[] = defaultExtensions;
constructor () {
// we only want to import these on creation, i.e. we want to avoid types
// weird side-effects from circular references. (Since registry is injected
@@ -165,6 +168,14 @@ export class TypeRegistry implements Registry {
return type;
}
public getSignedExtensionExtra (): Record<string, InterfaceTypes> {
return expandExtensionTypes(this._metadataExtensions, 'extra');
}
public getSignedExtensionTypes (): Record<string, InterfaceTypes> {
return expandExtensionTypes(this._metadataExtensions, 'types');
}
public hasClass (name: string): boolean {
return this._classes.has(name);
}
@@ -221,5 +232,16 @@ export class TypeRegistry implements Registry {
decorateExtrinsics(this, metadata, this._metadataCalls);
decorateErrors(this, metadata, this._metadataErrors);
decorateEvents(this, metadata, this._metadataEvents);
// setup the available extensions
this._metadataExtensions = metadata.asLatest.extrinsic.version.gtn(0)
? metadata.asLatest.extrinsic.signedExtensions.map((key): string => key.toString())
: defaultExtensions;
const unknown = findUnknownExtensions(this._metadataExtensions);
if (unknown.length) {
console.warn(`Unknown signed extensions [${unknown.join(', ')}] found, treating them as no-efect`);
}
}
}
+5 -1
View File
@@ -6,6 +6,7 @@
type Mapper = (value: string) => string;
const ALLOWED_BOXES = ['BTreeMap', 'BTreeSet', 'Compact', 'Linkage', 'Result', 'Option', 'Vec'];
const BOX_PRECEDING = ['<', '(', '[', '"', ',', ' ']; // start of vec, tuple, fixed array, part of struct def or in tuple
const mappings: Mapper[] = [
// alias <T::InherentOfflineReport as InherentOfflineReport>::Inherent -> InherentOfflineReport
@@ -114,7 +115,10 @@ function _removeGenerics (): Mapper {
const box = ALLOWED_BOXES.find((box): boolean => {
const start = index - box.length;
return start >= 0 && value.substr(start, box.length) === box;
return (start >= 0 && value.substr(start, box.length) === box) && (
// make sure it is stand-alone, i.e. don't catch ElectionResult<...> as Result<...>
start === 0 || BOX_PRECEDING.includes(value[start - 1])
);
});
// we have not found anything, unwrap generic innards
+8 -1
View File
@@ -7,15 +7,22 @@
import { detectPackage } from '@polkadot/util';
let dirname;
let pkgJson;
try {
dirname = __dirname;
} catch (error) {
// ignore
}
try {
pkgJson = require('./package.json');
} catch (error) {
pkgJson = require('../package.json');
}
detectPackage(pkgJson);
detectPackage(pkgJson, dirname);
export * from './codec';
export * from './index.types';
+70 -42
View File
@@ -3,14 +3,14 @@
import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
import { Bytes, Data, Fixed64, H160, H256, H512, IdentityFields, Null, StorageData, StorageKey, Text, Type, U256, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types/primitive';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, MultiSignature, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, MultiSignature, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { InclusionHeight, Uncle, UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
import { BabeAuthorityWeight, BabeBlockWeight, BabeWeight, MaybeVrf, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondary, RawBabePreDigestSecondaryTo159, RawBabePreDigestTo159, SlotNumber, VrfData, VrfProof } from '@polkadot/types/interfaces/babe';
import { BalanceLock, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import { AccountData, BalanceLock, BalanceLockTo212, Reasons, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import { MemberCount, ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from '@polkadot/types/interfaces/democracy';
import { AccountInfo, Amount, AssetOf, InherentOfflineReport, LockPeriods, NewAccountOutcome, OpaqueKey, SessionKey } from '@polkadot/types/interfaces/deprecated';
import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
@@ -28,6 +28,7 @@ import { DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, Dispa
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import { EthereumAddress } from '@polkadot/types/interfaces/claims';
import { AttestedCandidate, AuctionIndex, BalanceUpload, Bidder, CandidateReceipt, CollatorId, CollatorSignature, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaScheduling, ParachainDispatchOrigin, Retriable, SlotRange, SubId, UpwardMessage, ValidatorIndex, ValidityAttestation, ValidityVote, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
@@ -127,6 +128,57 @@ export interface InterfaceRegistry {
Raw: Raw;
'Option<Raw>': Option<Raw>;
'Vec<Raw>': Vec<Raw>;
Extrinsic: Extrinsic;
'Option<Extrinsic>': Option<Extrinsic>;
'Vec<Extrinsic>': Vec<Extrinsic>;
ExtrinsicEra: ExtrinsicEra;
'Option<ExtrinsicEra>': Option<ExtrinsicEra>;
'Vec<ExtrinsicEra>': Vec<ExtrinsicEra>;
ExtrinsicPayload: ExtrinsicPayload;
'Option<ExtrinsicPayload>': Option<ExtrinsicPayload>;
'Vec<ExtrinsicPayload>': Vec<ExtrinsicPayload>;
ExtrinsicV1: ExtrinsicV1;
'Option<ExtrinsicV1>': Option<ExtrinsicV1>;
'Vec<ExtrinsicV1>': Vec<ExtrinsicV1>;
ExtrinsicPayloadV1: ExtrinsicPayloadV1;
'Option<ExtrinsicPayloadV1>': Option<ExtrinsicPayloadV1>;
'Vec<ExtrinsicPayloadV1>': Vec<ExtrinsicPayloadV1>;
ExtrinsicSignatureV1: ExtrinsicSignatureV1;
'Option<ExtrinsicSignatureV1>': Option<ExtrinsicSignatureV1>;
'Vec<ExtrinsicSignatureV1>': Vec<ExtrinsicSignatureV1>;
ExtrinsicV2: ExtrinsicV2;
'Option<ExtrinsicV2>': Option<ExtrinsicV2>;
'Vec<ExtrinsicV2>': Vec<ExtrinsicV2>;
ExtrinsicPayloadV2: ExtrinsicPayloadV2;
'Option<ExtrinsicPayloadV2>': Option<ExtrinsicPayloadV2>;
'Vec<ExtrinsicPayloadV2>': Vec<ExtrinsicPayloadV2>;
ExtrinsicSignatureV2: ExtrinsicSignatureV2;
'Option<ExtrinsicSignatureV2>': Option<ExtrinsicSignatureV2>;
'Vec<ExtrinsicSignatureV2>': Vec<ExtrinsicSignatureV2>;
ExtrinsicV3: ExtrinsicV3;
'Option<ExtrinsicV3>': Option<ExtrinsicV3>;
'Vec<ExtrinsicV3>': Vec<ExtrinsicV3>;
ExtrinsicPayloadV3: ExtrinsicPayloadV3;
'Option<ExtrinsicPayloadV3>': Option<ExtrinsicPayloadV3>;
'Vec<ExtrinsicPayloadV3>': Vec<ExtrinsicPayloadV3>;
ExtrinsicSignatureV3: ExtrinsicSignatureV3;
'Option<ExtrinsicSignatureV3>': Option<ExtrinsicSignatureV3>;
'Vec<ExtrinsicSignatureV3>': Vec<ExtrinsicSignatureV3>;
ExtrinsicV4: ExtrinsicV4;
'Option<ExtrinsicV4>': Option<ExtrinsicV4>;
'Vec<ExtrinsicV4>': Vec<ExtrinsicV4>;
ExtrinsicPayloadV4: ExtrinsicPayloadV4;
'Option<ExtrinsicPayloadV4>': Option<ExtrinsicPayloadV4>;
'Vec<ExtrinsicPayloadV4>': Vec<ExtrinsicPayloadV4>;
ExtrinsicSignatureV4: ExtrinsicSignatureV4;
'Option<ExtrinsicSignatureV4>': Option<ExtrinsicSignatureV4>;
'Vec<ExtrinsicSignatureV4>': Vec<ExtrinsicSignatureV4>;
ExtrinsicUnknown: ExtrinsicUnknown;
'Option<ExtrinsicUnknown>': Option<ExtrinsicUnknown>;
'Vec<ExtrinsicUnknown>': Vec<ExtrinsicUnknown>;
ExtrinsicPayloadUnknown: ExtrinsicPayloadUnknown;
'Option<ExtrinsicPayloadUnknown>': Option<ExtrinsicPayloadUnknown>;
'Vec<ExtrinsicPayloadUnknown>': Vec<ExtrinsicPayloadUnknown>;
AccountId: AccountId;
'Option<AccountId>': Option<AccountId>;
'Vec<AccountId>': Vec<AccountId>;
@@ -183,45 +235,6 @@ export interface InterfaceRegistry {
DispatchInfoTo190: DispatchInfoTo190;
'Option<DispatchInfoTo190>': Option<DispatchInfoTo190>;
'Vec<DispatchInfoTo190>': Vec<DispatchInfoTo190>;
Extrinsic: Extrinsic;
'Option<Extrinsic>': Option<Extrinsic>;
'Vec<Extrinsic>': Vec<Extrinsic>;
ExtrinsicEra: ExtrinsicEra;
'Option<ExtrinsicEra>': Option<ExtrinsicEra>;
'Vec<ExtrinsicEra>': Vec<ExtrinsicEra>;
ExtrinsicPayload: ExtrinsicPayload;
'Option<ExtrinsicPayload>': Option<ExtrinsicPayload>;
'Vec<ExtrinsicPayload>': Vec<ExtrinsicPayload>;
ExtrinsicPayloadUnknown: ExtrinsicPayloadUnknown;
'Option<ExtrinsicPayloadUnknown>': Option<ExtrinsicPayloadUnknown>;
'Vec<ExtrinsicPayloadUnknown>': Vec<ExtrinsicPayloadUnknown>;
ExtrinsicPayloadV1: ExtrinsicPayloadV1;
'Option<ExtrinsicPayloadV1>': Option<ExtrinsicPayloadV1>;
'Vec<ExtrinsicPayloadV1>': Vec<ExtrinsicPayloadV1>;
ExtrinsicPayloadV2: ExtrinsicPayloadV2;
'Option<ExtrinsicPayloadV2>': Option<ExtrinsicPayloadV2>;
'Vec<ExtrinsicPayloadV2>': Vec<ExtrinsicPayloadV2>;
ExtrinsicPayloadV3: ExtrinsicPayloadV3;
'Option<ExtrinsicPayloadV3>': Option<ExtrinsicPayloadV3>;
'Vec<ExtrinsicPayloadV3>': Vec<ExtrinsicPayloadV3>;
ExtrinsicPayloadV4: ExtrinsicPayloadV4;
'Option<ExtrinsicPayloadV4>': Option<ExtrinsicPayloadV4>;
'Vec<ExtrinsicPayloadV4>': Vec<ExtrinsicPayloadV4>;
ExtrinsicUnknown: ExtrinsicUnknown;
'Option<ExtrinsicUnknown>': Option<ExtrinsicUnknown>;
'Vec<ExtrinsicUnknown>': Vec<ExtrinsicUnknown>;
ExtrinsicV1: ExtrinsicV1;
'Option<ExtrinsicV1>': Option<ExtrinsicV1>;
'Vec<ExtrinsicV1>': Vec<ExtrinsicV1>;
ExtrinsicV2: ExtrinsicV2;
'Option<ExtrinsicV2>': Option<ExtrinsicV2>;
'Vec<ExtrinsicV2>': Vec<ExtrinsicV2>;
ExtrinsicV3: ExtrinsicV3;
'Option<ExtrinsicV3>': Option<ExtrinsicV3>;
'Vec<ExtrinsicV3>': Vec<ExtrinsicV3>;
ExtrinsicV4: ExtrinsicV4;
'Option<ExtrinsicV4>': Option<ExtrinsicV4>;
'Vec<ExtrinsicV4>': Vec<ExtrinsicV4>;
Hash: Hash;
'Option<Hash>': Option<Hash>;
'Vec<Hash>': Vec<Hash>;
@@ -381,9 +394,18 @@ export interface InterfaceRegistry {
VrfProof: VrfProof;
'Option<VrfProof>': Option<VrfProof>;
'Vec<VrfProof>': Vec<VrfProof>;
AccountData: AccountData;
'Option<AccountData>': Option<AccountData>;
'Vec<AccountData>': Vec<AccountData>;
BalanceLockTo212: BalanceLockTo212;
'Option<BalanceLockTo212>': Option<BalanceLockTo212>;
'Vec<BalanceLockTo212>': Vec<BalanceLockTo212>;
BalanceLock: BalanceLock;
'Option<BalanceLock>': Option<BalanceLock>;
'Vec<BalanceLock>': Vec<BalanceLock>;
Reasons: Reasons;
'Option<Reasons>': Option<Reasons>;
'Vec<Reasons>': Vec<Reasons>;
VestingSchedule: VestingSchedule;
'Option<VestingSchedule>': Option<VestingSchedule>;
'Vec<VestingSchedule>': Vec<VestingSchedule>;
@@ -435,6 +457,9 @@ export interface InterfaceRegistry {
PrefabWasmModuleReserved: PrefabWasmModuleReserved;
'Option<PrefabWasmModuleReserved>': Option<PrefabWasmModuleReserved>;
'Vec<PrefabWasmModuleReserved>': Vec<PrefabWasmModuleReserved>;
ScheduleTo212: ScheduleTo212;
'Option<ScheduleTo212>': Option<ScheduleTo212>;
'Vec<ScheduleTo212>': Vec<ScheduleTo212>;
Schedule: Schedule;
'Option<Schedule>': Option<Schedule>;
'Vec<Schedule>': Vec<Schedule>;
@@ -812,6 +837,9 @@ export interface InterfaceRegistry {
Multisig: Multisig;
'Option<Multisig>': Option<Multisig>;
'Vec<Multisig>': Vec<Multisig>;
VestingInfo: VestingInfo;
'Option<VestingInfo>': Option<VestingInfo>;
'Vec<VestingInfo>': Vec<VestingInfo>;
BlockAttestations: BlockAttestations;
'Option<BlockAttestations>': Option<BlockAttestations>;
'Vec<BlockAttestations>': Vec<BlockAttestations>;

Some files were not shown because too many files have changed in this diff Show More