Compare commits

...
60 Commits
Author SHA1 Message Date
Github Actions 2b6e66b906 [CI Skip] release/stable 5.4.1
skip-checks: true
2021-08-09 08:54:48 +00:00
Jaco b165c0fe8d 5.4.1 (#3857)
* 5.4.1

* CHANGELOG

* CHANGELOG
2021-08-09 10:44:27 +02:00
hamidra c0751f1a67 enable keys(), entries() for NMaps (#3858) 2021-08-09 08:44:56 +02:00
Github Actions 2a95046fb2 [CI Skip] release/beta 5.3.3-9
skip-checks: true
2021-08-07 11:21:27 +00:00
Jaco e1828af4c4 createType TS tuple definitions (#3854) 2021-08-07 13:12:02 +02:00
Github Actions a133fec533 [CI Skip] release/beta 5.3.3-8
skip-checks: true
2021-08-06 12:08:30 +00:00
Jaco Greeff c51f3d5d2a Remove extra params to type detection 2021-08-06 14:56:03 +03:00
Jaco 54bb965537 Cater for higher-order tuples (#3851)
* Cater for higher-order tuples

* IEnum
2021-08-06 13:42:50 +02:00
Github Actions 9ab662881f [CI Skip] release/beta 5.3.3-7
skip-checks: true
2021-08-06 11:01:01 +00:00
Jaco 697781fb52 Type detection with trimming (#3850)
* Type detection with trimming

* Additional interface check
2021-08-06 12:48:45 +02:00
Github Actions a60d80953b [CI Skip] release/beta 5.3.3-6
skip-checks: true
2021-08-06 09:37:29 +00:00
Jaco a7edf81279 Detect resulting types from createType (#3849)
* Detect resulting types from createType

* Additional detect overrides

* additional

* Empy (), never for invalids
2021-08-06 11:28:32 +02:00
Github Actions 3423fb1717 [CI Skip] release/beta 5.3.3-5
skip-checks: true
2021-08-05 15:02:48 +00:00
Jaco 4ae4e4298c Ensure flags are set before connect/disconnect events (#3846) 2021-08-05 16:46:33 +02:00
Github Actions 90a84baa52 [CI Skip] release/beta 5.3.3-4
skip-checks: true
2021-08-05 10:41:02 +00:00
Jaco a80df7d846 Swap CodecArg usage to unknown (#3845)
* Swap CodecArg usage to unknown

* Adjust Constructor defintion
2021-08-05 12:27:51 +02:00
Github Actions 9961595634 [CI Skip] release/beta 5.3.3-3
skip-checks: true
2021-08-05 07:24:40 +00:00
Jaco e0ecaccb09 Adjust Registry createType return detection (#3844)
* Adjust Registry createType return detection

* type as 'OtherType' cast removal

* Use createClass via registry
2021-08-05 09:15:06 +02:00
Github Actions fd7c80bd8a [CI Skip] release/beta 5.3.3-2
skip-checks: true
2021-08-04 14:43:15 +00:00
Jaco 44a81bc00c Metadata v14 only has combined Map (#3843)
* Metadata v14 only has combined Map

* v14 Map conversion de-duped

* Substrate Map conversion

* v13 tests

* Apply suggestions from code review

* Housekeeping

* v14 bump
2021-08-04 16:31:16 +02:00
Github Actions 7d71726024 [CI Skip] release/beta 5.3.3-1
skip-checks: true
2021-08-04 08:52:18 +00:00
Jaco f603100b8b Add @polkadot/types-support (#3842)
* Add @polkadot/types-support

* jest config fix

* typegen lookups

* Build fixes

* Explicit kusama naming

* testMeta for v14 (local)

* CI test failure

* CI test failure v14

* Update with corrected data after test

* types-support json imports
2021-08-04 10:39:21 +02:00
Github Actions 70ac38cfd2 [CI Skip] release/beta 5.3.3-0
skip-checks: true
2021-08-03 11:40:44 +00:00
Jaco 0bf0d27a39 Handle BitSequence in PortableRegistry (#3838)
* Handle BitSequence in PortableRegistry

* Use Kusama-dev v14 metadata
2021-08-03 13:27:52 +02:00
Github Actions b51988193a [CI Skip] release/stable 5.3.2
skip-checks: true
2021-08-03 08:36:43 +00:00
Jaco fd31e5a6e5 5.3.2 (#3837) 2021-08-03 10:26:46 +02:00
Github Actions 074663cdb7 [CI Skip] release/beta 5.3.2-1
skip-checks: true
2021-08-03 08:07:30 +00:00
Jaco 5f5be13c08 Add missing bridges ChainId (#3836)
* Add missing bridges ChainId

* CHANGELOG
2021-08-03 09:56:35 +02:00
Jaco d60b1818d0 Update bridges types (#3835)
* Update bridges types

* BitVec

* BitVec
2021-08-03 09:39:32 +02:00
Github Actions 9c611e9414 [CI Skip] release/beta 5.3.2-0
skip-checks: true
2021-08-03 05:44:26 +00:00
Jaco da14679b65 v14 metadata bump (#3834) 2021-08-03 07:32:47 +02:00
Github Actions c88bb99b19 [CI Skip] release/stable 5.3.1
skip-checks: true
2021-08-02 09:11:40 +00:00
Jaco fc174738ec 5.3.1 (#3831) 2021-08-02 10:59:03 +02:00
Github Actions b43f1a747d [CI Skip] release/beta 5.2.2-12
skip-checks: true
2021-08-01 07:46:30 +00:00
Jaco 555b2fb5fe Flatten metadata tests & imports (#3830) 2021-08-01 09:35:01 +02:00
Github Actions 1e1ee6eb49 [CI Skip] release/beta 5.2.2-11
skip-checks: true
2021-07-30 14:58:58 +00:00
Jaco 7c4c346389 Hex/JSON metadata split (#3829)
* Hex/JSON metadata split

* revert import change

* Adjust imports

* Update tests
2021-07-30 16:45:57 +02:00
Github Actions beff353b4e [CI Skip] release/beta 5.2.2-10
skip-checks: true
2021-07-30 12:09:20 +00:00
Jaco 3172cb55f8 Add Polkadot static metadata (#3827)
* Add Polkadot static metadata

* v13 static polkadot

* v14 static polkadot

* CHANGELOG
2021-07-30 13:56:39 +02:00
Github Actions ba74ad0be9 [CI Skip] release/beta 5.2.2-9
skip-checks: true
2021-07-30 08:44:08 +00:00
Jaco 6ec7687f33 Bump static metadata (#3826) 2021-07-30 10:34:15 +02:00
Github Actions bd70b1e6ce [CI Skip] release/beta 5.2.2-8
skip-checks: true
2021-07-30 07:06:25 +00:00
Jaco 8744b95c83 Adjust PortableRegistry name matches (#3825)
* Adjust PortableRegistry name matches

* Update packages/types/src/generic/PortableRegistry.ts

* Update packages/types/src/generic/PortableRegistry.ts

* Opt

* Adjust set matching

* Extra includes check
2021-07-30 08:57:13 +02:00
Github Actions 94e6d8455d [CI Skip] release/beta 5.2.2-7
skip-checks: true
2021-07-30 06:26:56 +00:00
Jaco 70d19fcebb Kusama 9080 upgrade block (#3821) 2021-07-30 08:17:22 +02:00
Github Actions 174ba867d7 [CI Skip] release/beta 5.2.2-6
skip-checks: true
2021-07-29 11:10:28 +00:00
Jaco 36b217463a (some) Bridges types (#3823) 2021-07-29 13:00:05 +02:00
Github Actions 412c7525c0 [CI Skip] release/beta 5.2.2-5
skip-checks: true
2021-07-29 09:26:01 +00:00
Jaco 172c6f655f Update v14 metadata & PortableRegistry (#3822)
* Alin PortableRegistry with latest v14 changes

* Bump latest v14
2021-07-29 11:16:16 +02:00
Github Actions 1e3240c669 [CI Skip] release/beta 5.2.2-4
skip-checks: true
2021-07-28 10:54:16 +00:00
Jaco 43e1bf2d4a Check and match both specName/specVersion for registries (#3820) 2021-07-28 12:43:18 +02:00
Github Actions 839b2bc342 [CI Skip] release/beta 5.2.2-3
skip-checks: true
2021-07-28 05:50:31 +00:00
Jaco a281e0dc2d Adjust sorting (#3819)
* Adjust sorting

* typo
2021-07-28 07:40:46 +02:00
Github Actions 9a4893130d [CI Skip] release/beta 5.2.2-2
skip-checks: true
2021-07-28 05:34:40 +00:00
Jaco 77c45cf4c0 Fix sorting circular dependencies (#3818) 2021-07-28 07:22:42 +02:00
Github Actions ca0969b1eb [CI Skip] release/beta 5.2.2-1
skip-checks: true
2021-07-27 13:18:35 +00:00
Jaco 1df8cf9857 Bump v14 static (#3816) 2021-07-27 15:05:43 +02:00
Github Actions b7f095bcbd [CI Skip] release/beta 5.2.2-0
skip-checks: true
2021-07-27 10:34:47 +00:00
Jaco 6cc7242bdf Fix at(...) decoration (#3815)
* Fix at(...) decoration

* Add decoratedMeta/decoratedApi

* Remove intermediate
2021-07-27 12:24:49 +02:00
Jaco 48f91ae0da Adjust PortableRegistry (#3811)
* Adjust PortableRegistry

* Adjust formatting

* Additional formatting picks

* Readability

* Replacement comment
2021-07-26 09:33:15 +02:00
209 changed files with 113074 additions and 7867 deletions
+2
View File
@@ -24,3 +24,5 @@
4.9.2
4.11.2
4.16.2
5.3.2
+50 -1
View File
@@ -1,5 +1,54 @@
# CHANGELOG
## 5.4.1 Aug 9, 2021
Upgrade priority: Low. Recommended for potential users of NMap.
- **Important** The `ClassOf` alias for `createClass` has been removed, use `createClass` (with new generics) directly
Contributed:
- Enable `.keys()/.entries()` on NMap (Thanks to https://github.com/hamidra)
Changes:
- `createType<T = Codec>('...': K)` now returns `Codec` when `K` is not known
- `createType` does basic TypeScript type matching on the input type
- Handle `BitSequence` in `PortableRegistry`
- Ensure API `isConnected` is set before connect/disconnect events are fired
- Move all static test support files into `@polkadot/types-support`
- Align static Metadata with latest Substrate, Polkadot & Kusama
- Adjust v14 Metadata definitions to latest version
## 5.3.2 Aug 3, 2021
Upgrade priority: Low. Recommended for users of bridges.
Contributed:
- Add missing bridges types (Thanks to https://github.com/tomusdrw)
Changes:
- Align static metadata with latest Substrate
## 5.3.1 Aug 2, 2021
Upgrade priority: Low. Recommended for users of `api.at(...)` interfaces
Changes:
- Check specName & specVersion for historic registries (caters for runtime renames)
- Fix circular dependencies in codec utils
- Fix `api.at(<blockHash>)` to decorate with the correct storage hash
- Adjustments for upcoming metadata v14 in type creation & `PortableRegistry`
- Add Kusama 9080 upgrade block
- Add v13/v14 static metadata for Polkadot
- Align static metadata with latest Substrate
## 5.2.1 Jul 26, 2021
Upgrade priority: Low. Recommended for users of `BTreeMap` and `BTreeSet`
@@ -10,7 +59,7 @@ Contributed:
Changes:
- Adjust RPC to use registry.createType with optionality (required for metadata v14)
- Adjust RPC to use `registry.createType` with optionality (required for metadata v14)
- Adjust alphabetical sorting for TS type generation
- Adjustments for upcoming metadata v14 in type creation & `PortableRegistry`
- Provide the capability to convert v13 Metadata to upcoming v14
+3 -2
View File
@@ -12,7 +12,7 @@ module.exports = {
'@polkadot/metadata(.*)$': '<rootDir>/packages/metadata/src/$1',
'@polkadot/rpc-(core|provider)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
'@polkadot/types-known(.*)$': '<rootDir>/packages/types-known/src/$1',
'@polkadot/types-(known|support)(.*)$': '<rootDir>/packages/types-$1/src/$2',
// eslint-disable-next-line sort-keys
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
},
@@ -25,7 +25,8 @@ module.exports = {
'<rootDir>/packages/rpc-provider/build',
'<rootDir>/packages/typegen/build',
'<rootDir>/packages/types/build',
'<rootDir>/packages/types-known/build'
'<rootDir>/packages/types-known/build',
'<rootDir>/packages/types-support/build'
],
testTimeout: 30000,
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
+1 -1
View File
@@ -35,5 +35,5 @@
"@types/jest": "^26.0.24",
"copyfiles": "^2.4.1"
},
"version": "5.2.1"
"version": "5.4.1"
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "5.2.1",
"version": "5.4.1",
"type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
@@ -20,9 +20,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/api": "5.2.1",
"@polkadot/types": "5.2.1",
"@polkadot/util": "^7.0.3",
"@polkadot/api": "5.4.1",
"@polkadot/types": "5.4.1",
"@polkadot/util": "^7.1.1",
"rxjs": "^7.2.0"
}
}
+3 -3
View File
@@ -3,7 +3,7 @@
import type { Bytes } from '@polkadot/types';
import type { ChainProperties, ContractConstructorSpec, ContractEventSpec, ContractMessageParamSpec, ContractMessageSpec, ContractProject } from '@polkadot/types/interfaces';
import type { AnyJson, Codec, CodecArg } from '@polkadot/types/types';
import type { AnyJson, Codec } from '@polkadot/types/types';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from './types';
import { assert, assertReturn, compactAddLength, compactStripLength, isNumber, isObject, isString, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
@@ -154,7 +154,7 @@ export class Abi {
index,
method: stringCamelCase(identifier),
selector: spec.selector,
toU8a: (params: CodecArg[]) =>
toU8a: (params: unknown[]) =>
this.#encodeArgs(spec, args, params)
};
@@ -185,7 +185,7 @@ export class Abi {
return message.fromU8a(trimmed.subarray(4));
}
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: CodecArg[]): Uint8Array => {
#encodeArgs = ({ name, selector }: ContractMessageSpec | ContractConstructorSpec, args: AbiParam[], data: unknown[]): Uint8Array => {
assert(data.length === args.length, () => `Expected ${args.length} arguments to contract message '${name.toString()}', found ${data.length}`);
return compactAddLength(
@@ -24,6 +24,7 @@ const PRIMITIVE_ALIAS: Record<string, keyof InterfaceTypes> = {
const PRIMITIVE_ALWAYS = ['AccountId', 'AccountIndex', 'Address', 'Balance'];
// TODO Replace usages with PortableRegistry
export class MetaRegistry extends TypeRegistry {
public readonly metaTypeDefs: TypeDef[] = [];
+2 -2
View File
@@ -4,7 +4,7 @@
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
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 { AnyJson, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { MapConstructorExec } from './types';
@@ -52,7 +52,7 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
return this.#tx;
}
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
#deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
return this.api.tx.contracts
.instantiate(
value,
+2 -2
View File
@@ -4,7 +4,7 @@
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { EventRecord } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AnyJson, ISubmittableResult } from '@polkadot/types/types';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { MapConstructorExec } from './types';
@@ -56,7 +56,7 @@ export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
return this.#tx;
}
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
#instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
return this.api.tx.contracts
.instantiateWithCode(
value,
+7 -7
View File
@@ -5,7 +5,7 @@ import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, DecorateMethod } from '@polkadot/api/types';
import type { Bytes } from '@polkadot/types';
import type { AccountId, EventRecord, Weight } from '@polkadot/types/interfaces';
import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/types';
import type { AnyJson, ISubmittableResult } from '@polkadot/types/types';
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
import type { ContractCallResult, ContractCallSend, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
@@ -26,15 +26,15 @@ const ERROR_NO_CALL = 'Your node does not expose the contracts.call RPC. This is
const l = logger('Contract');
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: CodecArg[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
return (origin: string | AccountId | Uint8Array, options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): ContractCallResult<ApiType, ContractCallOutcome> =>
function createQuery <ApiType extends ApiTypes> (fn: (origin: string | AccountId | Uint8Array, options: ContractOptions, params: unknown[]) => ContractCallResult<ApiType, ContractCallOutcome>): ContractQuery<ApiType> {
return (origin: string | AccountId | Uint8Array, options: BigInt | string | number | BN | ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome> =>
isOptions(options)
? fn(origin, options, params)
: fn(origin, ...extractOptions(options, params));
}
function createTx <ApiType extends ApiTypes> (fn: (options: ContractOptions, params: CodecArg[]) => SubmittableExtrinsic<ApiType>): ContractTx<ApiType> {
return (options: BigInt | string | number | BN | ContractOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType> =>
function createTx <ApiType extends ApiTypes> (fn: (options: ContractOptions, params: unknown[]) => SubmittableExtrinsic<ApiType>): ContractTx<ApiType> {
return (options: BigInt | string | number | BN | ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType> =>
isOptions(options)
? fn(options, params)
: fn(...extractOptions(options, params));
@@ -103,7 +103,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
: gasLimit;
}
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: CodecArg[]): SubmittableExtrinsic<ApiType> => {
#exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): SubmittableExtrinsic<ApiType> => {
return this.api.tx.contracts
.call(
this.address,
@@ -129,7 +129,7 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
);
}
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: CodecArg[]): ContractCallSend<ApiType> => {
#read = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, value = BN_ZERO }: ContractOptions, params: unknown[]): ContractCallSend<ApiType> => {
assert(this.hasRpcContractsCall, ERROR_NO_CALL);
const message = this.abi.findMessage(messageOrId);
+8 -9
View File
@@ -5,28 +5,27 @@ import type { Observable } from 'rxjs';
import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types';
import type { ApiTypes, ObsInnerType } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { CodecArg } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
export interface BlueprintDeploy<ApiType extends ApiTypes> {
(options: BlueprintOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
(value: BigInt | string | number | BN, gasLimit: BigInt | string | number | BN, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
(options: BlueprintOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
(value: BigInt | string | number | BN, gasLimit: BigInt | string | number | BN, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
}
export interface ContractQuery<ApiType extends ApiTypes> {
(origin: AccountId | string | Uint8Array, options: ContractOptions, ...params: CodecArg[]): ContractCallResult<ApiType, ContractCallOutcome>;
(origin: AccountId | string | Uint8Array, value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: CodecArg[]): ContractCallResult<ApiType, ContractCallOutcome>;
(origin: AccountId | string | Uint8Array, options: ContractOptions, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome>;
(origin: AccountId | string | Uint8Array, value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: unknown[]): ContractCallResult<ApiType, ContractCallOutcome>;
}
export interface ContractTx<ApiType extends ApiTypes> {
(options: ContractOptions, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
(value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: CodecArg[]): SubmittableExtrinsic<ApiType>;
(options: ContractOptions, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
(value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: unknown[]): SubmittableExtrinsic<ApiType>;
}
export interface ContractGeneric<O, T> {
(messageOrId: AbiMessage | string | number, options: O, ...params: CodecArg[]): T;
(messageOrId: AbiMessage | string | number, value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: CodecArg[]): T;
(messageOrId: AbiMessage | string | number, options: O, ...params: unknown[]): T;
(messageOrId: AbiMessage | string | number, value: BigInt | BN | string | number, gasLimit: BigInt | BN | string | number, ...params: unknown[]): T;
}
export type ContractCallResult<ApiType extends ApiTypes, T> = ApiType extends 'rxjs'
+4 -5
View File
@@ -4,7 +4,6 @@
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 { BN } from '@polkadot/util';
import type { AbiConstructor, BlueprintOptions } from '../types';
import type { BlueprintDeploy, ContractGeneric } from './types';
@@ -17,15 +16,15 @@ 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> =>
export function createBluePrintTx <ApiType extends ApiTypes, R extends SubmittableResult> (fn: (options: BlueprintOptions, params: unknown[]) => SubmittableExtrinsic<ApiType, R>): BlueprintDeploy<ApiType> {
return (options: BigInt | string | number | BN | BlueprintOptions, ...params: unknown[]): 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 =>
export function createBluePrintWithId <T> (fn: (constructorOrId: AbiConstructor | string | number, options: BlueprintOptions, params: unknown[]) => T): ContractGeneric<BlueprintOptions, T> {
return (constructorOrId: AbiConstructor | string | number, options: BigInt | string | number | BN | BlueprintOptions, ...params: unknown[]): T =>
isOptions(options)
? fn(constructorOrId, options, params)
: fn(constructorOrId, ...extractOptions(options, params));
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '5.2.1' };
export const packageInfo = { name: '@polkadot/api-contract', version: '5.4.1' };
+2 -2
View File
@@ -5,7 +5,7 @@ import type { ApiBase } from '@polkadot/api/base';
import type { ApiTypes } from '@polkadot/api/types';
import type { Text, u64 } from '@polkadot/types';
import type { ContractExecResultResult, ContractSelector } from '@polkadot/types/interfaces';
import type { Codec, CodecArg, TypeDef } from '@polkadot/types/types';
import type { Codec, TypeDef } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { Abi } from '.';
@@ -42,7 +42,7 @@ export interface AbiMessage {
method: string;
returnType?: TypeDef | null;
selector: ContractSelector;
toU8a: (params: CodecArg[]) => Uint8Array;
toU8a: (params: unknown[]) => Uint8Array;
}
export type AbiConstructor = AbiMessage;
+1 -2
View File
@@ -3,7 +3,6 @@
import type { SubmittableResult } from '@polkadot/api';
import type { EventRecord } from '@polkadot/types/interfaces';
import type { CodecArg } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { BlueprintOptions, ContractOptions } from './types';
@@ -29,7 +28,7 @@ export function isOptions <T> (options: BigInt | string | number | BN | T): opti
return !(isBn(options) || isBigInt(options) || isNumber(options) || isString(options));
}
export function extractOptions <T extends TOptions> (value: BigInt | string | number | BN, params: CodecArg[]): [T, CodecArg[]] {
export function extractOptions <T extends TOptions> (value: BigInt | string | number | BN, params: unknown[]): [T, unknown[]] {
const gasLimit = params.shift() as BN;
return [{ gasLimit, value } as T, params];
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "5.2.1",
"version": "5.4.1",
"type": "module",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
@@ -20,15 +20,15 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/api": "5.2.1",
"@polkadot/rpc-core": "5.2.1",
"@polkadot/types": "5.2.1",
"@polkadot/util": "^7.0.3",
"@polkadot/util-crypto": "^7.0.3",
"@polkadot/api": "5.4.1",
"@polkadot/rpc-core": "5.4.1",
"@polkadot/types": "5.4.1",
"@polkadot/util": "^7.1.1",
"@polkadot/util-crypto": "^7.1.1",
"rxjs": "^7.2.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.0.3",
"@polkadot/rpc-provider": "5.2.1"
"@polkadot/keyring": "^7.1.1",
"@polkadot/rpc-provider": "5.4.1"
}
}
@@ -86,7 +86,7 @@ function queryScheduler (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
const id = scheduled.maybeId.unwrap().toHex();
if (id.startsWith(DEMOCRACY_ID)) {
const [, index] = api.registry.createType('(u64, ReferendumIndex)' as any, id) as ITuple<[u64, ReferendumIndex]>;
const [, index] = api.registry.createType<ITuple<[u64, ReferendumIndex]>>('(u64, ReferendumIndex)', id);
const imageHash = scheduled.call.args[0] as Hash;
result.push({ at, imageHash, index });
+2 -5
View File
@@ -14,10 +14,7 @@ import { TypeRegistry } from '@polkadot/types/create';
import { ExactDerive } from '.';
const testFunction = (api: ApiRx): any => {
return <
Section extends keyof ExactDerive,
Method extends keyof (typeof api.derive[Section])
>(section: Section, method: Method, inputs: any[]): void => {
return <S extends keyof ExactDerive, M extends keyof (typeof api.derive[S])>(section: S, method: M, inputs: any[]): void => {
describe(`derive.${section}.${method}`, (): void => {
it('should be a function', (): void => {
expect(typeof api.derive[section][method]).toBe('function');
@@ -96,7 +93,7 @@ describe('derive', (): void => {
testFunction(api)('balances', 'fees', ['a', 'b']);
// new
testFunction(api)('custom' as any, 'test', [1, 2, 3]);
testFunction(api)('custom', 'test', [1, 2, 3]);
// existing
testFunction(api)('chain', 'bestNumber', []);
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '5.2.1' };
export const packageInfo = { name: '@polkadot/api-derive', version: '5.4.1' };
+1 -1
View File
@@ -3,7 +3,7 @@
import { ApiPromise, WsProvider } from '@polkadot/api';
import { Metadata, TypeRegistry } from '@polkadot/types';
import metaStatic from '@polkadot/types/metadata/static';
import metaStatic from '@polkadot/types-support/metadata/static-substrate';
export function createApiWithAugmentations (): ApiPromise {
const registry = new TypeRegistry();
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "5.2.1",
"version": "5.4.1",
"type": "module",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
@@ -20,14 +20,14 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/api-derive": "5.2.1",
"@polkadot/keyring": "^7.0.3",
"@polkadot/rpc-core": "5.2.1",
"@polkadot/rpc-provider": "5.2.1",
"@polkadot/types": "5.2.1",
"@polkadot/types-known": "5.2.1",
"@polkadot/util": "^7.0.3",
"@polkadot/util-crypto": "^7.0.3",
"@polkadot/api-derive": "5.4.1",
"@polkadot/keyring": "^7.1.1",
"@polkadot/rpc-core": "5.4.1",
"@polkadot/rpc-provider": "5.4.1",
"@polkadot/types": "5.4.1",
"@polkadot/types-known": "5.4.1",
"@polkadot/util": "^7.1.1",
"@polkadot/util-crypto": "^7.1.1",
"eventemitter3": "^4.0.7",
"rxjs": "^7.2.0"
}
+168 -3
View File
@@ -1,19 +1,59 @@
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
/* eslint-disable */
import type { Vec, u16, u32, u64 } from '@polkadot/types';
import type { Vec, bool, u16, u32, u64 } from '@polkadot/types';
import type { Codec } from '@polkadot/types/types';
import type { Schedule } from '@polkadot/types/interfaces/contracts';
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, Moment, PalletId, Perbill, Percent, Permill, RuntimeDbWeight, Weight } from '@polkadot/types/interfaces/runtime';
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, Moment, PalletId, Perbill, Percent, Permill, RuntimeDbWeight, TransactionPriority, Weight } from '@polkadot/types/interfaces/runtime';
import type { SessionIndex } from '@polkadot/types/interfaces/session';
import type { EraIndex } from '@polkadot/types/interfaces/staking';
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import type { BlockLength, BlockWeights } from '@polkadot/types/interfaces/system';
import type { DepositBalanceOf } from '@polkadot/types/interfaces/uniques';
import type { ApiTypes } from '@polkadot/api/types';
declare module '@polkadot/api/types/consts' {
export interface AugmentedConsts<ApiType> {
assets: {
/**
* The amount of funds that must be reserved when creating a new approval.
**/
approvalDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The basic amount of funds that must be reserved for an asset.
**/
assetDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The basic amount of funds that must be reserved when adding metadata to your asset.
**/
metadataDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The additional funds that must be reserved for the number of bytes you store in your
* metadata.
**/
metadataDepositPerByte: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The maximum length of a name or symbol stored on-chain.
**/
stringLimit: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
authorship: {
/**
* The number of blocks back we should accept uncles.
* This means that we will deal with uncle-parents that are
* `UncleGenerations + 1` before `now`.
**/
uncleGenerations: BlockNumber & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
babe: {
/**
* The amount of time, in slots, that each epoch should last.
@@ -39,6 +79,15 @@ declare module '@polkadot/api/types/consts' {
* The minimum amount required to keep an account open.
**/
existentialDeposit: Balance & AugmentedConst<ApiType>;
/**
* The maximum number of locks that should exist on an account.
* Not strictly enforced, but used for weight estimation.
**/
maxLocks: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of named reserves that can exist on an account.
**/
maxReserves: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
@@ -163,10 +212,20 @@ declare module '@polkadot/api/types/consts' {
* Minimum voting period allowed for a fast-track referendum.
**/
fastTrackVotingPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* Indicator for whether an emergency origin is even allowed to happen. Some chains may want
* to set this permanently to `false`, others may want to condition it on things such as
* an upgrade having happened recently.
**/
instantAllowed: bool & AugmentedConst<ApiType>;
/**
* How often (in blocks) new public referenda are launched.
**/
launchPeriod: BlockNumber & AugmentedConst<ApiType>;
/**
* The maximum number of public proposals that can exist at any time.
**/
maxProposals: u32 & AugmentedConst<ApiType>;
/**
* The maximum number of votes for an account.
*
@@ -192,6 +251,29 @@ declare module '@polkadot/api/types/consts' {
[key: string]: Codec;
};
electionProviderMultiPhase: {
/**
* Maximum number of iteration of balancing that will be executed in the embedded miner of
* the pallet.
**/
minerMaxIterations: u32 & AugmentedConst<ApiType>;
/**
* Maximum length (bytes) that the mined solution should consume.
*
* The miner will ensure that the total length of the unsigned solution will not exceed
* this value.
**/
minerMaxLength: u32 & AugmentedConst<ApiType>;
/**
* Maximum weight that the miner should consume.
*
* The miner will ensure that the total weight of the unsigned solution will not exceed
* this value, based on [`WeightInfo::submit_unsigned`].
**/
minerMaxWeight: Weight & AugmentedConst<ApiType>;
/**
* The priority of the unsigned transaction submitted in the unsigned-phase
**/
minerTxPriority: TransactionPriority & AugmentedConst<ApiType>;
/**
* The repeat threshold of the offchain worker.
*
@@ -295,6 +377,11 @@ declare module '@polkadot/api/types/consts' {
* Must be no greater than `MaxQueueLen`.
**/
fifoQueueLen: u32 & AugmentedConst<ApiType>;
/**
* The issuance to ignore. This is subtracted from the `Currency`'s `total_issuance` to get
* the issuance by which we inflate or deflate the gilt.
**/
ignoredIssuance: BalanceOf & AugmentedConst<ApiType>;
/**
* The number of blocks between consecutive attempts to issue more gilts in an effort to
* get to the target amount to be frozen.
@@ -371,6 +458,19 @@ declare module '@polkadot/api/types/consts' {
**/
[key: string]: Codec;
};
imOnline: {
/**
* A configuration for base priority of unsigned transactions.
*
* This is exposed so that it can be tuned for particular runtime, when
* multiple pallets send unsigned transactions.
**/
unsignedPriority: TransactionPriority & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
indices: {
/**
* The deposit needed for reserving an index.
@@ -386,6 +486,12 @@ declare module '@polkadot/api/types/consts' {
* The max number of calls available in a single lottery.
**/
maxCalls: u32 & AugmentedConst<ApiType>;
/**
* Number of time we should try to generate a random number that has no modulo bias.
* The larger this number, the more potential computation is used for picking the winner,
* but also the more likely that the chosen winner is done fairly.
**/
maxGenerateRandom: u32 & AugmentedConst<ApiType>;
/**
* The Lottery's pallet id
**/
@@ -495,6 +601,22 @@ declare module '@polkadot/api/types/consts' {
**/
[key: string]: Codec;
};
scheduler: {
/**
* The maximum weight that may be scheduled per block for any dispatchables of less priority
* than `schedule::HARD_DEADLINE`.
**/
maximumWeight: Weight & AugmentedConst<ApiType>;
/**
* The maximum number of scheduled calls in the queue for a single block.
* Not strictly enforced, but used for weight estimation.
**/
maxScheduledPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
society: {
/**
* The minimum amount of a deposit required for a bid to be made.
@@ -657,7 +779,11 @@ declare module '@polkadot/api/types/consts' {
**/
burn: Permill & AugmentedConst<ApiType>;
/**
* The treasury's module id, used for deriving its sovereign account ID.
* The maximum number of approvals that can wait in the spending queue.
**/
maxApprovals: u32 & AugmentedConst<ApiType>;
/**
* The treasury's pallet id, used for deriving its sovereign account ID.
**/
palletId: PalletId & AugmentedConst<ApiType>;
/**
@@ -678,6 +804,45 @@ declare module '@polkadot/api/types/consts' {
**/
[key: string]: Codec;
};
uniques: {
/**
* The basic amount of funds that must be reserved when adding an attribute to an asset.
**/
attributeDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The basic amount of funds that must be reserved for an asset class.
**/
classDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The additional funds that must be reserved for the number of bytes store in metadata,
* either "normal" metadata or attribute metadata.
**/
depositPerByte: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The basic amount of funds that must be reserved for an asset instance.
**/
instanceDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The maximum length of an attribute key.
**/
keyLimit: u32 & AugmentedConst<ApiType>;
/**
* The basic amount of funds that must be reserved when adding metadata to your asset.
**/
metadataDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
/**
* The maximum length of data stored on-chain.
**/
stringLimit: u32 & AugmentedConst<ApiType>;
/**
* The maximum length of an attribute value.
**/
valueLimit: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
vesting: {
/**
* The minimum amount transferred to call `vested_transfer`.
+15 -7
View File
@@ -314,9 +314,9 @@ declare module '@polkadot/api/types/events' {
**/
Delegated: AugmentedEvent<ApiType, [AccountId, AccountId]>;
/**
* A proposal has been enacted. \[ref_index, is_ok\]
* A proposal has been enacted. \[ref_index, result\]
**/
Executed: AugmentedEvent<ApiType, [ReferendumIndex, bool]>;
Executed: AugmentedEvent<ApiType, [ReferendumIndex, DispatchResult]>;
/**
* An external proposal has been tabled.
**/
@@ -819,7 +819,7 @@ declare module '@polkadot/api/types/events' {
* the remainder from the maximum amount of reward.
* \[era_index, validator_payout, remainder\]
**/
EraPayout: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
EraPaid: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
/**
* A nominator has been kicked from a validator. \[nominator, stash\]
**/
@@ -830,18 +830,22 @@ declare module '@polkadot/api/types/events' {
**/
OldSlashingReportDiscarded: AugmentedEvent<ApiType, [SessionIndex]>;
/**
* The staker has been rewarded by this amount. \[stash, amount\]
* The stakers' rewards are getting paid. \[era_index, validator_stash\]
**/
Reward: AugmentedEvent<ApiType, [AccountId, Balance]>;
PayoutStarted: AugmentedEvent<ApiType, [EraIndex, AccountId]>;
/**
* The nominator has been rewarded by this amount. \[stash, amount\]
**/
Rewarded: AugmentedEvent<ApiType, [AccountId, Balance]>;
/**
* One validator (and its nominators) has been slashed by the given amount.
* \[validator, amount\]
**/
Slash: AugmentedEvent<ApiType, [AccountId, Balance]>;
Slashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
/**
* A new set of stakers was elected.
**/
StakingElection: AugmentedEvent<ApiType, []>;
StakersElected: AugmentedEvent<ApiType, []>;
/**
* The election failed. No new era is planned.
**/
@@ -1172,6 +1176,10 @@ declare module '@polkadot/api/types/events' {
* well as the error. \[index, error\]
**/
BatchInterrupted: AugmentedEvent<ApiType, [u32, DispatchError]>;
/**
* A single item within a Batch of dispatches has completed with no error.
**/
ItemCompleted: AugmentedEvent<ApiType, []>;
/**
* Generic event
**/
+1 -1
View File
@@ -939,7 +939,7 @@ declare module '@polkadot/api/types/storage' {
/**
* The last planned session scheduled by the session pallet.
*
* This is basically in sync with the call to [`SessionManager::new_session`].
* This is basically in sync with the call to [`pallet_session::SessionManager::new_session`].
**/
currentPlannedSession: AugmentedQuery<ApiType, () => Observable<SessionIndex>, []> & QueryableStorageEntry<ApiType, []>;
/**
+8 -8
View File
@@ -1352,8 +1352,9 @@ declare module '@polkadot/api/types/submittable' {
* origin is removed as a runner-up.
* - `origin` is a current member. In this case, the deposit is unreserved and origin is
* removed as a member, consequently not being a candidate for the next round anymore.
* Similar to [`remove_members`], if replacement runners exists, they are immediately
* used. If the prime is renouncing, then no prime will exist until the next round.
* Similar to [`remove_member`](Self::remove_member), if replacement runners exists,
* they are immediately used. If the prime is renouncing, then no prime will exist until
* the next round.
*
* The dispatch origin of this call must be signed, and have one of the above roles.
*
@@ -2556,7 +2557,7 @@ declare module '@polkadot/api/types/submittable' {
* Schedule a named task after a delay.
*
* # <weight>
* Same as [`schedule_named`].
* Same as [`schedule_named`](Self::schedule_named).
* # </weight>
**/
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option<Period> | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, BlockNumber, Option<Period>, Priority, Call]>;
@@ -2954,8 +2955,8 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin for this call must be _Signed_ by the stash, not the controller.
*
* Use this if there are additional funds in your stash account that you wish to bond.
* Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount
* that can be added.
* Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose any limitation
* on the amount that can be added.
*
* Emits `Bonded`.
*
@@ -3017,7 +3018,6 @@ declare module '@polkadot/api/types/submittable' {
*
* This can be helpful if bond requirements are updated, and we need to remove old users
* who do not satisfy these requirements.
*
**/
chillOther: AugmentedSubmittable<(controller: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId]>;
/**
@@ -3093,7 +3093,7 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin must be Root.
*
* # <weight>
* Same as [`set_validator_count`].
* Same as [`Self::set_validator_count`].
* # </weight>
**/
increaseValidatorCount: AugmentedSubmittable<(additional: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
@@ -3185,7 +3185,7 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin must be Root.
*
* # <weight>
* Same as [`set_validator_count`].
* Same as [`Self::set_validator_count`].
* # </weight>
**/
scaleValidatorCount: AugmentedSubmittable<(factor: Percent | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Percent]>;
+54 -44
View File
@@ -7,7 +7,7 @@ import type { Option, Raw, StorageKey, Text, u64 } from '@polkadot/types';
import type { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, CallFunction, Codec, CodecArg as Arg, DefinitionRpc, DefinitionRpcSub, IMethod, InterfaceTypes, IStorageKey, Registry, RegistryTypes } from '@polkadot/types/types';
import type { AnyFunction, AnyTuple, CallFunction, Codec, DefinitionRpc, DefinitionRpcSub, DetectCodec, IMethod, IStorageKey, Registry, RegistryTypes } from '@polkadot/types/types';
import type { SubmittableExtrinsic } from '../submittable/types';
import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecoratedRpcSection, DecorateMethod, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableModuleStorageAt, QueryableStorage, QueryableStorageAt, QueryableStorageEntry, QueryableStorageEntryAt, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import type { VersionedRegistry } from './types';
@@ -164,7 +164,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
/**
* @description Creates an instance of a type as registered
*/
public createType <K extends keyof InterfaceTypes> (type: K, ...params: unknown[]): InterfaceTypes[K] {
public createType <T extends Codec = Codec, K extends string = string> (type: K, ...params: unknown[]): DetectCodec<T, K> {
return this.#registry.createType(type, ...params);
}
@@ -189,12 +189,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._rpcCore.provider.hasSubscriptions || !!this._rpcCore.state.queryStorageAt;
}
protected _injectDecorated (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean, blockHash?: Uint8Array): FullDecoration<ApiType> {
const decoratedMeta = expandMetadata(registry.registry, registry.metadata);
// clear the decoration, we are redoing it here
if (fromEmpty || !registry.decoration) {
registry.decoration = {
protected _createDecorated (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean, blockHash?: Uint8Array | null, decoratedApi?: ApiDecoration<ApiType>): FullDecoration<ApiType> {
if (!decoratedApi) {
decoratedApi = {
consts: {},
errors: {},
events: {},
@@ -202,25 +199,39 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
} as ApiDecoration<ApiType>;
}
if (!registry.decoratedMeta) {
registry.decoratedMeta = expandMetadata(registry.registry, registry.metadata);
}
// adjust the versioned registry
augmentObject('consts', decoratedMeta.consts, registry.decoration.consts, fromEmpty);
augmentObject('errors', decoratedMeta.errors, registry.decoration.errors, fromEmpty);
augmentObject('events', decoratedMeta.events, registry.decoration.events, fromEmpty);
augmentObject('consts', registry.decoratedMeta.consts, decoratedApi.consts, fromEmpty);
augmentObject('errors', registry.decoratedMeta.errors, decoratedApi.errors, fromEmpty);
augmentObject('events', registry.decoratedMeta.events, decoratedApi.events, fromEmpty);
const storage = blockHash
? this._decorateStorageAt(decoratedMeta, this._decorateMethod, blockHash)
: this._decorateStorage(decoratedMeta, this._decorateMethod);
? this._decorateStorageAt(registry.decoratedMeta, this._decorateMethod, blockHash)
: this._decorateStorage(registry.decoratedMeta, this._decorateMethod);
augmentObject('query', storage, registry.decoration.query, fromEmpty);
augmentObject('query', storage, decoratedApi.query, fromEmpty);
return {
decoratedApi: registry.decoration,
decoratedMeta
decoratedApi,
decoratedMeta: registry.decoratedMeta
};
}
protected _injectMetadata (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean): void {
const { decoratedApi, decoratedMeta } = this._injectDecorated(registry, fromEmpty);
// clear the decoration, we are redoing it here
if (fromEmpty || !registry.decoratedApi) {
registry.decoratedApi = {
consts: {},
errors: {},
events: {},
query: {}
} as ApiDecoration<ApiType>;
}
const { decoratedApi, decoratedMeta } = this._createDecorated(registry, fromEmpty, null, registry.decoratedApi);
this._consts = decoratedApi.consts;
this._errors = decoratedApi.errors;
@@ -245,7 +256,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
* backwards compatible endpoint for metadata injection, may be removed in the future (However, it is still useful for testing injection)
*/
public injectMetadata (metadata: Metadata, fromEmpty?: boolean, registry?: Registry): void {
this._injectMetadata({ metadata, registry: registry || this.#registry, specVersion: BN_ZERO }, fromEmpty);
this._injectMetadata({ metadata, registry: registry || this.#registry, specName: this.#registry.createType('Text'), specVersion: BN_ZERO }, fromEmpty);
}
private _decorateFunctionMeta (input: MetaDecoration, output: MetaDecoration): MetaDecoration {
@@ -368,7 +379,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}
private _decorateExtrinsicEntry<ApiType extends ApiTypes> (method: CallFunction, creator: (value: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>): SubmittableExtrinsicFunction<ApiType> {
const decorated = (...params: Arg[]): SubmittableExtrinsic<ApiType> =>
const decorated = (...params: unknown[]): SubmittableExtrinsic<ApiType> =>
creator(method(...params));
// pass through the `.is`
@@ -414,17 +425,17 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
decorated.creator = creator;
decorated.at = decorateMethod((hash: Hash, ...args: Arg[]): Observable<Codec> =>
decorated.at = decorateMethod((hash: Hash, ...args: unknown[]): Observable<Codec> =>
this._rpcCore.state.getStorage(getArgs(args), hash));
decorated.hash = decorateMethod((...args: Arg[]): Observable<Hash> =>
decorated.hash = decorateMethod((...args: unknown[]): Observable<Hash> =>
this._rpcCore.state.getStorageHash(getArgs(args)));
decorated.is = <A extends AnyTuple> (key: IStorageKey<AnyTuple>): key is IStorageKey<A> =>
key.section === creator.section &&
key.method === creator.method;
decorated.key = (...args: Arg[]): string =>
decorated.key = (...args: unknown[]): string =>
u8aToHex(compactStripLength(creator(
creator.meta.type.isPlain
? undefined
@@ -435,27 +446,27 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
: args
))[1]);
decorated.keyPrefix = (...keys: Arg[]): string =>
decorated.keyPrefix = (...keys: unknown[]): string =>
u8aToHex(creator.keyPrefix(...keys));
decorated.range = decorateMethod((range: [Hash, Hash?], ...args: Arg[]): Observable<[Hash, Codec][]> =>
decorated.range = decorateMethod((range: [Hash, Hash?], ...args: unknown[]): Observable<[Hash, Codec][]> =>
this._decorateStorageRange(decorated, args, range));
decorated.size = decorateMethod((...args: Arg[]): Observable<u64> =>
decorated.size = decorateMethod((...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args)));
decorated.sizeAt = decorateMethod((hash: Hash | Uint8Array | string, ...args: Arg[]): Observable<u64> =>
decorated.sizeAt = decorateMethod((hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args), hash));
// FIXME NMap support
// .keys() & .entries() only available on map types
if (creator.iterKey && (creator.meta.type.isMap || creator.meta.type.isDoubleMap)) {
if (creator.iterKey && (creator.meta.type.isMap || creator.meta.type.isDoubleMap || creator.meta.type.isNMap)) {
decorated.entries = decorateMethod(
memo(this.#instanceId, (...args: Arg[]): Observable<[StorageKey, Codec][]> =>
memo(this.#instanceId, (...args: unknown[]): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, null, args)));
decorated.entriesAt = decorateMethod(
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: Arg[]): Observable<[StorageKey, Codec][]> =>
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, hash, args)));
decorated.entriesPaged = decorateMethod(
@@ -463,11 +474,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this._retrieveMapEntriesPaged(creator, opts)));
decorated.keys = decorateMethod(
memo(this.#instanceId, (...args: Arg[]): Observable<StorageKey[]> =>
memo(this.#instanceId, (...args: unknown[]): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, null, args)));
decorated.keysAt = decorateMethod(
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: Arg[]): Observable<StorageKey[]> =>
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, hash, args)));
decorated.keysPaged = decorateMethod(
@@ -477,7 +488,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
if (this.supportMulti) {
// When using double map storage function, user need to pass double map key as an array
decorated.multi = decorateMethod((args: (Arg | Arg[])[]): Observable<Codec[]> =>
decorated.multi = decorateMethod((args: (unknown | unknown[])[]): Observable<Codec[]> =>
this._retrieveMulti(args.map((arg) => [creator, arg])));
}
@@ -493,19 +504,19 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
// Disable this where it occurs for each field we are decorating
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
const decorated = decorateMethod((...args: Arg[]): Observable<Codec> =>
const decorated = decorateMethod((...args: unknown[]): Observable<Codec> =>
this._rpcCore.state.getStorage(getArgs(args), blockHash));
decorated.creator = creator;
decorated.hash = decorateMethod((...args: Arg[]): Observable<Hash> =>
decorated.hash = decorateMethod((...args: unknown[]): Observable<Hash> =>
this._rpcCore.state.getStorageHash(getArgs(args), blockHash));
decorated.is = <A extends AnyTuple> (key: IStorageKey<AnyTuple>): key is IStorageKey<A> =>
key.section === creator.section &&
key.method === creator.method;
decorated.key = (...args: Arg[]): string =>
decorated.key = (...args: unknown[]): string =>
u8aToHex(compactStripLength(creator(
creator.meta.type.isPlain
? undefined
@@ -516,21 +527,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
: args
))[1]);
decorated.keyPrefix = (...keys: Arg[]): string =>
decorated.keyPrefix = (...keys: unknown[]): string =>
u8aToHex(creator.keyPrefix(...keys));
decorated.size = decorateMethod((...args: Arg[]): Observable<u64> =>
decorated.size = decorateMethod((...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args), blockHash));
// FIXME NMap support
// .keys() & .entries() only available on map types
if (creator.iterKey && (creator.meta.type.isMap || creator.meta.type.isDoubleMap)) {
decorated.entries = decorateMethod(
memo(this.#instanceId, (...args: Arg[]): Observable<[StorageKey, Codec][]> =>
memo(this.#instanceId, (...args: unknown[]): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, blockHash, args)));
decorated.keys = decorateMethod(
memo(this.#instanceId, (...args: Arg[]): Observable<StorageKey[]> =>
memo(this.#instanceId, (...args: unknown[]): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, blockHash, args)));
}
@@ -542,7 +553,6 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
// Decorate the base storage call. In the case or rxjs or promise-without-callback (await)
// we make a subscription, alternatively we push this through a single-shot query
private _decorateStorageCall<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): ReturnType<DecorateMethod<ApiType>> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return decorateMethod((...args: unknown[]): Observable<Codec> => {
return this.hasSubscriptions
? this._rpcCore.state.subscribeStorage<[Codec]>([extractStorageArgs(this.#registry, creator, args)]).pipe(
@@ -555,7 +565,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
});
}
private _decorateStorageRange<ApiType extends ApiTypes> (decorated: QueryableStorageEntry<ApiType>, args: Arg[], range: [Hash, Hash?]): Observable<[Hash, Codec][]> {
private _decorateStorageRange<ApiType extends ApiTypes> (decorated: QueryableStorageEntry<ApiType>, args: unknown[], range: [Hash, Hash?]): Observable<[Hash, Codec][]> {
const outputType = unwrapStorageType(this.#registry, decorated.creator.meta.type, decorated.creator.meta.modifier.isOptional);
return this._rpcCore.state
@@ -569,7 +579,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}
// retrieve a set of values for a specific set of keys - here we chunk the keys into PAGE_SIZE sizes
private _retrieveMulti (keys: [StorageEntry, Arg | Arg[]][]): Observable<Codec[]> {
private _retrieveMulti (keys: [StorageEntry, unknown | unknown[]][]): Observable<Codec[]> {
if (!keys.length) {
return of([]);
}
@@ -585,7 +595,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
);
}
private _retrieveMapKeys ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | null, args: Arg[]): Observable<StorageKey[]> {
private _retrieveMapKeys ({ iterKey, meta, method, section }: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<StorageKey[]> {
assert(iterKey && (meta.type.isMap || meta.type.isDoubleMap || meta.type.isNMap), 'keys can only be retrieved on maps, linked maps and double maps');
const headKey = iterKey(...args).toHex();
@@ -619,7 +629,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
);
}
private _retrieveMapEntries (entry: StorageEntry, at: Hash | Uint8Array | string | null, args: Arg[]): Observable<[StorageKey, Codec][]> {
private _retrieveMapEntries (entry: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<[StorageKey, Codec][]> {
const query = at
? (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset, at)
: (keyset: StorageKey[]) => this._rpcCore.state.queryStorageAt(keyset);
+12 -10
View File
@@ -114,9 +114,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
const u8aHash = u8aToU8a(blockHash);
const registry = await this.getBlockRegistry(u8aHash);
return registry.decoration
? registry.decoration
: this._injectDecorated(registry, true, u8aHash).decoratedApi;
// always create a new decoration for this specific hash
return this._createDecorated(registry, true, u8aHash).decoratedApi;
}
/**
@@ -152,8 +151,12 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
: await firstValueFrom((this._rpcCore.state.getRuntimeVersion as RpcInterfaceMethod).json(header.parentHash))
);
// check for pre-existing registries
const existingViaVersion = this.#registries.find(({ specVersion }) => specVersion.eq(version.specVersion));
// check for pre-existing registries. We also check specName, e.g. it
// could be changed like in Westmint with upgrade from shell -> westmint
const existingViaVersion = this.#registries.find(({ specName, specVersion }) =>
specName.eq(version.specName) &&
specVersion.eq(version.specVersion)
);
if (existingViaVersion) {
existingViaVersion.lastBlockHash = blockHash;
@@ -170,7 +173,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
this._initRegistry(registry, this._runtimeChain as Text, version, metadata);
// add our new registry
const result = { lastBlockHash: blockHash, metadata, registry, specVersion: version.specVersion };
const result = { lastBlockHash: blockHash, metadata, registry, specName: version.specName, specVersion: version.specVersion };
this.#registries.push(result);
@@ -301,7 +304,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// setup the initial registry, when we have none
if (!this.#registries.length) {
this.#registries.push({ isDefault: true, metadata, registry: this.registry, specVersion: runtimeVersion.specVersion });
this.#registries.push({ isDefault: true, metadata, registry: this.registry, specName: runtimeVersion.specName, specVersion: runtimeVersion.specVersion });
}
// get unique types & validate
@@ -349,8 +352,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
}
#onProviderConnect = async (): Promise<void> => {
this.emit('connected');
this._isConnected.next(true);
this.emit('connected');
try {
const [hasMeta, cryptoReady] = await Promise.all([
@@ -379,10 +382,9 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
}
#onProviderDisconnect = (): void => {
this.emit('disconnected');
this._isConnected.next(false);
this._unsubscribeHealth();
this.emit('disconnected');
};
#onProviderError = (error: Error): void => {
+5 -1
View File
@@ -2,15 +2,19 @@
// SPDX-License-Identifier: Apache-2.0
import type { Metadata } from '@polkadot/types/metadata';
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
import type { Text } from '@polkadot/types/primitive';
import type { Registry } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { ApiDecoration, ApiTypes } from '../types';
export interface VersionedRegistry<ApiType extends ApiTypes> {
decoration?: ApiDecoration<ApiType> | null;
decoratedApi?: ApiDecoration<ApiType>;
decoratedMeta?: DecoratedMeta;
isDefault?: boolean;
lastBlockHash?: Uint8Array | null;
metadata: Metadata;
registry: Registry;
specName: Text;
specVersion: BN;
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '5.2.1' };
export const packageInfo = { name: '@polkadot/api', version: '5.4.1' };
+3 -4
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AnyFunction, Callback, Codec, CodecArg } from '@polkadot/types/types';
import type { AnyFunction, Callback, Codec } from '@polkadot/types/types';
export type Push<T extends readonly unknown[], V> = [...T, V]
@@ -57,9 +57,8 @@ export interface DecorateMethodOptions {
export type DecorateFn <T extends Codec> = (...args: any[]) => Observable<T>;
// FIXME We need a solution for NMap
export interface PaginationOptions<ArgType = CodecArg> {
args: ArgType[];
export interface PaginationOptions<A = unknown> {
args: A[];
pageSize: number;
startKey?: string;
}
+13 -13
View File
@@ -5,34 +5,34 @@ import type { Observable } from 'rxjs';
import type { StorageKey, u64 } from '@polkadot/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, Callback, Codec, CodecArg, IStorageKey } from '@polkadot/types/types';
import type { AnyFunction, AnyTuple, Callback, Codec, IStorageKey } from '@polkadot/types/types';
import type { ApiTypes, DropLast, MethodResult, ObsInnerType, PaginationOptions, PromiseOrObs, UnsubscribePromise } from './base';
interface StorageEntryObservableMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Observable<T[]>;
<T extends Codec>(args: (unknown[] | unknown)[]): Observable<T[]>;
}
interface StorageEntryPromiseMulti {
<T extends Codec>(args: (CodecArg[] | CodecArg)[]): Promise<T[]>;
<T extends Codec>(args: (CodecArg[] | CodecArg)[], callback: Callback<T[]>): UnsubscribePromise;
<T extends Codec>(args: (unknown[] | unknown)[]): Promise<T[]>;
<T extends Codec>(args: (unknown[] | unknown)[], callback: Callback<T[]>): UnsubscribePromise;
}
export interface StorageEntryPromiseOverloads {
(arg1?: CodecArg, arg2?: CodecArg, arg3?: CodecArg): Promise<Codec>;
<T extends Codec>(arg1?: CodecArg, arg2?: CodecArg, arg3?: CodecArg): Promise<T>;
(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<Codec>;
<T extends Codec>(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<T>;
<T extends Codec>(callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg: CodecArg, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: CodecArg, arg2: CodecArg, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: CodecArg, arg2: CodecArg, arg3: CodecArg, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg: unknown, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: unknown, arg2: unknown, callback: Callback<T>): UnsubscribePromise;
<T extends Codec>(arg1: unknown, arg2: unknown, arg3: unknown, callback: Callback<T>): UnsubscribePromise;
}
export interface StorageEntryPromiseOverloadsAt {
(arg1?: CodecArg, arg2?: CodecArg, arg3?: CodecArg): Promise<Codec>;
<T extends Codec>(arg1?: CodecArg, arg2?: CodecArg, arg3?: CodecArg): Promise<T>;
(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<Codec>;
<T extends Codec>(arg1?: unknown, arg2?: unknown, arg3?: unknown): Promise<T>;
}
// This is the most generic typings we can have for a storage entry function
type GenericStorageEntryFunction = (...args: CodecArg[]) => Observable<Codec>
type GenericStorageEntryFunction = (...args: unknown[]) => Observable<Codec>
export type QueryableStorageEntry<ApiType extends ApiTypes, A extends AnyTuple = AnyTuple> =
ApiType extends 'rxjs'
@@ -92,7 +92,7 @@ export interface QueryableModuleStorageAt<ApiType extends ApiTypes> {
export type QueryableStorageMultiArg<ApiType extends ApiTypes> =
QueryableStorageEntry<ApiType> |
[QueryableStorageEntry<ApiType>, ...CodecArg[]];
[QueryableStorageEntry<ApiType>, ...unknown[]];
export interface QueryableStorageMultiBase<ApiType extends ApiTypes> {
<T extends Codec[]>(calls: QueryableStorageMultiArg<ApiType>[]): Observable<T>;
+1 -1
View File
@@ -4,7 +4,7 @@
import type { Storage } from '@polkadot/types/metadata/decorate/types';
import { decorateStorage, Metadata, TypeRegistry } from '@polkadot/types';
import metaStatic from '@polkadot/types/metadata/static';
import metaStatic from '@polkadot/types-support/metadata/static-substrate';
import { extractStorageArgs } from './validate';
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "5.2.1",
"version": "5.4.1",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
@@ -20,12 +20,12 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/rpc-provider": "5.2.1",
"@polkadot/types": "5.2.1",
"@polkadot/util": "^7.0.3",
"@polkadot/rpc-provider": "5.4.1",
"@polkadot/types": "5.4.1",
"@polkadot/util": "^7.1.1",
"rxjs": "^7.2.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.0.3"
"@polkadot/keyring": "^7.1.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '5.2.1' };
export const packageInfo = { name: '@polkadot/rpc-core', version: '5.4.1' };
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "5.2.1",
"version": "5.4.1",
"type": "module",
"description": "Transport providers for the API",
"main": "index.js",
@@ -20,17 +20,17 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/types": "5.2.1",
"@polkadot/util": "^7.0.3",
"@polkadot/util-crypto": "^7.0.3",
"@polkadot/x-fetch": "^7.0.3",
"@polkadot/x-global": "^7.0.3",
"@polkadot/x-ws": "^7.0.3",
"@polkadot/types": "5.4.1",
"@polkadot/util": "^7.1.1",
"@polkadot/util-crypto": "^7.1.1",
"@polkadot/x-fetch": "^7.1.1",
"@polkadot/x-global": "^7.1.1",
"@polkadot/x-ws": "^7.1.1",
"eventemitter3": "^4.0.7"
},
"devDependencies": {
"@polkadot/keyring": "^7.0.3",
"@polkadot/types": "5.2.1",
"@polkadot/keyring": "^7.1.1",
"@polkadot/types": "5.4.1",
"mock-socket": "^9.0.3",
"nock": "^13.1.1"
}
+3 -3
View File
@@ -13,9 +13,9 @@ import EventEmitter from 'eventemitter3';
import { createTestKeyring } from '@polkadot/keyring/testing';
import { decorateStorage, Metadata } from '@polkadot/types';
import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
import rpcHeader from '@polkadot/types/json/Header.004.json';
import rpcSignedBlock from '@polkadot/types/json/SignedBlock.004.immortal.json';
import rpcMetadata from '@polkadot/types/metadata/static';
import rpcHeader from '@polkadot/types-support/json/Header.004.json';
import rpcSignedBlock from '@polkadot/types-support/json/SignedBlock.004.immortal.json';
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
import { assert, BN, bnToU8a, logger, u8aToHex } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '5.2.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', version: '5.4.1' };
+7 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "5.2.1",
"version": "5.4.1",
"type": "module",
"description": "Type generation scripts",
"main": "index.js",
@@ -29,16 +29,17 @@
"@babel/core": "^7.14.8",
"@babel/register": "^7.14.5",
"@babel/runtime": "^7.14.8",
"@polkadot/api": "5.2.1",
"@polkadot/rpc-provider": "5.2.1",
"@polkadot/types": "5.2.1",
"@polkadot/util": "^7.0.3",
"@polkadot/api": "5.4.1",
"@polkadot/rpc-provider": "5.4.1",
"@polkadot/types": "5.4.1",
"@polkadot/types-support": "5.4.1",
"@polkadot/util": "^7.1.1",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.0.1"
},
"devDependencies": {
"@types/websocket": "^1.0.3",
"@types/websocket": "^1.0.4",
"@types/yargs": "^17.0.2"
}
}
@@ -21,6 +21,7 @@ try {
'^@polkadot/rpc-core(.*)': './packages/rpc-core/src\\1',
'^@polkadot/rpc-provider(.*)': './packages/rpc-provider/src\\1',
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -17,6 +17,7 @@ try {
['module-resolver', {
alias: {
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -18,6 +18,7 @@ try {
alias: {
'^@polkadot/typegen(.*)': './packages/typegen/src\\1',
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -17,6 +17,7 @@ try {
['module-resolver', {
alias: {
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
@@ -17,6 +17,7 @@ try {
['module-resolver', {
alias: {
'^@polkadot/types-known(.*)': './packages/types-known/src\\1',
'^@polkadot/types-support(.*)': './packages/types-support/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
+10 -12
View File
@@ -51,23 +51,21 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
})
.sort(compareName);
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
];
return generateForMetaTemplate({
headerType: 'chain',
imports,
isStrict,
modules,
types
types: [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
]
});
});
}
+6 -8
View File
@@ -31,19 +31,17 @@ function generateForMeta (meta: Metadata, dest: string, isStrict: boolean): void
}))
.sort(compareName);
const types = [
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
];
return generateForMetaTemplate({
headerType: 'chain',
imports,
isStrict,
modules,
types
types: [
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
]
});
});
}
+10 -12
View File
@@ -44,23 +44,21 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
}))
.sort(compareName);
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
];
return generateForMetaTemplate({
headerType: 'chain',
imports,
isStrict,
modules,
types
types: [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
]
});
});
}
@@ -8,7 +8,7 @@ import { TypeRegistry } from '@polkadot/types/create';
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
import * as defaultPrimitives from '@polkadot/types/primitive';
import { createImports, getDerivedTypes, readTemplate, setImports, writeFile } from '../util';
import { createImports, readTemplate, setImports, writeFile } from '../util';
import { ModuleTypes } from '../util/imports';
const primitiveClasses = {
@@ -35,10 +35,10 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
Object
.keys(primitiveClasses)
.filter((name) => !name.includes('Generic'))
.forEach((primitiveName) => {
.forEach((primitiveName): void => {
setImports(definitions, imports, [primitiveName]);
items.push(...getDerivedTypes(registry, definitions, primitiveName, primitiveName, imports));
items.push(primitiveName);
});
const existingTypes: Record<string, boolean> = {};
@@ -55,25 +55,23 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
const uniqueTypes = Object.keys(types).filter((type) => !existingTypes[type]);
uniqueTypes.forEach((type) => {
uniqueTypes.forEach((type): void => {
existingTypes[type] = true;
items.push(...getDerivedTypes(registry, definitions, type, types[type] as string, imports));
items.push(type);
});
});
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
}))
];
return generateInterfaceTypesTemplate({
headerType: 'defs',
imports,
items: items.sort((a, b) => a.localeCompare(b)),
types
types: [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
}))
]
});
});
}
+10 -12
View File
@@ -127,23 +127,21 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
imports.typesTypes.Observable = true;
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
];
return generateForMetaTemplate({
headerType: 'chain',
imports,
isStrict,
modules,
types
types: [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes']
}
]
});
});
}
+6 -8
View File
@@ -126,18 +126,16 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
imports.typesTypes.Observable = true;
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
}))
];
return generateRpcTypesTemplate({
headerType: 'chain',
imports,
modules,
types
types: [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
}))
]
});
});
}
+10 -12
View File
@@ -70,23 +70,21 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
})
.sort(compareName);
const types = [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes', 'SubmittableExtrinsic']
}
];
return generateForMetaTemplate({
headerType: 'chain',
imports,
isStrict,
modules,
types
types: [
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
file: packagePath,
types: Object.keys(imports.localTypes[packagePath])
})),
{
file: '@polkadot/api/types',
types: ['ApiTypes', 'SubmittableExtrinsic']
}
]
});
});
}
+1 -1
View File
@@ -9,9 +9,9 @@ import fs from 'fs';
import { GenericCall as Call, Metadata, TypeRegistry, Vec } from '@polkadot/types';
import * as definitions from '@polkadot/types/interfaces/definitions';
import { getStorage as getSubstrateStorage } from '@polkadot/types/metadata/decorate/storage/getStorage';
import rpcdata from '@polkadot/types/metadata/static';
import { Text } from '@polkadot/types/primitive';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import rpcdata from '@polkadot/types-support/metadata/static-substrate';
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
interface SectionItem {
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '5.2.1' };
export const packageInfo = { name: '@polkadot/typegen', version: '5.4.1' };
@@ -5,7 +5,7 @@
declare module '@polkadot/types/types/registry' {
export interface InterfaceTypes {
{{#each items}}
{{{this}}}
{{{this}}}: {{{this}}};
{{/each}}
}
}
-12
View File
@@ -1,12 +0,0 @@
// Copyright 2017-2021 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Constructor } from '@polkadot/types/types';
import { UInt } from '@polkadot/types/codec';
import { isChildClass } from '@polkadot/util';
/** @internal */
export function isCompactEncodable (Child: Constructor<any>): boolean {
return isChildClass(UInt, Child);
}
+4 -43
View File
@@ -6,15 +6,13 @@ import type { Constructor, Registry } from '@polkadot/types/types';
import { Compact, Enum, Option, Struct, Tuple, UInt, Vec } from '@polkadot/types/codec';
import { AbstractInt } from '@polkadot/types/codec/AbstractInt';
import { ClassOfUnsafe, getTypeDef } from '@polkadot/types/create';
import { getTypeDef } from '@polkadot/types/create';
import { TypeDefInfo } from '@polkadot/types/create/types';
import { GenericAccountId, GenericLookupSource, GenericVote } from '@polkadot/types/generic';
import { AllConvictions } from '@polkadot/types/interfaces/democracy/definitions';
import { Null } from '@polkadot/types/primitive';
import * as primitiveClasses from '@polkadot/types/primitive';
import { bool, Null } from '@polkadot/types/primitive';
import { isChildClass, stringify } from '@polkadot/util';
import { isCompactEncodable } from './class';
import { formatType } from './formatting';
import { ModuleTypes, setImports, TypeImports } from './imports';
@@ -24,43 +22,6 @@ function arrayToStrType (arr: string[]): string {
const voteConvictions = arrayToStrType(AllConvictions);
// From `T`, generate `Compact<T>, Option<T>, Vec<T>`
/** @internal */
export function getDerivedTypes (registry: Registry, definitions: Record<string, ModuleTypes>, type: string, primitiveName: string, imports: TypeImports): string[] {
// `primitiveName` represents the actual primitive type our type is mapped to
const isCompact = isCompactEncodable((primitiveClasses as Record<string, any>)[primitiveName] || ClassOfUnsafe(registry, type));
const def = getTypeDef(type);
setImports(definitions, imports, ['Option', 'Vec', isCompact ? 'Compact' : '']);
const types = [
{
info: TypeDefInfo.Option,
sub: def,
type
},
{
info: TypeDefInfo.Vec,
sub: def,
type
}
];
if (isCompact) {
types.unshift({
info: TypeDefInfo.Compact,
sub: def,
type
});
}
const result = types.map((t) => formatType(registry, definitions, t, imports)).map((t) => `'${t}': ${t};`);
result.unshift(`${type}: ${type};`);
return result;
}
// Make types a little bit more flexible
// - if param instanceof AbstractInt, then param: u64 | Uint8array | AnyNumber
// etc
@@ -84,7 +45,7 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
return ['null'];
}
const Clazz = ClassOfUnsafe(registry, type);
const Clazz = registry.createClass(type);
if (isChildClass(Vec, Clazz)) {
const vecDef = getTypeDef(type);
@@ -121,7 +82,7 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
possibleTypes.push('Address', 'AccountId', 'AccountIndex', 'LookupSource', 'string', 'Uint8Array');
} else if (isChildClass(GenericAccountId, Clazz)) {
possibleTypes.push('string', 'Uint8Array');
} else if (isChildClass(registry.createClass('bool'), Clazz)) {
} else if (isChildClass(bool, Clazz)) {
possibleTypes.push('boolean', 'Uint8Array');
} else if (isChildClass(Null, Clazz)) {
possibleTypes.push('null');
+59 -47
View File
@@ -86,74 +86,86 @@ export function exportType (name = '', base: string): string {
return exportInterface(name, base);
}
const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => string> = {
[TypeDefInfo.Compact]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => string> = {
[TypeDefInfo.Compact]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['Compact']);
return paramsNotation('Compact', formatType(registry, definitions, (typeDef.sub as TypeDef).type, imports));
const sub = typeDef.sub as TypeDef;
return paramsNotation('Compact', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
},
[TypeDefInfo.DoNotConstruct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.DoNotConstruct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['DoNotConstruct']);
return 'DoNotConstruct';
},
[TypeDefInfo.Enum]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Enum]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
if (typeDef.lookupName) {
return typeDef.lookupName;
}
throw new Error(`TypeDefInfo.Enum: Not implemented on ${stringify(typeDef)}`);
},
[TypeDefInfo.Int]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Int]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
throw new Error(`TypeDefInfo.Int: Not implemented on ${stringify(typeDef)}`);
},
[TypeDefInfo.UInt]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.UInt]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
throw new Error(`TypeDefInfo.UInt: Not implemented on ${stringify(typeDef)}`);
},
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['Null']);
return 'Null';
},
[TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['Option']);
return paramsNotation('Option', formatType(registry, definitions, (typeDef.sub as TypeDef).type, imports));
const sub = (typeDef.sub as TypeDef);
return paramsNotation('Option', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
},
[TypeDefInfo.Plain]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Plain]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, [typeDef.type]);
return typeDef.type;
},
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
throw new Error(`TypeDefInfo.Set: Not implemented on ${stringify(typeDef)}`);
},
[TypeDefInfo.Si]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
throw new Error(`TypeDefInfo.Si: Not implemented on ${stringify(typeDef)}`);
[TypeDefInfo.Si]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
return formatType(registry, definitions, registry.lookup.getTypeDef(typeDef.type), imports, withShortcut);
},
[TypeDefInfo.Struct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Struct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['Struct']);
return `{ ${
((typeDef.sub as TypeDef[]).map(({ name, type }, index) => [
return `{${withShortcut ? ' ' : '\n'}${
((typeDef.sub as TypeDef[]).map(({ lookupName, name, type }, index) => [
name || `unknown${index}`,
formatType(registry, definitions, type, imports)
])).map(([k, t]) => `${k}: ${t};`).join(' ')
} } & Struct`;
formatType(registry, definitions, lookupName || type, imports, withShortcut)
])).map(([k, t]) => `${withShortcut ? '' : ' readonly '}${k}: ${t};`).join(withShortcut ? ' ' : '\n')
}${withShortcut ? ' ' : '\n '}} & Struct`;
},
[TypeDefInfo.Tuple]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Tuple]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['ITuple']);
// `(a,b)` gets transformed into `ITuple<[a, b]>`
return paramsNotation('ITuple', `[${
((typeDef.sub as TypeDef[]).map(({ type }) =>
formatType(registry, definitions, type, imports))
).join(', ')
((typeDef.sub as TypeDef[]).map(({ lookupName, type }) =>
formatType(registry, definitions, lookupName || type, imports, withShortcut)
)).join(', ')
}]`);
},
[TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['Vec']);
return paramsNotation('Vec', formatType(registry, definitions, (typeDef.sub as TypeDef).type, imports));
},
[TypeDefInfo.VecFixed]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
const type = (typeDef.sub as TypeDef).type;
const sub = (typeDef.sub as TypeDef);
if (type === 'u8') {
return paramsNotation('Vec', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
},
[TypeDefInfo.VecFixed]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
const sub = (typeDef.sub as TypeDef);
if (sub.type === 'u8') {
setImports(definitions, imports, ['U8aFixed']);
return 'U8aFixed';
@@ -161,42 +173,42 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
setImports(definitions, imports, ['Vec']);
return paramsNotation('Vec', formatType(registry, definitions, type, imports));
return paramsNotation('Vec', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
},
[TypeDefInfo.BTreeMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.BTreeMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['BTreeMap']);
const [keyDef, valDef] = (typeDef.sub as TypeDef[]);
return `BTreeMap<${formatType(registry, definitions, keyDef.type, imports)}, ${formatType(registry, definitions, valDef.type, imports)}>`;
return `BTreeMap<${formatType(registry, definitions, keyDef.lookupName || keyDef.type, imports, withShortcut)}, ${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
},
[TypeDefInfo.BTreeSet]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.BTreeSet]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['BTreeSet']);
const valDef = typeDef.sub as TypeDef;
return `BTreeSet<${formatType(registry, definitions, valDef.type, imports)}>`;
return `BTreeSet<${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
},
[TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['HashMap']);
const [keyDef, valDef] = (typeDef.sub as TypeDef[]);
return `HashMap<${formatType(registry, definitions, keyDef.type, imports)}, ${formatType(registry, definitions, valDef.type, imports)}>`;
return `HashMap<${formatType(registry, definitions, keyDef.lookupName || keyDef.type, imports, withShortcut)}, ${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
},
[TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
const type = (typeDef.sub as TypeDef).type;
[TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['Linkage']);
return paramsNotation('Linkage', formatType(registry, definitions, type, imports));
const sub = (typeDef.sub as TypeDef);
return paramsNotation('Linkage', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
},
[TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports) => {
[TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
setImports(definitions, imports, ['Result']);
const [okDef, errorDef] = (typeDef.sub as TypeDef[]);
const [okDef, errDef] = (typeDef.sub as TypeDef[]);
return `Result<${formatType(registry, definitions, okDef.type, imports)}, ${formatType(registry, definitions, errorDef.type, imports)}>`;
return `Result<${formatType(registry, definitions, okDef.lookupName || okDef.type, imports, withShortcut)}, ${formatType(registry, definitions, errDef.lookupName || errDef.type, imports, withShortcut)}>`;
}
};
@@ -205,7 +217,7 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
*/
/** @internal */
// eslint-disable-next-line @typescript-eslint/ban-types
export function formatType (registry: Registry, definitions: Record<string, ModuleTypes>, type: string | String | TypeDef, imports: TypeImports): string {
export function formatType (registry: Registry, definitions: Record<string, ModuleTypes>, type: string | String | TypeDef, imports: TypeImports, withShortcut = false): string {
let typeDef: TypeDef;
if (isString(type)) {
@@ -213,7 +225,7 @@ export function formatType (registry: Registry, definitions: Record<string, Modu
// If type is "unorthodox" (i.e. `{ something: any }` for an Enum input or `[a | b | c, d | e | f]` for a Tuple's similar types),
// we return it as-is
if (/(^{.+:.+})|^\([^,]+\)|^\(.+\)\[\]|^\[.+\]/.exec(_type) && !/\[\w+;\w+\]/.exec(_type)) {
if (withShortcut && /(^{.+:.+})|^\([^,]+\)|^\(.+\)\[\]|^\[.+\]/.exec(_type) && !/\[\w+;\w+\]/.exec(_type)) {
return _type;
}
@@ -224,5 +236,5 @@ export function formatType (registry: Registry, definitions: Record<string, Modu
setImports(definitions, imports, [typeDef.type]);
return formatters[typeDef.info](registry, typeDef, definitions, imports);
return formatters[typeDef.info](registry, typeDef, definitions, imports, withShortcut);
}
+2 -2
View File
@@ -64,10 +64,10 @@ export function setImports (allDefs: Record<string, ModuleTypes>, imports: TypeI
// TypeDef.sub is a `TypeDef | TypeDef[]`
if (Array.isArray(typeDef.sub)) {
typeDef.sub.forEach((subType) => setImports(allDefs, imports, [subType.type]));
typeDef.sub.forEach((subType) => setImports(allDefs, imports, [subType.lookupName || subType.type]));
} else if (typeDef.sub && (typeDef.info !== TypeDefInfo.VecFixed || typeDef.sub.type !== 'u8')) {
// typeDef.sub is a TypeDef in this case
setImports(allDefs, imports, [typeDef.sub.type]);
setImports(allDefs, imports, [typeDef.sub.lookupName || typeDef.sub.type]);
}
} else if (type.includes('[') && type.includes('|')) {
// We split the types (we already dod the check above, so safe-path should not be caught)
+1 -1
View File
@@ -4,7 +4,7 @@
import type { ExtraTypes } from '../generate/types';
import { Metadata, TypeRegistry } from '@polkadot/types';
import staticData from '@polkadot/types/metadata/static';
import staticData from '@polkadot/types-support/metadata/static-substrate';
import { registerDefinitions } from './register';
+5 -5
View File
@@ -1,8 +1,8 @@
{
"name": "@polkadot/types-known",
"version": "5.2.1",
"version": "5.4.1",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"description": "Known type definitions",
"main": "index.js",
"sideEffects": [
"./detectPackage.js",
@@ -20,8 +20,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/networks": "^7.0.3",
"@polkadot/types": "5.2.1",
"@polkadot/util": "^7.0.3"
"@polkadot/networks": "^7.1.1",
"@polkadot/types": "5.4.1",
"@polkadot/util": "^7.1.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '5.2.1' };
export const packageInfo = { name: '@polkadot/types-known', version: '5.4.1' };
+1 -1
View File
@@ -13,7 +13,7 @@ const upgrades: ChainUpgradesRaw = [
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
[7812476, 9040], [8010981, 9050], [8073833, 9070]
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080]
];
export default upgrades;
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+3
View File
@@ -0,0 +1,3 @@
# @polkadot/types-known
Specific known base type overrides (e.g. `Address`, etc) for chains & specs. This does not contain user-specfic types.
+25
View File
@@ -0,0 +1,25 @@
{
"name": "@polkadot/types-support",
"version": "5.4.1",
"type": "module",
"description": "Supporting files for types, mostly for testing",
"main": "index.js",
"sideEffects": [
"./detectPackage.js",
"./detectPackage.cjs"
],
"engines": {
"node": ">=14.0.0"
},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [],
"contributors": [],
"license": "Apache-2.0",
"repository": "github:polkadot-js/api",
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-support#readme",
"dependencies": {
"@babel/runtime": "^7.14.8",
"@polkadot/util": "^7.1.1"
}
}
@@ -0,0 +1,8 @@
// Copyright 2017-2021 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, []);
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2021 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
@@ -1,4 +1,4 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// Copyright 2017-2021 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Be able to import json in TS
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import metadata from './v13/kusama-hex';
export default metadata;
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import metadata from './v13/polkadot-hex';
export default metadata;
@@ -0,0 +1,6 @@
// Copyright 2017-2021 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import metadata from './v13/substrate-hex';
export default metadata;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -659,6 +659,13 @@
"docs": [
" Batch of dispatches completed fully with no error."
]
},
{
"name": "ItemCompleted",
"args": [],
"docs": [
" A single item within a Batch of dispatches has completed with no error."
]
}
],
"constants": [],
@@ -1119,7 +1126,18 @@
}
],
"events": null,
"constants": [],
"constants": [
{
"name": "UncleGenerations",
"type": "BlockNumber",
"value": "0x05000000",
"docs": [
" The number of blocks back we should accept uncles.",
" This means that we will deal with uncle-parents that are",
" `UncleGenerations + 1` before `now`."
]
}
],
"errors": [
{
"name": "InvalidUncleParent",
@@ -1771,6 +1789,23 @@
"docs": [
" The minimum amount required to keep an account open."
]
},
{
"name": "MaxLocks",
"type": "u32",
"value": "0x32000000",
"docs": [
" The maximum number of locks that should exist on an account.",
" Not strictly enforced, but used for weight estimation."
]
},
{
"name": "MaxReserves",
"type": "u32",
"value": "0x32000000",
"docs": [
" The maximum number of named reserves that can exist on an account."
]
}
],
"errors": [
@@ -2001,7 +2036,7 @@
"linked": false
}
},
"fallback": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000",
"fallback": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000",
"docs": [
" Unchecked, signed solutions.",
"",
@@ -2224,6 +2259,34 @@
" to submit the worker's solution."
]
},
{
"name": "MinerTxPriority",
"type": "TransactionPriority",
"value": "0xfeffffffffffff7f",
"docs": [
" The priority of the unsigned transaction submitted in the unsigned-phase"
]
},
{
"name": "MinerMaxIterations",
"type": "u32",
"value": "0x0a000000",
"docs": [
" Maximum number of iteration of balancing that will be executed in the embedded miner of",
" the pallet."
]
},
{
"name": "MinerMaxWeight",
"type": "Weight",
"value": "0xc07c907c2d010000",
"docs": [
" Maximum weight that the miner should consume.",
"",
" The miner will ensure that the total weight of the unsigned solution will not exceed",
" this value, based on [`WeightInfo::submit_unsigned`]."
]
},
{
"name": "SignedMaxSubmissions",
"type": "u32",
@@ -2279,6 +2342,17 @@
"docs": [
" Per-weight deposit for a signed solution."
]
},
{
"name": "MinerMaxLength",
"type": "u32",
"value": "0x00003600",
"docs": [
" Maximum length (bytes) that the mined solution should consume.",
"",
" The miner will ensure that the total length of the unsigned solution will not exceed",
" this value."
]
}
],
"errors": [
@@ -2886,7 +2960,7 @@
"docs": [
" The last planned session scheduled by the session pallet.",
"",
" This is basically in sync with the call to [`SessionManager::new_session`]."
" This is basically in sync with the call to [`pallet_session::SessionManager::new_session`]."
]
},
{
@@ -2970,8 +3044,8 @@
" The dispatch origin for this call must be _Signed_ by the stash, not the controller.",
"",
" Use this if there are additional funds in your stash account that you wish to bond.",
" Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount",
" that can be added.",
" Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose any limitation",
" on the amount that can be added.",
"",
" Emits `Bonded`.",
"",
@@ -3179,7 +3253,7 @@
" The dispatch origin must be Root.",
"",
" # <weight>",
" Same as [`set_validator_count`].",
" Same as [`Self::set_validator_count`].",
" # </weight>"
]
},
@@ -3197,7 +3271,7 @@
" The dispatch origin must be Root.",
"",
" # <weight>",
" Same as [`set_validator_count`].",
" Same as [`Self::set_validator_count`].",
" # </weight>"
]
},
@@ -3549,14 +3623,13 @@
" bond required.",
"",
" This can be helpful if bond requirements are updated, and we need to remove old users",
" who do not satisfy these requirements.",
""
" who do not satisfy these requirements."
]
}
],
"events": [
{
"name": "EraPayout",
"name": "EraPaid",
"args": [
"EraIndex",
"Balance",
@@ -3569,17 +3642,17 @@
]
},
{
"name": "Reward",
"name": "Rewarded",
"args": [
"AccountId",
"Balance"
],
"docs": [
" The staker has been rewarded by this amount. \\[stash, amount\\]"
" The nominator has been rewarded by this amount. \\[stash, amount\\]"
]
},
{
"name": "Slash",
"name": "Slashed",
"args": [
"AccountId",
"Balance"
@@ -3600,7 +3673,7 @@
]
},
{
"name": "StakingElection",
"name": "StakersElected",
"args": [],
"docs": [
" A new set of stakers was elected."
@@ -3666,6 +3739,16 @@
" An account has stopped participating as either a validator or nominator.",
" \\[stash\\]"
]
},
{
"name": "PayoutStarted",
"args": [
"EraIndex",
"AccountId"
],
"docs": [
" The stakers' rewards are getting paid. \\[era_index, validator_stash\\]"
]
}
],
"constants": [
@@ -4903,10 +4986,10 @@
"name": "Executed",
"args": [
"ReferendumIndex",
"bool"
"DispatchResult"
],
"docs": [
" A proposal has been enacted. \\[ref_index, is_ok\\]"
" A proposal has been enacted. \\[ref_index, result\\]"
]
},
{
@@ -5053,6 +5136,16 @@
" The minimum amount to be used as a deposit for a public referendum proposal."
]
},
{
"name": "InstantAllowed",
"type": "bool",
"value": "0x01",
"docs": [
" Indicator for whether an emergency origin is even allowed to happen. Some chains may want",
" to set this permanently to `false`, others may want to condition it on things such as",
" an upgrade having happened recently."
]
},
{
"name": "FastTrackVotingPeriod",
"type": "BlockNumber",
@@ -5087,6 +5180,14 @@
" Also used to compute weight, an overly big value can",
" lead to extrinsic with very big weight: see `delegate` for instance."
]
},
{
"name": "MaxProposals",
"type": "u32",
"value": "0x64000000",
"docs": [
" The maximum number of public proposals that can exist at any time."
]
}
],
"errors": [
@@ -6383,8 +6484,9 @@
" origin is removed as a runner-up.",
" - `origin` is a current member. In this case, the deposit is unreserved and origin is",
" removed as a member, consequently not being a candidate for the next round anymore.",
" Similar to [`remove_members`], if replacement runners exists, they are immediately",
" used. If the prime is renouncing, then no prime will exist until the next round.",
" Similar to [`remove_member`](Self::remove_member), if replacement runners exists,",
" they are immediately used. If the prime is renouncing, then no prime will exist until",
" the next round.",
"",
" The dispatch origin of this call must be signed, and have one of the above roles.",
"",
@@ -7328,7 +7430,15 @@
"type": "PalletId",
"value": "0x70792f7472737279",
"docs": [
" The treasury's module id, used for deriving its sovereign account ID."
" The treasury's pallet id, used for deriving its sovereign account ID."
]
},
{
"name": "MaxApprovals",
"type": "u32",
"value": "0x64000000",
"docs": [
" The maximum number of approvals that can wait in the spending queue."
]
}
],
@@ -8309,7 +8419,19 @@
]
}
],
"constants": [],
"constants": [
{
"name": "UnsignedPriority",
"type": "TransactionPriority",
"value": "0xffffffffffffffff",
"docs": [
" A configuration for base priority of unsigned transactions.",
"",
" This is exposed so that it can be tuned for particular runtime, when",
" multiple pallets send unsigned transactions."
]
}
],
"errors": [
{
"name": "InvalidKey",
@@ -11156,7 +11278,7 @@
" Schedule a named task after a delay.",
"",
" # <weight>",
" Same as [`schedule_named`].",
" Same as [`schedule_named`](Self::schedule_named).",
" # </weight>"
]
}
@@ -11194,7 +11316,26 @@
]
}
],
"constants": [],
"constants": [
{
"name": "MaximumWeight",
"type": "Weight",
"value": "0x00806e8774010000",
"docs": [
" The maximum weight that may be scheduled per block for any dispatchables of less priority",
" than `schedule::HARD_DEADLINE`."
]
},
{
"name": "MaxScheduledPerBlock",
"type": "u32",
"value": "0x32000000",
"docs": [
" The maximum number of scheduled calls in the queue for a single block.",
" Not strictly enforced, but used for weight estimation."
]
}
],
"errors": [
{
"name": "FailedToSchedule",
@@ -14068,7 +14209,49 @@
]
}
],
"constants": [],
"constants": [
{
"name": "AssetDeposit",
"type": "DepositBalanceOf",
"value": "0x0000c16ff28623000000000000000000",
"docs": [
" The basic amount of funds that must be reserved for an asset."
]
},
{
"name": "MetadataDepositBase",
"type": "DepositBalanceOf",
"value": "0x0080c6a47e8d03000000000000000000",
"docs": [
" The basic amount of funds that must be reserved when adding metadata to your asset."
]
},
{
"name": "MetadataDepositPerByte",
"type": "DepositBalanceOf",
"value": "0x00407a10f35a00000000000000000000",
"docs": [
" The additional funds that must be reserved for the number of bytes you store in your",
" metadata."
]
},
{
"name": "ApprovalDeposit",
"type": "DepositBalanceOf",
"value": "0x00407a10f35a00000000000000000000",
"docs": [
" The amount of funds that must be reserved when creating a new approval."
]
},
{
"name": "StringLimit",
"type": "u32",
"value": "0x32000000",
"docs": [
" The maximum length of a name or symbol stored on-chain."
]
}
],
"errors": [
{
"name": "BalanceLow",
@@ -14148,7 +14331,7 @@
{
"name": "Mmr",
"storage": {
"prefix": "MerkleMountainRange",
"prefix": "Mmr",
"items": [
{
"name": "RootHash",
@@ -14420,6 +14603,16 @@
"docs": [
" The max number of calls available in a single lottery."
]
},
{
"name": "MaxGenerateRandom",
"type": "u32",
"value": "0x0a000000",
"docs": [
" Number of time we should try to generate a random number that has no modulo bias.",
" The larger this number, the more potential computation is used for picking the winner,",
" but also the more likely that the chosen winner is done fairly."
]
}
],
"errors": [
@@ -14673,6 +14866,15 @@
}
],
"constants": [
{
"name": "IgnoredIssuance",
"type": "BalanceOf",
"value": "0x00000000000000000000000000000000",
"docs": [
" The issuance to ignore. This is subtracted from the `Currency`'s `total_issuance` to get",
" the issuance by which we inflate or deflate the gilt."
]
},
{
"name": "QueueCount",
"type": "u32",
@@ -15855,7 +16057,73 @@
]
}
],
"constants": [],
"constants": [
{
"name": "ClassDeposit",
"type": "DepositBalanceOf",
"value": "0x0000c16ff28623000000000000000000",
"docs": [
" The basic amount of funds that must be reserved for an asset class."
]
},
{
"name": "InstanceDeposit",
"type": "DepositBalanceOf",
"value": "0x00407a10f35a00000000000000000000",
"docs": [
" The basic amount of funds that must be reserved for an asset instance."
]
},
{
"name": "MetadataDepositBase",
"type": "DepositBalanceOf",
"value": "0x0080c6a47e8d03000000000000000000",
"docs": [
" The basic amount of funds that must be reserved when adding metadata to your asset."
]
},
{
"name": "AttributeDepositBase",
"type": "DepositBalanceOf",
"value": "0x0080c6a47e8d03000000000000000000",
"docs": [
" The basic amount of funds that must be reserved when adding an attribute to an asset."
]
},
{
"name": "DepositPerByte",
"type": "DepositBalanceOf",
"value": "0x00407a10f35a00000000000000000000",
"docs": [
" The additional funds that must be reserved for the number of bytes store in metadata,",
" either \"normal\" metadata or attribute metadata."
]
},
{
"name": "StringLimit",
"type": "u32",
"value": "0x32000000",
"docs": [
" The maximum length of data stored on-chain."
]
},
{
"name": "KeyLimit",
"type": "u32",
"value": "0x20000000",
"docs": [
" The maximum length of an attribute key."
]
},
{
"name": "ValueLimit",
"type": "u32",
"value": "0x00010000",
"docs": [
" The maximum length of an attribute value."
]
}
],
"errors": [
{
"name": "NoPermission",
@@ -16219,4 +16487,4 @@
}
}
}
}
}

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