Compare commits

...
80 Commits
Author SHA1 Message Date
Github Actions b6af4b9877 [CI Skip] release/stable 4.4.1
skip-checks: true
2021-04-05 11:30:23 +00:00
Jaco Greeff 3f368e721d 4.4 (#3371)
* 4.4

* CHANGELOG
2021-04-05 13:20:18 +02:00
Github Actions 22b4257636 [CI Skip] release/beta 4.3.2-2
skip-checks: true
2021-04-03 06:15:11 +00:00
Jaco Greeff ca7a631032 Add cumulus ServiceQuality type (#3368) 2021-04-03 08:04:42 +02:00
Github Actions da5bbd17af [CI Skip] release/beta 4.3.2-1
skip-checks: true
2021-03-30 09:52:02 +00:00
Jaco Greeff b58f3f5c3e Multilocation update (X5-X8) (#3362) 2021-03-30 11:42:27 +02:00
Github Actions 8c30194f59 [CI Skip] release/beta 4.3.2-0
skip-checks: true
2021-03-30 09:03:06 +00:00
Jaco Greeff dc9ec37490 Add Polkadot 29 upgrade block (#3361) 2021-03-30 10:53:30 +02:00
Github Actions 5175e77eec [CI Skip] release/stable 4.3.1
skip-checks: true
2021-03-29 09:40:47 +00:00
Jaco Greeff 9553c5467c 4.3 (#3359) 2021-03-29 12:30:49 +03:00
Github Actions a1f07e3274 [CI Skip] release/beta 4.2.2-4
skip-checks: true
2021-03-24 11:04:59 +00:00
Jaco Greeff 58deb2eb14 Session index without staking (#3352)
* Session index without staking

* Fix ordering
2021-03-24 11:55:36 +01:00
Github Actions 83caad7f1b [CI Skip] release/beta 4.2.2-3
skip-checks: true
2021-03-24 10:08:26 +00:00
Jaco Greeff 26c3cc9126 Make council optional with treasury proposals (#3351) 2021-03-24 10:58:03 +01:00
Github Actions 1a231dfb0d [CI Skip] release/beta 4.2.2-2
skip-checks: true
2021-03-23 09:48:48 +00:00
Jaco Greeff 712d0425d0 Update ParaInfo types (#3348) 2021-03-23 10:38:28 +01:00
Github Actions eaa5db517f [CI Skip] release/beta 4.2.2-1
skip-checks: true
2021-03-22 16:12:29 +00:00
Jaco Greeff 88c3850d1b Warn on deprecated contracts interfaces (#3346) 2021-03-22 17:03:49 +01:00
Github Actions 943df72ae9 [CI Skip] release/beta 4.2.2-0
skip-checks: true
2021-03-22 15:58:36 +00:00
Veliko 67ab11a036 Abi constructor takes different parameters (#3347)
The Abi constructor used to take the registry as a parameter, now it takes registry.getChainProperties() and this change introduced hard to debug behaviour
2021-03-22 16:48:15 +01:00
Github Actions c87ef7526b [CI Skip] release/stable 4.2.1
skip-checks: true
2021-03-22 08:39:17 +00:00
Jaco Greeff bccf2d52ad 4.2 (#3344) 2021-03-22 09:29:38 +01:00
Github Actions be6dbdd3e4 [CI Skip] release/beta 4.1.2-8
skip-checks: true
2021-03-21 16:37:49 +00:00
Jaco Greeff 3c34ee9897 Bump metadata (#3343) 2021-03-21 17:27:41 +01:00
Github Actions 9ad97813e3 [CI Skip] release/beta 4.1.2-7
skip-checks: true
2021-03-20 17:28:19 +00:00
Jaco Greeff 028f04e47f Optimize society multi-derive (#3342)
* Optimize society multi-derive

* isVoting flag

* isDefenderVoter
2021-03-20 18:18:49 +01:00
Github Actions 4974c9247f [CI Skip] release/beta 4.1.2-6
skip-checks: true
2021-03-20 10:22:42 +00:00
Jaco Greeff 1ffe6a11bf SignedBlock (justifications field) (#3340) 2021-03-20 11:13:56 +01:00
Github Actions 19699ea445 [CI Skip] release/beta 4.1.2-5
skip-checks: true
2021-03-20 09:11:02 +00:00
Jaco Greeff d98ccfb12a Ensure metadata private fields are not accessed (#3341) 2021-03-20 10:01:03 +01:00
Github Actions 41cb056b0f [CI Skip] release/beta 4.1.2-4
skip-checks: true
2021-03-20 08:10:05 +00:00
Jaco Greeff 48bda0bdea Rococo types (detected, now explicit) (#3339)
* Rococo types (detected, now explicit)

* Bumps
2021-03-20 08:59:57 +01:00
Github Actions 1b393c7b67 [CI Skip] release/beta 4.1.2-3
skip-checks: true
2021-03-18 16:17:51 +00:00
Jaco Greeff f52e518b7b Adjust extended derives with as-defined instances (#3336) 2021-03-18 17:08:18 +01:00
Github Actions 08970cff88 [CI Skip] release/beta 4.1.2-2
skip-checks: true
2021-03-17 08:06:55 +00:00
Jaco Greeff 6d38ca6453 Update .123trigger 2021-03-17 08:57:36 +01:00
Github Actions 60db4bc66b [CI Skip] release/beta 4.1.2-1
skip-checks: true
2021-03-16 13:48:13 +00:00
Jaco Greeff 0661237b28 Bump deps (#3326) 2021-03-16 14:38:17 +01:00
Github Actions 6ccac712a8 [CI Skip] release/beta 4.1.2-0
skip-checks: true
2021-03-16 07:41:09 +00:00
Jaco Greeff 3d4877940c Update .123trigger 2021-03-16 08:31:40 +01:00
VelikoandJaco Greeff 70fc95ef27 Fix contractEvents in ContractSubmittableResult (#3324)
* fix the autoaggregation of contract events 

apparently, the system event for contract emitted events has had its name changed

* fix the autoaggregation of contract events

apparently, the system event for contract emitted events has had its name changed

* Update packages/api-contract/src/base/Contract.ts

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2021-03-15 22:16:35 +01:00
Github Actions 463f65d25c [CI Skip] release/stable 4.1.1
skip-checks: true
2021-03-15 11:51:46 +00:00
Jaco Greeff 09d176c82e 4.1 (#3321) 2021-03-15 12:42:20 +01:00
Github Actions fce96baf3d [CI Skip] release/beta 4.0.4-16
skip-checks: true
2021-03-15 11:18:57 +00:00
Jaco Greeff c6785c533f Use at-block registry/types for derive block/header (#3320)
* Use at-block registry/types for derive block/header

* Also apply to subscribe
2021-03-15 12:08:25 +01:00
Github Actions 64de021149 [CI Skip] release/beta 4.0.4-15
skip-checks: true
2021-03-15 10:13:45 +00:00
Jaco Greeff de9e17a1a0 Add Mmr RPCs (#3318)
* Add Mmr RPCs

* blockHash
2021-03-15 11:03:18 +01:00
Github Actions 987bccea2e [CI Skip] release/beta 4.0.4-14
skip-checks: true
2021-03-15 09:46:29 +00:00
Jaco GreeffandXiliang Chen 1434b86b8f Update to latest Substrate metadata (#3316)
* Update to latest Substrate metadata

* Update contract Schedule

* Update CHANGELOG.md

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

* CHANGELOG

* Updates

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
2021-03-15 10:36:05 +01:00
Github Actions a398b2201f [CI Skip] release/beta 4.0.4-13
skip-checks: true
2021-03-15 08:44:13 +00:00
Jaco Greeff f015837c38 Allow ConsensusEngineId toString with non-ascii (#3315)
* Allow ConsensusEngineId toString with non-ascii

* Add number test
2021-03-15 09:34:16 +01:00
Github Actions 5b51588995 [CI Skip] release/beta 4.0.4-12
skip-checks: true
2021-03-12 15:31:59 +00:00
Jaco Greeff 7383e521e5 Kusama 2029 upgrade block (#3310) 2021-03-12 16:23:41 +01:00
Github Actions b10f05786c [CI Skip] release/beta 4.0.4-11
skip-checks: true
2021-03-11 13:03:32 +00:00
Jaco Greeff a212351528 Re-add old slot types (#3305) 2021-03-11 13:55:11 +01:00
Github Actions 55c01af260 [CI Skip] release/beta 4.0.4-10
skip-checks: true
2021-03-11 07:49:11 +00:00
Jaco Greeff 1cf6ffad2b Updata HostConfig for parachains (#3302) 2021-03-11 08:39:24 +01:00
Github Actions 00d0ab9de1 [CI Skip] release/beta 4.0.4-9
skip-checks: true
2021-03-10 21:27:04 +00:00
Jaco Greeff b38e60a9a7 ValidatorIndex for shared 2021-03-10 22:17:30 +01:00
Github Actions 29f7e46439 [CI Skip] release/beta 4.0.4-8
skip-checks: true
2021-03-10 21:10:51 +00:00
Jaco Greeff fa0add8564 Adjust to new auction types (#3297)
* Adjust to new auction types

* Update BitVec fields, Babe types
2021-03-10 22:00:57 +01:00
Github Actions 5bec38c404 [CI Skip] release/beta 4.0.4-7
skip-checks: true
2021-03-10 16:33:36 +00:00
Jaco Greeff 43b66b6507 Remove createBlueprint (use createContract) (#3300) 2021-03-10 17:24:59 +01:00
Github Actions 7e370b3a23 [CI Skip] release/beta 4.0.4-6
skip-checks: true
2021-03-10 16:06:13 +00:00
Jaco Greeff 2b270a3c9f Fix author extraction (both POW & BABE) (#3299)
* Fix author extaction for Babeb session-end

* Fix extraction from Seal
2021-03-10 16:55:59 +01:00
Github Actions cf0d9a2d3f [CI Skip] release/beta 4.0.4-5
skip-checks: true
2021-03-09 15:49:41 +00:00
Jaco Greeff 5d70622819 Extend signer payload with any additional extension fields (#3269)
* Extend payload with additional fields

* Extras

* Adjust
2021-03-09 16:38:33 +01:00
Github Actions fcebdb6d6f [CI Skip] release/beta 4.0.4-4
skip-checks: true
2021-03-09 15:28:51 +00:00
Jaco Greeff 3d020b5159 Check types against fallbacks (#3293)
* Check types against fallbacks

* Only enable fallback check for latest
2021-03-09 16:17:49 +01:00
Github Actions 530d1bcd03 [CI Skip] release/beta 4.0.4-3
skip-checks: true
2021-03-09 14:48:18 +00:00
Jaco Greeff a4151c2941 Adjust for latest types (#3291) 2021-03-09 15:40:06 +01:00
Github Actions a801d30fb6 [CI Skip] release/beta 4.0.4-2
skip-checks: true
2021-03-09 10:00:17 +00:00
Jaco Greeff 1fe9b605dd Bump substrate metadata (#3289) 2021-03-09 10:49:42 +01:00
Github Actions ecfd822d94 [CI Skip] release/beta 4.0.4-1
skip-checks: true
2021-03-09 09:30:33 +00:00
Jaco Greeff a5e4d68993 Remove jest confix for rxjs (#3288) 2021-03-09 10:20:26 +01:00
Github Actions ca5c002d37 [CI Skip] release/beta 4.0.4-0
skip-checks: true
2021-03-09 08:27:13 +00:00
Jaco Greeff 6e28760da4 Remove explicit RpcCore interface (apply in API itself) (#3284)
* Remove explicit RpcCore interface (apply in API itself)

* Simplify

* Adjust test linting

* casting

* Remove stray eslint

* Re-add enable
2021-03-09 09:17:30 +01:00
Github Actions a253c4edb5 [CI Skip] release/stable 4.0.3
skip-checks: true
2021-03-08 21:20:51 +00:00
Jaco Greeff 7c96525d35 4.0.3 (#3287) 2021-03-08 22:11:42 +01:00
Zeke MostovandJaco Greeff 3f0457efc2 fix: Allow sudo for polkadot indexed proxy enum (#3286)
* fix: Allow sudo for polkadot indexed proxy enum

* Update packages/types-known/src/spec/polkadot.ts

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2021-03-08 22:00:35 +01:00
91 changed files with 2594 additions and 1612 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
26
27
1.4.2
1.6.2
1.11.2
@@ -17,5 +17,5 @@
3.9.2
3.9.3
3.10.2
4.0.2
4.0.2
4.0.3
+73
View File
@@ -1,5 +1,78 @@
# CHANGELOG
## 4.4.1 Apr 5, 2021
Upgrade priority: Low. Recommended with usage with the Rococo testnet.
Changes:
- Add `ServiceQuality` type for Cumulus
- Adjust XCM MultiLocation type (X5 to X8 junctions)
- Add Polkadot 29 upgrade block
## 4.3.1 Mar 29, 2021
Upgrade priority: Low.
Contributed:
- Fix documentation on ABI parameters (Thanks to https://github.com/vminkov)
Changes:
- Warn on usage of deprecated contract interfaces
- Update `ParaInfo` type
- Council should be optional in treasury derives
- Allow extraction of session derives indexes with no staking
## 4.2.1 Mar 22, 2021
Upgrade priority: Low. Recommended when tracking the latest updates from Substrate.
Contributed:
- Fix contract even decoding on Substrate 3 (Thanks to https://github.com/vminkov)
Changes:
- Adjust `Extender{Header, SignedBlock}` types to ensure at-block `Header` types are used
- Explicit definition for new Rococo triple refcount `AccountData` types
- Convert metadata private class fields to ES-private
- Adjust `SignedBlock` type for new `justifications` field
- Optimize society derive for multi accounts
- Bump metadata to latest substrate version
## 4.1.1 Mar 15, 2021
Upgrade priority: Low. Recommended when tracking the latest updates from Substrate.
Changes:
- Fix author extraction for last block in a session
- Expand `SignerPayload` to inject/expose custom signed extensions
- `ConsensusEngineId` formats non-Ascii engines correctly
- Allow `getBlock/Header` derives to use as-at registry (instead of latest)
- Cleanup `RpcCore` augmentation (removing TS warnings on typegen chains)
- Add upgrade block for Kusama 2029
- Ensure that type alias overrides also apply to map keys
- Check type generation against fallbacks (build-time only sanity check)
- Add `mmr_generateProof` RPC
- Align types with latest substrate master
- Apply latest Polkadot auctions/crowdloan/parachains/slots types
## 4.0.3 Mar 8, 2021
Upgrade priority: Low. Recommended if you use the API to sync the full chain, most notably Polkadot.
Contributed:
- Re-add unused historical `SudoBalances` to `ProxyType` (Thanks to https://github.com/emostov)
## 4.0.2 Mar 8, 2021
Upgrade priority: High. Required if you are using 4.0.1 in a Node.js environment.
+4 -3
View File
@@ -3,7 +3,8 @@
const config = require('@polkadot/dev/config/jest.cjs');
module.exports = Object.assign({}, config, {
module.exports = {
...config,
moduleNameMapper: {
'@polkadot/api-(contract|derive)(.*)$': '<rootDir>/packages/api-$1/src/$2',
// eslint-disable-next-line sort-keys
@@ -26,5 +27,5 @@ module.exports = Object.assign({}, config, {
'<rootDir>/packages/types/build',
'<rootDir>/packages/types-known/build'
],
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/|rxjs/_esm5)']
});
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
};
+6 -6
View File
@@ -25,14 +25,14 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.13.8",
"@babel/core": "^7.13.13",
"@babel/register": "^7.13.8",
"@babel/runtime": "^7.13.9",
"@polkadot/dev": "^0.62.5",
"@polkadot/ts": "^0.3.61",
"@babel/runtime": "^7.13.10",
"@polkadot/dev": "^0.62.7",
"@polkadot/ts": "^0.3.62",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.20",
"@types/jest": "^26.0.22",
"copyfiles": "^2.4.1"
},
"version": "4.0.2"
"version": "4.4.1"
}
+1 -1
View File
@@ -8,7 +8,7 @@ import { Abi } from '@polkadot/api-contract';
const wsProvider = new WsProvider(<...Node Url...>);
const api = await ApiPromise.create({ provider: wsProvider });
const abi = new Abi(api.registry, <...JSON ABI...>);
const abi = new Abi(<...JSON ABI...>, api.registry.getChainProperties());
api.tx.contracts
.call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
@@ -16,9 +16,9 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/api": "4.0.2",
"@polkadot/types": "4.0.2",
"@babel/runtime": "^7.13.10",
"@polkadot/api": "4.4.1",
"@polkadot/types": "4.4.1",
"@polkadot/util": "^6.0.5",
"@polkadot/x-rxjs": "^6.0.5",
"bn.js": "^4.11.9"
+14 -22
View File
@@ -3,14 +3,14 @@
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { EventRecord, Hash } from '@polkadot/types/interfaces';
import type { EventRecord } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { MapConstructorExec } from './types';
import { SubmittableResult } from '@polkadot/api';
import { ApiBase } from '@polkadot/api/base';
import { assert, compactAddLength, isFunction, isUndefined, isWasm, stringCamelCase, u8aToU8a } from '@polkadot/util';
import { assert, compactAddLength, isFunction, isUndefined, isWasm, logger, stringCamelCase, u8aToU8a } from '@polkadot/util';
import { blake2AsU8a } from '@polkadot/util-crypto';
import { Abi } from '../Abi';
@@ -20,6 +20,8 @@ import { Blueprint } from './Blueprint';
import { Contract } from './Contract';
import { createBluePrintTx, EMPTY_SALT, encodeSalt } from './util';
const l = logger('Code');
export class CodeSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
public readonly blueprint?: Blueprint<ApiType>;
public readonly contract?: Contract<ApiType>;
@@ -55,18 +57,8 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
});
}
/**
* @description Deploy the code bundle, creating a Blueprint.
* @deprecated Use the `code.tx.<constructor>(...) format to put code and deploy
*/
public createBlueprint (): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> {
return this.api.tx.contracts
.putCode(compactAddLength(this.code))
.withResultTransform((result: ISubmittableResult) =>
new CodeSubmittableResult(result, applyOnEvent(result, ['CodeStored'], ([record]: EventRecord[]) =>
new Blueprint<ApiType>(this.api, this.abi, record.event.data[0] as Hash, this._decorateMethod)
))
);
public get tx (): MapConstructorExec<ApiType> {
return this.#tx;
}
/**
@@ -74,26 +66,26 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
* @deprecated Use the `code.tx.<constructor>(...) format to put code and deploy
*/
public createContract (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> {
return this.#instantiate(constructorOrId, options, params);
}
l.warn('.createContract is deprecated, use code.tx.<constructorName>(...) instead (where code refers to this instance)');
public get tx (): MapConstructorExec<ApiType> {
return this.#tx;
return this.#instantiate(constructorOrId, options, params);
}
#instantiate = (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
return isFunction(this.api.tx.contracts.instantiateWithCode)
? this.#instantiateSingle(constructorOrId, options, params)
: this.#instantiateBatch(constructorOrId, options, params);
? this.#instantiateCurrent(constructorOrId, options, params)
: this.#instantiatePrev(constructorOrId, options, params);
}
#instantiateSingle = (constructorOrId: AbiConstructor | string | number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
#instantiateCurrent = (constructorOrId: AbiConstructor | string | number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
return this.api.tx.contracts
.instantiateWithCode(value, gasLimit, compactAddLength(this.code), this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt))
.withResultTransform(this.#transformEvents);
}
#instantiateBatch = (constructorOrId: AbiConstructor | string | number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
#instantiatePrev = (constructorOrId: AbiConstructor | string | number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
assert(isFunction(this.api.tx.utility?.batch), 'Your chain does not include the utility pallet, for contracts v2 deployment, this is required');
const encodedSalt = encodeSalt(salt);
const withSalt = this.api.tx.contracts.instantiate.meta.args.length === 5;
const encoded = this.abi.findConstructor(constructorOrId).toU8a(params, withSalt ? EMPTY_SALT : encodedSalt);
+11 -6
View File
@@ -23,6 +23,7 @@ import { Base } from './Base';
// As per Rust, 5 * GAS_PER_SEC
const MAX_CALL_GAS = new BN(5_000_000_000_000).subn(1);
const ERROR_NO_CALL = 'Your node does not expose the contracts.call RPC. This is most probably due to a runtime configuration.';
const l = logger('Contract');
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: CodecArg[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
@@ -39,11 +40,14 @@ function createTx <ApiType extends ApiTypes> (fn: (options: ContractOptions, par
: fn(...extractOptions(options, params));
}
function createWithId <T> (fn: (messageOrId: AbiMessage | string | number, options: ContractOptions, params: CodecArg[]) => T): ContractGeneric<ContractOptions, T> {
return (messageOrId: AbiMessage | string | number, options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): T =>
isOptions(options)
function createWithId <T> (fn: (messageOrId: AbiMessage | string | number, options: ContractOptions, params: CodecArg[]) => T, warn?: string): ContractGeneric<ContractOptions, T> {
return (messageOrId: AbiMessage | string | number, options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): T => {
warn && l.warn(warn);
return isOptions(options)
? fn(messageOrId, options, params)
: fn(messageOrId, ...extractOptions(options, params));
};
}
export class ContractSubmittableResult extends SubmittableResult {
@@ -109,8 +113,8 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
super(api, abi, decorateMethod);
this.address = this.registry.createType('AccountId', address);
this.exec = createWithId(this.#exec);
this.read = createWithId(this.#read);
this.exec = createWithId(this.#exec, '.exec is deprecated, use contract.tx.<messageName>(...) instead (where contract refers to this instance)');
this.read = createWithId(this.#read, '.read is deprecated, use contract.query.<messageName>(...) instead (where contract refers to this instance)');
this.abi.messages.forEach((m): void => {
const messageName = stringCamelCase(m.identifier);
@@ -156,7 +160,8 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
return this.api.tx.contracts
.call(this.address, value, this.#getGas(gasLimit), this.abi.findMessage(messageOrId).toU8a(params))
.withResultTransform((result: ISubmittableResult) =>
new ContractSubmittableResult(result, applyOnEvent(result, ['ContractExecution'], (records: EventRecord[]) =>
// ContractEmitted is the current generation, ContractExecution is the previous generation
new ContractSubmittableResult(result, applyOnEvent(result, ['ContractEmitted', 'ContractExecution'], (records: EventRecord[]) =>
records
.map(({ event: { data: [, data] } }): DecodedEvent | null => {
try {
@@ -37,7 +37,9 @@ async function checkContract (api: ApiPromise, pairs: TestKeyringMap): Promise<v
}
async function main (): Promise<void> {
const api = await ApiPromise.create();
const api = await ApiPromise.create({
hasher: (data: Uint8Array): Uint8Array => data
});
const pairs = createTestPairs();
// eslint-disable-next-line @typescript-eslint/no-floating-promises
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/api-contract', version: '4.4.1' };
+1 -1
View File
@@ -12,7 +12,7 @@ import BN from 'bn.js';
import { createTypeUnsafe } from '@polkadot/types/create';
import { isBigInt, isBn, isNumber, isString } from '@polkadot/util';
type ContractEvents = 'CodeStored' | 'ContractExecution' | 'Instantiated';
type ContractEvents = 'CodeStored' | 'ContractEmitted' | 'ContractExecution' | 'Instantiated';
type TOptions = BlueprintOptions | ContractOptions;
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
@@ -16,10 +16,10 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/api": "4.0.2",
"@polkadot/rpc-core": "4.0.2",
"@polkadot/types": "4.0.2",
"@babel/runtime": "^7.13.10",
"@polkadot/api": "4.4.1",
"@polkadot/rpc-core": "4.4.1",
"@polkadot/types": "4.4.1",
"@polkadot/util": "^6.0.5",
"@polkadot/util-crypto": "^6.0.5",
"@polkadot/x-rxjs": "^6.0.5",
@@ -27,6 +27,6 @@
},
"devDependencies": {
"@polkadot/keyring": "^6.0.5",
"@polkadot/rpc-provider": "4.0.2"
"@polkadot/rpc-provider": "4.4.1"
}
}
+6 -2
View File
@@ -37,12 +37,16 @@ export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observ
return memo(instanceId, (): Observable<DeriveBounties> =>
combineLatest([
bountyBase.bountyCount<BountyIndex>(),
api.query.council ? api.query.council.proposalCount<ProposalIndex>() : of(0)
api.query.council
? api.query.council.proposalCount<ProposalIndex>()
: of(0)
]).pipe(
switchMap(() =>
combineLatest([
bountyBase.bounties.keys<[BountyIndex]>(),
api.derive.council ? api.derive.council.proposals() : of([])
api.derive.council
? api.derive.council.proposals()
: of([])
])
),
switchMap(([keys, proposals]): Observable<Result> => {
+3 -2
View File
@@ -3,11 +3,12 @@
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { SignedBlockExtended } from '../type/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map } from '@polkadot/x-rxjs/operators';
import { SignedBlockExtended } from '../type';
import { createSignedBlockExtended } from '../type';
import { memo } from '../util';
/**
@@ -33,7 +34,7 @@ export function getBlock (instanceId: string, api: ApiInterfaceRx): (hash: Uint8
: of([])
]).pipe(
map(([signedBlock, events, validators]): SignedBlockExtended =>
new SignedBlockExtended(api.registry, signedBlock, events, validators)
createSignedBlockExtended(api.registry, signedBlock, events, validators)
),
catchError((): Observable<undefined> =>
// where rpc.chain.getHeader throws, we will land here - it can happen that
+3 -2
View File
@@ -3,11 +3,12 @@
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { HeaderExtended } from '../type/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { catchError, map } from '@polkadot/x-rxjs/operators';
import { HeaderExtended } from '../type';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
/**
@@ -33,7 +34,7 @@ export function getHeader (instanceId: string, api: ApiInterfaceRx): (hash: Uint
: of([])
]).pipe(
map(([header, validators]): HeaderExtended =>
new HeaderExtended(api.registry, header, validators)
createHeaderExtended(header.registry, header, validators)
),
catchError((): Observable<undefined> =>
// where rpc.chain.getHeader throws, we will land here - it can happen that
@@ -5,12 +5,12 @@ import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { EventRecord, SignedBlock } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { HeaderExtended } from '../type';
import type { HeaderExtended, SignedBlockExtended } from '../type/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { SignedBlockExtended } from '../type';
import { createSignedBlockExtended } from '../type';
import { memo } from '../util';
/**
@@ -30,7 +30,7 @@ export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): ()
);
}),
map(([block, events, header]) =>
new SignedBlockExtended(api.registry, block, events, header.validators)
createSignedBlockExtended(block.registry, block, events, header.validators)
)
)
);
@@ -3,11 +3,12 @@
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { HeaderExtended } from '../type/types';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map } from '@polkadot/x-rxjs/operators';
import { HeaderExtended } from '../type';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
/**
@@ -34,7 +35,7 @@ export function subscribeNewHeads (instanceId: string, api: ApiInterfaceRx): ()
map(([header, validators]): HeaderExtended => {
header.createdAtHash = header.hash;
return new HeaderExtended(api.registry, header, validators);
return createHeaderExtended(header.registry, header, validators);
})
)
);
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/api-derive', version: '4.4.1' };
+24 -9
View File
@@ -13,7 +13,7 @@ import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
// parse into Indexes
function parse ([activeEra, activeEraStart, currentEra, currentIndex, validatorCount]: [EraIndex, Option<Moment>, EraIndex, SessionIndex, u32]): DeriveSessionIndexes {
function parse ([currentIndex, activeEra, activeEraStart, currentEra, validatorCount]: [SessionIndex, EraIndex, Option<Moment>, EraIndex, u32]): DeriveSessionIndexes {
return {
activeEra,
activeEraStart,
@@ -24,42 +24,57 @@ function parse ([activeEra, activeEraStart, currentEra, currentIndex, validatorC
}
// query based on latest
function query (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
return api.queryMulti<[Option<ActiveEraInfo>, Option<EraIndex>, SessionIndex, u32]>([
function queryStaking (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
return api.queryMulti<[SessionIndex, Option<ActiveEraInfo>, Option<EraIndex>, u32]>([
api.query.session.currentIndex,
api.query.staking.activeEra,
api.query.staking.currentEra,
api.query.session.currentIndex,
api.query.staking.validatorCount
]).pipe(
map(([activeOpt, currentEra, currentIndex, validatorCount]): DeriveSessionIndexes => {
map(([currentIndex, activeOpt, currentEra, validatorCount]): DeriveSessionIndexes => {
const { index, start } = activeOpt.unwrapOrDefault();
return parse([
currentIndex,
index,
start,
currentEra.unwrapOrDefault(),
currentIndex,
validatorCount
]);
})
);
}
// query based on latest
function querySession (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
return api.query.session.currentIndex().pipe(
map((currentIndex): DeriveSessionIndexes => parse([
currentIndex,
api.registry.createType('EraIndex'),
api.registry.createType('Option<Moment>'),
api.registry.createType('EraIndex'),
api.registry.createType('u32')
]))
);
}
// empty set when none is available
function empty (api: ApiInterfaceRx): Observable<DeriveSessionIndexes> {
return of(parse([
api.registry.createType('SessionIndex', 1),
api.registry.createType('EraIndex'),
api.registry.createType('Option<Moment>'),
api.registry.createType('EraIndex'),
api.registry.createType('SessionIndex', 1),
api.registry.createType('u32')
]));
}
export function indexes (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSessionIndexes> {
return memo(instanceId, (): Observable<DeriveSessionIndexes> =>
api.query.session && api.query.staking
? query(api)
api.query.session
? api.query.staking
? queryStaking(api)
: querySession(api)
: empty(api)
);
}
+3 -20
View File
@@ -2,9 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { bool, Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSocietyMember } from '../types';
@@ -12,28 +10,13 @@ import { map } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
type Result = [Vec<ITuple<[BlockNumber, Balance]>>, StrikeCount, Option<SocietyVote>, bool, Option<VouchingStatus>];
/**
* @description Get the member info for a society
*/
export function member (instanceId: string, api: ApiInterfaceRx): (accountId: AccountId) => Observable<DeriveSocietyMember> {
return memo(instanceId, (accountId: AccountId): Observable<DeriveSocietyMember> =>
api.queryMulti<Result>([
[api.query.society.payouts, accountId],
[api.query.society.strikes, accountId],
[api.query.society.defenderVotes, accountId],
[api.query.society.suspendedMembers, accountId],
[api.query.society.vouching, accountId]
]).pipe(
map(([payouts, strikes, defenderVotes, suspended, vouching]: Result): DeriveSocietyMember => ({
accountId,
isSuspended: suspended.isTrue,
payouts,
strikes,
vote: defenderVotes.unwrapOr(undefined),
vouching: vouching.unwrapOr(undefined)
}))
api.derive.society._members([accountId]).pipe(
map(([result]) => result)
)
);
}
+33 -10
View File
@@ -2,28 +2,51 @@
// SPDX-License-Identifier: Apache-2.0
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { bool, Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Observable } from '@polkadot/x-rxjs';
import type { DeriveSocietyMember } from '../types';
import { combineLatest } from '@polkadot/x-rxjs';
import { switchMap } from '@polkadot/x-rxjs/operators';
import { combineLatest, of } from '@polkadot/x-rxjs';
import { map, switchMap } from '@polkadot/x-rxjs/operators';
import { memo } from '../util';
type Result = [AccountId[], Vec<ITuple<[BlockNumber, Balance]>>[], StrikeCount[], Option<SocietyVote>[], bool[], Option<VouchingStatus>[]];
export function _members (instanceId: string, api: ApiInterfaceRx): (accountIds: AccountId[]) => Observable<DeriveSocietyMember[]> {
return memo(instanceId, (accountIds: AccountId[]): Observable<DeriveSocietyMember[]> =>
combineLatest<Result>([
of(accountIds),
api.query.society.payouts.multi(accountIds),
api.query.society.strikes.multi(accountIds),
api.query.society.defenderVotes.multi(accountIds),
api.query.society.suspendedMembers.multi(accountIds),
api.query.society.vouching.multi(accountIds)
]).pipe(
map(([accountIds, payouts, strikes, defenderVotes, suspended, vouching]) =>
accountIds.map((accountId, index) => ({
accountId,
isDefenderVoter: defenderVotes[index].isSome,
isSuspended: suspended[index].isTrue,
payouts: payouts[index],
strikes: strikes[index],
vote: defenderVotes[index].unwrapOr(undefined),
vouching: vouching[index].unwrapOr(undefined)
}))
)
)
);
}
/**
* @description Get the member info for a society
*/
export function members (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSocietyMember[]> {
return memo(instanceId, (): Observable<DeriveSocietyMember[]> =>
api.query.society.members<AccountId[]>().pipe(
switchMap((members): Observable<DeriveSocietyMember[]> =>
combineLatest(
members.map((accountId): Observable<DeriveSocietyMember> =>
api.derive.society.member(accountId)
)
)
)
switchMap((members) => api.derive.society._members(members))
)
);
}
@@ -61,7 +61,9 @@ function retrieveProposals (api: ApiInterfaceRx, proposalCount: ProposalIndex, a
return combineLatest([
api.query.treasury.proposals.multi<Option<TreasuryProposal>>(allIds),
api.derive.council.proposals()
api.derive.council
? api.derive.council.proposals()
: of([] as DeriveCollectiveProposal[])
]).pipe(
map(([allProposals, councilProposals]: [Option<TreasuryProposal>[], DeriveCollectiveProposal[]]): DeriveTreasuryProposals =>
parseResult(api, { allIds, allProposals, approvalIds, councilProposals, proposalCount })
+29 -32
View File
@@ -2,44 +2,41 @@
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, Header } from '@polkadot/types/interfaces';
import type { Constructor, Registry } from '@polkadot/types/types';
import { Struct } from '@polkadot/types';
import runtimeTypes from '@polkadot/types/interfaces/runtime/definitions';
import type { Registry } from '@polkadot/types/types';
import type { HeaderExtended } from './types';
import { extractAuthor } from './util';
// We can ignore the properties, added via Struct.with
const _Header = Struct.with(runtimeTypes.types.Header as any) as Constructor<Header>;
export function createHeaderExtended (registry: Registry, header?: Header, validators?: AccountId[]): HeaderExtended {
// an instance of the base extrinsic for us to extend
const HeaderBase = registry.createClass('Header');
/**
* @name HeaderExtended
* @description
* A [[Block]] header with an additional `author` field that indicates the block author
*/
export class HeaderExtended extends _Header {
readonly #author?: AccountId;
readonly #validators?: AccountId[];
class Implementation extends HeaderBase implements HeaderExtended {
readonly #author?: AccountId;
readonly #validators?: AccountId[];
constructor (registry: Registry, header?: Header, validators?: AccountId[]) {
super(registry, header);
constructor (registry: Registry, header?: Header, validators?: AccountId[]) {
super(registry, header);
this.#author = extractAuthor(this.digest, validators);
this.#validators = validators;
this.createdAtHash = header?.createdAtHash;
this.#author = extractAuthor(this.digest, validators);
this.#validators = validators;
this.createdAtHash = header?.createdAtHash;
}
/**
* @description Convenience method, returns the author for the block
*/
public get author (): AccountId | undefined {
return this.#author;
}
/**
* @description Convenience method, returns the validators for the block
*/
public get validators (): AccountId[] | undefined {
return this.#validators;
}
}
/**
* @description Convenience method, returns the author for the block
*/
public get author (): AccountId | undefined {
return this.#author;
}
/**
* @description Convenience method, returns the validators for the block
*/
public get validators (): AccountId[] | undefined {
return this.#validators;
}
return new Implementation(registry, header, validators);
}
@@ -1,24 +1,12 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, DispatchError, DispatchInfo, Event, EventRecord, Extrinsic, SignedBlock } from '@polkadot/types/interfaces';
import type { Constructor, Registry } from '@polkadot/types/types';
import { Struct } from '@polkadot/types';
import runtimeTypes from '@polkadot/types/interfaces/runtime/definitions';
import type { AccountId, DispatchError, DispatchInfo, EventRecord, Extrinsic, SignedBlock } from '@polkadot/types/interfaces';
import type { Registry } from '@polkadot/types/types';
import type { SignedBlockExtended, TxWithEvent } from './types';
import { extractAuthor } from './util';
// We can ignore the properties, added via Struct.with
const _SignedBlock = Struct.with(runtimeTypes.types.SignedBlock as any) as Constructor<SignedBlock>;
interface TxWithEvent {
dispatchError?: DispatchError;
dispatchInfo?: DispatchInfo;
events: Event[];
extrinsic: Extrinsic;
}
function mapExtrinsics (extrinsics: Extrinsic[], records: EventRecord[]): TxWithEvent[] {
return extrinsics.map((extrinsic, index): TxWithEvent => {
let dispatchError: DispatchError | undefined;
@@ -43,43 +31,45 @@ function mapExtrinsics (extrinsics: Extrinsic[], records: EventRecord[]): TxWith
});
}
/**
* @name SignedBlockExtended
* @description
* A [[Block]] header with an additional `author` field that indicates the block author
*/
export class SignedBlockExtended extends _SignedBlock {
readonly #author?: AccountId;
readonly #events: EventRecord[];
readonly #extrinsics: TxWithEvent[];
export function createSignedBlockExtended (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[]): SignedBlockExtended {
// an instance of the base extrinsic for us to extend
const SignedBlockBase = registry.createClass('SignedBlock');
constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[]) {
super(registry, block);
class Implementation extends SignedBlockBase implements SignedBlockExtended {
readonly #author?: AccountId;
readonly #events: EventRecord[];
readonly #extrinsics: TxWithEvent[];
this.#author = extractAuthor(this.block.header.digest, validators);
this.#events = events || ([] as EventRecord[]);
this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events);
this.createdAtHash = block?.createdAtHash;
constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[]) {
super(registry, block);
this.#author = extractAuthor(this.block.header.digest, validators);
this.#events = events || ([] as EventRecord[]);
this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events);
this.createdAtHash = block?.createdAtHash;
}
/**
* @description Convenience method, returns the author for the block
*/
public get author (): AccountId | undefined {
return this.#author;
}
/**
* @description Convenience method, returns the events associated with the block
*/
public get events (): EventRecord[] {
return this.#events;
}
/**
* @description Returns the extrinsics and their events, mapped
*/
public get extrinsics (): TxWithEvent[] {
return this.#extrinsics;
}
}
/**
* @description Convenience method, returns the author for the block
*/
public get author (): AccountId | undefined {
return this.#author;
}
/**
* @description Convenience method, returns the events associated with the block
*/
public get events (): EventRecord[] {
return this.#events;
}
/**
* @description Returns the extrinsics and their events, mapped
*/
public get extrinsics (): TxWithEvent[] {
return this.#extrinsics;
}
return new Implementation(registry, block, events, validators);
}
+2 -2
View File
@@ -1,5 +1,5 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export { HeaderExtended } from './HeaderExtended';
export { SignedBlockExtended } from './SignedBlockExtended';
export { createHeaderExtended } from './HeaderExtended';
export { createSignedBlockExtended } from './SignedBlockExtended';
+22
View File
@@ -0,0 +1,22 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, DispatchError, DispatchInfo, Event, EventRecord, Extrinsic, Header, SignedBlock } from '@polkadot/types/interfaces';
export interface HeaderExtended extends Header {
readonly author: AccountId | undefined;
readonly validators: AccountId[] | undefined;
}
export interface SignedBlockExtended extends SignedBlock {
readonly author: AccountId | undefined;
readonly events: EventRecord[];
readonly extrinsics: TxWithEvent[];
}
export interface TxWithEvent {
dispatchError?: DispatchError;
dispatchInfo?: DispatchInfo;
events: Event[];
extrinsic: Extrinsic;
}
+32 -9
View File
@@ -5,20 +5,43 @@ import type { AccountId, Digest } from '@polkadot/types/interfaces';
export function extractAuthor (digest: Digest, sessionValidators: AccountId[] = []): AccountId | undefined {
const [citem] = digest.logs.filter(({ type }) => type === 'Consensus');
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
const [sitem] = digest.logs.filter(({ type }) => type === 'Seal');
if (citem) {
const [engine, data] = citem.asConsensus;
let accountId: AccountId | undefined;
return engine.extractAuthor(data, sessionValidators);
} else {
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
if (pitem) {
// This is critical to be first for BABE (before Consensus)
// If not first, we end up dropping the author at session-end
if (pitem) {
try {
const [engine, data] = pitem.asPreRuntime;
return engine.extractAuthor(data, sessionValidators);
accountId = engine.extractAuthor(data, sessionValidators);
} catch {
// ignore
}
}
return undefined;
if (!accountId && citem) {
try {
const [engine, data] = citem.asConsensus;
accountId = engine.extractAuthor(data, sessionValidators);
} catch {
// ignore
}
}
// SEAL, still used in e.g. Kulupu for pow
if (!accountId && sitem) {
try {
const [engine, data] = sitem.asSeal;
accountId = engine.extractAuthor(data, sessionValidators);
} catch {
// ignore
}
}
return accountId;
}
+2
View File
@@ -12,6 +12,7 @@ export * from './elections/types';
export * from './parachains/types';
export * from './session/types';
export * from './staking/types';
export * from './type/types';
export interface DeriveBalancesAccountData {
freeBalance: Balance;
@@ -107,6 +108,7 @@ export interface DeriveSocietyCandidate {
export interface DeriveSocietyMember {
accountId: AccountId;
isDefenderVoter: boolean;
isSuspended: boolean;
payouts: [BlockNumber, Balance][];
strikes: StrikeCount;
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
@@ -16,14 +16,14 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/api-derive": "4.0.2",
"@babel/runtime": "^7.13.10",
"@polkadot/api-derive": "4.4.1",
"@polkadot/keyring": "^6.0.5",
"@polkadot/metadata": "4.0.2",
"@polkadot/rpc-core": "4.0.2",
"@polkadot/rpc-provider": "4.0.2",
"@polkadot/types": "4.0.2",
"@polkadot/types-known": "4.0.2",
"@polkadot/metadata": "4.4.1",
"@polkadot/rpc-core": "4.4.1",
"@polkadot/rpc-provider": "4.4.1",
"@polkadot/types": "4.4.1",
"@polkadot/types-known": "4.4.1",
"@polkadot/util": "^6.0.5",
"@polkadot/util-crypto": "^6.0.5",
"@polkadot/x-rxjs": "^6.0.5",
+64 -28
View File
@@ -16,11 +16,9 @@ declare module '@polkadot/api/types/consts' {
babe: {
[key: string]: Codec;
/**
* The number of **slots** that an epoch takes. We couple sessions to
* epochs, i.e. we start a new session once the new epoch begins.
* NOTE: Currently it is not possible to change the epoch duration
* after the chain has started. Attempting to do so will brick block
* production.
* The amount of time, in slots, that each epoch should last.
* NOTE: Currently it is not possible to change the epoch duration after
* the chain has started. Attempting to do so will brick block production.
**/
epochDuration: u64 & AugmentedConst<ApiType>;
/**
@@ -210,6 +208,52 @@ declare module '@polkadot/api/types/consts' {
votingBondBase: BalanceOf & AugmentedConst<ApiType>;
votingBondFactor: BalanceOf & AugmentedConst<ApiType>;
};
gilt: {
[key: string]: Codec;
/**
* Portion of the queue which is free from ordering and just a FIFO.
*
* Must be no greater than `MaxQueueLen`.
**/
fifoQueueLen: u32 & AugmentedConst<ApiType>;
/**
* The number of blocks between consecutive attempts to issue more gilts in an effort to
* get to the target amount to be frozen.
*
* A larger value results in fewer storage hits each block, but a slower period to get to
* the target.
**/
intakePeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* The maximum amount of bids that can be turned into issued gilts each block. A larger
* value here means less of the block available for transactions should there be a glut of
* bids to make into gilts to reach the target.
**/
maxIntakeBids: u32 & AugmentedConst<ApiType>;
/**
* Maximum number of items that may be in each duration queue.
**/
maxQueueLen: u32 & AugmentedConst<ApiType>;
/**
* The minimum amount of funds that may be offered to freeze for a gilt. Note that this
* does not actually limit the amount which may be frozen in a gilt since gilts may be
* split up in order to satisfy the desired amount of funds under gilts.
*
* It should be at least big enough to ensure that there is no possible storage spam attack
* or queue-filling attack.
**/
minFreeze: BalanceOf & AugmentedConst<ApiType>;
/**
* The base period for the duration queues. This is the common multiple across all
* supported freezing durations that can be bid upon.
**/
period: BlockNumber & AugmentedConst<ApiType>;
/**
* Number of duration queues in total. This sets the maximum duration supported, which is
* this value multiplied by `Period`.
**/
queueCount: u32 & AugmentedConst<ApiType>;
};
identity: {
[key: string]: Codec;
/**
@@ -272,15 +316,20 @@ declare module '@polkadot/api/types/consts' {
proxy: {
[key: string]: Codec;
/**
* `AnnouncementDepositBase` metadata shadow.
* The base amount of currency needed to reserve for creating an announcement.
*
* This is held when a new storage item holding a `Balance` is created (typically 16 bytes).
**/
announcementDepositBase: BalanceOf & AugmentedConst<ApiType>;
/**
* `AnnouncementDepositFactor` metadata shadow.
* The amount of currency needed per announcement made.
*
* This is held for adding an `AccountId`, `Hash` and `BlockNumber` (typically 68 bytes)
* into a pre-existing storage value.
**/
announcementDepositFactor: BalanceOf & AugmentedConst<ApiType>;
/**
* `MaxPending` metadata shadow.
* The maximum amount of time-delayed announcements that are allowed to be pending.
**/
maxPending: u32 & AugmentedConst<ApiType>;
/**
@@ -289,10 +338,17 @@ declare module '@polkadot/api/types/consts' {
maxProxies: u16 & AugmentedConst<ApiType>;
/**
* The base amount of currency needed to reserve for creating a proxy.
*
* This is held for an additional storage item whose value size is
* `sizeof(Balance)` bytes and whose key size is `sizeof(AccountId)` bytes.
**/
proxyDepositBase: BalanceOf & AugmentedConst<ApiType>;
/**
* The amount of currency needed per proxy added.
*
* This is held for adding 32 bytes plus an instance of `ProxyType` more into a pre-existing
* storage value. Thus, when configuring `ProxyDepositFactor` one should take into account
* `32 + proxy_type.encode().len()` bytes of data.
**/
proxyDepositFactor: BalanceOf & AugmentedConst<ApiType>;
};
@@ -354,22 +410,6 @@ declare module '@polkadot/api/types/consts' {
* Number of eras that staked funds must remain bonded for.
**/
bondingDuration: EraIndex & AugmentedConst<ApiType>;
/**
* The number of blocks before the end of the era from which election submissions are allowed.
*
* Setting this to zero will disable the offchain compute and only on-chain seq-phragmen will
* be used.
*
* This is bounded by being within the last session. Hence, setting it to a value more than the
* length of a session will be pointless.
**/
electionLookahead: BlockNumber & AugmentedConst<ApiType>;
/**
* Maximum number of balancing iterations to run in the offchain submission.
*
* If set to 0, balance_solution will not be executed at all.
**/
maxIterations: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of nominators rewarded for each validator.
*
@@ -377,10 +417,6 @@ declare module '@polkadot/api/types/consts' {
* their reward. This used to limit the i/o cost for the nominator payout.
**/
maxNominatorRewardedPerValidator: u32 & AugmentedConst<ApiType>;
/**
* The threshold of improvement that should be provided for a new solution to be accepted.
**/
minSolutionScoreBump: Perbill & AugmentedConst<ApiType>;
/**
* Number of sessions per era.
**/
+61 -73
View File
@@ -7,18 +7,10 @@ declare module '@polkadot/api/types/errors' {
export interface AugmentedErrors<ApiType> {
assets: {
[key: string]: AugmentedError<ApiType>;
/**
* Transfer amount should be non-zero.
**/
AmountZero: AugmentedError<ApiType>;
/**
* Invalid metadata given.
**/
BadMetadata: AugmentedError<ApiType>;
/**
* Some internal state is broken.
**/
BadState: AugmentedError<ApiType>;
/**
* Invalid witness data given.
**/
@@ -47,22 +39,26 @@ declare module '@polkadot/api/types/errors' {
* The signing account has no permission to do the operation.
**/
NoPermission: AugmentedError<ApiType>;
/**
* No provider reference exists to allow a non-zero balance of a non-self-sufficient asset.
**/
NoProvider: AugmentedError<ApiType>;
/**
* A mint operation lead to an overflow.
**/
Overflow: AugmentedError<ApiType>;
/**
* Attempt to destroy an asset class when non-zombie, reference-bearing accounts exist.
* No approval exists that would allow the transfer.
**/
RefsLeft: AugmentedError<ApiType>;
/**
* Too many zombie accounts in use.
**/
TooManyZombies: AugmentedError<ApiType>;
Unapproved: AugmentedError<ApiType>;
/**
* The given asset ID is unknown.
**/
Unknown: AugmentedError<ApiType>;
/**
* The source account would not survive the transfer and it needs to stay alive.
**/
WouldDie: AugmentedError<ApiType>;
};
authorship: {
[key: string]: AugmentedError<ApiType>;
@@ -95,6 +91,21 @@ declare module '@polkadot/api/types/errors' {
**/
UnclesAlreadySet: AugmentedError<ApiType>;
};
babe: {
[key: string]: AugmentedError<ApiType>;
/**
* A given equivocation report is valid but already previously reported.
**/
DuplicateOffenceReport: AugmentedError<ApiType>;
/**
* An equivocation proof provided as part of an equivocation report is invalid.
**/
InvalidEquivocationProof: AugmentedError<ApiType>;
/**
* A key ownership proof provided as part of an equivocation report is invalid.
**/
InvalidKeyOwnershipProof: AugmentedError<ApiType>;
};
balances: {
[key: string]: AugmentedError<ApiType>;
/**
@@ -585,6 +596,42 @@ declare module '@polkadot/api/types/errors' {
**/
UnableToVote: AugmentedError<ApiType>;
};
gilt: {
[key: string]: AugmentedError<ApiType>;
/**
* The amount of the bid is less than the minimum allowed.
**/
AmountTooSmall: AugmentedError<ApiType>;
/**
* The queue for the bid's duration is full and the amount bid is too low to get in through
* replacing an existing bid.
**/
BidTooLow: AugmentedError<ApiType>;
/**
* The duration is the bid is greater than the number of queues.
**/
DurationTooBig: AugmentedError<ApiType>;
/**
* The duration of the bid is less than one.
**/
DurationTooSmall: AugmentedError<ApiType>;
/**
* Gilt not yet at expiry date.
**/
NotExpired: AugmentedError<ApiType>;
/**
* The given bid for retraction is not found.
**/
NotFound: AugmentedError<ApiType>;
/**
* Not the owner of the gilt.
**/
NotOwner: AugmentedError<ApiType>;
/**
* Gilt index is unknown.
**/
Unknown: AugmentedError<ApiType>;
};
grandpa: {
[key: string]: AugmentedError<ApiType>;
/**
@@ -1000,10 +1047,6 @@ declare module '@polkadot/api/types/errors' {
* A nomination target was supplied that was blocked or otherwise not a validator.
**/
BadTarget: AugmentedError<ApiType>;
/**
* The call is not allowed at the given time due to restrictions of election period.
**/
CallNotAllowed: AugmentedError<ApiType>;
/**
* Duplicate index.
**/
@@ -1060,61 +1103,6 @@ declare module '@polkadot/api/types/errors' {
* Can not rebond without unlocking chunks.
**/
NoUnlockChunk: AugmentedError<ApiType>;
/**
* Error while building the assignment type from the compact. This can happen if an index
* is invalid, or if the weights _overflow_.
**/
OffchainElectionBogusCompact: AugmentedError<ApiType>;
/**
* The submitted result has unknown edges that are not among the presented winners.
**/
OffchainElectionBogusEdge: AugmentedError<ApiType>;
/**
* The election size is invalid.
**/
OffchainElectionBogusElectionSize: AugmentedError<ApiType>;
/**
* One of the submitted nominators has an edge to which they have not voted on chain.
**/
OffchainElectionBogusNomination: AugmentedError<ApiType>;
/**
* One of the submitted nominators is not an active nominator on chain.
**/
OffchainElectionBogusNominator: AugmentedError<ApiType>;
/**
* The claimed score does not match with the one computed from the data.
**/
OffchainElectionBogusScore: AugmentedError<ApiType>;
/**
* A self vote must only be originated from a validator to ONLY themselves.
**/
OffchainElectionBogusSelfVote: AugmentedError<ApiType>;
/**
* One of the submitted winners is not an active candidate on chain (index is out of range
* in snapshot).
**/
OffchainElectionBogusWinner: AugmentedError<ApiType>;
/**
* Incorrect number of winners were presented.
**/
OffchainElectionBogusWinnerCount: AugmentedError<ApiType>;
/**
* The submitted result is received out of the open window.
**/
OffchainElectionEarlySubmission: AugmentedError<ApiType>;
/**
* One of the submitted nominators has an edge which is submitted before the last non-zero
* slash of the target.
**/
OffchainElectionSlashedNomination: AugmentedError<ApiType>;
/**
* The submitted result is not as good as the one stored on chain.
**/
OffchainElectionWeakSubmission: AugmentedError<ApiType>;
/**
* The snapshot data of the current window is missing.
**/
SnapshotUnavailable: AugmentedError<ApiType>;
/**
* Too many nomination targets supplied.
**/
+56 -15
View File
@@ -9,12 +9,13 @@ import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/coll
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
import type { PropIndex, ReferendumIndex } from '@polkadot/types/interfaces/democracy';
import type { VoteThreshold } from '@polkadot/types/interfaces/elections';
import type { ActiveIndex } from '@polkadot/types/interfaces/gilt';
import type { AuthorityList } from '@polkadot/types/interfaces/grandpa';
import type { RegistrarIndex } from '@polkadot/types/interfaces/identity';
import type { CallIndex } from '@polkadot/types/interfaces/lottery';
import type { Kind, OpaqueTimeSlot } from '@polkadot/types/interfaces/offences';
import type { ProxyType } from '@polkadot/types/interfaces/proxy';
import type { AccountId, AccountIndex, AssetId, Balance, BlockNumber, CallHash, Hash, PhantomData } from '@polkadot/types/interfaces/runtime';
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, CallHash, Hash, PhantomData } from '@polkadot/types/interfaces/runtime';
import type { TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { IdentificationTuple, SessionIndex } from '@polkadot/types/interfaces/session';
import type { ElectionCompute, EraIndex } from '@polkadot/types/interfaces/staking';
@@ -27,10 +28,25 @@ declare module '@polkadot/api/types/events' {
export interface AugmentedEvents<ApiType> {
assets: {
[key: string]: AugmentedEvent<ApiType>;
/**
* An approval for account `delegate` was cancelled by `owner`.
* \[id, owner, delegate\]
**/
ApprovalCancelled: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId]>;
/**
* (Additional) funds have been approved for transfer to a destination account.
* \[asset_id, source, delegate, amount\]
**/
ApprovedTransfer: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
/**
* Some asset `asset_id` was frozen. \[asset_id\]
**/
AssetFrozen: AugmentedEvent<ApiType, [AssetId]>;
/**
* An asset has had its attributes changed by the `Force` origin.
* \[id\]
**/
AssetStatusChanged: AugmentedEvent<ApiType, [AssetId]>;
/**
* Some asset `asset_id` was thawed. \[asset_id\]
**/
@@ -51,10 +67,6 @@ declare module '@polkadot/api/types/events' {
* Some asset class was force-created. \[asset_id, owner\]
**/
ForceCreated: AugmentedEvent<ApiType, [AssetId, AccountId]>;
/**
* Some assets was transferred by an admin. \[asset_id, from, to, amount\]
**/
ForceTransferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
/**
* Some account `who` was frozen. \[asset_id, who\]
**/
@@ -64,13 +76,13 @@ declare module '@polkadot/api/types/events' {
**/
Issued: AugmentedEvent<ApiType, [AssetId, AccountId, TAssetBalance]>;
/**
* The maximum amount of zombies allowed has changed. \[asset_id, max_zombies\]
* Metadata has been cleared for an asset. \[asset_id\]
**/
MaxZombiesChanged: AugmentedEvent<ApiType, [AssetId, u32]>;
MetadataCleared: AugmentedEvent<ApiType, [AssetId]>;
/**
* New metadata has been set for an asset. \[asset_id, name, symbol, decimals\]
* New metadata has been set for an asset. \[asset_id, name, symbol, decimals, is_frozen\]
**/
MetadataSet: AugmentedEvent<ApiType, [AssetId, Bytes, Bytes, u8]>;
MetadataSet: AugmentedEvent<ApiType, [AssetId, Bytes, Bytes, u8, bool]>;
/**
* The owner changed \[asset_id, owner\]
**/
@@ -87,6 +99,12 @@ declare module '@polkadot/api/types/events' {
* Some assets were transferred. \[asset_id, from, to, amount\]
**/
Transferred: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, TAssetBalance]>;
/**
* An `amount` was transferred in its entirety from `owner` to `destination` by
* the approved `delegate`.
* \[id, owner, delegate, destination\]
**/
TransferredApproved: AugmentedEvent<ApiType, [AssetId, AccountId, AccountId, AccountId, TAssetBalance]>;
};
balances: {
[key: string]: AugmentedEvent<ApiType>;
@@ -415,6 +433,29 @@ declare module '@polkadot/api/types/events' {
**/
SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
};
gilt: {
[key: string]: AugmentedEvent<ApiType>;
/**
* A bid was successfully placed.
* \[ who, amount, duration \]
**/
BidPlaced: AugmentedEvent<ApiType, [AccountId, BalanceOf, u32]>;
/**
* A bid was successfully removed (before being accepted as a gilt).
* \[ who, amount, duration \]
**/
BidRetracted: AugmentedEvent<ApiType, [AccountId, BalanceOf, u32]>;
/**
* A bid was accepted as a gilt. The balance may not be released until expiry.
* \[ index, expiry, who, amount \]
**/
GiltIssued: AugmentedEvent<ApiType, [ActiveIndex, BlockNumber, AccountId, BalanceOf]>;
/**
* An expired gilt has been thawed.
* \[ index, who, original_amount, additional_amount \]
**/
GiltThawed: AugmentedEvent<ApiType, [ActiveIndex, AccountId, BalanceOf, BalanceOf]>;
};
grandpa: {
[key: string]: AugmentedEvent<ApiType>;
/**
@@ -728,13 +769,9 @@ declare module '@polkadot/api/types/events' {
**/
Slash: AugmentedEvent<ApiType, [AccountId, Balance]>;
/**
* A new solution for the upcoming election has been stored. \[compute\]
* A new set of stakers was elected.
**/
SolutionStored: AugmentedEvent<ApiType, [ElectionCompute]>;
/**
* A new set of stakers was elected with the given \[compute\].
**/
StakingElection: AugmentedEvent<ApiType, [ElectionCompute]>;
StakingElection: AugmentedEvent<ApiType, []>;
/**
* An account has unbonded this amount. \[stash, amount\]
**/
@@ -782,6 +819,10 @@ declare module '@polkadot/api/types/events' {
* A new \[account\] was created.
**/
NewAccount: AugmentedEvent<ApiType, [AccountId]>;
/**
* On on-chain remark happened. \[origin, remark_hash\]
**/
Remarked: AugmentedEvent<ApiType, [AccountId, Hash]>;
};
technicalCommittee: {
[key: string]: AugmentedEvent<ApiType>;
+64 -55
View File
@@ -3,15 +3,16 @@
import type { Bytes, Data, Option, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
import type { AssetBalance, AssetDetails, AssetMetadata } from '@polkadot/types/interfaces/assets';
import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDetails, AssetMetadata } from '@polkadot/types/interfaces/assets';
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import type { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
import type { BabeAuthorityWeight, BabeEpochConfiguration, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
import type { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
import type { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
import type { CodeHash, ContractInfo, DeletedContract, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
import type { PreimageStatus, PropIndex, Proposal, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy';
import type { VoteThreshold } from '@polkadot/types/interfaces/elections';
import type { ActiveGilt, ActiveGiltsTotal, ActiveIndex, GiltBid } from '@polkadot/types/interfaces/gilt';
import type { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
import type { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
import type { AuthIndex } from '@polkadot/types/interfaces/imOnline';
@@ -23,7 +24,7 @@ import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber,
import type { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
import type { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import type { ActiveEraInfo, ElectionPhase, ElectionResult, ElectionScore, ElectionStatus, EraIndex, EraRewardPoints, Exposure, Forcing, Nominations, ReadySolution, RewardDestination, RoundSnapshot, SeatHolder, SlashingSpans, SolutionOrSnapshotSize, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs, Voter } from '@polkadot/types/interfaces/staking';
import type { ActiveEraInfo, ElectionPhase, EraIndex, EraRewardPoints, Exposure, Forcing, Nominations, ReadySolution, RewardDestination, RoundSnapshot, SeatHolder, SlashingSpans, SolutionOrSnapshotSize, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs, Voter } from '@polkadot/types/interfaces/staking';
import type { AccountInfo, ConsumedWeight, DigestOf, EventIndex, EventRecord, LastRuntimeUpgradeInfo, Phase } from '@polkadot/types/interfaces/system';
import type { Bounty, BountyIndex, OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
@@ -39,6 +40,11 @@ declare module '@polkadot/api/types/storage' {
* The number of units of assets held by any given account.
**/
account: AugmentedQueryDoubleMap<ApiType, (key1: AssetId | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<AssetBalance>, [AssetId, AccountId]> & QueryableStorageEntry<ApiType, [AssetId, AccountId]>;
/**
* Approved balance transfers. First balance is the amount approved for transfer. Second
* is the amount of `T::Currency` reserved for storing this.
**/
approvals: AugmentedQueryDoubleMap<ApiType, (key1: AssetId | AnyNumber | Uint8Array, key2: AssetApprovalKey | { owner?: any; delegate?: any } | string | Uint8Array) => Observable<Option<AssetApproval>>, [AssetId, AssetApprovalKey]> & QueryableStorageEntry<ApiType, [AssetId, AssetApprovalKey]>;
/**
* Details of an asset.
**/
@@ -79,10 +85,22 @@ declare module '@polkadot/api/types/storage' {
* Current slot number.
**/
currentSlot: AugmentedQuery<ApiType, () => Observable<Slot>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The configuration for the current epoch. Should never be `None` as it is initialized in genesis.
**/
epochConfig: AugmentedQuery<ApiType, () => Observable<Option<BabeEpochConfiguration>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Current epoch index.
**/
epochIndex: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The block numbers when the last and current epoch have started, respectively `N-1` and
* `N`.
* NOTE: We track this is in order to annotate the block number when a given pool of
* entropy was fixed (i.e. it was known to chain observers). Since epochs are defined in
* slots, which may be skipped, the block numbers may not line up with the slot numbers.
**/
epochStart: AugmentedQuery<ApiType, () => Observable<ITuple<[BlockNumber, BlockNumber]>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The slot at which the first epoch actually started. This is 0
* until the first block of the chain.
@@ -106,13 +124,18 @@ declare module '@polkadot/api/types/storage' {
**/
nextAuthorities: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AuthorityId, BabeAuthorityWeight]>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Next epoch configuration, if changed.
* The configuration for the next epoch, `None` if the config will not change
* (you can fallback to `EpochConfig` instead in that case).
**/
nextEpochConfig: AugmentedQuery<ApiType, () => Observable<Option<NextConfigDescriptor>>, []> & QueryableStorageEntry<ApiType, []>;
nextEpochConfig: AugmentedQuery<ApiType, () => Observable<Option<BabeEpochConfiguration>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Next epoch randomness.
**/
nextRandomness: AugmentedQuery<ApiType, () => Observable<Randomness>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Pending epoch configuration change that will be applied when the next epoch is enacted.
**/
pendingEpochConfigChange: AugmentedQuery<ApiType, () => Observable<Option<NextConfigDescriptor>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The epoch randomness for the *current* epoch.
*
@@ -396,6 +419,29 @@ declare module '@polkadot/api/types/storage' {
**/
voting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Voter>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
};
gilt: {
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The currently active gilts, indexed according to the order of creation.
**/
active: AugmentedQuery<ApiType, (arg: ActiveIndex | AnyNumber | Uint8Array) => Observable<Option<ActiveGilt>>, [ActiveIndex]> & QueryableStorageEntry<ApiType, [ActiveIndex]>;
/**
* Information relating to the gilts currently active.
**/
activeTotal: AugmentedQuery<ApiType, () => Observable<ActiveGiltsTotal>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The queues of bids ready to become gilts. Indexed by duration (in `Period`s).
**/
queues: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<GiltBid>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* The totals of items and balances within each queue. Saves a lot of storage reads in the
* case of sparsely packed queues.
*
* The vector is indexed by duration in `Period`s, offset by one, so information on the queue
* whose duration is one `Period` would be storage `0`.
**/
queueTotals: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[u32, BalanceOf]>>>, []> & QueryableStorageEntry<ApiType, []>;
};
grandpa: {
[key: string]: QueryableStorageEntry<ApiType>;
/**
@@ -464,12 +510,17 @@ declare module '@polkadot/api/types/storage' {
**/
authoredBlocks: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>, [SessionIndex, ValidatorId]> & QueryableStorageEntry<ApiType, [SessionIndex, ValidatorId]>;
/**
* The block number after which it's ok to send heartbeats in current session.
* The block number after which it's ok to send heartbeats in the current
* session.
*
* At the beginning of each session we set this to a value that should
* fall roughly in the middle of the session duration.
* The idea is to first wait for the validators to produce a block
* in the current session, so that the heartbeat later on will not be necessary.
* At the beginning of each session we set this to a value that should fall
* roughly in the middle of the session duration. The idea is to first wait for
* the validators to produce a block in the current session, so that the
* heartbeat later on will not be necessary.
*
* This value will only be used as a fallback if we fail to get a proper session
* progress estimate from `NextSessionRotation`, as those estimates should be
* more accurate then the value we calculate for `HeartbeatAfter`.
**/
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -771,13 +822,6 @@ declare module '@polkadot/api/types/storage' {
* The earliest era for which we have a pending, unapplied slash.
**/
earliestUnappliedSlash: AugmentedQuery<ApiType, () => Observable<Option<EraIndex>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Flag to control the execution of the offchain election. When `Open(_)`, we accept
* solutions to be submitted.
*
* TWO_PHASE_NOTE: should be removed once we switch to multi-phase.
**/
eraElectionStatus: AugmentedQuery<ApiType, () => Observable<ElectionStatus>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Rewards for the last `HISTORY_DEPTH` eras.
* If reward hasn't been set or has been removed then 0 reward is returned.
@@ -852,13 +896,6 @@ declare module '@polkadot/api/types/storage' {
* invulnerables) and restricted to testnets.
**/
invulnerables: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* True if the current **planned** session is final. Note that this does not take era
* forcing into account.
*
* TWO_PHASE_NOTE: should be removed once we switch to multi-phase.
**/
isCurrentSessionFinal: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Map from all (unlocked) "controller" accounts to the info regarding the staking.
**/
@@ -879,20 +916,6 @@ declare module '@polkadot/api/types/storage' {
* Where the reward payment should be made. Keyed by stash.
**/
payee: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<RewardDestination>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
/**
* The next validator set. At the end of an era, if this is available (potentially from the
* result of an offchain worker), it is immediately used. Otherwise, the on-chain election
* is executed.
*
* TWO_PHASE_NOTE: should be removed once we switch to multi-phase.
**/
queuedElected: AugmentedQuery<ApiType, () => Observable<Option<ElectionResult>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The score of the current [`QueuedElected`].
*
* TWO_PHASE_NOTE: should be removed once we switch to multi-phase.
**/
queuedScore: AugmentedQuery<ApiType, () => Observable<Option<ElectionScore>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Slashing spans for stash accounts.
**/
@@ -903,20 +926,6 @@ declare module '@polkadot/api/types/storage' {
* The rest of the slashed value is handled by the `Slash`.
**/
slashRewardFraction: AugmentedQuery<ApiType, () => Observable<Perbill>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Snapshot of nominators at the beginning of the current election window. This should only
* have a value when [`EraElectionStatus`] == `ElectionStatus::Open(_)`.
*
* TWO_PHASE_NOTE: should be removed once we switch to multi-phase.
**/
snapshotNominators: AugmentedQuery<ApiType, () => Observable<Option<Vec<AccountId>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Snapshot of validators at the beginning of the current election window. This should only
* have a value when [`EraElectionStatus`] == `ElectionStatus::Open(_)`.
*
* TWO_PHASE_NOTE: should be removed once we switch to multi-phase.
**/
snapshotValidators: AugmentedQuery<ApiType, () => Observable<Option<Vec<AccountId>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Records information about the maximum slash of a stash within a slashing span,
* as well as how much reward has been paid out.
@@ -926,7 +935,7 @@ declare module '@polkadot/api/types/storage' {
* True if network has been upgraded to this version.
* Storage version of the pallet.
*
* This is set to v5.0.0 for new networks.
* This is set to v6.0.0 for new networks.
**/
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -1022,10 +1031,10 @@ declare module '@polkadot/api/types/storage' {
**/
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>, []> & QueryableStorageEntry<ApiType, []>;
/**
* True if we have upgraded so that AccountInfo contains two types of `RefCount`. False
* True if we have upgraded so that AccountInfo contains three types of `RefCount`. False
* (default) if not.
**/
upgradedToDualRefCount: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
upgradedToTripleRefCount: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
/**
* True if we have upgraded so that `type RefCount` is `u32`. False (default) if not.
**/
+8 -1
View File
@@ -14,6 +14,7 @@ import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
@@ -133,7 +134,7 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
/**
* Instructs the manual-seal authorship task to finalize a block
**/
finalizeBlock: AugmentedRpc<(hash: BlockHash | string | Uint8Array, justification?: Justification | string | Uint8Array) => Observable<bool>>;
finalizeBlock: AugmentedRpc<(hash: BlockHash | string | Uint8Array, justification?: Justification) => Observable<bool>>;
};
eth: {
/**
@@ -315,6 +316,12 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
**/
subscribeJustifications: AugmentedRpc<() => Observable<JustificationNotification>>;
};
mmr: {
/**
* Generate MMR proof for given leaf index.
**/
generateProof: AugmentedRpc<(leafIndex: u64 | AnyNumber | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<MmrLeafProof>>;
};
net: {
/**
* Returns true if client is actively listening for network connections. Otherwise false.
+250 -114
View File
@@ -3,22 +3,23 @@
import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u16, u32, u64, u8 } from '@polkadot/types';
import type { AnyNumber, ITuple } from '@polkadot/types/types';
import type { TAssetBalance } from '@polkadot/types/interfaces/assets';
import type { BabeEquivocationProof } from '@polkadot/types/interfaces/babe';
import type { AssetDestroyWitness, TAssetBalance } from '@polkadot/types/interfaces/assets';
import type { BabeEquivocationProof, NextConfigDescriptor } from '@polkadot/types/interfaces/babe';
import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
import type { CodeHash, Schedule } from '@polkadot/types/interfaces/contracts';
import type { AccountVote, Conviction, PropIndex, Proposal, ReferendumIndex } from '@polkadot/types/interfaces/democracy';
import type { Renouncing } from '@polkadot/types/interfaces/elections';
import type { Extrinsic, Signature } from '@polkadot/types/interfaces/extrinsics';
import type { ActiveIndex } from '@polkadot/types/interfaces/gilt';
import type { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/interfaces/grandpa';
import type { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity';
import type { Heartbeat } from '@polkadot/types/interfaces/imOnline';
import type { ProxyType } from '@polkadot/types/interfaces/proxy';
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, Call, CallHashOf, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, Weight } from '@polkadot/types/interfaces/runtime';
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, Call, CallHashOf, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, Perquintill, Weight } from '@polkadot/types/interfaces/runtime';
import type { Period, Priority } from '@polkadot/types/interfaces/scheduler';
import type { Keys } from '@polkadot/types/interfaces/session';
import type { SocietyJudgement } from '@polkadot/types/interfaces/society';
import type { CompactAssignments, ElectionScore, ElectionSize, EraIndex, RawSolution, RewardDestination, SolutionOrSnapshotSize, ValidatorIndex, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
import type { EraIndex, RawSolution, RewardDestination, SolutionOrSnapshotSize, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
import type { Key } from '@polkadot/types/interfaces/system';
import type { BountyIndex } from '@polkadot/types/interfaces/treasury';
import type { Timepoint } from '@polkadot/types/interfaces/utility';
@@ -29,6 +30,29 @@ declare module '@polkadot/api/types/submittable' {
export interface AugmentedSubmittables<ApiType> {
assets: {
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Approve an amount of asset for transfer by a delegated third-party account.
*
* Origin must be Signed.
*
* Ensures that `ApprovalDeposit` worth of `Currency` is reserved from signing account
* for the purpose of holding the approval. If some non-zero amount of assets is already
* approved from signing account to `delegate`, then it is topped up or unreserved to
* meet the right value.
*
* NOTE: The signing account does not need to own `amount` of assets at the point of
* making this call.
*
* - `id`: The identifier of the asset.
* - `delegate`: The account to delegate permission to transfer asset.
* - `amount`: The amount of asset that may be transferred by `delegate`. If there is
* already an approval in place, then this acts additively.
*
* Emits `ApprovedTransfer` on success.
*
* Weight: `O(1)`
**/
approveTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, delegate: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/**
* Reduce the balance of `who` by as much as possible up to `amount` assets of `id`.
*
@@ -47,10 +71,40 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
**/
burn: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/**
* Cancel all of some asset approved for delegated transfer by a third-party account.
*
* Origin must be Signed and there must be an approval in place between signer and
* `delegate`.
*
* Unreserves any deposit previously reserved by `approve_transfer` for the approval.
*
* - `id`: The identifier of the asset.
* - `delegate`: The account delegated permission to transfer asset.
*
* Emits `ApprovalCancelled` on success.
*
* Weight: `O(1)`
**/
cancelApproval: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, delegate: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
/**
* Clear the metadata for an asset.
*
* Origin must be Signed and the sender should be the Owner of the asset `id`.
*
* Any deposit is freed for the asset owner.
*
* - `id`: The identifier of the asset to clear.
*
* Emits `MetadataCleared`.
*
* Weight: `O(1)`
**/
clearMetadata: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>]>;
/**
* Issue a new class of fungible assets from a public origin.
*
* This new asset class has no assets initially.
* This new asset class has no assets initially and its owner is the origin.
*
* The origin must be Signed and the sender must have sufficient funds free.
*
@@ -60,11 +114,8 @@ declare module '@polkadot/api/types/submittable' {
* Parameters:
* - `id`: The identifier of the new asset. This must not be currently in use to identify
* an existing asset.
* - `owner`: The owner of this class of assets. The owner has full superuser permissions
* over this asset, but may later change and configure the permissions using `transfer_ownership`
* and `set_team`.
* - `max_zombies`: The total number of accounts which may hold assets in this class yet
* have no existential deposit.
* - `admin`: The admin of this class of assets. The admin is the initial address of each
* member of the asset class's admin team.
* - `min_balance`: The minimum balance of this new asset that any single account must
* have. If an account's balance is reduced below this, then it collapses to zero.
*
@@ -72,20 +123,79 @@ declare module '@polkadot/api/types/submittable' {
*
* Weight: `O(1)`
**/
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: TAssetBalance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, u32, TAssetBalance]>;
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: TAssetBalance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, TAssetBalance]>;
/**
* Destroy a class of fungible assets owned by the sender.
* Destroy a class of fungible assets.
*
* The origin must be Signed and the sender must be the owner of the asset `id`.
* The origin must conform to `ForceOrigin` or must be Signed and the sender must be the
* owner of the asset `id`.
*
* - `id`: The identifier of the asset to be destroyed. This must identify an existing
* asset.
*
* Emits `Destroyed` event when successful.
*
* Weight: `O(z)` where `z` is the number of zombie accounts.
* Weight: `O(c + p + a)` where:
* - `c = (witness.accounts - witness.sufficients)`
* - `s = witness.sufficients`
* - `a = witness.approvals`
**/
destroy: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, zombiesWitness: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, Compact<u32>]>;
destroy: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, witness: AssetDestroyWitness | { accounts?: any; sufficients?: any; approvals?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, AssetDestroyWitness]>;
/**
* Alter the attributes of a given asset.
*
* Origin must be `ForceOrigin`.
*
* - `id`: The identifier of the asset.
* - `owner`: The new Owner of this asset.
* - `issuer`: The new Issuer of this asset.
* - `admin`: The new Admin of this asset.
* - `freezer`: The new Freezer of this asset.
* - `min_balance`: The minimum balance of this new asset that any single account must
* have. If an account's balance is reduced below this, then it collapses to zero.
* - `is_sufficient`: Whether a non-zero balance of this asset is deposit of sufficient
* value to account for the state bloat associated with its balance storage. If set to
* `true`, then non-zero balances may be stored without a `consumer` reference (and thus
* an ED in the Balances pallet or whatever else is used to control user-account state
* growth).
* - `is_frozen`: Whether this asset class is frozen except for permissioned/admin
* instructions.
*
* Emits `AssetStatusChanged` with the identity of the asset.
*
* Weight: `O(1)`
**/
forceAssetStatus: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, issuer: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, admin: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, freezer: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array, isSufficient: bool | boolean | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, LookupSource, LookupSource, Compact<TAssetBalance>, bool, bool]>;
/**
* Cancel all of some asset approved for delegated transfer by a third-party account.
*
* Origin must be either ForceOrigin or Signed origin with the signer being the Admin
* account of the asset `id`.
*
* Unreserves any deposit previously reserved by `approve_transfer` for the approval.
*
* - `id`: The identifier of the asset.
* - `delegate`: The account delegated permission to transfer asset.
*
* Emits `ApprovalCancelled` on success.
*
* Weight: `O(1)`
**/
forceCancelApproval: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, delegate: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource]>;
/**
* Clear the metadata for an asset.
*
* Origin must be ForceOrigin.
*
* Any deposit is returned.
*
* - `id`: The identifier of the asset to clear.
*
* Emits `MetadataCleared`.
*
* Weight: `O(1)`
**/
forceClearMetadata: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>]>;
/**
* Issue a new class of fungible assets from a privileged origin.
*
@@ -109,20 +219,24 @@ declare module '@polkadot/api/types/submittable' {
*
* Weight: `O(1)`
**/
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<u32>, Compact<TAssetBalance>]>;
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, isSufficient: bool | boolean | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, bool, Compact<TAssetBalance>]>;
/**
* Destroy a class of fungible assets.
* Force the metadata for an asset to some value.
*
* The origin must conform to `ForceOrigin`.
* Origin must be ForceOrigin.
*
* - `id`: The identifier of the asset to be destroyed. This must identify an existing
* asset.
* Any deposit is left alone.
*
* Emits `Destroyed` event when successful.
* - `id`: The identifier of the asset to update.
* - `name`: The user friendly name of this asset. Limited in length by `StringLimit`.
* - `symbol`: The exchange symbol for this asset. Limited in length by `StringLimit`.
* - `decimals`: The number of decimals this asset uses to represent one unit.
*
* Weight: `O(1)`
* Emits `MetadataSet`.
*
* Weight: `O(N + S)` where N and S are the length of the name and symbol respectively.
**/
forceDestroy: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, zombiesWitness: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, Compact<u32>]>;
forceSetMetadata: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, name: Bytes | string | Uint8Array, symbol: Bytes | string | Uint8Array, decimals: u8 | AnyNumber | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, Bytes, Bytes, u8, bool]>;
/**
* Move some assets from one account to another.
*
@@ -185,30 +299,9 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
**/
mint: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/**
* Set the maximum number of zombie accounts for an asset.
*
* Origin must be Signed and the sender should be the Owner of the asset `id`.
*
* Funds of sender are reserved according to the formula:
* `AssetDepositBase + AssetDepositPerZombie * max_zombies` taking into account
* any already reserved funds.
*
* - `id`: The identifier of the asset to update zombie count.
* - `max_zombies`: The new number of zombies allowed for this asset.
*
* Emits `MaxZombiesChanged`.
*
* Weight: `O(1)`
**/
setMaxZombies: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, Compact<u32>]>;
/**
* Set the metadata for an asset.
*
* NOTE: There is no `unset_metadata` call. Simply pass an empty name, symbol,
* and 0 decimals to this function to remove the metadata of an asset and
* return your deposit.
*
* Origin must be Signed and the sender should be the Owner of the asset `id`.
*
* Funds of sender are reserved according to the formula:
@@ -220,7 +313,7 @@ declare module '@polkadot/api/types/submittable' {
* - `symbol`: The exchange symbol for this asset. Limited in length by `StringLimit`.
* - `decimals`: The number of decimals this asset uses to represent one unit.
*
* Emits `MaxZombiesChanged`.
* Emits `MetadataSet`.
*
* Weight: `O(1)`
**/
@@ -286,12 +379,54 @@ declare module '@polkadot/api/types/submittable' {
* of sender; Account pre-existence of `target`.
**/
transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/**
* Transfer some asset balance from a previously delegated account to some third-party
* account.
*
* Origin must be Signed and there must be an approval in place by the `owner` to the
* signer.
*
* If the entire amount approved for transfer is transferred, then any deposit previously
* reserved by `approve_transfer` is unreserved.
*
* - `id`: The identifier of the asset.
* - `owner`: The account which previously approved for a transfer of at least `amount` and
* from which the asset balance will be withdrawn.
* - `destination`: The account to which the asset balance of `amount` will be transferred.
* - `amount`: The amount of assets to transfer.
*
* Emits `TransferredApproved` on success.
*
* Weight: `O(1)`
**/
transferApproved: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, destination: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, Compact<TAssetBalance>]>;
/**
* Move some assets from the sender account to another, keeping the sender account alive.
*
* Origin must be Signed.
*
* - `id`: The identifier of the asset to have some amount transferred.
* - `target`: The account to be credited.
* - `amount`: The amount by which the sender's balance of assets should be reduced and
* `target`'s balance increased. The amount actually transferred may be slightly greater in
* the case that the transfer would otherwise take the sender balance above zero but below
* the minimum balance. Must be greater than zero.
*
* Emits `Transferred` with the actual amount transferred. If this takes the source balance
* to below the minimum for the asset, then the amount transferred is increased to take it
* to zero.
*
* Weight: `O(1)`
* Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status
* of sender; Account pre-existence of `target`.
**/
transferKeepAlive: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/**
* Change the Owner of an asset.
*
* Origin must be Signed and the sender should be the Owner of the asset `id`.
*
* - `id`: The identifier of the asset to be frozen.
* - `id`: The identifier of the asset.
* - `owner`: The new Owner of this asset.
*
* Emits `OwnerChanged`.
@@ -309,6 +444,13 @@ declare module '@polkadot/api/types/submittable' {
};
babe: {
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Plan an epoch config change. The epoch config change is recorded and will be enacted on
* the next call to `enact_epoch_change`. The config will be activated one epoch after.
* Multiple calls to this method will replace any existing planned config change that had
* not been enacted yet.
**/
planConfigChange: AugmentedSubmittable<(config: NextConfigDescriptor | { V0: any } | { V1: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [NextConfigDescriptor]>;
/**
* Report authority equivocation/misbehavior. This method will verify
* the equivocation proof and validate the given key ownership proof
@@ -586,7 +728,10 @@ declare module '@polkadot/api/types/submittable' {
/**
* Updates the schedule for metering contracts.
*
* The schedule must have a greater version than the stored schedule.
* The schedule's version cannot be less than the version of the stored schedule.
* If a schedule does not change the instruction weights the version does not
* need to be increased. Therefore we allow storing a schedule that has the same
* version as the stored one.
**/
updateSchedule: AugmentedSubmittable<(schedule: Schedule | { version?: any; enablePrintln?: any; limits?: any; instructionWeights?: any; hostFnWeights?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Schedule]>;
};
@@ -1187,6 +1332,54 @@ declare module '@polkadot/api/types/submittable' {
**/
vote: AugmentedSubmittable<(votes: Vec<AccountId> | (AccountId | string | Uint8Array)[], value: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId>, Compact<BalanceOf>]>;
};
gilt: {
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Place a bid for a gilt to be issued.
*
* Origin must be Signed, and account must have at least `amount` in free balance.
*
* - `amount`: The amount of the bid; these funds will be reserved. If the bid is
* successfully elevated into an issued gilt, then these funds will continue to be
* reserved until the gilt expires. Must be at least `MinFreeze`.
* - `duration`: The number of periods for which the funds will be locked if the gilt is
* issued. It will expire only after this period has elapsed after the point of issuance.
* Must be greater than 1 and no more than `QueueCount`.
*
* Complexities:
* - `Queues[duration].len()` (just take max).
**/
placeBid: AugmentedSubmittable<(amount: Compact<BalanceOf> | AnyNumber | Uint8Array, duration: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, u32]>;
/**
* Retract a previously placed bid.
*
* Origin must be Signed, and the account should have previously issued a still-active bid
* of `amount` for `duration`.
*
* - `amount`: The amount of the previous bid.
* - `duration`: The duration of the previous bid.
**/
retractBid: AugmentedSubmittable<(amount: Compact<BalanceOf> | AnyNumber | Uint8Array, duration: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, u32]>;
/**
* Set target proportion of gilt-funds.
*
* Origin must be `AdminOrigin`.
*
* - `target`: The target proportion of effective issued funds that should be under gilts
* at any one time.
**/
setTarget: AugmentedSubmittable<(target: Compact<Perquintill> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<Perquintill>]>;
/**
* Remove an active but expired gilt. Reserved funds under gilt are freed and balance is
* adjusted to ensure that the funds grow or shrink to maintain the equivalent proportion
* of effective total issued funds.
*
* Origin must be Signed and the account must be the owner of the gilt of the given index.
*
* - `index`: The index of the gilt to be thawed.
**/
thaw: AugmentedSubmittable<(index: Compact<ActiveIndex> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ActiveIndex>]>;
};
grandpa: {
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
@@ -1905,7 +2098,7 @@ declare module '@polkadot/api/types/submittable' {
**/
proxy: AugmentedSubmittable<(real: AccountId | string | Uint8Array, forceProxyType: Option<ProxyType> | null | object | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId, Option<ProxyType>, Call]>;
/**
* Dispatch the given `call` from an account that the sender is authorised for through
* Dispatch the given `call` from an account that the sender is authorized for through
* `add_proxy`.
*
* Removes any corresponding announcement(s).
@@ -2962,70 +3155,6 @@ declare module '@polkadot/api/types/submittable' {
* # </weight>
**/
setValidatorCount: AugmentedSubmittable<(updated: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
/**
* Submit an election result to the chain. If the solution:
*
* 1. is valid.
* 2. has a better score than a potentially existing solution on chain.
*
* then, it will be _put_ on chain.
*
* A solution consists of two pieces of data:
*
* 1. `winners`: a flat vector of all the winners of the round.
* 2. `assignments`: the compact version of an assignment vector that encodes the edge
* weights.
*
* Both of which may be computed using _phragmen_, or any other algorithm.
*
* Additionally, the submitter must provide:
*
* - The `score` that they claim their solution has.
*
* Both validators and nominators will be represented by indices in the solution. The
* indices should respect the corresponding types ([`ValidatorIndex`] and
* [`NominatorIndex`]). Moreover, they should be valid when used to index into
* [`SnapshotValidators`] and [`SnapshotNominators`]. Any invalid index will cause the
* solution to be rejected. These two storage items are set during the election window and
* may be used to determine the indices.
*
* A solution is valid if:
*
* 0. It is submitted when [`EraElectionStatus`] is `Open`.
* 1. Its claimed score is equal to the score computed on-chain.
* 2. Presents the correct number of winners.
* 3. All indexes must be value according to the snapshot vectors. All edge values must
* also be correct and should not overflow the granularity of the ratio type (i.e. 256
* or billion).
* 4. For each edge, all targets are actually nominated by the voter.
* 5. Has correct self-votes.
*
* A solutions score is consisted of 3 parameters:
*
* 1. `min { support.total }` for each support of a winner. This value should be maximized.
* 2. `sum { support.total }` for each support of a winner. This value should be minimized.
* 3. `sum { support.total^2 }` for each support of a winner. This value should be
* minimized (to ensure less variance)
*
* # <weight>
* The transaction is assumed to be the longest path, a better solution.
* - Initial solution is almost the same.
* - Worse solution is retraced in pre-dispatch-checks which sets its own weight.
* # </weight>
**/
submitElectionSolution: AugmentedSubmittable<(winners: Vec<ValidatorIndex> | (ValidatorIndex | AnyNumber | Uint8Array)[], compact: CompactAssignments | { votes1?: any; votes2?: any; votes3?: any; votes4?: any; votes5?: any; votes6?: any; votes7?: any; votes8?: any; votes9?: any; votes10?: any; votes11?: any; votes12?: any; votes13?: any; votes14?: any; votes15?: any; votes16?: any } | string | Uint8Array, score: ElectionScore, era: EraIndex | AnyNumber | Uint8Array, size: ElectionSize | { validators?: any; nominators?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<ValidatorIndex>, CompactAssignments, ElectionScore, EraIndex, ElectionSize]>;
/**
* Unsigned version of `submit_election_solution`.
*
* Note that this must pass the [`ValidateUnsigned`] check which only allows transactions
* from the local node to be included. In other words, only the block author can include a
* transaction in the block.
*
* # <weight>
* See [`submit_election_solution`].
* # </weight>
**/
submitElectionSolutionUnsigned: AugmentedSubmittable<(winners: Vec<ValidatorIndex> | (ValidatorIndex | AnyNumber | Uint8Array)[], compact: CompactAssignments | { votes1?: any; votes2?: any; votes3?: any; votes4?: any; votes5?: any; votes6?: any; votes7?: any; votes8?: any; votes9?: any; votes10?: any; votes11?: any; votes12?: any; votes13?: any; votes14?: any; votes15?: any; votes16?: any } | string | Uint8Array, score: ElectionScore, era: EraIndex | AnyNumber | Uint8Array, size: ElectionSize | { validators?: any; nominators?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<ValidatorIndex>, CompactAssignments, ElectionScore, EraIndex, ElectionSize]>;
/**
* Schedule a portion of the stash to be unlocked ready for transfer out after the bond
* period ends. If this leaves an amount actively bonded less than
@@ -3207,11 +3336,18 @@ declare module '@polkadot/api/types/submittable' {
*
* # <weight>
* - `O(1)`
* - Base Weight: 0.665 µs, independent of remark length.
* - No DB operations.
* # </weight>
**/
remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/**
* Make some on-chain remark and emit event.
*
* # <weight>
* - `O(b)` where b is the length of the remark.
* - 1 event.
* # </weight>
**/
remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
/**
* Set the new changes trie configuration.
*
+6 -4
View File
@@ -79,7 +79,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
protected _rpc?: DecoratedRpc<ApiType, RpcInterface>;
protected _rpcCore: RpcCore;
protected _rpcCore: RpcCore & RpcInterface;
protected _runtimeChain?: Text;
@@ -136,6 +136,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this.#instanceId = `${++instanceCounter}`;
this.#registry = options.source?.registry || options.registry || new TypeRegistry();
this._rx.registry = this.#registry;
const thisProvider = options.source
? options.source._rpcCore.provider.clone()
@@ -144,10 +145,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this._decorateMethod = decorateMethod;
this._options = options;
this._type = type;
this._rpcCore = new RpcCore(this.#instanceId, this.#registry, thisProvider, this._options.rpc);
// The RPC interface decorates the known interfaces on init
this._rpcCore = new RpcCore(this.#instanceId, this.#registry, thisProvider, this._options.rpc) as (RpcCore & RpcInterface);
this._isConnected = new BehaviorSubject(this._rpcCore.provider.isConnected);
this._rx.hasSubscriptions = this._rpcCore.provider.hasSubscriptions;
this._rx.registry = this.#registry;
}
/**
@@ -281,7 +283,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
});
}
protected _decorateRpc<ApiType extends ApiTypes> (rpc: RpcCore, decorateMethod: DecorateMethod<ApiType>, input: Partial<DecoratedRpc<ApiType, RpcInterface>> = {}): DecoratedRpc<ApiType, RpcInterface> {
protected _decorateRpc<ApiType extends ApiTypes> (rpc: RpcCore & RpcInterface, decorateMethod: DecorateMethod<ApiType>, input: Partial<DecoratedRpc<ApiType, RpcInterface>> = {}): DecoratedRpc<ApiType, RpcInterface> {
return rpc.sections.reduce((out, _sectionName): DecoratedRpc<ApiType, RpcInterface> => {
const sectionName = _sectionName as keyof DecoratedRpc<ApiType, RpcInterface>;
+1 -1
View File
@@ -3,12 +3,12 @@
// Simple non-runnable checks to test type definitions in the editor itself
import type { HeaderExtended } from '@polkadot/api-derive/types';
import type { StorageKey } from '@polkadot/types';
import type { AccountId, Balance, DispatchErrorModule, Event, Header, Index } from '@polkadot/types/interfaces';
import type { AnyTuple, IExtrinsic, IMethod } from '@polkadot/types/types';
import { ApiPromise } from '@polkadot/api';
import { HeaderExtended } from '@polkadot/api-derive';
import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs';
import { createTypeUnsafe, TypeRegistry } from '@polkadot/types/create';
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/api', version: '4.4.1' };
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
@@ -16,9 +16,9 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/types": "4.0.2",
"@polkadot/types-known": "4.0.2",
"@babel/runtime": "^7.13.10",
"@polkadot/types": "4.4.1",
"@polkadot/types-known": "4.4.1",
"@polkadot/util": "^6.0.5",
"@polkadot/util-crypto": "^6.0.5",
"bn.js": "^4.11.9"
+19 -19
View File
@@ -33,18 +33,18 @@ export class MetadataVersioned extends Struct {
}, value as Map<unknown, unknown>);
}
private _assertVersion (version: number): boolean {
#assertVersion = (version: number): boolean => {
assert(this.version <= version, `Cannot convert metadata from v${this.version} to v${version}`);
return this.version === version;
}
};
private _getVersion<T extends MetaMapped, F extends MetaMapped> (version: MetaVersions, fromPrev: (registry: Registry, input: F, metaVersion: number) => T): T {
#getVersion = <T extends MetaMapped, F extends MetaMapped>(version: MetaVersions, fromPrev: (registry: Registry, input: F, metaVersion: number) => T): T => {
const asCurr = `asV${version}` as MetaAsX;
const asPrev = `asV${version - 1}` as MetaAsX;
if (this._assertVersion(version)) {
return this._metadata[asCurr] as T;
if (this.#assertVersion(version)) {
return this.#metadata()[asCurr] as T;
}
if (!this.#converted.has(version)) {
@@ -52,6 +52,13 @@ export class MetadataVersioned extends Struct {
}
return this.#converted.get(version) as T;
};
/**
* @description the metadata wrapped
*/
#metadata = (): MetadataAll => {
return this.get('metadata') as MetadataAll;
}
/**
@@ -68,30 +75,30 @@ export class MetadataVersioned extends Struct {
* @description Returns the wrapped metadata as a V9 object
*/
public get asV9 (): MetadataV9 {
this._assertVersion(9);
this.#assertVersion(9);
return this._metadata.asV9;
return this.#metadata().asV9;
}
/**
* @description Returns the wrapped values as a V10 object
*/
public get asV10 (): MetadataV10 {
return this._getVersion(10, toV10);
return this.#getVersion(10, toV10);
}
/**
* @description Returns the wrapped values as a V11 object
*/
public get asV11 (): MetadataV11 {
return this._getVersion(11, toV11);
return this.#getVersion(11, toV11);
}
/**
* @description Returns the wrapped values as a V12 object
*/
public get asV12 (): MetadataV12 {
return this._getVersion(12, toV12);
return this.#getVersion(12, toV12);
}
/**
@@ -99,7 +106,7 @@ export class MetadataVersioned extends Struct {
*/
public get asLatest (): MetadataLatest {
// This is non-existent & latest - applied here to do the module-specific type conversions
return this._getVersion(13, toLatest);
return this.#getVersion(13, toLatest);
}
/**
@@ -109,18 +116,11 @@ export class MetadataVersioned extends Struct {
return this.get('magicNumber') as MagicNumber;
}
/**
* @description the metadata wrapped
*/
private get _metadata (): MetadataAll {
return this.get('metadata') as MetadataAll;
}
/**
* @description the metadata version this structure represents
*/
public get version (): number {
return this._metadata.index;
return this.#metadata().index;
}
public getUniqTypes (throwError: boolean): string[] {
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/metadata', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/metadata', version: '4.4.1' };
+11 -4
View File
@@ -5,6 +5,7 @@ import type { Codec, Registry } from '@polkadot/types/types';
import type { MetadataInterface } from '../types';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import { assert, hexToU8a, u8aToHex } from '@polkadot/util';
import { Metadata } from '../Metadata';
import { getUniqTypes } from './getUniqTypes';
@@ -47,19 +48,25 @@ export function toLatest<Modules extends Codec> (registry: Registry, version: nu
}
/** @internal */
export function defaultValues (registry: Registry, rpcData: string, withThrow = true): void {
export function defaultValues (registry: Registry, rpcData: string, withThrow = true, withFallbackCheck = false): void {
describe('storage with default values', (): void => {
const metadata = new Metadata(registry, rpcData);
metadata.asLatest.modules.filter(({ storage }): boolean => storage.isSome).forEach((mod): void => {
mod.storage.unwrap().items.forEach(({ fallback, name, type }): void => {
const inner = unwrapStorageType(type);
mod.storage.unwrap().items.forEach(({ fallback, modifier, name, type }): void => {
const inner = unwrapStorageType(type, modifier.isOptional);
const location = `${mod.name.toString()}.${name.toString()}: ${inner}`;
it(`creates default types for ${location}`, (): void => {
expect((): void => {
try {
registry.createType(inner, fallback);
const type = registry.createType(inner, hexToU8a(fallback.toHex()));
if (withFallbackCheck) {
const [hexType, hexOrig] = [u8aToHex(type.toU8a()), u8aToHex(fallback.toU8a(true))];
assert(hexType === hexOrig, `Fallback does not match (${((hexOrig.length - 2) / 2) - ((hexType.length - 2) / 2)} bytes missing): ${hexType} !== ${hexOrig}`);
}
} catch (error) {
const message = `${location}:: ${(error as Error).message}`;
+1 -1
View File
@@ -14,5 +14,5 @@ describe('MetadataV12 (substrate)', (): void => {
toLatest(registry, 12, substrateData);
defaultValues(registry, substrateData);
defaultValues(registry, substrateData, true, true);
});
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+20 -22
View File
@@ -20,22 +20,24 @@ const KNOWN_ORIGINS: Record<string, string> = {
* Find and apply the correct type override
* @internal
**/
function setTypeOverride (sectionTypes: OverrideModuleType, type: Type): void {
const override = Object.keys(sectionTypes).find((aliased) => type.eq(aliased));
function setTypeOverride (sectionTypes: OverrideModuleType, ...types: Type[]): void {
types.forEach((type): void => {
const override = Object.keys(sectionTypes).find((aliased) => type.eq(aliased));
if (override) {
type.setOverride(sectionTypes[override]);
} else {
// FIXME: NOT happy with this approach, but gets over the initial hump cased by (Vec<Announcement>,BalanceOf)
const orig = type.toString();
const alias = Object.entries(sectionTypes).reduce((result: string, [from, to]): string =>
[['<', '>'], ['<', ','], [',', '>'], ['(', ')'], ['(', ','], [',', ','], [',', ')']].reduce((result, [one, two]): string =>
result.replace(`${one}${from}${two}`, `${one}${to}${two}`), result), orig);
if (override) {
type.setOverride(sectionTypes[override]);
} else {
// FIXME: NOT happy with this approach, but gets over the initial hump cased by (Vec<Announcement>,BalanceOf)
const orig = type.toString();
const alias = Object.entries(sectionTypes).reduce((result: string, [from, to]): string =>
[['<', '>'], ['<', ','], [',', '>'], ['(', ')'], ['(', ','], [',', ','], [',', ')']].reduce((result, [one, two]): string =>
result.replace(`${one}${from}${two}`, `${one}${to}${two}`), result), orig);
if (orig !== alias) {
type.setOverride(alias);
if (orig !== alias) {
type.setOverride(alias);
}
}
}
});
}
/**
@@ -81,18 +83,14 @@ function convertEvents (registry: Registry, events: EventMetadataV12[], sectionT
function convertStorage (registry: Registry, { items, prefix }: StorageMetadataV12, sectionTypes: OverrideModuleType): StorageMetadataLatest {
return registry.createType('StorageMetadataLatest', {
items: items.map((s): StorageEntryMetadataLatest => {
let resultType: Type;
if (s.type.isMap) {
resultType = s.type.asMap.value;
} else if (s.type.isDoubleMap) {
resultType = s.type.asDoubleMap.value;
if (s.type.isDoubleMap) {
setTypeOverride(sectionTypes, s.type.asDoubleMap.value, s.type.asDoubleMap.key1, s.type.asDoubleMap.key2);
} else if (s.type.isMap) {
setTypeOverride(sectionTypes, s.type.asMap.value, s.type.asMap.key);
} else {
resultType = s.type.asPlain;
setTypeOverride(sectionTypes, s.type.asPlain);
}
setTypeOverride(sectionTypes, resultType);
return registry.createType('StorageEntryMetadataLatest', s);
}),
prefix
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
@@ -16,10 +16,10 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/metadata": "4.0.2",
"@polkadot/rpc-provider": "4.0.2",
"@polkadot/types": "4.0.2",
"@babel/runtime": "^7.13.10",
"@polkadot/metadata": "4.4.1",
"@polkadot/rpc-provider": "4.4.1",
"@polkadot/types": "4.4.1",
"@polkadot/util": "^6.0.5",
"@polkadot/x-rxjs": "^6.0.5"
},
+4 -2
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { RpcInterface } from '@polkadot/rpc-core/types.jsonrpc';
import { createTestPairs } from '@polkadot/keyring/testingPairs';
import { MockProvider } from '@polkadot/rpc-provider/mock';
import { TypeRegistry } from '@polkadot/types/create';
@@ -9,11 +11,11 @@ import { RpcCore } from '.';
describe('Cached Observables', (): void => {
const registry = new TypeRegistry();
let rpc: RpcCore;
let rpc: RpcCore & RpcInterface;
const keyring = createTestPairs();
beforeEach((): void => {
rpc = new RpcCore('123', registry, new MockProvider(registry));
rpc = new RpcCore('123', registry, new MockProvider(registry)) as (RpcCore & RpcInterface);
});
it('creates a single observable for subscriptions (multiple calls)', (): void => {
+3 -38
View File
@@ -79,7 +79,7 @@ function isTreatAsHex (key: StorageKey): boolean {
* const rpc = new Rpc(provider);
* ```
*/
export class RpcCore implements RpcInterface {
export class RpcCore {
#instanceId: string;
#registryDefault: Registry;
@@ -94,42 +94,6 @@ export class RpcCore implements RpcInterface {
public readonly sections: string[] = [];
// Ok, this is quite horrible - we really should not be using the ! here, but we are actually assigning
// these via the createInterfaces inside the constructor. However... this is not quite visible. The reason
// why we don't do for individual assignments is to allow user-defined RPCs to also be defined
public readonly author!: RpcInterface['author'];
public readonly babe!: RpcInterface['babe'];
public readonly chain!: RpcInterface['chain'];
public readonly childstate!: RpcInterface['childstate'];
public readonly contracts!: RpcInterface['contracts'];
public readonly engine!: RpcInterface['engine'];
public readonly eth!: RpcInterface['eth'];
public readonly grandpa!: RpcInterface['grandpa'];
public readonly net!: RpcInterface['net'];
public readonly offchain!: RpcInterface['offchain'];
public readonly payment!: RpcInterface['payment'];
public readonly rpc!: RpcInterface['rpc'];
public readonly state!: RpcInterface['state'];
public readonly syncstate!: RpcInterface['syncstate'];
public readonly system!: RpcInterface['system'];
public readonly web3!: RpcInterface['web3'];
/**
* @constructor
* Default constructor for the Api Object
@@ -148,6 +112,7 @@ export class RpcCore implements RpcInterface {
// these are the base keys (i.e. part of jsonrpc)
this.sections.push(...sectionNames);
// decorate all interfaces, defined and user on this instance
this.addUserInterfaces(userRpc);
}
@@ -187,7 +152,7 @@ export class RpcCore implements RpcInterface {
this.sections.forEach((sectionName): void => {
(this as Record<string, unknown>)[sectionName as Section] ||= {};
const section = this[sectionName as Section] as Record<string, unknown>;
const section = (this as Record<string, unknown>)[sectionName as Section] as Record<string, unknown>;
Object
.entries({
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.4.1' };
+3 -2
View File
@@ -1,6 +1,7 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { RpcInterface } from '@polkadot/rpc-core/types.jsonrpc';
import type { Observable } from '@polkadot/x-rxjs';
import { MockProvider } from '@polkadot/rpc-provider/mock';
@@ -11,10 +12,10 @@ import { RpcCore } from '.';
describe('replay', (): void => {
const registry = new TypeRegistry();
let rpc: RpcCore;
let rpc: RpcCore & RpcInterface;
beforeEach((): void => {
rpc = new RpcCore('653', registry, new MockProvider(registry));
rpc = new RpcCore('653', registry, new MockProvider(registry)) as (RpcCore & RpcInterface);
});
it('subscribes via the rpc section', (done): void => {
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "Transport providers for the API",
"main": "index.js",
@@ -16,8 +16,8 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/types": "4.0.2",
"@babel/runtime": "^7.13.10",
"@polkadot/types": "4.4.1",
"@polkadot/util": "^6.0.5",
"@polkadot/util-crypto": "^6.0.5",
"@polkadot/x-fetch": "^6.0.5",
@@ -28,8 +28,8 @@
},
"devDependencies": {
"@polkadot/keyring": "^6.0.5",
"@polkadot/metadata": "4.0.2",
"@polkadot/metadata": "4.4.1",
"mock-socket": "^9.0.3",
"nock": "^13.0.10"
"nock": "^13.0.11"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.4.1' };
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "Type generation scripts",
"main": "index.js",
@@ -23,13 +23,13 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"dependencies": {
"@babel/core": "^7.13.8",
"@babel/core": "^7.13.13",
"@babel/register": "^7.13.8",
"@babel/runtime": "^7.13.9",
"@polkadot/api": "4.0.2",
"@polkadot/metadata": "4.0.2",
"@polkadot/rpc-provider": "4.0.2",
"@polkadot/types": "4.0.2",
"@babel/runtime": "^7.13.10",
"@polkadot/api": "4.4.1",
"@polkadot/metadata": "4.4.1",
"@polkadot/rpc-provider": "4.4.1",
"@polkadot/types": "4.4.1",
"@polkadot/util": "^6.0.5",
"handlebars": "^4.7.7",
"websocket": "^1.0.33",
@@ -37,6 +37,6 @@
},
"devDependencies": {
"@types/websocket": "^1.0.2",
"@types/yargs": "^16.0.0"
"@types/yargs": "^16.0.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/typegen', version: '4.4.1' };
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
@@ -16,9 +16,9 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@babel/runtime": "^7.13.10",
"@polkadot/networks": "^6.0.5",
"@polkadot/types": "4.0.2",
"@polkadot/types": "4.4.1",
"@polkadot/util": "^6.0.5",
"bn.js": "^4.11.9"
},
+7 -1
View File
@@ -6,7 +6,10 @@ import type { OverrideModuleType } from '@polkadot/types/types';
// type overrides for modules (where duplication between modules exist)
const typesModules: Record<string, OverrideModuleType> = {
assets: {
Balance: 'TAssetBalance'
Approval: 'AssetApproval',
ApprovalKey: 'AssetApprovalKey',
Balance: 'TAssetBalance',
DestroyWitness: 'AssetDestroyWitness'
},
babe: {
EquivocationProof: 'BabeEquivocationProof'
@@ -57,6 +60,9 @@ const typesModules: Record<string, OverrideModuleType> = {
scheduler: {
ValidatorIndex: 'ParaValidatorIndex'
},
shared: {
ValidatorIndex: 'ParaValidatorIndex'
},
society: {
Judgement: 'SocietyJudgement',
Vote: 'SocietyVote'
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/types-known', version: '4.4.1' };
+1 -1
View File
@@ -16,7 +16,7 @@ const sharedTypes = {
NonTransfer: 1,
Governance: 2,
Staking: 3,
// SudoBalances: 4,
UnusedSudoBalances: 4,
IdentityJudgement: 5,
CancelProxy: 6
}
+9 -4
View File
@@ -9,10 +9,7 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
/* eslint-disable sort-keys */
const sharedTypes = {
AccountInfo: 'AccountInfoWithDualRefCount',
Address: 'MultiAddress',
FullIdentification: '()', // No staking, only session (as per config)
LookupSource: 'MultiAddress',
Keys: 'SessionKeys6'
};
@@ -21,12 +18,20 @@ const versioned: OverrideVersionedType[] = [
minmax: [0, 200],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount',
Address: 'AccountId',
LookupSource: 'AccountId'
}
},
{
minmax: [201, undefined],
minmax: [201, 214],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithDualRefCount'
}
},
{
minmax: [215, undefined],
types: {
...sharedTypes
}
+1 -1
View File
@@ -12,7 +12,7 @@ const upgrades: ChainUpgradesRaw = [
[2201991, 1062], [2671528, 2005], [2704202, 2007], [2728002, 2008], [2832534, 2011],
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
[6137912, 2028]
[6137912, 2028], [6561855, 2029]
];
export default upgrades;
@@ -8,7 +8,7 @@ const upgrades: ChainUpgradesRaw = [
[244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12],
[528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
[3613564, 27], [3899547, 28]
[3613564, 27], [3899547, 28], [4345767, 29]
];
export default upgrades;
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "4.0.2",
"version": "4.4.1",
"type": "module",
"description": "Implementation of the Parity codec",
"main": "index.js",
@@ -16,8 +16,8 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/metadata": "4.0.2",
"@babel/runtime": "^7.13.10",
"@polkadot/metadata": "4.4.1",
"@polkadot/util": "^6.0.5",
"@polkadot/util-crypto": "^6.0.5",
"@polkadot/x-rxjs": "^6.0.5",
+44 -15
View File
@@ -2,21 +2,21 @@
/* eslint-disable */
import type { BitVec, Bool, Bytes, Compact, Data, DoNotConstruct, I128, I16, I256, I32, I64, I8, Json, Null, Option, Raw, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, Vec, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types';
import type { AssetBalance, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
import type { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import type { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import type { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEquivocationProof, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe';
import type { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEpochConfiguration, BabeEquivocationProof, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe';
import type { AccountData, BalanceLock, BalanceLockTo212, BalanceStatus, Reasons, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
import type { BlockHash } from '@polkadot/types/interfaces/chain';
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
import type { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims';
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractInfo, ContractStorageKey, DeletedContract, Gas, HostFnWeights, HostFnWeightsTo264, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractInfo, ContractStorageKey, DeletedContract, Gas, HostFnWeights, HostFnWeightsTo264, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import type { ContractConstructorSpec, ContractContractSpec, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpec, ContractEventSpec, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpec, ContractMessageSpec, ContractProject, ContractProjectContract, ContractProjectSource, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
import type { DeployData, FundIndex, FundInfo, LastContribution } from '@polkadot/types/interfaces/crowdloan';
import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';
import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
@@ -30,16 +30,17 @@ import type { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityJudg
import type { AuthIndex, AuthoritySignature, Heartbeat, HeartbeatTo244, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline';
import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lottery';
import type { DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV12, DoubleMapTypeV9, ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV9, MapTypeLatest, MapTypeV10, MapTypeV11, MapTypeV12, MapTypeV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV9, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV9, StorageMetadataLatest, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AbstractFungible, AbstractNonFungible, AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Balances, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, ConcreteFungible, ConcreteNonFungible, CoreAssignment, CoreIndex, CoreOccupied, DepositAsset, DepositReserveAsset, DoubleVoteReport, DownwardMessage, ExchangeAsset, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InitiateReserveWithdraw, InitiateTeleport, Junction, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiAsset, MultiLocation, NetworkId, NewBidder, NewBidderOption, Order, OriginKind, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueryHolding, QueuedParathread, RegisteredParachainInfo, RelayChainBlockNumber, RelayChainHash, RelayTo, RelayedFrom, Remark, ReserveAssetDeposit, Retriable, Scheduling, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, SystemInherentData, TeleportAsset, Transact, TransientValidationData, UpwardMessage, ValidationCode, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, WinnersData, WinnersDataTuple, WinningData, WinningDataEntry, WithdrawAsset, Xcm, XcmError, XcmResult } from '@polkadot/types/interfaces/parachains';
import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AbstractFungible, AbstractNonFungible, AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Balances, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, ConcreteFungible, ConcreteNonFungible, CoreAssignment, CoreIndex, CoreOccupied, DepositAsset, DepositReserveAsset, DoubleVoteReport, DownwardMessage, ExchangeAsset, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InitiateReserveWithdraw, InitiateTeleport, Junction, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiAsset, MultiLocation, NetworkId, NewBidder, Order, OriginKind, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueryHolding, QueuedParathread, RegisteredParachainInfo, RelayChainBlockNumber, RelayChainHash, RelayTo, RelayedFrom, Remark, ReserveAssetDeposit, Retriable, Scheduling, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, SystemInherentData, TeleportAsset, Transact, TransientValidationData, UpwardMessage, ValidationCode, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, WinnersData, WinnersDataTuple, WinningData, WinningDataEntry, WithdrawAsset, Xcm, XcmError, XcmResult } from '@polkadot/types/interfaces/parachains';
import type { FeeDetails, InclusionFee, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { Approvals } from '@polkadot/types/interfaces/poll';
import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy';
import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H512, H64, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, OpaqueCall, Origin, OriginCaller, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, Slot, StorageData, StorageProof, TransactionPriority, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H512, H64, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionPriority, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys7, SessionKeys8, SessionKeys9, ValidatorCount } from '@polkadot/types/interfaces/session';
@@ -120,6 +121,7 @@ declare module '@polkadot/types/types/registry' {
'Compact<TAssetBalance>': Compact<TAssetBalance>;
'Compact<TAssetDepositBalance>': Compact<TAssetDepositBalance>;
'Compact<TransactionPriority>': Compact<TransactionPriority>;
'Compact<TrieIndex>': Compact<TrieIndex>;
'Compact<u128>': Compact<u128>;
'Compact<U128>': Compact<U128>;
'Compact<u16>': Compact<u16>;
@@ -175,7 +177,10 @@ declare module '@polkadot/types/types/registry' {
'Option<ApplyExtrinsicResult>': Option<ApplyExtrinsicResult>;
'Option<ApprovalFlag>': Option<ApprovalFlag>;
'Option<Approvals>': Option<Approvals>;
'Option<AssetApproval>': Option<AssetApproval>;
'Option<AssetApprovalKey>': Option<AssetApprovalKey>;
'Option<AssetBalance>': Option<AssetBalance>;
'Option<AssetDestroyWitness>': Option<AssetDestroyWitness>;
'Option<AssetDetails>': Option<AssetDetails>;
'Option<AssetId>': Option<AssetId>;
'Option<AssetInstance>': Option<AssetInstance>;
@@ -196,6 +201,7 @@ declare module '@polkadot/types/types/registry' {
'Option<AvailabilityBitfieldRecord>': Option<AvailabilityBitfieldRecord>;
'Option<BabeAuthorityWeight>': Option<BabeAuthorityWeight>;
'Option<BabeBlockWeight>': Option<BabeBlockWeight>;
'Option<BabeEpochConfiguration>': Option<BabeEpochConfiguration>;
'Option<BabeEquivocationProof>': Option<BabeEquivocationProof>;
'Option<BabeWeight>': Option<BabeWeight>;
'Option<BackedCandidate>': Option<BackedCandidate>;
@@ -297,7 +303,6 @@ declare module '@polkadot/types/types/registry' {
'Option<DefunctVoter>': Option<DefunctVoter>;
'Option<Delegations>': Option<Delegations>;
'Option<DeletedContract>': Option<DeletedContract>;
'Option<DeployData>': Option<DeployData>;
'Option<DepositAsset>': Option<DepositAsset>;
'Option<DepositReserveAsset>': Option<DepositReserveAsset>;
'Option<Digest>': Option<Digest>;
@@ -331,6 +336,7 @@ declare module '@polkadot/types/types/registry' {
'Option<ElectionSize>': Option<ElectionSize>;
'Option<ElectionStatus>': Option<ElectionStatus>;
'Option<EncodedFinalityProofs>': Option<EncodedFinalityProofs>;
'Option<EncodedJustification>': Option<EncodedJustification>;
'Option<EpochAuthorship>': Option<EpochAuthorship>;
'Option<EraIndex>': Option<EraIndex>;
'Option<EraPoints>': Option<EraPoints>;
@@ -494,6 +500,7 @@ declare module '@polkadot/types/types/registry' {
'Option<Junction>': Option<Junction>;
'Option<Justification>': Option<Justification>;
'Option<JustificationNotification>': Option<JustificationNotification>;
'Option<Justifications>': Option<Justifications>;
'Option<Key>': Option<Key>;
'Option<KeyOwnerProof>': Option<KeyOwnerProof>;
'Option<Keys>': Option<Keys>;
@@ -532,6 +539,7 @@ declare module '@polkadot/types/types/registry' {
'Option<MetadataV11>': Option<MetadataV11>;
'Option<MetadataV12>': Option<MetadataV12>;
'Option<MetadataV9>': Option<MetadataV9>;
'Option<MmrLeafProof>': Option<MmrLeafProof>;
'Option<ModuleConstantMetadataLatest>': Option<ModuleConstantMetadataLatest>;
'Option<ModuleConstantMetadataV10>': Option<ModuleConstantMetadataV10>;
'Option<ModuleConstantMetadataV11>': Option<ModuleConstantMetadataV11>;
@@ -553,12 +561,12 @@ declare module '@polkadot/types/types/registry' {
'Option<Multiplier>': Option<Multiplier>;
'Option<Multisig>': Option<Multisig>;
'Option<MultiSignature>': Option<MultiSignature>;
'Option<MultiSigner>': Option<MultiSigner>;
'Option<NetworkId>': Option<NetworkId>;
'Option<NetworkState>': Option<NetworkState>;
'Option<NetworkStatePeerset>': Option<NetworkStatePeerset>;
'Option<NetworkStatePeersetInfo>': Option<NetworkStatePeersetInfo>;
'Option<NewBidder>': Option<NewBidder>;
'Option<NewBidderOption>': Option<NewBidderOption>;
'Option<NextAuthority>': Option<NextAuthority>;
'Option<NextConfigDescriptor>': Option<NextConfigDescriptor>;
'Option<NextConfigDescriptorV1>': Option<NextConfigDescriptorV1>;
@@ -630,7 +638,6 @@ declare module '@polkadot/types/types/registry' {
'Option<Points>': Option<Points>;
'Option<Precommits>': Option<Precommits>;
'Option<PrefabWasmModule>': Option<PrefabWasmModule>;
'Option<PrefabWasmModuleReserved>': Option<PrefabWasmModuleReserved>;
'Option<PrefixedStorageKey>': Option<PrefixedStorageKey>;
'Option<PreimageStatus>': Option<PreimageStatus>;
'Option<PreimageStatusAvailable>': Option<PreimageStatusAvailable>;
@@ -711,6 +718,7 @@ declare module '@polkadot/types/types/registry' {
'Option<SealV0>': Option<SealV0>;
'Option<SeatHolder>': Option<SeatHolder>;
'Option<SeedOf>': Option<SeedOf>;
'Option<ServiceQuality>': Option<ServiceQuality>;
'Option<SessionIndex>': Option<SessionIndex>;
'Option<SessionInfo>': Option<SessionInfo>;
'Option<SessionInfoValidatorGroup>': Option<SessionInfoValidatorGroup>;
@@ -730,6 +738,8 @@ declare module '@polkadot/types/types/registry' {
'Option<SignedAvailabilityBitfield>': Option<SignedAvailabilityBitfield>;
'Option<SignedAvailabilityBitfields>': Option<SignedAvailabilityBitfields>;
'Option<SignedBlock>': Option<SignedBlock>;
'Option<SignedBlockWithJustification>': Option<SignedBlockWithJustification>;
'Option<SignedBlockWithJustifications>': Option<SignedBlockWithJustifications>;
'Option<SignerPayload>': Option<SignerPayload>;
'Option<SigningContext>': Option<SigningContext>;
'Option<SiLookupTypeId>': Option<SiLookupTypeId>;
@@ -813,6 +823,7 @@ declare module '@polkadot/types/types/registry' {
'Option<TransientValidationData>': Option<TransientValidationData>;
'Option<TreasuryProposal>': Option<TreasuryProposal>;
'Option<TrieId>': Option<TrieId>;
'Option<TrieIndex>': Option<TrieIndex>;
'Option<Type>': Option<Type>;
'Option<u128>': Option<u128>;
'Option<U128>': Option<U128>;
@@ -921,7 +932,10 @@ declare module '@polkadot/types/types/registry' {
'Vec<ApplyExtrinsicResult>': Vec<ApplyExtrinsicResult>;
'Vec<ApprovalFlag>': Vec<ApprovalFlag>;
'Vec<Approvals>': Vec<Approvals>;
'Vec<AssetApproval>': Vec<AssetApproval>;
'Vec<AssetApprovalKey>': Vec<AssetApprovalKey>;
'Vec<AssetBalance>': Vec<AssetBalance>;
'Vec<AssetDestroyWitness>': Vec<AssetDestroyWitness>;
'Vec<AssetDetails>': Vec<AssetDetails>;
'Vec<AssetId>': Vec<AssetId>;
'Vec<AssetInstance>': Vec<AssetInstance>;
@@ -942,6 +956,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<AvailabilityBitfieldRecord>': Vec<AvailabilityBitfieldRecord>;
'Vec<BabeAuthorityWeight>': Vec<BabeAuthorityWeight>;
'Vec<BabeBlockWeight>': Vec<BabeBlockWeight>;
'Vec<BabeEpochConfiguration>': Vec<BabeEpochConfiguration>;
'Vec<BabeEquivocationProof>': Vec<BabeEquivocationProof>;
'Vec<BabeWeight>': Vec<BabeWeight>;
'Vec<BackedCandidate>': Vec<BackedCandidate>;
@@ -1043,7 +1058,6 @@ declare module '@polkadot/types/types/registry' {
'Vec<DefunctVoter>': Vec<DefunctVoter>;
'Vec<Delegations>': Vec<Delegations>;
'Vec<DeletedContract>': Vec<DeletedContract>;
'Vec<DeployData>': Vec<DeployData>;
'Vec<DepositAsset>': Vec<DepositAsset>;
'Vec<DepositReserveAsset>': Vec<DepositReserveAsset>;
'Vec<Digest>': Vec<Digest>;
@@ -1077,6 +1091,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<ElectionSize>': Vec<ElectionSize>;
'Vec<ElectionStatus>': Vec<ElectionStatus>;
'Vec<EncodedFinalityProofs>': Vec<EncodedFinalityProofs>;
'Vec<EncodedJustification>': Vec<EncodedJustification>;
'Vec<EpochAuthorship>': Vec<EpochAuthorship>;
'Vec<EraIndex>': Vec<EraIndex>;
'Vec<EraPoints>': Vec<EraPoints>;
@@ -1240,6 +1255,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<Junction>': Vec<Junction>;
'Vec<Justification>': Vec<Justification>;
'Vec<JustificationNotification>': Vec<JustificationNotification>;
'Vec<Justifications>': Vec<Justifications>;
'Vec<Key>': Vec<Key>;
'Vec<KeyOwnerProof>': Vec<KeyOwnerProof>;
'Vec<Keys>': Vec<Keys>;
@@ -1278,6 +1294,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<MetadataV11>': Vec<MetadataV11>;
'Vec<MetadataV12>': Vec<MetadataV12>;
'Vec<MetadataV9>': Vec<MetadataV9>;
'Vec<MmrLeafProof>': Vec<MmrLeafProof>;
'Vec<ModuleConstantMetadataLatest>': Vec<ModuleConstantMetadataLatest>;
'Vec<ModuleConstantMetadataV10>': Vec<ModuleConstantMetadataV10>;
'Vec<ModuleConstantMetadataV11>': Vec<ModuleConstantMetadataV11>;
@@ -1299,12 +1316,12 @@ declare module '@polkadot/types/types/registry' {
'Vec<Multiplier>': Vec<Multiplier>;
'Vec<Multisig>': Vec<Multisig>;
'Vec<MultiSignature>': Vec<MultiSignature>;
'Vec<MultiSigner>': Vec<MultiSigner>;
'Vec<NetworkId>': Vec<NetworkId>;
'Vec<NetworkState>': Vec<NetworkState>;
'Vec<NetworkStatePeerset>': Vec<NetworkStatePeerset>;
'Vec<NetworkStatePeersetInfo>': Vec<NetworkStatePeersetInfo>;
'Vec<NewBidder>': Vec<NewBidder>;
'Vec<NewBidderOption>': Vec<NewBidderOption>;
'Vec<NextAuthority>': Vec<NextAuthority>;
'Vec<NextConfigDescriptor>': Vec<NextConfigDescriptor>;
'Vec<NextConfigDescriptorV1>': Vec<NextConfigDescriptorV1>;
@@ -1376,7 +1393,6 @@ declare module '@polkadot/types/types/registry' {
'Vec<Points>': Vec<Points>;
'Vec<Precommits>': Vec<Precommits>;
'Vec<PrefabWasmModule>': Vec<PrefabWasmModule>;
'Vec<PrefabWasmModuleReserved>': Vec<PrefabWasmModuleReserved>;
'Vec<PrefixedStorageKey>': Vec<PrefixedStorageKey>;
'Vec<PreimageStatus>': Vec<PreimageStatus>;
'Vec<PreimageStatusAvailable>': Vec<PreimageStatusAvailable>;
@@ -1457,6 +1473,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<SealV0>': Vec<SealV0>;
'Vec<SeatHolder>': Vec<SeatHolder>;
'Vec<SeedOf>': Vec<SeedOf>;
'Vec<ServiceQuality>': Vec<ServiceQuality>;
'Vec<SessionIndex>': Vec<SessionIndex>;
'Vec<SessionInfo>': Vec<SessionInfo>;
'Vec<SessionInfoValidatorGroup>': Vec<SessionInfoValidatorGroup>;
@@ -1476,6 +1493,8 @@ declare module '@polkadot/types/types/registry' {
'Vec<SignedAvailabilityBitfield>': Vec<SignedAvailabilityBitfield>;
'Vec<SignedAvailabilityBitfields>': Vec<SignedAvailabilityBitfields>;
'Vec<SignedBlock>': Vec<SignedBlock>;
'Vec<SignedBlockWithJustification>': Vec<SignedBlockWithJustification>;
'Vec<SignedBlockWithJustifications>': Vec<SignedBlockWithJustifications>;
'Vec<SignerPayload>': Vec<SignerPayload>;
'Vec<SigningContext>': Vec<SigningContext>;
'Vec<SiLookupTypeId>': Vec<SiLookupTypeId>;
@@ -1559,6 +1578,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<TransientValidationData>': Vec<TransientValidationData>;
'Vec<TreasuryProposal>': Vec<TreasuryProposal>;
'Vec<TrieId>': Vec<TrieId>;
'Vec<TrieIndex>': Vec<TrieIndex>;
'Vec<Type>': Vec<Type>;
'Vec<u128>': Vec<u128>;
'Vec<U128>': Vec<U128>;
@@ -1667,7 +1687,10 @@ declare module '@polkadot/types/types/registry' {
ApplyExtrinsicResult: ApplyExtrinsicResult;
ApprovalFlag: ApprovalFlag;
Approvals: Approvals;
AssetApproval: AssetApproval;
AssetApprovalKey: AssetApprovalKey;
AssetBalance: AssetBalance;
AssetDestroyWitness: AssetDestroyWitness;
AssetDetails: AssetDetails;
AssetId: AssetId;
AssetInstance: AssetInstance;
@@ -1688,6 +1711,7 @@ declare module '@polkadot/types/types/registry' {
AvailabilityBitfieldRecord: AvailabilityBitfieldRecord;
BabeAuthorityWeight: BabeAuthorityWeight;
BabeBlockWeight: BabeBlockWeight;
BabeEpochConfiguration: BabeEpochConfiguration;
BabeEquivocationProof: BabeEquivocationProof;
BabeWeight: BabeWeight;
BackedCandidate: BackedCandidate;
@@ -1789,7 +1813,6 @@ declare module '@polkadot/types/types/registry' {
DefunctVoter: DefunctVoter;
Delegations: Delegations;
DeletedContract: DeletedContract;
DeployData: DeployData;
DepositAsset: DepositAsset;
DepositReserveAsset: DepositReserveAsset;
Digest: Digest;
@@ -1823,6 +1846,7 @@ declare module '@polkadot/types/types/registry' {
ElectionSize: ElectionSize;
ElectionStatus: ElectionStatus;
EncodedFinalityProofs: EncodedFinalityProofs;
EncodedJustification: EncodedJustification;
EpochAuthorship: EpochAuthorship;
EraIndex: EraIndex;
EraPoints: EraPoints;
@@ -1986,6 +2010,7 @@ declare module '@polkadot/types/types/registry' {
Junction: Junction;
Justification: Justification;
JustificationNotification: JustificationNotification;
Justifications: Justifications;
Key: Key;
KeyOwnerProof: KeyOwnerProof;
Keys: Keys;
@@ -2024,6 +2049,7 @@ declare module '@polkadot/types/types/registry' {
MetadataV11: MetadataV11;
MetadataV12: MetadataV12;
MetadataV9: MetadataV9;
MmrLeafProof: MmrLeafProof;
ModuleConstantMetadataLatest: ModuleConstantMetadataLatest;
ModuleConstantMetadataV10: ModuleConstantMetadataV10;
ModuleConstantMetadataV11: ModuleConstantMetadataV11;
@@ -2045,12 +2071,12 @@ declare module '@polkadot/types/types/registry' {
Multiplier: Multiplier;
Multisig: Multisig;
MultiSignature: MultiSignature;
MultiSigner: MultiSigner;
NetworkId: NetworkId;
NetworkState: NetworkState;
NetworkStatePeerset: NetworkStatePeerset;
NetworkStatePeersetInfo: NetworkStatePeersetInfo;
NewBidder: NewBidder;
NewBidderOption: NewBidderOption;
NextAuthority: NextAuthority;
NextConfigDescriptor: NextConfigDescriptor;
NextConfigDescriptorV1: NextConfigDescriptorV1;
@@ -2122,7 +2148,6 @@ declare module '@polkadot/types/types/registry' {
Points: Points;
Precommits: Precommits;
PrefabWasmModule: PrefabWasmModule;
PrefabWasmModuleReserved: PrefabWasmModuleReserved;
PrefixedStorageKey: PrefixedStorageKey;
PreimageStatus: PreimageStatus;
PreimageStatusAvailable: PreimageStatusAvailable;
@@ -2203,6 +2228,7 @@ declare module '@polkadot/types/types/registry' {
SealV0: SealV0;
SeatHolder: SeatHolder;
SeedOf: SeedOf;
ServiceQuality: ServiceQuality;
SessionIndex: SessionIndex;
SessionInfo: SessionInfo;
SessionInfoValidatorGroup: SessionInfoValidatorGroup;
@@ -2222,6 +2248,8 @@ declare module '@polkadot/types/types/registry' {
SignedAvailabilityBitfield: SignedAvailabilityBitfield;
SignedAvailabilityBitfields: SignedAvailabilityBitfields;
SignedBlock: SignedBlock;
SignedBlockWithJustification: SignedBlockWithJustification;
SignedBlockWithJustifications: SignedBlockWithJustifications;
SignerPayload: SignerPayload;
SigningContext: SigningContext;
SiLookupTypeId: SiLookupTypeId;
@@ -2305,6 +2333,7 @@ declare module '@polkadot/types/types/registry' {
TransientValidationData: TransientValidationData;
TreasuryProposal: TreasuryProposal;
TrieId: TrieId;
TrieIndex: TrieIndex;
Type: Type;
u128: u128;
U128: U128;
+97 -22
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Address, Balance, BlockNumber, Call, ExtrinsicEra, Hash, Index, RuntimeVersion } from '../interfaces';
import type { Codec, Constructor, ISignerPayload, SignerPayloadJSON, SignerPayloadRaw } from '../types';
import type { Codec, InterfaceTypes, ISignerPayload, Registry, SignerPayloadJSON, SignerPayloadRaw } from '../types';
import { u8aToHex } from '@polkadot/util';
@@ -26,9 +26,7 @@ export interface SignerPayloadType extends Codec {
version: u8;
}
// We explicitly cast the type here to get the actual TypeScript exports right
// We can ignore the properties, added via Struct.with
const _Payload = Struct.with({
const knownTypes: Record<string, keyof InterfaceTypes> = {
address: 'Address',
blockHash: 'Hash',
blockNumber: 'BlockNumber',
@@ -40,33 +38,106 @@ const _Payload = Struct.with({
signedExtensions: 'Vec<Text>',
tip: 'Compact<Balance>',
version: 'u8'
}) as unknown as Constructor<SignerPayloadType>;
};
/**
* @name GenericSignerPayload
* @description
* A generic signer payload that can be used for serialization between API and signer
*/
export class GenericSignerPayload extends _Payload implements ISignerPayload {
export class GenericSignerPayload extends Struct implements ISignerPayload, SignerPayloadType {
private readonly _extraTypes: Record<string, keyof InterfaceTypes>;
constructor (registry: Registry, value?: string | { [x: string]: any; } | Map<unknown, unknown> | unknown[]) {
const extensionTypes = {
...registry.getSignedExtensionTypes(),
...registry.getSignedExtensionExtra()
};
super(registry, {
...extensionTypes,
...knownTypes
}, value);
// add all extras that are not in the base types
this._extraTypes = Object.entries(extensionTypes).reduce<Record<string, keyof InterfaceTypes>>((map, [key, type]) => {
if (!knownTypes[key]) {
map[key] = type;
}
return map;
}, {});
}
get address (): Address {
return this.get('address') as Address;
}
get blockHash (): Hash {
return this.get('blockHash') as Hash;
}
get blockNumber (): BlockNumber {
return this.get('blockNumber') as BlockNumber;
}
get era (): ExtrinsicEra {
return this.get('era') as ExtrinsicEra;
}
get genesisHash (): Hash {
return this.get('genesisHash') as Hash;
}
get method (): Call {
return this.get('method') as Call;
}
get nonce (): Compact<Index> {
return this.get('nonce') as Compact<Index>;
}
get runtimeVersion (): RuntimeVersion {
return this.get('runtimeVersion') as RuntimeVersion;
}
get signedExtensions (): Vec<Text> {
return this.get('signedExtensions') as Vec<Text>;
}
get tip (): Compact<Balance> {
return this.get('tip') as Compact<Balance>;
}
get version (): u8 {
return this.get('version') as u8;
}
/**
* @description Creates an representation of the structure as an ISignerPayload JSON
*/
public toPayload (): SignerPayloadJSON {
const { address, blockHash, blockNumber, era, genesisHash, method, nonce, runtimeVersion: { specVersion, transactionVersion }, signedExtensions, tip, version } = this;
return {
address: address.toString(),
blockHash: blockHash.toHex(),
blockNumber: blockNumber.toHex(),
era: era.toHex(),
genesisHash: genesisHash.toHex(),
method: method.toHex(),
nonce: nonce.toHex(),
signedExtensions: signedExtensions.map((e) => e.toString()),
specVersion: specVersion.toHex(),
tip: tip.toHex(),
transactionVersion: transactionVersion.toHex(),
version: version.toNumber()
// add any explicit overrides we may have
...(Object.keys(this._extraTypes).reduce<Record<string, string>>((map, key) => {
map[key] = (this.get(key) as Codec).toHex();
return map;
}, {})),
// the known defaults as managed explicitly and has different
// formatting in cases, e.g. we mostly expose a hex format here
address: this.address.toString(),
blockHash: this.blockHash.toHex(),
blockNumber: this.blockNumber.toHex(),
era: this.era.toHex(),
genesisHash: this.genesisHash.toHex(),
method: this.method.toHex(),
nonce: this.nonce.toHex(),
signedExtensions: this.signedExtensions.map((e) => e.toString()),
specVersion: this.runtimeVersion.specVersion.toHex(),
tip: this.tip.toHex(),
transactionVersion: this.runtimeVersion.transactionVersion.toHex(),
version: this.version.toNumber()
};
}
@@ -75,8 +146,12 @@ export class GenericSignerPayload extends _Payload implements ISignerPayload {
*/
public toRaw (): SignerPayloadRaw {
const payload = this.toPayload();
// NOTE Explicitly pass the bare flag so the method is encoded un-prefixed (non-decodable, for signing only)
const data = u8aToHex(this.registry.createType('ExtrinsicPayload', payload, { version: payload.version }).toU8a({ method: true }));
const data = u8aToHex(
this.registry
.createType('ExtrinsicPayload', payload, { version: payload.version })
// NOTE Explicitly pass the bare flag so the method is encoded un-prefixed (non-decodable, for signing only)
.toU8a({ method: true })
);
return {
address: payload.address,
@@ -1,6 +1,8 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { hexToBn } from '@polkadot/util';
import { CID_AURA, CID_BABE, CID_GRPA, GenericConsensusEngineId as ConsensusEngineId } from './ConsensusEngineId';
describe('ConsensusEngineId', (): void => {
@@ -12,4 +14,9 @@ describe('ConsensusEngineId', (): void => {
it('reverses an id to string for babe', (): void => {
expect(ConsensusEngineId.idToString(CID_BABE)).toEqual('BABE');
});
it('reverses a non-ASCII id to a hex string', (): void => {
expect(ConsensusEngineId.idToString(hexToBn('0x01020304', { isLe: true }))).toEqual('0x01020304');
expect(ConsensusEngineId.idToString(0x04030201)).toEqual('0x01020304');
});
});
@@ -5,7 +5,7 @@ import type { AccountId } from '../interfaces/runtime';
import BN from 'bn.js';
import { bnToBn } from '@polkadot/util';
import { bnToU8a, isAscii, u8aToHex, u8aToString } from '@polkadot/util';
import { Bytes } from '../primitive/Bytes';
import { u32 } from '../primitive/U32';
@@ -24,10 +24,11 @@ export const CID_POW = 0x5f776f70; // 'pow_'
*/
export class GenericConsensusEngineId extends u32 {
public static idToString (input: number | BN): string {
return bnToBn(input)
.toArray('le')
.map((code): string => String.fromCharCode(code))
.join('');
const u8a = bnToU8a(input);
return isAscii(u8a)
? u8aToString(u8a)
: u8aToHex(u8a);
}
public static stringToId (input: string): number {
@@ -9,10 +9,23 @@ import type { Definitions } from '../../types';
export default {
rpc: {},
types: {
AssetApprovalKey: {
owner: 'AccountId',
delegate: 'AccountId'
},
AssetApproval: {
amount: 'TAssetBalance',
deposit: 'TAssetDepositBalance'
},
AssetBalance: {
balance: 'TAssetBalance',
isFrozen: 'bool',
isZombie: 'bool'
isSufficient: 'bool'
},
AssetDestroyWitness: {
accounts: 'Compact<u32>',
sufficients: 'Compact<u32>',
approvals: 'Compact<u32>'
},
AssetDetails: {
owner: 'AccountId',
@@ -21,16 +34,19 @@ export default {
freezer: 'AccountId',
supply: 'TAssetBalance',
deposit: 'TAssetDepositBalance',
maxZombies: 'u32',
minBalance: 'TAssetBalance',
zombies: 'u32',
accounts: 'u32'
isSufficient: 'bool',
accounts: 'u32',
sufficients: 'u32',
approvals: 'u32',
isFrozen: 'bool'
},
AssetMetadata: {
deposit: 'TAssetDepositBalance',
name: 'Vec<u8>',
symbol: 'Vec<u8>',
decimals: 'u8'
decimals: 'u8',
isFrozen: 'bool'
},
TAssetBalance: 'u64',
TAssetDepositBalance: 'BalanceOf'
+26 -4
View File
@@ -1,14 +1,33 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Bytes, Struct, bool, u32, u64, u8 } from '@polkadot/types';
import type { Bytes, Compact, Struct, bool, u32, u64, u8 } from '@polkadot/types';
import type { AccountId, BalanceOf } from '@polkadot/types/interfaces/runtime';
/** @name AssetApproval */
export interface AssetApproval extends Struct {
readonly amount: TAssetBalance;
readonly deposit: TAssetDepositBalance;
}
/** @name AssetApprovalKey */
export interface AssetApprovalKey extends Struct {
readonly owner: AccountId;
readonly delegate: AccountId;
}
/** @name AssetBalance */
export interface AssetBalance extends Struct {
readonly balance: TAssetBalance;
readonly isFrozen: bool;
readonly isZombie: bool;
readonly isSufficient: bool;
}
/** @name AssetDestroyWitness */
export interface AssetDestroyWitness extends Struct {
readonly accounts: Compact<u32>;
readonly sufficients: Compact<u32>;
readonly approvals: Compact<u32>;
}
/** @name AssetDetails */
@@ -19,10 +38,12 @@ export interface AssetDetails extends Struct {
readonly freezer: AccountId;
readonly supply: TAssetBalance;
readonly deposit: TAssetDepositBalance;
readonly maxZombies: u32;
readonly minBalance: TAssetBalance;
readonly zombies: u32;
readonly isSufficient: bool;
readonly accounts: u32;
readonly sufficients: u32;
readonly approvals: u32;
readonly isFrozen: bool;
}
/** @name AssetMetadata */
@@ -31,6 +52,7 @@ export interface AssetMetadata extends Struct {
readonly name: Bytes;
readonly symbol: Bytes;
readonly decimals: u8;
readonly isFrozen: bool;
}
/** @name TAssetBalance */
@@ -19,6 +19,10 @@ export default {
_enum: ['PrimarySlots', 'PrimaryAndSecondaryPlainSlots', 'PrimaryAndSecondaryVRFSlots']
},
BabeAuthorityWeight: 'u64',
BabeEpochConfiguration: {
c: '(u64, u64)',
allowedSlots: 'AllowedSlots'
},
BabeBlockWeight: 'u32',
BabeEquivocationProof: {
offender: 'AuthorityId',
@@ -19,6 +19,12 @@ export interface BabeAuthorityWeight extends u64 {}
/** @name BabeBlockWeight */
export interface BabeBlockWeight extends u32 {}
/** @name BabeEpochConfiguration */
export interface BabeEpochConfiguration extends Struct {
readonly c: ITuple<[u64, u64]>;
readonly allowedSlots: AllowedSlots;
}
/** @name BabeEquivocationProof */
export interface BabeEquivocationProof extends Struct {
readonly offender: AuthorityId;
@@ -70,7 +70,8 @@ export default {
codeHash: 'CodeHash',
rentAllowance: 'Balance',
deductBlock: 'BlockNumber',
lastWrite: 'Option<BlockNumber>'
lastWrite: 'Option<BlockNumber>',
_reserved: 'Option<Null>'
},
CodeHash: 'Hash',
ContractCallRequest: {
@@ -231,6 +232,7 @@ export default {
instantiatePerCodeByte: 'Weight',
instantiatePerInputByte: 'Weight',
instantiatePerOutputByte: 'Weight',
instantiatePerSaltByte: 'Weight',
hashSha2256: 'Weight',
hashSha2256PerByte: 'Weight',
hashKeccak256: 'Weight',
@@ -238,7 +240,8 @@ export default {
hashBlake2256: 'Weight',
hashBlake2256PerByte: 'Weight',
hashBlake2128: 'Weight',
hashBlake2128PerByte: 'Weight'
hashBlake2128PerByte: 'Weight',
rentParams: 'Weight'
},
InstructionWeights: {
i64const: 'u32',
@@ -318,10 +321,11 @@ export default {
scheduleVersion: 'Compact<u32>',
initial: 'Compact<u32>',
maximum: 'Compact<u32>',
_reserved: 'PrefabWasmModuleReserved',
code: 'Bytes'
refcount: 'Compact<u64>',
_reserved: 'Option<Null>',
code: 'Bytes',
originalCodeLen: 'u32'
},
PrefabWasmModuleReserved: 'Option<Null>',
ScheduleTo212: {
version: 'u32',
putCodePerByteCost: 'Gas',
@@ -14,6 +14,7 @@ export interface AliveContractInfo extends Struct {
readonly rentAllowance: Balance;
readonly deductBlock: BlockNumber;
readonly lastWrite: Option<BlockNumber>;
readonly _reserved: Option<Null>;
}
/** @name CodeHash */
@@ -157,6 +158,7 @@ export interface HostFnWeights extends Struct {
readonly instantiatePerCodeByte: Weight;
readonly instantiatePerInputByte: Weight;
readonly instantiatePerOutputByte: Weight;
readonly instantiatePerSaltByte: Weight;
readonly hashSha2256: Weight;
readonly hashSha2256PerByte: Weight;
readonly hashKeccak256: Weight;
@@ -165,6 +167,7 @@ export interface HostFnWeights extends Struct {
readonly hashBlake2256PerByte: Weight;
readonly hashBlake2128: Weight;
readonly hashBlake2128PerByte: Weight;
readonly rentParams: Weight;
}
/** @name HostFnWeightsTo264 */
@@ -301,13 +304,12 @@ export interface PrefabWasmModule extends Struct {
readonly scheduleVersion: Compact<u32>;
readonly initial: Compact<u32>;
readonly maximum: Compact<u32>;
readonly _reserved: PrefabWasmModuleReserved;
readonly refcount: Compact<u64>;
readonly _reserved: Option<Null>;
readonly code: Bytes;
readonly originalCodeLen: u32;
}
/** @name PrefabWasmModuleReserved */
export interface PrefabWasmModuleReserved extends Option<Null> {}
/** @name Schedule */
export interface Schedule extends Struct {
readonly version: u32;
@@ -13,26 +13,23 @@ export default {
LastContribution: {
_enum: {
Never: 'Null',
PreEnding: 'AuctionIndex',
PreEnding: 'u32',
Ending: 'BlockNumber'
}
},
DeployData: {
codeHash: 'Hash',
codeSize: 'u32',
initialHeadData: 'HeadData'
},
FundInfo: {
parachain: 'Option<ParaId>',
owner: 'AccountId',
retiring: 'bool',
depositor: 'AccountId',
verifier: 'Option<MultiSigner>',
deposit: 'Balance',
raised: 'Balance',
end: 'BlockNumber',
cap: 'Balance',
lastContribution: 'LastContribution',
firstSlot: 'BlockNumber',
lastSlot: 'BlockNumber',
deployData: 'Option<DeployData>'
}
firstSlot: 'LeasePeriod',
lastSlot: 'LeasePeriod',
trieIndex: 'TrieIndex'
},
TrieIndex: 'u32'
}
} as Definitions;
@@ -1,41 +1,38 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Enum, Option, Struct, u32 } from '@polkadot/types';
import type { AuctionIndex, HeadData, ParaId } from '@polkadot/types/interfaces/parachains';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
/** @name DeployData */
export interface DeployData extends Struct {
readonly codeHash: Hash;
readonly codeSize: u32;
readonly initialHeadData: HeadData;
}
import type { Enum, Option, Struct, bool, u32 } from '@polkadot/types';
import type { LeasePeriod } from '@polkadot/types/interfaces/parachains';
import type { AccountId, Balance, BlockNumber, MultiSigner } from '@polkadot/types/interfaces/runtime';
/** @name FundIndex */
export interface FundIndex extends u32 {}
/** @name FundInfo */
export interface FundInfo extends Struct {
readonly parachain: Option<ParaId>;
readonly owner: AccountId;
readonly retiring: bool;
readonly depositor: AccountId;
readonly verifier: Option<MultiSigner>;
readonly deposit: Balance;
readonly raised: Balance;
readonly end: BlockNumber;
readonly cap: Balance;
readonly lastContribution: LastContribution;
readonly firstSlot: BlockNumber;
readonly lastSlot: BlockNumber;
readonly deployData: Option<DeployData>;
readonly firstSlot: LeasePeriod;
readonly lastSlot: LeasePeriod;
readonly trieIndex: TrieIndex;
}
/** @name LastContribution */
export interface LastContribution extends Enum {
readonly isNever: boolean;
readonly isPreEnding: boolean;
readonly asPreEnding: AuctionIndex;
readonly asPreEnding: u32;
readonly isEnding: boolean;
readonly asEnding: BlockNumber;
}
/** @name TrieIndex */
export interface TrieIndex extends u32 {}
export type PHANTOM_CROWDLOAN = 'crowdloan';
@@ -24,6 +24,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 lottery } from './lottery/definitions';
export { default as mmr } from './mmr/definitions';
export { default as offences } from './offences/definitions';
export { default as proxy } from './proxy/definitions';
export { default as recovery } from './recovery/definitions';
@@ -0,0 +1,35 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { Definitions } from '../../types';
export default {
rpc: {
generateProof: {
description: 'Generate MMR proof for given leaf index.',
params: [
{
name: 'leafIndex',
type: 'u64'
},
{
name: 'at',
type: 'BlockHash',
isHistoric: true,
isOptional: true
}
],
type: 'MmrLeafProof'
}
},
types: {
MmrLeafProof: {
blockHash: 'BlockHash',
leaf: 'Bytes',
proof: 'Bytes'
}
}
} 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,14 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Bytes, Struct } from '@polkadot/types';
import type { BlockHash } from '@polkadot/types/interfaces/chain';
/** @name MmrLeafProof */
export interface MmrLeafProof extends Struct {
readonly blockHash: BlockHash;
readonly leaf: Bytes;
readonly proof: Bytes;
}
export type PHANTOM_MMR = 'mmr';
@@ -24,11 +24,18 @@ const proposeTypes = {
}
};
const cumulusTypes = {
ServiceQuality: {
_enum: ['Ordered', 'Fast']
}
};
export default {
rpc: {},
types: {
...proposeTypes,
...cumulusTypes,
...hrmpTypes,
...proposeTypes,
...slotTypes,
AbridgedCandidateReceipt: {
parachainIndex: 'ParaId',
@@ -184,6 +191,7 @@ export default {
threadAvailabilityPeriod: 'BlockNumber',
schedulingLookahead: 'u32',
maxValidatorsPerCore: 'Option<u32>',
maxValidators: 'Option<u32>',
disputePeriod: 'SessionIndex',
noShowSlots: 'u32',
nDelayTranches: 'u32',
@@ -230,7 +238,8 @@ export default {
},
ParaId: 'u32',
ParaInfo: {
scheduling: 'Scheduling'
manager: 'AccountId',
deposit: 'Balance'
},
ParaLifecycle: {
_enum: ['Onboarding', 'Parathread', 'Parachain', 'UpgradingToParachain', 'DowngradingToParathread', 'OutgoingParathread', 'OutgoingParachain']
@@ -405,7 +414,11 @@ export default {
X1: 'Junction',
X2: '(Junction, Junction)',
X3: '(Junction, Junction, Junction)',
X4: '(Junction, Junction, Junction, Junction)'
X4: '(Junction, Junction, Junction, Junction)',
X5: '(Junction, Junction, Junction, Junction, Junction)',
X6: '(Junction, Junction, Junction, Junction, Junction, Junction)',
X7: '(Junction, Junction, Junction, Junction, Junction, Junction, Junction)',
X8: '(Junction, Junction, Junction, Junction, Junction, Junction, Junction, Junction)'
}
},
AccountId32Junction: {
@@ -6,8 +6,7 @@
const SLOT_RANGE_COUNT = 10;
export default {
AuctionIndex: 'u32',
const oldTypes = {
Bidder: {
_enum: {
New: 'NewBidder',
@@ -30,19 +29,23 @@ export default {
codeSize: 'u32',
initialHeadData: 'HeadData'
},
LeasePeriod: 'BlockNumber',
LeasePeriodOf: 'BlockNumber',
NewBidder: {
who: 'AccountId',
sub: 'SubId'
},
NewBidderOption: 'Option<NewBidder>',
SubId: 'u32'
};
export default {
...oldTypes,
AuctionIndex: 'u32',
LeasePeriod: 'BlockNumber',
LeasePeriodOf: 'BlockNumber',
SlotRange: {
_enum: ['ZeroZero', 'ZeroOne', 'ZeroTwo', 'ZeroThree', 'OneOne', 'OneTwo', 'OneThree', 'TwoTwo', 'TwoThree', 'ThreeThree']
},
SubId: 'u32',
WinningData: `[WinningDataEntry; ${SLOT_RANGE_COUNT}]`,
WinningDataEntry: 'Option<Bidder>',
WinningDataEntry: 'Option<(AccountId, ParaId, BalanceOf)>',
WinnersData: 'Vec<WinnersDataTuple>',
WinnersDataTuple: '(NewBidderOption, ParaId, BalanceOf, SlotRange)'
WinnersDataTuple: '(AccountId, ParaId, BalanceOf, SlotRange)'
};
@@ -317,6 +317,7 @@ export interface HostConfiguration extends Struct {
readonly threadAvailabilityPeriod: BlockNumber;
readonly schedulingLookahead: u32;
readonly maxValidatorsPerCore: Option<u32>;
readonly maxValidators: Option<u32>;
readonly disputePeriod: SessionIndex;
readonly noShowSlots: u32;
readonly nDelayTranches: u32;
@@ -491,6 +492,14 @@ export interface MultiLocation extends Enum {
readonly asX3: ITuple<[Junction, Junction, Junction]>;
readonly isX4: boolean;
readonly asX4: ITuple<[Junction, Junction, Junction, Junction]>;
readonly isX5: boolean;
readonly asX5: ITuple<[Junction, Junction, Junction, Junction, Junction]>;
readonly isX6: boolean;
readonly asX6: ITuple<[Junction, Junction, Junction, Junction, Junction, Junction]>;
readonly isX7: boolean;
readonly asX7: ITuple<[Junction, Junction, Junction, Junction, Junction, Junction, Junction]>;
readonly isX8: boolean;
readonly asX8: ITuple<[Junction, Junction, Junction, Junction, Junction, Junction, Junction, Junction]>;
}
/** @name NetworkId */
@@ -508,9 +517,6 @@ export interface NewBidder extends Struct {
readonly sub: SubId;
}
/** @name NewBidderOption */
export interface NewBidderOption extends Option<NewBidder> {}
/** @name Order */
export interface Order extends Enum {
readonly isNull: boolean;
@@ -577,7 +583,8 @@ export interface ParaId extends u32 {}
/** @name ParaInfo */
export interface ParaInfo extends Struct {
readonly scheduling: Scheduling;
readonly manager: AccountId;
readonly deposit: Balance;
}
/** @name ParaLifecycle */
@@ -688,6 +695,12 @@ export interface Scheduling extends Enum {
readonly isDynamic: boolean;
}
/** @name ServiceQuality */
export interface ServiceQuality extends Enum {
readonly isOrdered: boolean;
readonly isFast: boolean;
}
/** @name SessionInfo */
export interface SessionInfo extends Struct {
readonly validators: Vec<ValidatorId>;
@@ -835,13 +848,13 @@ export interface VersionedXcm extends Enum {
export interface WinnersData extends Vec<WinnersDataTuple> {}
/** @name WinnersDataTuple */
export interface WinnersDataTuple extends ITuple<[NewBidderOption, ParaId, BalanceOf, SlotRange]> {}
export interface WinnersDataTuple extends ITuple<[AccountId, ParaId, BalanceOf, SlotRange]> {}
/** @name WinningData */
export interface WinningData extends Vec<WinningDataEntry> {}
/** @name WinningDataEntry */
export interface WinningDataEntry extends Option<Bidder> {}
export interface WinningDataEntry extends Option<ITuple<[AccountId, ParaId, BalanceOf]>> {}
/** @name WithdrawAsset */
export interface WithdrawAsset extends Struct {
@@ -79,7 +79,9 @@ export default {
},
IndicesLookupSource: 'GenericLookupSource',
Index: 'u32',
Justification: 'Bytes',
Justification: '(ConsensusEngineId, EncodedJustification)',
EncodedJustification: 'Bytes',
Justifications: 'Vec<Justification>',
KeyValue: '(StorageKey, StorageData)',
KeyTypeId: 'u32',
LockIdentifier: '[u8; 8]',
@@ -87,6 +89,13 @@ export default {
LookupTarget: 'AccountId',
ModuleId: 'LockIdentifier',
MultiAddress: 'GenericMultiAddress',
MultiSigner: {
_enum: {
Ed25519: '[u8; 32]',
Sr25519: '[u8; 32]',
Ecdsa: '[u8; 33]'
}
},
Moment: 'UInt<64, Moment>',
OpaqueCall: 'Bytes',
Origin: 'DoNotConstruct<Origin>',
@@ -114,9 +123,14 @@ export default {
read: 'Weight',
write: 'Weight'
},
SignedBlock: {
SignedBlock: 'SignedBlockWithJustifications',
SignedBlockWithJustification: {
block: 'Block',
justification: 'Justification'
justification: 'Option<EncodedJustification>'
},
SignedBlockWithJustifications: {
block: 'Block',
justifications: 'Option<Justifications>'
},
Slot: 'u64',
StorageData: 'Bytes',
+29 -4
View File
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Bytes, Compact, DoNotConstruct, Enum, GenericAccountId, GenericAccountIndex, GenericBlock, GenericCall, GenericConsensusEngineId, GenericLookupSource, GenericMultiAddress, Int, Null, StorageKey, Struct, U8aFixed, UInt, Vec, u16, u32, u64, u8 } from '@polkadot/types';
import type { Bytes, Compact, DoNotConstruct, Enum, GenericAccountId, GenericAccountIndex, GenericBlock, GenericCall, GenericConsensusEngineId, GenericLookupSource, GenericMultiAddress, Int, Null, Option, StorageKey, Struct, U8aFixed, UInt, Vec, u16, u32, u64, u8 } from '@polkadot/types';
import type { ITuple } from '@polkadot/types/types';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
import type { Signature } from '@polkadot/types/interfaces/extrinsics';
@@ -81,6 +81,9 @@ export interface DigestItem extends Enum {
readonly asPreRuntime: PreRuntime;
}
/** @name EncodedJustification */
export interface EncodedJustification extends Bytes {}
/** @name ExtrinsicsWeight */
export interface ExtrinsicsWeight extends Struct {
readonly normal: Weight;
@@ -148,7 +151,10 @@ export interface Index extends u32 {}
export interface IndicesLookupSource extends GenericLookupSource {}
/** @name Justification */
export interface Justification extends Bytes {}
export interface Justification extends ITuple<[ConsensusEngineId, EncodedJustification]> {}
/** @name Justifications */
export interface Justifications extends Vec<Justification> {}
/** @name KeyTypeId */
export interface KeyTypeId extends u32 {}
@@ -174,6 +180,16 @@ export interface Moment extends UInt {}
/** @name MultiAddress */
export interface MultiAddress extends GenericMultiAddress {}
/** @name MultiSigner */
export interface MultiSigner extends Enum {
readonly isEd25519: boolean;
readonly asEd25519: U8aFixed;
readonly isSr25519: boolean;
readonly asSr25519: U8aFixed;
readonly isEcdsa: boolean;
readonly asEcdsa: U8aFixed;
}
/** @name OpaqueCall */
export interface OpaqueCall extends Bytes {}
@@ -253,9 +269,18 @@ export interface Seal extends ITuple<[ConsensusEngineId, Bytes]> {}
export interface SealV0 extends ITuple<[u64, Signature]> {}
/** @name SignedBlock */
export interface SignedBlock extends Struct {
export interface SignedBlock extends SignedBlockWithJustifications {}
/** @name SignedBlockWithJustification */
export interface SignedBlockWithJustification extends Struct {
readonly block: Block;
readonly justification: Justification;
readonly justification: Option<EncodedJustification>;
}
/** @name SignedBlockWithJustifications */
export interface SignedBlockWithJustifications extends Struct {
readonly block: Block;
readonly justifications: Option<Justifications>;
}
/** @name Slot */
@@ -134,7 +134,7 @@ export default {
}
},
types: {
AccountInfo: 'AccountInfoWithRefCount',
AccountInfo: 'AccountInfoWithTripleRefCount',
AccountInfoWithRefCount: {
nonce: 'Index',
refcount: 'RefCount',
@@ -7,7 +7,7 @@ import type { AccountData } from '@polkadot/types/interfaces/balances';
import type { AccountId, BlockNumber, Digest, Hash, Index, Pays, Weight } from '@polkadot/types/interfaces/runtime';
/** @name AccountInfo */
export interface AccountInfo extends AccountInfoWithRefCount {}
export interface AccountInfo extends AccountInfoWithTripleRefCount {}
/** @name AccountInfoWithDualRefCount */
export interface AccountInfoWithDualRefCount extends Struct {
+1
View File
@@ -21,6 +21,7 @@ export * from './grandpa/types';
export * from './identity/types';
export * from './imOnline/types';
export * from './lottery/types';
export * from './mmr/types';
export * from './offences/types';
export * from './proxy/types';
export * from './recovery/types';
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types', version: '4.0.2' };
export const packageInfo = { name: '@polkadot/types', version: '4.4.1' };
+4
View File
@@ -49,6 +49,10 @@ export class BitVec extends Raw {
return this.length + compactToU8a(this.bitLength()).length;
}
public toHuman (): string {
return `0b${[...this.toU8a(true)].map((d) => `00000000${d.toString(2)}`.slice(-8)).join('_')}`;
}
/**
* @description Returns the base runtime type name for this instance
*/
+36 -33
View File
@@ -85,6 +85,7 @@ function decodeStorageKey (value?: AnyU8a | StorageKey | StorageEntry | [Storage
throw new Error(`Unable to convert input ${value as string} to StorageKey`);
}
/** @internal */
function decodeHashers <A extends AnyTuple> (registry: Registry, value: Uint8Array, hashers: [StorageHasher, string][]): A {
// the storage entry is xxhashAsU8a(prefix, 128) + xxhashAsU8a(method, 128), 256 bits total
let offset = 32;
@@ -124,6 +125,39 @@ function decodeArgsFromMeta <A extends AnyTuple> (registry: Registry, value: Uin
]);
}
/** @internal */
function getMeta (value: StorageKey | StorageEntry | [StorageEntry, any]): StorageEntryMetadataLatest | undefined {
if (value instanceof StorageKey) {
return value.meta;
} else if (isFunction(value)) {
return value.meta;
} else if (Array.isArray(value)) {
const [fn] = value;
return fn.meta;
}
return undefined;
}
/** @internal */
function getType (value: StorageKey | StorageEntry | [StorageEntry, any]): string {
if (value instanceof StorageKey) {
return value.outputType;
} else if (isFunction(value)) {
return unwrapStorageType(value.meta.type);
} else if (Array.isArray(value)) {
const [fn] = value;
if (fn.meta) {
return unwrapStorageType(fn.meta.type);
}
}
// If we have no type set, default to Raw
return 'Raw';
}
/**
* @name StorageKey
* @description
@@ -148,41 +182,10 @@ export class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements
super(registry, key);
this._outputType = StorageKey.getType(value as StorageKey);
this._outputType = getType(value as StorageKey);
// decode the args (as applicable based on the key and the hashers, after all init)
this.setMeta(StorageKey.getMeta(value as StorageKey), override.section || section, override.method || method);
}
public static getMeta (value: StorageKey | StorageEntry | [StorageEntry, any]): StorageEntryMetadataLatest | undefined {
if (value instanceof StorageKey) {
return value.meta;
} else if (isFunction(value)) {
return value.meta;
} else if (Array.isArray(value)) {
const [fn] = value;
return fn.meta;
}
return undefined;
}
public static getType (value: StorageKey | StorageEntry | [StorageEntry, any]): string {
if (value instanceof StorageKey) {
return value.outputType;
} else if (isFunction(value)) {
return unwrapStorageType(value.meta.type);
} else if (Array.isArray(value)) {
const [fn] = value;
if (fn.meta) {
return unwrapStorageType(fn.meta.type);
}
}
// If we have no type set, default to Raw
return 'Raw';
this.setMeta(getMeta(value as StorageKey), override.section || section, override.method || method);
}
/**
+274 -353
View File
File diff suppressed because it is too large Load Diff