Compare commits

..
36 Commits
Author SHA1 Message Date
Github Actions 033ff7a28c [CI Skip] 1.12.1
skip-checks: true
2020-04-29 22:23:45 +00:00
Jaco Greeff 7c8b2abf92 1.12 (#2221) 2020-04-30 00:13:27 +02:00
Github Actions 5312ec1f3a [CI Skip] 1.12.0-beta.15
skip-checks: true
2020-04-29 16:13:00 +00:00
Matej Nemček cdfbf91ee6 added Kodadot to @polkadot/api users section (#2220) 2020-04-29 18:00:50 +02:00
Github Actions 14f2abdc37 [CI Skip] 1.12.0-beta.14
skip-checks: true
2020-04-29 15:50:05 +00:00
Jake Naviasky 04c8d49e9d Add configurable provider auto-reconnect time. (#2215) 2020-04-29 17:39:31 +02:00
Github Actions 722929d0d4 [CI Skip] 1.12.0-beta.13
skip-checks: true
2020-04-29 14:57:15 +00:00
Jaco Greeff d1fae523ac Fix CompactAssignments types (#2219)
* Fix CompactAssignments types

* Cleanup mistaken type adjustments
2020-04-29 16:45:59 +02:00
Github Actions ce9a92cdc0 [CI Skip] 1.12.0-beta.12
skip-checks: true
2020-04-27 17:09:59 +00:00
Jaco Greeff 3de09a2e27 Hack around preimage failures (#2217) 2020-04-27 18:59:18 +02:00
Github Actions f28479180f [CI Skip] 1.12.0-beta.11
skip-checks: true
2020-04-27 14:04:29 +00:00
Jaco Greeff 0d1d42f6c2 Update promise combineLatest with generics (#2214) 2020-04-27 15:53:17 +02:00
Github Actions c93dad0bc5 [CI Skip] 1.12.0-beta.10
skip-checks: true
2020-04-27 07:04:47 +00:00
Jaco Greeff e3d3a1ff71 Handle no keysReturn StorageChangeSet with no keys (#2212) 2020-04-27 08:54:02 +02:00
Github Actions 1c8bd896e1 [CI Skip] 1.12.0-beta.9
skip-checks: true
2020-04-26 11:56:32 +00:00
Jaco Greeff e0119c1873 Bump metadata to current Substrate master (incl. types) (#2210) 2020-04-26 13:46:36 +02:00
Github Actions defe81e560 [CI Skip] 1.12.0-beta.8
skip-checks: true
2020-04-26 11:42:47 +00:00
Xiliang Chen 932122cd21 subscribeStorage parameter should be optional (#2208) 2020-04-26 13:32:43 +02:00
Github Actions 40d035eca7 [CI Skip] 1.12.0-beta.7
skip-checks: true
2020-04-25 07:58:44 +00:00
Jaco Greeff a135abaea2 Fix flags (council may not exist) (#2207) 2020-04-25 09:47:46 +02:00
Github Actions 00b8c10881 [CI Skip] 1.12.0-beta.6
skip-checks: true
2020-04-24 14:34:08 +00:00
Jaco Greeff 11e7b90918 Bump deps (#2206) 2020-04-24 16:22:18 +02:00
Github Actions ae74467e6a [CI Skip] 1.12.0-beta.5
skip-checks: true
2020-04-24 13:40:02 +00:00
Jeremías Díaz 5a929d3810 remove unnecessary parentheses and duplicate types (#2204)
* remove unnecessary parentheses and duplicate types

* fix: remove test code
2020-04-24 15:28:47 +02:00
Github Actions 63732f1456 [CI Skip] 1.12.0-beta.4
skip-checks: true
2020-04-24 08:54:04 +00:00
Jaco Greeff ea6bb83c01 Voting delegations (#2205) 2020-04-24 10:41:30 +02:00
Github Actions d6a443ca2a [CI Skip] 1.12.0-beta.3
skip-checks: true
2020-04-23 09:50:46 +00:00
Jaco Greeff d983ee106c migrateEra is first stakerPayouts era (#2202) 2020-04-23 11:39:39 +02:00
Github Actions beed1df5bd [CI Skip] 1.12.0-beta.2
skip-checks: true
2020-04-22 09:04:55 +00:00
Jaco Greeff 426aef6088 Update .123trigger 2020-04-22 10:55:01 +02:00
Github Actions 9be9b3fb83 [CI Skip] 1.12.0-beta.1
skip-checks: true
2020-04-22 07:56:01 +00:00
Jaco Greeff 8676f30cbf Reset to beta 2020-04-22 09:44:59 +02:00
Github Actions 154561c34c [CI Skip] 1.11.2
skip-checks: true
2020-04-22 07:40:26 +00:00
Jaco Greeff 714b242ec0 0.11.2 (#2200) 2020-04-22 09:30:02 +02:00
Github Actions 32ce650ee1 [CI Skip] 1.12.0-beta.0
skip-checks: true
2020-04-21 17:05:00 +00:00
Jaco Greeff 3715df2f5b Additional parachains types (#2199)
* Additional parachains types

* missing extensions listing

* trigger
2020-04-21 18:53:00 +02:00
50 changed files with 835 additions and 437 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
22 24
1.4.2 1.4.2
1.6.2 1.6.2
1.11.2
+15
View File
@@ -1,3 +1,18 @@
# 1.12.1 Apr 29, 2020
- Fix `CompactAssignments` types (Thanks to https://github.com/arjanz)
- Provider ayo-connect now allows for interval config (Thanks to https://github.com/jnaviask)
- Cleanup generation for c-like enums (Thanks to https://github.com/monitz87)
- Allow subscription to all storage keys, alignment with Substrate (Thanks to https://github.com/xlc)
- Cater for vote delegations in democracy derives
- Cleanup account derive flags where to allow for optional council modules
- Allow generic types in ApiPromise.combineLatest
- Update to latest substrate metadata
# 1.11.2 Apr 22, 2020
- Small patch to add missing Polkadot master types (will be in next Kusama update)
# 1.11.1 Apr 21, 2020 # 1.11.1 Apr 21, 2020
- **Important** Substrate master has an updated `Weight` (to `u64`), on older chains apply `Weight: 'u32'` (This does affect event decoding if wrongly set) - **Important** Substrate master has an updated `Weight` (to `u64`), on older chains apply `Weight: 'u32'` (This does affect event decoding if wrongly set)
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [ "packages": [
"packages/*" "packages/*"
], ],
"version": "1.11.1" "version": "1.12.1"
} }
+5 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api-contract", "name": "@polkadot/api-contract",
"version": "1.11.1", "version": "1.12.1",
"description": "Interfaces for interacting with contracts and contract ABIs", "description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
@@ -27,10 +27,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/api": "1.11.1", "@polkadot/api": "1.12.1",
"@polkadot/rpc-core": "1.11.1", "@polkadot/rpc-core": "1.12.1",
"@polkadot/types": "1.11.1", "@polkadot/types": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"bn.js": "^5.1.1", "bn.js": "^5.1.1",
"rxjs": "^6.5.5" "rxjs": "^6.5.5"
} }
+8 -8
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api-derive", "name": "@polkadot/api-derive",
"version": "1.11.1", "version": "1.12.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.", "description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
@@ -28,17 +28,17 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/api": "1.11.1", "@polkadot/api": "1.12.1",
"@polkadot/rpc-core": "1.11.1", "@polkadot/rpc-core": "1.12.1",
"@polkadot/rpc-provider": "1.11.1", "@polkadot/rpc-provider": "1.12.1",
"@polkadot/types": "1.11.1", "@polkadot/types": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.3",
"bn.js": "^5.1.1", "bn.js": "^5.1.1",
"memoizee": "^0.4.14", "memoizee": "^0.4.14",
"rxjs": "^6.5.5" "rxjs": "^6.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^2.8.1" "@polkadot/keyring": "^2.9.0-beta.3"
} }
} }
+1 -1
View File
@@ -40,7 +40,7 @@ export function flags (api: ApiInterfaceRx): (address?: AccountId | Address | st
address && api.query[councilSection]?.members address && api.query[councilSection]?.members
? api.query[councilSection].members() ? api.query[councilSection].members()
: of(undefined), : of(undefined),
address && api.query.council.members address && api.query.council?.members
? api.query.council.members() ? api.query.council.members()
: of([]), : of([]),
address && api.query.technicalCommittee?.members address && api.query.technicalCommittee?.members
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details. // of the Apache-2.0 license. See the LICENSE file for details.
import { ApiInterfaceRx } from '@polkadot/api/types'; import { ApiInterfaceRx } from '@polkadot/api/types';
import { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDirectVote } from '@polkadot/types/interfaces'; import { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDirectVote, VotingDelegating } from '@polkadot/types/interfaces';
import { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types'; import { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
import BN from 'bn.js'; import BN from 'bn.js';
@@ -33,6 +33,7 @@ function votesPrev (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveRef
votersFor.map((accountId, index): DeriveReferendumVote => ({ votersFor.map((accountId, index): DeriveReferendumVote => ({
accountId, accountId,
balance: balances[index].votingBalance || api.registry.createType('Balance'), balance: balances[index].votingBalance || api.registry.createType('Balance'),
isDelegating: false,
vote: votes[index] || api.registry.createType('Vote') vote: votes[index] || api.registry.createType('Vote')
})) }))
) )
@@ -41,10 +42,9 @@ function votesPrev (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveRef
function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> { function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
return api.query.democracy.votingOf.entries<Voting>().pipe( return api.query.democracy.votingOf.entries<Voting>().pipe(
map((allVoting): DeriveReferendumVote[] => map((allVoting): DeriveReferendumVote[] => {
allVoting const mapped = allVoting.map(([key, voting]): [AccountId, Voting] => [key.args[0] as AccountId, voting]);
.map(([key, voting]): [AccountId, Voting] => [key.args[0] as AccountId, voting]) const votes = mapped
// FIXME We are ignoring delegated votes
.filter(([, voting]) => voting.isDirect) .filter(([, voting]) => voting.isDirect)
.map(([accountId, voting]): [AccountId, VotingDirectVote[]] => [ .map(([accountId, voting]): [AccountId, VotingDirectVote[]] => [
accountId, accountId,
@@ -57,14 +57,37 @@ function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveRef
if (vote.isStandard) { if (vote.isStandard) {
result.push({ result.push({
accountId, accountId,
isDelegating: false,
...vote.asStandard ...vote.asStandard
}); });
} }
return result; return result;
}, result), [] }, result), []
) );
) const delegations = mapped
.filter(([, voting]) => voting.isDelegating)
.map(([accountId, voting]): [AccountId, VotingDelegating] => [accountId, voting.asDelegating]);
// add delegations
delegations.forEach(([accountId, { balance, conviction, target }]): void => {
// Are we delegating to a delegator
const toDelegator = delegations.find(([accountId]) => accountId.eq(target));
const to = votes.find(({ accountId }) => accountId.eq(toDelegator ? toDelegator[0] : target));
// this delegation has a target
if (to) {
votes.push({
accountId,
balance,
isDelegating: true,
vote: api.registry.createType('Vote', { aye: to.vote.isAye, conviction })
});
}
});
return votes;
})
); );
} }
@@ -46,6 +46,7 @@ export interface DeriveReferendum {
export interface DeriveReferendumVote { export interface DeriveReferendumVote {
accountId: AccountId; accountId: AccountId;
balance: Balance; balance: Balance;
isDelegating: boolean;
vote: Vote; vote: Vote;
} }
+22 -7
View File
@@ -8,7 +8,7 @@ import { DeriveSessionInfo, DeriveStakingAccount, DeriveStakingQuery, DeriveUnlo
import BN from 'bn.js'; import BN from 'bn.js';
import { Observable, combineLatest } from 'rxjs'; import { Observable, combineLatest } from 'rxjs';
import { map } from 'rxjs/operators'; import { map, switchMap } from 'rxjs/operators';
import { isUndefined } from '@polkadot/util'; import { isUndefined } from '@polkadot/util';
@@ -70,16 +70,31 @@ function parseResult (api: ApiInterfaceRx, sessionInfo: DeriveSessionInfo, query
}; };
} }
export function _account (api: ApiInterfaceRx): (sessionInfo: DeriveSessionInfo, accountId: Uint8Array | string) => Observable<DeriveStakingAccount> {
return memo((sessionInfo: DeriveSessionInfo, accountId: Uint8Array | string): Observable<DeriveStakingAccount> =>
api.derive.staking.query(accountId).pipe(
map((query) => parseResult(api, sessionInfo, query))
));
}
/** /**
* @description From a stash, retrieve the controllerId and fill in all the relevant staking details * @description From a stash, retrieve the controllerId and fill in all the relevant staking details
*/ */
export function account (api: ApiInterfaceRx): (accountId: Uint8Array | string) => Observable<DeriveStakingAccount> { export function account (api: ApiInterfaceRx): (accountId: Uint8Array | string) => Observable<DeriveStakingAccount> {
return memo((accountId: Uint8Array | string): Observable<DeriveStakingAccount> => return memo((accountId: Uint8Array | string): Observable<DeriveStakingAccount> =>
combineLatest([ api.derive.session.info().pipe(
api.derive.session.info(), switchMap((sessionInfo) => api.derive.staking._account(sessionInfo, accountId))
api.derive.staking.query(accountId) ));
]).pipe( }
map(([sessionInfo, query]: [DeriveSessionInfo, DeriveStakingQuery]) =>
parseResult(api, sessionInfo, query)) /**
* @description From a list of stashes, fill in all the relevant staking details
*/
export function accounts (api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[]) => Observable<DeriveStakingAccount[]> {
return memo((accountIds: (Uint8Array | string)[]): Observable<DeriveStakingAccount[]> =>
api.derive.session.info().pipe(
switchMap((sessionInfo) =>
combineLatest(accountIds.map((accountId) => api.derive.staking._account(sessionInfo, accountId)))
)
)); ));
} }
@@ -107,18 +107,18 @@ function filterRewards (api: ApiInterfaceRx, rewards: DeriveStakerReward[], stak
return combineLatest([ return combineLatest([
api.query.staking.migrateEra api.query.staking.migrateEra
? api.query.staking.migrateEra<Option<EraIndex>>() ? api.query.staking.migrateEra<Option<EraIndex>>()
: of({ unwrapOr: () => api.tx.staking.payoutStakers ? MIN_ONE : MAX_ERAS }), : of({ unwrapOr: () => api.tx.staking.payoutStakers ? ZERO : MAX_ERAS }),
api.tx.staking.payoutStakers api.tx.staking.payoutStakers
? api.derive.staking.queryMulti(validators) ? api.derive.staking.queryMulti(validators)
: of([]) : of([])
]).pipe( ]).pipe(
map(([optMigrate, queryValidators]): DeriveStakerReward[] => { map(([optMigrate, queryValidators]): DeriveStakerReward[] => {
const migrateEra: BN = optMigrate.unwrapOr(MIN_ONE); const migrateEra: BN = optMigrate.unwrapOr(ZERO);
return rewards return rewards
.filter(({ isEmpty }) => !isEmpty) .filter(({ isEmpty }) => !isEmpty)
.filter((reward): boolean => { .filter((reward): boolean => {
if (reward.era.lte(migrateEra)) { if (reward.era.lt(migrateEra)) {
// we filter again here, the actual ledger may have changed, e.g. something has been claimed // we filter again here, the actual ledger may have changed, e.g. something has been claimed
return filterEra(reward.era, stakingLedger); return filterEra(reward.era, stakingLedger);
} }
+1
View File
@@ -92,6 +92,7 @@ const api = await ApiPromise.create({
Some of the users of the API (let us know if you are missing from the list), include - Some of the users of the API (let us know if you are missing from the list), include -
- [Polkadot-JS UI](https://github.com/polkadot-js/apps) A user-interface that allows you to make transactions, query the network or participate in actions on the network such as referendums and staking - [Polkadot-JS UI](https://github.com/polkadot-js/apps) A user-interface that allows you to make transactions, query the network or participate in actions on the network such as referendums and staking
- [KodaDot](https://github.com/vue-polkadot/apps) ([twitter](https://twitter.com/KodaDot)) - Vue.js web wallet, governance dashboard and aspiring performance (lightweight) alternative to original apps, mobile-first.
- [Polkabot](https://gitlab.com/Polkabot) Polkabot is a Matrix chatbot that keeps an eye on the Polkadot network. You can see Polkabot in action in https://matrix.to/#/#polkadot-network-status:matrix.org - [Polkabot](https://gitlab.com/Polkabot) Polkabot is a Matrix chatbot that keeps an eye on the Polkadot network. You can see Polkabot in action in https://matrix.to/#/#polkadot-network-status:matrix.org
- [Polkawallet.io](https://polkawallet.io) and [Polkawallet (Github)](https://github.com/polkawallet-io/polkawallet-RN/) A mobile wallet for the Polkadot network to manage funds and make transactions, available on both Androind and iOS - [Polkawallet.io](https://polkawallet.io) and [Polkawallet (Github)](https://github.com/polkawallet-io/polkawallet-RN/) A mobile wallet for the Polkadot network to manage funds and make transactions, available on both Androind and iOS
- [PolkaStats.io](https://polkastats.io), [PolkaStats frontend GitHub repository](https://github.com/Colm3na/polkastats-v2) and [PolkaStats backend GitHub repository](https://github.com/Colm3na/polkastats-backend-v2) Polkadot network statistics (currently Kusama and Alexander). Shows network information and staking details from validators and intentions. - [PolkaStats.io](https://polkastats.io), [PolkaStats frontend GitHub repository](https://github.com/Colm3na/polkastats-v2) and [PolkaStats backend GitHub repository](https://github.com/Colm3na/polkastats-backend-v2) Polkadot network statistics (currently Kusama and Alexander). Shows network information and staking details from validators and intentions.
+11 -11
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api", "name": "@polkadot/api",
"version": "1.11.1", "version": "1.12.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC", "description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
@@ -27,20 +27,20 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/api-derive": "1.11.1", "@polkadot/api-derive": "1.12.1",
"@polkadot/keyring": "^2.8.1", "@polkadot/keyring": "^2.9.0-beta.3",
"@polkadot/metadata": "1.11.1", "@polkadot/metadata": "1.12.1",
"@polkadot/rpc-core": "1.11.1", "@polkadot/rpc-core": "1.12.1",
"@polkadot/rpc-provider": "1.11.1", "@polkadot/rpc-provider": "1.12.1",
"@polkadot/types": "1.11.1", "@polkadot/types": "1.12.1",
"@polkadot/types-known": "1.11.1", "@polkadot/types-known": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.3",
"bn.js": "^5.1.1", "bn.js": "^5.1.1",
"eventemitter3": "^4.0.0", "eventemitter3": "^4.0.0",
"rxjs": "^6.5.5" "rxjs": "^6.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^2.8.1" "@polkadot/keyring": "^2.9.0-beta.3"
} }
} }
+64 -34
View File
@@ -3,8 +3,7 @@
import { Codec } from '@polkadot/types/types'; import { Codec } from '@polkadot/types/types';
import { u32, u64 } from '@polkadot/types/primitive'; import { u32, u64 } from '@polkadot/types/primitive';
import { Gas } from '@polkadot/types/interfaces/contracts'; import { Balance, BalanceOf, BlockNumber, LockIdentifier, ModuleId, Moment, Percent, Permill, RuntimeDbWeight, Weight } from '@polkadot/types/interfaces/runtime';
import { Balance, BalanceOf, BlockNumber, Moment, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import { SessionIndex } from '@polkadot/types/interfaces/session'; import { SessionIndex } from '@polkadot/types/interfaces/session';
import { EraIndex } from '@polkadot/types/interfaces/staking'; import { EraIndex } from '@polkadot/types/interfaces/staking';
@@ -36,26 +35,6 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
}; };
contracts: { contracts: {
[index: string]: AugmentedConst<object & Codec>; [index: string]: AugmentedConst<object & Codec>;
/**
* The maximum amount of gas that could be expended per block. A reasonable
* default value is 10_000_000.
**/
blockGasLimit: AugmentedConst<Gas>;
/**
* The base fee charged for calling into a contract. A reasonable default
* value is 135.
**/
callBaseFee: AugmentedConst<Gas>;
/**
* The fee required to instantiate a contract instance. A reasonable default value
* is 21.
**/
contractFee: AugmentedConst<BalanceOf>;
/**
* 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 * The maximum nesting level of a call/instantiate stack. A reasonable default
* value is 100. * value is 100.
@@ -98,14 +77,6 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* The minimum amount required to generate a tombstone. * The minimum amount required to generate a tombstone.
**/ **/
tombstoneDeposit: AugmentedConst<BalanceOf>; tombstoneDeposit: 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>;
}; };
democracy: { democracy: {
[index: string]: AugmentedConst<object & Codec>; [index: string]: AugmentedConst<object & Codec>;
@@ -146,6 +117,7 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
candidacyBond: AugmentedConst<BalanceOf>; candidacyBond: AugmentedConst<BalanceOf>;
desiredMembers: AugmentedConst<u32>; desiredMembers: AugmentedConst<u32>;
desiredRunnersUp: AugmentedConst<u32>; desiredRunnersUp: AugmentedConst<u32>;
moduleId: AugmentedConst<LockIdentifier>;
termDuration: AugmentedConst<BlockNumber>; termDuration: AugmentedConst<BlockNumber>;
votingBond: AugmentedConst<BalanceOf>; votingBond: AugmentedConst<BalanceOf>;
}; };
@@ -160,6 +132,37 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
**/ **/
windowSize: AugmentedConst<BlockNumber>; windowSize: AugmentedConst<BlockNumber>;
}; };
identity: {
[index: string]: AugmentedConst<object & Codec>;
/**
* The amount held on deposit for a registered identity.
**/
basicDeposit: AugmentedConst<BalanceOf>;
/**
* The amount held on deposit per additional field for a registered identity.
**/
fieldDeposit: AugmentedConst<BalanceOf>;
/**
* Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O
* required to access an identity, but can be pretty high.
**/
maxAdditionalFields: AugmentedConst<u32>;
/**
* Maxmimum number of registrars allowed in the system. Needed to bound the complexity
* of, e.g., updating judgements.
**/
maxRegistrars: AugmentedConst<u32>;
/**
* The maximum number of sub-accounts allowed per identified account.
**/
maxSubAccounts: AugmentedConst<u32>;
/**
* The amount held on deposit for a registered subaccount. This should account for the fact
* that one storage item's value will increase by the size of an account ID, and there will be
* another trie item whose value is the size of an account ID plus 32 bytes.
**/
subAccountDeposit: AugmentedConst<BalanceOf>;
};
society: { society: {
[index: string]: AugmentedConst<object & Codec>; [index: string]: AugmentedConst<object & Codec>;
/** /**
@@ -175,6 +178,10 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* before they become suspended. * before they become suspended.
**/ **/
maxStrikes: AugmentedConst<u32>; maxStrikes: AugmentedConst<u32>;
/**
* The societies's module id
**/
moduleId: AugmentedConst<ModuleId>;
/** /**
* The amount of incentive paid within each period. Doesn't include VoterTip. * The amount of incentive paid within each period. Doesn't include VoterTip.
**/ **/
@@ -200,6 +207,29 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
**/ **/
sessionsPerEra: AugmentedConst<SessionIndex>; sessionsPerEra: AugmentedConst<SessionIndex>;
}; };
system: {
[index: string]: AugmentedConst<object & Codec>;
/**
* The base weight of executing a block, independent of the transactions in the block.
**/
blockExecutionWeight: AugmentedConst<Weight>;
/**
* The weight of runtime database operations the runtime can invoke.
**/
dbWeight: AugmentedConst<RuntimeDbWeight>;
/**
* The base weight of an Extrinsic in the block, independent of the of extrinsic being executed.
**/
extrinsicBaseWeight: AugmentedConst<Weight>;
/**
* The maximum length of a block (in bytes).
**/
maximumBlockLength: AugmentedConst<u32>;
/**
* The maximum weight of a block.
**/
maximumBlockWeight: AugmentedConst<Weight>;
};
timestamp: { timestamp: {
[index: string]: AugmentedConst<object & Codec>; [index: string]: AugmentedConst<object & Codec>;
/** /**
@@ -212,10 +242,6 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
}; };
transactionPayment: { transactionPayment: {
[index: string]: AugmentedConst<object & Codec>; [index: string]: AugmentedConst<object & 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. * The fee to be paid for making a transaction; the per-byte portion.
**/ **/
@@ -227,6 +253,10 @@ declare module '@polkadot/metadata/Decorated/consts/types' {
* Percentage of spare funds (if any) that are burnt per spend period. * Percentage of spare funds (if any) that are burnt per spend period.
**/ **/
burn: AugmentedConst<Permill>; burn: AugmentedConst<Permill>;
/**
* The treasury's module id, used for deriving its sovereign account ID.
**/
moduleId: AugmentedConst<ModuleId>;
/** /**
* Fraction of a proposal's value that should be bonded in order to place the proposal. * 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. * An accepted proposal gets these back. A rejected proposal does not.
+1 -9
View File
@@ -9,7 +9,7 @@ import { BabeAuthorityWeight, MaybeVrf, Randomness } from '@polkadot/types/inter
import { AccountData, BalanceLock, ReleasesBalances } from '@polkadot/types/interfaces/balances'; import { AccountData, BalanceLock, ReleasesBalances } from '@polkadot/types/interfaces/balances';
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective'; import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus'; import { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
import { CodeHash, ContractInfo, Gas, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts'; import { CodeHash, ContractInfo, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
import { PreimageStatus, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy'; import { PreimageStatus, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy';
import { VoteThreshold } from '@polkadot/types/interfaces/elections'; import { VoteThreshold } from '@polkadot/types/interfaces/elections';
import { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa'; import { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
@@ -146,14 +146,6 @@ declare module '@polkadot/api/types/storage' {
* Current cost schedule for contracts. * Current cost schedule for contracts.
**/ **/
currentSchedule: AugmentedQuery<ApiType, () => Observable<Schedule>> & QueryableStorageEntry<ApiType>; currentSchedule: AugmentedQuery<ApiType, () => Observable<Schedule>> & QueryableStorageEntry<ApiType>;
/**
* The price of one unit of gas.
**/
gasPrice: AugmentedQuery<ApiType, () => Observable<BalanceOf>> & QueryableStorageEntry<ApiType>;
/**
* Gas spent so far in this block.
**/
gasSpent: AugmentedQuery<ApiType, () => Observable<Gas>> & QueryableStorageEntry<ApiType>;
/** /**
* A mapping from an original code hash to the original code, untouched by instrumentation. * A mapping from an original code hash to the original code, untouched by instrumentation.
**/ **/
+3 -3
View File
@@ -144,11 +144,11 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
/** /**
* Get offchain local storage under given key and prefix * Get offchain local storage under given key and prefix
**/ **/
localStorageGet: AugmentedRpc<(kind: StorageKind | ('__UNUSED' | 'PERSISTENT' | 'LOCAL') | number | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Option<Bytes>>>; localStorageGet: AugmentedRpc<(kind: StorageKind | '__UNUSED' | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Option<Bytes>>>;
/** /**
* Set offchain local storage under given key and prefix * Set offchain local storage under given key and prefix
**/ **/
localStorageSet: AugmentedRpc<(kind: StorageKind | ('__UNUSED' | 'PERSISTENT' | 'LOCAL') | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>; localStorageSet: AugmentedRpc<(kind: StorageKind | '__UNUSED' | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>;
}; };
payment: { payment: {
/** /**
@@ -234,7 +234,7 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
/** /**
* Subscribes to storage changes for the provided keys * Subscribes to storage changes for the provided keys
**/ **/
subscribeStorage: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[]) => Observable<T>>; subscribeStorage: AugmentedRpc<<T = Codec[]>(keys?: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[]) => Observable<T>>;
}; };
system: { system: {
/** /**
+116 -29
View File
@@ -33,6 +33,10 @@ declare module '@polkadot/api/types/submittable' {
/** /**
* Exactly as `transfer`, except the origin must be root and the source account may be * Exactly as `transfer`, except the origin must be root and the source account may be
* specified. * specified.
* # <weight>
* - Same as transfer, but additional read and write because the source account is
* not assumed to be in the overlay.
* # </weight>
**/ **/
forceTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; forceTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
@@ -110,7 +114,7 @@ declare module '@polkadot/api/types/submittable' {
* Stores the given binary Wasm code into the chain's storage and returns its `codehash`. * Stores the given binary Wasm code into the chain's storage and returns its `codehash`.
* You can instantiate contracts only with stored code. * You can instantiate contracts only with stored code.
**/ **/
putCode: AugmentedSubmittable<(gasLimit: Compact<Gas> | AnyNumber | Uint8Array, code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; putCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Updates the schedule for metering contracts. * Updates the schedule for metering contracts.
* The schedule must have a greater version than the stored schedule. * The schedule must have a greater version than the stored schedule.
@@ -237,7 +241,7 @@ declare module '@polkadot/api/types/submittable' {
* # <weight> * # <weight>
* # </weight> * # </weight>
**/ **/
delegate: AugmentedSubmittable<(to: AccountId | string | Uint8Array, conviction: Conviction | ('None' | 'Locked1x' | 'Locked2x' | 'Locked3x' | 'Locked4x' | 'Locked5x' | 'Locked6x') | number | Uint8Array, balance: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; delegate: AugmentedSubmittable<(to: AccountId | string | Uint8Array, conviction: Conviction | 'None'|'Locked1x'|'Locked2x'|'Locked3x'|'Locked4x'|'Locked5x'|'Locked6x' | number | Uint8Array, balance: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Schedule an emergency cancellation of a referendum. Cannot happen twice to the same * Schedule an emergency cancellation of a referendum. Cannot happen twice to the same
* referendum. * referendum.
@@ -375,7 +379,7 @@ declare module '@polkadot/api/types/submittable' {
* # <weight> * # <weight>
* # </weight> * # </weight>
**/ **/
proxyDelegate: AugmentedSubmittable<(to: AccountId | string | Uint8Array, conviction: Conviction | ('None' | 'Locked1x' | 'Locked2x' | 'Locked3x' | 'Locked4x' | 'Locked5x' | 'Locked6x') | number | Uint8Array, balance: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; proxyDelegate: AugmentedSubmittable<(to: AccountId | string | Uint8Array, conviction: Conviction | 'None'|'Locked1x'|'Locked2x'|'Locked3x'|'Locked4x'|'Locked5x'|'Locked6x' | number | Uint8Array, balance: BalanceOf | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Remove a proxied vote for a referendum. * Remove a proxied vote for a referendum.
* Exactly equivalent to `remove_vote` except that it operates on the account that the * Exactly equivalent to `remove_vote` except that it operates on the account that the
@@ -630,9 +634,12 @@ declare module '@polkadot/api/types/submittable' {
* - `account`: the account of the registrar. * - `account`: the account of the registrar.
* Emits `RegistrarAdded` if successful. * Emits `RegistrarAdded` if successful.
* # <weight> * # <weight>
* - `O(R)` where `R` registrar-count (governance-bounded). * - `O(R)` where `R` registrar-count (governance-bounded and code-bounded).
* - One storage mutation (codec `O(R)`). * - One storage mutation (codec `O(R)`).
* - One event. * - One event.
* - Benchmarks:
* - 78.71 + R * 0.965 µs (min squares analysis)
* - 94.28 + R * 0.991 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
addRegistrar: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; addRegistrar: AugmentedSubmittable<(account: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
@@ -648,20 +655,29 @@ declare module '@polkadot/api/types/submittable' {
* - One balance-reserve operation. * - One balance-reserve operation.
* - One storage mutation `O(R + X)`. * - One storage mutation `O(R + X)`.
* - One event. * - One event.
* - Benchmarks:
* - 135.3 + R * 0.574 + X * 3.394 µs (min squares analysis)
* - 144.3 + R * 0.316 + X * 3.53 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
cancelRequest: AugmentedSubmittable<(regIndex: RegistrarIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; cancelRequest: AugmentedSubmittable<(regIndex: RegistrarIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Clear an account's identity info and all sub-account and return all deposits. * Clear an account's identity info and all sub-accounts and return all deposits.
* Payment: All reserved balances on the account are returned. * Payment: All reserved balances on the account are returned.
* The dispatch origin for this call must be _Signed_ and the sender must have a registered * The dispatch origin for this call must be _Signed_ and the sender must have a registered
* identity. * identity.
* Emits `IdentityCleared` if successful. * Emits `IdentityCleared` if successful.
* # <weight> * # <weight>
* - `O(R + S + X)`. * - `O(R + S + X)`
* - One balance-reserve operation. * - where `R` registrar-count (governance-bounded).
* - `S + 2` storage deletions. * - where `S` subs-count (hard- and deposit-bounded).
* - where `X` additional-field-count (deposit-bounded and code-bounded).
* - One balance-unreserve operation.
* - `2` storage reads and `S + 2` storage deletions.
* - One event. * - One event.
* - Benchmarks:
* - 152.3 + R * 0.306 + S * 4.967 + X * 1.697 µs (min squares analysis)
* - 139.5 + R * 0.466 + S * 5.304 + X * 1.895 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
clearIdentity: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>; clearIdentity: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
@@ -679,6 +695,7 @@ declare module '@polkadot/api/types/submittable' {
* - One balance-reserve operation. * - One balance-reserve operation.
* - `S + 2` storage mutations. * - `S + 2` storage mutations.
* - One event. * - One event.
* - Benchmark: 167.4 + R * 1.107 + S * 5.343 + X * 2.294 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
@@ -697,6 +714,7 @@ declare module '@polkadot/api/types/submittable' {
* - Up to one account-lookup operation. * - Up to one account-lookup operation.
* - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`. * - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`.
* - One event. * - One event.
* - Benchmark: 110.7 + R * 1.066 + X * 3.402 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
@@ -709,7 +727,7 @@ declare module '@polkadot/api/types/submittable' {
* - `reg_index`: The index of the registrar whose judgement is requested. * - `reg_index`: The index of the registrar whose judgement is requested.
* - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as: * - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as:
* ```nocompile * ```nocompile
* Self::registrars(reg_index).unwrap().fee * Self::registrars().get(reg_index).unwrap().fee
* ``` * ```
* Emits `JudgementRequested` if successful. * Emits `JudgementRequested` if successful.
* # <weight> * # <weight>
@@ -717,6 +735,9 @@ declare module '@polkadot/api/types/submittable' {
* - One balance-reserve operation. * - One balance-reserve operation.
* - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`. * - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`.
* - One event. * - One event.
* - Benchmarks:
* - 154 + R * 0.932 + X * 3.302 µs (min squares analysis)
* - 172.9 + R * 0.69 + X * 3.304 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
requestJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, maxFee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; requestJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, maxFee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
@@ -729,6 +750,7 @@ declare module '@polkadot/api/types/submittable' {
* # <weight> * # <weight>
* - `O(R)`. * - `O(R)`.
* - One storage mutation `O(R)`. * - One storage mutation `O(R)`.
* - Benchmark: 24.59 + R * 0.832 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
setAccountId: AugmentedSubmittable<(index: Compact<RegistrarIndex> | AnyNumber | Uint8Array, updated: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; setAccountId: AugmentedSubmittable<(index: Compact<RegistrarIndex> | AnyNumber | Uint8Array, updated: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
@@ -741,6 +763,8 @@ declare module '@polkadot/api/types/submittable' {
* # <weight> * # <weight>
* - `O(R)`. * - `O(R)`.
* - One storage mutation `O(R)`. * - One storage mutation `O(R)`.
* - Benchmarks:
* - 23.81 + R * 0.774 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
setFee: AugmentedSubmittable<(index: Compact<RegistrarIndex> | AnyNumber | Uint8Array, fee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; setFee: AugmentedSubmittable<(index: Compact<RegistrarIndex> | AnyNumber | Uint8Array, fee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
@@ -753,6 +777,7 @@ declare module '@polkadot/api/types/submittable' {
* # <weight> * # <weight>
* - `O(R)`. * - `O(R)`.
* - One storage mutation `O(R)`. * - One storage mutation `O(R)`.
* - Benchmark: 22.85 + R * 0.853 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
setFields: AugmentedSubmittable<(index: Compact<RegistrarIndex> | AnyNumber | Uint8Array, fields: IdentityFields) => SubmittableExtrinsic<ApiType>>; setFields: AugmentedSubmittable<(index: Compact<RegistrarIndex> | AnyNumber | Uint8Array, fields: IdentityFields) => SubmittableExtrinsic<ApiType>>;
@@ -760,15 +785,19 @@ declare module '@polkadot/api/types/submittable' {
* Set an account's identity information and reserve the appropriate deposit. * Set an account's identity information and reserve the appropriate deposit.
* If the account already has identity information, the deposit is taken as part payment * If the account already has identity information, the deposit is taken as part payment
* for the new deposit. * for the new deposit.
* The dispatch origin for this call must be _Signed_ and the sender must have a registered * The dispatch origin for this call must be _Signed_.
* identity.
* - `info`: The identity information. * - `info`: The identity information.
* Emits `IdentitySet` if successful. * Emits `IdentitySet` if successful.
* # <weight> * # <weight>
* - `O(X + X' + R)` where `X` additional-field-count (deposit-bounded and code-bounded). * - `O(X + X' + R)`
* - At most two balance operations. * - where `X` additional-field-count (deposit-bounded and code-bounded)
* - where `R` judgements-count (registrar-count-bounded)
* - One balance reserve operation.
* - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`). * - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).
* - One event. * - One event.
* - Benchmarks:
* - 136.6 + R * 0.62 + X * 2.62 µs (min squares analysis)
* - 146.2 + R * 0.372 + X * 2.98 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
setIdentity: AugmentedSubmittable<(info: IdentityInfo | { additional?: any; display?: any; legal?: any; web?: any; riot?: any; email?: any; pgpFingerprint?: any; image?: any; twitter?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; setIdentity: AugmentedSubmittable<(info: IdentityInfo | { additional?: any; display?: any; legal?: any; web?: any; riot?: any; email?: any; pgpFingerprint?: any; image?: any; twitter?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
@@ -778,12 +807,20 @@ declare module '@polkadot/api/types/submittable' {
* and an amount `SubAccountDeposit` will be reserved for each item in `subs`. * and an amount `SubAccountDeposit` will be reserved for each item in `subs`.
* The dispatch origin for this call must be _Signed_ and the sender must have a registered * The dispatch origin for this call must be _Signed_ and the sender must have a registered
* identity. * identity.
* - `subs`: The identity's sub-accounts. * - `subs`: The identity's (new) sub-accounts.
* # <weight> * # <weight>
* - `O(S)` where `S` subs-count (hard- and deposit-bounded). * - `O(P + S)`
* - At most two balance operations. * - where `P` old-subs-count (hard- and deposit-bounded).
* - At most O(2 * S + 1) storage mutations; codec complexity `O(1 * S + S * 1)`); * - where `S` subs-count (hard- and deposit-bounded).
* one storage-exists. * - At most one balance operations.
* - DB:
* - `P + S` storage mutations (codec complexity `O(1)`)
* - One storage read (codec complexity `O(P)`).
* - One storage write (codec complexity `O(S)`).
* - One storage-exists (`IdentityOf::contains_key`).
* - Benchmarks:
* - 115.2 + P * 5.11 + S * 6.67 µs (min squares analysis)
* - 121 + P * 4.852 + S * 7.111 µs (min squares analysis)
* # </weight> * # </weight>
**/ **/
setSubs: AugmentedSubmittable<(subs: Vec<ITuple<[AccountId, Data]>> | ([AccountId | string | Uint8Array, Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>>; setSubs: AugmentedSubmittable<(subs: Vec<ITuple<[AccountId, Data]>> | ([AccountId | string | Uint8Array, Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>>;
@@ -1024,9 +1061,11 @@ declare module '@polkadot/api/types/submittable' {
* This doesn't take effect until the next session. * This doesn't take effect until the next session.
* The dispatch origin of this function must be signed. * The dispatch origin of this function must be signed.
* # <weight> * # <weight>
* - O(N) in number of key types. * - Complexity: `O(1)` in number of key types.
* - Removes N + 1 DB entries. * Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.
* - Reduces system account refs by one on success. * - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`
* - DbWrites: `NextKeys`, `origin account`
* - DbWrites per key id: `KeyOwnder`
* # </weight> * # </weight>
**/ **/
purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>; purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
@@ -1036,10 +1075,12 @@ declare module '@polkadot/api/types/submittable' {
* This doesn't take effect until the next session. * This doesn't take effect until the next session.
* The dispatch origin of this function must be signed. * The dispatch origin of this function must be signed.
* # <weight> * # <weight>
* - O(log n) in number of accounts. * - Complexity: `O(1)`
* - One extra DB entry. * Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.
* - Increases system account refs by one on success iff there were previously no keys set. * - DbReads: `origin account`, `T::ValidatorIdOf`, `NextKeys`
* In this case, purge_keys will need to be called before the account can be removed. * - DbWrites: `origin account`, `NextKeys`
* - DbReads per key id: `KeyOwner`
* - DbWrites per key id: `KeyOwner`
* # </weight> * # </weight>
**/ **/
setKeys: AugmentedSubmittable<(keys: Keys, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; setKeys: AugmentedSubmittable<(keys: Keys, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
@@ -1144,7 +1185,7 @@ declare module '@polkadot/api/types/submittable' {
* Total Complexity: O(M + logM + B + X) * Total Complexity: O(M + logM + B + X)
* # </weight> * # </weight>
**/ **/
judgeSuspendedCandidate: AugmentedSubmittable<(who: AccountId | string | Uint8Array, judgement: SocietyJudgement | ('Rebid' | 'Reject' | 'Approve') | number | Uint8Array) => SubmittableExtrinsic<ApiType>>; judgeSuspendedCandidate: AugmentedSubmittable<(who: AccountId | string | Uint8Array, judgement: SocietyJudgement | 'Rebid'|'Reject'|'Approve' | number | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Allow suspension judgement origin to make judgement on a suspended member. * Allow suspension judgement origin to make judgement on a suspended member.
* If a suspended member is forgiven, we simply add them back as a member, not affecting * If a suspended member is forgiven, we simply add them back as a member, not affecting
@@ -1322,7 +1363,7 @@ declare module '@polkadot/api/types/submittable' {
* unless the `origin` falls below _existential deposit_ and gets removed as dust. * unless the `origin` falls below _existential deposit_ and gets removed as dust.
* # </weight> * # </weight>
**/ **/
bond: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | ('Staked' | 'Stash' | 'Controller') | number | Uint8Array) => SubmittableExtrinsic<ApiType>>; bond: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | 'Staked'|'Stash'|'Controller' | number | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Add some extra amount that have appeared in the stash `free_balance` into the balance up * Add some extra amount that have appeared in the stash `free_balance` into the balance up
* for staking. * for staking.
@@ -1506,7 +1547,7 @@ declare module '@polkadot/api/types/submittable' {
* - Writes are limited to the `origin` account key. * - Writes are limited to the `origin` account key.
* # </weight> * # </weight>
**/ **/
setPayee: AugmentedSubmittable<(payee: RewardDestination | ('Staked' | 'Stash' | 'Controller') | number | Uint8Array) => SubmittableExtrinsic<ApiType>>; setPayee: AugmentedSubmittable<(payee: RewardDestination | 'Staked'|'Stash'|'Controller' | number | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* The ideal number of validators. * The ideal number of validators.
**/ **/
@@ -1558,7 +1599,7 @@ declare module '@polkadot/api/types/submittable' {
* - Storage: O(n) reads `AccountId` to fetch `snapshot_nominators`. * - Storage: O(n) reads `AccountId` to fetch `snapshot_nominators`.
* - Memory: O(n + m) reads to map index to `AccountId` for un-compact. * - Memory: O(n + m) reads to map index to `AccountId` for un-compact.
* - Storage: O(e) accountid reads from `Nomination` to read correct nominations. * - Storage: O(e) accountid reads from `Nomination` to read correct nominations.
* - Storage: O(e) calls into `slashable_balance_of_extended` to convert ratio to staked. * - Storage: O(e) calls into `slashable_balance_of_vote_weight` to convert ratio to staked.
* - Memory: build_support_map. O(e). * - Memory: build_support_map. O(e).
* - Memory: evaluate_support: O(E). * - Memory: evaluate_support: O(E).
* - Storage: O(e) writes to `QueuedElected`. * - Storage: O(e) writes to `QueuedElected`.
@@ -1672,39 +1713,80 @@ declare module '@polkadot/api/types/submittable' {
fillBlock: AugmentedSubmittable<(ratio: Perbill | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; fillBlock: AugmentedSubmittable<(ratio: Perbill | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Kill all storage items with a key that starts with the given prefix. * Kill all storage items with a key that starts with the given prefix.
* # <weight>
* - `O(P)` where `P` amount of keys with prefix `prefix`
* - `P` storage deletions.
* # </weight>
**/ **/
killPrefix: AugmentedSubmittable<(prefix: Key | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; killPrefix: AugmentedSubmittable<(prefix: Key | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Kill some items from storage. * Kill some items from storage.
* # <weight>
* - `O(VK)` where `V` length of `keys` and `K` length of one key
* - `V` storage deletions.
* # </weight>
**/ **/
killStorage: AugmentedSubmittable<(keys: Vec<Key> | (Key | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>; killStorage: AugmentedSubmittable<(keys: Vec<Key> | (Key | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>>;
/** /**
* Make some on-chain remark. * Make some on-chain remark.
* # <weight>
* - `O(1)`
* # </weight>
**/ **/
remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Set the new changes trie configuration. * Set the new changes trie configuration.
* # <weight>
* - `O(D)` where `D` length of `Digest`
* - 1 storage write or delete (codec `O(1)`).
* - 1 call to `deposit_log`: `O(D)` (which depends on the length of `Digest`)
* # </weight>
**/ **/
setChangesTrieConfig: AugmentedSubmittable<(changesTrieConfig: Option<ChangesTrieConfiguration> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; setChangesTrieConfig: AugmentedSubmittable<(changesTrieConfig: Option<ChangesTrieConfiguration> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Set the new runtime code. * Set the new runtime code.
* # <weight>
* - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`
* - 1 storage write (codec `O(C)`).
* - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is expensive).
* - 1 event.
* # </weight>
**/ **/
setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Set the new runtime code without doing any checks of the given `code`. * Set the new runtime code without doing any checks of the given `code`.
* # <weight>
* - `O(C)` where `C` length of `code`
* - 1 storage write (codec `O(C)`).
* - 1 event.
* # </weight>
**/ **/
setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>; setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Set the number of pages in the WebAssembly environment's heap. * Set the number of pages in the WebAssembly environment's heap.
* # <weight>
* - `O(1)`
* - 1 storage write.
* # </weight>
**/ **/
setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/** /**
* Set some items of storage. * Set some items of storage.
* # <weight>
* - `O(I)` where `I` length of `items`
* - `I` storage writes (`O(1)`).
* # </weight>
**/ **/
setStorage: AugmentedSubmittable<(items: Vec<KeyValue> | (KeyValue)[]) => SubmittableExtrinsic<ApiType>>; setStorage: AugmentedSubmittable<(items: Vec<KeyValue> | (KeyValue)[]) => SubmittableExtrinsic<ApiType>>;
/** /**
* Kill the sending account, assuming there are no references outstanding and the composite * Kill the sending account, assuming there are no references outstanding and the composite
* data is equal to its default value. * data is equal to its default value.
* # <weight>
* - `O(K)` with `K` being complexity of `on_killed_account`
* - 1 storage read and deletion.
* - 1 call to `on_killed_account` callback with unknown complexity `K`
* - 1 event.
* # </weight>
**/ **/
suicide: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>; suicide: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
}; };
@@ -1799,6 +1881,11 @@ declare module '@polkadot/api/types/submittable' {
* The timestamp should be greater than the previous one by the amount specified by * The timestamp should be greater than the previous one by the amount specified by
* `MinimumPeriod`. * `MinimumPeriod`.
* The dispatch origin for this call must be `Inherent`. * The dispatch origin for this call must be `Inherent`.
* # <weight>
* - `O(T)` where `T` complexity of `on_timestamp_set`
* - 2 storage mutations (codec `O(1)`).
* - 1 event handler `on_timestamp_set` `O(T)`.
* # </weight>
**/ **/
set: AugmentedSubmittable<(now: Compact<Moment> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>; set: AugmentedSubmittable<(now: Compact<Moment> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
}; };
+1 -1
View File
@@ -264,7 +264,7 @@ export default class ApiPromise extends ApiBase<'promise'> {
* ``` * ```
*/ */
// eslint-disable-next-line @typescript-eslint/require-await // eslint-disable-next-line @typescript-eslint/require-await
public async combineLatest (fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[], callback: CombinatorCallback): UnsubscribePromise { public async combineLatest <T extends any[] = any[]> (fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[], callback: CombinatorCallback<T>): UnsubscribePromise {
const combinator = new Combinator(fns, callback); const combinator = new Combinator(fns, callback);
return (): void => { return (): void => {
+6 -5
View File
@@ -7,15 +7,16 @@ import { UnsubscribePromise } from '../types';
import { isFunction } from '@polkadot/util'; import { isFunction } from '@polkadot/util';
export type CombinatorCallback = Callback<any[]>; export type CombinatorCallback <T extends any[]> = Callback<T>;
export interface CombinatorFunction { export interface CombinatorFunction {
(cb: Callback<any>): UnsubscribePromise; (cb: Callback<any>): UnsubscribePromise;
} }
export default class Combinator { export default class Combinator<T extends any[] = any[]> {
#allHasFired = false; #allHasFired = false;
#callback: CombinatorCallback; #callback: CombinatorCallback<T>;
#fired: boolean[] = []; #fired: boolean[] = [];
@@ -27,7 +28,7 @@ export default class Combinator {
#subscriptions: UnsubscribePromise[] = []; #subscriptions: UnsubscribePromise[] = [];
constructor (fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[], callback: CombinatorCallback) { constructor (fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[], callback: CombinatorCallback<T>) {
this.#callback = callback; this.#callback = callback;
// eslint-disable-next-line @typescript-eslint/require-await // eslint-disable-next-line @typescript-eslint/require-await
@@ -67,7 +68,7 @@ export default class Combinator {
} }
try { try {
this.#callback(this.#results); this.#callback(this.#results as T);
} catch (error) { } catch (error) {
// swallow, we don't want the handler to trip us up // swallow, we don't want the handler to trip us up
} }
+2
View File
@@ -9,6 +9,8 @@ function createApi (): Promise<ApiPromise> {
process.env.NODE_ENV = 'test'; process.env.NODE_ENV = 'test';
const provider = new WsProvider('wss://kusama-rpc.polkadot.io'); const provider = new WsProvider('wss://kusama-rpc.polkadot.io');
// const provider = new WsProvider('wss://westend-rpc.polkadot.io/');
// const provider = new WsProvider('ws://127.0.0.1:9944/');
return new ApiPromise({ provider }).isReady; return new ApiPromise({ provider }).isReady;
} }
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/metadata", "name": "@polkadot/metadata",
"version": "1.11.1", "version": "1.12.1",
"description": "Helpers to extract information from runtime metadata", "description": "Helpers to extract information from runtime metadata",
"main": "index.js", "main": "index.js",
"publishConfig": { "publishConfig": {
@@ -27,13 +27,13 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/types": "1.11.1", "@polkadot/types": "1.12.1",
"@polkadot/types-known": "1.11.1", "@polkadot/types-known": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.3",
"bn.js": "^5.1.1" "bn.js": "^5.1.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^2.8.1" "@polkadot/keyring": "^2.9.0-beta.3"
} }
} }
@@ -226,7 +226,11 @@
} }
], ],
"documentation": [ "documentation": [
" Make some on-chain remark." " Make some on-chain remark.",
"",
" # <weight>",
" - `O(1)`",
" # </weight>"
] ]
}, },
{ {
@@ -238,7 +242,12 @@
} }
], ],
"documentation": [ "documentation": [
" Set the number of pages in the WebAssembly environment's heap." " Set the number of pages in the WebAssembly environment's heap.",
"",
" # <weight>",
" - `O(1)`",
" - 1 storage write.",
" # </weight>"
] ]
}, },
{ {
@@ -250,7 +259,14 @@
} }
], ],
"documentation": [ "documentation": [
" Set the new runtime code." " Set the new runtime code.",
"",
" # <weight>",
" - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`",
" - 1 storage write (codec `O(C)`).",
" - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is expensive).",
" - 1 event.",
" # </weight>"
] ]
}, },
{ {
@@ -262,7 +278,13 @@
} }
], ],
"documentation": [ "documentation": [
" Set the new runtime code without doing any checks of the given `code`." " Set the new runtime code without doing any checks of the given `code`.",
"",
" # <weight>",
" - `O(C)` where `C` length of `code`",
" - 1 storage write (codec `O(C)`).",
" - 1 event.",
" # </weight>"
] ]
}, },
{ {
@@ -274,7 +296,13 @@
} }
], ],
"documentation": [ "documentation": [
" Set the new changes trie configuration." " Set the new changes trie configuration.",
"",
" # <weight>",
" - `O(D)` where `D` length of `Digest`",
" - 1 storage write or delete (codec `O(1)`).",
" - 1 call to `deposit_log`: `O(D)` (which depends on the length of `Digest`)",
" # </weight>"
] ]
}, },
{ {
@@ -286,7 +314,12 @@
} }
], ],
"documentation": [ "documentation": [
" Set some items of storage." " Set some items of storage.",
"",
" # <weight>",
" - `O(I)` where `I` length of `items`",
" - `I` storage writes (`O(1)`).",
" # </weight>"
] ]
}, },
{ {
@@ -298,7 +331,12 @@
} }
], ],
"documentation": [ "documentation": [
" Kill some items from storage." " Kill some items from storage.",
"",
" # <weight>",
" - `O(VK)` where `V` length of `keys` and `K` length of one key",
" - `V` storage deletions.",
" # </weight>"
] ]
}, },
{ {
@@ -310,7 +348,12 @@
} }
], ],
"documentation": [ "documentation": [
" Kill all storage items with a key that starts with the given prefix." " Kill all storage items with a key that starts with the given prefix.",
"",
" # <weight>",
" - `O(P)` where `P` amount of keys with prefix `prefix`",
" - `P` storage deletions.",
" # </weight>"
] ]
}, },
{ {
@@ -318,7 +361,14 @@
"args": [], "args": [],
"documentation": [ "documentation": [
" Kill the sending account, assuming there are no references outstanding and the composite", " Kill the sending account, assuming there are no references outstanding and the composite",
" data is equal to its default value." " data is equal to its default value.",
"",
" # <weight>",
" - `O(K)` with `K` being complexity of `on_killed_account`",
" - 1 storage read and deletion.",
" - 1 call to `on_killed_account` callback with unknown complexity `K`",
" - 1 event.",
" # </weight>"
] ]
} }
], ],
@@ -368,7 +418,48 @@
] ]
} }
], ],
"constants": [], "constants": [
{
"name": "MaximumBlockWeight",
"type": "Weight",
"value": "0x00204aa9d1010000",
"documentation": [
" The maximum weight of a block."
]
},
{
"name": "DbWeight",
"type": "RuntimeDbWeight",
"value": "0x008793030000000000c2eb0b00000000",
"documentation": [
" The weight of runtime database operations the runtime can invoke."
]
},
{
"name": "BlockExecutionWeight",
"type": "Weight",
"value": "0x0000000000000000",
"documentation": [
" The base weight of executing a block, independent of the transactions in the block."
]
},
{
"name": "ExtrinsicBaseWeight",
"type": "Weight",
"value": "0x8096980000000000",
"documentation": [
" The base weight of an Extrinsic in the block, independent of the of extrinsic being executed."
]
},
{
"name": "MaximumBlockLength",
"type": "u32",
"value": "0x00005000",
"documentation": [
" The maximum length of a block (in bytes)."
]
}
],
"errors": [ "errors": [
{ {
"name": "InvalidSpecName", "name": "InvalidSpecName",
@@ -944,7 +1035,7 @@
{ {
"name": "EpochDuration", "name": "EpochDuration",
"type": "u64", "type": "u64",
"value": "0x1400000000000000", "value": "0xc800000000000000",
"documentation": [ "documentation": [
" The number of **slots** that an epoch takes. We couple sessions to", " 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." " epochs, i.e. we start a new session once the new epoch begins."
@@ -1012,7 +1103,13 @@
" The timestamp should be greater than the previous one by the amount specified by", " The timestamp should be greater than the previous one by the amount specified by",
" `MinimumPeriod`.", " `MinimumPeriod`.",
"", "",
" The dispatch origin for this call must be `Inherent`." " The dispatch origin for this call must be `Inherent`.",
"",
" # <weight>",
" - `O(T)` where `T` complexity of `on_timestamp_set`",
" - 2 storage mutations (codec `O(1)`).",
" - 1 event handler `on_timestamp_set` `O(T)`.",
" # </weight>"
] ]
} }
], ],
@@ -1457,7 +1554,11 @@
], ],
"documentation": [ "documentation": [
" Exactly as `transfer`, except the origin must be root and the source account may be", " Exactly as `transfer`, except the origin must be root and the source account may be",
" specified." " specified.",
" # <weight>",
" - Same as transfer, but additional read and write because the source account is",
" not assumed to be in the overlay.",
" # </weight>"
] ]
}, },
{ {
@@ -1609,7 +1710,7 @@
"type": { "type": {
"Plain": "Multiplier" "Plain": "Multiplier"
}, },
"fallback": "0x0000000000000000", "fallback": "0x00000000000000000000000000000000",
"documentation": [] "documentation": []
} }
] ]
@@ -1617,14 +1718,6 @@
"calls": null, "calls": null,
"events": null, "events": null,
"constants": [ "constants": [
{
"name": "TransactionBaseFee",
"type": "BalanceOf",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The fee to be paid for making a transaction; the base."
]
},
{ {
"name": "TransactionByteFee", "name": "TransactionByteFee",
"type": "BalanceOf", "type": "BalanceOf",
@@ -2754,7 +2847,7 @@
" - Memory: O(n + m) reads to map index to `AccountId` for un-compact.", " - Memory: O(n + m) reads to map index to `AccountId` for un-compact.",
"", "",
" - Storage: O(e) accountid reads from `Nomination` to read correct nominations.", " - Storage: O(e) accountid reads from `Nomination` to read correct nominations.",
" - Storage: O(e) calls into `slashable_balance_of_extended` to convert ratio to staked.", " - Storage: O(e) calls into `slashable_balance_of_vote_weight` to convert ratio to staked.",
"", "",
" - Memory: build_support_map. O(e).", " - Memory: build_support_map. O(e).",
" - Memory: evaluate_support: O(E).", " - Memory: evaluate_support: O(E).",
@@ -2796,6 +2889,18 @@
} }
], ],
"events": [ "events": [
{
"name": "EraPayout",
"args": [
"EraIndex",
"Balance",
"Balance"
],
"documentation": [
" The era payout has been set; the first balance is the validator-payout; the second is",
" the remainder from the maximum amount of reward."
]
},
{ {
"name": "Reward", "name": "Reward",
"args": [ "args": [
@@ -3181,10 +3286,12 @@
" The dispatch origin of this function must be signed.", " The dispatch origin of this function must be signed.",
"", "",
" # <weight>", " # <weight>",
" - O(log n) in number of accounts.", " - Complexity: `O(1)`",
" - One extra DB entry.", " Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.",
" - Increases system account refs by one on success iff there were previously no keys set.", " - DbReads: `origin account`, `T::ValidatorIdOf`, `NextKeys`",
" In this case, purge_keys will need to be called before the account can be removed.", " - DbWrites: `origin account`, `NextKeys`",
" - DbReads per key id: `KeyOwner`",
" - DbWrites per key id: `KeyOwner`",
" # </weight>" " # </weight>"
] ]
}, },
@@ -3198,9 +3305,11 @@
" The dispatch origin of this function must be signed.", " The dispatch origin of this function must be signed.",
"", "",
" # <weight>", " # <weight>",
" - O(N) in number of key types.", " - Complexity: `O(1)` in number of key types.",
" - Removes N + 1 DB entries.", " Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.",
" - Reduces system account refs by one on success.", " - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`",
" - DbWrites: `NextKeys`, `origin account`",
" - DbWrites per key id: `KeyOwnder`",
" # </weight>" " # </weight>"
] ]
} }
@@ -5548,6 +5657,12 @@
"type": "BlockNumber", "type": "BlockNumber",
"value": "0x80130300", "value": "0x80130300",
"documentation": [] "documentation": []
},
{
"name": "ModuleId",
"type": "LockIdentifier",
"value": "0x706872656c656374",
"documentation": []
} }
], ],
"errors": [ "errors": [
@@ -6491,6 +6606,14 @@
"documentation": [ "documentation": [
" The amount held on deposit per byte within the tip report reason." " The amount held on deposit per byte within the tip report reason."
] ]
},
{
"name": "ModuleId",
"type": "ModuleId",
"value": "0x70792f7472737279",
"documentation": [
" The treasury's module id, used for deriving its sovereign account ID."
]
} }
], ],
"errors": [ "errors": [
@@ -6549,24 +6672,13 @@
"storage": { "storage": {
"prefix": "Contracts", "prefix": "Contracts",
"items": [ "items": [
{
"name": "GasSpent",
"modifier": "Default",
"type": {
"Plain": "Gas"
},
"fallback": "0x0000000000000000",
"documentation": [
" Gas spent so far in this block."
]
},
{ {
"name": "CurrentSchedule", "name": "CurrentSchedule",
"modifier": "Default", "modifier": "Default",
"type": { "type": {
"Plain": "Schedule" "Plain": "Schedule"
}, },
"fallback": "0x0000000001000000000000000100000000000000010000000000000001000000000000000100000000000000010000000000000001000000000000008700000000000000af00000000000000010000000000000001000000000000006400000000000000040000000000010010000000004000000020000000", "fallback": "0x0000000020a107000000000020a107000000000020a107000000000020a107000000000020a107000000000020a107000000000020a1070000000000e0f7050400000000e024370500000000e0f705040000000020a107000000000020a107000000000080f0fa020000000000e1f50500000000040000000000010010000000004000000020000000",
"documentation": [ "documentation": [
" Current cost schedule for contracts." " Current cost schedule for contracts."
] ]
@@ -6629,17 +6741,6 @@
"documentation": [ "documentation": [
" The code associated with a given account." " The code associated with a given account."
] ]
},
{
"name": "GasPrice",
"modifier": "Default",
"type": {
"Plain": "BalanceOf"
},
"fallback": "0x01000000000000000000000000000000",
"documentation": [
" The price of one unit of gas."
]
} }
] ]
}, },
@@ -6661,10 +6762,6 @@
{ {
"name": "put_code", "name": "put_code",
"args": [ "args": [
{
"name": "gas_limit",
"type": "Compact<Gas>"
},
{ {
"name": "code", "name": "code",
"type": "Bytes" "type": "Bytes"
@@ -6917,49 +7014,6 @@
" to removal of a contract." " to removal of a contract."
] ]
}, },
{
"name": "TransactionBaseFee",
"type": "BalanceOf",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The fee to be paid for making a transaction; the base."
]
},
{
"name": "TransactionByteFee",
"type": "BalanceOf",
"value": "0x00e40b54020000000000000000000000",
"documentation": [
" The fee to be paid for making a transaction; the per-byte portion."
]
},
{
"name": "ContractFee",
"type": "BalanceOf",
"value": "0x0010a5d4e80000000000000000000000",
"documentation": [
" The fee required to instantiate a contract instance. A reasonable default value",
" is 21."
]
},
{
"name": "CallBaseFee",
"type": "Gas",
"value": "0xe803000000000000",
"documentation": [
" The base fee charged for calling into a contract. A reasonable default",
" value is 135."
]
},
{
"name": "InstantiateBaseFee",
"type": "Gas",
"value": "0xe803000000000000",
"documentation": [
" The base fee charged for instantiating a contract. A reasonable default value",
" is 175."
]
},
{ {
"name": "MaxDepth", "name": "MaxDepth",
"type": "u32", "type": "u32",
@@ -6976,15 +7030,6 @@
"documentation": [ "documentation": [
" The maximum size of a storage value in bytes. A reasonable default is 16 KiB." " The maximum size of a storage value in bytes. A reasonable default is 16 KiB."
] ]
},
{
"name": "BlockGasLimit",
"type": "Gas",
"value": "0x8096980000000000",
"documentation": [
" The maximum amount of gas that could be expended per block. A reasonable",
" default value is 10_000_000."
]
} }
], ],
"errors": [ "errors": [
@@ -7497,9 +7542,12 @@
" Emits `RegistrarAdded` if successful.", " Emits `RegistrarAdded` if successful.",
"", "",
" # <weight>", " # <weight>",
" - `O(R)` where `R` registrar-count (governance-bounded).", " - `O(R)` where `R` registrar-count (governance-bounded and code-bounded).",
" - One storage mutation (codec `O(R)`).", " - One storage mutation (codec `O(R)`).",
" - One event.", " - One event.",
" - Benchmarks:",
" - 78.71 + R * 0.965 µs (min squares analysis)",
" - 94.28 + R * 0.991 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7517,18 +7565,22 @@
" If the account already has identity information, the deposit is taken as part payment", " If the account already has identity information, the deposit is taken as part payment",
" for the new deposit.", " for the new deposit.",
"", "",
" The dispatch origin for this call must be _Signed_ and the sender must have a registered", " The dispatch origin for this call must be _Signed_.",
" identity.",
"", "",
" - `info`: The identity information.", " - `info`: The identity information.",
"", "",
" Emits `IdentitySet` if successful.", " Emits `IdentitySet` if successful.",
"", "",
" # <weight>", " # <weight>",
" - `O(X + X' + R)` where `X` additional-field-count (deposit-bounded and code-bounded).", " - `O(X + X' + R)`",
" - At most two balance operations.", " - where `X` additional-field-count (deposit-bounded and code-bounded)",
" - where `R` judgements-count (registrar-count-bounded)",
" - One balance reserve operation.",
" - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).", " - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).",
" - One event.", " - One event.",
" - Benchmarks:",
" - 136.6 + R * 0.62 + X * 2.62 µs (min squares analysis)",
" - 146.2 + R * 0.372 + X * 2.98 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7549,13 +7601,21 @@
" The dispatch origin for this call must be _Signed_ and the sender must have a registered", " The dispatch origin for this call must be _Signed_ and the sender must have a registered",
" identity.", " identity.",
"", "",
" - `subs`: The identity's sub-accounts.", " - `subs`: The identity's (new) sub-accounts.",
"", "",
" # <weight>", " # <weight>",
" - `O(S)` where `S` subs-count (hard- and deposit-bounded).", " - `O(P + S)`",
" - At most two balance operations.", " - where `P` old-subs-count (hard- and deposit-bounded).",
" - At most O(2 * S + 1) storage mutations; codec complexity `O(1 * S + S * 1)`);", " - where `S` subs-count (hard- and deposit-bounded).",
" one storage-exists.", " - At most one balance operations.",
" - DB:",
" - `P + S` storage mutations (codec complexity `O(1)`)",
" - One storage read (codec complexity `O(P)`).",
" - One storage write (codec complexity `O(S)`).",
" - One storage-exists (`IdentityOf::contains_key`).",
" - Benchmarks:",
" - 115.2 + P * 5.11 + S * 6.67 µs (min squares analysis)",
" - 121 + P * 4.852 + S * 7.111 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7563,7 +7623,7 @@
"name": "clear_identity", "name": "clear_identity",
"args": [], "args": [],
"documentation": [ "documentation": [
" Clear an account's identity info and all sub-account and return all deposits.", " Clear an account's identity info and all sub-accounts and return all deposits.",
"", "",
" Payment: All reserved balances on the account are returned.", " Payment: All reserved balances on the account are returned.",
"", "",
@@ -7573,10 +7633,16 @@
" Emits `IdentityCleared` if successful.", " Emits `IdentityCleared` if successful.",
"", "",
" # <weight>", " # <weight>",
" - `O(R + S + X)`.", " - `O(R + S + X)`",
" - One balance-reserve operation.", " - where `R` registrar-count (governance-bounded).",
" - `S + 2` storage deletions.", " - where `S` subs-count (hard- and deposit-bounded).",
" - where `X` additional-field-count (deposit-bounded and code-bounded).",
" - One balance-unreserve operation.",
" - `2` storage reads and `S + 2` storage deletions.",
" - One event.", " - One event.",
" - Benchmarks:",
" - 152.3 + R * 0.306 + S * 4.967 + X * 1.697 µs (min squares analysis)",
" - 139.5 + R * 0.466 + S * 5.304 + X * 1.895 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7605,7 +7671,7 @@
" - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as:", " - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as:",
"", "",
" ```nocompile", " ```nocompile",
" Self::registrars(reg_index).unwrap().fee", " Self::registrars().get(reg_index).unwrap().fee",
" ```", " ```",
"", "",
" Emits `JudgementRequested` if successful.", " Emits `JudgementRequested` if successful.",
@@ -7615,6 +7681,9 @@
" - One balance-reserve operation.", " - One balance-reserve operation.",
" - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`.", " - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`.",
" - One event.", " - One event.",
" - Benchmarks:",
" - 154 + R * 0.932 + X * 3.302 µs (min squares analysis)",
" - 172.9 + R * 0.69 + X * 3.304 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7643,6 +7712,9 @@
" - One balance-reserve operation.", " - One balance-reserve operation.",
" - One storage mutation `O(R + X)`.", " - One storage mutation `O(R + X)`.",
" - One event.", " - One event.",
" - Benchmarks:",
" - 135.3 + R * 0.574 + X * 3.394 µs (min squares analysis)",
" - 144.3 + R * 0.316 + X * 3.53 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7670,6 +7742,8 @@
" # <weight>", " # <weight>",
" - `O(R)`.", " - `O(R)`.",
" - One storage mutation `O(R)`.", " - One storage mutation `O(R)`.",
" - Benchmarks:",
" - 23.81 + R * 0.774 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7697,6 +7771,7 @@
" # <weight>", " # <weight>",
" - `O(R)`.", " - `O(R)`.",
" - One storage mutation `O(R)`.", " - One storage mutation `O(R)`.",
" - Benchmark: 24.59 + R * 0.832 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7724,6 +7799,7 @@
" # <weight>", " # <weight>",
" - `O(R)`.", " - `O(R)`.",
" - One storage mutation `O(R)`.", " - One storage mutation `O(R)`.",
" - Benchmark: 22.85 + R * 0.853 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7762,6 +7838,7 @@
" - Up to one account-lookup operation.", " - Up to one account-lookup operation.",
" - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`.", " - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`.",
" - One event.", " - One event.",
" - Benchmark: 110.7 + R * 1.066 + X * 3.402 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
}, },
@@ -7792,6 +7869,7 @@
" - One balance-reserve operation.", " - One balance-reserve operation.",
" - `S + 2` storage mutations.", " - `S + 2` storage mutations.",
" - One event.", " - One event.",
" - Benchmark: 167.4 + R * 1.107 + S * 5.343 + X * 2.294 µs (min squares analysis)",
" # </weight>" " # </weight>"
] ]
} }
@@ -7866,7 +7944,60 @@
] ]
} }
], ],
"constants": [], "constants": [
{
"name": "BasicDeposit",
"type": "BalanceOf",
"value": "0x0080c6a47e8d03000000000000000000",
"documentation": [
" The amount held on deposit for a registered identity."
]
},
{
"name": "FieldDeposit",
"type": "BalanceOf",
"value": "0x00a031a95fe300000000000000000000",
"documentation": [
" The amount held on deposit per additional field for a registered identity."
]
},
{
"name": "SubAccountDeposit",
"type": "BalanceOf",
"value": "0x0080f420e6b500000000000000000000",
"documentation": [
" The amount held on deposit for a registered subaccount. This should account for the fact",
" that one storage item's value will increase by the size of an account ID, and there will be",
" another trie item whose value is the size of an account ID plus 32 bytes."
]
},
{
"name": "MaxSubAccounts",
"type": "u32",
"value": "0x64000000",
"documentation": [
" The maximum number of sub-accounts allowed per identified account."
]
},
{
"name": "MaxAdditionalFields",
"type": "u32",
"value": "0x64000000",
"documentation": [
" Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O",
" required to access an identity, but can be pretty high."
]
},
{
"name": "MaxRegistrars",
"type": "u32",
"value": "0x14000000",
"documentation": [
" Maxmimum number of registrars allowed in the system. Needed to bound the complexity",
" of, e.g., updating judgements."
]
}
],
"errors": [ "errors": [
{ {
"name": "TooManySubAccounts", "name": "TooManySubAccounts",
@@ -7939,6 +8070,12 @@
"documentation": [ "documentation": [
" Too many additional fields." " Too many additional fields."
] ]
},
{
"name": "TooManyRegistrars",
"documentation": [
" Maximum amount of registrars reached. Cannot add any more."
]
} }
] ]
}, },
@@ -8793,6 +8930,14 @@
"documentation": [ "documentation": [
" The number of blocks between membership challenges." " The number of blocks between membership challenges."
] ]
},
{
"name": "ModuleId",
"type": "ModuleId",
"value": "0x70792f736f636965",
"documentation": [
" The societies's module id"
]
} }
], ],
"errors": [ "errors": [
@@ -9639,8 +9784,7 @@
"CheckEra", "CheckEra",
"CheckNonce", "CheckNonce",
"CheckWeight", "CheckWeight",
"ChargeTransactionPayment", "ChargeTransactionPayment"
"CheckBlockGasLimit"
] ]
} }
} }
File diff suppressed because one or more lines are too long
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/rpc-core", "name": "@polkadot/rpc-core",
"version": "1.11.1", "version": "1.12.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
@@ -27,14 +27,14 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/metadata": "1.11.1", "@polkadot/metadata": "1.12.1",
"@polkadot/rpc-provider": "1.11.1", "@polkadot/rpc-provider": "1.12.1",
"@polkadot/types": "1.11.1", "@polkadot/types": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"memoizee": "^0.4.14", "memoizee": "^0.4.14",
"rxjs": "^6.5.5" "rxjs": "^6.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^2.8.1" "@polkadot/keyring": "^2.9.0-beta.3"
} }
} }
+23 -8
View File
@@ -336,7 +336,11 @@ export default class Rpc implements RpcInterface {
throw error; throw error;
} }
} else if (rpc.type === 'StorageChangeSet') { } else if (rpc.type === 'StorageChangeSet') {
return this._formatStorageSet(params[0] as Vec<StorageKey>, result.changes); const keys = params[0] as Vec<StorageKey>;
return keys
? this._formatStorageSet(keys, result.changes)
: this.registry.createType('StorageChangeSet', result);
} else if (rpc.type === 'Vec<StorageChangeSet>') { } else if (rpc.type === 'Vec<StorageChangeSet>') {
const mapped = result.map(({ block, changes }: { block: string; changes: [string, string | null][] }): [Hash, Codec[]] => [ const mapped = result.map(({ block, changes }: { block: string; changes: [string, string | null][] }): [Hash, Codec[]] => [
this.registry.createType('Hash', block), this.registry.createType('Hash', block),
@@ -432,13 +436,24 @@ export default class Rpc implements RpcInterface {
this.#storageCache.set(hexKey, value); this.#storageCache.set(hexKey, value);
if (meta.modifier.isOptional) { if (meta.modifier.isOptional) {
return new Option( try {
this.registry, return new Option(
createClass(this.registry, type), this.registry,
isEmpty createClass(this.registry, type),
? null isEmpty
: createTypeUnsafe(this.registry, type, [input], true) ? null
); : createTypeUnsafe(this.registry, type, [input], true)
);
} catch (error) {
if (type === 'PreimageStatus') {
return new Option(
this.registry,
createClass(this.registry, type)
);
}
throw error;
}
} }
return createTypeUnsafe(this.registry, type, [ return createTypeUnsafe(this.registry, type, [
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/rpc-provider", "name": "@polkadot/rpc-provider",
"version": "1.11.1", "version": "1.12.1",
"description": "Transport providers for the API", "description": "Transport providers for the API",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
@@ -27,17 +27,17 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/metadata": "1.11.1", "@polkadot/metadata": "1.12.1",
"@polkadot/types": "1.11.1", "@polkadot/types": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.3",
"bn.js": "^5.1.1", "bn.js": "^5.1.1",
"eventemitter3": "^4.0.0", "eventemitter3": "^4.0.0",
"isomorphic-fetch": "^2.2.1", "isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31" "websocket": "^1.0.31"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^2.8.1", "@polkadot/keyring": "^2.9.0-beta.3",
"mock-socket": "^9.0.3", "mock-socket": "^9.0.3",
"nock": "^12.0.3" "nock": "^12.0.3"
} }
+8 -8
View File
@@ -75,7 +75,7 @@ export default class WsProvider implements WSProviderInterface {
readonly #waitingForId: Record<string, JsonRpcResponse> = {}; readonly #waitingForId: Record<string, JsonRpcResponse> = {};
#autoConnect: boolean; #autoConnectMs: number;
#isConnected = false; #isConnected = false;
@@ -87,16 +87,16 @@ export default class WsProvider implements WSProviderInterface {
* @param {string} endpoint The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944` * @param {string} endpoint The endpoint url. Usually `ws://ip:9944` or `wss://ip:9944`
* @param {boolean} autoConnect Whether to connect automatically or not. * @param {boolean} autoConnect Whether to connect automatically or not.
*/ */
constructor (endpoint: string = defaults.WS_URL, autoConnect = true) { constructor (endpoint: string = defaults.WS_URL, autoConnectMs: number | false = 1000) {
assert(/^(wss|ws):\/\//.test(endpoint), `Endpoint should start with 'ws://', received '${endpoint}'`); assert(/^(wss|ws):\/\//.test(endpoint), `Endpoint should start with 'ws://', received '${endpoint}'`);
this.#eventemitter = new EventEmitter(); this.#eventemitter = new EventEmitter();
this.#autoConnect = autoConnect; this.#autoConnectMs = autoConnectMs || 0;
this.#coder = new Coder(); this.#coder = new Coder();
this.#endpoint = endpoint; this.#endpoint = endpoint;
this.#websocket = null; this.#websocket = null;
if (autoConnect) { if (autoConnectMs > 0) {
this.connect(); this.connect();
} }
} }
@@ -143,7 +143,7 @@ export default class WsProvider implements WSProviderInterface {
} }
// switch off autoConnect, we are in manual mode now // switch off autoConnect, we are in manual mode now
this.#autoConnect = false; this.#autoConnectMs = 0;
// 1000 - Normal closure; the connection successfully completed // 1000 - Normal closure; the connection successfully completed
this.#websocket.close(1000); this.#websocket.close(1000);
@@ -267,17 +267,17 @@ export default class WsProvider implements WSProviderInterface {
} }
#onSocketClose = (event: CloseEvent): void => { #onSocketClose = (event: CloseEvent): void => {
if (this.#autoConnect) { if (this.#autoConnectMs > 0) {
l.error(`disconnected from ${this.#endpoint} code: '${event.code}' reason: '${event.reason}'`); l.error(`disconnected from ${this.#endpoint} code: '${event.code}' reason: '${event.reason}'`);
} }
this.#isConnected = false; this.#isConnected = false;
this.#emit('disconnected'); this.#emit('disconnected');
if (this.#autoConnect) { if (this.#autoConnectMs > 0) {
setTimeout((): void => { setTimeout((): void => {
this.connect(); this.connect();
}, 1000); }, this.#autoConnectMs);
} }
} }
+3 -3
View File
@@ -20,19 +20,19 @@ describe('onConnect', (): void => {
}); });
it('Does not connect when autoConnect is false', (): void => { it('Does not connect when autoConnect is false', (): void => {
const provider: WsProvider = new WsProvider(TEST_WS_URL, false); const provider: WsProvider = new WsProvider(TEST_WS_URL, 0);
expect(provider.isConnected()).toBe(false); expect(provider.isConnected()).toBe(false);
}); });
it('Does connect when autoConnect is true', (): void => { it('Does connect when autoConnect is true', (): void => {
const provider: WsProvider = new WsProvider(TEST_WS_URL, true); const provider: WsProvider = new WsProvider(TEST_WS_URL, 1000);
expect(provider.isConnected()).not.toBe(true); expect(provider.isConnected()).not.toBe(true);
}); });
it('Creates a new WebSocket instance by calling the connect() method', (): void => { it('Creates a new WebSocket instance by calling the connect() method', (): void => {
const provider: WsProvider = new WsProvider(TEST_WS_URL, false); const provider: WsProvider = new WsProvider(TEST_WS_URL, 0);
expect(provider.isConnected()).toBe(false); expect(provider.isConnected()).toBe(false);
+2 -2
View File
@@ -9,7 +9,7 @@ import { mockWs, TEST_WS_URL } from '../../test/mockWs';
let ws: WsProvider; let ws: WsProvider;
let mock: Mock; let mock: Mock;
function createWs (requests: any[], autoConnect: boolean | undefined): WsProvider { function createWs (requests: any[], autoConnect: number | undefined = 1000): WsProvider {
mock = mockWs(requests); mock = mockWs(requests);
ws = new WsProvider(TEST_WS_URL, autoConnect); ws = new WsProvider(TEST_WS_URL, autoConnect);
@@ -25,7 +25,7 @@ describe('Ws', (): void => {
it('returns the connected state', (): void => { it('returns the connected state', (): void => {
expect( expect(
createWs([], true).isConnected() createWs([]).isConnected()
).toEqual(false); ).toEqual(false);
}); });
}); });
+2 -2
View File
@@ -9,7 +9,7 @@ import { mockWs, TEST_WS_URL } from '../../test/mockWs';
let ws: WsProvider; let ws: WsProvider;
let mock: Mock; let mock: Mock;
function createWs (requests: any[], autoConnect: boolean | undefined): WsProvider { function createWs (requests: any[], autoConnect: number | undefined = 1000): WsProvider {
mock = mockWs(requests); mock = mockWs(requests);
ws = new WsProvider(TEST_WS_URL, autoConnect); ws = new WsProvider(TEST_WS_URL, autoConnect);
@@ -30,7 +30,7 @@ describe('onOpen', (): void => {
reply: { reply: {
result: 'ok' result: 'ok'
} }
}], false); }], 0);
const sendPromise = ws.send('test_queue', []); const sendPromise = ws.send('test_queue', []);
ws.connect(); ws.connect();
+5 -5
View File
@@ -17,7 +17,7 @@ function createMock (requests: any[]): void {
mock = mockWs(requests); mock = mockWs(requests);
} }
function createWs (autoConnect = true): WsProvider { function createWs (autoConnect = 1000): WsProvider {
provider = new WsProvider(TEST_WS_URL, autoConnect); provider = new WsProvider(TEST_WS_URL, autoConnect);
return provider; return provider;
@@ -47,7 +47,7 @@ describe('send', (): void => {
} }
}]); }]);
return createWs(true) return createWs()
.send('test_encoding', [{ error: 'send error' }]) .send('test_encoding', [{ error: 'send error' }])
.catch((error): void => { .catch((error): void => {
expect(error.message).toEqual('send error'); expect(error.message).toEqual('send error');
@@ -63,7 +63,7 @@ describe('send', (): void => {
} }
}]); }]);
return createWs(true) return createWs()
.send('test_body', ['param']) .send('test_body', ['param'])
.then((): void => { .then((): void => {
expect( expect(
@@ -81,7 +81,7 @@ describe('send', (): void => {
id: 1 id: 1
}]); }]);
return createWs(true) return createWs()
.send('test_error', []) .send('test_error', [])
.catch((error): void => { .catch((error): void => {
expect(error.message).toMatch(/666: error/); expect(error.message).toMatch(/666: error/);
@@ -97,7 +97,7 @@ describe('send', (): void => {
} }
}]); }]);
return createWs(true) return createWs()
.send('test_sub', []) .send('test_sub', [])
.then((id): void => { .then((id): void => {
expect(id).toEqual(1); expect(id).toEqual(1);
+2 -2
View File
@@ -7,13 +7,13 @@ import WsProvider from './';
describe('state', (): void => { describe('state', (): void => {
it('requires an ws:// prefixed endpoint', (): void => { it('requires an ws:// prefixed endpoint', (): void => {
expect( expect(
(): WsProvider => new WsProvider('http://', false) (): WsProvider => new WsProvider('http://', 0)
).toThrow(/with 'ws/); ).toThrow(/with 'ws/);
}); });
it('allows wss:// endpoints', (): void => { it('allows wss:// endpoints', (): void => {
expect( expect(
(): WsProvider => new WsProvider('wss://', false) (): WsProvider => new WsProvider('wss://', 0)
).not.toThrow(); ).not.toThrow();
}); });
}); });
@@ -17,7 +17,7 @@ function createMock (requests: any[]): void {
mock = mockWs(requests); mock = mockWs(requests);
} }
function createWs (autoConnect = true): WsProvider { function createWs (autoConnect = 1000): WsProvider {
ws = new WsProvider(TEST_WS_URL, autoConnect); ws = new WsProvider(TEST_WS_URL, autoConnect);
return ws; return ws;
@@ -47,7 +47,7 @@ describe('subscribe', (): void => {
} }
}]); }]);
return createWs(true) return createWs()
.subscribe('type', 'test_sub', [], (cb): void => { .subscribe('type', 'test_sub', [], (cb): void => {
expect(cb).toEqual(expect.anything()); expect(cb).toEqual(expect.anything());
}) })
@@ -17,7 +17,7 @@ function createMock (requests: any): void {
mock = mockWs(requests); mock = mockWs(requests);
} }
function createWs (autoConnect = true): WsProvider { function createWs (autoConnect = 1000): WsProvider {
ws = new WsProvider(TEST_WS_URL, autoConnect); ws = new WsProvider(TEST_WS_URL, autoConnect);
return ws; return ws;
@@ -56,7 +56,7 @@ describe('subscribe', (): void => {
} }
]); ]);
const ws = createWs(true); const ws = createWs();
return ws return ws
.subscribe('test', 'subscribe_test', [], (cb): void => { .subscribe('test', 'subscribe_test', [], (cb): void => {
@@ -76,7 +76,7 @@ describe('subscribe', (): void => {
} }
}]); }]);
const ws = createWs(true); const ws = createWs();
return ws return ws
.subscribe('test', 'subscribe_test', [], (cb): void => { .subscribe('test', 'subscribe_test', [], (cb): void => {
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/typegen", "name": "@polkadot/typegen",
"version": "1.11.1", "version": "1.12.1",
"description": "Type generation scripts", "description": "Type generation scripts",
"main": "index.js", "main": "index.js",
"bin": { "bin": {
@@ -36,11 +36,11 @@
"@babel/core": "^7.9.0", "@babel/core": "^7.9.0",
"@babel/register": "^7.9.0", "@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/api": "1.11.1", "@polkadot/api": "1.12.1",
"@polkadot/metadata": "1.11.1", "@polkadot/metadata": "1.12.1",
"@polkadot/rpc-provider": "1.11.1", "@polkadot/rpc-provider": "1.12.1",
"@polkadot/types": "1.11.1", "@polkadot/types": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"websocket": "^1.0.31", "websocket": "^1.0.31",
"yargs": "^15.3.1" "yargs": "^15.3.1"
}, },
@@ -20,6 +20,7 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
const imports = createImports(importDefinitions); const imports = createImports(importDefinitions);
const definitions = imports.definitions; const definitions = imports.definitions;
const primitives = Object const primitives = Object
.keys(primitiveClasses) .keys(primitiveClasses)
.filter((name): boolean => !!name.indexOf('Generic')) .filter((name): boolean => !!name.indexOf('Generic'))
@@ -32,13 +33,19 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
].join('\n'); ].join('\n');
}, ''); }, '');
const existingTypes: Record<string, boolean> = {};
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const srml = Object.entries(definitions).reduce((accumulator, [_defName, { types }]): string => { const srml = Object.entries(definitions).reduce((accumulator, [_defName, { types }]): string => {
setImports(definitions, imports, Object.keys(types)); setImports(definitions, imports, Object.keys(types));
const uniqueTypes = Object.keys(types).filter((type) => !existingTypes[type]);
uniqueTypes.forEach((type) => { existingTypes[type] = true; });
return [ return [
accumulator, accumulator,
...Object.keys(types).map((type): string => ...uniqueTypes.map((type): string =>
getDerivedTypes(definitions, type, types[type], imports).map(indent(4)).join('\n') getDerivedTypes(definitions, type, types[type], imports).map(indent(4)).join('\n')
) )
].join('\n'); ].join('\n');
+1 -1
View File
@@ -37,7 +37,7 @@ export default function generateRpcTypes (dest = 'packages/api/src/augment/rpc.t
} else if (methodName === 'queryStorageAt') { } else if (methodName === 'queryStorageAt') {
return createDocComments(6, [def.description]) + indent(6)(`queryStorageAt: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (${StorageKeyTye})[], at?: Hash | Uint8Array | string) => Observable<T>>;`); return createDocComments(6, [def.description]) + indent(6)(`queryStorageAt: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (${StorageKeyTye})[], at?: Hash | Uint8Array | string) => Observable<T>>;`);
} else if (methodName === 'subscribeStorage') { } else if (methodName === 'subscribeStorage') {
return createDocComments(6, [def.description]) + indent(6)(`subscribeStorage: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (${StorageKeyTye})[]) => Observable<T>>;`); return createDocComments(6, [def.description]) + indent(6)(`subscribeStorage: AugmentedRpc<<T = Codec[]>(keys?: Vec<StorageKey> | (${StorageKeyTye})[]) => Observable<T>>;`);
} }
} }
+1 -1
View File
@@ -27,7 +27,7 @@ import { formatType } from './formatting';
import { setImports, TypeImports } from './imports'; import { setImports, TypeImports } from './imports';
function arrayToStrType (arr: string[]): string { function arrayToStrType (arr: string[]): string {
return `(${arr.map((c): string => `'${c}'`).join(' | ')})`; return `${arr.map((c): string => `'${c}'`).join(' | ')}`;
} }
const voteConvictions = arrayToStrType(AllConvictions); const voteConvictions = arrayToStrType(AllConvictions);
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/types-known", "name": "@polkadot/types-known",
"version": "1.11.1", "version": "1.12.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
@@ -27,8 +27,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/types": "1.11.1", "@polkadot/types": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"bn.js": "^5.1.1" "bn.js": "^5.1.1"
}, },
"devDependencies": { "devDependencies": {
+5 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/types", "name": "@polkadot/types",
"version": "1.11.1", "version": "1.12.1",
"description": "Implementation of the Parity codec", "description": "Implementation of the Parity codec",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
@@ -27,16 +27,16 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/metadata": "1.11.1", "@polkadot/metadata": "1.12.1",
"@polkadot/util": "^2.8.1", "@polkadot/util": "^2.9.0-beta.3",
"@polkadot/util-crypto": "^2.8.1", "@polkadot/util-crypto": "^2.9.0-beta.3",
"@types/bn.js": "^4.11.6", "@types/bn.js": "^4.11.6",
"bn.js": "^5.1.1", "bn.js": "^5.1.1",
"memoizee": "^0.4.14", "memoizee": "^0.4.14",
"rxjs": "^6.5.5" "rxjs": "^6.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^2.8.1", "@polkadot/keyring": "^2.9.0-beta.3",
"@types/memoizee": "^0.4.3" "@types/memoizee": "^0.4.3"
} }
} }
+26 -3
View File
@@ -27,15 +27,15 @@ import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetwor
import { CallMetadataV0, DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV11, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapTypeLatest, MapTypeV0, MapTypeV10, MapTypeV11, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV11, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV11, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV4, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataLatest, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata'; import { CallMetadataV0, DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV11, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapTypeLatest, MapTypeV0, MapTypeV10, MapTypeV11, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV11, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV11, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV4, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataLatest, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import { StorageKind } from '@polkadot/types/interfaces/offchain'; import { StorageKind } from '@polkadot/types/interfaces/offchain';
import { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences'; import { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
import { AttestedCandidate, AuctionIndex, Bidder, CandidateReceipt, CollatorId, CollatorSignature, DoubleVoteReport, DoubleVoteReportProof, DoubleVoteReportStatement, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaScheduling, ParachainDispatchOrigin, Retriable, SigningContext, SlotRange, Statement, SubId, UpwardMessage, ValidatorSignature, ValidityAttestation, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains'; import { AttestedCandidate, AuctionIndex, Bidder, CandidateReceipt, CollatorId, CollatorSignature, DoubleVoteReport, DoubleVoteReportProof, DoubleVoteReportStatement, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParachainDispatchOrigin, Retriable, SigningContext, SlotRange, Statement, SubId, UpwardMessage, ValidationCode, ValidatorSignature, ValidityAttestation, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment'; import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery'; import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { RpcMethods } from '@polkadot/types/interfaces/rpc'; import { RpcMethods } from '@polkadot/types/interfaces/rpc';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, Moment, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, SignedBlock, StorageData, 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, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler'; import { SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6 } from '@polkadot/types/interfaces/session'; import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6 } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society'; import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking'; import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, OffchainAccuracy, PerU16, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state'; import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { AccountInfo, ChainProperties, ChainType, DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount } from '@polkadot/types/interfaces/system'; import { AccountInfo, ChainProperties, ChainType, DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount } from '@polkadot/types/interfaces/system';
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury'; import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
@@ -223,6 +223,9 @@ declare module '@polkadot/types/types/registry' {
LookupTarget: LookupTarget; LookupTarget: LookupTarget;
'Option<LookupTarget>': Option<LookupTarget>; 'Option<LookupTarget>': Option<LookupTarget>;
'Vec<LookupTarget>': Vec<LookupTarget>; 'Vec<LookupTarget>': Vec<LookupTarget>;
ModuleId: ModuleId;
'Option<ModuleId>': Option<ModuleId>;
'Vec<ModuleId>': Vec<ModuleId>;
Moment: Moment; Moment: Moment;
'Compact<Moment>': Compact<Moment>; 'Compact<Moment>': Compact<Moment>;
'Option<Moment>': Option<Moment>; 'Option<Moment>': Option<Moment>;
@@ -252,6 +255,9 @@ declare module '@polkadot/types/types/registry' {
PhantomData: PhantomData; PhantomData: PhantomData;
'Option<PhantomData>': Option<PhantomData>; 'Option<PhantomData>': Option<PhantomData>;
'Vec<PhantomData>': Vec<PhantomData>; 'Vec<PhantomData>': Vec<PhantomData>;
RuntimeDbWeight: RuntimeDbWeight;
'Option<RuntimeDbWeight>': Option<RuntimeDbWeight>;
'Vec<RuntimeDbWeight>': Vec<RuntimeDbWeight>;
SignedBlock: SignedBlock; SignedBlock: SignedBlock;
'Option<SignedBlock>': Option<SignedBlock>; 'Option<SignedBlock>': Option<SignedBlock>;
'Vec<SignedBlock>': Vec<SignedBlock>; 'Vec<SignedBlock>': Vec<SignedBlock>;
@@ -830,6 +836,17 @@ declare module '@polkadot/types/types/registry' {
Nominations: Nominations; Nominations: Nominations;
'Option<Nominations>': Option<Nominations>; 'Option<Nominations>': Option<Nominations>;
'Vec<Nominations>': Vec<Nominations>; 'Vec<Nominations>': Vec<Nominations>;
NominatorIndex: NominatorIndex;
'Compact<NominatorIndex>': Compact<NominatorIndex>;
'Option<NominatorIndex>': Option<NominatorIndex>;
'Vec<NominatorIndex>': Vec<NominatorIndex>;
OffchainAccuracy: OffchainAccuracy;
'Option<OffchainAccuracy>': Option<OffchainAccuracy>;
'Vec<OffchainAccuracy>': Vec<OffchainAccuracy>;
PerU16: PerU16;
'Compact<PerU16>': Compact<PerU16>;
'Option<PerU16>': Option<PerU16>;
'Vec<PerU16>': Vec<PerU16>;
PhragmenScore: PhragmenScore; PhragmenScore: PhragmenScore;
'Option<PhragmenScore>': Option<PhragmenScore>; 'Option<PhragmenScore>': Option<PhragmenScore>;
'Vec<PhragmenScore>': Vec<PhragmenScore>; 'Vec<PhragmenScore>': Vec<PhragmenScore>;
@@ -1083,6 +1100,9 @@ declare module '@polkadot/types/types/registry' {
ParaInfo: ParaInfo; ParaInfo: ParaInfo;
'Option<ParaInfo>': Option<ParaInfo>; 'Option<ParaInfo>': Option<ParaInfo>;
'Vec<ParaInfo>': Vec<ParaInfo>; 'Vec<ParaInfo>': Vec<ParaInfo>;
ParaPastCodeMeta: ParaPastCodeMeta;
'Option<ParaPastCodeMeta>': Option<ParaPastCodeMeta>;
'Vec<ParaPastCodeMeta>': Vec<ParaPastCodeMeta>;
ParachainDispatchOrigin: ParachainDispatchOrigin; ParachainDispatchOrigin: ParachainDispatchOrigin;
'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>; 'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>;
'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>; 'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>;
@@ -1108,6 +1128,9 @@ declare module '@polkadot/types/types/registry' {
UpwardMessage: UpwardMessage; UpwardMessage: UpwardMessage;
'Option<UpwardMessage>': Option<UpwardMessage>; 'Option<UpwardMessage>': Option<UpwardMessage>;
'Vec<UpwardMessage>': Vec<UpwardMessage>; 'Vec<UpwardMessage>': Vec<UpwardMessage>;
ValidationCode: ValidationCode;
'Option<ValidationCode>': Option<ValidationCode>;
'Vec<ValidationCode>': Vec<ValidationCode>;
ValidityAttestation: ValidityAttestation; ValidityAttestation: ValidityAttestation;
'Option<ValidityAttestation>': Option<ValidityAttestation>; 'Option<ValidityAttestation>': Option<ValidityAttestation>;
'Vec<ValidityAttestation>': Vec<ValidityAttestation>; 'Vec<ValidityAttestation>': Vec<ValidityAttestation>;
+1 -1
View File
@@ -319,7 +319,7 @@ export class TypeRegistry implements Registry {
const unknown = findUnknownExtensions(this.#metadataExtensions); const unknown = findUnknownExtensions(this.#metadataExtensions);
if (unknown.length) { if (unknown.length) {
console.warn(`Unknown signed extensions [${unknown.join(', ')}] found, treating them as no-efect`); console.warn(`Unknown signed extensions ${unknown.join(', ')} found, treating them as no-efect`);
} }
} }
} }
@@ -76,6 +76,10 @@ export default {
ParaInfo: { ParaInfo: {
scheduling: 'ParaScheduling' scheduling: 'ParaScheduling'
}, },
ParaPastCodeMeta: {
upgradeTimes: 'Vec<BlockNumber>',
lastPruned: 'Option<BlockNumber>'
},
ParachainDispatchOrigin: { ParachainDispatchOrigin: {
_enum: ['Signed', 'Parachain'] _enum: ['Signed', 'Parachain']
}, },
@@ -120,6 +124,7 @@ export default {
origin: 'ParachainDispatchOrigin', origin: 'ParachainDispatchOrigin',
data: 'Bytes' data: 'Bytes'
}, },
ValidationCode: 'Bytes',
ValidityAttestation: { ValidityAttestation: {
_enum: { _enum: {
// This Null is not in the original, however indexes start at 1 // This Null is not in the original, however indexes start at 1
@@ -2,7 +2,7 @@
/* eslint-disable */ /* eslint-disable */
import { ITuple } from '@polkadot/types/types'; import { ITuple } from '@polkadot/types/types';
import { Enum, Struct, Vec } from '@polkadot/types/codec'; import { Enum, Option, Struct, Vec } from '@polkadot/types/codec';
import { BitVec, Bytes, u32 } from '@polkadot/types/primitive'; import { BitVec, Bytes, u32 } from '@polkadot/types/primitive';
import { Signature } from '@polkadot/types/interfaces/extrinsics'; import { Signature } from '@polkadot/types/interfaces/extrinsics';
import { AccountId, Balance, BalanceOf, BlockNumber, H256, Hash, ValidatorId } from '@polkadot/types/interfaces/runtime'; import { AccountId, Balance, BalanceOf, BlockNumber, H256, Hash, ValidatorId } from '@polkadot/types/interfaces/runtime';
@@ -120,6 +120,12 @@ export interface ParaInfo extends Struct {
readonly scheduling: ParaScheduling; readonly scheduling: ParaScheduling;
} }
/** @name ParaPastCodeMeta */
export interface ParaPastCodeMeta extends Struct {
readonly upgradeTimes: Vec<BlockNumber>;
readonly lastPruned: Option<BlockNumber>;
}
/** @name ParaScheduling */ /** @name ParaScheduling */
export interface ParaScheduling extends Enum { export interface ParaScheduling extends Enum {
readonly isAlways: boolean; readonly isAlways: boolean;
@@ -173,6 +179,9 @@ export interface UpwardMessage extends Struct {
readonly data: Bytes; readonly data: Bytes;
} }
/** @name ValidationCode */
export interface ValidationCode extends Bytes {}
/** @name ValidatorSignature */ /** @name ValidatorSignature */
export interface ValidatorSignature extends Signature {} export interface ValidatorSignature extends Signature {}
@@ -71,6 +71,7 @@ export default {
LockIdentifier: '[u8; 8]', LockIdentifier: '[u8; 8]',
LookupSource: 'Address', LookupSource: 'Address',
LookupTarget: 'AccountId', LookupTarget: 'AccountId',
ModuleId: 'LockIdentifier',
Moment: 'u64', Moment: 'u64',
Origin: 'DoNotConstruct<Origin>', Origin: 'DoNotConstruct<Origin>',
Perbill: 'u32', Perbill: 'u32',
@@ -79,6 +80,10 @@ export default {
Perquintill: 'u64', Perquintill: 'u64',
Phantom: 'Null', Phantom: 'Null',
PhantomData: 'Null', PhantomData: 'Null',
RuntimeDbWeight: {
read: 'Weight',
write: 'Weight'
},
SignedBlock: { SignedBlock: {
block: 'Block', block: 'Block',
justification: 'Justification' justification: 'Justification'
@@ -141,6 +141,9 @@ export interface LookupSource extends Address {}
/** @name LookupTarget */ /** @name LookupTarget */
export interface LookupTarget extends AccountId {} export interface LookupTarget extends AccountId {}
/** @name ModuleId */
export interface ModuleId extends LockIdentifier {}
/** @name Moment */ /** @name Moment */
export interface Moment extends u64 {} export interface Moment extends u64 {}
@@ -168,6 +171,12 @@ export interface PhantomData extends Null {}
/** @name PreRuntime */ /** @name PreRuntime */
export interface PreRuntime extends ITuple<[ConsensusEngineId, Bytes]> {} export interface PreRuntime extends ITuple<[ConsensusEngineId, Bytes]> {}
/** @name RuntimeDbWeight */
export interface RuntimeDbWeight extends Struct {
readonly read: Weight;
readonly write: Weight;
}
/** @name Seal */ /** @name Seal */
export interface Seal extends ITuple<[ConsensusEngineId, Bytes]> {} export interface Seal extends ITuple<[ConsensusEngineId, Bytes]> {}
@@ -6,27 +6,27 @@ import { TypeRegistry, createTypeUnsafe } from '../../create';
describe('CompactAssignments', (): void => { describe('CompactAssignments', (): void => {
const registry = new TypeRegistry(); const registry = new TypeRegistry();
const votes2 = [['5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', [['5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y', 123456]], '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty']]; const votes2 = [[1, [[2, 12345]], 3]];
const test = registry.createType('CompactAssignments', { const test = registry.createType('CompactAssignments', {
votes1: [['5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', [], '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty']], votes1: [[1, [], 3]],
votes2 votes2
}); });
it('has a valid vote1 ([Type; <number>] equivalency)', (): void => { it('has a valid vote1 ([Type; <number>] equivalency)', (): void => {
expect(test.votes1.toHex()).toEqual( expect(test.votes1.toHex()).toEqual(
createTypeUnsafe(registry, 'Vec<(AccountId, AccountId)>', [[ createTypeUnsafe(registry, 'Vec<(u16, u32)>', [[
['5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'] [1, 3]
]]).toHex() ]]).toHex()
); );
}); });
it('hash valid vot2 (actual tuple values)', (): void => { it('hash valid vot2 (actual tuple values)', (): void => {
expect(test.votes2.toHex()).toEqual( expect(test.votes2.toHex()).toEqual(
createTypeUnsafe(registry, 'Vec<(AccountId, [(AccountId, u128); 1], AccountId)>', [votes2]).toHex() createTypeUnsafe(registry, 'Vec<(u16, [(u16, u16); 1], u32)>', [votes2]).toHex()
); );
}); });
it('has a proper decoded toHuman() available', (): void => { it('has a proper decoded toHuman() available', (): void => {
expect(test.votes2.toHuman()).toEqual([['5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', [['5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y', '123,456']], '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty']]); expect(test.votes2.toHuman()).toEqual([['1', [['2', '12,345']], '3']]);
}); });
}); });
@@ -24,24 +24,24 @@ export default {
start: 'Option<Moment>' start: 'Option<Moment>'
}, },
CompactAssignments: { CompactAssignments: {
votes1: 'Vec<(AccountId, [CompactScore; 0], AccountId)>', votes1: 'Vec<(ValidatorIndex, [CompactScore; 0], NominatorIndex)>',
votes2: 'Vec<(AccountId, [CompactScore; 1], AccountId)>', votes2: 'Vec<(ValidatorIndex, [CompactScore; 1], NominatorIndex)>',
votes3: 'Vec<(AccountId, [CompactScore; 2], AccountId)>', votes3: 'Vec<(ValidatorIndex, [CompactScore; 2], NominatorIndex)>',
votes4: 'Vec<(AccountId, [CompactScore; 3], AccountId)>', votes4: 'Vec<(ValidatorIndex, [CompactScore; 3], NominatorIndex)>',
votes5: 'Vec<(AccountId, [CompactScore; 4], AccountId)>', votes5: 'Vec<(ValidatorIndex, [CompactScore; 4], NominatorIndex)>',
votes6: 'Vec<(AccountId, [CompactScore; 5], AccountId)>', votes6: 'Vec<(ValidatorIndex, [CompactScore; 5], NominatorIndex)>',
votes7: 'Vec<(AccountId, [CompactScore; 6], AccountId)>', votes7: 'Vec<(ValidatorIndex, [CompactScore; 6], NominatorIndex)>',
votes8: 'Vec<(AccountId, [CompactScore; 7], AccountId)>', votes8: 'Vec<(ValidatorIndex, [CompactScore; 7], NominatorIndex)>',
votes9: 'Vec<(AccountId, [CompactScore; 8], AccountId)>', votes9: 'Vec<(ValidatorIndex, [CompactScore; 8], NominatorIndex)>',
votes10: 'Vec<(AccountId, [CompactScore; 9], AccountId)>', votes10: 'Vec<(ValidatorIndex, [CompactScore; 9], NominatorIndex)>',
votes11: 'Vec<(AccountId, [CompactScore; 10], AccountId)>', votes11: 'Vec<(ValidatorIndex, [CompactScore; 10], NominatorIndex)>',
votes12: 'Vec<(AccountId, [CompactScore; 11], AccountId)>', votes12: 'Vec<(ValidatorIndex, [CompactScore; 11], NominatorIndex)>',
votes13: 'Vec<(AccountId, [CompactScore; 12], AccountId)>', votes13: 'Vec<(ValidatorIndex, [CompactScore; 12], NominatorIndex)>',
votes14: 'Vec<(AccountId, [CompactScore; 13], AccountId)>', votes14: 'Vec<(ValidatorIndex, [CompactScore; 13], NominatorIndex)>',
votes15: 'Vec<(AccountId, [CompactScore; 14], AccountId)>', votes15: 'Vec<(ValidatorIndex, [CompactScore; 14], NominatorIndex)>',
votes16: 'Vec<(AccountId, [CompactScore; 15], AccountId)>' votes16: 'Vec<(ValidatorIndex, [CompactScore; 15], NominatorIndex)>'
}, },
CompactScore: '(AccountId, u128)', CompactScore: '(u16, OffchainAccuracy)',
ElectionCompute: { ElectionCompute: {
_enum: ['OnChain', 'Signed', 'Authority'] _enum: ['OnChain', 'Signed', 'Authority']
}, },
@@ -90,6 +90,9 @@ export default {
submittedIn: 'EraIndex', submittedIn: 'EraIndex',
suppressed: 'bool' suppressed: 'bool'
}, },
NominatorIndex: 'u32',
OffchainAccuracy: 'PerU16',
PerU16: 'u16',
PhragmenScore: '[u128; 3]', PhragmenScore: '[u128; 3]',
Points: 'u32', Points: 'u32',
ReleasesStaking: { ReleasesStaking: {
+26 -17
View File
@@ -14,26 +14,26 @@ export interface ActiveEraInfo extends Struct {
/** @name CompactAssignments */ /** @name CompactAssignments */
export interface CompactAssignments extends Struct { export interface CompactAssignments extends Struct {
readonly votes1: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes1: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes2: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes2: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes3: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes3: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes4: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes4: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes5: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes5: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes6: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes6: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes7: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes7: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes8: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes8: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes9: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes9: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes10: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes10: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes11: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes11: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes12: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes12: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes13: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes13: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes14: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes14: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes15: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes15: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
readonly votes16: Vec<ITuple<[AccountId, Vec<CompactScore>, AccountId]>>; readonly votes16: Vec<ITuple<[ValidatorIndex, Vec<CompactScore>, NominatorIndex]>>;
} }
/** @name CompactScore */ /** @name CompactScore */
export interface CompactScore extends ITuple<[AccountId, u128]> {} export interface CompactScore extends ITuple<[u16, OffchainAccuracy]> {}
/** @name ElectionCompute */ /** @name ElectionCompute */
export interface ElectionCompute extends Enum { export interface ElectionCompute extends Enum {
@@ -112,6 +112,15 @@ export interface Nominations extends Struct {
readonly suppressed: bool; readonly suppressed: bool;
} }
/** @name NominatorIndex */
export interface NominatorIndex extends u32 {}
/** @name OffchainAccuracy */
export interface OffchainAccuracy extends PerU16 {}
/** @name PerU16 */
export interface PerU16 extends u16 {}
/** @name PhragmenScore */ /** @name PhragmenScore */
export interface PhragmenScore extends Vec<u128> {} export interface PhragmenScore extends Vec<u128> {}
@@ -328,7 +328,8 @@ export default {
params: [ params: [
{ {
name: 'keys', name: 'keys',
type: 'Vec<StorageKey>' type: 'Vec<StorageKey>',
isOptional: true
} }
], ],
pubsub: [ pubsub: [
+68 -68
View File
@@ -2607,47 +2607,47 @@ __metadata:
resolution: "@polkadot/api-contract@workspace:packages/api-contract" resolution: "@polkadot/api-contract@workspace:packages/api-contract"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/api": 1.11.1 "@polkadot/api": 1.12.1
"@polkadot/rpc-core": 1.11.1 "@polkadot/rpc-core": 1.12.1
"@polkadot/types": 1.11.1 "@polkadot/types": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
bn.js: ^5.1.1 bn.js: ^5.1.1
rxjs: ^6.5.5 rxjs: ^6.5.5
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/api-derive@1.11.1, @polkadot/api-derive@workspace:packages/api-derive": "@polkadot/api-derive@1.12.1, @polkadot/api-derive@workspace:packages/api-derive":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/api-derive@workspace:packages/api-derive" resolution: "@polkadot/api-derive@workspace:packages/api-derive"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/api": 1.11.1 "@polkadot/api": 1.12.1
"@polkadot/keyring": ^2.8.1 "@polkadot/keyring": ^2.9.0-beta.3
"@polkadot/rpc-core": 1.11.1 "@polkadot/rpc-core": 1.12.1
"@polkadot/rpc-provider": 1.11.1 "@polkadot/rpc-provider": 1.12.1
"@polkadot/types": 1.11.1 "@polkadot/types": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
"@polkadot/util-crypto": ^2.8.1 "@polkadot/util-crypto": ^2.9.0-beta.3
bn.js: ^5.1.1 bn.js: ^5.1.1
memoizee: ^0.4.14 memoizee: ^0.4.14
rxjs: ^6.5.5 rxjs: ^6.5.5
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/api@1.11.1, @polkadot/api@workspace:packages/api": "@polkadot/api@1.12.1, @polkadot/api@workspace:packages/api":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/api@workspace:packages/api" resolution: "@polkadot/api@workspace:packages/api"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/api-derive": 1.11.1 "@polkadot/api-derive": 1.12.1
"@polkadot/keyring": ^2.8.1 "@polkadot/keyring": ^2.9.0-beta.3
"@polkadot/metadata": 1.11.1 "@polkadot/metadata": 1.12.1
"@polkadot/rpc-core": 1.11.1 "@polkadot/rpc-core": 1.12.1
"@polkadot/rpc-provider": 1.11.1 "@polkadot/rpc-provider": 1.12.1
"@polkadot/types": 1.11.1 "@polkadot/types": 1.12.1
"@polkadot/types-known": 1.11.1 "@polkadot/types-known": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
"@polkadot/util-crypto": ^2.8.1 "@polkadot/util-crypto": ^2.9.0-beta.3
bn.js: ^5.1.1 bn.js: ^5.1.1
eventemitter3: ^4.0.0 eventemitter3: ^4.0.0
rxjs: ^6.5.5 rxjs: ^6.5.5
@@ -2741,56 +2741,56 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@polkadot/keyring@npm:^2.8.1": "@polkadot/keyring@npm:^2.9.0-beta.3":
version: 2.8.1 version: 2.9.0-beta.3
resolution: "@polkadot/keyring@npm:2.8.1" resolution: "@polkadot/keyring@npm:2.9.0-beta.3"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/util": 2.8.1 "@polkadot/util": 2.9.0-beta.3
"@polkadot/util-crypto": 2.8.1 "@polkadot/util-crypto": 2.9.0-beta.3
checksum: 2/3c6e4be89b5e50ba4c57cc79f1c47d0927d092ac9937345037c18568fec070f873d977e289ef4d563036c1174fc25f0b6f4037c1ef70888957ee5288ad6c28e6 checksum: 2/5b7c4baeed6a8d133c425f341b557202657e7b94a9489f50792425fda3c90104916714c256518fee79c034cad85ca7ff6131444eb7fc7947f65466dc3410f1bc
languageName: node languageName: node
linkType: hard linkType: hard
"@polkadot/metadata@1.11.1, @polkadot/metadata@workspace:packages/metadata": "@polkadot/metadata@1.12.1, @polkadot/metadata@workspace:packages/metadata":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/metadata@workspace:packages/metadata" resolution: "@polkadot/metadata@workspace:packages/metadata"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/keyring": ^2.8.1 "@polkadot/keyring": ^2.9.0-beta.3
"@polkadot/types": 1.11.1 "@polkadot/types": 1.12.1
"@polkadot/types-known": 1.11.1 "@polkadot/types-known": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
"@polkadot/util-crypto": ^2.8.1 "@polkadot/util-crypto": ^2.9.0-beta.3
bn.js: ^5.1.1 bn.js: ^5.1.1
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/rpc-core@1.11.1, @polkadot/rpc-core@workspace:packages/rpc-core": "@polkadot/rpc-core@1.12.1, @polkadot/rpc-core@workspace:packages/rpc-core":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/rpc-core@workspace:packages/rpc-core" resolution: "@polkadot/rpc-core@workspace:packages/rpc-core"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/keyring": ^2.8.1 "@polkadot/keyring": ^2.9.0-beta.3
"@polkadot/metadata": 1.11.1 "@polkadot/metadata": 1.12.1
"@polkadot/rpc-provider": 1.11.1 "@polkadot/rpc-provider": 1.12.1
"@polkadot/types": 1.11.1 "@polkadot/types": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
memoizee: ^0.4.14 memoizee: ^0.4.14
rxjs: ^6.5.5 rxjs: ^6.5.5
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/rpc-provider@1.11.1, @polkadot/rpc-provider@workspace:packages/rpc-provider": "@polkadot/rpc-provider@1.12.1, @polkadot/rpc-provider@workspace:packages/rpc-provider":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider" resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/keyring": ^2.8.1 "@polkadot/keyring": ^2.9.0-beta.3
"@polkadot/metadata": 1.11.1 "@polkadot/metadata": 1.12.1
"@polkadot/types": 1.11.1 "@polkadot/types": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
"@polkadot/util-crypto": ^2.8.1 "@polkadot/util-crypto": ^2.9.0-beta.3
bn.js: ^5.1.1 bn.js: ^5.1.1
eventemitter3: ^4.0.0 eventemitter3: ^4.0.0
isomorphic-fetch: ^2.2.1 isomorphic-fetch: ^2.2.1
@@ -2816,11 +2816,11 @@ __metadata:
"@babel/core": ^7.9.0 "@babel/core": ^7.9.0
"@babel/register": ^7.9.0 "@babel/register": ^7.9.0
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/api": 1.11.1 "@polkadot/api": 1.12.1
"@polkadot/metadata": 1.11.1 "@polkadot/metadata": 1.12.1
"@polkadot/rpc-provider": 1.11.1 "@polkadot/rpc-provider": 1.12.1
"@polkadot/types": 1.11.1 "@polkadot/types": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
"@types/websocket": ^1.0.0 "@types/websocket": ^1.0.0
"@types/yargs": ^15.0.4 "@types/yargs": ^15.0.4
websocket: ^1.0.31 websocket: ^1.0.31
@@ -2834,27 +2834,27 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/types-known@1.11.1, @polkadot/types-known@workspace:packages/types-known": "@polkadot/types-known@1.12.1, @polkadot/types-known@workspace:packages/types-known":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/types-known@workspace:packages/types-known" resolution: "@polkadot/types-known@workspace:packages/types-known"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/types": 1.11.1 "@polkadot/types": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
"@types/bn.js": ^4.11.6 "@types/bn.js": ^4.11.6
bn.js: ^5.1.1 bn.js: ^5.1.1
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/types@1.11.1, @polkadot/types@workspace:packages/types": "@polkadot/types@1.12.1, @polkadot/types@workspace:packages/types":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@polkadot/types@workspace:packages/types" resolution: "@polkadot/types@workspace:packages/types"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/keyring": ^2.8.1 "@polkadot/keyring": ^2.9.0-beta.3
"@polkadot/metadata": 1.11.1 "@polkadot/metadata": 1.12.1
"@polkadot/util": ^2.8.1 "@polkadot/util": ^2.9.0-beta.3
"@polkadot/util-crypto": ^2.8.1 "@polkadot/util-crypto": ^2.9.0-beta.3
"@types/bn.js": ^4.11.6 "@types/bn.js": ^4.11.6
"@types/memoizee": ^0.4.3 "@types/memoizee": ^0.4.3
bn.js: ^5.1.1 bn.js: ^5.1.1
@@ -2863,12 +2863,12 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@polkadot/util-crypto@npm:2.8.1, @polkadot/util-crypto@npm:^2.8.1": "@polkadot/util-crypto@npm:2.9.0-beta.3, @polkadot/util-crypto@npm:^2.9.0-beta.3":
version: 2.8.1 version: 2.9.0-beta.3
resolution: "@polkadot/util-crypto@npm:2.8.1" resolution: "@polkadot/util-crypto@npm:2.9.0-beta.3"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/util": 2.8.1 "@polkadot/util": 2.9.0-beta.3
"@polkadot/wasm-crypto": ^1.2.1 "@polkadot/wasm-crypto": ^1.2.1
base-x: ^3.0.8 base-x: ^3.0.8
bip39: ^3.0.2 bip39: ^3.0.2
@@ -2880,13 +2880,13 @@ __metadata:
pbkdf2: ^3.0.17 pbkdf2: ^3.0.17
tweetnacl: ^1.0.3 tweetnacl: ^1.0.3
xxhashjs: ^0.2.2 xxhashjs: ^0.2.2
checksum: 2/2cbbf5d084695ea901a29013f4a607b04c90e290709ac7c5633d854b602344c11adb154cbfd97a1a0caf40aaa9811c24b5470b335ddf4a17696b832686c84e0f checksum: 2/f3825919b8d8b94cf977937d3113afd1d350b47f89903959778ed4b618d7a95fac37f22d69af0c16fe95657049acf8579c3ebc907ad0bb702d4e9025d3d52a6a
languageName: node languageName: node
linkType: hard linkType: hard
"@polkadot/util@npm:2.8.1, @polkadot/util@npm:^2.8.1": "@polkadot/util@npm:2.9.0-beta.3, @polkadot/util@npm:^2.9.0-beta.3":
version: 2.8.1 version: 2.9.0-beta.3
resolution: "@polkadot/util@npm:2.8.1" resolution: "@polkadot/util@npm:2.9.0-beta.3"
dependencies: dependencies:
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@types/bn.js": ^4.11.6 "@types/bn.js": ^4.11.6
@@ -2894,7 +2894,7 @@ __metadata:
camelcase: ^5.3.1 camelcase: ^5.3.1
chalk: ^4.0.0 chalk: ^4.0.0
ip-regex: ^4.1.0 ip-regex: ^4.1.0
checksum: 2/30f5e0f4cd352a6258e3fc134b047c680fcfab5e0efd694bad5076ef71a95065f203a9a48ece4c7aa77e50e930de1e47ba2f28283a2d0134c6e2258305be47c1 checksum: 2/c2231b36075654bf7e7b91a682ac647028d351f48fa651e2d54d1c424cede45612a2bd896f4b06264f7c1e165d50c44f125df5a38046a21ea53735f316209428
languageName: node languageName: node
linkType: hard linkType: hard