Compare commits

..
58 Commits
Author SHA1 Message Date
Github Actions ad905db53b [CI Skip] release/stable 1.29.1
skip-checks: true
2020-08-17 10:56:06 +00:00
Jaco Greeff 0a0aa742b4 1.29 (#2489) 2020-08-17 12:43:56 +02:00
Github Actions dfbb06a4d6 [CI Skip] release/beta 1.29.0-beta.5
skip-checks: true
2020-08-13 09:05:15 +00:00
Jaco Greeff 82e71fd51e Bump deps (#2486) 2020-08-13 10:54:45 +02:00
Github Actions a8b88af97a [CI Skip] release/beta 1.29.0-beta.4
skip-checks: true
2020-08-13 07:59:11 +00:00
sung wu eee36537de Update tx.md (#2485)
fix sample code
2020-08-13 09:47:22 +02:00
Github Actions 20a75eafb6 [CI Skip] release/beta 1.29.0-beta.3
skip-checks: true
2020-08-11 15:33:01 +00:00
Jaco Greeff 00d3a1174b Add desiredRunnersUp (#2484) 2020-08-11 17:21:30 +02:00
Github Actions e293c7c1cf [CI Skip] release/beta 1.29.0-beta.2
skip-checks: true
2020-08-11 11:54:13 +00:00
Jaco Greeff 3c8cd499c4 Introduce compact version of CompactAssignments (#2483)
* Introduce compact version of CompactAssignments

* Rebuild interfaces, update tests
2020-08-11 13:43:24 +02:00
Github Actions cb3816df78 [CI Skip] release/beta 1.29.0-beta.1
skip-checks: true
2020-08-11 08:01:38 +00:00
Jaco Greeff fcfcbb2d97 Additional Fixed* types (#2481) 2020-08-11 09:50:28 +02:00
Github Actions 321b80ed63 [CI Skip] release/beta 1.29.0-beta.0
skip-checks: true
2020-08-10 14:55:58 +00:00
Jaco Greeff 73eaa9fe17 Cleanup id from index lookups (#2479) 2020-08-10 16:42:27 +02:00
Github Actions 4d8910f3da [CI Skip] release/stable 1.28.1
skip-checks: true
2020-08-10 06:20:15 +00:00
Jaco Greeff e6806ed7f9 jg-1.28 (#2478) 2020-08-10 08:10:21 +02:00
Github Actions 218abf9568 [CI Skip] release/beta 1.28.0-beta.6
skip-checks: true
2020-08-08 07:21:20 +00:00
Jaco Greeff a1df864681 Nump deps (#2477) 2020-08-08 09:09:30 +02:00
Github Actions 45640edcff [CI Skip] release/beta 1.28.0-beta.5
skip-checks: true
2020-08-07 09:29:23 +00:00
Jaco Greeff 53655019b5 Cookbook for viewing block extrinsics (#2476) 2020-08-07 11:16:33 +02:00
Github Actions a1f8bedb6d [CI Skip] release/beta 1.28.0-beta.4
skip-checks: true
2020-08-06 19:08:46 +00:00
Miguel Hervas 9d1af1eaeb Add Centrifuge missing types (#2475)
* Add missing types

* sort attempt

* sort attempt 1

* sort attempt 2
2020-08-06 20:57:07 +02:00
Github Actions 38bfd26511 [CI Skip] release/beta 1.28.0-beta.3
skip-checks: true
2020-08-06 13:07:18 +00:00
Jaco Greeff 1beaf9f208 Bump berry (#2473)
* Bump berry

* Rewrite
2020-08-06 14:56:43 +02:00
Github Actions 29c29978dd [CI Skip] release/beta 1.28.0-beta.2
skip-checks: true
2020-08-05 15:06:31 +00:00
Jaco Greeff a8d1dd0637 Bump deps (#2472) 2020-08-05 16:53:11 +02:00
Github Actions 74571dcd26 [CI Skip] release/beta 1.28.0-beta.1
skip-checks: true
2020-08-04 20:51:40 +00:00
Jaco Greeff 54b4c2620a Types for time-delay proxies (#2468)
* Types for time-delay proxies

* Remove duplicated CallHash (& generate output)
2020-08-04 22:38:56 +02:00
Github Actions da05828e74 [CI Skip] release/beta 1.28.0-beta.0
skip-checks: true
2020-08-04 11:07:26 +00:00
Jaco Greeff fa935156e1 Add ValidationFunctionParams type (#2467) 2020-08-04 12:56:55 +02:00
Github Actions 19510c1ede [CI Skip] release/stable 1.27.1
skip-checks: true
2020-08-03 07:18:56 +00:00
Jaco Greeff 97b5c699b1 1.27 (#2462) 2020-08-03 09:08:09 +02:00
Github Actions d2befda86e [CI Skip] release/beta 1.27.0-beta.3
skip-checks: true
2020-07-31 09:46:53 +00:00
Jaco Greeff 740348b48f Bump deps (#2460) 2020-07-31 11:34:00 +02:00
Github Actions 9e2a5cf532 [CI Skip] release/beta 1.27.0-beta.2
skip-checks: true
2020-07-30 16:28:52 +00:00
Jaco Greeff 6df466d9ea Known types for Rococo (#2459)
* Known types for Rococo

* Update rococo.ts
2020-07-30 18:17:32 +02:00
Github Actions e2a2ac2842 [CI Skip] release/beta 1.27.0-beta.1
skip-checks: true
2020-07-28 11:11:30 +00:00
sung wu 5adc846e45 update doc - "create instance" page (#2456)
poc-3.polkadot.io is not available right now. use rpc.polkadot.io instead.
2020-07-28 12:59:27 +02:00
Github Actions 75aa310837 [CI Skip] release/beta 1.27.0-beta.0
skip-checks: true
2020-07-28 10:27:07 +00:00
Jaco Greeff ce0523eb1c Raw toHuman Ascii detection (#2455) 2020-07-28 12:17:26 +02:00
Github Actions eb0370bb66 [CI Skip] release/stable 1.26.1
skip-checks: true
2020-07-27 11:21:29 +00:00
Jaco Greeff 5eb491dc67 1.26 (#2453) 2020-07-27 13:10:07 +02:00
Github Actions b50294ab0f [CI Skip] release/beta 1.26.0-beta.6
skip-checks: true
2020-07-27 10:56:53 +00:00
Keith Ingram e1cb62d2d2 Type for contract call params (#2452) 2020-07-27 12:43:54 +02:00
Github Actions 8ed0ef2295 [CI Skip] release/beta 1.26.0-beta.5
skip-checks: true
2020-07-27 10:18:11 +00:00
Jaco Greeff 956e173323 Metadata bump (#2451) 2020-07-27 12:06:28 +02:00
Github Actions b8a37ba438 [CI Skip] release/beta 1.26.0-beta.4
skip-checks: true
2020-07-27 07:22:38 +00:00
Jaco Greeff e7669c2b00 Add api typesBundle (#2422)
* Add api typesBundle

* Inject user-defined RPC from spec/chain

* Linting cleanups

* Invert check fro non-existing

* Extract bundle injection

* Ignore RPC for the first round

* CHANGELOG

* Merge master
2020-07-27 09:12:04 +02:00
Github Actions 6c309a503d [CI Skip] release/beta 1.26.0-beta.3
skip-checks: true
2020-07-27 07:02:12 +00:00
Jaco Greeff 3cf67c975a Bump deps (#2450) 2020-07-27 08:49:52 +02:00
Github Actions 077914364c [CI Skip] release/beta 1.26.0-beta.2
skip-checks: true
2020-07-25 12:15:51 +00:00
Jaco Greeff 56e4cbdb27 Update .123trigger 2020-07-25 14:03:36 +02:00
nsso 60bfdae734 support rpc import definitions (#2438)
* support import definitions

* fix lint
2020-07-25 13:53:04 +02:00
Jaco Greeff 1cf4d6b9b8 Additional typegen asserts (#2448)
* Additional typegen asserts

* typo

* Revert tuple assert

* Free-standing Vec is valid
2020-07-25 13:47:34 +02:00
Github Actions 40cd9ff51f [CI Skip] release/beta 1.26.0-beta.1
skip-checks: true
2020-07-20 18:13:14 +00:00
Jaco Greeff c7e6e40030 Voting is only free balance (#2444) 2020-07-20 20:03:26 +02:00
Github Actions 97d0bcbfd4 [CI Skip] release/beta 1.26.0-beta.0
skip-checks: true
2020-07-20 10:55:27 +00:00
Shawn Tabrizi 6ca84425d1 Update docs for accountNextIndex (#2443) 2020-07-20 12:45:01 +02:00
59 changed files with 3816 additions and 3133 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
24
25
1.4.2
1.6.2
1.11.2
1.12.21.17.2
1.12.2
1.17.2
Vendored Executable
+86
View File
File diff suppressed because one or more lines are too long
-56
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.js
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-rc.js
yarnPath: .yarn/releases/yarn-2.1.1.js
+44
View File
@@ -1,7 +1,51 @@
# CHANGELOG
## 1.29.1 Aug 17, 2020
Upgrade priority: Low, unless on bleeding-edge chain with new compact `CompactAssignments`.
- **Important** The Substrate `CompactAssignments` type has changed for better space utilization. On older chains, supply `CompactAssignments: 'CompactAssignmentsTo257'`
- Clean tx cookbook param expansion (Thanks to https://github.com/swswsw)
- Add additional `Fixed{I,U}{64,128}` and `{I,U}32F32` types
- Add `desiredRunnersUp` to council derives
- Cleanup indices/AccountId combination derive lookups
- `@polkadot/util` 3.2
## 1.28.1 Aug 10, 2020
Upgrade priority: Low, unless using Centrifuge or parachains
- Update Centrifuge types to latest (Thanks to https://github.com/mikiquantum)
- Add cookbook entry for viewing block extrinsics
- Support types for time-delay proxies
- Update types for parachains
- `@polkadot/util` 3.1
- `@polkadot/wasm-crypto` 1.3
## 1.27.1 Aug 3, 2020
Upgrade priority: Low, unless using the Rococo chain
- Remove outdated example poc-3 RPC reference (Thanks to https://github.com/swswsw)
- Raw/Bytes `toHuman` detects ASCII sequence for text output
- Add know types for the Rococo chain
## 1.26.1 Jul 27, 2020
Upgrade priority: Low
- Update docs for the new `system.accountNextIndex` (Thanks to https://github.com/shawntabrizi)
- Update contracts call parameter typing (Thanks to https://github.com/kwingram25)
- Adjust votingBalance to only return `freeBalance` (only council voting is free + reserved)
- Additional checks for referenced Vec sub-type deconstruction in typegen
- Allow for API `typesBundle` option to inject a group of chain versions types
- Update metadata static tests for latest Substrate
- `@polkadot/util` 3.0
## 1.25.1 Jul 20, 2020
Upgrade priority: Medium, especially if using contracts.
- **Important** Contract RPC result updated on Substrate, on older chains supply `ContractExecResult: 'ContractExecResultTo255'`
- Support for custom HTTP headers in providers (Thanks to https://github.com/brad-larson)
- Update known types for Centrifuge (Thanks to https://github.com/philipstanislaus)
+17
View File
@@ -42,3 +42,20 @@ const header = await api.derive.chain.getHeader();
console.log(`#${header.number}: ${header.author}`);
```
## How do I view block extrinsic information?
The transactions are included in a signed block as part of the extrinsics - some of these will be unsigned and generated by the block author and some of these may be submitted from external sources and be signed. (Some palettes do use unsigned transactions, so signed/unsigned is not an indication of origin). To retrieve the block and display the transaction information, we can do the following -
```js
// no blockHash is specified, so we retrieve the latest
const signedBlock = await this.api.rpc.chain.getBlock();
// the information for each of the contained extrinsics
signedBlock.block.extrinsics.forEach((ex, index) => {
// the extrinsics are decoded by the API
console.log(index, ex.toHuman());
});
```
In the above `.toHuman()` is used to format into a human-readable representation. You can inspect/extract specific fields from the decoded extrinsic as required, for instance `ex.method.section` would return the pallete that executed this transaction.
+6 -6
View File
@@ -16,9 +16,9 @@ const info = await api.tx.balances
// log relevant info, partialFee is Balance, estimated for current
console.log(`
class=${class.toString()},
weight=${weight.toString()},
partialFee=${partialFee.toHuman()}
class=${info.class.toString()},
weight=${info.weight.toString()},
partialFee=${info.partialFee.toHuman()}
`);
```
@@ -97,12 +97,12 @@ api.tx.utility
## How do I take the pending tx pool into account in my nonce?
The `system.account` query will always contain the current state, i.e. it will reflect the nonce for the last known block. As such when sending multiple transactions in quick succession (see batching above), there may be transactions in the pool that has the same nonce that `signAndSend` would apply - this call doesn't do any magic, it simply reads the state for the nonce. Since we can specify options to the `signandSend` operation, we can override the nonce, either by manually incrementing it o querying it via `nextNonce`.
The `system.account` query will always contain the current state, i.e. it will reflect the nonce for the last known block. As such when sending multiple transactions in quick succession (see batching above), there may be transactions in the pool that has the same nonce that `signAndSend` would apply - this call doesn't do any magic, it simply reads the state for the nonce. Since we can specify options to the `signAndSend` operation, we can override the nonce, either by manually incrementing it or querying it via `rpc.system.accountNextIndex`.
```js
for (let i = 0; i < 10; i++) {
// retrieve the nextNonce, taking txs in the pool into account
const nonce = await api.rpc.account.nextNonce(sender);
// retrieve sender's next index/nonce, taking txs in the pool into account
const nonce = await api.rpc.system.accountNextIndex(sender);
// send, just retrieving the hash, not waiting on status
const txhash = await api.tx.balances
+1 -1
View File
@@ -8,7 +8,7 @@ import { ApiPromise, WsProvider } from '@polkadot/api';
...
// Construct
const wsProvider = new WsProvider('wss://poc-3.polkadot.io');
const wsProvider = new WsProvider('wss://rpc.polkadot.io');
const api = await ApiPromise.create({ provider: wsProvider });
// Do something
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "1.25.1"
"version": "1.29.1"
}
+7 -7
View File
@@ -24,15 +24,15 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.10.5",
"@babel/core": "^7.11.1",
"@babel/register": "^7.10.5",
"@babel/runtime": "^7.10.5",
"@polkadot/dev": "^0.55.27",
"@polkadot/ts": "^0.3.29",
"@babel/runtime": "^7.11.2",
"@polkadot/dev": "^0.55.38",
"@polkadot/ts": "^0.3.38",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.5",
"@vuepress/plugin-search": "^1.5.2",
"@types/jest": "^26.0.9",
"@vuepress/plugin-search": "^1.5.3",
"copyfiles": "^2.3.0"
},
"version": "1.25.1"
"version": "1.29.1"
}
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.25.1",
"version": "1.29.1",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -26,12 +26,12 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/api": "1.25.1",
"@polkadot/rpc-core": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/api": "1.29.1",
"@polkadot/rpc-core": "1.29.1",
"@polkadot/types": "1.29.1",
"@polkadot/util": "^3.2.1",
"bn.js": "^5.1.2",
"rxjs": "^6.6.0"
"rxjs": "^6.6.2"
}
}
+5 -5
View File
@@ -4,7 +4,7 @@
import { ApiTypes, DecorateMethod, ObsInnerType } from '@polkadot/api/types';
import { AccountId, Address, ContractExecResult } from '@polkadot/types/interfaces';
import { Codec, IKeyringPair } from '@polkadot/types/types';
import { Codec, CodecArg, IKeyringPair } from '@polkadot/types/types';
import { ApiObject, ContractABIMessage, ContractABIPre, ContractCallOutcome } from '../types';
import BN from 'bn.js';
@@ -38,9 +38,9 @@ export default class Contract<ApiType extends ApiTypes> extends BaseWithTxAndRpc
this.address = this.registry.createType('Address', address);
}
public call (as: 'rpc', message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, 'rpc'>;
public call (as: 'tx', message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, 'tx'>;
public call<CallType extends ContractCallTypes> (as: CallType, message: string, value: BN | number, gasLimit: BN | number, ...params: any[]): ContractCall<ApiType, CallType> {
public call (as: 'rpc', message: string, value: BN | number, gasLimit: BN | number, ...params: CodecArg[]): ContractCall<ApiType, 'rpc'>;
public call (as: 'tx', message: string, value: BN | number, gasLimit: BN | number, ...params: CodecArg[]): ContractCall<ApiType, 'tx'>;
public call<CallType extends ContractCallTypes> (as: CallType, message: string, value: BN | number, gasLimit: BN | number, ...params: CodecArg[]): ContractCall<ApiType, CallType> {
const { def, fn } = this.getMessage(message);
return {
@@ -67,7 +67,7 @@ export default class Contract<ApiType extends ApiTypes> extends BaseWithTxAndRpc
};
}
private _createOutcome (result: ContractExecResult, origin: AccountId, message: ContractABIMessage, params: any[]): ContractCallOutcome {
private _createOutcome (result: ContractExecResult, origin: AccountId, message: ContractABIMessage, params: CodecArg[]): ContractCallOutcome {
let output: Codec | null = null;
if (result.isSuccess) {
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.25.1",
"version": "1.29.1",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -27,18 +27,18 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/api": "1.25.1",
"@polkadot/rpc-core": "1.25.1",
"@polkadot/rpc-provider": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/api": "1.29.1",
"@polkadot/rpc-core": "1.29.1",
"@polkadot/rpc-provider": "1.29.1",
"@polkadot/types": "1.29.1",
"@polkadot/util": "^3.2.1",
"@polkadot/util-crypto": "^3.2.1",
"bn.js": "^5.1.2",
"memoizee": "^0.4.14",
"rxjs": "^6.6.0"
"rxjs": "^6.6.2"
},
"devDependencies": {
"@polkadot/keyring": "^2.18.1"
"@polkadot/keyring": "^3.2.1"
}
}
@@ -30,7 +30,7 @@ function retrieve (api: ApiInterfaceRx, address: Address | AccountId | AccountIn
const accountIndex = api.registry.createType('AccountIndex', decoded);
return api.derive.accounts.indexToId(accountIndex).pipe(
return api.derive.accounts.indexToId(accountIndex.toString()).pipe(
map((accountId): AccountIdAndIndex => [accountId, accountIndex])
);
} catch (error) {
+1 -1
View File
@@ -23,7 +23,7 @@ function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBa
frozenFee,
frozenMisc,
reservedBalance,
votingBalance: api.registry.createType('Balance', freeBalance.add(reservedBalance))
votingBalance: api.registry.createType('Balance', freeBalance.toBn())
};
}
+2 -1
View File
@@ -4,13 +4,13 @@
import { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces';
import { ITuple } from '@polkadot/types/types';
import { DeriveElectionsInfo } from './types';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { Vec, u32 } from '@polkadot/types';
import { DeriveElectionsInfo } from '../types';
import { memo } from '../util';
function sortAccounts ([, balanceA]: ITuple<[AccountId, Balance]>, [, balanceB]: ITuple<[AccountId, Balance]>): number {
@@ -30,6 +30,7 @@ function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
candidacyBond: api.consts[section].candidacyBond as Balance,
candidateCount: api.registry.createType('u32', candidates.length),
candidates,
desiredRunnersUp: api.consts[section].desiredRunnersUp as u32,
desiredSeats: api.consts[section].desiredMembers as u32,
members: members.length
? members.sort(sortAccounts)
@@ -0,0 +1,22 @@
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, Balance, BlockNumber, SetIndex, VoteIndex } from '@polkadot/types/interfaces';
import { u32 } from '@polkadot/types';
export interface DeriveElectionsInfo {
candidates: AccountId[];
candidateCount: u32;
candidacyBond?: Balance;
desiredRunnersUp: u32;
desiredSeats: u32;
members: [AccountId, Balance][];
nextVoterSet?: SetIndex;
runnersUp: [AccountId, Balance][];
termDuration: BlockNumber;
voteCount?: VoteIndex;
voterCount?: SetIndex;
votingBond?: Balance;
}
+2 -15
View File
@@ -3,13 +3,14 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import type BN from 'bn.js';
import { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces';
import { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VouchingStatus } from '@polkadot/types/interfaces';
import { u32 } from '@polkadot/types';
export * from './accounts/types';
export * from './council/types';
export * from './democracy/types';
export * from './elections/types';
export * from './parachains/types';
export * from './session/types';
export * from './staking/types';
@@ -59,20 +60,6 @@ export interface DeriveCollectiveProposal {
export type DeriveCollectiveProposals = DeriveCollectiveProposal[];
export interface DeriveElectionsInfo {
candidates: AccountId[];
candidateCount: u32;
candidacyBond?: Balance;
desiredSeats: u32;
members: [AccountId, Balance][];
nextVoterSet?: SetIndex;
runnersUp: [AccountId, Balance][];
termDuration: BlockNumber;
voteCount?: VoteIndex;
voterCount?: SetIndex;
votingBond?: Balance;
}
export interface DeriveFees {
creationFee: Balance;
existentialDeposit: Balance;
+13 -13
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.25.1",
"version": "1.29.1",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -26,21 +26,21 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/api-derive": "1.25.1",
"@polkadot/keyring": "^2.18.1",
"@polkadot/metadata": "1.25.1",
"@polkadot/rpc-core": "1.25.1",
"@polkadot/rpc-provider": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/types-known": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/api-derive": "1.29.1",
"@polkadot/keyring": "^3.2.1",
"@polkadot/metadata": "1.29.1",
"@polkadot/rpc-core": "1.29.1",
"@polkadot/rpc-provider": "1.29.1",
"@polkadot/types": "1.29.1",
"@polkadot/types-known": "1.29.1",
"@polkadot/util": "^3.2.1",
"@polkadot/util-crypto": "^3.2.1",
"bn.js": "^5.1.2",
"eventemitter3": "^4.0.4",
"rxjs": "^6.6.0"
"rxjs": "^6.6.2"
},
"devDependencies": {
"@polkadot/keyring": "^2.18.1"
"@polkadot/keyring": "^3.2.1"
}
}
+2 -1
View File
@@ -16,8 +16,9 @@ import { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfa
import { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
import { AuthIndex } from '@polkadot/types/interfaces/imOnline';
import { DeferredOffenceOf, Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
import { ProxyType } from '@polkadot/types/interfaces/proxy';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, ExtrinsicsWeight, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, ProxyType, Releases, ValidatorId } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, ExtrinsicsWeight, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, Releases, ValidatorId } from '@polkadot/types/interfaces/runtime';
import { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
+12 -1
View File
@@ -13,7 +13,8 @@ import { Extrinsic, Signature } from '@polkadot/types/interfaces/extrinsics';
import { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/interfaces/grandpa';
import { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity';
import { Heartbeat } from '@polkadot/types/interfaces/imOnline';
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, ProxyType, Weight } from '@polkadot/types/interfaces/runtime';
import { ProxyType } from '@polkadot/types/interfaces/proxy';
import { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, Weight } from '@polkadot/types/interfaces/runtime';
import { Period, Priority } from '@polkadot/types/interfaces/scheduler';
import { Keys } from '@polkadot/types/interfaces/session';
import { SocietyJudgement } from '@polkadot/types/interfaces/society';
@@ -890,6 +891,16 @@ declare module '@polkadot/api/types/submittable' {
};
grandpa: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Note that the current authority set of the GRANDPA finality gadget has
* stalled. This will trigger a forced authority set change at the beginning
* of the next session, to be enacted `delay` blocks after that. The delay
* should be high enough to safely assume that the block signalling the
* forced change will not be re-orged (e.g. 1000 blocks). The GRANDPA voters
* will start the new authority set using the given finalized block as base.
* Only callable by root.
**/
noteStalled: AugmentedSubmittable<(delay: BlockNumber | AnyNumber | Uint8Array, bestFinalizedBlockNumber: BlockNumber | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Report voter equivocation/misbehavior. This method will verify the
* equivocation proof and validate the given key ownership proof
+34 -1
View File
@@ -9,7 +9,7 @@ import { Observable, Subscription, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Metadata, Text } from '@polkadot/types';
import { LATEST_EXTRINSIC_VERSION } from '@polkadot/types/extrinsic/Extrinsic';
import { getMetadataTypes, getSpecTypes } from '@polkadot/types-known';
import { getMetadataTypes, getSpecAlias, getSpecTypes } from '@polkadot/types-known';
import { logger } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto';
@@ -35,6 +35,7 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
this.registry.setKnownTypes({
types: options.types,
typesAlias: options.typesAlias,
typesBundle: options.typesBundle,
typesChain: options.typesChain,
typesSpec: options.typesSpec
});
@@ -147,6 +148,33 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
).subscribe();
}
private _adjustBundleTypes (chain: Text, specName: Text): void {
// adjust known type aliases
this.registry.knownTypes.typesAlias = getSpecAlias(this.registry, chain, specName);
// FIXME For the first round, we are not adjusting the user-injected RPCs
// inject any user-level RPCs now that we have the chain/spec
// this._rpcCore.addUserInterfaces(getSpecRpc(this.registry, chain, specName));
// const extraRpc = this._decorateRpc(this._rpcCore, this._decorateMethod);
// // FIXME this is a mess
// Object.entries(extraRpc).forEach(([section, value]): void => {
// if (this._rpc) {
// if (!this._rpc[section as 'author']) {
// this._rpc[section as 'author'] = {} as DecoratedRpcSection<ApiType, RpcInterface['author']>;
// }
// Object.entries(value).forEach(([name, method]): void => {
// if (this._rpc && !this._rpc[section as 'author'][name as 'hasKey']) {
// // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
// this._rpc[section as 'author'][name as 'hasKey'] = method;
// }
// });
// }
// });
}
private async _metaFromChain (optMetadata: Record<string, string>): Promise<Metadata> {
const [runtimeVersion, chain, chainProps] = await Promise.all([
this._rpcCore.state.getRuntimeVersion().toPromise(),
@@ -159,6 +187,11 @@ export default abstract class Init<ApiType extends ApiTypes> extends Decorate<Ap
this._runtimeVersion = runtimeVersion;
this._rx.runtimeVersion = runtimeVersion;
// adjust types based on bundled info
if (this.registry.knownTypes.typesBundle) {
this._adjustBundleTypes(chain, runtimeVersion.specName);
}
// do the setup for the specific chain
this.registry.setChainProperties(chainProps);
this.registerTypes(getSpecTypes(this.registry, chain, runtimeVersion.specName, runtimeVersion.specVersion));
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.25.1",
"version": "1.29.1",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -26,14 +26,14 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/types": "1.25.1",
"@polkadot/types-known": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/types": "1.29.1",
"@polkadot/types-known": "1.29.1",
"@polkadot/util": "^3.2.1",
"@polkadot/util-crypto": "^3.2.1",
"bn.js": "^5.1.2"
},
"devDependencies": {
"@polkadot/keyring": "^2.18.1"
"@polkadot/keyring": "^3.2.1"
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.25.1",
"version": "1.29.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -26,15 +26,15 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/metadata": "1.25.1",
"@polkadot/rpc-provider": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/metadata": "1.29.1",
"@polkadot/rpc-provider": "1.29.1",
"@polkadot/types": "1.29.1",
"@polkadot/util": "^3.2.1",
"memoizee": "^0.4.14",
"rxjs": "^6.6.0"
"rxjs": "^6.6.2"
},
"devDependencies": {
"@polkadot/keyring": "^2.18.1"
"@polkadot/keyring": "^3.2.1"
}
}
+27 -12
View File
@@ -116,7 +116,12 @@ export default class Rpc implements RpcInterface {
this.registry = registry;
this.provider = provider;
this._createInterfaces(userRpc);
const sectionNames = Object.keys(jsonrpc);
// these are the base keys (i.e. part of jsonrpc)
this.sections.push(...sectionNames);
this.addUserInterfaces(userRpc);
}
/**
@@ -126,27 +131,37 @@ export default class Rpc implements RpcInterface {
this.provider.disconnect();
}
private _createInterfaces<Section extends keyof RpcInterface> (userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void {
const sectionNames = Object.keys(jsonrpc);
// these are the base keys (i.e. part of jsonrpc)
this.sections.push(...sectionNames);
public addUserInterfaces<Section extends keyof RpcInterface> (userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void {
// add any extra user-defined sections
this.sections.push(...Object.keys(userRpc).filter((key): boolean => !this.sections.includes(key)));
this.sections.push(...Object.keys(userRpc).filter((key) => !this.sections.includes(key)));
// decorate the sections with base and user methods
this.sections.forEach((sectionName): void => {
(this as Record<string, unknown>)[sectionName as Section] = {
...this._createInterface(sectionName, jsonrpc[sectionName as 'babe'] || {}),
...this._createInterface(sectionName, userRpc[sectionName] || {})
};
if (!(this as Record<string, unknown>)[sectionName as Section]) {
(this as Record<string, unknown>)[sectionName as Section] = {};
}
const section = (this as Record<string, unknown>)[sectionName as Section] as Record<string, any>;
Object
.entries({
...this._createInterface(sectionName, jsonrpc[sectionName as 'babe'] || {}),
...this._createInterface(sectionName, userRpc[sectionName] || {})
})
.forEach(([key, value]): void => {
// we don't want to clobber existing, i.e. when this is called again after chain is determined
if (!section[key]) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
section[key] = value;
}
});
});
}
private _createInterface<Section extends keyof RpcInterface> (section: string, methods: Record<string, DefinitionRpc | DefinitionRpcSub>): RpcInterface[Section] {
return Object
.keys(methods)
.filter((method) => !this.mapping.has(`${section}_${method}`))
.reduce((exposed, method): RpcInterface[Section] => {
const def = methods[method];
const isSubscription = !!(def as DefinitionRpcSub).pubsub;
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.25.1",
"version": "1.29.1",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -26,19 +26,19 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/metadata": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/metadata": "1.29.1",
"@polkadot/types": "1.29.1",
"@polkadot/util": "^3.2.1",
"@polkadot/util-crypto": "^3.2.1",
"bn.js": "^5.1.2",
"eventemitter3": "^4.0.4",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.31"
},
"devDependencies": {
"@polkadot/keyring": "^2.18.1",
"@polkadot/keyring": "^3.2.1",
"mock-socket": "^9.0.3",
"nock": "^13.0.2"
"nock": "^13.0.4"
}
}
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.25.1",
"version": "1.29.1",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
@@ -33,14 +33,14 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"dependencies": {
"@babel/core": "^7.10.5",
"@babel/core": "^7.11.1",
"@babel/register": "^7.10.5",
"@babel/runtime": "^7.10.5",
"@polkadot/api": "1.25.1",
"@polkadot/metadata": "1.25.1",
"@polkadot/rpc-provider": "1.25.1",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/api": "1.29.1",
"@polkadot/metadata": "1.29.1",
"@polkadot/rpc-provider": "1.29.1",
"@polkadot/types": "1.29.1",
"@polkadot/util": "^3.2.1",
"handlebars": "^4.7.6",
"websocket": "^1.0.31",
"yargs": "^15.4.1"
+26 -11
View File
@@ -5,9 +5,10 @@
import Handlebars from 'handlebars';
import { TypeRegistry } from '@polkadot/types/create';
import * as definitions from '@polkadot/types/interfaces/definitions';
import { Definitions } from '@polkadot/types/types';
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
import { createImports, getSimilarTypes, readTemplate, setImports, writeFile } from '../util';
import { createImports, getSimilarTypes, formatType, readTemplate, setImports, writeFile } from '../util';
const StorageKeyTye = 'StorageKey | string | Uint8Array | any';
@@ -15,21 +16,28 @@ const template = readTemplate('rpc');
const generateRpcTypesTemplate = Handlebars.compile(template);
/** @internal */
export default function generateRpcTypes (dest = 'packages/api/src/augment/rpc.ts'): void {
export function generateRpcTypes (importDefinitions: { [importPath: string]: Record<string, Definitions> }, dest: string): void {
writeFile(dest, (): string => {
const registry = new TypeRegistry();
const allTypes = { '@polkadot/types/interfaces': definitions };
const imports = createImports(allTypes);
const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => {
const imports = createImports(importDefinitions);
const definitions = imports.definitions as Record<string, Definitions>;
const allDefs = Object.entries(importDefinitions).reduce((defs, [path, obj]) => {
return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs);
}, {});
const rpcKeys = Object
.keys(definitions)
.filter((key) => Object.keys(definitions[key as 'babe'].rpc || {}).length !== 0)
.filter((key) => Object.keys(definitions[key].rpc || {}).length !== 0)
.sort();
const modules = rpcKeys.map((section) => {
const allMethods = Object.keys(definitions[section as 'babe'].rpc).sort().map((methodName) => {
const def = definitions[section as 'babe'].rpc[methodName];
const modules = rpcKeys.map((sectionFullName) => {
const rpc = definitions[sectionFullName].rpc;
const section = sectionFullName.split('/').pop();
const allMethods = Object.keys(rpc).sort().map((methodName) => {
const def = rpc[methodName];
let args;
let type;
@@ -69,7 +77,7 @@ export default function generateRpcTypes (dest = 'packages/api/src/augment/rpc.t
return `${param.name}${param.isOptional ? '?' : ''}: ${similarTypes.join(' | ')}`;
});
type = def.type;
type = formatType(allDefs, def.type, imports);
generic = '';
}
@@ -105,3 +113,10 @@ export default function generateRpcTypes (dest = 'packages/api/src/augment/rpc.t
});
});
}
export default function generateDefaultRpcTypes (): void {
generateRpcTypes(
{ '@polkadot/types/interfaces': defaultDefinitions },
'packages/api/src/augment/rpc.ts'
);
}
+17 -11
View File
@@ -92,18 +92,22 @@ export function getSimilarTypes (definitions: Record<string, ModuleTypes>, regis
const Clazz = ClassOfUnsafe(registry, type);
if (isChildClass(Vec, Clazz)) {
const subDef = (getTypeDef(type).sub) as TypeDef;
const vecDef = getTypeDef(type);
const subDef = (vecDef.sub) as TypeDef;
if (subDef.info === TypeDefInfo.Plain) {
possibleTypes.push(`(${getSimilarTypes(definitions, registry, subDef.type, imports).join(' | ')})[]`);
} else if (subDef.info === TypeDefInfo.Tuple) {
const subs = (subDef.sub as TypeDef[]).map(({ type }): string =>
getSimilarTypes(definitions, registry, type, imports).join(' | ')
);
// this could be that we define a Vec type and refer to it by name
if (subDef) {
if (subDef.info === TypeDefInfo.Plain) {
possibleTypes.push(`(${getSimilarTypes(definitions, registry, subDef.type, imports).join(' | ')})[]`);
} else if (subDef.info === TypeDefInfo.Tuple) {
const subs = (subDef.sub as TypeDef[]).map(({ type }): string =>
getSimilarTypes(definitions, registry, type, imports).join(' | ')
);
possibleTypes.push(`([${subs.join(', ')}])[]`);
} else {
throw new Error(`Unhandled subtype in Vec, ${JSON.stringify(subDef)}`);
possibleTypes.push(`([${subs.join(', ')}])[]`);
} else {
throw new Error(`Unhandled subtype in Vec, ${JSON.stringify(subDef)}`);
}
}
} else if (isChildClass(Enum, Clazz)) {
const e = new (Clazz as Constructor)(registry) as Enum;
@@ -141,8 +145,10 @@ export function getSimilarTypes (definitions: Record<string, ModuleTypes>, regis
} else if (isChildClass(String, Clazz)) {
possibleTypes.push('string');
} else if (isChildClass(Tuple, Clazz)) {
const subDef = getTypeDef(type).sub;
const tupDef = getTypeDef(type);
const subDef = tupDef.sub;
// this could be that we define a Tuple type and refer to it by name
if (Array.isArray(subDef)) {
const subs = subDef.map(({ type }) => getSimilarTypes(definitions, registry, type, imports).join(' | '));
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "1.25.1",
"version": "1.29.1",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -26,9 +26,9 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/types": "1.25.1",
"@polkadot/util": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/types": "1.29.1",
"@polkadot/util": "^3.2.1",
"bn.js": "^5.1.2"
},
"devDependencies": {
+30 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import type BN from 'bn.js';
import { Registry, RegistryTypes, OverrideModuleType, OverrideVersionedType } from '@polkadot/types/types';
import { DefinitionRpc, DefinitionRpcSub, Registry, RegistryTypes, OverrideModuleType, OverrideVersionedType } from '@polkadot/types/types';
import { Text } from '@polkadot/types';
import { bnToBn, isUndefined } from '@polkadot/util';
@@ -58,7 +58,36 @@ export function getSpecTypes ({ knownTypes }: Registry, chainName: Text | string
return {
...filterVersions(typesSpec[_specName], _specVersion),
...filterVersions(typesChain[_chainName], _specVersion),
...filterVersions(knownTypes.typesBundle?.spec?.[_specName]?.types, _specVersion),
...filterVersions(knownTypes.typesBundle?.chain?.[_chainName]?.types, _specVersion),
...(knownTypes.typesSpec?.[_specName] || {}),
...(knownTypes.typesChain?.[_chainName] || {})
};
}
/**
* @description Based on the chain and runtimeVersion, get the applicable rpc definitions (ready for registration)
*/
export function getSpecRpc ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>> {
const _chainName = chainName.toString();
const _specName = specName.toString();
return {
...(knownTypes.typesBundle?.spec?.[_specName]?.rpc || {}),
...(knownTypes.typesBundle?.chain?.[_chainName]?.rpc || {})
};
}
/**
* @description Based on the chain and runtimeVersion, get the applicable alias definitions (ready for registration)
*/
export function getSpecAlias ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): Record<string, OverrideModuleType> {
const _chainName = chainName.toString();
const _specName = specName.toString();
return {
...(knownTypes.typesAlias || {}),
...(knownTypes.typesBundle?.spec?.[_specName]?.alias || {}),
...(knownTypes.typesBundle?.chain?.[_chainName]?.alias || {})
};
}
+3
View File
@@ -29,6 +29,9 @@ const typesModules: Record<string, OverrideModuleType> = {
parachains: {
Id: 'ParaId'
},
proxy: {
Announcement: 'ProxyAnnouncement'
},
society: {
Judgement: 'SocietyJudgement',
Vote: 'SocietyVote'
@@ -6,27 +6,46 @@ import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
Address: 'GenericAddress',
AnchorData: {
anchoredBlock: 'u64',
docRoot: 'H256',
id: 'H256'
},
Fee: {
key: 'Hash',
price: 'Balance'
},
LookupSource: 'GenericAddress',
MultiAccountData: {
deposit: 'Balance',
depositor: 'AccountId',
signatories: 'Vec<AccountId>',
threshold: 'u16'
},
Multiplier: 'Fixed64',
PreCommitData: {
expirationBlock: 'u64',
identity: 'H256',
signingRoot: 'H256'
},
Proof: {
leafHash: 'H256',
sortedHashes: 'H256'
},
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
};
const versioned: OverrideVersionedType[] = [
{
// most chains started at 1000 (Fulvous at 224)
minmax: [1, 228],
types: {
...sharedTypes,
Address: 'AccountId',
LookupSource: 'AccountId'
}
},
{
minmax: [229, undefined],
types: {
...sharedTypes
...sharedTypes,
ChainId: 'u8',
DepositNonce: 'u64',
ResourceId: '[u8; 32]',
'chainbridge::ChainId': 'u8'
}
}
];
+2
View File
@@ -7,6 +7,7 @@ import { OverrideVersionedType } from '@polkadot/types/types';
import centrifugeChain from './centrifuge-chain';
import kusama from './kusama';
import polkadot from './polkadot';
import rococo from './rococo';
import westend from './westend';
// Type overrides for specific spec types & versions as given in runtimeVersion
@@ -14,6 +15,7 @@ const typesSpec: Record<string, OverrideVersionedType[]> = {
'centrifuge-chain': centrifugeChain,
kusama,
polkadot,
rococo,
westend
};
+9 -1
View File
@@ -20,6 +20,7 @@ const versioned: OverrideVersionedType[] = [
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257',
DispatchError: 'DispatchErrorTo198',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
@@ -38,6 +39,7 @@ const versioned: OverrideVersionedType[] = [
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'Address',
@@ -56,6 +58,7 @@ const versioned: OverrideVersionedType[] = [
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'Address',
@@ -72,6 +75,7 @@ const versioned: OverrideVersionedType[] = [
types: {
// Indices optional, not in transaction
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
@@ -84,6 +88,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [1055, 1056],
types: {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
@@ -95,6 +100,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [1057, 1061],
types: {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
OpenTip: 'OpenTipTo225'
}
@@ -103,13 +109,15 @@ const versioned: OverrideVersionedType[] = [
minmax: [1062, 2012],
types: {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225'
}
},
{
minmax: [2013, undefined],
types: {
...sharedTypes
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257'
}
}
];
+3 -1
View File
@@ -19,13 +19,15 @@ const versioned: OverrideVersionedType[] = [
minmax: [0, 12],
types: {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225'
}
},
{
minmax: [13, undefined],
types: {
...sharedTypes
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257'
}
}
];
+23
View File
@@ -0,0 +1,23 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
};
const versioned: OverrideVersionedType[] = [
{
minmax: [0, undefined],
types: {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257'
}
}
];
export default versioned;
+4 -1
View File
@@ -18,6 +18,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [1, 2],
types: {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
Weight: 'u32'
@@ -27,13 +28,15 @@ const versioned: OverrideVersionedType[] = [
minmax: [3, 22],
types: {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225'
}
},
{
minmax: [23, undefined],
types: {
...sharedTypes
...sharedTypes,
CompactAssignments: 'CompactAssignmentsTo257'
}
}
];
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.25.1",
"version": "1.29.1",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -26,17 +26,17 @@
},
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.10.5",
"@polkadot/metadata": "1.25.1",
"@polkadot/util": "^2.18.1",
"@polkadot/util-crypto": "^2.18.1",
"@babel/runtime": "^7.11.2",
"@polkadot/metadata": "1.29.1",
"@polkadot/util": "^3.2.1",
"@polkadot/util-crypto": "^3.2.1",
"@types/bn.js": "^4.11.6",
"bn.js": "^5.1.2",
"memoizee": "^0.4.14",
"rxjs": "^6.6.0"
"rxjs": "^6.6.2"
},
"devDependencies": {
"@polkadot/keyring": "^2.18.1",
"@polkadot/keyring": "^3.2.1",
"@types/memoizee": "^0.4.4"
}
}
+85 -36
View File
@@ -27,23 +27,24 @@ import { AuthIndex, AuthoritySignature, Heartbeat, HeartbeatTo244, OpaqueMultiad
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 { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
import { AbridgedCandidateReceipt, AttestedCandidate, AuctionIndex, Bidder, CandidateCommitments, CandidateReceipt, CollatorId, CollatorSignature, DoubleVoteReport, DownwardMessage, GlobalValidationSchedule, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, LocalValidationData, NewBidder, ParaId, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParachainDispatchOrigin, Remark, Retriable, Scheduling, SigningContext, SlotRange, Statement, SubId, UpwardMessage, ValidationCode, ValidatorSignature, ValidityAttestation, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { AbridgedCandidateReceipt, AttestedCandidate, AuctionIndex, Bidder, CandidateCommitments, CandidateReceipt, CollatorId, CollatorSignature, DoubleVoteReport, DownwardMessage, GlobalValidationSchedule, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, LocalValidationData, NewBidder, ParaId, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParachainDispatchOrigin, RelayChainBlockNumber, Remark, Retriable, Scheduling, SigningContext, SlotRange, Statement, SubId, UpwardMessage, ValidationCode, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { Approvals } from '@polkadot/types/interfaces/poll';
import { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy';
import { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, ExtrinsicsWeight, Fixed128, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, OpaqueCall, Origin, Pays, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, ProxyType, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H160, H256, H512, Hash, Header, I32F32, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, OpaqueCall, Origin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, U32F32, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, ValidatorCount } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, OffchainAccuracy, PerU16, PhragmenScore, Points, 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, CompactAssignmentsTo257, CompactScore, CompactScoreCompact, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import { AccountInfo, ApplyExtrinsicResult, ChainProperties, ChainType, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount, TransactionValidityError, UnknownTransaction } from '@polkadot/types/interfaces/system';
import { OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { CallHash, Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
declare module '@polkadot/types/types/registry' {
@@ -128,6 +129,50 @@ declare module '@polkadot/types/types/registry' {
Raw: Raw;
'Option<Raw>': Option<Raw>;
'Vec<Raw>': Vec<Raw>;
Fixed64: Fixed64;
'Option<Fixed64>': Option<Fixed64>;
'Vec<Fixed64>': Vec<Fixed64>;
FixedI64: FixedI64;
'Option<FixedI64>': Option<FixedI64>;
'Vec<FixedI64>': Vec<FixedI64>;
FixedU64: FixedU64;
'Option<FixedU64>': Option<FixedU64>;
'Vec<FixedU64>': Vec<FixedU64>;
Fixed128: Fixed128;
'Option<Fixed128>': Option<Fixed128>;
'Vec<Fixed128>': Vec<Fixed128>;
FixedI128: FixedI128;
'Option<FixedI128>': Option<FixedI128>;
'Vec<FixedI128>': Vec<FixedI128>;
FixedU128: FixedU128;
'Option<FixedU128>': Option<FixedU128>;
'Vec<FixedU128>': Vec<FixedU128>;
I32F32: I32F32;
'Option<I32F32>': Option<I32F32>;
'Vec<I32F32>': Vec<I32F32>;
U32F32: U32F32;
'Option<U32F32>': Option<U32F32>;
'Vec<U32F32>': Vec<U32F32>;
PerU16: PerU16;
'Compact<PerU16>': Compact<PerU16>;
'Option<PerU16>': Option<PerU16>;
'Vec<PerU16>': Vec<PerU16>;
Perbill: Perbill;
'Compact<Perbill>': Compact<Perbill>;
'Option<Perbill>': Option<Perbill>;
'Vec<Perbill>': Vec<Perbill>;
Percent: Percent;
'Compact<Percent>': Compact<Percent>;
'Option<Percent>': Option<Percent>;
'Vec<Percent>': Vec<Percent>;
Permill: Permill;
'Compact<Permill>': Compact<Permill>;
'Option<Permill>': Option<Permill>;
'Vec<Permill>': Vec<Permill>;
Perquintill: Perquintill;
'Compact<Perquintill>': Compact<Perquintill>;
'Option<Perquintill>': Option<Perquintill>;
'Vec<Perquintill>': Vec<Perquintill>;
AccountId: AccountId;
'Option<AccountId>': Option<AccountId>;
'Vec<AccountId>': Vec<AccountId>;
@@ -161,6 +206,12 @@ declare module '@polkadot/types/types/registry' {
Call: Call;
'Option<Call>': Option<Call>;
'Vec<Call>': Vec<Call>;
CallHash: CallHash;
'Option<CallHash>': Option<CallHash>;
'Vec<CallHash>': Vec<CallHash>;
CallHashOf: CallHashOf;
'Option<CallHashOf>': Option<CallHashOf>;
'Vec<CallHashOf>': Vec<CallHashOf>;
ChangesTrieConfiguration: ChangesTrieConfiguration;
'Option<ChangesTrieConfiguration>': Option<ChangesTrieConfiguration>;
'Vec<ChangesTrieConfiguration>': Vec<ChangesTrieConfiguration>;
@@ -176,12 +227,6 @@ declare module '@polkadot/types/types/registry' {
ExtrinsicsWeight: ExtrinsicsWeight;
'Option<ExtrinsicsWeight>': Option<ExtrinsicsWeight>;
'Vec<ExtrinsicsWeight>': Vec<ExtrinsicsWeight>;
Fixed64: Fixed64;
'Option<Fixed64>': Option<Fixed64>;
'Vec<Fixed64>': Vec<Fixed64>;
Fixed128: Fixed128;
'Option<Fixed128>': Option<Fixed128>;
'Vec<Fixed128>': Vec<Fixed128>;
H160: H160;
'Option<H160>': Option<H160>;
'Vec<H160>': Vec<H160>;
@@ -236,31 +281,12 @@ declare module '@polkadot/types/types/registry' {
Pays: Pays;
'Option<Pays>': Option<Pays>;
'Vec<Pays>': Vec<Pays>;
Perbill: Perbill;
'Compact<Perbill>': Compact<Perbill>;
'Option<Perbill>': Option<Perbill>;
'Vec<Perbill>': Vec<Perbill>;
Percent: Percent;
'Compact<Percent>': Compact<Percent>;
'Option<Percent>': Option<Percent>;
'Vec<Percent>': Vec<Percent>;
Permill: Permill;
'Compact<Permill>': Compact<Permill>;
'Option<Permill>': Option<Permill>;
'Vec<Permill>': Vec<Permill>;
Perquintill: Perquintill;
'Compact<Perquintill>': Compact<Perquintill>;
'Option<Perquintill>': Option<Perquintill>;
'Vec<Perquintill>': Vec<Perquintill>;
Phantom: Phantom;
'Option<Phantom>': Option<Phantom>;
'Vec<Phantom>': Vec<Phantom>;
PhantomData: PhantomData;
'Option<PhantomData>': Option<PhantomData>;
'Vec<PhantomData>': Vec<PhantomData>;
ProxyType: ProxyType;
'Option<ProxyType>': Option<ProxyType>;
'Vec<ProxyType>': Vec<ProxyType>;
Releases: Releases;
'Option<Releases>': Option<Releases>;
'Vec<Releases>': Vec<Releases>;
@@ -789,6 +815,15 @@ declare module '@polkadot/types/types/registry' {
Reporter: Reporter;
'Option<Reporter>': Option<Reporter>;
'Vec<Reporter>': Vec<Reporter>;
ProxyDefinition: ProxyDefinition;
'Option<ProxyDefinition>': Option<ProxyDefinition>;
'Vec<ProxyDefinition>': Vec<ProxyDefinition>;
ProxyType: ProxyType;
'Option<ProxyType>': Option<ProxyType>;
'Vec<ProxyType>': Vec<ProxyType>;
ProxyAnnouncement: ProxyAnnouncement;
'Option<ProxyAnnouncement>': Option<ProxyAnnouncement>;
'Vec<ProxyAnnouncement>': Vec<ProxyAnnouncement>;
ActiveRecovery: ActiveRecovery;
'Option<ActiveRecovery>': Option<ActiveRecovery>;
'Vec<ActiveRecovery>': Vec<ActiveRecovery>;
@@ -884,9 +919,15 @@ declare module '@polkadot/types/types/registry' {
CompactAssignments: CompactAssignments;
'Option<CompactAssignments>': Option<CompactAssignments>;
'Vec<CompactAssignments>': Vec<CompactAssignments>;
CompactAssignmentsTo257: CompactAssignmentsTo257;
'Option<CompactAssignmentsTo257>': Option<CompactAssignmentsTo257>;
'Vec<CompactAssignmentsTo257>': Vec<CompactAssignmentsTo257>;
CompactScore: CompactScore;
'Option<CompactScore>': Option<CompactScore>;
'Vec<CompactScore>': Vec<CompactScore>;
CompactScoreCompact: CompactScoreCompact;
'Option<CompactScoreCompact>': Option<CompactScoreCompact>;
'Vec<CompactScoreCompact>': Vec<CompactScoreCompact>;
ElectionCompute: ElectionCompute;
'Option<ElectionCompute>': Option<ElectionCompute>;
'Vec<ElectionCompute>': Vec<ElectionCompute>;
@@ -934,13 +975,15 @@ declare module '@polkadot/types/types/registry' {
'Compact<NominatorIndex>': Compact<NominatorIndex>;
'Option<NominatorIndex>': Option<NominatorIndex>;
'Vec<NominatorIndex>': Vec<NominatorIndex>;
NominatorIndexCompact: NominatorIndexCompact;
'Option<NominatorIndexCompact>': Option<NominatorIndexCompact>;
'Vec<NominatorIndexCompact>': Vec<NominatorIndexCompact>;
OffchainAccuracy: OffchainAccuracy;
'Option<OffchainAccuracy>': Option<OffchainAccuracy>;
'Vec<OffchainAccuracy>': Vec<OffchainAccuracy>;
PerU16: PerU16;
'Compact<PerU16>': Compact<PerU16>;
'Option<PerU16>': Option<PerU16>;
'Vec<PerU16>': Vec<PerU16>;
OffchainAccuracyCompact: OffchainAccuracyCompact;
'Option<OffchainAccuracyCompact>': Option<OffchainAccuracyCompact>;
'Vec<OffchainAccuracyCompact>': Vec<OffchainAccuracyCompact>;
PhragmenScore: PhragmenScore;
'Option<PhragmenScore>': Option<PhragmenScore>;
'Vec<PhragmenScore>': Vec<PhragmenScore>;
@@ -989,6 +1032,9 @@ declare module '@polkadot/types/types/registry' {
'Compact<ValidatorIndex>': Compact<ValidatorIndex>;
'Option<ValidatorIndex>': Option<ValidatorIndex>;
'Vec<ValidatorIndex>': Vec<ValidatorIndex>;
ValidatorIndexCompact: ValidatorIndexCompact;
'Option<ValidatorIndexCompact>': Option<ValidatorIndexCompact>;
'Vec<ValidatorIndexCompact>': Vec<ValidatorIndexCompact>;
ValidatorPrefs: ValidatorPrefs;
'Option<ValidatorPrefs>': Option<ValidatorPrefs>;
'Vec<ValidatorPrefs>': Vec<ValidatorPrefs>;
@@ -1138,9 +1184,6 @@ declare module '@polkadot/types/types/registry' {
Multiplier: Multiplier;
'Option<Multiplier>': Option<Multiplier>;
'Vec<Multiplier>': Vec<Multiplier>;
CallHash: CallHash;
'Option<CallHash>': Option<CallHash>;
'Vec<CallHash>': Vec<CallHash>;
Multisig: Multisig;
'Option<Multisig>': Option<Multisig>;
'Vec<Multisig>': Vec<Multisig>;
@@ -1239,6 +1282,9 @@ declare module '@polkadot/types/types/registry' {
ParaScheduling: ParaScheduling;
'Option<ParaScheduling>': Option<ParaScheduling>;
'Vec<ParaScheduling>': Vec<ParaScheduling>;
RelayChainBlockNumber: RelayChainBlockNumber;
'Option<RelayChainBlockNumber>': Option<RelayChainBlockNumber>;
'Vec<RelayChainBlockNumber>': Vec<RelayChainBlockNumber>;
Remark: Remark;
'Option<Remark>': Option<Remark>;
'Vec<Remark>': Vec<Remark>;
@@ -1264,6 +1310,9 @@ declare module '@polkadot/types/types/registry' {
UpwardMessage: UpwardMessage;
'Option<UpwardMessage>': Option<UpwardMessage>;
'Vec<UpwardMessage>': Vec<UpwardMessage>;
ValidationFunctionParams: ValidationFunctionParams;
'Option<ValidationFunctionParams>': Option<ValidationFunctionParams>;
'Vec<ValidationFunctionParams>': Vec<ValidationFunctionParams>;
ValidationCode: ValidationCode;
'Option<ValidationCode>': Option<ValidationCode>;
'Vec<ValidationCode>': Vec<ValidationCode>;
+1 -1
View File
@@ -117,7 +117,7 @@ export default class Raw extends Uint8Array implements IU8a {
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/
public toHuman (): AnyJson {
return this.isUtf8
return this.isAscii
? this.toUtf8()
: this.toJSON();
}
@@ -23,6 +23,7 @@ export { default as grandpa } from './grandpa/definitions';
export { default as identity } from './identity/definitions';
export { default as imOnline } from './imOnline/definitions';
export { default as offences } from './offences/definitions';
export { default as proxy } from './proxy/definitions';
export { default as recovery } from './recovery/definitions';
export { default as scheduler } from './scheduler/definitions';
export { default as session } from './session/definitions';
@@ -113,6 +113,7 @@ export default {
ParaScheduling: {
_enum: ['Always', 'Dynamic']
},
RelayChainBlockNumber: 'BlockNumber',
Remark: '[u8; 32]',
Retriable: {
_enum: {
@@ -143,6 +144,11 @@ export default {
origin: 'ParachainDispatchOrigin',
data: 'Vec<u8>'
},
ValidationFunctionParams: {
maxCodeSize: 'u32',
relayChainHeight: 'RelayChainBlockNumber',
codeUpgradeAllowed: 'Option<RelayChainBlockNumber>'
},
ValidationCode: 'Bytes',
ValidatorSignature: 'Signature',
ValidityAttestation: {
@@ -161,6 +161,9 @@ export interface ParaScheduling extends Enum {
readonly isDynamic: boolean;
}
/** @name RelayChainBlockNumber */
export interface RelayChainBlockNumber extends BlockNumber {}
/** @name Remark */
export interface Remark extends U8aFixed {}
@@ -220,6 +223,13 @@ export interface UpwardMessage extends Struct {
/** @name ValidationCode */
export interface ValidationCode extends Bytes {}
/** @name ValidationFunctionParams */
export interface ValidationFunctionParams extends Struct {
readonly maxCodeSize: u32;
readonly relayChainHeight: RelayChainBlockNumber;
readonly codeUpgradeAllowed: Option<RelayChainBlockNumber>;
}
/** @name ValidatorSignature */
export interface ValidatorSignature extends Signature {}
@@ -0,0 +1,27 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// order important in structs... :)
/* eslint-disable sort-keys */
import { Definitions } from '../../types';
export default {
rpc: {},
types: {
ProxyDefinition: {
delegate: 'AccountId',
proxyType: 'ProxyType',
delay: 'BlockNumber'
},
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking']
},
ProxyAnnouncement: {
real: 'AccountId',
callHash: 'Hash',
height: 'BlockNumber'
}
}
} as Definitions;
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types';
@@ -0,0 +1,29 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import { Enum, Struct } from '@polkadot/types/codec';
import { AccountId, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
/** @name ProxyAnnouncement */
export interface ProxyAnnouncement extends Struct {
readonly real: AccountId;
readonly callHash: Hash;
readonly height: BlockNumber;
}
/** @name ProxyDefinition */
export interface ProxyDefinition extends Struct {
readonly delegate: AccountId;
readonly proxyType: ProxyType;
readonly delay: BlockNumber;
}
/** @name ProxyType */
export interface ProxyType extends Enum {
readonly isAny: boolean;
readonly isNonTransfer: boolean;
readonly isGovernance: boolean;
readonly isStaking: boolean;
}
export type PHANTOM_PROXY = 'proxy';
@@ -7,9 +7,26 @@
import { Definitions } from '../../types';
const numberTypes = {
Fixed64: 'Int<64, Fixed64>',
FixedI64: 'Int<64, FixedI64>',
FixedU64: 'UInt<64, FixedU64>',
Fixed128: 'Int<128, Fixed128>',
FixedI128: 'Int<128, FixedI128>',
FixedU128: 'UInt<128, FixedU128>',
I32F32: 'Int<64, I32F32>',
U32F32: 'UInt<64, U32F32>',
PerU16: 'u16',
Perbill: 'u32',
Percent: 'u8',
Permill: 'u32',
Perquintill: 'u64'
};
export default {
rpc: {},
types: {
...numberTypes,
AccountId: 'GenericAccountId',
AccountIdOf: 'AccountId',
AccountIndex: 'GenericAccountIndex',
@@ -20,6 +37,8 @@ export default {
Block: 'GenericBlock',
BlockNumber: 'u32',
Call: 'GenericCall',
CallHash: 'Hash',
CallHashOf: 'CallHash',
ChangesTrieConfiguration: {
digestInterval: 'u32',
digestLevels: 'u32'
@@ -43,8 +62,6 @@ export default {
normal: 'Weight',
operational: 'Weight'
},
Fixed64: 'Int<64, Fixed64>',
Fixed128: 'Int<128, Fixed128>',
H160: '[u8; 20; H160]',
H256: '[u8; 32; H256]',
H512: '[u8; 64; H512]',
@@ -70,15 +87,8 @@ export default {
Pays: {
_enum: ['Yes', 'No']
},
Perbill: 'u32',
Percent: 'u8',
Permill: 'u32',
Perquintill: 'u64',
Phantom: 'Null',
PhantomData: 'Null',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking']
},
Releases: {
_enum: ['V1', 'V2', 'V3', 'V4', 'V5', 'V6', 'V7', 'V8', 'V9', 'V10']
},
+29 -10
View File
@@ -2,9 +2,9 @@
/* eslint-disable */
import { ITuple } from '@polkadot/types/types';
import { Compact, Enum, Int, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { Compact, Enum, Int, Struct, U8aFixed, UInt, Vec } from '@polkadot/types/codec';
import { GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId } from '@polkadot/types/generic';
import { Bytes, DoNotConstruct, Null, StorageKey, u128, u32, u64, u8 } from '@polkadot/types/primitive';
import { Bytes, DoNotConstruct, Null, StorageKey, u128, u16, u32, u64, u8 } from '@polkadot/types/primitive';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { Signature } from '@polkadot/types/interfaces/extrinsics';
@@ -38,6 +38,12 @@ export interface BlockNumber extends u32 {}
/** @name Call */
export interface Call extends GenericCall {}
/** @name CallHash */
export interface CallHash extends Hash {}
/** @name CallHashOf */
export interface CallHashOf extends CallHash {}
/** @name ChangesTrieConfiguration */
export interface ChangesTrieConfiguration extends Struct {
readonly digestInterval: u32;
@@ -85,6 +91,18 @@ export interface Fixed128 extends Int {}
/** @name Fixed64 */
export interface Fixed64 extends Int {}
/** @name FixedI128 */
export interface FixedI128 extends Int {}
/** @name FixedI64 */
export interface FixedI64 extends Int {}
/** @name FixedU128 */
export interface FixedU128 extends UInt {}
/** @name FixedU64 */
export interface FixedU64 extends UInt {}
/** @name H160 */
export interface H160 extends U8aFixed {}
@@ -106,6 +124,9 @@ export interface Header extends Struct {
readonly digest: Digest;
}
/** @name I32F32 */
export interface I32F32 extends Int {}
/** @name Index */
export interface Index extends u32 {}
@@ -157,6 +178,9 @@ export interface Permill extends u32 {}
/** @name Perquintill */
export interface Perquintill extends u64 {}
/** @name PerU16 */
export interface PerU16 extends u16 {}
/** @name Phantom */
export interface Phantom extends Null {}
@@ -166,14 +190,6 @@ export interface PhantomData extends Null {}
/** @name PreRuntime */
export interface PreRuntime extends ITuple<[ConsensusEngineId, Bytes]> {}
/** @name ProxyType */
export interface ProxyType extends Enum {
readonly isAny: boolean;
readonly isNonTransfer: boolean;
readonly isGovernance: boolean;
readonly isStaking: boolean;
}
/** @name Releases */
export interface Releases extends Enum {
readonly isV1: boolean;
@@ -209,6 +225,9 @@ export interface SignedBlock extends Struct {
/** @name StorageData */
export interface StorageData extends Bytes {}
/** @name U32F32 */
export interface U32F32 extends UInt {}
/** @name ValidatorId */
export interface ValidatorId extends AccountId {}
File diff suppressed because one or more lines are too long
@@ -24,6 +24,24 @@ export default {
start: 'Option<Moment>'
},
CompactAssignments: {
votes1: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 0], ValidatorIndexCompact)>',
votes2: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 1], ValidatorIndexCompact)>',
votes3: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 2], ValidatorIndexCompact)>',
votes4: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 3], ValidatorIndexCompact)>',
votes5: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 4], ValidatorIndexCompact)>',
votes6: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 5], ValidatorIndexCompact)>',
votes7: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 6], ValidatorIndexCompact)>',
votes8: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 7], ValidatorIndexCompact)>',
votes9: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 8], ValidatorIndexCompact)>',
votes10: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 9], ValidatorIndexCompact)>',
votes11: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 10], ValidatorIndexCompact)>',
votes12: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 11], ValidatorIndexCompact)>',
votes13: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 12], ValidatorIndexCompact)>',
votes14: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 13], ValidatorIndexCompact)>',
votes15: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 14], ValidatorIndexCompact)>',
votes16: 'Vec<(NominatorIndexCompact, [CompactScoreCompact; 15], ValidatorIndexCompact)>'
},
CompactAssignmentsTo257: {
votes1: 'Vec<(NominatorIndex, [CompactScore; 0], ValidatorIndex)>',
votes2: 'Vec<(NominatorIndex, [CompactScore; 1], ValidatorIndex)>',
votes3: 'Vec<(NominatorIndex, [CompactScore; 2], ValidatorIndex)>',
@@ -42,6 +60,7 @@ export default {
votes16: 'Vec<(NominatorIndex, [CompactScore; 15], ValidatorIndex)>'
},
CompactScore: '(ValidatorIndex, OffchainAccuracy)',
CompactScoreCompact: '(ValidatorIndexCompact, OffchainAccuracyCompact)',
ElectionCompute: {
_enum: ['OnChain', 'Signed', 'Authority']
},
@@ -96,8 +115,9 @@ export default {
suppressed: 'bool'
},
NominatorIndex: 'u32',
NominatorIndexCompact: 'Compact<NominatorIndex>',
OffchainAccuracy: 'PerU16',
PerU16: 'u16',
OffchainAccuracyCompact: 'Compact<OffchainAccuracy>',
PhragmenScore: '[u128; 3]',
Points: 'u32',
RewardDestination: {
@@ -162,6 +182,7 @@ export default {
era: 'Compact<BlockNumber>'
},
ValidatorIndex: 'u16',
ValidatorIndexCompact: 'Compact<ValidatorIndex>',
ValidatorPrefs: {
commission: 'Compact<Perbill>'
},
+32 -3
View File
@@ -4,7 +4,7 @@
import { ITuple } from '@polkadot/types/types';
import { BTreeMap, Compact, Enum, Option, Struct, Vec } from '@polkadot/types/codec';
import { bool, u128, u16, u32 } from '@polkadot/types/primitive';
import { AccountId, Balance, BlockNumber, Moment, Perbill } from '@polkadot/types/interfaces/runtime';
import { AccountId, Balance, BlockNumber, Moment, PerU16, Perbill } from '@polkadot/types/interfaces/runtime';
/** @name ActiveEraInfo */
export interface ActiveEraInfo extends Struct {
@@ -14,6 +14,26 @@ export interface ActiveEraInfo extends Struct {
/** @name CompactAssignments */
export interface CompactAssignments extends Struct {
readonly votes1: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes2: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes3: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes4: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes5: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes6: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes7: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes8: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes9: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes10: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes11: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes12: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes13: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes14: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes15: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
readonly votes16: Vec<ITuple<[NominatorIndexCompact, Vec<CompactScoreCompact>, ValidatorIndexCompact]>>;
}
/** @name CompactAssignmentsTo257 */
export interface CompactAssignmentsTo257 extends Struct {
readonly votes1: Vec<ITuple<[NominatorIndex, Vec<CompactScore>, ValidatorIndex]>>;
readonly votes2: Vec<ITuple<[NominatorIndex, Vec<CompactScore>, ValidatorIndex]>>;
readonly votes3: Vec<ITuple<[NominatorIndex, Vec<CompactScore>, ValidatorIndex]>>;
@@ -35,6 +55,9 @@ export interface CompactAssignments extends Struct {
/** @name CompactScore */
export interface CompactScore extends ITuple<[ValidatorIndex, OffchainAccuracy]> {}
/** @name CompactScoreCompact */
export interface CompactScoreCompact extends ITuple<[ValidatorIndexCompact, OffchainAccuracyCompact]> {}
/** @name ElectionCompute */
export interface ElectionCompute extends Enum {
readonly isOnChain: boolean;
@@ -124,11 +147,14 @@ export interface Nominations extends Struct {
/** @name NominatorIndex */
export interface NominatorIndex extends u32 {}
/** @name NominatorIndexCompact */
export interface NominatorIndexCompact extends Compact<NominatorIndex> {}
/** @name OffchainAccuracy */
export interface OffchainAccuracy extends PerU16 {}
/** @name PerU16 */
export interface PerU16 extends u16 {}
/** @name OffchainAccuracyCompact */
export interface OffchainAccuracyCompact extends Compact<OffchainAccuracy> {}
/** @name PhragmenScore */
export interface PhragmenScore extends Vec<u128> {}
@@ -224,6 +250,9 @@ export interface UnlockChunk extends Struct {
/** @name ValidatorIndex */
export interface ValidatorIndex extends u16 {}
/** @name ValidatorIndexCompact */
export interface ValidatorIndexCompact extends Compact<ValidatorIndex> {}
/** @name ValidatorPrefs */
export interface ValidatorPrefs extends Struct {
readonly commission: Compact<Perbill>;
+1
View File
@@ -19,6 +19,7 @@ export * from './grandpa/types';
export * from './identity/types';
export * from './imOnline/types';
export * from './offences/types';
export * from './proxy/types';
export * from './recovery/types';
export * from './scheduler/types';
export * from './session/types';
@@ -10,7 +10,6 @@ import { Definitions } from '../../types';
export default {
rpc: {},
types: {
CallHash: 'H256',
Multisig: {
when: 'Timepoint',
deposit: 'Balance',
@@ -3,10 +3,7 @@
import { Struct, Vec } from '@polkadot/types/codec';
import { u32 } from '@polkadot/types/primitive';
import { AccountId, Balance, BlockNumber, H256 } from '@polkadot/types/interfaces/runtime';
/** @name CallHash */
export interface CallHash extends H256 {}
import { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces/runtime';
/** @name Multisig */
export interface Multisig extends Struct {
+16
View File
@@ -7,6 +7,7 @@ import type BN from 'bn.js';
import { ChainProperties } from '../interfaces/system';
import { CallFunction } from './calls';
import { Codec, Constructor } from './codec';
import { DefinitionRpc, DefinitionRpcSub } from './definitions';
import { AnyJson } from './helpers';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -19,6 +20,17 @@ export interface OverrideVersionedType {
export type OverrideModuleType = Record<string, string>;
export interface OverrideBundleDefinition {
alias?: Record<string, OverrideModuleType>;
rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
types?: OverrideVersionedType[];
}
export interface OverrideBundleType {
chain?: Record<string, OverrideBundleDefinition>;
spec?: Record<string, OverrideBundleDefinition>;
}
export type RegistryTypes = Record<string, Constructor | string | Record<string, string> | { _enum: string[] | Record<string, string | null> } | { _set: Record<string, number> }>;
export interface RegistryMetadataText extends String, Codec {
@@ -97,6 +109,10 @@ export interface RegisteredTypes {
* @description Alias an types, as received via the metadata, to a JS-specific type to avoid conflicts. For instance, you can rename the `Proposal` in the `treasury` module to `TreasuryProposal` as to not have conflicts with the one for democracy.
*/
typesAlias?: Record<string, OverrideModuleType>;
/**
* @description A bundle of types related to chain & spec that is injected based on what the chain contains
*/
typesBundle?: OverrideBundleType;
/**
* @description Additional types that are injected based on the chain we are connecting to. There are keyed by the chain, i.e. `{ 'Kusama CC1': { ... } }`
*/
+2849 -2710
View File
File diff suppressed because it is too large Load Diff