Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e45ff6d026 | ||
|
|
b49c2314e7 | ||
|
|
0ac085756a | ||
|
|
542a690c89 | ||
|
|
ff23ead797 | ||
|
|
ae55e4fbf7 | ||
|
|
b17412163d | ||
|
|
46dcbf9a42 | ||
|
|
193dfcc32f | ||
|
|
a81011cf94 | ||
|
|
d43a8b2e11 | ||
|
|
dff859ba68 | ||
|
|
5169b6ee69 | ||
|
|
f4405667fe | ||
|
|
49ff636305 | ||
|
|
d77d686c76 | ||
|
|
502c6a3451 | ||
|
|
b58c77683d | ||
|
|
b9f82fc549 | ||
|
|
25b8dba607 | ||
|
|
1bc4f2c334 | ||
|
|
aee8ac6b0a | ||
|
|
aa7e30070f | ||
|
|
64b5855f65 | ||
|
|
d7ff9e706e | ||
|
|
15ba6f6261 | ||
|
|
8c88a880c6 | ||
|
|
74566cce7b | ||
|
|
16f6deed5e | ||
|
|
40edc131fe | ||
|
|
3e014b38e6 | ||
|
|
b4cfdbffab | ||
|
|
cbfb6f8f59 | ||
|
|
b5bc15ab8b | ||
|
|
0b343fc0f8 | ||
|
|
e7f9693873 | ||
|
|
a0a5c3185d | ||
|
|
151d4693a9 | ||
|
|
cdb27d8ec2 | ||
|
|
055e4d1261 | ||
|
|
bf753255ab | ||
|
|
e2230ef454 | ||
|
|
0f5b01b856 | ||
|
|
82787c96c6 | ||
|
|
f89028d5fe | ||
|
|
ba24a2e917 | ||
|
|
b549bbf46b | ||
|
|
1e87f58f36 | ||
|
|
f643426067 | ||
|
|
94d26c76ec | ||
|
|
8fe262a712 | ||
|
|
122ee968cb | ||
|
|
d2ff350db9 | ||
|
|
9100aabbac | ||
|
|
1e73f69253 | ||
|
|
7153cb4158 | ||
|
|
999dc6f8a5 | ||
|
|
724574afe7 | ||
|
|
0352a30b6b | ||
|
|
41b4cd5c55 | ||
|
|
89f16f3123 | ||
|
|
261a4eede3 | ||
|
|
f623b382f7 | ||
|
|
51537c619a | ||
|
|
3df943572f | ||
|
|
aa10804f6f | ||
|
|
981407f00f | ||
|
|
74f7098e0a | ||
|
|
c2e46bf16d | ||
|
|
78b26d2d40 | ||
|
|
e4d5be85f6 | ||
|
|
23b5601eeb | ||
|
|
859679ce09 | ||
|
|
71543c2351 | ||
|
|
edae5057c8 | ||
|
|
8dd450ded4 | ||
|
|
bc2061723e | ||
|
|
5753e37307 | ||
|
|
e74da70a9d | ||
|
|
737bbc225a | ||
|
|
9313551559 | ||
|
|
5b8f53f050 | ||
|
|
7358e4715b | ||
|
|
a9005d86d6 | ||
|
|
788c05d86e | ||
|
|
de6ba69631 | ||
|
|
4153fed250 | ||
|
|
c68b89831e | ||
|
|
01c9c5ed53 | ||
|
|
573fb135a7 | ||
|
|
0ee7256e37 | ||
|
|
9829ee558c | ||
|
|
34b563dd48 | ||
|
|
f6bb200146 | ||
|
|
af36e3a52c | ||
|
|
c50c7ae6ef | ||
|
|
61739d5ba1 | ||
|
|
34c4a6055e | ||
|
|
27dabdaf52 | ||
|
|
2ee3242f41 |
+9
-1
@@ -9,4 +9,12 @@
|
||||
3.2.2
|
||||
3.2.3
|
||||
|
||||
3.3.2
|
||||
3.3.2
|
||||
3.6.2
|
||||
3.6.3
|
||||
3.6.4
|
||||
3.7.2
|
||||
3.7.3
|
||||
3.9.2
|
||||
3.9.3
|
||||
3.10.2
|
||||
+120
@@ -1,5 +1,125 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 3.10.2 Feb 23, 2021
|
||||
|
||||
Upgrade priority: Medium. Recommended for users of chains where `MultiAddress` is in-use and blocks are decoded.
|
||||
|
||||
Changes:
|
||||
|
||||
- Fix decoding for `MultiAddress` enum where non-`AccountId` variable-lengths are provided as part of a stream
|
||||
- Added known Polkadot 28 upgrade block
|
||||
- Update for latest Substrate contracts `Schedule` types
|
||||
|
||||
|
||||
## 3.10.1 Feb 22, 2021
|
||||
|
||||
Upgrade priority: Low.
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust ConsumedWeight types to align with Rust module code
|
||||
- Check for connection status in subscription unsubscribe
|
||||
- Adjust staking reward derives ordering for better performance
|
||||
- Adapt detection imports to remove `.json` dependencies (Better behavior using Node.js with ESM)
|
||||
|
||||
|
||||
## 3.9.3 Feb 16, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for parachain builders since it contains the updated parachain types.
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjusted parachain `PersistedValidationData` structure
|
||||
|
||||
|
||||
## 3.9.2 Feb 15, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for parachain builders since it contains the latest parachain types.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Update README links (Thanks to https://github.com/wirednkod)
|
||||
|
||||
Changes:
|
||||
|
||||
- Added missing Culmulus `ParachainInherentData` & `MessageQueueChain` types
|
||||
- Add alias for `system_unstable_networkState` RPC
|
||||
|
||||
|
||||
## 3.9.1 Feb 14, 2021
|
||||
|
||||
Upgrade priority: Low.
|
||||
|
||||
- **Important** The `Result<T, E>` has been updated in the generation and the base types to follow the Rust version 100%. This means `{as, is}Error` is now available as `{as, is}Err` on the `Result` type. The older versions can still be used, but the `*Error` interfaces are now marked as deprecated.
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust `Result<T, E>` interface to be 100% compatible with the Rust version
|
||||
- Add the `2028` upgrade to the known upgrades (optimizing certain `.at` queries)
|
||||
- Adjust council derives to cater for latest Substrate & Polkadot
|
||||
- Adjust Rococo know type definitions to cater for the latest update
|
||||
- Update types for latest Polkadot/Substrate
|
||||
- Add generic arguments for TypeScript users to `.entries/.keys` to deal with the key typings
|
||||
|
||||
|
||||
## 3.8.1 Feb 7, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for users of the latest Substrate master, especially using contracts.
|
||||
|
||||
- **Important** The `api-contract` `Code` now supports deploying the code and a contract in on operation. This aligns with the latest Substrate where code cannot be uploaded with a contract. The `createBlueprint` is therefore deprecated, use `code.tx.<constructor>(...)` to deploy code. (Compatible with both old and new versions of Substrate)
|
||||
|
||||
Contributed:
|
||||
|
||||
- Add support for latest Frontier RPCs (Thanks to https://github.com/jnaviask)
|
||||
- Fix user-supplied signed extensions type signature (Thanks to https://github.com/ntduan)
|
||||
|
||||
Changes:
|
||||
|
||||
- Expand `api-contract` to allow for `Code` to deploy contract alongside code. `createBlueprint` is now deprecated, replaced by `createContract` or the preferred `code.tx.<constructor>`, which uploads and deploys the code in one operation. This aligns with the current Substrate master contracts implementation.
|
||||
- Allow for signed extensions to be supplied inside type bundles
|
||||
- Ensure that the auto-connect state is checked on auto-connections (respecting disconnect)
|
||||
- Added `CancelProxy` to `ProxyTypes on Polkadot, Kusama & Westend
|
||||
- Updated to latest Substrate metadata
|
||||
|
||||
|
||||
## 3.7.3 Feb 2, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Added Polkadot upgrade block for runtime 27 (known checkpoint optimization)
|
||||
|
||||
|
||||
## 3.7.2 Feb 2, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjusted the `Keys` type for the 28 runtime on Kusama, Polkadot & Westend
|
||||
|
||||
|
||||
## 3.7.1 Feb 1, 2021
|
||||
|
||||
Upgrade priority: Low. However recommended for current Substrate master, Polkadot and Rococo users and those wishing to support the upcoming Polkadot 28 runtime with the new `MultiAddress`.
|
||||
|
||||
- **Breaking change** As indicated in the 3.5.1 release notes, the `Address`/`LookupSource` defaults have now been adjusted for `MultiAddress`. If your chain does not use these types, explicitly add the correct `Address`/`LookupSource` types. This new extensible format is mean to cater for all address types into the future, removing a lot of discrepancies between chains.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Extraction of the block author on Moonbeam (Thanks to https://github.com/joelamouche)
|
||||
- Cleanup logs with HTTP providers, no subs (Thanks to https://github.com/Tbaut)
|
||||
|
||||
Changes:
|
||||
|
||||
- Allow `.slice` operator on the `Vec` type
|
||||
- Apply `MultiAddress` as a default
|
||||
- Adds support for the upcoming Polkadot 28 and Kusama 2028 runtimes
|
||||
- Add checkpoint for Kusama 2027 upgrade
|
||||
- Update all parachain types (as per latest Rococo)
|
||||
- Correctly use relay blockNumber in parachain validation data
|
||||
- remove information log for capabilities detection (creates confusion)
|
||||
- Remove explicit references to `global`, use the `x-global` detection
|
||||
- Remove explicit `module` in `package.json` (exports map available)
|
||||
|
||||
|
||||
## 3.6.1 Jan 24, 2020
|
||||
|
||||
Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
# @polkadot/api
|
||||
|
||||
This library provides a clean wrapper around all the methods exposed by a Polkadot/Substrate network client and defines all the types exposed by a node. For complete documentation around the classes, interfaces and their use, visit the [documentation portal](https://polkadot.js.org/api/).
|
||||
This library provides a clean wrapper around all the methods exposed by a Polkadot/Substrate network client and defines all the types exposed by a node. For complete documentation around the classes, interfaces and their use, visit the [documentation portal](https://polkadot.js.org/docs/api/).
|
||||
|
||||
If you are an existing user, please be sure to track the [CHANGELOG](CHANGELOG.md) and [UPGRADING](UPGRADING.md) guides when changing versions.
|
||||
|
||||
@@ -22,7 +22,7 @@ The API is split up into a number of internal packages -
|
||||
- [@polkadot/api](packages/api/) The API library, providing both Promise and RxJS Observable-based interfaces. This is the main user-facing entry point.
|
||||
- [@polkadot/api-derive](packages/api-derive/) Derived results that are injected into the API, allowing for combinations of various query results (only used internally and exposed on the Api instances via `api.derive.*`)
|
||||
- [@polkadot/api-metadata](packages/api-metadata/) Base extrinsic, storage and constant injectors for injection
|
||||
- [@polkadot/rpc-core](packages/rpc-core/) Wrapper around all [JSON-RPC methods](https://polkadot.js.org/api/substrate/rpc.html) exposed by a Polkadot network client
|
||||
- [@polkadot/rpc-core](packages/rpc-core/) Wrapper around all [JSON-RPC methods](https://polkadot.js.org/docs/substrate/rpc) exposed by a Polkadot network client
|
||||
- [@polkadot/rpc-provider](packages/rpc-provider/) Providers for connecting to nodes, including WebSockets and Http
|
||||
|
||||
Type definitions for interfaces as exposed by Polkadot & Substrate clients -
|
||||
|
||||
+6
-6
@@ -8,7 +8,7 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"typescript": "^4.1.3"
|
||||
"typescript": "^4.1.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||
@@ -25,14 +25,14 @@
|
||||
"test:watch": "polkadot-dev-run-test --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/register": "^7.12.10",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/dev": "^0.61.24",
|
||||
"@babel/core": "^7.12.17",
|
||||
"@babel/register": "^7.12.13",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/dev": "^0.61.26",
|
||||
"@polkadot/ts": "^0.3.59",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^26.0.20",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"version": "3.6.1"
|
||||
"version": "3.10.2"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
"sideEffects": false,
|
||||
@@ -12,11 +12,11 @@
|
||||
"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.12.5",
|
||||
"@polkadot/api": "3.6.1",
|
||||
"@polkadot/types": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"@polkadot/x-rxjs": "^5.4.2",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/api": "3.10.2",
|
||||
"@polkadot/types": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"@polkadot/x-rxjs": "^5.7.1",
|
||||
"bn.js": "^4.11.9"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ export abstract class Base<ApiType extends ApiTypes> {
|
||||
this.registry = this.abi.registry;
|
||||
this._decorateMethod = decorateMethod;
|
||||
|
||||
assert(this.api.rx.tx.contracts && this.api.rx.tx.contracts.putCode, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
|
||||
assert(api.rx.tx.contracts?.instantiate, 'You need to connect to a node with the contracts module, the metadata does not enable api.tx.contracts on this instance');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,44 +6,17 @@ import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import type { AccountId, EventRecord, Hash } from '@polkadot/types/interfaces';
|
||||
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
|
||||
import type { AbiConstructor, BlueprintOptions } from '../types';
|
||||
import type { BlueprintDeploy, ContractGeneric, MapConstructorExec } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import type { ContractGeneric, MapConstructorExec } from './types';
|
||||
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import { ApiBase } from '@polkadot/api/base';
|
||||
import { Bytes } from '@polkadot/types';
|
||||
import { compactAddLength, isUndefined, stringCamelCase, u8aToU8a } from '@polkadot/util';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
import { isUndefined, stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { Abi } from '../Abi';
|
||||
import { applyOnEvent, extractOptions, isOptions } from '../util';
|
||||
import { applyOnEvent } from '../util';
|
||||
import { Base } from './Base';
|
||||
import { Contract } from './Contract';
|
||||
|
||||
const EMPTY_SALT = new Uint8Array();
|
||||
|
||||
function createTx <ApiType extends ApiTypes> (fn: (options: BlueprintOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>>): BlueprintDeploy<ApiType> {
|
||||
return (options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> =>
|
||||
isOptions(options)
|
||||
? fn(options, params)
|
||||
: fn(...extractOptions(options, params));
|
||||
}
|
||||
|
||||
function createWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]) => T): ContractGeneric<BlueprintOptions, T> {
|
||||
return (constructorOrId: AbiConstructor | string | number, options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): T =>
|
||||
isOptions(options)
|
||||
? fn(constructorOrId, options, params)
|
||||
: fn(constructorOrId, ...extractOptions(options, params));
|
||||
}
|
||||
|
||||
function encodeSalt (salt: Uint8Array | string | null = randomAsU8a()) {
|
||||
return salt instanceof Bytes
|
||||
? salt
|
||||
: salt && salt.length
|
||||
? compactAddLength(u8aToU8a(salt))
|
||||
: EMPTY_SALT;
|
||||
}
|
||||
import { createBluePrintTx, createBluePrintWithId, EMPTY_SALT, encodeSalt } from './util';
|
||||
|
||||
export class BlueprintSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
|
||||
public readonly contract?: Contract<ApiType>;
|
||||
@@ -73,13 +46,13 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
super(api, abi, decorateMethod);
|
||||
|
||||
this.codeHash = this.registry.createType('Hash', codeHash);
|
||||
this.createContract = createWithId(this.#deploy);
|
||||
this.createContract = createBluePrintWithId(this.#deploy);
|
||||
|
||||
this.abi.constructors.forEach((c): void => {
|
||||
const messageName = stringCamelCase(c.identifier);
|
||||
|
||||
if (isUndefined(this.#tx[messageName])) {
|
||||
this.#tx[messageName] = createTx((o, p) => this.#deploy(c, o, p));
|
||||
this.#tx[messageName] = createBluePrintTx((o, p) => this.#deploy(c, o, p));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -88,7 +61,7 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
return this.#tx;
|
||||
}
|
||||
|
||||
#deploy = (constructorOrId: AbiConstructor | string| number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
|
||||
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = 0, salt, value = 0 }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
|
||||
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);
|
||||
@@ -99,7 +72,7 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
: this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, encoded);
|
||||
|
||||
return tx.withResultTransform((result: ISubmittableResult) =>
|
||||
new BlueprintSubmittableResult(result, applyOnEvent(result, 'Instantiated', ([record]: EventRecord[]) =>
|
||||
new BlueprintSubmittableResult(result, applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) =>
|
||||
new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod)
|
||||
))
|
||||
);
|
||||
|
||||
@@ -4,30 +4,39 @@
|
||||
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 { AnyJson, ISubmittableResult } from '@polkadot/types/types';
|
||||
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, isWasm, u8aToU8a } from '@polkadot/util';
|
||||
import { assert, compactAddLength, isFunction, isUndefined, isWasm, stringCamelCase, u8aToU8a } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { Abi } from '../Abi';
|
||||
import { applyOnEvent } from '../util';
|
||||
import { Base } from './Base';
|
||||
import { Blueprint } from './Blueprint';
|
||||
import { Contract } from './Contract';
|
||||
import { createBluePrintTx, EMPTY_SALT, encodeSalt } from './util';
|
||||
|
||||
export class CodeSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
|
||||
public readonly blueprint?: Blueprint<ApiType>;
|
||||
public readonly contract?: Contract<ApiType>;
|
||||
|
||||
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>) {
|
||||
constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType>, contract?: Contract<ApiType>) {
|
||||
super(result);
|
||||
|
||||
this.blueprint = blueprint;
|
||||
this.contract = contract;
|
||||
}
|
||||
}
|
||||
|
||||
export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
public readonly code: Uint8Array;
|
||||
|
||||
readonly #tx: MapConstructorExec<ApiType> = {};
|
||||
|
||||
constructor (api: ApiBase<ApiType>, abi: AnyJson | Abi, wasm: Uint8Array | string | Buffer | null | undefined, decorateMethod: DecorateMethod<ApiType>) {
|
||||
super(api, abi, decorateMethod);
|
||||
|
||||
@@ -36,18 +45,79 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
|
||||
: u8aToU8a(wasm);
|
||||
|
||||
assert(isWasm(this.code), 'No WASM code provided');
|
||||
|
||||
this.abi.constructors.forEach((c): void => {
|
||||
const messageName = stringCamelCase(c.identifier);
|
||||
|
||||
if (isUndefined(this.#tx[messageName])) {
|
||||
this.#tx[messageName] = createBluePrintTx((o, p) => this.#instantiate(c, o, p));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 CodeSubmittableResult(result, applyOnEvent(result, ['CodeStored'], ([record]: EventRecord[]) =>
|
||||
new Blueprint<ApiType>(this.api, this.abi, record.event.data[0] as Hash, this._decorateMethod)
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Deploy the code bundle and the contract, creating a Blueprint.
|
||||
* @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);
|
||||
}
|
||||
|
||||
public get tx (): MapConstructorExec<ApiType> {
|
||||
return this.#tx;
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
#instantiateSingle = (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>> => {
|
||||
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);
|
||||
const codeHash = blake2AsU8a(this.code);
|
||||
|
||||
return this.api.tx.utility.batch([
|
||||
this.api.tx.contracts.putCode(compactAddLength(this.code)),
|
||||
withSalt
|
||||
? this.api.tx.contracts.instantiate(value, gasLimit, codeHash, encoded, encodedSalt)
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore old style with salt included in the params itself
|
||||
: this.api.tx.contracts.instantiate(value, gasLimit, codeHash, encoded)
|
||||
]).withResultTransform(this.#transformEvents);
|
||||
}
|
||||
|
||||
#transformEvents = (result: ISubmittableResult): CodeSubmittableResult<ApiType> => {
|
||||
return new CodeSubmittableResult(result, ...(applyOnEvent(result, ['CodeStored', 'Instantiated'], (records: EventRecord[]) =>
|
||||
records.reduce(([blueprint, contract], { event }): [Blueprint<ApiType>?, Contract<ApiType>?] =>
|
||||
this.api.events.contracts.Instantiated.is(event)
|
||||
? [blueprint, new Contract<ApiType>(this.api, this.abi, event.data[1], this._decorateMethod)]
|
||||
: this.api.events.contracts.CodeStored.is(event)
|
||||
? [new Blueprint<ApiType>(this.api, this.abi, event.data[0], this._decorateMethod), contract]
|
||||
: [blueprint, contract],
|
||||
[] as [Blueprint<ApiType>?, Contract<ApiType>?])
|
||||
) || []));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ 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[]) =>
|
||||
new ContractSubmittableResult(result, applyOnEvent(result, ['ContractExecution'], (records: EventRecord[]) =>
|
||||
records
|
||||
.map(({ event: { data: [, data] } }): DecodedEvent | null => {
|
||||
try {
|
||||
|
||||
@@ -11,6 +11,9 @@ export const mockApi = {
|
||||
rx: {
|
||||
tx: {
|
||||
contracts: {
|
||||
instantiate: (): never => {
|
||||
throw new Error('mock');
|
||||
},
|
||||
putCode: (): never => {
|
||||
throw new Error('mock');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { SubmittableResult } from '@polkadot/api';
|
||||
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
|
||||
import type { ApiTypes } from '@polkadot/api/types';
|
||||
import type { CodecArg } from '@polkadot/types/types';
|
||||
import type { AbiConstructor, BlueprintOptions } from '../types';
|
||||
import type { BlueprintDeploy, ContractGeneric } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { Bytes } from '@polkadot/types';
|
||||
import { compactAddLength, u8aToU8a } from '@polkadot/util';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { extractOptions, isOptions } from '../util';
|
||||
|
||||
export const EMPTY_SALT = new Uint8Array();
|
||||
|
||||
export function createBluePrintTx <ApiType extends ApiTypes, R extends SubmittableResult> (fn: (options: BlueprintOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType, R>): BlueprintDeploy<ApiType> {
|
||||
return (options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType, R> =>
|
||||
isOptions(options)
|
||||
? fn(options, params)
|
||||
: fn(...extractOptions(options, params));
|
||||
}
|
||||
|
||||
export function createBluePrintWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: CodecArg[]) => T): ContractGeneric<BlueprintOptions, T> {
|
||||
return (constructorOrId: AbiConstructor | string | number, options: BigInt | string | number | BN | BlueprintOptions, ...params: CodecArg[]): T =>
|
||||
isOptions(options)
|
||||
? fn(constructorOrId, options, params)
|
||||
: fn(constructorOrId, ...extractOptions(options, params));
|
||||
}
|
||||
|
||||
export function encodeSalt (salt: Uint8Array | string | null = randomAsU8a()): Uint8Array {
|
||||
return salt instanceof Bytes
|
||||
? salt
|
||||
: salt && salt.length
|
||||
? compactAddLength(u8aToU8a(salt))
|
||||
: EMPTY_SALT;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-contract', version: '3.10.2' };
|
||||
@@ -20,9 +20,9 @@ export function formatData (registry: Registry, data: Raw, { type }: TypeDef): C
|
||||
return createTypeUnsafe(registry, type, [data], { isPedantic: true });
|
||||
}
|
||||
|
||||
export function applyOnEvent <T> (result: SubmittableResult, type: ContractEvents, fn: (records: EventRecord[]) => T): T | undefined {
|
||||
export function applyOnEvent <T> (result: SubmittableResult, types: ContractEvents[], fn: (records: EventRecord[]) => T): T | undefined {
|
||||
if (result.isInBlock || result.isFinalized) {
|
||||
const records = result.filterRecords('contracts', type);
|
||||
const records = result.filterRecords('contracts', types);
|
||||
|
||||
if (records.length) {
|
||||
return fn(records);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
"sideEffects": false,
|
||||
@@ -12,17 +12,17 @@
|
||||
"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.12.5",
|
||||
"@polkadot/api": "3.6.1",
|
||||
"@polkadot/rpc-core": "3.6.1",
|
||||
"@polkadot/types": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"@polkadot/util-crypto": "^5.4.2",
|
||||
"@polkadot/x-rxjs": "^5.4.2",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/api": "3.10.2",
|
||||
"@polkadot/rpc-core": "3.10.2",
|
||||
"@polkadot/types": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"@polkadot/util-crypto": "^5.7.1",
|
||||
"@polkadot/x-rxjs": "^5.7.1",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.4.2",
|
||||
"@polkadot/rpc-provider": "3.6.1"
|
||||
"@polkadot/keyring": "^5.7.1",
|
||||
"@polkadot/rpc-provider": "3.10.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { DeriveBounties, DeriveCollectiveProposal } from '@polkadot/api-derive/types';
|
||||
import type { Bytes, Option, StorageKey } from '@polkadot/types';
|
||||
import type { Bytes, Option } from '@polkadot/types';
|
||||
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
|
||||
|
||||
import { memo } from '@polkadot/api-derive/util';
|
||||
@@ -32,7 +32,7 @@ function parseResult ([maybeBounties, maybeDescriptions, ids, bountyProposals]:
|
||||
}
|
||||
|
||||
export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveBounties> {
|
||||
const bountyBase = api.query.bounties ? api.query.bounties : api.query.treasury;
|
||||
const bountyBase = api.query.bounties || api.query.treasury;
|
||||
|
||||
return memo(instanceId, (): Observable<DeriveBounties> =>
|
||||
combineLatest([
|
||||
@@ -41,12 +41,12 @@ export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observ
|
||||
]).pipe(
|
||||
switchMap(() =>
|
||||
combineLatest([
|
||||
bountyBase.bounties.keys(),
|
||||
bountyBase.bounties.keys<[BountyIndex]>(),
|
||||
api.derive.council ? api.derive.council.proposals() : of([])
|
||||
])
|
||||
),
|
||||
switchMap(([keys, proposals]): Observable<Result> => {
|
||||
const ids = (keys as StorageKey<[BountyIndex]>[]).map(({ args: [id] }) => id);
|
||||
const ids = keys.map(({ args: [id] }) => id);
|
||||
|
||||
return combineLatest([
|
||||
bountyBase.bounties.multi<Option<Bounty>>(ids),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Vec } from '@polkadot/types';
|
||||
import type { AccountId, Balance } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, Balance, Voter } from '@polkadot/types/interfaces';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveCouncilVote, DeriveCouncilVotes } from '../types';
|
||||
@@ -13,18 +13,25 @@ import { map } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
// Voter is current tuple is 2.x-era
|
||||
type VoteEntry = Voter | ITuple<[Balance, Vec<AccountId>]>;
|
||||
|
||||
function isVoter (value: VoteEntry): value is Voter {
|
||||
return !Array.isArray(value);
|
||||
}
|
||||
|
||||
function retrieveStakeOf (api: ApiInterfaceRx): Observable<[AccountId, Balance][]> {
|
||||
return (api.query.electionsPhragmen || api.query.elections).stakeOf.entries<Balance>().pipe(
|
||||
return (api.query.electionsPhragmen || api.query.elections).stakeOf.entries<Balance, [AccountId]>().pipe(
|
||||
map((entries) =>
|
||||
entries.map(([key, stake]) => [key.args[0] as AccountId, stake])
|
||||
entries.map(([{ args: [accountId] }, stake]) => [accountId, stake])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function retrieveVoteOf (api: ApiInterfaceRx): Observable<[AccountId, AccountId[]][]> {
|
||||
return (api.query.electionsPhragmen || api.query.elections).votesOf.entries<Vec<AccountId>>().pipe(
|
||||
return (api.query.electionsPhragmen || api.query.elections).votesOf.entries<Vec<AccountId>, [AccountId]>().pipe(
|
||||
map((entries) =>
|
||||
entries.map(([key, votes]) => [key.args[0] as AccountId, votes])
|
||||
entries.map(([{ args: [accountId] }, votes]) => [accountId, votes])
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -56,11 +63,14 @@ function retrievePrev (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
|
||||
function retrieveCurrent (api: ApiInterfaceRx): Observable<DeriveCouncilVotes> {
|
||||
const elections = (api.query.electionsPhragmen || api.query.elections);
|
||||
|
||||
return elections.voting.entries<ITuple<[Balance, Vec<AccountId>]>>().pipe(
|
||||
return elections.voting.entries<VoteEntry, [AccountId]>().pipe(
|
||||
map((entries): DeriveCouncilVotes =>
|
||||
entries.map(([key, [stake, votes]]): [AccountId, DeriveCouncilVote] =>
|
||||
[key.args[0] as AccountId, { stake, votes }]
|
||||
)
|
||||
entries.map(([{ args: [accountId] }, value]): [AccountId, DeriveCouncilVote] => [
|
||||
accountId,
|
||||
isVoter(value)
|
||||
? { stake: value.stake, votes: value.votes }
|
||||
: { stake: value[0], votes: value[1] }
|
||||
])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], Opti
|
||||
api.query.scheduler.agenda.keys()
|
||||
),
|
||||
switchMap((keys) => {
|
||||
const blockNumbers = keys.map((key) => key.args[0]);
|
||||
const blockNumbers = keys.map(({ args: [blockNumber] }) => blockNumber);
|
||||
|
||||
return combineLatest([
|
||||
of(blockNumbers),
|
||||
|
||||
@@ -67,9 +67,9 @@ function extractVotes (mapped: [AccountId, Voting][], referendumId: BN): DeriveR
|
||||
}
|
||||
|
||||
function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
|
||||
return api.query.democracy.votingOf.entries<Voting>().pipe(
|
||||
return api.query.democracy.votingOf.entries<Voting, [AccountId]>().pipe(
|
||||
map((allVoting): DeriveReferendumVote[] => {
|
||||
const mapped = allVoting.map(([key, voting]): [AccountId, Voting] => [key.args[0], voting]);
|
||||
const mapped = allVoting.map(([{ args: [accountId] }, voting]): [AccountId, Voting] => [accountId, voting]);
|
||||
const votes = extractVotes(mapped, referendumId);
|
||||
const delegations = mapped
|
||||
.filter(([, voting]) => voting.isDelegating)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { u32, Vec } from '@polkadot/types';
|
||||
import type { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, Balance, BlockNumber, SeatHolder } from '@polkadot/types/interfaces';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveElectionsInfo } from './types';
|
||||
@@ -12,14 +12,27 @@ import { map } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
function sortAccounts ([, balanceA]: ITuple<[AccountId, Balance]>, [, balanceB]: ITuple<[AccountId, Balance]>): number {
|
||||
// SeatHolder is current tuple is 2.x-era Substrate
|
||||
type Member = SeatHolder | ITuple<[AccountId, Balance]>;
|
||||
|
||||
function isSeatHolder (value: Member): value is SeatHolder {
|
||||
return !Array.isArray(value);
|
||||
}
|
||||
|
||||
function getAccountTuple (value: Member): [AccountId, Balance] {
|
||||
return isSeatHolder(value)
|
||||
? [value.who, value.stake]
|
||||
: value;
|
||||
}
|
||||
|
||||
function sortAccounts ([, balanceA]: [AccountId, Balance], [, balanceB]: [AccountId, Balance]): number {
|
||||
return balanceB.cmp(balanceA);
|
||||
}
|
||||
|
||||
function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
|
||||
const section = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections';
|
||||
|
||||
return api.queryMulti<[Vec<AccountId>, Vec<AccountId>, Vec<ITuple<[AccountId, Balance]>>, Vec<ITuple<[AccountId, Balance]>>]>([
|
||||
return api.queryMulti<[Vec<AccountId>, Vec<AccountId>, Vec<Member>, Vec<Member>]>([
|
||||
api.query.council.members,
|
||||
api.query[section].candidates,
|
||||
api.query[section].members,
|
||||
@@ -32,9 +45,9 @@ function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
|
||||
desiredRunnersUp: api.consts[section].desiredRunnersUp as u32,
|
||||
desiredSeats: api.consts[section].desiredMembers as u32,
|
||||
members: members.length
|
||||
? members.sort(sortAccounts)
|
||||
? members.map(getAccountTuple).sort(sortAccounts)
|
||||
: councilMembers.map((accountId): [AccountId, Balance] => [accountId, api.registry.createType('Balance')]),
|
||||
runnersUp: runnersUp.sort(sortAccounts),
|
||||
runnersUp: runnersUp.map(getAccountTuple).sort(sortAccounts),
|
||||
termDuration: api.consts[section].termDuration as BlockNumber,
|
||||
votingBond: api.consts[section].votingBond as Balance
|
||||
}))
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-derive', version: '3.10.2' };
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { StorageKey } from '@polkadot/types';
|
||||
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, EraIndex, Exposure } from '@polkadot/types/interfaces';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveEraExposure, DeriveEraNominatorExposure, DeriveEraValidatorExposure } from '../types';
|
||||
|
||||
@@ -12,7 +12,7 @@ import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { deriveCache, memo } from '../util';
|
||||
|
||||
type KeysAndExposures = [StorageKey, Exposure][];
|
||||
type KeysAndExposures = [StorageKey<[EraIndex, AccountId]>, Exposure][];
|
||||
|
||||
const CACHE_KEY = 'eraExposure';
|
||||
|
||||
|
||||
@@ -1,55 +1,37 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveOwnExposure } from '../types';
|
||||
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
import { of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { deriveCache, memo } from '../util';
|
||||
import { memo } from '../util';
|
||||
|
||||
const CACHE_KEY = 'ownExposure';
|
||||
|
||||
export function _ownExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex, withActive: boolean) => Observable<DeriveOwnExposure> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex, withActive: boolean): Observable<DeriveOwnExposure> => {
|
||||
const cacheKey = `${CACHE_KEY}-${era.toString()}-${accountId.toString()}`;
|
||||
const cached = withActive
|
||||
? undefined
|
||||
: deriveCache.get<DeriveOwnExposure>(cacheKey);
|
||||
|
||||
return cached
|
||||
? of(cached)
|
||||
: api.queryMulti<[Exposure, Exposure]>([
|
||||
[api.query.staking.erasStakersClipped, [era, accountId]],
|
||||
[api.query.staking.erasStakers, [era, accountId]]
|
||||
export function _ownExposures (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveOwnExposure[]> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveOwnExposure[]> =>
|
||||
eras.length
|
||||
? api.queryMulti<Exposure[]>([
|
||||
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.erasStakersClipped, [era, accountId]]),
|
||||
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.erasStakers, [era, accountId]])
|
||||
]).pipe(
|
||||
map(([clipped, exposure]): DeriveOwnExposure => {
|
||||
const value = { clipped, era, exposure };
|
||||
|
||||
!withActive && deriveCache.set(cacheKey, value);
|
||||
|
||||
return value;
|
||||
})
|
||||
);
|
||||
});
|
||||
map((all): DeriveOwnExposure[] =>
|
||||
eras.map((era, index) => ({ clipped: all[index], era, exposure: all[eras.length + index] }))
|
||||
)
|
||||
)
|
||||
: of([])
|
||||
);
|
||||
}
|
||||
|
||||
export function ownExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex) => Observable<DeriveOwnExposure> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex): Observable<DeriveOwnExposure> =>
|
||||
api.derive.staking._ownExposure(accountId, era, true)
|
||||
);
|
||||
}
|
||||
|
||||
export function _ownExposures (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveOwnExposure[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveOwnExposure[]> =>
|
||||
eras.length
|
||||
? combineLatest(
|
||||
eras.map((era) => api.derive.staking._ownExposure(accountId, era, withActive))
|
||||
)
|
||||
: of([])
|
||||
api.derive.staking._ownExposures(accountId, [era], true).pipe(
|
||||
map(([first]) => first)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,62 +1,44 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||
import type { Option } from '@polkadot/types';
|
||||
import type { BalanceOf, EraIndex, Perbill } from '@polkadot/types/interfaces';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveStakerSlashes } from '../types';
|
||||
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
import { of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { deriveCache, memo } from '../util';
|
||||
import { memo } from '../util';
|
||||
|
||||
const CACHE_KEY = 'ownSlash';
|
||||
|
||||
export function _ownSlash (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex, withActive: boolean) => Observable<DeriveStakerSlashes> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex, withActive: boolean): Observable<DeriveStakerSlashes> => {
|
||||
const cacheKey = `${CACHE_KEY}-${era.toString()}-${accountId.toString()}`;
|
||||
const cached = withActive
|
||||
? undefined
|
||||
: deriveCache.get<DeriveStakerSlashes>(cacheKey);
|
||||
|
||||
return cached
|
||||
? of(cached)
|
||||
: api.queryMulti<[Option<BalanceOf>, Option<ITuple<[Perbill, BalanceOf]>>]>([
|
||||
[api.query.staking.nominatorSlashInEra, [era, accountId]],
|
||||
[api.query.staking.validatorSlashInEra, [era, accountId]]
|
||||
export function _ownSlashes (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerSlashes[]> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveStakerSlashes[]> =>
|
||||
eras.length
|
||||
? api.queryMulti<(Option<ITuple<[Perbill, BalanceOf]>> | Option<BalanceOf>)[]>([
|
||||
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.validatorSlashInEra, [era, accountId]]),
|
||||
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.nominatorSlashInEra, [era, accountId]])
|
||||
]).pipe(
|
||||
map(([optNom, optVal]): DeriveStakerSlashes => {
|
||||
const value = {
|
||||
map((values): DeriveStakerSlashes[] =>
|
||||
eras.map((era, index) => ({
|
||||
era,
|
||||
total: optVal.isSome
|
||||
? optVal.unwrap()[1]
|
||||
: optNom.unwrapOrDefault()
|
||||
};
|
||||
|
||||
!withActive && deriveCache.set(cacheKey, value);
|
||||
|
||||
return value;
|
||||
})
|
||||
);
|
||||
});
|
||||
total: values[index].isSome
|
||||
? (values[index].unwrap() as ITuple<[Perbill, BalanceOf]>)[1]
|
||||
: (values[index + eras.length].unwrapOrDefault() as BalanceOf)
|
||||
}))
|
||||
)
|
||||
)
|
||||
: of([])
|
||||
);
|
||||
}
|
||||
|
||||
export function ownSlash (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, era: EraIndex) => Observable<DeriveStakerSlashes> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, era: EraIndex): Observable<DeriveStakerSlashes> =>
|
||||
api.derive.staking._ownSlash(accountId, era, true)
|
||||
);
|
||||
}
|
||||
|
||||
export function _ownSlashes (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerSlashes[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerSlashes[]> =>
|
||||
eras.length
|
||||
? combineLatest(
|
||||
eras.map((era) => api.derive.staking._ownSlash(accountId, era, withActive))
|
||||
)
|
||||
: of([])
|
||||
api.derive.staking._ownSlashes(accountId, [era], true).pipe(
|
||||
map(([first]) => first)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,36 +10,46 @@ import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
export function _stakerExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerExposure[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerExposure[]> => {
|
||||
const stakerId = api.registry.createType('AccountId', accountId).toString();
|
||||
export function _stakerExposures (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerExposure[][]> {
|
||||
return memo(instanceId, (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean): Observable<DeriveStakerExposure[][]> => {
|
||||
const stakerIds = accountIds.map((a) => api.registry.createType('AccountId', a).toString());
|
||||
|
||||
return api.derive.staking._erasExposure(eras, withActive).pipe(
|
||||
map((exposures): DeriveStakerExposure[] =>
|
||||
exposures.map(({ era, nominators: allNominators, validators: allValidators }): DeriveStakerExposure => {
|
||||
const isValidator = !!allValidators[stakerId];
|
||||
const validators: DeriveEraValidatorExposure = {};
|
||||
const nominating = allNominators[stakerId] || [];
|
||||
map((exposures): DeriveStakerExposure[][] =>
|
||||
stakerIds.map((stakerId) =>
|
||||
exposures.map(({ era, nominators: allNominators, validators: allValidators }): DeriveStakerExposure => {
|
||||
const isValidator = !!allValidators[stakerId];
|
||||
const validators: DeriveEraValidatorExposure = {};
|
||||
const nominating = allNominators[stakerId] || [];
|
||||
|
||||
if (isValidator) {
|
||||
validators[stakerId] = allValidators[stakerId];
|
||||
} else if (nominating) {
|
||||
nominating.forEach(({ validatorId }): void => {
|
||||
validators[validatorId] = allValidators[validatorId];
|
||||
});
|
||||
}
|
||||
if (isValidator) {
|
||||
validators[stakerId] = allValidators[stakerId];
|
||||
} else if (nominating) {
|
||||
nominating.forEach(({ validatorId }): void => {
|
||||
validators[validatorId] = allValidators[validatorId];
|
||||
});
|
||||
}
|
||||
|
||||
return { era, isEmpty: !Object.keys(validators).length, isValidator, nominating, validators };
|
||||
})
|
||||
return { era, isEmpty: !Object.keys(validators).length, isValidator, nominating, validators };
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function stakerExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerExposure[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerExposure[]> =>
|
||||
export function stakerExposures (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], withActive?: boolean) => Observable<DeriveStakerExposure[][]> {
|
||||
return memo(instanceId, (accountIds: (Uint8Array | string)[], withActive = false): Observable<DeriveStakerExposure[][]> =>
|
||||
api.derive.staking.erasHistoric(withActive).pipe(
|
||||
switchMap((eras) => api.derive.staking._stakerExposure(accountId, eras, withActive))
|
||||
switchMap((eras) => api.derive.staking._stakerExposures(accountIds, eras, withActive))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function stakerExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerExposure[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerExposure[]> =>
|
||||
api.derive.staking.stakerExposures([accountId, withActive]).pipe(
|
||||
map(([first]) => first)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,45 +2,40 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option } from '@polkadot/types';
|
||||
import type { AccountId, EraIndex, StakingLedger, StakingLedgerTo240 } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, EraIndex, StakingLedger } from '@polkadot/types/interfaces';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveEraPoints, DeriveEraPrefs, DeriveEraRewards, DeriveEraValPrefs, DeriveStakerExposure, DeriveStakerReward, DeriveStakerRewardValidator } from '../types';
|
||||
import type { DeriveStakingQuery } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { isFunction } from '@polkadot/util';
|
||||
import { BN_BILLION, BN_ZERO } from '@polkadot/util';
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
type ErasResult = [{ unwrapOr: (value: BN) => BN }, DeriveEraPoints[], DeriveEraPrefs[], DeriveEraRewards[]];
|
||||
type ErasResult = [DeriveEraPoints[], DeriveEraPrefs[], DeriveEraRewards[]];
|
||||
|
||||
const ZERO = new BN(0);
|
||||
const MIN_ONE = new BN(-1);
|
||||
const COMM_DIV = new BN(1_000_000_000);
|
||||
|
||||
function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [, erasPoints, erasPrefs, erasRewards]: ErasResult, exposures: DeriveStakerExposure[]): DeriveStakerReward[] {
|
||||
function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [erasPoints, erasPrefs, erasRewards]: ErasResult, exposures: DeriveStakerExposure[]): DeriveStakerReward[] {
|
||||
return exposures.map(({ era, isEmpty, isValidator, nominating, validators: eraValidators }): DeriveStakerReward => {
|
||||
const { eraPoints, validators: allValPoints } = erasPoints.find((p) => p.era.eq(era)) || { eraPoints: ZERO, validators: {} };
|
||||
const { eraPoints, validators: allValPoints } = erasPoints.find((p) => p.era.eq(era)) || { eraPoints: BN_ZERO, validators: {} };
|
||||
const { eraReward } = erasRewards.find((r) => r.era.eq(era)) || { eraReward: api.registry.createType('Balance') };
|
||||
const { validators: allValPrefs } = erasPrefs.find((p) => p.era.eq(era)) || { validators: {} as DeriveEraValPrefs };
|
||||
const validators: Record<string, DeriveStakerRewardValidator> = {};
|
||||
const stakerId = stashId.toString();
|
||||
|
||||
Object.entries(eraValidators).forEach(([validatorId, exposure]): void => {
|
||||
const valPoints = allValPoints[validatorId] || ZERO;
|
||||
const valComm = allValPrefs[validatorId]?.commission.unwrap() || ZERO;
|
||||
const valPoints = allValPoints[validatorId] || BN_ZERO;
|
||||
const valComm = allValPrefs[validatorId]?.commission.unwrap() || BN_ZERO;
|
||||
const expTotal = exposure.total.unwrap();
|
||||
let avail = ZERO;
|
||||
let avail = BN_ZERO;
|
||||
let value: BN | undefined;
|
||||
|
||||
if (!(expTotal.isZero() || valPoints.isZero() || eraPoints.isZero())) {
|
||||
avail = eraReward.mul(valPoints).div(eraPoints);
|
||||
|
||||
const valCut = valComm.mul(avail).div(COMM_DIV);
|
||||
const valCut = valComm.mul(avail).div(BN_BILLION);
|
||||
let staked: BN;
|
||||
|
||||
if (validatorId === stakerId) {
|
||||
@@ -50,10 +45,10 @@ function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [, erasPoints, e
|
||||
|
||||
staked = stakerExp
|
||||
? stakerExp.value.unwrap()
|
||||
: ZERO;
|
||||
: BN_ZERO;
|
||||
}
|
||||
|
||||
value = avail.sub(valCut).imul(staked).div(expTotal).iadd(validatorId === stakerId ? valCut : ZERO);
|
||||
value = avail.sub(valCut).imul(staked).div(expTotal).iadd(validatorId === stakerId ? valCut : BN_ZERO);
|
||||
}
|
||||
|
||||
validators[validatorId] = {
|
||||
@@ -73,32 +68,25 @@ function parseRewards (api: ApiInterfaceRx, stashId: AccountId, [, erasPoints, e
|
||||
});
|
||||
}
|
||||
|
||||
function uniqValidators (rewards: DeriveStakerReward[]): string[] {
|
||||
const uniq: string[] = [];
|
||||
function allUniqValidators (rewards: DeriveStakerReward[][]): [string[], string[][]] {
|
||||
return rewards.reduce(([all, perStash]: [string[], string[][]], rewards) => {
|
||||
const uniq: string[] = [];
|
||||
|
||||
rewards.forEach(({ validators }): void => {
|
||||
Object.keys(validators).forEach((validatorId): void => {
|
||||
if (!uniq.includes(validatorId)) {
|
||||
uniq.push(validatorId);
|
||||
}
|
||||
});
|
||||
});
|
||||
perStash.push(uniq);
|
||||
rewards.forEach(({ validators }) =>
|
||||
Object.keys(validators).forEach((validatorId): void => {
|
||||
if (!uniq.includes(validatorId)) {
|
||||
uniq.push(validatorId);
|
||||
|
||||
return uniq;
|
||||
}
|
||||
if (!all.includes(validatorId)) {
|
||||
all.push(validatorId);
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
function isOldLedger (ledger?: StakingLedger | StakingLedgerTo240): ledger is StakingLedgerTo240 {
|
||||
return !!(ledger as StakingLedgerTo240)?.lastReward;
|
||||
}
|
||||
|
||||
function filterEra (era: EraIndex, stakingLedger: StakingLedger): boolean {
|
||||
return isOldLedger(stakingLedger)
|
||||
? era.gt(stakingLedger.lastReward.unwrapOr(MIN_ONE))
|
||||
: !stakingLedger.claimedRewards.some((e) => e.eq(era));
|
||||
}
|
||||
|
||||
function filterEras (eras: EraIndex[], stakingLedger: StakingLedger): EraIndex[] {
|
||||
return eras.filter((era) => filterEra(era, stakingLedger));
|
||||
return [all, perStash];
|
||||
}, [[], []]);
|
||||
}
|
||||
|
||||
function removeClaimed (validators: string[], queryValidators: DeriveStakingQuery[], reward: DeriveStakerReward): void {
|
||||
@@ -121,43 +109,34 @@ function removeClaimed (validators: string[], queryValidators: DeriveStakingQuer
|
||||
});
|
||||
}
|
||||
|
||||
function filterRewards (api: ApiInterfaceRx, eras: EraIndex[], { migrateEra, rewards, stakingLedger }: { migrateEra: BN, rewards: DeriveStakerReward[]; stakingLedger: StakingLedger }): Observable<DeriveStakerReward[]> {
|
||||
const validators = uniqValidators(rewards);
|
||||
const filter = filterEras(eras, stakingLedger);
|
||||
function filterRewards (eras: EraIndex[], valInfo: [string, DeriveStakingQuery][], { rewards, stakingLedger }: { rewards: DeriveStakerReward[]; stakingLedger: StakingLedger }): DeriveStakerReward[] {
|
||||
const filter = eras.filter((era) => !stakingLedger.claimedRewards.some((e) => e.eq(era)));
|
||||
const validators = valInfo.map(([v]) => v);
|
||||
const queryValidators = valInfo.map(([, q]) => q);
|
||||
|
||||
return api.derive.staking.queryMulti(validators, { withLedger: true }).pipe(
|
||||
map((queryValidators): DeriveStakerReward[] =>
|
||||
rewards
|
||||
.filter(({ isEmpty }) => !isEmpty)
|
||||
.filter((reward): boolean => {
|
||||
if (!filter.some((filter) => reward.era.eq(filter))) {
|
||||
return false;
|
||||
} else if (reward.era.lt(migrateEra)) {
|
||||
// we filter again here, the actual ledger may have changed, e.g. something has been claimed
|
||||
return filterEra(reward.era, stakingLedger);
|
||||
}
|
||||
return rewards
|
||||
.filter(({ isEmpty }) => !isEmpty)
|
||||
.filter((reward): boolean => {
|
||||
if (!filter.some((filter) => reward.era.eq(filter))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
reward.isStakerPayout = true;
|
||||
reward.isStakerPayout = true;
|
||||
|
||||
removeClaimed(validators, queryValidators, reward);
|
||||
removeClaimed(validators, queryValidators, reward);
|
||||
|
||||
return true;
|
||||
})
|
||||
.filter(({ validators }) => Object.keys(validators).length !== 0)
|
||||
.map((reward) => ({
|
||||
...reward,
|
||||
nominators: reward.nominating.filter((n) => reward.validators[n.validatorId])
|
||||
}))
|
||||
)
|
||||
);
|
||||
return true;
|
||||
})
|
||||
.filter(({ validators }) => Object.keys(validators).length !== 0)
|
||||
.map((reward) => ({
|
||||
...reward,
|
||||
nominators: reward.nominating.filter((n) => reward.validators[n.validatorId])
|
||||
}));
|
||||
}
|
||||
|
||||
export function _stakerRewardsEras (instanceId: string, api: ApiInterfaceRx): (eras: EraIndex[], withActive: boolean) => Observable<ErasResult> {
|
||||
return memo(instanceId, (eras: EraIndex[], withActive: boolean): Observable<ErasResult> =>
|
||||
combineLatest([
|
||||
isFunction(api.query.staking.migrateEra)
|
||||
? api.query.staking.migrateEra<Option<EraIndex>>()
|
||||
: of(api.registry.createType('Option<EraIndex>')),
|
||||
api.derive.staking._erasPoints(eras, withActive),
|
||||
api.derive.staking._erasPrefs(eras, withActive),
|
||||
api.derive.staking._erasRewards(eras, withActive)
|
||||
@@ -165,23 +144,39 @@ export function _stakerRewardsEras (instanceId: string, api: ApiInterfaceRx): (e
|
||||
);
|
||||
}
|
||||
|
||||
export function _stakerRewards (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerReward[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean): Observable<DeriveStakerReward[]> =>
|
||||
export function _stakerRewards (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerReward[][]> {
|
||||
return memo(instanceId, (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean): Observable<DeriveStakerReward[][]> =>
|
||||
combineLatest([
|
||||
api.derive.staking.query(accountId, { withLedger: true }),
|
||||
api.derive.staking._stakerExposure(accountId, eras, withActive),
|
||||
api.derive.staking.queryMulti(accountIds, { withLedger: true }),
|
||||
api.derive.staking._stakerExposures(accountIds, eras, withActive),
|
||||
api.derive.staking._stakerRewardsEras(eras, withActive)
|
||||
]).pipe(
|
||||
switchMap(([{ stakingLedger, stashId }, exposures, erasResult]): Observable<DeriveStakerReward[]> => {
|
||||
if (!stashId || !stakingLedger) {
|
||||
return of([]);
|
||||
switchMap(([queries, exposures, erasResult]): Observable<DeriveStakerReward[][]> => {
|
||||
const allRewards = queries.map(({ stakingLedger, stashId }, index): DeriveStakerReward[] =>
|
||||
(!stashId || !stakingLedger)
|
||||
? []
|
||||
: parseRewards(api, stashId, erasResult, exposures[index])
|
||||
);
|
||||
|
||||
if (withActive) {
|
||||
return of(allRewards);
|
||||
}
|
||||
|
||||
const rewards = parseRewards(api, stashId, erasResult, exposures);
|
||||
const [allValidators, stashValidators] = allUniqValidators(allRewards);
|
||||
|
||||
return withActive
|
||||
? of(rewards)
|
||||
: filterRewards(api, eras, { migrateEra: erasResult[0].unwrapOr(ZERO), rewards, stakingLedger });
|
||||
return api.derive.staking.queryMulti(allValidators, { withLedger: true }).pipe(
|
||||
map((queriedVals): DeriveStakerReward[][] => {
|
||||
return queries.map(({ stakingLedger }, index): DeriveStakerReward[] => {
|
||||
const rewards = allRewards[index];
|
||||
const ownValidators = stashValidators[index].map((validatorId): [string, DeriveStakingQuery] => [
|
||||
validatorId,
|
||||
queriedVals.find((q) => q.accountId.eq(validatorId)) as DeriveStakingQuery
|
||||
]);
|
||||
|
||||
return filterRewards(eras, ownValidators, { rewards, stakingLedger });
|
||||
});
|
||||
})
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
@@ -190,7 +185,8 @@ export function _stakerRewards (instanceId: string, api: ApiInterfaceRx): (accou
|
||||
export function stakerRewards (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerReward[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerReward[]> =>
|
||||
api.derive.staking.erasHistoric(withActive).pipe(
|
||||
switchMap((eras) => api.derive.staking._stakerRewards(accountId, eras, withActive))
|
||||
switchMap((eras) => api.derive.staking._stakerRewards([accountId], eras, withActive)),
|
||||
map(([first]) => first)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -198,7 +194,7 @@ export function stakerRewards (instanceId: string, api: ApiInterfaceRx): (accoun
|
||||
export function stakerRewardsMultiEras (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[]) => Observable<DeriveStakerReward[][]> {
|
||||
return memo(instanceId, (accountIds: (Uint8Array | string)[], eras: EraIndex[]): Observable<DeriveStakerReward[][]> =>
|
||||
accountIds.length && eras.length
|
||||
? combineLatest(accountIds.map((acc) => api.derive.staking._stakerRewards(acc, eras, false)))
|
||||
? api.derive.staking._stakerRewards(accountIds, eras, false)
|
||||
: of([])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { memo } from '../util';
|
||||
export function stashes (instanceId: string, api: ApiInterfaceRx): () => Observable<AccountId[]> {
|
||||
return memo(instanceId, (): Observable<AccountId[]> =>
|
||||
api.query.staking.validators.keys().pipe(
|
||||
map((keys) => keys.map((key) => key.args[0]).filter((a) => a))
|
||||
map((keys) => keys.map(({ args: [validatorId] }) => validatorId).filter((a) => a))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export function nextElected (instanceId: string, api: ApiInterfaceRx): () => Obs
|
||||
// only populate for next era in the last session, so track both here - entries are not
|
||||
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
|
||||
switchMap(({ currentEra }) => api.query.staking.erasStakers.keys(currentEra)),
|
||||
map((keys) => keys.map((key) => key.args[1]))
|
||||
map((keys) => keys.map(({ args: [, accountId] }) => accountId))
|
||||
)
|
||||
: api.query.staking.currentElected<AccountId[]>()
|
||||
);
|
||||
|
||||
@@ -4,19 +4,17 @@
|
||||
import type { AccountId, Digest } from '@polkadot/types/interfaces';
|
||||
|
||||
export function extractAuthor (digest: Digest, sessionValidators: AccountId[] = []): AccountId | undefined {
|
||||
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
|
||||
const [citem] = digest.logs.filter(({ type }) => type === 'Consensus');
|
||||
|
||||
// extract from the substrate 2.0 PreRuntime digest
|
||||
if (pitem) {
|
||||
const [engine, data] = pitem.asPreRuntime;
|
||||
if (citem) {
|
||||
const [engine, data] = citem.asConsensus;
|
||||
|
||||
return engine.extractAuthor(data, sessionValidators);
|
||||
} else {
|
||||
const [citem] = digest.logs.filter(({ type }) => type === 'Consensus');
|
||||
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
|
||||
|
||||
// extract author from the consensus (substrate 1.0, digest)
|
||||
if (citem) {
|
||||
const [engine, data] = citem.asConsensus;
|
||||
if (pitem) {
|
||||
const [engine, data] = pitem.asPreRuntime;
|
||||
|
||||
return engine.extractAuthor(data, sessionValidators);
|
||||
}
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
"sideEffects": [
|
||||
@@ -15,17 +15,17 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/api-derive": "3.6.1",
|
||||
"@polkadot/keyring": "^5.4.2",
|
||||
"@polkadot/metadata": "3.6.1",
|
||||
"@polkadot/rpc-core": "3.6.1",
|
||||
"@polkadot/rpc-provider": "3.6.1",
|
||||
"@polkadot/types": "3.6.1",
|
||||
"@polkadot/types-known": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"@polkadot/util-crypto": "^5.4.2",
|
||||
"@polkadot/x-rxjs": "^5.4.2",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/api-derive": "3.10.2",
|
||||
"@polkadot/keyring": "^5.7.1",
|
||||
"@polkadot/metadata": "3.10.2",
|
||||
"@polkadot/rpc-core": "3.10.2",
|
||||
"@polkadot/rpc-provider": "3.10.2",
|
||||
"@polkadot/types": "3.10.2",
|
||||
"@polkadot/types-known": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"@polkadot/util-crypto": "^5.7.1",
|
||||
"@polkadot/x-rxjs": "^5.7.1",
|
||||
"bn.js": "^4.11.9",
|
||||
"eventemitter3": "^4.0.7"
|
||||
}
|
||||
|
||||
@@ -184,7 +184,8 @@ declare module '@polkadot/api/types/errors' {
|
||||
**/
|
||||
CodeNotFound: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The code supplied to `put_code` exceeds the limit specified in the current schedule.
|
||||
* The code supplied to `instantiate_with_code` exceeds the limit specified in the
|
||||
* current schedule.
|
||||
**/
|
||||
CodeTooLarge: AugmentedError<ApiType>;
|
||||
/**
|
||||
@@ -210,6 +211,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
* Trying again during another block is the only way to resolve this issue.
|
||||
**/
|
||||
DeletionQueueFull: AugmentedError<ApiType>;
|
||||
/**
|
||||
* A contract with the same AccountId already exists.
|
||||
**/
|
||||
DuplicateContract: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The topics passed to `seal_deposit_events` contains at least one duplicate.
|
||||
**/
|
||||
|
||||
@@ -160,45 +160,71 @@ declare module '@polkadot/api/types/events' {
|
||||
contracts: {
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
/**
|
||||
* Code with the specified hash has been stored.
|
||||
* A code with the specified hash was removed.
|
||||
* \[code_hash\]
|
||||
*
|
||||
* This happens when the last contract that uses this code hash was removed or evicted.
|
||||
**/
|
||||
CodeRemoved: AugmentedEvent<ApiType, [Hash]>;
|
||||
/**
|
||||
* Code with the specified hash has been stored. \[code_hash\]
|
||||
**/
|
||||
CodeStored: AugmentedEvent<ApiType, [Hash]>;
|
||||
/**
|
||||
* An event deposited upon execution of a contract from the account.
|
||||
* \[account, data\]
|
||||
**/
|
||||
ContractExecution: AugmentedEvent<ApiType, [AccountId, Bytes]>;
|
||||
/**
|
||||
* Contract has been evicted and is now in tombstone state.
|
||||
* \[contract, tombstone\]
|
||||
* A custom event emitted by the contract.
|
||||
* \[contract, data\]
|
||||
*
|
||||
* # Params
|
||||
*
|
||||
* - `contract`: `AccountId`: The account ID of the evicted contract.
|
||||
* - `tombstone`: `bool`: True if the evicted contract left behind a tombstone.
|
||||
* - `contract`: The contract that emitted the event.
|
||||
* - `data`: Data supplied by the contract. Metadata generated during contract
|
||||
* compilation is needed to decode it.
|
||||
**/
|
||||
Evicted: AugmentedEvent<ApiType, [AccountId, bool]>;
|
||||
ContractEmitted: AugmentedEvent<ApiType, [AccountId, Bytes]>;
|
||||
/**
|
||||
* Contract deployed by address at the specified address. \[owner, contract\]
|
||||
* Contract has been evicted and is now in tombstone state. \[contract\]
|
||||
**/
|
||||
Evicted: AugmentedEvent<ApiType, [AccountId]>;
|
||||
/**
|
||||
* Contract deployed by address at the specified address. \[deployer, contract\]
|
||||
**/
|
||||
Instantiated: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
||||
/**
|
||||
* Restoration for a contract has been successful.
|
||||
* \[donor, dest, code_hash, rent_allowance\]
|
||||
* Restoration of a contract has been successful.
|
||||
* \[restorer, dest, code_hash, rent_allowance\]
|
||||
*
|
||||
* # Params
|
||||
*
|
||||
* - `donor`: `AccountId`: Account ID of the restoring contract
|
||||
* - `dest`: `AccountId`: Account ID of the restored contract
|
||||
* - `code_hash`: `Hash`: Code hash of the restored contract
|
||||
* - `rent_allowance: `Balance`: Rent allowance of the restored contract
|
||||
* - `restorer`: Account ID of the restoring contract.
|
||||
* - `dest`: Account ID of the restored contract.
|
||||
* - `code_hash`: Code hash of the restored contract.
|
||||
* - `rent_allowance`: Rent allowance of the restored contract.
|
||||
**/
|
||||
Restored: AugmentedEvent<ApiType, [AccountId, AccountId, Hash, Balance]>;
|
||||
/**
|
||||
* Triggered when the current \[schedule\] is updated.
|
||||
* Triggered when the current schedule is updated.
|
||||
* \[version\]
|
||||
*
|
||||
* # Params
|
||||
*
|
||||
* - `version`: The version of the newly set schedule.
|
||||
**/
|
||||
ScheduleUpdated: AugmentedEvent<ApiType, [u32]>;
|
||||
/**
|
||||
* Contract has been terminated without leaving a tombstone.
|
||||
* \[contract, beneficiary\]
|
||||
*
|
||||
* # Params
|
||||
*
|
||||
* - `contract`: The contract that was terminated.
|
||||
* - `beneficiary`: The account that received the contracts remaining balance.
|
||||
*
|
||||
* # Note
|
||||
*
|
||||
* The only way for a contract to be removed without a tombstone and emitting
|
||||
* this event is by calling `seal_terminate`.
|
||||
**/
|
||||
Terminated: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
||||
};
|
||||
council: {
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
|
||||
@@ -19,7 +19,7 @@ import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lotter
|
||||
import type { DeferredOffenceOf, Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
|
||||
import type { ProxyAnnouncement, ProxyDefinition } from '@polkadot/types/interfaces/proxy';
|
||||
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
|
||||
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, Releases, ValidatorId } from '@polkadot/types/interfaces/runtime';
|
||||
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, Releases, Slot, ValidatorId } from '@polkadot/types/interfaces/runtime';
|
||||
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';
|
||||
@@ -78,7 +78,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
/**
|
||||
* Current slot number.
|
||||
**/
|
||||
currentSlot: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
currentSlot: AugmentedQuery<ApiType, () => Observable<Slot>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Current epoch index.
|
||||
**/
|
||||
@@ -87,7 +87,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
* The slot at which the first epoch actually started. This is 0
|
||||
* until the first block of the chain.
|
||||
**/
|
||||
genesisSlot: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
genesisSlot: AugmentedQuery<ApiType, () => Observable<Slot>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Temporary value (cleared at block finalization) which is `Some`
|
||||
* if per-block initialization has already been called for current block.
|
||||
@@ -148,7 +148,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
/**
|
||||
* The balance of an account.
|
||||
*
|
||||
* NOTE: This is only used in the case that this module is used to store balances.
|
||||
* NOTE: This is only used in the case that this pallet is used to store balances.
|
||||
**/
|
||||
account: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<AccountData>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
/**
|
||||
@@ -421,7 +421,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
imOnline: {
|
||||
[key: string]: QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* For each session index, we keep a mapping of `T::ValidatorId` to the
|
||||
* For each session index, we keep a mapping of `ValidatorId<T>` to the
|
||||
* number of blocks authored by the given authority.
|
||||
**/
|
||||
authoredBlocks: AugmentedQueryDoubleMap<ApiType, (key1: SessionIndex | AnyNumber | Uint8Array, key2: ValidatorId | string | Uint8Array) => Observable<u32>, [SessionIndex, ValidatorId]> & QueryableStorageEntry<ApiType, [SessionIndex, ValidatorId]>;
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
||||
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||
import type { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
|
||||
import type { CreatedBlock } from '@polkadot/types/interfaces/engine';
|
||||
import type { EthAccount, EthCallRequest, EthFilter, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';
|
||||
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 { StorageKind } from '@polkadot/types/interfaces/offchain';
|
||||
@@ -188,6 +188,14 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
||||
* Returns the code at given address at given time (block number).
|
||||
**/
|
||||
getCode: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<Bytes>>;
|
||||
/**
|
||||
* Returns filter changes since last poll.
|
||||
**/
|
||||
getFilterChanges: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<EthFilterChanges>>;
|
||||
/**
|
||||
* Returns all logs matching given filter (in a range 'from' - 'to').
|
||||
**/
|
||||
getFilterLogs: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<Vec<EthLog>>>;
|
||||
/**
|
||||
* Returns logs matching given filter object.
|
||||
**/
|
||||
@@ -248,6 +256,18 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
||||
* Returns true if client is actively mining new blocks.
|
||||
**/
|
||||
mining: AugmentedRpc<() => Observable<bool>>;
|
||||
/**
|
||||
* Returns id of new block filter.
|
||||
**/
|
||||
newBlockFilter: AugmentedRpc<() => Observable<U256>>;
|
||||
/**
|
||||
* Returns id of new filter.
|
||||
**/
|
||||
newFilter: AugmentedRpc<(filter: EthFilter | { fromBlock?: any; toBlock?: any; blockHash?: any; address?: any; topics?: any } | string | Uint8Array) => Observable<U256>>;
|
||||
/**
|
||||
* Returns id of new block filter.
|
||||
**/
|
||||
newPendingTransactionFilter: AugmentedRpc<() => Observable<U256>>;
|
||||
/**
|
||||
* Returns protocol version encoded as a string (quotes are necessary).
|
||||
**/
|
||||
@@ -276,6 +296,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
||||
* Returns an object with data about the sync status or false.
|
||||
**/
|
||||
syncing: AugmentedRpc<() => Observable<EthSyncStatus>>;
|
||||
/**
|
||||
* Uninstalls filter.
|
||||
**/
|
||||
uninstallFilter: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<bool>>;
|
||||
};
|
||||
grandpa: {
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/in
|
||||
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, Address, 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, 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';
|
||||
@@ -46,7 +46,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Weight: `O(1)`
|
||||
* Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
|
||||
**/
|
||||
burn: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
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>]>;
|
||||
/**
|
||||
* Issue a new class of fungible assets from a public origin.
|
||||
*
|
||||
@@ -72,7 +72,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | 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, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: TAssetBalance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, u32, TAssetBalance]>;
|
||||
/**
|
||||
* Destroy a class of fungible assets owned by the sender.
|
||||
*
|
||||
@@ -109,7 +109,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | 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, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<u32>, Compact<TAssetBalance>]>;
|
||||
/**
|
||||
* Destroy a class of fungible assets.
|
||||
*
|
||||
@@ -144,7 +144,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Modes: Pre-existence of `dest`; Post-existence of `source`; Prior & post zombie-status
|
||||
* of `source`; Account pre-existence of `dest`.
|
||||
**/
|
||||
forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, Compact<TAssetBalance>]>;
|
||||
forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: 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>]>;
|
||||
/**
|
||||
* Disallow further unprivileged transfers from an account.
|
||||
*
|
||||
@@ -157,7 +157,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
freeze: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
freeze: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
/**
|
||||
* Disallow further unprivileged transfers for the asset class.
|
||||
*
|
||||
@@ -184,7 +184,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Weight: `O(1)`
|
||||
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
|
||||
**/
|
||||
mint: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
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.
|
||||
*
|
||||
@@ -239,7 +239,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
setTeam: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, issuer: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, freezer: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, LookupSource]>;
|
||||
setTeam: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | 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) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, LookupSource]>;
|
||||
/**
|
||||
* Allow unprivileged transfers from an account again.
|
||||
*
|
||||
@@ -252,7 +252,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
thaw: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
thaw: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
/**
|
||||
* Allow unprivileged transfers for the asset again.
|
||||
*
|
||||
@@ -285,7 +285,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status
|
||||
* of sender; Account pre-existence of `target`.
|
||||
**/
|
||||
transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
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>]>;
|
||||
/**
|
||||
* Change the Owner of an asset.
|
||||
*
|
||||
@@ -298,7 +298,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
transferOwnership: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
transferOwnership: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
};
|
||||
authorship: {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
@@ -338,7 +338,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* not assumed to be in the overlay.
|
||||
* # </weight>
|
||||
**/
|
||||
forceTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, Compact<Balance>]>;
|
||||
forceTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, Compact<Balance>]>;
|
||||
/**
|
||||
* Set the balances of a given account.
|
||||
*
|
||||
@@ -359,7 +359,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - DB Weight: 1 Read, 1 Write to `who`
|
||||
* # </weight>
|
||||
**/
|
||||
setBalance: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, newFree: Compact<Balance> | AnyNumber | Uint8Array, newReserved: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>, Compact<Balance>]>;
|
||||
setBalance: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact<Balance> | AnyNumber | Uint8Array, newReserved: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>, Compact<Balance>]>;
|
||||
/**
|
||||
* Transfer some liquid free balance to another account.
|
||||
*
|
||||
@@ -389,21 +389,21 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Origin account is already in memory, so no DB operations for them.
|
||||
* # </weight>
|
||||
**/
|
||||
transfer: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
transfer: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
/**
|
||||
* Same as the [`transfer`] call, but with a check that the transfer will not kill the
|
||||
* origin account.
|
||||
*
|
||||
* 99% of the time you want [`transfer`] instead.
|
||||
*
|
||||
* [`transfer`]: struct.Module.html#method.transfer
|
||||
* [`transfer`]: struct.Pallet.html#method.transfer
|
||||
* # <weight>
|
||||
* - Cheaper than transfer because account cannot be killed.
|
||||
* - Base Weight: 51.4 µs
|
||||
* - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already)
|
||||
* #</weight>
|
||||
**/
|
||||
transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
};
|
||||
bounties: {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
@@ -441,7 +441,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - O(1).
|
||||
* # </weight>
|
||||
**/
|
||||
awardBounty: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource]>;
|
||||
awardBounty: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource]>;
|
||||
/**
|
||||
* Claim the payout from an awarded bounty after payout delay.
|
||||
*
|
||||
@@ -504,7 +504,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - O(1).
|
||||
* # </weight>
|
||||
**/
|
||||
proposeCurator: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, curator: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, fee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource, Compact<BalanceOf>]>;
|
||||
proposeCurator: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, curator: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, fee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource, Compact<BalanceOf>]>;
|
||||
/**
|
||||
* Unassign curator from a bounty.
|
||||
*
|
||||
@@ -538,7 +538,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* * If no account exists and the call value is not less than `existential_deposit`,
|
||||
* a regular account will be created and any value will be transferred.
|
||||
**/
|
||||
call: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, Compact<Gas>, Bytes]>;
|
||||
call: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, Compact<Gas>, Bytes]>;
|
||||
/**
|
||||
* Allows block producers to claim a small reward for evicting a contract. If a block
|
||||
* producer fails to do so, a regular users will be allowed to claim the reward.
|
||||
@@ -552,26 +552,37 @@ declare module '@polkadot/api/types/submittable' {
|
||||
**/
|
||||
claimSurcharge: AugmentedSubmittable<(dest: AccountId | string | Uint8Array, auxSender: Option<AccountId> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId, Option<AccountId>]>;
|
||||
/**
|
||||
* Instantiates a new contract from the `code_hash` generated by `put_code`,
|
||||
* optionally transferring some balance.
|
||||
* Instantiates a contract from a previously deployed wasm binary.
|
||||
*
|
||||
* The supplied `salt` is used for contract address deriviation. See `fn contract_address`.
|
||||
*
|
||||
* Instantiation is executed as follows:
|
||||
*
|
||||
* - The destination address is computed based on the sender, code_hash and the salt.
|
||||
* - The smart-contract account is created at the computed address.
|
||||
* - The `ctor_code` is executed in the context of the newly-created account. Buffer returned
|
||||
* after the execution is saved as the `code` of the account. That code will be invoked
|
||||
* upon any call received by this account.
|
||||
* - The contract is initialized.
|
||||
* This function is identical to [`Self::instantiate_with_code`] but without the
|
||||
* code deployment step. Instead, the `code_hash` of an on-chain deployed wasm binary
|
||||
* must be supplied.
|
||||
**/
|
||||
instantiate: AugmentedSubmittable<(endowment: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, codeHash: CodeHash | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, Compact<Gas>, CodeHash, Bytes, Bytes]>;
|
||||
/**
|
||||
* Stores the given binary Wasm code into the chain's storage and returns its `codehash`.
|
||||
* You can instantiate contracts only with stored code.
|
||||
* Instantiates a new contract from the supplied `code` optionally transferring
|
||||
* some balance.
|
||||
*
|
||||
* This is the only function that can deploy new code to the chain.
|
||||
*
|
||||
* # Parameters
|
||||
*
|
||||
* * `endowment`: The balance to transfer from the `origin` to the newly created contract.
|
||||
* * `gas_limit`: The gas limit enforced when executing the constructor.
|
||||
* * `code`: The contract code to deploy in raw bytes.
|
||||
* * `data`: The input data to pass to the contract constructor.
|
||||
* * `salt`: Used for the address derivation. See [`Self::contract_address`].
|
||||
*
|
||||
* Instantiation is executed as follows:
|
||||
*
|
||||
* - The supplied `code` is instrumented, deployed, and a `code_hash` is created for that code.
|
||||
* - If the `code_hash` already exists on the chain the underlying `code` will be shared.
|
||||
* - The destination address is computed based on the sender, code_hash and the salt.
|
||||
* - The smart-contract account is created at the computed address.
|
||||
* - The `endowment` is transferred to the new account.
|
||||
* - The `deploy` function is executed in the context of the newly-created account.
|
||||
**/
|
||||
putCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
instantiateWithCode: AugmentedSubmittable<(endowment: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, code: Bytes | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, Compact<Gas>, Bytes, Bytes, Bytes]>;
|
||||
/**
|
||||
* Updates the schedule for metering contracts.
|
||||
*
|
||||
@@ -1082,7 +1093,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* will go into phragmen, we assume full block for now.
|
||||
* # </weight>
|
||||
**/
|
||||
removeMember: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
removeMember: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
/**
|
||||
* Remove `origin` as a voter.
|
||||
*
|
||||
@@ -1215,7 +1226,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
|
||||
* sub identity of `sub`.
|
||||
**/
|
||||
addSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
|
||||
addSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
|
||||
/**
|
||||
* Cancel a previous request.
|
||||
*
|
||||
@@ -1278,7 +1289,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
killIdentity: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Provide a judgement for an account's identity.
|
||||
*
|
||||
@@ -1300,7 +1311,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<RegistrarIndex>, LookupSource, IdentityJudgement]>;
|
||||
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<RegistrarIndex>, LookupSource, IdentityJudgement]>;
|
||||
/**
|
||||
* Remove the sender as a sub-account.
|
||||
*
|
||||
@@ -1323,14 +1334,14 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
|
||||
* sub identity of `sub`.
|
||||
**/
|
||||
removeSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
removeSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Alter the associated name of the given sub-account.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
|
||||
* sub identity of `sub`.
|
||||
**/
|
||||
renameSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
|
||||
renameSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
|
||||
/**
|
||||
* Request a judgement from a registrar.
|
||||
*
|
||||
@@ -2538,7 +2549,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Total Complexity: O(M + logM + C)
|
||||
* # </weight>
|
||||
**/
|
||||
vote: AugmentedSubmittable<(candidate: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
vote: AugmentedSubmittable<(candidate: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
/**
|
||||
* As a member, vouch for someone to join society by placing a bid on their behalf.
|
||||
*
|
||||
@@ -2613,7 +2624,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Write: Bonded, Payee, [Origin Account], Locks, Ledger
|
||||
* # </weight>
|
||||
**/
|
||||
bond: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, RewardDestination]>;
|
||||
bond: AugmentedSubmittable<(controller: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, RewardDestination]>;
|
||||
/**
|
||||
* Add some extra amount that have appeared in the stash `free_balance` into the balance up
|
||||
* for staking.
|
||||
@@ -2748,7 +2759,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Note: Making this call only makes sense if you first set the validator preferences to
|
||||
* block any further nominations.
|
||||
**/
|
||||
kick: AugmentedSubmittable<(who: Vec<LookupSource> | (LookupSource | Address | AccountId | AccountIndex | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
|
||||
kick: AugmentedSubmittable<(who: Vec<LookupSource> | (LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
|
||||
/**
|
||||
* Declare the desire to nominate `targets` for the origin controller.
|
||||
*
|
||||
@@ -2770,7 +2781,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Writes: Validators, Nominators
|
||||
* # </weight>
|
||||
**/
|
||||
nominate: AugmentedSubmittable<(targets: Vec<LookupSource> | (LookupSource | Address | AccountId | AccountIndex | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
|
||||
nominate: AugmentedSubmittable<(targets: Vec<LookupSource> | (LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
|
||||
/**
|
||||
* Pay out all the stakers behind a single validator for a single era.
|
||||
*
|
||||
@@ -2865,7 +2876,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Write: Bonded, Ledger New Controller, Ledger Old Controller
|
||||
* # </weight>
|
||||
**/
|
||||
setController: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
setController: AugmentedSubmittable<(controller: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Set `HistoryDepth` value. This function will delete any history information
|
||||
* when `HistoryDepth` is reduced.
|
||||
@@ -3098,7 +3109,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - One DB change.
|
||||
* # </weight>
|
||||
**/
|
||||
setKey: AugmentedSubmittable<(updated: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
setKey: AugmentedSubmittable<(updated: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Authenticates the sudo key and dispatches a function call with `Root` origin.
|
||||
*
|
||||
@@ -3125,7 +3136,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Weight of derivative `call` execution + 10,000.
|
||||
* # </weight>
|
||||
**/
|
||||
sudoAs: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Call]>;
|
||||
sudoAs: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Call]>;
|
||||
/**
|
||||
* Authenticates the sudo key and dispatches a function call with `Root` origin.
|
||||
* This function does not check the weight of the call, and instead allows the
|
||||
@@ -3612,7 +3623,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - DbWrites: `ProposalCount`, `Proposals`, `origin account`
|
||||
* # </weight>
|
||||
**/
|
||||
proposeSpend: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, LookupSource]>;
|
||||
proposeSpend: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, LookupSource]>;
|
||||
/**
|
||||
* Reject a proposed spend. The original deposit will be slashed.
|
||||
*
|
||||
@@ -3703,7 +3714,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Writes: Vesting Storage, Balances Locks, Target Account, Source Account
|
||||
* # </weight>
|
||||
**/
|
||||
forceVestedTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, VestingInfo]>;
|
||||
forceVestedTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, VestingInfo]>;
|
||||
/**
|
||||
* Unlock any vested funds of the sender account.
|
||||
*
|
||||
@@ -3737,7 +3748,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Writes: Vesting Storage, Balances Locks, Target Account
|
||||
* # </weight>
|
||||
**/
|
||||
vestOther: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
vestOther: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Create a vested transfer.
|
||||
*
|
||||
@@ -3756,7 +3767,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]
|
||||
* # </weight>
|
||||
**/
|
||||
vestedTransfer: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, VestingInfo]>;
|
||||
vestedTransfer: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, VestingInfo]>;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import BN from 'bn.js';
|
||||
import { Metadata } from '@polkadot/metadata';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { LATEST_EXTRINSIC_VERSION } from '@polkadot/types/extrinsic/Extrinsic';
|
||||
import { getSpecAlias, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
|
||||
import { getSpecAlias, getSpecExtensions, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
|
||||
import { assert, BN_ZERO, logger, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
import { of } from '@polkadot/x-rxjs';
|
||||
@@ -37,10 +37,6 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
constructor (options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) {
|
||||
super(options, type, decorateMethod);
|
||||
|
||||
if (!this.hasSubscriptions) {
|
||||
l.warn('Api will be available in a limited mode since the provider does not support subscriptions');
|
||||
}
|
||||
|
||||
// all injected types added to the registry for overrides
|
||||
this.registry.setKnownTypes(options);
|
||||
|
||||
@@ -64,9 +60,14 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
this._rx.signer = options.signer;
|
||||
|
||||
this._rpcCore.setRegistrySwap((hash: string | Uint8Array) => this.getBlockRegistry(hash));
|
||||
this._rpcCore.provider.on('disconnected', this.#onProviderDisconnect);
|
||||
this._rpcCore.provider.on('error', this.#onProviderError);
|
||||
this._rpcCore.provider.on('connected', this.#onProviderConnect);
|
||||
|
||||
if (this.hasSubscriptions) {
|
||||
this._rpcCore.provider.on('disconnected', this.#onProviderDisconnect);
|
||||
this._rpcCore.provider.on('error', this.#onProviderError);
|
||||
this._rpcCore.provider.on('connected', this.#onProviderConnect);
|
||||
} else {
|
||||
l.warn('Api will be available in a limited mode since the provider does not support subscriptions');
|
||||
}
|
||||
|
||||
// If the provider was instantiated earlier, and has already emitted a
|
||||
// 'connected' event, then the `on('connected')` won't fire anymore. To
|
||||
@@ -90,7 +91,10 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
registry.knownTypes.typesAlias = getSpecAlias(registry, chain, version.specName);
|
||||
}
|
||||
|
||||
registry.setMetadata(metadata, undefined, this._options.signedExtensions);
|
||||
registry.setMetadata(metadata, undefined, {
|
||||
...getSpecExtensions(registry, chain, version.specName),
|
||||
...(this._options.signedExtensions || {})
|
||||
});
|
||||
|
||||
return registry;
|
||||
}
|
||||
@@ -193,7 +197,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
if (Object.keys(types).length) {
|
||||
(registry || this.registry).register(types as Record<string, string>);
|
||||
|
||||
l.log(`Capabilities detected${blockHash ? ` (${u8aToHex(u8aToU8a(blockHash))})` : ''}: ${JSON.stringify(types)}`);
|
||||
l.debug(`Capabilities detected${blockHash ? ` (${u8aToHex(u8aToU8a(blockHash))})` : ''}: ${JSON.stringify(types)}`);
|
||||
}
|
||||
})
|
||||
.catch(l.error);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import packageInfo from './package-info.json';
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api', version: '3.10.2' };
|
||||
@@ -12,7 +12,7 @@ import { hexToU8a } from '@polkadot/util';
|
||||
import { SingleAccountSigner } from '../../test/util';
|
||||
import { ApiPromise } from '.';
|
||||
|
||||
const TRANSFER_SIG = '0x7a10e5ed9a14284eca7bea53f81631981dddda5a3d2dee973b136475947264801465726e4829ae3994d9058df638d959d4e043c7f1924299546790dda1dea20a';
|
||||
const TRANSFER_SIG = '0x54f39e43f32376a5ab6cdfd4d0ce57802aa9ff85514a7ffa9f2a949078f02beca16af87427c45fe60d54aa847fd241d127ed39e21b101806f6b1f50f7a82500b';
|
||||
|
||||
describe('ApiPromise', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -66,14 +66,14 @@ export class SubmittableResult implements ISubmittableResult {
|
||||
/**
|
||||
* @description Filters EventRecords for the specified method & section (there could be multiple)
|
||||
*/
|
||||
public filterRecords (section: string, method: string): EventRecord[] {
|
||||
return filterAndApply(this.events, section, [method], recordIdentity);
|
||||
public filterRecords (section: string, method: string | string[]): EventRecord[] {
|
||||
return filterAndApply(this.events, section, Array.isArray(method) ? method : [method], recordIdentity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Finds an EventRecord for the specified method & section
|
||||
*/
|
||||
public findRecord (section: string, method: string): EventRecord | undefined {
|
||||
public findRecord (section: string, method: string | string[]): EventRecord | undefined {
|
||||
return this.filterRecords(section, method)[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ export interface ApiOptions extends RegisteredTypes {
|
||||
/**
|
||||
* @description Any chain-specific signed extensions that are now well-known
|
||||
*/
|
||||
signedExtensions?: Record<string, ExtDef>;
|
||||
signedExtensions?: ExtDef;
|
||||
/**
|
||||
* @description An external signer which will be used to sign extrinsic when account passed in is not KeyringPair
|
||||
*/
|
||||
|
||||
@@ -35,19 +35,19 @@ export type QueryableStorageEntry<ApiType extends ApiTypes, A extends AnyTuple =
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
: AugmentedQuery<'promise', GenericStorageEntryFunction, A> & StorageEntryPromiseOverloads;
|
||||
|
||||
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple> {
|
||||
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> {
|
||||
at: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
|
||||
creator: StorageEntry;
|
||||
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey<A>, T][]>;
|
||||
entriesAt: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(hash: Hash | Uint8Array | string, arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey<A>, T][]>;
|
||||
entriesPaged: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<A>, T][]>;
|
||||
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
entriesAt: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(hash: Hash | Uint8Array | string, arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
entriesPaged: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
|
||||
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
|
||||
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
|
||||
key: (...args: Parameters<F>) => string;
|
||||
keyPrefix: () => string;
|
||||
keys: (arg?: any) => PromiseOrObs<ApiType, StorageKey<A>[]>;
|
||||
keysAt: (hash: Hash | Uint8Array | string, arg?: any) => PromiseOrObs<ApiType, StorageKey<A>[]>;
|
||||
keysPaged: (opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, StorageKey<A>[]>;
|
||||
keys: <K extends AnyTuple = A> (arg?: any) => PromiseOrObs<ApiType, StorageKey<K>[]>;
|
||||
keysAt: <K extends AnyTuple = A> (hash: Hash | Uint8Array | string, arg?: any) => PromiseOrObs<ApiType, StorageKey<K>[]>;
|
||||
keysPaged: <K extends AnyTuple = A> (opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
|
||||
// @deprecated The underlying RPC this been marked unsafe and is generally not exposed
|
||||
range: <T extends Codec | any = ObsInnerType<ReturnType<F>>>([from, to]: [Hash | Uint8Array | string, Hash | Uint8Array | string | undefined] | [Hash | Uint8Array | string], ...args: Parameters<F>) => PromiseOrObs<ApiType, [Hash, T][]>;
|
||||
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/metadata",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "Helpers to extract information from runtime metadata",
|
||||
"main": "index.js",
|
||||
"sideEffects": [
|
||||
@@ -15,14 +15,14 @@
|
||||
"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.12.5",
|
||||
"@polkadot/types": "3.6.1",
|
||||
"@polkadot/types-known": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"@polkadot/util-crypto": "^5.4.2",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/types": "3.10.2",
|
||||
"@polkadot/types-known": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"@polkadot/util-crypto": "^5.7.1",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.4.2"
|
||||
"@polkadot/keyring": "^5.7.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ const registry = new TypeRegistry();
|
||||
const metadata = new Metadata(registry, metadataStatic);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
registry.register({ Address: 'IndicesLookupSource', LookupSource: 'IndicesLookupSource' });
|
||||
|
||||
const extrinsics = decorateExtrinsics(registry, metadata.asLatest, metadata.version);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import packageInfo from './package-info.json';
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/metadata', version: '3.10.2' };
|
||||
@@ -474,7 +474,7 @@
|
||||
{
|
||||
"name": "Version",
|
||||
"type": "RuntimeVersion",
|
||||
"value": "0x106e6f6465387375627374726174652d6e6f64650a000000050100000000000030df6acb689907609b0300000037e397fc7c91f5e40100000040fe3ad401f8959a04000000d2bc9897eed08f1502000000f78b278be53f454c02000000ed99c5acb25eedf502000000cbca25e39f14238702000000687ad44ad37f03c201000000bc9d89904f5b923f0100000068b66ba122c93fa70100000037c8bb1350a9a2a801000000ab3c0572291feb8b0100000002000000",
|
||||
"value": "0x106e6f6465387375627374726174652d6e6f64650a000000080100000000000034df6acb689907609b0300000037e397fc7c91f5e40100000040fe3ad401f8959a04000000d2bc9897eed08f1502000000f78b278be53f454c02000000ed99c5acb25eedf502000000cbca25e39f14238702000000687ad44ad37f03c201000000bc9d89904f5b923f0100000068b66ba122c93fa70100000037c8bb1350a9a2a80100000091d5df18b0d2cf5801000000ab3c0572291feb8b0100000002000000",
|
||||
"documentation": [
|
||||
" Get the chain's current version."
|
||||
]
|
||||
@@ -671,7 +671,7 @@
|
||||
"name": "GenesisSlot",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"Plain": "u64"
|
||||
"Plain": "Slot"
|
||||
},
|
||||
"fallback": "0x0000000000000000",
|
||||
"documentation": [
|
||||
@@ -683,7 +683,7 @@
|
||||
"name": "CurrentSlot",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"Plain": "u64"
|
||||
"Plain": "Slot"
|
||||
},
|
||||
"fallback": "0x0000000000000000",
|
||||
"documentation": [
|
||||
@@ -1331,7 +1331,7 @@
|
||||
"documentation": [
|
||||
" The balance of an account.",
|
||||
"",
|
||||
" NOTE: This is only used in the case that this module is used to store balances."
|
||||
" NOTE: This is only used in the case that this pallet is used to store balances."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1489,7 +1489,7 @@
|
||||
"",
|
||||
" 99% of the time you want [`transfer`] instead.",
|
||||
"",
|
||||
" [`transfer`]: struct.Module.html#method.transfer",
|
||||
" [`transfer`]: struct.Pallet.html#method.transfer",
|
||||
" # <weight>",
|
||||
" - Cheaper than transfer because account cannot be killed.",
|
||||
" - Base Weight: 51.4 µs",
|
||||
@@ -6842,7 +6842,7 @@
|
||||
"type": {
|
||||
"Plain": "Schedule"
|
||||
},
|
||||
"fallback": "0x000000000004000000000200000001000080000000100000000010000000010000200000000000080019060000016302005498030053100000941c0000a40d0000f11800005e2a00007000000044790100dcf102007907000080060000690700001a06000013190000f92800007f0700007d9ea70811080000a3070000770a00003308000023080000a5070000a3070000050a00003c0a000077090000b50900008f090000240a00007f09000041090000f9090000ec090000120a0000b70900003f0900003b200000cc1c000017200000471d0000e3090000c409000087090000080a00002e0a0000310a00003e0a0000380a00009c33260000000000a8fa2500000000005620250000000000848b4f00000000000e4a250000000000003f2500000000001066250000000000c0905400000000008c4e2500000000006c4b250000000000b49d490000000000466b12000000000090786500000000000f01000000000000b01b4300000000000003000000000000989e591f00000000c07d7c220000000040eca60900000000a4b55a0000000000701683000000000022b8c80700000000aa0900000000000076e85f0000000000bab5971100000000cf02000000000000f81bbb0800000000dedb070200000000dc050000000000007271d10900000000f49adb08000000007e070e08000000004a02000000000000260300000000000008f83e1b0000000051020000000000003103000000000000d70a000000000000d49522000000000068100000000000007c09250000000000240d000000000000b6e22000000000001f0600000000000006a22000000000001c06000000000000",
|
||||
"fallback": "0x0000000000040000000002000000010000800000001000000000100000000100002000000000000800150600004c6b02004c8103009e1800000b1d0000160d0000651800006d2b00008a000000f5700100fdf602008e070000440600006e070000030600004f180000b528000091070000b60da70827080000590800006a0a0000ef070000560800004a0800008e080000f509000061090000dd090000a10a00009c090000e409000091090000650900001e0a0000120a0000ae09000099090000060a00006b2000000b1d000051200000221d000094090000ad090000b6090000160a0000660a0000fd090000260a0000440a0000d41a2a0000000000a0c729000000000092122900000000001ab5580000000000ba1c290000000000e000290000000000b0ef280000000000ee325c0000000000dec1280000000000ca07290000000000c07d4e00000000009c77140000000000303a7200000000000b01000000000000f0ab450000000000ff0200000000000060a21c270000000030078d31000000002635af09000000000ae164000000000038b18e0000000000b6b1cc0700000000890900000000000040036c00000000008ad6e21100000000de020000000000006e67cc080000000078f6110200000000e605000000000000acb1b50a00000000b24419090000000092579f08000000004702000000000000240300000000000016eaeb220000000055020000000000003503000000000000db0a000000000000f4802600000000006a100000000000006a9a280000000000220d0000000000004e9c2400000000001c0600000000000026832400000000001b06000000000000",
|
||||
"documentation": [
|
||||
" Current cost schedule for contracts."
|
||||
]
|
||||
@@ -6939,19 +6939,6 @@
|
||||
" The schedule must have a greater version than the stored schedule."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "put_code",
|
||||
"args": [
|
||||
{
|
||||
"name": "code",
|
||||
"type": "Bytes"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Stores the given binary Wasm code into the chain's storage and returns its `codehash`.",
|
||||
" You can instantiate contracts only with stored code."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "call",
|
||||
"args": [
|
||||
@@ -6982,6 +6969,54 @@
|
||||
" a regular account will be created and any value will be transferred."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "instantiate_with_code",
|
||||
"args": [
|
||||
{
|
||||
"name": "endowment",
|
||||
"type": "Compact<BalanceOf>"
|
||||
},
|
||||
{
|
||||
"name": "gas_limit",
|
||||
"type": "Compact<Gas>"
|
||||
},
|
||||
{
|
||||
"name": "code",
|
||||
"type": "Bytes"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "Bytes"
|
||||
},
|
||||
{
|
||||
"name": "salt",
|
||||
"type": "Bytes"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Instantiates a new contract from the supplied `code` optionally transferring",
|
||||
" some balance.",
|
||||
"",
|
||||
" This is the only function that can deploy new code to the chain.",
|
||||
"",
|
||||
" # Parameters",
|
||||
"",
|
||||
" * `endowment`: The balance to transfer from the `origin` to the newly created contract.",
|
||||
" * `gas_limit`: The gas limit enforced when executing the constructor.",
|
||||
" * `code`: The contract code to deploy in raw bytes.",
|
||||
" * `data`: The input data to pass to the contract constructor.",
|
||||
" * `salt`: Used for the address derivation. See [`Self::contract_address`].",
|
||||
"",
|
||||
" Instantiation is executed as follows:",
|
||||
"",
|
||||
" - The supplied `code` is instrumented, deployed, and a `code_hash` is created for that code.",
|
||||
" - If the `code_hash` already exists on the chain the underlying `code` will be shared.",
|
||||
" - The destination address is computed based on the sender, code_hash and the salt.",
|
||||
" - The smart-contract account is created at the computed address.",
|
||||
" - The `endowment` is transferred to the new account.",
|
||||
" - The `deploy` function is executed in the context of the newly-created account."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "instantiate",
|
||||
"args": [
|
||||
@@ -7007,19 +7042,11 @@
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Instantiates a new contract from the `code_hash` generated by `put_code`,",
|
||||
" optionally transferring some balance.",
|
||||
" Instantiates a contract from a previously deployed wasm binary.",
|
||||
"",
|
||||
" The supplied `salt` is used for contract address deriviation. See `fn contract_address`.",
|
||||
"",
|
||||
" Instantiation is executed as follows:",
|
||||
"",
|
||||
" - The destination address is computed based on the sender, code_hash and the salt.",
|
||||
" - The smart-contract account is created at the computed address.",
|
||||
" - The `ctor_code` is executed in the context of the newly-created account. Buffer returned",
|
||||
" after the execution is saved as the `code` of the account. That code will be invoked",
|
||||
" upon any call received by this account.",
|
||||
" - The contract is initialized."
|
||||
" This function is identical to [`Self::instantiate_with_code`] but without the",
|
||||
" code deployment step. Instead, the `code_hash` of an on-chain deployed wasm binary",
|
||||
" must be supplied."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -7055,23 +7082,37 @@
|
||||
"AccountId"
|
||||
],
|
||||
"documentation": [
|
||||
" Contract deployed by address at the specified address. \\[owner, contract\\]"
|
||||
" Contract deployed by address at the specified address. \\[deployer, contract\\]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Evicted",
|
||||
"args": [
|
||||
"AccountId",
|
||||
"bool"
|
||||
"AccountId"
|
||||
],
|
||||
"documentation": [
|
||||
" Contract has been evicted and is now in tombstone state.",
|
||||
" \\[contract, tombstone\\]",
|
||||
" Contract has been evicted and is now in tombstone state. \\[contract\\]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Terminated",
|
||||
"args": [
|
||||
"AccountId",
|
||||
"AccountId"
|
||||
],
|
||||
"documentation": [
|
||||
" Contract has been terminated without leaving a tombstone.",
|
||||
" \\[contract, beneficiary\\]",
|
||||
"",
|
||||
" # Params",
|
||||
"",
|
||||
" - `contract`: `AccountId`: The account ID of the evicted contract.",
|
||||
" - `tombstone`: `bool`: True if the evicted contract left behind a tombstone."
|
||||
" - `contract`: The contract that was terminated.",
|
||||
" - `beneficiary`: The account that received the contracts remaining balance.",
|
||||
"",
|
||||
" # Note",
|
||||
"",
|
||||
" The only way for a contract to be removed without a tombstone and emitting",
|
||||
" this event is by calling `seal_terminate`."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -7083,15 +7124,15 @@
|
||||
"Balance"
|
||||
],
|
||||
"documentation": [
|
||||
" Restoration for a contract has been successful.",
|
||||
" \\[donor, dest, code_hash, rent_allowance\\]",
|
||||
" Restoration of a contract has been successful.",
|
||||
" \\[restorer, dest, code_hash, rent_allowance\\]",
|
||||
"",
|
||||
" # Params",
|
||||
"",
|
||||
" - `donor`: `AccountId`: Account ID of the restoring contract",
|
||||
" - `dest`: `AccountId`: Account ID of the restored contract",
|
||||
" - `code_hash`: `Hash`: Code hash of the restored contract",
|
||||
" - `rent_allowance: `Balance`: Rent allowance of the restored contract"
|
||||
" - `restorer`: Account ID of the restoring contract.",
|
||||
" - `dest`: Account ID of the restored contract.",
|
||||
" - `code_hash`: Code hash of the restored contract.",
|
||||
" - `rent_allowance`: Rent allowance of the restored contract."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -7100,8 +7141,7 @@
|
||||
"Hash"
|
||||
],
|
||||
"documentation": [
|
||||
" Code with the specified hash has been stored.",
|
||||
" \\[code_hash\\]"
|
||||
" Code with the specified hash has been stored. \\[code_hash\\]"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -7110,18 +7150,41 @@
|
||||
"u32"
|
||||
],
|
||||
"documentation": [
|
||||
" Triggered when the current \\[schedule\\] is updated."
|
||||
" Triggered when the current schedule is updated.",
|
||||
" \\[version\\]",
|
||||
"",
|
||||
" # Params",
|
||||
"",
|
||||
" - `version`: The version of the newly set schedule."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ContractExecution",
|
||||
"name": "ContractEmitted",
|
||||
"args": [
|
||||
"AccountId",
|
||||
"Bytes"
|
||||
],
|
||||
"documentation": [
|
||||
" An event deposited upon execution of a contract from the account.",
|
||||
" \\[account, data\\]"
|
||||
" A custom event emitted by the contract.",
|
||||
" \\[contract, data\\]",
|
||||
"",
|
||||
" # Params",
|
||||
"",
|
||||
" - `contract`: The contract that emitted the event.",
|
||||
" - `data`: Data supplied by the contract. Metadata generated during contract",
|
||||
" compilation is needed to decode it."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CodeRemoved",
|
||||
"args": [
|
||||
"Hash"
|
||||
],
|
||||
"documentation": [
|
||||
" A code with the specified hash was removed.",
|
||||
" \\[code_hash\\]",
|
||||
"",
|
||||
" This happens when the last contract that uses this code hash was removed or evicted."
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -7224,7 +7287,7 @@
|
||||
{
|
||||
"name": "DeletionQueueDepth",
|
||||
"type": "u32",
|
||||
"value": "0x11010000",
|
||||
"value": "0xf2000000",
|
||||
"documentation": [
|
||||
" The maximum number of tries that can be queued for deletion."
|
||||
]
|
||||
@@ -7328,7 +7391,8 @@
|
||||
{
|
||||
"name": "CodeTooLarge",
|
||||
"documentation": [
|
||||
" The code supplied to `put_code` exceeds the limit specified in the current schedule."
|
||||
" The code supplied to `instantiate_with_code` exceeds the limit specified in the",
|
||||
" current schedule."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -7428,6 +7492,12 @@
|
||||
" This can either happen when the accumulated storage in bytes is too large or",
|
||||
" when number of storage items is too large."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "DuplicateContract",
|
||||
"documentation": [
|
||||
" A contract with the same AccountId already exists."
|
||||
]
|
||||
}
|
||||
],
|
||||
"index": 17
|
||||
@@ -7648,7 +7718,7 @@
|
||||
},
|
||||
"fallback": "0x00000000",
|
||||
"documentation": [
|
||||
" For each session index, we keep a mapping of `T::ValidatorId` to the",
|
||||
" For each session index, we keep a mapping of `ValidatorId<T>` to the",
|
||||
" number of blocks authored by the given authority."
|
||||
]
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-core",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
"sideEffects": false,
|
||||
@@ -12,14 +12,14 @@
|
||||
"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.12.5",
|
||||
"@polkadot/metadata": "3.6.1",
|
||||
"@polkadot/rpc-provider": "3.6.1",
|
||||
"@polkadot/types": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"@polkadot/x-rxjs": "^5.4.2"
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/metadata": "3.10.2",
|
||||
"@polkadot/rpc-provider": "3.10.2",
|
||||
"@polkadot/types": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"@polkadot/x-rxjs": "^5.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.4.2"
|
||||
"@polkadot/keyring": "^5.7.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '3.10.2' };
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
"sideEffects": false,
|
||||
@@ -12,19 +12,20 @@
|
||||
"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.12.5",
|
||||
"@polkadot/types": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"@polkadot/util-crypto": "^5.4.2",
|
||||
"@polkadot/x-fetch": "^5.4.2",
|
||||
"@polkadot/x-ws": "^5.4.2",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/types": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"@polkadot/util-crypto": "^5.7.1",
|
||||
"@polkadot/x-fetch": "^5.7.1",
|
||||
"@polkadot/x-global": "^5.7.1",
|
||||
"@polkadot/x-ws": "^5.7.1",
|
||||
"bn.js": "^4.11.9",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.4.2",
|
||||
"@polkadot/metadata": "3.6.1",
|
||||
"@polkadot/keyring": "^5.7.1",
|
||||
"@polkadot/metadata": "3.10.2",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^13.0.6"
|
||||
"nock": "^13.0.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', version: '3.10.2' };
|
||||
@@ -8,6 +8,7 @@ import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, Pro
|
||||
import EventEmitter from 'eventemitter3';
|
||||
|
||||
import { assert, isChildClass, isNull, isUndefined, logger } from '@polkadot/util';
|
||||
import { xglobal } from '@polkadot/x-global';
|
||||
import { WebSocket } from '@polkadot/x-ws';
|
||||
|
||||
import { RpcCoder } from '../coder';
|
||||
@@ -160,7 +161,7 @@ export class WsProvider implements ProviderInterface {
|
||||
public async connect (): Promise<void> {
|
||||
try {
|
||||
this.#endpointIndex = (this.#endpointIndex + 1) % this.#endpoints.length;
|
||||
this.#websocket = typeof global.WebSocket !== 'undefined' && isChildClass(global.WebSocket, WebSocket)
|
||||
this.#websocket = typeof xglobal.WebSocket !== 'undefined' && isChildClass(xglobal.WebSocket, WebSocket)
|
||||
? new WebSocket(this.#endpoints[this.#endpointIndex])
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers
|
||||
@@ -188,14 +189,16 @@ export class WsProvider implements ProviderInterface {
|
||||
* @description Connect, never throwing an error, but rather forcing a retry
|
||||
*/
|
||||
public async connectWithRetry (): Promise<void> {
|
||||
try {
|
||||
await this.connect();
|
||||
} catch (error) {
|
||||
setTimeout((): void => {
|
||||
this.connectWithRetry().catch((): void => {
|
||||
// does not throw
|
||||
});
|
||||
}, this.#autoConnectMs || RETRY_DELAY);
|
||||
if (this.#autoConnectMs > 0) {
|
||||
try {
|
||||
await this.connect();
|
||||
} catch (error) {
|
||||
setTimeout((): void => {
|
||||
this.connectWithRetry().catch((): void => {
|
||||
// does not throw
|
||||
});
|
||||
}, this.#autoConnectMs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,8 +245,8 @@ export class WsProvider implements ProviderInterface {
|
||||
* @param params Encoded parameters as applicable for the method
|
||||
* @param subscription Subscription details (internally used)
|
||||
*/
|
||||
public send (method: string, params: any[], subscription?: SubscriptionHandler): Promise<any> {
|
||||
return new Promise((resolve, reject): void => {
|
||||
public send <T = any> (method: string, params: any[], subscription?: SubscriptionHandler): Promise<T> {
|
||||
return new Promise<T>((resolve, reject): void => {
|
||||
try {
|
||||
assert(this.isConnected && !isNull(this.#websocket), 'WebSocket is not connected');
|
||||
|
||||
@@ -295,10 +298,8 @@ export class WsProvider implements ProviderInterface {
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
public async subscribe (type: string, method: string, params: any[], callback: ProviderInterfaceCallback): Promise<number | string> {
|
||||
const id = await this.send(method, params, { callback, type }) as Promise<number | string>;
|
||||
|
||||
return id;
|
||||
public subscribe (type: string, method: string, params: any[], callback: ProviderInterfaceCallback): Promise<number | string> {
|
||||
return this.send<number | string>(method, params, { callback, type });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,9 +320,13 @@ export class WsProvider implements ProviderInterface {
|
||||
|
||||
delete this.#subscriptions[subscription];
|
||||
|
||||
const result = await this.send(method, [id]) as Promise<boolean>;
|
||||
|
||||
return result;
|
||||
try {
|
||||
return this.isConnected && !isNull(this.#websocket)
|
||||
? this.send<boolean>(method, [id])
|
||||
: true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#emit = (type: ProviderInterfaceEmitted, ...args: any[]): void => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/typegen",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "Type generation scripts",
|
||||
"main": "index.js",
|
||||
"sideEffects": false,
|
||||
@@ -19,20 +19,20 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/register": "^7.12.10",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/api": "3.6.1",
|
||||
"@polkadot/metadata": "3.6.1",
|
||||
"@polkadot/rpc-provider": "3.6.1",
|
||||
"@polkadot/types": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"handlebars": "^4.7.6",
|
||||
"@babel/core": "^7.12.17",
|
||||
"@babel/register": "^7.12.13",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/api": "3.10.2",
|
||||
"@polkadot/metadata": "3.10.2",
|
||||
"@polkadot/rpc-provider": "3.10.2",
|
||||
"@polkadot/types": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"handlebars": "^4.7.7",
|
||||
"websocket": "^1.0.33",
|
||||
"yargs": "^16.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/websocket": "^1.0.1",
|
||||
"@types/yargs": "^15.0.12"
|
||||
"@types/yargs": "^16.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,12 +87,12 @@ function tsInt (definitions: Record<string, ModuleTypes>, def: TypeDef, imports:
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsResultGetter (definitions: Record<string, ModuleTypes>, resultName = '', getter: 'Ok' | 'Error', def: TypeDef, imports: TypeImports): string {
|
||||
function tsResultGetter (definitions: Record<string, ModuleTypes>, resultName = '', getter: 'Ok' | 'Err' | 'Error', def: TypeDef, imports: TypeImports): string {
|
||||
const { info, type } = def;
|
||||
const asGetter = type === 'Null'
|
||||
? ''
|
||||
: createGetter(definitions, `as${getter}`, info === TypeDefInfo.Tuple ? formatType(definitions, def, imports) : type, imports);
|
||||
const isGetter = createGetter(definitions, `is${getter}`, 'boolean', imports);
|
||||
: (getter === 'Error' ? ' /** @deprecated Use asErr */\n' : '') + createGetter(definitions, `as${getter}`, info === TypeDefInfo.Tuple ? formatType(definitions, def, imports) : type, imports);
|
||||
const isGetter = (getter === 'Error' ? ' /** @deprecated Use isErr */\n' : '') + createGetter(definitions, `is${getter}`, 'boolean', imports);
|
||||
|
||||
switch (info) {
|
||||
case TypeDefInfo.Plain:
|
||||
@@ -110,6 +110,8 @@ function tsResultGetter (definitions: Record<string, ModuleTypes>, resultName =
|
||||
function tsResult (definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
const [okDef, errorDef] = (def.sub as TypeDef[]);
|
||||
const inner = [
|
||||
tsResultGetter(definitions, def.name, 'Err', errorDef, imports),
|
||||
// @deprecated, use Err
|
||||
tsResultGetter(definitions, def.name, 'Error', errorDef, imports),
|
||||
tsResultGetter(definitions, def.name, 'Ok', okDef, imports)
|
||||
].join('');
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/typegen', version: '3.10.2' };
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types-known",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
"sideEffects": false,
|
||||
@@ -12,9 +12,10 @@
|
||||
"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.12.5",
|
||||
"@polkadot/types": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/networks": "^5.7.1",
|
||||
"@polkadot/types": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { Text } from '@polkadot/types';
|
||||
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
||||
import type { Hash } from '@polkadot/types/interfaces';
|
||||
import type { ChainUpgradeVersion, DefinitionRpc, DefinitionRpcSub, OverrideModuleType, OverrideVersionedType, Registry, RegistryTypes } from '@polkadot/types/types';
|
||||
|
||||
@@ -37,6 +38,19 @@ export function getModuleTypes ({ knownTypes }: Registry, section: string): Over
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Based on the chain and runtimeVersion, get the applicable signed extensions (ready for registration)
|
||||
*/
|
||||
export function getSpecExtensions ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): ExtDef {
|
||||
const _chainName = chainName.toString();
|
||||
const _specName = specName.toString();
|
||||
|
||||
return {
|
||||
...(knownTypes.typesBundle?.spec?.[_specName]?.signedExtensions || {}),
|
||||
...(knownTypes.typesBundle?.chain?.[_chainName]?.signedExtensions || {})
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Based on the chain and runtimeVersion, get the applicable types (ready for registration)
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/types-known', version: '3.10.2' };
|
||||
@@ -6,19 +6,30 @@
|
||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
Keys: 'SessionKeys6',
|
||||
LookupSource: 'MultiAddress',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy']
|
||||
},
|
||||
ValidatorPrefs: 'ValidatorPrefsWithBlocked'
|
||||
};
|
||||
|
||||
const addrIndicesTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'LookupSource',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'IndicesLookupSource',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement']
|
||||
}
|
||||
};
|
||||
|
||||
const indicesTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'LookupSource',
|
||||
LookupSource: 'IndicesLookupSource'
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
@@ -26,7 +37,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
// 1020 is first CC3
|
||||
minmax: [1019, 1031],
|
||||
types: {
|
||||
...indicesTypes,
|
||||
...addrIndicesTypes,
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchError: 'DispatchErrorTo198',
|
||||
@@ -46,7 +57,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [1032, 1042],
|
||||
types: {
|
||||
...indicesTypes,
|
||||
...addrIndicesTypes,
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
@@ -66,7 +77,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
// actual at 1045 (1043-1044 is dev)
|
||||
minmax: [1043, 1045],
|
||||
types: {
|
||||
...indicesTypes,
|
||||
...addrIndicesTypes,
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
@@ -86,6 +97,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
types: {
|
||||
// Indices optional, not in transaction
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
@@ -101,6 +113,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1055, 1056],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
@@ -115,6 +128,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1057, 1061],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -126,6 +140,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1062, 2012],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -136,6 +151,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [2013, 2022],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259',
|
||||
RewardDestination: 'RewardDestinationTo257'
|
||||
@@ -145,11 +161,19 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [2023, 2024],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
RefCount: 'RefCountTo259'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [2025, undefined],
|
||||
minmax: [2025, 2027],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [2028, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
|
||||
@@ -7,14 +7,7 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, 99],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
LookupSource: 'AccountId'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [100, undefined],
|
||||
minmax: [0, undefined],
|
||||
types: {
|
||||
Address: 'MultiAddress',
|
||||
LookupSource: 'MultiAddress'
|
||||
|
||||
@@ -8,21 +8,13 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
// these are override types for Polkadot
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, 259],
|
||||
minmax: [0, 260],
|
||||
types: {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'LookupSource',
|
||||
LookupSource: 'IndicesLookupSource'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [260, 260],
|
||||
types: {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'MultiAddress',
|
||||
LookupSource: 'MultiAddress'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [261, undefined],
|
||||
types: {
|
||||
|
||||
@@ -6,14 +6,22 @@
|
||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
Keys: 'SessionKeys6',
|
||||
LookupSource: 'MultiAddress',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'DeprecatedSudoBalances', 'IdentityJudgement', 'CancelProxy']
|
||||
},
|
||||
ValidatorPrefs: 'ValidatorPrefsWithBlocked'
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
// was: SudoBalances
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'Unused', 'IdentityJudgement']
|
||||
}
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
// these are override types for Polkadot
|
||||
@@ -22,6 +30,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [0, 12],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -32,6 +41,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [13, 22],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259',
|
||||
RewardDestination: 'RewardDestinationTo257'
|
||||
@@ -41,11 +51,19 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [23, 24],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
RefCount: 'RefCountTo259'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [25, undefined],
|
||||
minmax: [25, 27],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [28, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
|
||||
@@ -9,33 +9,24 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
const sharedTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
FullIdentification: '()', // No staking, only session (as per config)
|
||||
LookupSource: 'AccountId',
|
||||
LookupSource: 'MultiAddress',
|
||||
Keys: 'SessionKeys6'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, 9],
|
||||
minmax: [0, 200],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259',
|
||||
RewardDestination: 'RewardDestinationTo257',
|
||||
Keys: 'SessionKeys5'
|
||||
Address: 'AccountId',
|
||||
LookupSource: 'AccountId'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [10, 12],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
Keys: 'SessionKeys5'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [13, undefined],
|
||||
minmax: [201, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
|
||||
@@ -6,14 +6,23 @@
|
||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
Keys: 'SessionKeys6',
|
||||
LookupSource: 'MultiAddress',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances', 'IdentityJudgement', 'CancelProxy'
|
||||
]
|
||||
},
|
||||
ValidatorPrefs: 'ValidatorPrefsWithBlocked'
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
// was: SudoBalances
|
||||
_enum: ['Any', 'NonTransfer', 'Staking', 'Unused', 'IdentityJudgement']
|
||||
}
|
||||
Keys: 'SessionKeys5',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
@@ -21,6 +30,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1, 2],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -33,6 +43,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [3, 22],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -43,6 +54,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [23, 42],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259',
|
||||
RewardDestination: 'RewardDestinationTo257'
|
||||
@@ -52,11 +64,19 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [43, 44],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
RefCount: 'RefCountTo259'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [45, undefined],
|
||||
minmax: [45, 47],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [48, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
|
||||
@@ -1,10 +1,62 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { assert, u8aEq } from '@polkadot/util';
|
||||
|
||||
import all from '.';
|
||||
|
||||
interface TestDef {
|
||||
genesisHash: string;
|
||||
network: string;
|
||||
versions: [number, [number, number]][];
|
||||
}
|
||||
|
||||
const TESTS: TestDef[] = [
|
||||
{
|
||||
genesisHash: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe',
|
||||
network: 'kusama',
|
||||
versions: [
|
||||
[0, [0, 1020]],
|
||||
[17, [901442, 1045]]
|
||||
]
|
||||
},
|
||||
{
|
||||
genesisHash: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3',
|
||||
network: 'polkadot',
|
||||
versions: [
|
||||
[0, [0, 0]],
|
||||
[19, [2436698, 26]]
|
||||
]
|
||||
},
|
||||
{
|
||||
genesisHash: '0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e',
|
||||
network: 'westend',
|
||||
versions: [
|
||||
[0, [214356, 4]],
|
||||
[23, [4207800, 48]]
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
describe('upgrades', (): void => {
|
||||
it('is valid', (): void => {
|
||||
expect(all).toBeDefined();
|
||||
TESTS.forEach(({ genesisHash, network, versions }): void => {
|
||||
describe(network, (): void => {
|
||||
const chain = all.find((n) => n.network === network);
|
||||
|
||||
assert(chain, `Unable to find the entry for ${network}`);
|
||||
|
||||
it('has a valid genesisHash', (): void => {
|
||||
expect(u8aEq(chain.genesisHash, genesisHash)).toBe(true);
|
||||
});
|
||||
|
||||
versions.forEach(([index, [blockNumber, specVersion]]): void => {
|
||||
it(`has a valid entry at index ${index}`, (): void => {
|
||||
const version = chain.versions[index];
|
||||
|
||||
expect(version.blockNumber.eqn(blockNumber)).toBe(true);
|
||||
expect(version.specVersion.eqn(specVersion)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,14 +6,22 @@ import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import networks from '@polkadot/networks';
|
||||
import { assert, hexToU8a } from '@polkadot/util';
|
||||
|
||||
import kusama from './kusama';
|
||||
import polkadot from './polkadot';
|
||||
import westend from './westend';
|
||||
|
||||
// testnets are not available in the networks map
|
||||
const NET_EXTRA: Record<string, { genesisHash: string[] }> = {
|
||||
westend: {
|
||||
genesisHash: ['0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e']
|
||||
}
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
function checkOrder (network: string, versions: [number, number][]): [number, number][] {
|
||||
function checkOrder (network: string, versions: ChainUpgradesRaw): [number, number][] {
|
||||
const ooo = versions.filter((curr, index): boolean => {
|
||||
const prev = versions[index - 1];
|
||||
|
||||
@@ -28,9 +36,13 @@ function checkOrder (network: string, versions: [number, number][]): [number, nu
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function rawToFinal (network: string, { genesisHash, versions }: ChainUpgradesRaw): ChainUpgrades {
|
||||
function mapRaw ([network, versions]: [string, ChainUpgradesRaw]): ChainUpgrades {
|
||||
const chain = networks.find((n) => n.network === network) || NET_EXTRA[network];
|
||||
|
||||
assert(chain, `Unable to find info for chain ${network}`);
|
||||
|
||||
return {
|
||||
genesisHash: hexToU8a(genesisHash),
|
||||
genesisHash: hexToU8a(chain.genesisHash[0]),
|
||||
network,
|
||||
versions: checkOrder(network, versions).map(([blockNumber, specVersion]) => ({
|
||||
blockNumber: new BN(blockNumber),
|
||||
@@ -40,10 +52,6 @@ function rawToFinal (network: string, { genesisHash, versions }: ChainUpgradesRa
|
||||
}
|
||||
|
||||
// Type overrides for specific spec types & versions as given in runtimeVersion
|
||||
const upgrades: ChainUpgrades[] = [
|
||||
rawToFinal('kusama', kusama),
|
||||
rawToFinal('polkadot', polkadot),
|
||||
rawToFinal('westend', westend)
|
||||
];
|
||||
const upgrades = Object.entries({ kusama, polkadot, westend }).map(mapRaw);
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -3,18 +3,16 @@
|
||||
|
||||
import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
const upgrades: ChainUpgradesRaw = {
|
||||
genesisHash: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe',
|
||||
versions: [
|
||||
[0, 1020], [26669, 1021], [38245, 1022], [54248, 1023], [59659, 1024],
|
||||
[67651, 1025], [82191, 1027], [83238, 1028], [101503, 1029], [203466, 1030],
|
||||
[295787, 1031], [461692, 1032], [504329, 1033], [569327, 1038], [587687, 1039],
|
||||
[653183, 1040], [693488, 1042], [901442, 1045], [1375086, 1050], [1445458, 1051],
|
||||
[1472960, 1052], [1475648, 1053], [1491596, 1054], [1574408, 1055], [2064961, 1058],
|
||||
[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]
|
||||
]
|
||||
};
|
||||
const upgrades: ChainUpgradesRaw = [
|
||||
[0, 1020], [26669, 1021], [38245, 1022], [54248, 1023], [59659, 1024],
|
||||
[67651, 1025], [82191, 1027], [83238, 1028], [101503, 1029], [203466, 1030],
|
||||
[295787, 1031], [461692, 1032], [504329, 1033], [569327, 1038], [587687, 1039],
|
||||
[653183, 1040], [693488, 1042], [901442, 1045], [1375086, 1050], [1445458, 1051],
|
||||
[1472960, 1052], [1475648, 1053], [1491596, 1054], [1574408, 1055], [2064961, 1058],
|
||||
[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]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
|
||||
import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
const upgrades: ChainUpgradesRaw = {
|
||||
genesisHash: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3',
|
||||
versions: [
|
||||
[0, 0], [29231, 1], [188836, 5], [199405, 6], [214264, 7],
|
||||
[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]
|
||||
]
|
||||
};
|
||||
const upgrades: ChainUpgradesRaw = [
|
||||
[0, 0], [29231, 1], [188836, 5], [199405, 6], [214264, 7],
|
||||
[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]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export interface ChainUpgradesRaw {
|
||||
genesisHash: string;
|
||||
versions: [number, number][];
|
||||
}
|
||||
export type ChainUpgradesRaw = [number, number][];
|
||||
|
||||
@@ -3,15 +3,12 @@
|
||||
|
||||
import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
const upgrades: ChainUpgradesRaw = {
|
||||
genesisHash: '0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e',
|
||||
versions: [
|
||||
[214356, 4], [392764, 7], [409740, 8], [809976, 20], [877581, 24],
|
||||
[879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29],
|
||||
[1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35],
|
||||
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
|
||||
[2549864, 45], [3925782, 46], [3925843, 47]
|
||||
]
|
||||
};
|
||||
const upgrades: ChainUpgradesRaw = [
|
||||
[214356, 4], [392764, 7], [409740, 8], [809976, 20], [877581, 24],
|
||||
[879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29],
|
||||
[1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35],
|
||||
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
|
||||
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types",
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.2",
|
||||
"description": "Implementation of the Parity codec",
|
||||
"main": "index.js",
|
||||
"sideEffects": [
|
||||
@@ -15,15 +15,15 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/metadata": "3.6.1",
|
||||
"@polkadot/util": "^5.4.2",
|
||||
"@polkadot/util-crypto": "^5.4.2",
|
||||
"@polkadot/x-rxjs": "^5.4.2",
|
||||
"@babel/runtime": "^7.12.18",
|
||||
"@polkadot/metadata": "3.10.2",
|
||||
"@polkadot/util": "^5.7.1",
|
||||
"@polkadot/util-crypto": "^5.7.1",
|
||||
"@polkadot/x-rxjs": "^5.7.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.4.2"
|
||||
"@polkadot/keyring": "^5.7.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ 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, InstructionWeights, Limits, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, ScheduleTo258, 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, PrefabWasmModuleReserved, 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 { 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';
|
||||
import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth';
|
||||
import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth';
|
||||
import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } from '@polkadot/types/interfaces/evm';
|
||||
import type { AnySignature, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset';
|
||||
@@ -31,14 +31,14 @@ import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lotter
|
||||
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 { 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, MultiAsset, MultiLocation, NetworkId, NewBidder, NewBidderOption, Order, OriginKind, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainProposal, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueryHolding, QueuedParathread, RegisteredParachainInfo, RelayChainBlockNumber, RelayTo, RelayedFrom, Remark, ReserveAssetDeposit, Retriable, Scheduling, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, TeleportAsset, Transact, TransientValidationData, UpwardMessage, ValidationCode, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, 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, 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 { 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, 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, StorageData, 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, 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 { 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';
|
||||
@@ -46,7 +46,7 @@ import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, Vouching
|
||||
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactScore, CompactScoreCompact, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RewardDestination, RewardDestinationTo257, RewardPoint, SeatHolder, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, Voter } from '@polkadot/types/interfaces/staking';
|
||||
import type { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
|
||||
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||
import type { AccountInfo, AccountInfoWithProviders, AccountInfoWithRefCount, ApplyExtrinsicResult, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClass, PerDispatchClassU32, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system';
|
||||
import type { AccountInfo, AccountInfoWithProviders, AccountInfoWithRefCount, ApplyExtrinsicResult, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system';
|
||||
import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
||||
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||
import type { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
|
||||
@@ -109,6 +109,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Compact<SetId>': Compact<SetId>;
|
||||
'Compact<SetIndex>': Compact<SetIndex>;
|
||||
'Compact<SiLookupTypeId>': Compact<SiLookupTypeId>;
|
||||
'Compact<Slot>': Compact<Slot>;
|
||||
'Compact<SlotNumber>': Compact<SlotNumber>;
|
||||
'Compact<SpanIndex>': Compact<SpanIndex>;
|
||||
'Compact<StrikeCount>': Compact<StrikeCount>;
|
||||
@@ -339,6 +340,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<EthereumSignature>': Option<EthereumSignature>;
|
||||
'Option<EthFilter>': Option<EthFilter>;
|
||||
'Option<EthFilterAddress>': Option<EthFilterAddress>;
|
||||
'Option<EthFilterChanges>': Option<EthFilterChanges>;
|
||||
'Option<EthFilterTopic>': Option<EthFilterTopic>;
|
||||
'Option<EthFilterTopicEntry>': Option<EthFilterTopicEntry>;
|
||||
'Option<EthFilterTopicInner>': Option<EthFilterTopicInner>;
|
||||
@@ -436,6 +438,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<HeartbeatTo244>': Option<HeartbeatTo244>;
|
||||
'Option<HostConfiguration>': Option<HostConfiguration>;
|
||||
'Option<HostFnWeights>': Option<HostFnWeights>;
|
||||
'Option<HostFnWeightsTo264>': Option<HostFnWeightsTo264>;
|
||||
'Option<HrmpChannel>': Option<HrmpChannel>;
|
||||
'Option<HrmpChannelId>': Option<HrmpChannelId>;
|
||||
'Option<HrmpOpenChannelRequest>': Option<HrmpOpenChannelRequest>;
|
||||
@@ -491,6 +494,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<LeasePeriod>': Option<LeasePeriod>;
|
||||
'Option<LeasePeriodOf>': Option<LeasePeriodOf>;
|
||||
'Option<Limits>': Option<Limits>;
|
||||
'Option<LimitsTo264>': Option<LimitsTo264>;
|
||||
'Option<LocalValidationData>': Option<LocalValidationData>;
|
||||
'Option<LockIdentifier>': Option<LockIdentifier>;
|
||||
'Option<LookupSource>': Option<LookupSource>;
|
||||
@@ -506,6 +510,9 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<MemberCount>': Option<MemberCount>;
|
||||
'Option<MembershipProof>': Option<MembershipProof>;
|
||||
'Option<MessageIngestionType>': Option<MessageIngestionType>;
|
||||
'Option<MessageQueueChain>': Option<MessageQueueChain>;
|
||||
'Option<MessagingStateSnapshot>': Option<MessagingStateSnapshot>;
|
||||
'Option<MessagingStateSnapshotEgressEntry>': Option<MessagingStateSnapshotEgressEntry>;
|
||||
'Option<MetadataAll>': Option<MetadataAll>;
|
||||
'Option<MetadataLatest>': Option<MetadataLatest>;
|
||||
'Option<MetadataV10>': Option<MetadataV10>;
|
||||
@@ -570,10 +577,12 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<PalletsOrigin>': Option<PalletsOrigin>;
|
||||
'Option<PalletVersion>': Option<PalletVersion>;
|
||||
'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>;
|
||||
'Option<ParachainInherentData>': Option<ParachainInherentData>;
|
||||
'Option<ParachainProposal>': Option<ParachainProposal>;
|
||||
'Option<ParaGenesisArgs>': Option<ParaGenesisArgs>;
|
||||
'Option<ParaId>': Option<ParaId>;
|
||||
'Option<ParaInfo>': Option<ParaInfo>;
|
||||
'Option<ParaLifecycle>': Option<ParaLifecycle>;
|
||||
'Option<ParaPastCodeMeta>': Option<ParaPastCodeMeta>;
|
||||
'Option<ParaScheduling>': Option<ParaScheduling>;
|
||||
'Option<ParathreadClaim>': Option<ParathreadClaim>;
|
||||
@@ -590,8 +599,9 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<PendingResume>': Option<PendingResume>;
|
||||
'Option<Perbill>': Option<Perbill>;
|
||||
'Option<Percent>': Option<Percent>;
|
||||
'Option<PerDispatchClass>': Option<PerDispatchClass>;
|
||||
'Option<PerDispatchClassU32>': Option<PerDispatchClassU32>;
|
||||
'Option<PerDispatchClassWeight>': Option<PerDispatchClassWeight>;
|
||||
'Option<PerDispatchClassWeightsPerClass>': Option<PerDispatchClassWeightsPerClass>;
|
||||
'Option<Period>': Option<Period>;
|
||||
'Option<Permill>': Option<Permill>;
|
||||
'Option<PermissionLatest>': Option<PermissionLatest>;
|
||||
@@ -653,6 +663,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<Registration>': Option<Registration>;
|
||||
'Option<RegistrationJudgement>': Option<RegistrationJudgement>;
|
||||
'Option<RelayChainBlockNumber>': Option<RelayChainBlockNumber>;
|
||||
'Option<RelayChainHash>': Option<RelayChainHash>;
|
||||
'Option<RelayedFrom>': Option<RelayedFrom>;
|
||||
'Option<RelayTo>': Option<RelayTo>;
|
||||
'Option<Releases>': Option<Releases>;
|
||||
@@ -679,6 +690,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<SchedulePriority>': Option<SchedulePriority>;
|
||||
'Option<ScheduleTo212>': Option<ScheduleTo212>;
|
||||
'Option<ScheduleTo258>': Option<ScheduleTo258>;
|
||||
'Option<ScheduleTo264>': Option<ScheduleTo264>;
|
||||
'Option<Scheduling>': Option<Scheduling>;
|
||||
'Option<Seal>': Option<Seal>;
|
||||
'Option<SealV0>': Option<SealV0>;
|
||||
@@ -719,6 +731,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<SlashingSpans>': Option<SlashingSpans>;
|
||||
'Option<SlashingSpansTo204>': Option<SlashingSpansTo204>;
|
||||
'Option<SlashJournalEntry>': Option<SlashJournalEntry>;
|
||||
'Option<Slot>': Option<Slot>;
|
||||
'Option<SlotNumber>': Option<SlotNumber>;
|
||||
'Option<SlotRange>': Option<SlotRange>;
|
||||
'Option<SocietyJudgement>': Option<SocietyJudgement>;
|
||||
@@ -760,11 +773,13 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<StorageMetadataV11>': Option<StorageMetadataV11>;
|
||||
'Option<StorageMetadataV12>': Option<StorageMetadataV12>;
|
||||
'Option<StorageMetadataV9>': Option<StorageMetadataV9>;
|
||||
'Option<StorageProof>': Option<StorageProof>;
|
||||
'Option<StoredPendingChange>': Option<StoredPendingChange>;
|
||||
'Option<StoredState>': Option<StoredState>;
|
||||
'Option<StrikeCount>': Option<StrikeCount>;
|
||||
'Option<SubId>': Option<SubId>;
|
||||
'Option<SyncState>': Option<SyncState>;
|
||||
'Option<SystemInherentData>': Option<SystemInherentData>;
|
||||
'Option<SystemOrigin>': Option<SystemOrigin>;
|
||||
'Option<Tally>': Option<Tally>;
|
||||
'Option<TaskAddress>': Option<TaskAddress>;
|
||||
@@ -818,6 +833,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<ValidatorPrefsWithCommission>': Option<ValidatorPrefsWithCommission>;
|
||||
'Option<ValidatorSignature>': Option<ValidatorSignature>;
|
||||
'Option<ValidityAttestation>': Option<ValidityAttestation>;
|
||||
'Option<VecInboundHrmpMessage>': Option<VecInboundHrmpMessage>;
|
||||
'Option<VersionedMultiAsset>': Option<VersionedMultiAsset>;
|
||||
'Option<VersionedMultiLocation>': Option<VersionedMultiLocation>;
|
||||
'Option<VersionedXcm>': Option<VersionedXcm>;
|
||||
@@ -1055,6 +1071,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<EthereumSignature>': Vec<EthereumSignature>;
|
||||
'Vec<EthFilter>': Vec<EthFilter>;
|
||||
'Vec<EthFilterAddress>': Vec<EthFilterAddress>;
|
||||
'Vec<EthFilterChanges>': Vec<EthFilterChanges>;
|
||||
'Vec<EthFilterTopic>': Vec<EthFilterTopic>;
|
||||
'Vec<EthFilterTopicEntry>': Vec<EthFilterTopicEntry>;
|
||||
'Vec<EthFilterTopicInner>': Vec<EthFilterTopicInner>;
|
||||
@@ -1152,6 +1169,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<HeartbeatTo244>': Vec<HeartbeatTo244>;
|
||||
'Vec<HostConfiguration>': Vec<HostConfiguration>;
|
||||
'Vec<HostFnWeights>': Vec<HostFnWeights>;
|
||||
'Vec<HostFnWeightsTo264>': Vec<HostFnWeightsTo264>;
|
||||
'Vec<HrmpChannel>': Vec<HrmpChannel>;
|
||||
'Vec<HrmpChannelId>': Vec<HrmpChannelId>;
|
||||
'Vec<HrmpOpenChannelRequest>': Vec<HrmpOpenChannelRequest>;
|
||||
@@ -1207,6 +1225,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<LeasePeriod>': Vec<LeasePeriod>;
|
||||
'Vec<LeasePeriodOf>': Vec<LeasePeriodOf>;
|
||||
'Vec<Limits>': Vec<Limits>;
|
||||
'Vec<LimitsTo264>': Vec<LimitsTo264>;
|
||||
'Vec<LocalValidationData>': Vec<LocalValidationData>;
|
||||
'Vec<LockIdentifier>': Vec<LockIdentifier>;
|
||||
'Vec<LookupSource>': Vec<LookupSource>;
|
||||
@@ -1222,6 +1241,9 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<MemberCount>': Vec<MemberCount>;
|
||||
'Vec<MembershipProof>': Vec<MembershipProof>;
|
||||
'Vec<MessageIngestionType>': Vec<MessageIngestionType>;
|
||||
'Vec<MessageQueueChain>': Vec<MessageQueueChain>;
|
||||
'Vec<MessagingStateSnapshot>': Vec<MessagingStateSnapshot>;
|
||||
'Vec<MessagingStateSnapshotEgressEntry>': Vec<MessagingStateSnapshotEgressEntry>;
|
||||
'Vec<MetadataAll>': Vec<MetadataAll>;
|
||||
'Vec<MetadataLatest>': Vec<MetadataLatest>;
|
||||
'Vec<MetadataV10>': Vec<MetadataV10>;
|
||||
@@ -1286,10 +1308,12 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<PalletsOrigin>': Vec<PalletsOrigin>;
|
||||
'Vec<PalletVersion>': Vec<PalletVersion>;
|
||||
'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>;
|
||||
'Vec<ParachainInherentData>': Vec<ParachainInherentData>;
|
||||
'Vec<ParachainProposal>': Vec<ParachainProposal>;
|
||||
'Vec<ParaGenesisArgs>': Vec<ParaGenesisArgs>;
|
||||
'Vec<ParaId>': Vec<ParaId>;
|
||||
'Vec<ParaInfo>': Vec<ParaInfo>;
|
||||
'Vec<ParaLifecycle>': Vec<ParaLifecycle>;
|
||||
'Vec<ParaPastCodeMeta>': Vec<ParaPastCodeMeta>;
|
||||
'Vec<ParaScheduling>': Vec<ParaScheduling>;
|
||||
'Vec<ParathreadClaim>': Vec<ParathreadClaim>;
|
||||
@@ -1306,8 +1330,9 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<PendingResume>': Vec<PendingResume>;
|
||||
'Vec<Perbill>': Vec<Perbill>;
|
||||
'Vec<Percent>': Vec<Percent>;
|
||||
'Vec<PerDispatchClass>': Vec<PerDispatchClass>;
|
||||
'Vec<PerDispatchClassU32>': Vec<PerDispatchClassU32>;
|
||||
'Vec<PerDispatchClassWeight>': Vec<PerDispatchClassWeight>;
|
||||
'Vec<PerDispatchClassWeightsPerClass>': Vec<PerDispatchClassWeightsPerClass>;
|
||||
'Vec<Period>': Vec<Period>;
|
||||
'Vec<Permill>': Vec<Permill>;
|
||||
'Vec<PermissionLatest>': Vec<PermissionLatest>;
|
||||
@@ -1369,6 +1394,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<Registration>': Vec<Registration>;
|
||||
'Vec<RegistrationJudgement>': Vec<RegistrationJudgement>;
|
||||
'Vec<RelayChainBlockNumber>': Vec<RelayChainBlockNumber>;
|
||||
'Vec<RelayChainHash>': Vec<RelayChainHash>;
|
||||
'Vec<RelayedFrom>': Vec<RelayedFrom>;
|
||||
'Vec<RelayTo>': Vec<RelayTo>;
|
||||
'Vec<Releases>': Vec<Releases>;
|
||||
@@ -1395,6 +1421,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<SchedulePriority>': Vec<SchedulePriority>;
|
||||
'Vec<ScheduleTo212>': Vec<ScheduleTo212>;
|
||||
'Vec<ScheduleTo258>': Vec<ScheduleTo258>;
|
||||
'Vec<ScheduleTo264>': Vec<ScheduleTo264>;
|
||||
'Vec<Scheduling>': Vec<Scheduling>;
|
||||
'Vec<Seal>': Vec<Seal>;
|
||||
'Vec<SealV0>': Vec<SealV0>;
|
||||
@@ -1435,6 +1462,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<SlashingSpans>': Vec<SlashingSpans>;
|
||||
'Vec<SlashingSpansTo204>': Vec<SlashingSpansTo204>;
|
||||
'Vec<SlashJournalEntry>': Vec<SlashJournalEntry>;
|
||||
'Vec<Slot>': Vec<Slot>;
|
||||
'Vec<SlotNumber>': Vec<SlotNumber>;
|
||||
'Vec<SlotRange>': Vec<SlotRange>;
|
||||
'Vec<SocietyJudgement>': Vec<SocietyJudgement>;
|
||||
@@ -1476,11 +1504,13 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<StorageMetadataV11>': Vec<StorageMetadataV11>;
|
||||
'Vec<StorageMetadataV12>': Vec<StorageMetadataV12>;
|
||||
'Vec<StorageMetadataV9>': Vec<StorageMetadataV9>;
|
||||
'Vec<StorageProof>': Vec<StorageProof>;
|
||||
'Vec<StoredPendingChange>': Vec<StoredPendingChange>;
|
||||
'Vec<StoredState>': Vec<StoredState>;
|
||||
'Vec<StrikeCount>': Vec<StrikeCount>;
|
||||
'Vec<SubId>': Vec<SubId>;
|
||||
'Vec<SyncState>': Vec<SyncState>;
|
||||
'Vec<SystemInherentData>': Vec<SystemInherentData>;
|
||||
'Vec<SystemOrigin>': Vec<SystemOrigin>;
|
||||
'Vec<Tally>': Vec<Tally>;
|
||||
'Vec<TaskAddress>': Vec<TaskAddress>;
|
||||
@@ -1534,6 +1564,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<ValidatorPrefsWithCommission>': Vec<ValidatorPrefsWithCommission>;
|
||||
'Vec<ValidatorSignature>': Vec<ValidatorSignature>;
|
||||
'Vec<ValidityAttestation>': Vec<ValidityAttestation>;
|
||||
'Vec<VecInboundHrmpMessage>': Vec<VecInboundHrmpMessage>;
|
||||
'Vec<VersionedMultiAsset>': Vec<VersionedMultiAsset>;
|
||||
'Vec<VersionedMultiLocation>': Vec<VersionedMultiLocation>;
|
||||
'Vec<VersionedXcm>': Vec<VersionedXcm>;
|
||||
@@ -1771,6 +1802,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
EthereumSignature: EthereumSignature;
|
||||
EthFilter: EthFilter;
|
||||
EthFilterAddress: EthFilterAddress;
|
||||
EthFilterChanges: EthFilterChanges;
|
||||
EthFilterTopic: EthFilterTopic;
|
||||
EthFilterTopicEntry: EthFilterTopicEntry;
|
||||
EthFilterTopicInner: EthFilterTopicInner;
|
||||
@@ -1868,6 +1900,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
HeartbeatTo244: HeartbeatTo244;
|
||||
HostConfiguration: HostConfiguration;
|
||||
HostFnWeights: HostFnWeights;
|
||||
HostFnWeightsTo264: HostFnWeightsTo264;
|
||||
HrmpChannel: HrmpChannel;
|
||||
HrmpChannelId: HrmpChannelId;
|
||||
HrmpOpenChannelRequest: HrmpOpenChannelRequest;
|
||||
@@ -1923,6 +1956,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
LeasePeriod: LeasePeriod;
|
||||
LeasePeriodOf: LeasePeriodOf;
|
||||
Limits: Limits;
|
||||
LimitsTo264: LimitsTo264;
|
||||
LocalValidationData: LocalValidationData;
|
||||
LockIdentifier: LockIdentifier;
|
||||
LookupSource: LookupSource;
|
||||
@@ -1938,6 +1972,9 @@ declare module '@polkadot/types/types/registry' {
|
||||
MemberCount: MemberCount;
|
||||
MembershipProof: MembershipProof;
|
||||
MessageIngestionType: MessageIngestionType;
|
||||
MessageQueueChain: MessageQueueChain;
|
||||
MessagingStateSnapshot: MessagingStateSnapshot;
|
||||
MessagingStateSnapshotEgressEntry: MessagingStateSnapshotEgressEntry;
|
||||
MetadataAll: MetadataAll;
|
||||
MetadataLatest: MetadataLatest;
|
||||
MetadataV10: MetadataV10;
|
||||
@@ -2002,10 +2039,12 @@ declare module '@polkadot/types/types/registry' {
|
||||
PalletsOrigin: PalletsOrigin;
|
||||
PalletVersion: PalletVersion;
|
||||
ParachainDispatchOrigin: ParachainDispatchOrigin;
|
||||
ParachainInherentData: ParachainInherentData;
|
||||
ParachainProposal: ParachainProposal;
|
||||
ParaGenesisArgs: ParaGenesisArgs;
|
||||
ParaId: ParaId;
|
||||
ParaInfo: ParaInfo;
|
||||
ParaLifecycle: ParaLifecycle;
|
||||
ParaPastCodeMeta: ParaPastCodeMeta;
|
||||
ParaScheduling: ParaScheduling;
|
||||
ParathreadClaim: ParathreadClaim;
|
||||
@@ -2022,8 +2061,9 @@ declare module '@polkadot/types/types/registry' {
|
||||
PendingResume: PendingResume;
|
||||
Perbill: Perbill;
|
||||
Percent: Percent;
|
||||
PerDispatchClass: PerDispatchClass;
|
||||
PerDispatchClassU32: PerDispatchClassU32;
|
||||
PerDispatchClassWeight: PerDispatchClassWeight;
|
||||
PerDispatchClassWeightsPerClass: PerDispatchClassWeightsPerClass;
|
||||
Period: Period;
|
||||
Permill: Permill;
|
||||
PermissionLatest: PermissionLatest;
|
||||
@@ -2085,6 +2125,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
Registration: Registration;
|
||||
RegistrationJudgement: RegistrationJudgement;
|
||||
RelayChainBlockNumber: RelayChainBlockNumber;
|
||||
RelayChainHash: RelayChainHash;
|
||||
RelayedFrom: RelayedFrom;
|
||||
RelayTo: RelayTo;
|
||||
Releases: Releases;
|
||||
@@ -2111,6 +2152,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
SchedulePriority: SchedulePriority;
|
||||
ScheduleTo212: ScheduleTo212;
|
||||
ScheduleTo258: ScheduleTo258;
|
||||
ScheduleTo264: ScheduleTo264;
|
||||
Scheduling: Scheduling;
|
||||
Seal: Seal;
|
||||
SealV0: SealV0;
|
||||
@@ -2151,6 +2193,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
SlashingSpans: SlashingSpans;
|
||||
SlashingSpansTo204: SlashingSpansTo204;
|
||||
SlashJournalEntry: SlashJournalEntry;
|
||||
Slot: Slot;
|
||||
SlotNumber: SlotNumber;
|
||||
SlotRange: SlotRange;
|
||||
SocietyJudgement: SocietyJudgement;
|
||||
@@ -2192,11 +2235,13 @@ declare module '@polkadot/types/types/registry' {
|
||||
StorageMetadataV11: StorageMetadataV11;
|
||||
StorageMetadataV12: StorageMetadataV12;
|
||||
StorageMetadataV9: StorageMetadataV9;
|
||||
StorageProof: StorageProof;
|
||||
StoredPendingChange: StoredPendingChange;
|
||||
StoredState: StoredState;
|
||||
StrikeCount: StrikeCount;
|
||||
SubId: SubId;
|
||||
SyncState: SyncState;
|
||||
SystemInherentData: SystemInherentData;
|
||||
SystemOrigin: SystemOrigin;
|
||||
Tally: Tally;
|
||||
TaskAddress: TaskAddress;
|
||||
@@ -2250,6 +2295,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
ValidatorPrefsWithCommission: ValidatorPrefsWithCommission;
|
||||
ValidatorSignature: ValidatorSignature;
|
||||
ValidityAttestation: ValidityAttestation;
|
||||
VecInboundHrmpMessage: VecInboundHrmpMessage;
|
||||
VersionedMultiAsset: VersionedMultiAsset;
|
||||
VersionedMultiLocation: VersionedMultiLocation;
|
||||
VersionedXcm: VersionedXcm;
|
||||
|
||||
@@ -159,4 +159,11 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
public includes (check: unknown): boolean {
|
||||
return this.some((value: T) => value.eq(check));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns a slice of an array
|
||||
*/
|
||||
public slice (start?: number, end?: number): T[] {
|
||||
return this.toArray().slice(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { UIntBitLength } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { assert, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isHex, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
import { assert, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isHex, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
|
||||
export const DEFAULT_UINT_BITS = 64;
|
||||
|
||||
@@ -17,10 +17,10 @@ const MAX_NUMBER_BITS = 52;
|
||||
const MUL_P = new BN(1_00_00);
|
||||
|
||||
const FORMATTERS: [string, BN][] = [
|
||||
['Perquintill', new BN(1_000_000_000_000)],
|
||||
['Perbill', new BN(1_000_000_000)],
|
||||
['Permill', new BN(1_000_000)],
|
||||
['Percent', new BN(100)]
|
||||
['Perquintill', BN_QUINTILL],
|
||||
['Perbill', BN_BILLION],
|
||||
['Permill', BN_MILLION],
|
||||
['Percent', BN_HUNDRED]
|
||||
];
|
||||
|
||||
function toPercentage (value: BN, divisor: BN): string {
|
||||
|
||||
@@ -389,7 +389,7 @@ describe('Enum', (): void => {
|
||||
expect(test.toHex()).toEqual(
|
||||
'0x' +
|
||||
'00' + // index
|
||||
'ff' + // Address indicating an embedded AccountId
|
||||
'00' + // MultiAddress indicating an embedded AccountId
|
||||
'0001020304050607080910111213141516171819202122232425262728293031' // AccountId
|
||||
);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Result } from '.';
|
||||
|
||||
describe('Result', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
const Type = Result.with({ Error: Text, Ok: u32 });
|
||||
const Type = Result.with({ Err: Text, Ok: u32 });
|
||||
|
||||
it('has a sane toRawType representation', (): void => {
|
||||
expect(new Type(registry).toRawType()).toEqual('Result<u32,Text>');
|
||||
@@ -29,17 +29,21 @@ describe('Result', (): void => {
|
||||
it('decodes from a u8a (error)', (): void => {
|
||||
const result = new Type(registry, new Uint8Array([1, 4 << 2, 100, 101, 102, 103]));
|
||||
|
||||
expect(result.isError);
|
||||
expect(result.asError.toU8a()).toEqual(new Uint8Array([4 << 2, 100, 101, 102, 103]));
|
||||
expect(result.isErr);
|
||||
expect(result.asErr.toU8a()).toEqual(new Uint8Array([4 << 2, 100, 101, 102, 103]));
|
||||
expect(result.toHex()).toEqual('0x011064656667');
|
||||
expect(result.toJSON()).toEqual({
|
||||
Error: hexToString('0x64656667')
|
||||
Err: hexToString('0x64656667')
|
||||
});
|
||||
});
|
||||
|
||||
it('decodes from a JSON representation', (): void => {
|
||||
const result = new Type(registry, { Error: 'error' });
|
||||
const result = new Type(registry, { Err: 'error' });
|
||||
|
||||
expect(result.isErr).toBe(true);
|
||||
expect(result.isError).toBe(true);
|
||||
expect(result.asErr.toString()).toEqual('error');
|
||||
expect(result.asError.toString()).toEqual('error');
|
||||
expect(result.toHex()).toEqual('0x01146572726f72');
|
||||
});
|
||||
|
||||
|
||||
@@ -13,34 +13,41 @@ import { Enum } from './Enum';
|
||||
* A Result maps to the Rust Result type, that can either wrap a success or error value
|
||||
*/
|
||||
export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
constructor (registry: Registry, Ok: Constructor<O> | keyof InterfaceTypes, Error: Constructor<E> | keyof InterfaceTypes, value?: unknown) {
|
||||
constructor (registry: Registry, Ok: Constructor<O> | keyof InterfaceTypes, Err: Constructor<E> | keyof InterfaceTypes, value?: unknown) {
|
||||
// NOTE This is order-dependent, Ok (with index 0) needs to be first
|
||||
// eslint-disable-next-line sort-keys
|
||||
super(registry, { Ok, Error }, value);
|
||||
super(registry, { Ok, Err }, value);
|
||||
}
|
||||
|
||||
public static with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | keyof InterfaceTypes; Error: Constructor<E> | keyof InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
public static with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | keyof InterfaceTypes; Err: Constructor<E> | keyof InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
return class extends Result<O, E> {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Types.Ok, Types.Error, value);
|
||||
super(registry, Types.Ok, Types.Err, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the wrapper Error value (if isError)
|
||||
* @description Returns the wrapper Err value (if isErr)
|
||||
*/
|
||||
public get asError (): E {
|
||||
assert(this.isError, 'Cannot extract Error value from Ok result, check isError first');
|
||||
public get asErr (): E {
|
||||
assert(this.isErr, 'Cannot extract Err value from Ok result, check isErr first');
|
||||
|
||||
return this.value as E;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use asErr
|
||||
*/
|
||||
public get asError (): E {
|
||||
return this.asErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the wrapper Ok value (if isOk)
|
||||
*/
|
||||
public get asOk (): O {
|
||||
assert(this.isOk, 'Cannot extract Ok value from Error result, check isOk first');
|
||||
assert(this.isOk, 'Cannot extract Ok value from Err result, check isOk first');
|
||||
|
||||
return this.value as O;
|
||||
}
|
||||
@@ -53,10 +60,17 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Checks if the Result wraps an Error value
|
||||
* @description Checks if the Result wraps an Err value
|
||||
*/
|
||||
public get isErr (): boolean {
|
||||
return !this.isOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use isErr
|
||||
*/
|
||||
public get isError (): boolean {
|
||||
return !this.isOk;
|
||||
return this.isErr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,8 +84,8 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
const Types = this._toRawStruct() as { Ok: unknown; Error: unknown };
|
||||
const Types = this._toRawStruct() as { Ok: unknown; Err: unknown };
|
||||
|
||||
return `Result<${Types.Ok as string},${Types.Error as string}>`;
|
||||
return `Result<${Types.Ok as string},${Types.Err as string}>`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { Codec, CodecTo } from '../types';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata';
|
||||
import rpcMetadata from '@polkadot/metadata/static';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { createTypeUnsafe, TypeRegistry } from '../create';
|
||||
import { GenericAccountId as AccountId } from '../generic';
|
||||
@@ -170,5 +171,14 @@ describe('Vec', (): void => {
|
||||
|
||||
expect(vec.indexOf(myId)).toEqual(2);
|
||||
});
|
||||
|
||||
it('allows a slice operator', (): void => {
|
||||
const vec = registry.createType('Vec<AccountId>', [
|
||||
randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a()
|
||||
]);
|
||||
|
||||
expect(vec).toHaveLength(10);
|
||||
expect(vec.slice(2, 7)).toHaveLength(5);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -117,10 +117,10 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
|
||||
registry.getOrUnknown(value.type),
|
||||
|
||||
[TypeDefInfo.Result]: (registry: Registry, value: TypeDef): Constructor => {
|
||||
const [Ok, Error] = getTypeClassArray(value);
|
||||
const [Ok, Err] = getTypeClassArray(value);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
return Result.with({ Error, Ok });
|
||||
return Result.with({ Err, Ok });
|
||||
},
|
||||
|
||||
[TypeDefInfo.Set]: (registry: Registry, value: TypeDef): Constructor => {
|
||||
|
||||
@@ -66,7 +66,7 @@ describe('createType', (): void => {
|
||||
it('allows creation of a Result', (): void => {
|
||||
expect(
|
||||
createTypeUnsafe(registry, 'Result<u32,Text>', ['0x011064656667']).toJSON()
|
||||
).toEqual({ Error: 'defg' });
|
||||
).toEqual({ Err: 'defg' });
|
||||
});
|
||||
|
||||
it('allows creation of a Set', (): void => {
|
||||
|
||||
@@ -134,7 +134,7 @@ export class TypeRegistry implements Registry {
|
||||
|
||||
#signedExtensions: string[] = defaultExtensions;
|
||||
|
||||
#userExtensions?: Record<string, ExtDef>;
|
||||
#userExtensions?: ExtDef;
|
||||
|
||||
constructor () {
|
||||
this.#knownDefaults = { Json, Metadata, Raw, ...baseTypes };
|
||||
@@ -377,7 +377,7 @@ export class TypeRegistry implements Registry {
|
||||
}
|
||||
|
||||
// sets the metadata
|
||||
public setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: Record<string, ExtDef>): void {
|
||||
public setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: ExtDef): void {
|
||||
injectExtrinsics(this, metadata, this.#metadataCalls);
|
||||
injectErrors(this, metadata, this.#metadataErrors);
|
||||
injectEvents(this, metadata, this.#metadataEvents);
|
||||
@@ -399,7 +399,7 @@ export class TypeRegistry implements Registry {
|
||||
}
|
||||
|
||||
// sets the available signed extensions
|
||||
setSignedExtensions (signedExtensions: string[] = defaultExtensions, userExtensions?: Record<string, ExtDef>): void {
|
||||
setSignedExtensions (signedExtensions: string[] = defaultExtensions, userExtensions?: ExtDef): void {
|
||||
this.#signedExtensions = signedExtensions;
|
||||
this.#userExtensions = userExtensions;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import packageInfo from './package-info.json';
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ describe('EthereumLookupSource', (): void => {
|
||||
);
|
||||
testDecode(
|
||||
'AccountIndex (mixed prefixes)',
|
||||
registry.createType('EthereumLookupSource', '2jpAFn'),
|
||||
// NOTE Expected address here is encoded with prefix 42, input above with 68
|
||||
registry.createType('EthereumLookupSource', '118r'),
|
||||
// NOTE Expected address here is encoded with prefix 42, input above with 1
|
||||
'25GUyv'
|
||||
);
|
||||
testDecode(
|
||||
@@ -98,7 +98,7 @@ describe('EthereumLookupSource', (): void => {
|
||||
|
||||
it('equals on AccountIndex', (): void => {
|
||||
// see the test below - these are equivalent (with different prefix encoding)
|
||||
expect(registry.createType('EthereumLookupSource', '2jpAFn').eq('25GUyv')).toBe(true);
|
||||
expect(registry.createType('EthereumLookupSource', '118r').eq('25GUyv')).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('Extrinsic', (): void => {
|
||||
'0x' +
|
||||
'5d02' + // length
|
||||
'84' + // V4, signing bit set
|
||||
'ff' + // lookup, AccountId of sender follows
|
||||
'00' + // MultiAddress, AccountId of sender follows
|
||||
'fcc4910cb536b4333db4bccb40e2cf6427b4766518e754b91e70c97e4a87dbb3' + // sender
|
||||
'00' + // multisig, type ed25519
|
||||
'd99ffe3e610ad234e1414bda5831395a6df9098bf80b01561ce89a5065ae89d5' + // sig first 32
|
||||
@@ -29,7 +29,7 @@ describe('Extrinsic', (): void => {
|
||||
'1101' + // nonce, compact 68
|
||||
'0700ac23fc06' + // tip, 0.03 KSM
|
||||
'0600' + // balances.transfer (on Kusama this was 0400, changed here to match metadata)
|
||||
'ff' + // lookup, AccountId of recipient follows
|
||||
'00' + // MultiAddress, AccountId of recipient follows
|
||||
'495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718' + // recipient
|
||||
'0bc01eb1fc185f' // value, 104.560 KSM
|
||||
);
|
||||
@@ -38,7 +38,7 @@ describe('Extrinsic', (): void => {
|
||||
expect(extrinsic.nonce.toNumber()).toEqual(68);
|
||||
expect(extrinsic.tip.toHuman()).toEqual('30.0000 mUnit');
|
||||
expect(extrinsic.callIndex).toEqual(new Uint8Array([6, 0]));
|
||||
expect(extrinsic.args[0].toHex()).toEqual('0xff495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718');
|
||||
expect(extrinsic.args[0].toHex()).toEqual('0x00495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718');
|
||||
expect(extrinsic.args[1].toHuman()).toEqual('104.5609 Unit');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('SignerPayload', (): void => {
|
||||
blockNumber: '0x00231d30',
|
||||
era: '0x0703',
|
||||
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
||||
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
|
||||
method: '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
|
||||
nonce: '0x00001234',
|
||||
signedExtensions: ['CheckNonce', 'CheckWeight'],
|
||||
specVersion: '0x00000006',
|
||||
@@ -36,7 +36,7 @@ describe('SignerPayload', (): void => {
|
||||
blockNumber: '0x231d30',
|
||||
era: registry.createType('ExtrinsicEra', { current: 2301232, period: 200 }),
|
||||
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
||||
method: registry.createType('Call', '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
|
||||
method: registry.createType('Call', '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
|
||||
nonce: 0x1234,
|
||||
signedExtensions: ['CheckNonce'],
|
||||
tip: 0x5678,
|
||||
@@ -48,7 +48,7 @@ describe('SignerPayload', (): void => {
|
||||
blockNumber: '0x00231d30',
|
||||
era: '0x0703',
|
||||
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
||||
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
|
||||
method: '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
|
||||
nonce: '0x00001234',
|
||||
signedExtensions: ['CheckNonce'],
|
||||
specVersion: '0x00000000',
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export const emptyCheck = {
|
||||
import type { ExtInfo } from './types';
|
||||
|
||||
export const emptyCheck: ExtInfo = {
|
||||
extrinsic: {},
|
||||
payload: {}
|
||||
};
|
||||
|
||||
@@ -3,17 +3,14 @@
|
||||
|
||||
import type { ExtDef, ExtInfo, ExtTypes } from './types';
|
||||
|
||||
import polkadotExtensions from './polkadot';
|
||||
import substrateExtensions from './substrate';
|
||||
import { polkadot } from './polkadot';
|
||||
import { substrate } from './substrate';
|
||||
|
||||
// A mapping of the known signed extensions to the extra fields that they contain. Unlike in the actual extensions,
|
||||
// we define the extra fields not as a Tuple, but rather as a struct so they can be named. These will be expanded
|
||||
// into the various fields when added to the payload (we only support V4 onwards with these, V3 and earlier are
|
||||
// deemed fixed and non-changeable)
|
||||
const allExtensions: ExtDef = {
|
||||
...substrateExtensions,
|
||||
...polkadotExtensions
|
||||
};
|
||||
const allExtensions: ExtDef = { ...substrate, ...polkadot };
|
||||
|
||||
// the v4 signed extensions (the order is important here, as applied by default)
|
||||
const defaultExtensions: Array<keyof typeof allExtensions> = [
|
||||
@@ -26,15 +23,16 @@ const defaultExtensions: Array<keyof typeof allExtensions> = [
|
||||
'CheckBlockGasLimit'
|
||||
];
|
||||
|
||||
function findUnknownExtensions (extensions: string[], userExtensions: Record<string, ExtDef> = {}): string[] {
|
||||
function findUnknownExtensions (extensions: string[], userExtensions: ExtDef = {}): string[] {
|
||||
const names = [...Object.keys(allExtensions), ...Object.keys(userExtensions)];
|
||||
|
||||
return extensions.filter((key) => !names.includes(key));
|
||||
}
|
||||
|
||||
function expandExtensionTypes (extensions: string[], type: keyof ExtInfo, userExtensions: Record<string, ExtDef> = {}): ExtTypes {
|
||||
function expandExtensionTypes (extensions: string[], type: keyof ExtInfo, userExtensions: ExtDef = {}): ExtTypes {
|
||||
return extensions
|
||||
.map((key) => allExtensions[key] || userExtensions[key])
|
||||
// Always allow user extensions first - these should provide overrides
|
||||
.map((key) => userExtensions[key] || allExtensions[key])
|
||||
.filter((info): info is ExtInfo => !!info)
|
||||
.reduce((result, info): ExtTypes => ({ ...result, ...info[type] }), {});
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import type { ExtDef } from './types';
|
||||
|
||||
import { emptyCheck } from './emptyCheck';
|
||||
|
||||
export default {
|
||||
export const polkadot: ExtDef = {
|
||||
LimitParathreadCommits: emptyCheck,
|
||||
OnlyStakingAndClaims: emptyCheck,
|
||||
PrevalidateAttests: emptyCheck,
|
||||
RestrictFunctionality: emptyCheck,
|
||||
TransactionCallFilter: emptyCheck,
|
||||
ValidateDoubleVoteReports: emptyCheck
|
||||
} as ExtDef;
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ExtDef } from './types';
|
||||
import type { ExtDef, ExtInfo } from './types';
|
||||
|
||||
import { emptyCheck } from './emptyCheck';
|
||||
|
||||
const CheckMortality = {
|
||||
const CheckMortality: ExtInfo = {
|
||||
extrinsic: {
|
||||
era: 'ExtrinsicEra'
|
||||
},
|
||||
@@ -14,7 +14,7 @@ const CheckMortality = {
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
export const substrate: ExtDef = {
|
||||
ChargeTransactionPayment: {
|
||||
extrinsic: {
|
||||
tip: 'Compact<Balance>'
|
||||
@@ -57,4 +57,4 @@ export default {
|
||||
CheckWeight: emptyCheck,
|
||||
LockStakingStatus: emptyCheck,
|
||||
ValidateEquivocationReport: emptyCheck
|
||||
} as ExtDef;
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('ExtrinsicSignatureV4', (): void => {
|
||||
|
||||
const u8a = new Uint8Array([
|
||||
// signer as an AccountIndex
|
||||
0x09,
|
||||
0x01, 0x08, // 4 << 2
|
||||
// signature type
|
||||
0x01,
|
||||
// signature
|
||||
@@ -65,7 +65,7 @@ describe('ExtrinsicSignatureV4', (): void => {
|
||||
).toHex()
|
||||
).toEqual(
|
||||
'0x' +
|
||||
'ff' +
|
||||
'00' + // MultiAddress
|
||||
'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' +
|
||||
'01' +
|
||||
'4242424242424242424242424242424242424242424242424242424242424242' +
|
||||
@@ -93,7 +93,7 @@ describe('ExtrinsicSignatureV4', (): void => {
|
||||
).toEqual(
|
||||
'0x' +
|
||||
// Address = AccountId
|
||||
// 'ff' +
|
||||
// '00' +
|
||||
'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' +
|
||||
// This is a prefix-less signature, anySignture as opposed to Multi above
|
||||
// '01' +
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('AccountId', (): void => {
|
||||
]));
|
||||
|
||||
it('decodes to a non-empty value', (): void => {
|
||||
expect(registry.createType('AccountId', '7qT1BvpawNbqb3BZaBTMFMMAKrpJKLPf1LmEHR1JyarWJdMX').isEmpty).toBe(false);
|
||||
expect(registry.createType('AccountId', 'FVU8T5yaAssHAUwo3PnKso7fqNthEqJZGCZgJZSR9cKjWAf').isEmpty).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -98,7 +98,7 @@ describe('AccountId', (): void => {
|
||||
it('has the correct entries', (): void => {
|
||||
registry.setChainProperties(
|
||||
registry.createType('ChainProperties', {
|
||||
ss58Format: 68
|
||||
ss58Format: 2
|
||||
})
|
||||
);
|
||||
|
||||
@@ -106,14 +106,14 @@ describe('AccountId', (): void => {
|
||||
const list = registry.createType('Vec<AccountId>', data).map((accountId) => accountId.toString());
|
||||
|
||||
expect(list).toEqual([
|
||||
'7qVJujLF3EDbZt5WfQXWvueFedMS4Vfk2Hb4GyR8jwksTLup',
|
||||
'7pHyqeYaJjJPgxQgCXoS2EZMhBhtpm6BLCqQ4jJZTQB2kMhw',
|
||||
'7pYLWV6PTUmLTMQfHmmuBwBNLkhcKhRAnkM36CSJtjat9ACb',
|
||||
'7qT1BvpawNbqb3BZaBTMFMMAKrpJKLPf1LmEHR1JyarWJdMX',
|
||||
'7rADc9JW5EUGFPWLjPMipH4c3bJ2GyAUedmqQHiaGucWVrsT',
|
||||
'7oK5KRH6jt4p8auipnru9ptqeuRwbLMHA2tgCViZzhmW4Lox',
|
||||
'7ndAVsHvonnzTg4AvRhpraNCKj9g4CGQXKoLrgkTZ91Na6PE',
|
||||
'7oL7VfXgLA8L3pJJwi11v3sBYc1b5R3tLrweHwzMNxgEpjxP'
|
||||
'FXmrFbdg2VdG1NttGTx1S6Czbv2SQ7PaD2PfryGBWWgt52i',
|
||||
'ELSnAoxwXaRP5i4RPjs6m1K3AGVCfXpt8GjTcrgtxvrAuZv',
|
||||
'EaoT1Mn6H3N9Ui3WdiLGTdKgjGChbrpLfnNV5zSLJLhZvgj',
|
||||
'FVU8T5yaAssHAUwo3PnKso7fqNthEqJZGCZgJZSR9cKjWAf',
|
||||
'GCgYfZti2kHwWoixFJ9toWZPZrcesc8CZDAoBGhiUNKvTQM',
|
||||
'DMYFwYVNgLqpiD73eoLEMLnzszXyEnvhxL1bPGhSGXKV8kS',
|
||||
'CfdSPZKSb529oMZ9HeFw6p9fhiGS6i45FEgFaJazhmBzsxZ',
|
||||
'DNaSBo4xxQMjwbhAZwSzaK8taaBTKVXtnNygqYUpXS4FMwN'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('AccountIndex', (): void => {
|
||||
});
|
||||
|
||||
it('compares numbers', (): void => {
|
||||
expect(registry.createType('AccountIndex', '2jpAFn').eq(256 * 1)).toBe(true);
|
||||
expect(registry.createType('AccountIndex', '118r').eq(256 * 1)).toBe(true);
|
||||
});
|
||||
|
||||
describe('calcLength', (): void => {
|
||||
|
||||
@@ -19,12 +19,16 @@ describe('Call', (): void => {
|
||||
args: [],
|
||||
callIndex: [6, 1] // balances.setBalance
|
||||
}).toU8a()
|
||||
).toEqual(new Uint8Array([6, 1, 0, 0, 0]));
|
||||
).toEqual(
|
||||
new Uint8Array([6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
|
||||
);
|
||||
});
|
||||
|
||||
it('handles creation from a hex value properly', (): void => {
|
||||
expect(
|
||||
new Call(registry, '0x0601').toU8a()
|
||||
).toEqual(new Uint8Array([6, 1, 0, 0, 0])); // balances.setBalance
|
||||
).toEqual(
|
||||
new Uint8Array([6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
|
||||
); // balances.setBalance
|
||||
});
|
||||
});
|
||||
|
||||
@@ -88,6 +88,10 @@ export class GenericConsensusEngineId extends u32 {
|
||||
return this.registry.createType('AccountId', bytes);
|
||||
}
|
||||
|
||||
private _getH160Author (bytes: Bytes): AccountId {
|
||||
return this.registry.createType('AccountId', bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description From the input bytes, decode into an author
|
||||
*/
|
||||
@@ -104,6 +108,11 @@ export class GenericConsensusEngineId extends u32 {
|
||||
return this._getPowAuthor(bytes);
|
||||
}
|
||||
|
||||
// Moonbeam is neither Aura nor Babe nor Pow and uses h160 addresses
|
||||
if (bytes.length === 20) {
|
||||
return this._getH160Author(bytes);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('LookupSource', (): void => {
|
||||
|
||||
const testDecode = (type: string, input: LookupSource | AccountId | AccountIndex | number[] | Uint8Array, expected: string): void =>
|
||||
it(`can decode from ${type}`, (): void => {
|
||||
const a = registry.createType('Address', input);
|
||||
const a = registry.createType('IndicesLookupSource', input);
|
||||
|
||||
expect(a.toString()).toBe(expected);
|
||||
});
|
||||
@@ -18,19 +18,19 @@ describe('LookupSource', (): void => {
|
||||
it('equals on AccountId', (): void => {
|
||||
const addr = '5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo';
|
||||
|
||||
expect(registry.createType('LookupSource', addr).eq(addr)).toBe(true);
|
||||
expect(registry.createType('IndicesLookupSource', addr).eq(addr)).toBe(true);
|
||||
});
|
||||
|
||||
it('equals on AccountIndex', (): void => {
|
||||
// see the test below - these are equivalent (with different prefix encoding)
|
||||
expect(registry.createType('LookupSource', '2jpAFn').eq('25GUyv')).toBe(true);
|
||||
expect(registry.createType('IndicesLookupSource', '118r').eq('25GUyv')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('decoding', (): void => {
|
||||
testDecode(
|
||||
'Address',
|
||||
registry.createType('LookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'),
|
||||
registry.createType('IndicesLookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testDecode(
|
||||
@@ -40,8 +40,8 @@ describe('LookupSource', (): void => {
|
||||
);
|
||||
testDecode(
|
||||
'AccountIndex (mixed prefixes)',
|
||||
registry.createType('LookupSource', '2jpAFn'),
|
||||
// NOTE Expected adress here is encoded with prefix 42, input above with 68
|
||||
registry.createType('IndicesLookupSource', '118r'),
|
||||
// NOTE Expected adress here is encoded with prefix 42, input above with 1
|
||||
'25GUyv'
|
||||
);
|
||||
testDecode(
|
||||
@@ -83,7 +83,7 @@ describe('LookupSource', (): void => {
|
||||
'Mwz15xP2'
|
||||
);
|
||||
// FIXME The specification allows for 8 byte addresses, however since AccountIndex is u32 internally
|
||||
// (and defined that way in thd efault Substrate),this does not actually work since it is 8 bytes,
|
||||
// (and defined that way in the default Substrate),this does not actually work since it is 8 bytes,
|
||||
// instead of 4 bytes max u32 length
|
||||
// testDecode(
|
||||
// 'Uint8Array (with prefix 8 bytes)',
|
||||
@@ -95,7 +95,7 @@ describe('LookupSource', (): void => {
|
||||
describe('encoding', (): void => {
|
||||
const testEncode = (to: 'toHex' | 'toString' | 'toU8a', expected: string | Uint8Array): void =>
|
||||
it(`can encode ${to}`, (): void => {
|
||||
const a = registry.createType('Address', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
const a = registry.createType('IndicesLookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
|
||||
expect(a[to]()).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
|
||||
describe('MultiAddress', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
it('correctly decodes a stream with Address20', (): void => {
|
||||
const a = registry.createType('MultiAddress', '0x0467f89207abe6e1b093befd84a48f03313765929207009e292608');
|
||||
|
||||
expect(a.index).toEqual(4);
|
||||
expect(a.toString()).toEqual('0x67f89207abe6e1b093befd84a48f033137659292');
|
||||
});
|
||||
|
||||
it('correctly decodes an AccountId', (): void => {
|
||||
const a = registry.createType('MultiAddress', '0x0102030405060708010203040506070801020304050607080102030405060708');
|
||||
|
||||
expect(a.index).toEqual(0);
|
||||
expect(a.toString()).toEqual('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
});
|
||||
|
||||
it('correctly decodes an Address20', (): void => {
|
||||
const a = registry.createType('MultiAddress', '0x67f89207abe6e1b093befd84a48f033137659292');
|
||||
|
||||
expect(a.index).toEqual(4);
|
||||
expect(a.toString()).toEqual('0x67f89207abe6e1b093befd84a48f033137659292');
|
||||
});
|
||||
});
|
||||
@@ -10,14 +10,12 @@ import { Enum } from '../codec/Enum';
|
||||
import { GenericAccountId } from './AccountId';
|
||||
import { GenericAccountIndex } from './AccountIndex';
|
||||
|
||||
function decodeMultiU8a (registry: Registry, value?: unknown): unknown {
|
||||
function decodeMultiU8a (value?: unknown): unknown {
|
||||
if (isU8a(value) && value.length <= 32) {
|
||||
if (value.length === 32) {
|
||||
return { id: value };
|
||||
} else if (value.length === 20) {
|
||||
return { Address20: value };
|
||||
} else {
|
||||
return decodeMultiAny(registry, registry.createType('AccountIndex', value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +30,10 @@ function decodeMultiAny (registry: Registry, value?: unknown): unknown {
|
||||
} else if (value instanceof GenericAccountIndex || isNumber(value) || isBn(value)) {
|
||||
return { Index: registry.createType('Compact<AccountIndex>', value) };
|
||||
} else if (isString(value)) {
|
||||
return decodeMultiU8a(registry, decodeAddress(value.toString()));
|
||||
return decodeMultiU8a(decodeAddress(value.toString()));
|
||||
}
|
||||
|
||||
return decodeMultiU8a(registry, value);
|
||||
return decodeMultiU8a(value);
|
||||
}
|
||||
|
||||
export class GenericMultiAddress extends Enum {
|
||||
|
||||
@@ -141,7 +141,7 @@ export default {
|
||||
trieId: 'TrieId'
|
||||
},
|
||||
Gas: 'u64',
|
||||
HostFnWeights: {
|
||||
HostFnWeightsTo264: {
|
||||
caller: 'Weight',
|
||||
address: 'Weight',
|
||||
gasLeft: 'Weight',
|
||||
@@ -188,6 +188,58 @@ export default {
|
||||
hashBlake2128: 'Weight',
|
||||
hashBlake2128PerByte: 'Weight'
|
||||
},
|
||||
HostFnWeights: {
|
||||
caller: 'Weight',
|
||||
address: 'Weight',
|
||||
gasLeft: 'Weight',
|
||||
balance: 'Weight',
|
||||
valueTransferred: 'Weight',
|
||||
minimumBalance: 'Weight',
|
||||
tombstoneDeposit: 'Weight',
|
||||
rentAllowance: 'Weight',
|
||||
blockNumber: 'Weight',
|
||||
now: 'Weight',
|
||||
weightToFee: 'Weight',
|
||||
gas: 'Weight',
|
||||
input: 'Weight',
|
||||
inputPerByte: 'Weight',
|
||||
return: 'Weight',
|
||||
returnPerByte: 'Weight',
|
||||
terminate: 'Weight',
|
||||
terminatePerCodeByte: 'Weight',
|
||||
restoreTo: 'Weight',
|
||||
restoreToPerCallerCodeByte: 'Weight',
|
||||
restoreToPerTombstoneCodeByte: 'Weight',
|
||||
restoreToPerDelta: 'Weight',
|
||||
random: 'Weight',
|
||||
depositEvent: 'Weight',
|
||||
depositEventPerTopic: 'Weight',
|
||||
depositEventPerByte: 'Weight',
|
||||
setRentAllowance: 'Weight',
|
||||
setStorage: 'Weight',
|
||||
setStoragePerByte: 'Weight',
|
||||
clearStorage: 'Weight',
|
||||
getStorage: 'Weight',
|
||||
getStoragePerByte: 'Weight',
|
||||
transfer: 'Weight',
|
||||
call: 'Weight',
|
||||
callPerCodeByte: 'Weight',
|
||||
callTransferSurcharge: 'Weight',
|
||||
callPerInputByte: 'Weight',
|
||||
callPerOutputByte: 'Weight',
|
||||
instantiate: 'Weight',
|
||||
instantiatePerCodeByte: 'Weight',
|
||||
instantiatePerInputByte: 'Weight',
|
||||
instantiatePerOutputByte: 'Weight',
|
||||
hashSha2256: 'Weight',
|
||||
hashSha2256PerByte: 'Weight',
|
||||
hashKeccak256: 'Weight',
|
||||
hashKeccak256PerByte: 'Weight',
|
||||
hashBlake2256: 'Weight',
|
||||
hashBlake2256PerByte: 'Weight',
|
||||
hashBlake2128: 'Weight',
|
||||
hashBlake2128PerByte: 'Weight'
|
||||
},
|
||||
InstructionWeights: {
|
||||
i64const: 'u32',
|
||||
i64load: 'u32',
|
||||
@@ -241,7 +293,7 @@ export default {
|
||||
i64rotl: 'u32',
|
||||
i64rotr: 'u32'
|
||||
},
|
||||
Limits: {
|
||||
LimitsTo264: {
|
||||
eventTopics: 'u32',
|
||||
stackHeight: 'u32',
|
||||
globals: 'u32',
|
||||
@@ -252,6 +304,16 @@ export default {
|
||||
subjectLen: 'u32',
|
||||
codeSize: 'u32'
|
||||
},
|
||||
Limits: {
|
||||
eventTopics: 'u32',
|
||||
stackHeight: 'u32',
|
||||
globals: 'u32',
|
||||
parameters: 'u32',
|
||||
memoryPages: 'u32',
|
||||
tableSize: 'u32',
|
||||
brTableSize: 'u32',
|
||||
subjectLen: 'u32'
|
||||
},
|
||||
PrefabWasmModule: {
|
||||
scheduleVersion: 'Compact<u32>',
|
||||
initial: 'Compact<u32>',
|
||||
@@ -295,6 +357,13 @@ export default {
|
||||
enablePrintln: 'bool',
|
||||
maxSubjectLen: 'u32'
|
||||
},
|
||||
ScheduleTo264: {
|
||||
version: 'u32',
|
||||
enablePrintln: 'bool',
|
||||
limits: 'LimitsTo264',
|
||||
instructionWeights: 'InstructionWeights',
|
||||
hostFnWeights: 'HostFnWeightsTo264'
|
||||
},
|
||||
Schedule: {
|
||||
version: 'u32',
|
||||
enablePrintln: 'bool',
|
||||
|
||||
@@ -115,6 +115,60 @@ export interface Gas extends u64 {}
|
||||
|
||||
/** @name HostFnWeights */
|
||||
export interface HostFnWeights extends Struct {
|
||||
readonly caller: Weight;
|
||||
readonly address: Weight;
|
||||
readonly gasLeft: Weight;
|
||||
readonly balance: Weight;
|
||||
readonly valueTransferred: Weight;
|
||||
readonly minimumBalance: Weight;
|
||||
readonly tombstoneDeposit: Weight;
|
||||
readonly rentAllowance: Weight;
|
||||
readonly blockNumber: Weight;
|
||||
readonly now: Weight;
|
||||
readonly weightToFee: Weight;
|
||||
readonly gas: Weight;
|
||||
readonly input: Weight;
|
||||
readonly inputPerByte: Weight;
|
||||
readonly return: Weight;
|
||||
readonly returnPerByte: Weight;
|
||||
readonly terminate: Weight;
|
||||
readonly terminatePerCodeByte: Weight;
|
||||
readonly restoreTo: Weight;
|
||||
readonly restoreToPerCallerCodeByte: Weight;
|
||||
readonly restoreToPerTombstoneCodeByte: Weight;
|
||||
readonly restoreToPerDelta: Weight;
|
||||
readonly random: Weight;
|
||||
readonly depositEvent: Weight;
|
||||
readonly depositEventPerTopic: Weight;
|
||||
readonly depositEventPerByte: Weight;
|
||||
readonly setRentAllowance: Weight;
|
||||
readonly setStorage: Weight;
|
||||
readonly setStoragePerByte: Weight;
|
||||
readonly clearStorage: Weight;
|
||||
readonly getStorage: Weight;
|
||||
readonly getStoragePerByte: Weight;
|
||||
readonly transfer: Weight;
|
||||
readonly call: Weight;
|
||||
readonly callPerCodeByte: Weight;
|
||||
readonly callTransferSurcharge: Weight;
|
||||
readonly callPerInputByte: Weight;
|
||||
readonly callPerOutputByte: Weight;
|
||||
readonly instantiate: Weight;
|
||||
readonly instantiatePerCodeByte: Weight;
|
||||
readonly instantiatePerInputByte: Weight;
|
||||
readonly instantiatePerOutputByte: Weight;
|
||||
readonly hashSha2256: Weight;
|
||||
readonly hashSha2256PerByte: Weight;
|
||||
readonly hashKeccak256: Weight;
|
||||
readonly hashKeccak256PerByte: Weight;
|
||||
readonly hashBlake2256: Weight;
|
||||
readonly hashBlake2256PerByte: Weight;
|
||||
readonly hashBlake2128: Weight;
|
||||
readonly hashBlake2128PerByte: Weight;
|
||||
}
|
||||
|
||||
/** @name HostFnWeightsTo264 */
|
||||
export interface HostFnWeightsTo264 extends Struct {
|
||||
readonly caller: Weight;
|
||||
readonly address: Weight;
|
||||
readonly gasLeft: Weight;
|
||||
@@ -227,6 +281,18 @@ export interface Limits extends Struct {
|
||||
readonly tableSize: u32;
|
||||
readonly brTableSize: u32;
|
||||
readonly subjectLen: u32;
|
||||
}
|
||||
|
||||
/** @name LimitsTo264 */
|
||||
export interface LimitsTo264 extends Struct {
|
||||
readonly eventTopics: u32;
|
||||
readonly stackHeight: u32;
|
||||
readonly globals: u32;
|
||||
readonly parameters: u32;
|
||||
readonly memoryPages: u32;
|
||||
readonly tableSize: u32;
|
||||
readonly brTableSize: u32;
|
||||
readonly subjectLen: u32;
|
||||
readonly codeSize: u32;
|
||||
}
|
||||
|
||||
@@ -290,6 +356,15 @@ export interface ScheduleTo258 extends Struct {
|
||||
readonly maxSubjectLen: u32;
|
||||
}
|
||||
|
||||
/** @name ScheduleTo264 */
|
||||
export interface ScheduleTo264 extends Struct {
|
||||
readonly version: u32;
|
||||
readonly enablePrintln: bool;
|
||||
readonly limits: LimitsTo264;
|
||||
readonly instructionWeights: InstructionWeights;
|
||||
readonly hostFnWeights: HostFnWeightsTo264;
|
||||
}
|
||||
|
||||
/** @name SeedOf */
|
||||
export interface SeedOf extends Hash {}
|
||||
|
||||
|
||||
@@ -73,6 +73,13 @@ const types: DefinitionsTypes = {
|
||||
Null: 'Null'
|
||||
}
|
||||
},
|
||||
EthFilterChanges: {
|
||||
_enum: {
|
||||
Logs: 'Vec<EthLog>',
|
||||
Hashes: 'Vec<H256>',
|
||||
Empty: 'Null'
|
||||
}
|
||||
},
|
||||
EthFilterTopic: {
|
||||
_enum: {
|
||||
Single: 'EthFilterTopicInner',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user