Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf2c560db5 | ||
|
|
63189a6196 | ||
|
|
9990690332 | ||
|
|
ee163cc342 | ||
|
|
cf27f7e11b | ||
|
|
12986865c8 | ||
|
|
aac0fc741a | ||
|
|
c33f95d64b | ||
|
|
eb7255b34f | ||
|
|
3982798d5e | ||
|
|
ded1ebd4e7 | ||
|
|
c261d4e333 | ||
|
|
7b1400e238 | ||
|
|
7c2048bc6b | ||
|
|
2b1d5664fe | ||
|
|
5403686e20 | ||
|
|
e90c72fc8b | ||
|
|
1910ef54a4 | ||
|
|
45686f9482 | ||
|
|
a6b0d214af | ||
|
|
2a1a2a936b | ||
|
|
060275d1ae | ||
|
|
abb54d2538 | ||
|
|
98fc472a40 | ||
|
|
4034429042 | ||
|
|
ca212b8736 | ||
|
|
4c2593629d | ||
|
|
612d85ca2a | ||
|
|
b25b92dddc | ||
|
|
f01376ebe1 | ||
|
|
03acde19b8 | ||
|
|
1de533ca9c | ||
|
|
ce2037400c | ||
|
|
379fe12979 | ||
|
|
a285f53753 | ||
|
|
ed36eed112 | ||
|
|
ddf6f574f6 | ||
|
|
4f7c4e8b4e | ||
|
|
f2a82ddd0f | ||
|
|
3cec316683 | ||
|
|
c23b5e674b | ||
|
|
8bf8222c31 | ||
|
|
0c19e966cc | ||
|
|
9fbda5a6e0 | ||
|
|
3d7d39073f | ||
|
|
ae26aebdf8 | ||
|
|
c43f442fb9 | ||
|
|
f97a6d0418 | ||
|
|
7cd2fa5f6a | ||
|
|
6015552aab | ||
|
|
8748c02b20 | ||
|
|
6e04d4aa93 | ||
|
|
4a955f7b77 | ||
|
|
227143728d | ||
|
|
7330555c37 | ||
|
|
09831fe325 | ||
|
|
c7dda6fe85 | ||
|
|
285bbab055 | ||
|
|
b73010a506 | ||
|
|
9c951fe1cb | ||
|
|
f7dfb633d6 | ||
|
|
e32286b610 | ||
|
|
fe2687b514 | ||
|
|
1adde99e1b | ||
|
|
33dcc9c8aa | ||
|
|
db563bc131 | ||
|
|
35d2fa31e0 | ||
|
|
399637280c | ||
|
|
f46916b215 | ||
|
|
94aa79d1e5 | ||
|
|
10dacf1d16 | ||
|
|
bdaacfdd56 | ||
|
|
4fa77b3654 | ||
|
|
400e14d6c9 | ||
|
|
09f247432f | ||
|
|
fd195dd4f0 | ||
|
|
0038227680 | ||
|
|
89dec0bc0b | ||
|
|
a55a835504 | ||
|
|
c1266a6657 | ||
|
|
b78f08e2e6 | ||
|
|
298ef03787 | ||
|
|
dd80b1873c | ||
|
|
f7672e053b | ||
|
|
281e9d2dee |
+1
-1
@@ -1,4 +1,4 @@
|
||||
30
|
||||
31
|
||||
1.4.2
|
||||
1.6.2
|
||||
1.11.2
|
||||
|
||||
@@ -2,7 +2,7 @@ name: 'Lock Threads'
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '3 0/5 * * *'
|
||||
- cron: '30 1/2 * * *'
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
|
||||
@@ -7,7 +7,7 @@ on:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.issue.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
|
||||
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '2 2 * * *'
|
||||
- cron: '30 2/2 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
build
|
||||
coverage
|
||||
packages
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
module.exports = require('@polkadot/dev/config/prettier.cjs');
|
||||
@@ -1,5 +1,63 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 4.16.1 Jun 26, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for full from-genesis queries on Kusama.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Adjust types for uniques (Thanks to https://github.com/Yuripetusko)
|
||||
|
||||
Changes:
|
||||
|
||||
- Add Kusama, Polkadot & Westend 9050 upgrade blocks
|
||||
- Add Kusama & Westend 9070 upgrade blocks
|
||||
- Adjust API decoration to lazy-create event and storage types
|
||||
- Use TS `override` as applicable (with `--noImplicitOverrides` option)
|
||||
- Add missing historic `Heartbeat: HeartbeatTo244` mapping to Kusama
|
||||
- Remove duplication from contracts registry
|
||||
- Add explicit check for scale-info 0.7+ (contracts index lookups)
|
||||
- Align static metadata with latest Substrate
|
||||
|
||||
|
||||
## 4.15.1 Jun 19, 2021
|
||||
|
||||
Upgrade priority: Medium. Recommended for all chains where Xcm is used (addition of new `XcmOrigin`)
|
||||
|
||||
Contributed:
|
||||
|
||||
- Added `ChargeAssetTxPayment` extension (Thanks to https://github.com/apopiak)
|
||||
|
||||
Changes:
|
||||
|
||||
- Allow for type decoding of nested fixed vectors, tuples and structs
|
||||
- Added `childstate_getKeysPaged` RPC
|
||||
- Add `XcmOrigin` mapping for `OriginCaller` generation
|
||||
- Align static metadata with latest Substrate
|
||||
- Adjust error message for contracts V3 (extrinsic from runtime)
|
||||
- Correct module optionality in `api.derive.balances.account`
|
||||
- Add alias for `GenericAddress` -> `GenericMultiAddress`
|
||||
- Adjust metadata doc generation (keep spaces between subsequent lines)
|
||||
|
||||
|
||||
## 4.14.1 Jun 14, 2021
|
||||
|
||||
Upgrade priority: Low. Internal adjustment only, no major external usage changes.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Adjust types for uniques (Thanks to https://github.com/hamidra)
|
||||
- Add `ValidationCodeHash` type (Thanks to https://github.com/andresilva)
|
||||
- Extend `OriginCaller` type creation (Thanks to https://github.com/xlc)
|
||||
|
||||
Changes:
|
||||
|
||||
- Do strict length checking on `[u8; <length>]` type inputs
|
||||
- Adjust keys/entries retrieval batch sizes
|
||||
- Add upgrade block for Kusama 9040
|
||||
- Use `BN` imports from `@polkadot/util`
|
||||
|
||||
|
||||
## 4.13.1 Jun 6, 2021
|
||||
|
||||
Upgrade priority: Medium. Required for users connecting to Statemine and future Kusama upgrades.
|
||||
|
||||
@@ -27,5 +27,6 @@ module.exports = {
|
||||
'<rootDir>/packages/types/build',
|
||||
'<rootDir>/packages/types-known/build'
|
||||
],
|
||||
testTimeout: 10000,
|
||||
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
|
||||
};
|
||||
|
||||
+8
-8
@@ -8,7 +8,7 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"typescript": "^4.3.2"
|
||||
"typescript": "^4.3.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||
@@ -20,19 +20,19 @@
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
"test": "polkadot-dev-run-test --coverage --detectOpenHandles --forceExit --runInBand --testPathIgnorePatterns e2e",
|
||||
"test": "polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e",
|
||||
"test:one": "polkadot-dev-run-test --detectOpenHandles --forceExit",
|
||||
"test:watch": "polkadot-dev-run-test --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/register": "^7.13.16",
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/dev": "^0.62.38",
|
||||
"@polkadot/ts": "^0.3.86",
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/register": "^7.14.5",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/dev": "^0.62.43",
|
||||
"@polkadot/ts": "^0.4.1",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^26.0.23",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"version": "4.13.1"
|
||||
"version": "4.16.1"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
@@ -19,11 +19,10 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/api": "4.13.1",
|
||||
"@polkadot/types": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"@polkadot/x-rxjs": "^6.7.1",
|
||||
"bn.js": "^4.11.9"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string
|
||||
? list.find(({ identifier }) => [identifier, stringCamelCase(identifier)].includes(messageOrId.toString()))
|
||||
: messageOrId;
|
||||
|
||||
return assertReturn(message, `Attempted to call an invalid contract interface, ${stringify(messageOrId)}`);
|
||||
return assertReturn(message, () => `Attempted to call an invalid contract interface, ${stringify(messageOrId)}`);
|
||||
}
|
||||
|
||||
export class Abi {
|
||||
@@ -127,7 +127,7 @@ export class Abi {
|
||||
const args = this.#createArgs(spec.args, spec);
|
||||
const event = {
|
||||
args,
|
||||
docs: spec.docs.map((doc) => doc.toString()),
|
||||
docs: spec.docs.map((d) => d.toString()),
|
||||
fromU8a: (data: Uint8Array): DecodedEvent => ({
|
||||
args: this.#decodeArgs(args, data),
|
||||
event
|
||||
@@ -145,7 +145,7 @@ export class Abi {
|
||||
const message = {
|
||||
...add,
|
||||
args,
|
||||
docs: spec.docs.map((doc) => doc.toString()),
|
||||
docs: spec.docs.map((d) => d.toString()),
|
||||
fromU8a: (data: Uint8Array): DecodedMessage => ({
|
||||
args: this.#decodeArgs(args, data),
|
||||
message
|
||||
|
||||
@@ -35,8 +35,10 @@ export class MetaRegistry extends TypeRegistry {
|
||||
constructor (metadataVersion: string, chainProperties?: ChainProperties) {
|
||||
super();
|
||||
|
||||
// type indexes are 1-based pre-1.0 and 0-based post-1.0
|
||||
this.typeOffset = metadataVersion.split('.')[0] === '0' ? 1 : 0;
|
||||
const [major, minor] = metadataVersion.split('.').map((n) => parseInt(n, 10));
|
||||
|
||||
// type indexes are 1-based pre 0.7 and 0-based post
|
||||
this.typeOffset = (major === 0 && minor < 7) ? 1 : 0;
|
||||
|
||||
if (chainProperties) {
|
||||
this.setChainProperties(chainProperties);
|
||||
@@ -124,7 +126,7 @@ export class MetaRegistry extends TypeRegistry {
|
||||
: {}
|
||||
),
|
||||
...(path.length > 1
|
||||
? { namespace: path.map((segment) => segment.toString()).join('::') }
|
||||
? { namespace: path.map((s) => s.toString()).join('::') }
|
||||
: {}
|
||||
),
|
||||
...(type.params.length > 0
|
||||
@@ -154,15 +156,13 @@ export class MetaRegistry extends TypeRegistry {
|
||||
|
||||
assert(isTuple || isStruct, 'Invalid fields type detected, expected either Tuple or Struct');
|
||||
|
||||
const sub = fields.map(({ name, type }) => {
|
||||
return {
|
||||
...this.getMetaTypeDef({ type }),
|
||||
...(name.isSome
|
||||
? { name: name.unwrap().toString() }
|
||||
: {}
|
||||
)
|
||||
};
|
||||
});
|
||||
const sub = fields.map(({ name, type }) => ({
|
||||
...this.getMetaTypeDef({ type }),
|
||||
...(name.isSome
|
||||
? { name: name.unwrap().toString() }
|
||||
: {}
|
||||
)
|
||||
}));
|
||||
|
||||
return isTuple && sub.length === 1
|
||||
? sub[0]
|
||||
@@ -213,32 +213,28 @@ export class MetaRegistry extends TypeRegistry {
|
||||
const { params, path } = this.#getMetaType(id);
|
||||
const specialVariant = path[0].toString();
|
||||
|
||||
if (specialVariant === 'Option') {
|
||||
return {
|
||||
return specialVariant === 'Option'
|
||||
? {
|
||||
info: TypeDefInfo.Option,
|
||||
sub: this.getMetaTypeDef({ type: params[0] })
|
||||
};
|
||||
} else if (specialVariant === 'Result') {
|
||||
return {
|
||||
info: TypeDefInfo.Result,
|
||||
sub: params.map((type, index) => ({
|
||||
name: ['Ok', 'Error'][index],
|
||||
...this.getMetaTypeDef({ type })
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
info: TypeDefInfo.Enum,
|
||||
sub: this.#extractVariantSub(variants)
|
||||
};
|
||||
}
|
||||
: specialVariant === 'Result'
|
||||
? {
|
||||
info: TypeDefInfo.Result,
|
||||
sub: params.map((type, index) => ({
|
||||
name: ['Ok', 'Error'][index],
|
||||
...this.getMetaTypeDef({ type })
|
||||
}))
|
||||
}
|
||||
: {
|
||||
info: TypeDefInfo.Enum,
|
||||
sub: this.#extractVariantSub(variants)
|
||||
};
|
||||
}
|
||||
|
||||
#extractVariantSub = (variants: SiVariant[]): TypeDef[] => {
|
||||
const isAllUnitVariants = variants.every(({ fields }) => fields.length === 0);
|
||||
|
||||
if (isAllUnitVariants) {
|
||||
return variants.map(({ discriminant, name }) => ({
|
||||
return variants.every(({ fields }) => fields.length === 0)
|
||||
? variants.map(({ discriminant, name }) => ({
|
||||
...(
|
||||
discriminant.isSome
|
||||
? { ext: { discriminant: discriminant.unwrap().toNumber() } }
|
||||
@@ -247,14 +243,10 @@ export class MetaRegistry extends TypeRegistry {
|
||||
info: TypeDefInfo.Plain,
|
||||
name: name.toString(),
|
||||
type: 'Null'
|
||||
}));
|
||||
}
|
||||
|
||||
return variants.map(({ fields, name }) =>
|
||||
withTypeString({
|
||||
}))
|
||||
: variants.map(({ fields, name }) => withTypeString({
|
||||
...this.#extractFields(fields),
|
||||
name: name.toString()
|
||||
})
|
||||
);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ export abstract class Base<ApiType extends ApiTypes> {
|
||||
this.registry = this.abi.registry;
|
||||
this._decorateMethod = decorateMethod;
|
||||
|
||||
assert(isFunction(api.rx.tx.contracts?.instantiateWithCode), 'You need to connect to a node with a V3 contracts module. Your node does not expose api.tx.contracts.instantiateWithCode on this instance');
|
||||
assert(!!(api && api.isConnected && api.tx && api.tx.contracts && Object.keys(api.tx.contracts).length), 'Your API has not been initialized correctly and it not decorated with the runtime interfaces for contracts as retrieved from the on-chain runtime');
|
||||
assert(isFunction(api.tx.contracts.instantiateWithCode), 'You need to connect to a chain with a runtime with a V3 contracts module. The runtime does not expose api.tx.contracts.instantiateWithCode');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,10 @@ import type { AnyJson, CodecArg, ISubmittableResult } from '@polkadot/types/type
|
||||
import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent } from '../types';
|
||||
import type { ContractCallResult, ContractCallSend, ContractQuery, ContractTx, MapMessageQuery, MapMessageTx } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { SubmittableResult } from '@polkadot/api';
|
||||
import { ApiBase } from '@polkadot/api/base';
|
||||
import { createTypeUnsafe } from '@polkadot/types';
|
||||
import { assert, BN_HUNDRED, BN_ONE, BN_ZERO, bnToBn, isFunction, isUndefined, logger } from '@polkadot/util';
|
||||
import { assert, BN, BN_HUNDRED, BN_ONE, BN_ZERO, bnToBn, isFunction, isUndefined, logger } from '@polkadot/util';
|
||||
import { map } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { Abi } from '../Abi';
|
||||
|
||||
@@ -7,13 +7,12 @@ import { TypeRegistry } from '@polkadot/types';
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
export const mockApi = {
|
||||
isConnected: true,
|
||||
registry,
|
||||
rx: {
|
||||
tx: {
|
||||
contracts: {
|
||||
instantiateWithCode: (): never => {
|
||||
throw new Error('mock');
|
||||
}
|
||||
tx: {
|
||||
contracts: {
|
||||
instantiateWithCode: (): never => {
|
||||
throw new Error('mock');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
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 { Observable } from '@polkadot/x-rxjs';
|
||||
import type { AbiMessage, BlueprintOptions, ContractCallOutcome, ContractOptions } from '../types';
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
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';
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-contract', version: '4.13.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-contract', version: '4.16.1' };
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
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 { BN } from '@polkadot/util';
|
||||
import type { Abi } from '.';
|
||||
|
||||
export interface ContractBase<ApiType extends ApiTypes> {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/rpc-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
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';
|
||||
|
||||
import { isBigInt, isBn, isNumber, isString } from '@polkadot/util';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
@@ -19,17 +19,16 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/api": "4.13.1",
|
||||
"@polkadot/rpc-core": "4.13.1",
|
||||
"@polkadot/types": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"@polkadot/util-crypto": "^6.7.1",
|
||||
"@polkadot/x-rxjs": "^6.7.1",
|
||||
"bn.js": "^4.11.9"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api": "4.16.1",
|
||||
"@polkadot/rpc-core": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.7.1",
|
||||
"@polkadot/rpc-provider": "4.13.1"
|
||||
"@polkadot/keyring": "^6.10.1",
|
||||
"@polkadot/rpc-provider": "4.16.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,19 @@ type DeriveCustomAccount = ApiInterfaceRx['derive'] & {
|
||||
}
|
||||
}
|
||||
|
||||
function zeroBalance (api: ApiInterfaceRx) {
|
||||
return api.registry.createType('Balance');
|
||||
}
|
||||
|
||||
function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenFee, frozenMisc]: BalanceResult): DeriveBalancesAccountData {
|
||||
const votingBalance = api.registry.createType('Balance', freeBalance.toBn());
|
||||
|
||||
return {
|
||||
freeBalance,
|
||||
frozenFee,
|
||||
frozenMisc,
|
||||
reservedBalance,
|
||||
votingBalance: api.registry.createType('Balance', freeBalance.toBn())
|
||||
votingBalance
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,7 +61,16 @@ function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observab
|
||||
]).pipe(
|
||||
map(([freeBalance, reservedBalance, accountNonce]): Result => [
|
||||
accountNonce,
|
||||
[[freeBalance, reservedBalance, api.registry.createType('Balance'), api.registry.createType('Balance')]]
|
||||
[[freeBalance, reservedBalance, zeroBalance(api), zeroBalance(api)]]
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
function querySystemNonce (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
return api.query.system.accountNonce<Index>(accountId).pipe(
|
||||
map((accountNonce): Result => [
|
||||
accountNonce,
|
||||
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -71,6 +86,7 @@ function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, module
|
||||
const extract = (data: AccountData[]) =>
|
||||
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen]);
|
||||
|
||||
// NOTE this is for the first case where we do have instances specified
|
||||
return isFunction(api.query.system.account)
|
||||
? api.queryMulti<[AccountInfo, ...(AccountData[])]>([[api.query.system.account, accountId], ...balances]).pipe(
|
||||
map(([{ nonce }, ...balances]): Result => [nonce, extract(balances)])
|
||||
@@ -80,16 +96,27 @@ function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, module
|
||||
);
|
||||
}
|
||||
|
||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
function querySystemAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
// AccountInfo is current, support old, eg. Edgeware
|
||||
return api.query.system.account<AccountInfo | ITuple<[Index, AccountData]>>(accountId).pipe(
|
||||
map((infoOrTuple): Result => {
|
||||
const { feeFrozen, free, miscFrozen, reserved } = (infoOrTuple as AccountInfo).nonce
|
||||
const data = (infoOrTuple as AccountInfo).nonce
|
||||
? (infoOrTuple as AccountInfo).data
|
||||
: (infoOrTuple as [Index, AccountData])[1];
|
||||
|
||||
const nonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
|
||||
|
||||
if (!data || data.isEmpty) {
|
||||
return [
|
||||
nonce,
|
||||
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
|
||||
];
|
||||
}
|
||||
|
||||
const { feeFrozen, free, miscFrozen, reserved } = data;
|
||||
|
||||
return [
|
||||
(infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0],
|
||||
nonce,
|
||||
[[free, reserved, feeFrozen, miscFrozen]]
|
||||
];
|
||||
})
|
||||
@@ -113,6 +140,10 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
|
||||
*/
|
||||
export function account (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAccount> {
|
||||
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
|
||||
const empty: Result = [
|
||||
api.registry.createType('Index'),
|
||||
[[zeroBalance(api), zeroBalance(api), zeroBalance(api), zeroBalance(api)]]
|
||||
];
|
||||
|
||||
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAccount> =>
|
||||
api.derive.accounts.accountId(address).pipe(
|
||||
@@ -122,19 +153,17 @@ export function account (instanceId: string, api: ApiInterfaceRx): (address: Acc
|
||||
of(accountId),
|
||||
balanceInstances
|
||||
? queryBalancesAccount(api, accountId, balanceInstances)
|
||||
: isFunction(api.query.system.account)
|
||||
? queryCurrent(api, accountId)
|
||||
: isFunction(api.query.balances.account)
|
||||
: isFunction(api.query.system?.account)
|
||||
? querySystemAccount(api, accountId)
|
||||
: isFunction(api.query.balances?.account)
|
||||
? queryBalancesAccount(api, accountId)
|
||||
: queryBalancesFree(api, accountId)
|
||||
])
|
||||
: of([
|
||||
api.registry.createType('AccountId'),
|
||||
[
|
||||
api.registry.createType('Index'),
|
||||
[[api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance')]]
|
||||
]
|
||||
: isFunction(api.query.balances?.freeBalance)
|
||||
? queryBalancesFree(api, accountId)
|
||||
: isFunction(api.query.system?.accountNonce)
|
||||
? querySystemNonce(api, accountId)
|
||||
: of(empty)
|
||||
])
|
||||
: of([api.registry.createType('AccountId'), empty])
|
||||
)
|
||||
),
|
||||
map((result): DeriveBalancesAccount => calcBalances(api, result))
|
||||
|
||||
@@ -7,9 +7,7 @@ import type { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLoc
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { bnMax, isFunction } from '@polkadot/util';
|
||||
import { BN, bnMax, isFunction } from '@polkadot/util';
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveContractFees } from '../types';
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option } from '@polkadot/types';
|
||||
import type { AccountId, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveDemocracyLock } from '../types';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { ReferendumIndex } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
import { of } from '@polkadot/x-rxjs';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option, Vec } from '@polkadot/types';
|
||||
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
import { bnSqrt } from '@polkadot/util';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { Vec } from '@polkadot/types';
|
||||
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, ReferendumStatus, Vote, VoteThreshold } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
export interface DeriveDemocracyLock {
|
||||
balance: Balance;
|
||||
|
||||
@@ -7,9 +7,7 @@ import type { AccountId, Balance, BlockNumber, PreimageStatus, Proposal, Referen
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { bnSqrt } from '@polkadot/util';
|
||||
import { BN, bnSqrt } from '@polkadot/util';
|
||||
|
||||
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
|
||||
type OldPreimage = ITuple<PreimageInfo>;
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-derive', version: '4.13.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-derive', version: '4.16.1' };
|
||||
|
||||
@@ -5,9 +5,7 @@ import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Balance, StakingLedger, UnlockChunk } from '@polkadot/types/interfaces';
|
||||
import type { DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { BN_ZERO } from '@polkadot/util';
|
||||
import { BN, BN_ZERO } from '@polkadot/util';
|
||||
import { combineLatest, Observable } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option, u32 } from '@polkadot/types';
|
||||
import type { ActiveEraInfo, EraIndex } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
import { BN_ONE, BN_ZERO } from '@polkadot/util';
|
||||
import { map } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
@@ -23,12 +24,12 @@ export function erasHistoric (instanceId: string, api: ApiInterfaceRx): (withAct
|
||||
const activeEra: BN = activeEraOpt.unwrapOrDefault().index;
|
||||
let lastEra = activeEra;
|
||||
|
||||
while (lastEra.gten(0) && (result.length < max)) {
|
||||
while (lastEra.gte(BN_ZERO) && (result.length < max)) {
|
||||
if ((lastEra !== activeEra) || (withActive === true)) {
|
||||
result.push(api.registry.createType('EraIndex', lastEra));
|
||||
}
|
||||
|
||||
lastEra = lastEra.subn(1);
|
||||
lastEra = lastEra.sub(BN_ONE);
|
||||
}
|
||||
|
||||
// go from oldest to newest
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { AccountId, EraIndex, StakingLedger } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveEraPoints, DeriveEraPrefs, DeriveEraRewards, DeriveEraValPrefs, DeriveStakerExposure, DeriveStakerReward, DeriveStakerRewardValidator } from '../types';
|
||||
import type { DeriveStakingQuery } from './types';
|
||||
@@ -120,8 +120,6 @@ function filterRewards (eras: EraIndex[], valInfo: [string, DeriveStakingQuery][
|
||||
return false;
|
||||
}
|
||||
|
||||
reward.isStakerPayout = true;
|
||||
|
||||
removeClaimed(validators, queryValidators, reward);
|
||||
|
||||
return true;
|
||||
@@ -164,17 +162,21 @@ export function _stakerRewards (instanceId: string, api: ApiInterfaceRx): (accou
|
||||
const [allValidators, stashValidators] = allUniqValidators(allRewards);
|
||||
|
||||
return api.derive.staking.queryMulti(allValidators, { withLedger: true }).pipe(
|
||||
map((queriedVals): DeriveStakerReward[][] => {
|
||||
return queries.map(({ stakingLedger }, index): DeriveStakerReward[] => {
|
||||
const rewards = allRewards[index];
|
||||
const ownValidators = stashValidators[index].map((validatorId): [string, DeriveStakingQuery] => [
|
||||
validatorId,
|
||||
queriedVals.find((q) => q.accountId.eq(validatorId)) as DeriveStakingQuery
|
||||
]);
|
||||
|
||||
return filterRewards(eras, ownValidators, { rewards, stakingLedger });
|
||||
});
|
||||
})
|
||||
map((queriedVals): DeriveStakerReward[][] =>
|
||||
queries.map(({ stakingLedger }, index): DeriveStakerReward[] =>
|
||||
filterRewards(
|
||||
eras,
|
||||
stashValidators[index].map((validatorId): [string, DeriveStakingQuery] => [
|
||||
validatorId,
|
||||
queriedVals.find((q) => q.accountId.eq(validatorId)) as DeriveStakingQuery
|
||||
]),
|
||||
{
|
||||
rewards: allRewards[index],
|
||||
stakingLedger
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { AccountId, Balance, EraIndex, Exposure, RewardDestination, RewardPoint, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { DeriveSessionIndexes } from '../session/types';
|
||||
|
||||
export type DeriveEraValPoints = Record<string, RewardPoint>;
|
||||
@@ -81,7 +81,6 @@ export interface DeriveStakerRewardValidator {
|
||||
export interface DeriveStakerReward {
|
||||
era: EraIndex;
|
||||
eraReward: Balance;
|
||||
isStakerPayout?: boolean;
|
||||
isEmpty: boolean;
|
||||
isValidator: boolean;
|
||||
nominating: DeriveEraExposureNominating[];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { BN } from '@polkadot/util';
|
||||
|
||||
export const FALLBACK_MAX_HASH_COUNT = 250;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { u32 } from '@polkadot/types';
|
||||
import type { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Bounty, BountyIndex, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VouchingStatus } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
export * from './accounts/types';
|
||||
export * from './council/types';
|
||||
|
||||
+12
-13
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
@@ -19,18 +19,17 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/api-derive": "4.13.1",
|
||||
"@polkadot/keyring": "^6.7.1",
|
||||
"@polkadot/metadata": "4.13.1",
|
||||
"@polkadot/rpc-core": "4.13.1",
|
||||
"@polkadot/rpc-provider": "4.13.1",
|
||||
"@polkadot/types": "4.13.1",
|
||||
"@polkadot/types-known": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"@polkadot/util-crypto": "^6.7.1",
|
||||
"@polkadot/x-rxjs": "^6.7.1",
|
||||
"bn.js": "^4.11.9",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api-derive": "4.16.1",
|
||||
"@polkadot/keyring": "^6.10.1",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"@polkadot/rpc-core": "4.16.1",
|
||||
"@polkadot/rpc-provider": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/types-known": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1",
|
||||
"eventemitter3": "^4.0.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Vec, u16, u32, u64, u8 } from '@polkadot/types';
|
||||
import type { Vec, 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';
|
||||
@@ -508,9 +508,6 @@ declare module '@polkadot/api/types/consts' {
|
||||
* Number of eras that staked funds must remain bonded for.
|
||||
**/
|
||||
bondingDuration: EraIndex & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Maximum number of nominations per nominator.
|
||||
**/
|
||||
maxNominations: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of nominators rewarded for each validator.
|
||||
@@ -526,9 +523,8 @@ declare module '@polkadot/api/types/consts' {
|
||||
/**
|
||||
* Number of eras that slashes are deferred by, after computation.
|
||||
*
|
||||
* This should be less than the bonding duration.
|
||||
* Set to 0 if slashes should be applied immediately, without opportunity for
|
||||
* intervention.
|
||||
* This should be less than the bonding duration. Set to 0 if slashes
|
||||
* should be applied immediately, without opportunity for intervention.
|
||||
**/
|
||||
slashDeferDuration: EraIndex & AugmentedConst<ApiType>;
|
||||
/**
|
||||
@@ -560,7 +556,7 @@ declare module '@polkadot/api/types/consts' {
|
||||
* that the runtime should know about the prefix in order to make use of it as
|
||||
* an identifier of the chain.
|
||||
**/
|
||||
ss58Prefix: u8 & AugmentedConst<ApiType>;
|
||||
ss58Prefix: u16 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Get the chain's current version.
|
||||
**/
|
||||
|
||||
@@ -256,9 +256,9 @@ declare module '@polkadot/api/types/errors' {
|
||||
**/
|
||||
DuplicateTopics: AugmentedError<ApiType>;
|
||||
/**
|
||||
* `seal_input` was called twice from the same contract execution context.
|
||||
* `seal_call` forwarded this contracts input. It therefore is no longer available.
|
||||
**/
|
||||
InputAlreadyRead: AugmentedError<ApiType>;
|
||||
InputForwarded: AugmentedError<ApiType>;
|
||||
/**
|
||||
* An origin TrieId written in the current block.
|
||||
**/
|
||||
@@ -316,9 +316,7 @@ declare module '@polkadot/api/types/errors' {
|
||||
**/
|
||||
RandomSubjectTooLong: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The action performed is not allowed while the contract performing it is already
|
||||
* on the call stack. Those actions are contract self destruction and restoration
|
||||
* of a tombstone.
|
||||
* A call tried to invoke a contract that is flagged as non-reentrant.
|
||||
**/
|
||||
ReentranceDenied: AugmentedError<ApiType>;
|
||||
/**
|
||||
@@ -343,6 +341,11 @@ declare module '@polkadot/api/types/errors' {
|
||||
* This can be triggered by a call to `seal_terminate` or `seal_restore_to`.
|
||||
**/
|
||||
TerminatedInConstructor: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Termination of a contract is not allowed while the contract is already
|
||||
* on the call stack. Can be triggered by `seal_terminate` or `seal_restore_to.
|
||||
**/
|
||||
TerminatedWhileReentrant: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The amount of topics passed to `seal_deposit_events` exceeds the limit.
|
||||
**/
|
||||
@@ -548,6 +551,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
[key: string]: AugmentedError<ApiType>;
|
||||
};
|
||||
electionProviderMultiPhase: {
|
||||
/**
|
||||
* The call is not allowed at this point.
|
||||
**/
|
||||
CallNotAllowed: AugmentedError<ApiType>;
|
||||
/**
|
||||
* OCW submitted solution for wrong round
|
||||
**/
|
||||
@@ -1179,6 +1186,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
* A nomination target was supplied that was blocked or otherwise not a validator.
|
||||
**/
|
||||
BadTarget: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The user has enough bond and thus cannot be chilled forcefully by an external person.
|
||||
**/
|
||||
CannotChillOther: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Duplicate index.
|
||||
**/
|
||||
@@ -1200,9 +1211,9 @@ declare module '@polkadot/api/types/errors' {
|
||||
**/
|
||||
IncorrectSlashingSpans: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Can not bond with value less than minimum balance.
|
||||
* Can not bond with value less than minimum required.
|
||||
**/
|
||||
InsufficientValue: AugmentedError<ApiType>;
|
||||
InsufficientBond: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Invalid era to reward.
|
||||
**/
|
||||
@@ -1235,10 +1246,20 @@ declare module '@polkadot/api/types/errors' {
|
||||
* Can not rebond without unlocking chunks.
|
||||
**/
|
||||
NoUnlockChunk: AugmentedError<ApiType>;
|
||||
/**
|
||||
* There are too many nominators in the system. Governance needs to adjust the staking settings
|
||||
* to keep things safe for the runtime.
|
||||
**/
|
||||
TooManyNominators: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Too many nomination targets supplied.
|
||||
**/
|
||||
TooManyTargets: AugmentedError<ApiType>;
|
||||
/**
|
||||
* There are too many validators in the system. Governance needs to adjust the staking settings
|
||||
* to keep things safe for the runtime.
|
||||
**/
|
||||
TooManyValidators: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Generic error
|
||||
**/
|
||||
|
||||
@@ -835,6 +835,10 @@ declare module '@polkadot/api/types/events' {
|
||||
* A new set of stakers was elected.
|
||||
**/
|
||||
StakingElection: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* The election failed. No new era is planned.
|
||||
**/
|
||||
StakingElectionFailed: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* An account has unbonded this amount. \[stash, amount\]
|
||||
**/
|
||||
|
||||
@@ -883,6 +883,14 @@ declare module '@polkadot/api/types/storage' {
|
||||
* canceled by extraordinary circumstances (e.g. governance).
|
||||
**/
|
||||
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* A tracker to keep count of the number of items in the `Nominators` map.
|
||||
**/
|
||||
counterForNominators: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* A tracker to keep count of the number of items in the `Validators` map.
|
||||
**/
|
||||
counterForValidators: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The current era index.
|
||||
*
|
||||
@@ -978,12 +986,34 @@ declare module '@polkadot/api/types/storage' {
|
||||
* Map from all (unlocked) "controller" accounts to the info regarding the staking.
|
||||
**/
|
||||
ledger: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<StakingLedger>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
/**
|
||||
* The maximum nominator count before we stop allowing new validators to join.
|
||||
*
|
||||
* When this value is not set, no limits are enforced.
|
||||
**/
|
||||
maxNominatorsCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The maximum validator count before we stop allowing new validators to join.
|
||||
*
|
||||
* When this value is not set, no limits are enforced.
|
||||
**/
|
||||
maxValidatorsCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Minimum number of staking participants before emergency conditions are imposed.
|
||||
**/
|
||||
minimumValidatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The minimum active bond to become and maintain the role of a nominator.
|
||||
**/
|
||||
minNominatorBond: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The minimum active bond to become and maintain the role of a validator.
|
||||
**/
|
||||
minValidatorBond: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The map from nominator stash key to the set of stash keys of all validators to nominate.
|
||||
*
|
||||
* When updating this storage item, you must also update the `CounterForNominators`.
|
||||
**/
|
||||
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Nominations>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
/**
|
||||
@@ -1026,6 +1056,8 @@ declare module '@polkadot/api/types/storage' {
|
||||
validatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The map from (wannabe) validator stash key to the preferences of that validator.
|
||||
*
|
||||
* When updating this storage item, you must also update the `CounterForValidators`.
|
||||
**/
|
||||
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
/**
|
||||
|
||||
@@ -106,6 +106,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
||||
* Returns the keys with prefix from a child storage, leave empty to get all the keys
|
||||
**/
|
||||
getKeys: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;
|
||||
/**
|
||||
* Returns the keys with prefix from a child storage with pagination support
|
||||
**/
|
||||
getKeysPaged: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, count: u32 | AnyNumber | Uint8Array, startKey?: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;
|
||||
/**
|
||||
* Returns a child storage entry at a specific block state
|
||||
**/
|
||||
|
||||
@@ -19,7 +19,7 @@ import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber,
|
||||
import type { Period, Priority } from '@polkadot/types/interfaces/scheduler';
|
||||
import type { Keys } from '@polkadot/types/interfaces/session';
|
||||
import type { SocietyJudgement } from '@polkadot/types/interfaces/society';
|
||||
import type { ElectionScore, EraIndex, RawSolution, RewardDestination, SolutionOrSnapshotSize, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
||||
import type { ElectionScore, EraIndex, RawSolution, ReadySolution, RewardDestination, SolutionOrSnapshotSize, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
||||
import type { Key } from '@polkadot/types/interfaces/system';
|
||||
import type { BountyIndex } from '@polkadot/types/interfaces/treasury';
|
||||
import type { ClassId, DestroyWitness, InstanceId } from '@polkadot/types/interfaces/uniques';
|
||||
@@ -134,6 +134,10 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Emits `Destroyed` event when successful.
|
||||
*
|
||||
* NOTE: It can be helpful to first freeze an asset before destroying it so that you
|
||||
* can provide accurate witness information and prevent users from manipulating state
|
||||
* in a way that can make it harder to destroy.
|
||||
*
|
||||
* Weight: `O(c + p + a)` where:
|
||||
* - `c = (witness.accounts - witness.sufficients)`
|
||||
* - `s = witness.sufficients`
|
||||
@@ -538,6 +542,27 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* # </weight>
|
||||
**/
|
||||
transfer: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
/**
|
||||
* Transfer the entire transferable balance from the caller account.
|
||||
*
|
||||
* NOTE: This function only attempts to transfer _transferable_ balances. This means that
|
||||
* any locked, reserved, or existential deposits (when `keep_alive` is `true`), will not be
|
||||
* transferred by this function. To ensure that this function results in a killed account,
|
||||
* you might need to prepare the account by removing any reference counters, storage
|
||||
* deposits, etc...
|
||||
*
|
||||
* The dispatch origin of this call must be Signed.
|
||||
*
|
||||
* - `dest`: The recipient of the transfer.
|
||||
* - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all
|
||||
* of the funds the account has, causing the sender account to be killed (false), or
|
||||
* transfer everything except at least the existential deposit, which will guarantee to
|
||||
* keep the sender account alive (true).
|
||||
* # <weight>
|
||||
* - O(1). Just like transfer, but reading the user's transferable balance first.
|
||||
* #</weight>
|
||||
**/
|
||||
transferAll: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, keepAlive: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
/**
|
||||
* Same as the [`transfer`] call, but with a check that the transfer will not kill the
|
||||
* origin account.
|
||||
@@ -1221,6 +1246,17 @@ declare module '@polkadot/api/types/submittable' {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
};
|
||||
electionProviderMultiPhase: {
|
||||
/**
|
||||
* Set a solution in the queue, to be handed out to the client of this pallet in the next
|
||||
* call to `ElectionProvider::elect`.
|
||||
*
|
||||
* This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`.
|
||||
*
|
||||
* The solution is not checked for any feasibility and is assumed to be trustworthy, as any
|
||||
* feasibility check itself can in principle cause the election process to fail (due to
|
||||
* memory/weight constrains).
|
||||
**/
|
||||
setEmergencyElectionResult: AugmentedSubmittable<(solution: ReadySolution | { supports?: any; score?: any; compute?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [ReadySolution]>;
|
||||
/**
|
||||
* Set a new value for `MinimumUntrustedScore`.
|
||||
*
|
||||
@@ -2525,7 +2561,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.
|
||||
* - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`
|
||||
* - DbWrites: `NextKeys`, `origin account`
|
||||
* - DbWrites per key id: `KeyOwnder`
|
||||
* - DbWrites per key id: `KeyOwner`
|
||||
* # </weight>
|
||||
**/
|
||||
purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
@@ -2960,12 +2996,34 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* # </weight>
|
||||
**/
|
||||
chill: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
/**
|
||||
* Declare a `controller` as having no desire to either validator or nominate.
|
||||
*
|
||||
* Effects will be felt at the beginning of the next era.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_, but can be called by anyone.
|
||||
*
|
||||
* If the caller is the same as the controller being targeted, then no further checks
|
||||
* are enforced. However, this call can also be made by an third party user who witnesses
|
||||
* that this controller does not satisfy the minimum bond requirements to be in their role.
|
||||
*
|
||||
* 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]>;
|
||||
/**
|
||||
* Force there to be a new era at the end of the next session. After this, it will be
|
||||
* reset to normal (non-forced) behaviour.
|
||||
*
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # Warning
|
||||
*
|
||||
* The election process starts multiple blocks before the end of the era.
|
||||
* If this is called just before a new era is triggered, the election process may not
|
||||
* have enough blocks to get a result.
|
||||
*
|
||||
* # <weight>
|
||||
* - No arguments.
|
||||
* - Weight: O(1)
|
||||
@@ -2978,6 +3036,12 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # Warning
|
||||
*
|
||||
* The election process starts multiple blocks before the end of the era.
|
||||
* If this is called just before a new era is triggered, the election process may not
|
||||
* have enough blocks to get a result.
|
||||
*
|
||||
* # <weight>
|
||||
* - Weight: O(1)
|
||||
* - Write: ForceEra
|
||||
@@ -2989,6 +3053,12 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # Warning
|
||||
*
|
||||
* The election process starts multiple blocks before the end of the era.
|
||||
* Thus the election process may be ongoing when this is called. In this case the
|
||||
* election will continue until the next era is triggered.
|
||||
*
|
||||
* # <weight>
|
||||
* - No arguments.
|
||||
* - Weight: O(1)
|
||||
@@ -3229,6 +3299,9 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need
|
||||
* to be called first to remove some of the chunks (if possible).
|
||||
*
|
||||
* If a user encounters the `InsufficientBond` error when calling this extrinsic,
|
||||
* they should call `chill` first in order to free up their bonded funds.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_ by the controller, not the stash.
|
||||
* And, it can be only called when [`EraElectionStatus`] is `Closed`.
|
||||
*
|
||||
@@ -3252,6 +3325,22 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* </weight>
|
||||
**/
|
||||
unbond: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>]>;
|
||||
/**
|
||||
* Update the various staking limits this pallet.
|
||||
*
|
||||
* * `min_nominator_bond`: The minimum active bond needed to be a nominator.
|
||||
* * `min_validator_bond`: The minimum active bond needed to be a validator.
|
||||
* * `max_nominator_count`: The max number of users who can be a nominator at once.
|
||||
* When set to `None`, no limit is enforced.
|
||||
* * `max_validator_count`: The max number of users who can be a validator at once.
|
||||
* When set to `None`, no limit is enforced.
|
||||
*
|
||||
* Origin must be Root to call this function.
|
||||
*
|
||||
* NOTE: Existing nominators and validators will not be affected by this update.
|
||||
* to kick people under the new limits, `chill_other` should be called.
|
||||
**/
|
||||
updateStakingLimits: AugmentedSubmittable<(minNominatorBond: BalanceOf | AnyNumber | Uint8Array, minValidatorBond: BalanceOf | AnyNumber | Uint8Array, maxNominatorCount: Option<u32> | null | object | string | Uint8Array, maxValidatorCount: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [BalanceOf, BalanceOf, Option<u32>, Option<u32>]>;
|
||||
/**
|
||||
* Declare the desire to validate for the origin controller.
|
||||
*
|
||||
@@ -4052,7 +4141,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - `m = witness.instance_metdadatas`
|
||||
* - `a = witness.attributes`
|
||||
**/
|
||||
destroy: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, witness: DestroyWitness | { instances?: any; instanceMetadatas?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, DestroyWitness]>;
|
||||
destroy: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, witness: DestroyWitness | { instances?: any; instanceMetadatas?: any; attributes?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, DestroyWitness]>;
|
||||
/**
|
||||
* Alter the attributes of a given asset.
|
||||
*
|
||||
|
||||
@@ -10,8 +10,6 @@ import type { AnyFunction, AnyTuple, CallFunction, Codec, CodecArg as Arg, Defin
|
||||
import type { SubmittableExtrinsic } from '../submittable/types';
|
||||
import type { ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecoratedRpcSection, DecorateMethod, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { decorateDerive, ExactDerive } from '@polkadot/api-derive';
|
||||
import { memo } from '@polkadot/api-derive/util';
|
||||
import { expandMetadata, Metadata } from '@polkadot/metadata';
|
||||
@@ -20,7 +18,7 @@ import { WsProvider } from '@polkadot/rpc-provider';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/extrinsic/constants';
|
||||
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
import { arrayChunk, arrayFlatten, assert, compactStripLength, logger, u8aToHex } from '@polkadot/util';
|
||||
import { arrayChunk, arrayFlatten, assert, BN, compactStripLength, logger, u8aToHex } from '@polkadot/util';
|
||||
import { BehaviorSubject, combineLatest, Observable, of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap, tap, toArray } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
@@ -39,8 +37,8 @@ interface MetaDecoration {
|
||||
}
|
||||
|
||||
// the max amount of keys/values that we will retrieve at once
|
||||
const PAGE_SIZE_K = 768; // limited since the trie lookups are heavy
|
||||
const PAGE_SIZE_V = 256; // limited since the data may be very large
|
||||
const PAGE_SIZE_K = 1000; // limit aligned with the 1k on the node (trie lookups are heavy)
|
||||
const PAGE_SIZE_V = 250; // limited since the data may be very large (e.g. misfiring elections)
|
||||
|
||||
const l = logger('api/init');
|
||||
|
||||
|
||||
@@ -82,13 +82,6 @@ export abstract class Getters<ApiType extends ApiTypes> extends Init<ApiType> {
|
||||
return assertResult(this._genesisHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` when subscriptions are supported
|
||||
*/
|
||||
public get hasSubscriptions (): boolean {
|
||||
return this._rpcCore.provider.hasSubscriptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description true is the underlying provider is connected
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { RpcInterfaceMethod } from '@polkadot/rpc-core/types';
|
||||
import type { Text } from '@polkadot/types';
|
||||
import type { ChainProperties, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Observable, Subscription } from '@polkadot/x-rxjs';
|
||||
import type { ApiBase, ApiOptions, ApiTypes, DecorateMethod } from '../types';
|
||||
import type { VersionedRegistry } from './types';
|
||||
@@ -286,7 +286,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
}
|
||||
|
||||
// get unique types & validate
|
||||
metadata.getUniqTypes(false);
|
||||
metadata.getUniqTypes(this._options.throwOnUnknown || false);
|
||||
|
||||
return [genesisHash, metadata];
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { Metadata } from '@polkadot/metadata';
|
||||
import type { Constants } from '@polkadot/metadata/decorate/types';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
export interface VersionedRegistry {
|
||||
isDefault: boolean;
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api', version: '4.13.1' };
|
||||
export const packageInfo = { name: '@polkadot/api', version: '4.16.1' };
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
import type { SubmittableExtrinsic } from '../types';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { createPair } from '@polkadot/keyring/pair';
|
||||
import { createTestKeyring } from '@polkadot/keyring/testing';
|
||||
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
||||
@@ -91,7 +93,7 @@ describe('ApiPromise', (): void => {
|
||||
super({ provider });
|
||||
}
|
||||
|
||||
protected _loadMeta (): Promise<boolean> {
|
||||
protected override _loadMeta (): Promise<boolean> {
|
||||
throw new Error('Simulate failure to load meta');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
* @description Sign a transaction, returning the this to allow chaining, i.e. .sign(...).send(). When options, e.g. nonce/blockHash are not specified, it will be inferred. To retrieve eg. nonce use `signAsync` (the preferred interface, this is provided for backwards compatibility)
|
||||
* @deprecated
|
||||
*/
|
||||
public sign (account: IKeyringPair, optionsOrNonce?: Partial<SignerOptions>): this {
|
||||
public override sign (account: IKeyringPair, optionsOrNonce?: Partial<SignerOptions>): this {
|
||||
super.sign(account, this.#makeSignOptions(this.#optionsOrNonce(optionsOrNonce), {}));
|
||||
|
||||
return this;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
// Augment the modules
|
||||
import '@polkadot/api/augment';
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { DeriveCustom, ExactDerive } from '@polkadot/api-derive';
|
||||
import type { Metadata } from '@polkadot/metadata';
|
||||
import type { RpcInterface } from '@polkadot/rpc-core/types';
|
||||
@@ -12,6 +11,7 @@ import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-
|
||||
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
||||
import type { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
|
||||
import type { DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, SignatureOptions, Signer } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { ApiBase } from '../base';
|
||||
import type { DeriveAllSections } from '../util/decorate';
|
||||
import type { QueryableConsts } from './consts';
|
||||
@@ -73,6 +73,10 @@ export interface ApiOptions extends RegisteredTypes {
|
||||
* @description Throws an error when the initial connection fails (same as isReadyOrError)
|
||||
*/
|
||||
throwOnConnect?: boolean;
|
||||
/**
|
||||
* @description Throws an error when some types are unknown (useful with throwOnConnect)
|
||||
*/
|
||||
throwOnUnknown?: boolean;
|
||||
}
|
||||
|
||||
// A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { ApiPromise, WsProvider } from '@polkadot/api';
|
||||
|
||||
describe('misc online tests', (): void => {
|
||||
|
||||
@@ -7,6 +7,8 @@ import type { Option } from '@polkadot/types/codec';
|
||||
import type { AccountId, AccountIndex, AccountInfo, Address, Balance, BlockNumber, Index } from '@polkadot/types/interfaces';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { ApiPromise, WsProvider } from '@polkadot/api';
|
||||
import { memo } from '@polkadot/api-derive/util/memo';
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/metadata",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Helpers to extract information from runtime metadata",
|
||||
"main": "index.js",
|
||||
@@ -19,14 +19,13 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/types": "4.13.1",
|
||||
"@polkadot/types-known": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"@polkadot/util-crypto": "^6.7.1",
|
||||
"bn.js": "^4.11.9"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/types-known": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.7.1"
|
||||
"@polkadot/keyring": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ export class MetadataVersioned extends Struct {
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): Record<string, AnyJson> {
|
||||
public override toJSON (): Record<string, AnyJson> {
|
||||
// HACK(y): ensure that we apply the aliases if we have not done so already, this is
|
||||
// needed to ensure we have the correct overrides (which is only applied in toLatest)
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/metadata authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { createTestPairs } from '@polkadot/keyring/testingPairs';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { BN } from '@polkadot/util';
|
||||
|
||||
import { Metadata } from '../../Metadata';
|
||||
import metadataStatic from '../../static';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/metadata authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { StorageEntryMetadataLatest, StorageHasher } from '@polkadot/types/interfaces/metadata';
|
||||
import type { StorageEntry } from '@polkadot/types/primitive/types';
|
||||
import type { Codec, Registry } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
import { Raw } from '@polkadot/types/codec';
|
||||
import { StorageKey, Type } from '@polkadot/types/primitive';
|
||||
@@ -89,7 +89,7 @@ function extendHeadMeta (registry: Registry, { meta: { documentation, name, type
|
||||
// meta fallback only applies to actual entry values, create one for head
|
||||
(iterFn as IterFn).meta = registry.createType('StorageEntryMetadataLatest', {
|
||||
documentation,
|
||||
fallback: registry.createType('Bytes', registry.createType(outputType.toString() as 'Raw').toHex()),
|
||||
fallback: registry.createType('Bytes'),
|
||||
modifier: registry.createType('StorageEntryModifierLatest', 1), // required
|
||||
name,
|
||||
type: registry.createType('StorageEntryTypeLatest', registry.createType('Type', outputType), 0)
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/metadata', version: '4.13.1' };
|
||||
export const packageInfo = { name: '@polkadot/metadata', version: '4.16.1' };
|
||||
|
||||
@@ -506,8 +506,8 @@
|
||||
},
|
||||
{
|
||||
"name": "SS58Prefix",
|
||||
"type": "u8",
|
||||
"value": "0x2a",
|
||||
"type": "u16",
|
||||
"value": "0x2a00",
|
||||
"documentation": [
|
||||
" The designated SS85 prefix of this chain.",
|
||||
"",
|
||||
@@ -1638,6 +1638,39 @@
|
||||
" - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already)",
|
||||
" #</weight>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "transfer_all",
|
||||
"args": [
|
||||
{
|
||||
"name": "dest",
|
||||
"type": "LookupSource"
|
||||
},
|
||||
{
|
||||
"name": "keep_alive",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Transfer the entire transferable balance from the caller account.",
|
||||
"",
|
||||
" NOTE: This function only attempts to transfer _transferable_ balances. This means that",
|
||||
" any locked, reserved, or existential deposits (when `keep_alive` is `true`), will not be",
|
||||
" transferred by this function. To ensure that this function results in a killed account,",
|
||||
" you might need to prepare the account by removing any reference counters, storage",
|
||||
" deposits, etc...",
|
||||
"",
|
||||
" The dispatch origin of this call must be Signed.",
|
||||
"",
|
||||
" - `dest`: The recipient of the transfer.",
|
||||
" - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all",
|
||||
" of the funds the account has, causing the sender account to be killed (false), or",
|
||||
" transfer everything except at least the existential deposit, which will guarantee to",
|
||||
" keep the sender account alive (true).",
|
||||
" # <weight>",
|
||||
" - O(1). Just like transfer, but reading the user's transferable balance first.",
|
||||
" #</weight>"
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
@@ -1982,6 +2015,25 @@
|
||||
"",
|
||||
" This check can be turned off by setting the value to `None`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "set_emergency_election_result",
|
||||
"args": [
|
||||
{
|
||||
"name": "solution",
|
||||
"type": "ReadySolution"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Set a solution in the queue, to be handed out to the client of this pallet in the next",
|
||||
" call to `ElectionProvider::elect`.",
|
||||
"",
|
||||
" This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`.",
|
||||
"",
|
||||
" The solution is not checked for any feasibility and is assumed to be trustworthy, as any",
|
||||
" feasibility check itself can in principle cause the election process to fail (due to",
|
||||
" memory/weight constrains)."
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
@@ -2106,6 +2158,12 @@
|
||||
"documentation": [
|
||||
" OCW submitted solution for wrong round"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CallNotAllowed",
|
||||
"documentation": [
|
||||
" The call is not allowed at this point."
|
||||
]
|
||||
}
|
||||
],
|
||||
"index": 8
|
||||
@@ -2183,6 +2241,28 @@
|
||||
" Map from all locked \"stash\" accounts to the controller account."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MinNominatorBond",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"plain": "BalanceOf"
|
||||
},
|
||||
"fallback": "0x00000000000000000000000000000000",
|
||||
"documentation": [
|
||||
" The minimum active bond to become and maintain the role of a nominator."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MinValidatorBond",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"plain": "BalanceOf"
|
||||
},
|
||||
"fallback": "0x00000000000000000000000000000000",
|
||||
"documentation": [
|
||||
" The minimum active bond to become and maintain the role of a validator."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Ledger",
|
||||
"modifier": "Optional",
|
||||
@@ -2228,7 +2308,33 @@
|
||||
},
|
||||
"fallback": "0x0000",
|
||||
"documentation": [
|
||||
" The map from (wannabe) validator stash key to the preferences of that validator."
|
||||
" The map from (wannabe) validator stash key to the preferences of that validator.",
|
||||
"",
|
||||
" When updating this storage item, you must also update the `CounterForValidators`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CounterForValidators",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"plain": "u32"
|
||||
},
|
||||
"fallback": "0x00000000",
|
||||
"documentation": [
|
||||
" A tracker to keep count of the number of items in the `Validators` map."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxValidatorsCount",
|
||||
"modifier": "Optional",
|
||||
"type": {
|
||||
"plain": "u32"
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" The maximum validator count before we stop allowing new validators to join.",
|
||||
"",
|
||||
" When this value is not set, no limits are enforced."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -2244,7 +2350,33 @@
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" The map from nominator stash key to the set of stash keys of all validators to nominate."
|
||||
" The map from nominator stash key to the set of stash keys of all validators to nominate.",
|
||||
"",
|
||||
" When updating this storage item, you must also update the `CounterForNominators`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CounterForNominators",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"plain": "u32"
|
||||
},
|
||||
"fallback": "0x00000000",
|
||||
"documentation": [
|
||||
" A tracker to keep count of the number of items in the `Nominators` map."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxNominatorsCount",
|
||||
"modifier": "Optional",
|
||||
"type": {
|
||||
"plain": "u32"
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" The maximum nominator count before we stop allowing new validators to join.",
|
||||
"",
|
||||
" When this value is not set, no limits are enforced."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -2580,7 +2712,7 @@
|
||||
"type": {
|
||||
"plain": "Releases"
|
||||
},
|
||||
"fallback": "0x05",
|
||||
"fallback": "0x06",
|
||||
"documentation": [
|
||||
" True if network has been upgraded to this version.",
|
||||
" Storage version of the pallet.",
|
||||
@@ -2684,6 +2816,9 @@
|
||||
" can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need",
|
||||
" to be called first to remove some of the chunks (if possible).",
|
||||
"",
|
||||
" If a user encounters the `InsufficientBond` error when calling this extrinsic,",
|
||||
" they should call `chill` first in order to free up their bonded funds.",
|
||||
"",
|
||||
" The dispatch origin for this call must be _Signed_ by the controller, not the stash.",
|
||||
" And, it can be only called when [`EraElectionStatus`] is `Closed`.",
|
||||
"",
|
||||
@@ -2947,6 +3082,12 @@
|
||||
"",
|
||||
" The dispatch origin must be Root.",
|
||||
"",
|
||||
" # Warning",
|
||||
"",
|
||||
" The election process starts multiple blocks before the end of the era.",
|
||||
" Thus the election process may be ongoing when this is called. In this case the",
|
||||
" election will continue until the next era is triggered.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" - No arguments.",
|
||||
" - Weight: O(1)",
|
||||
@@ -2963,6 +3104,12 @@
|
||||
"",
|
||||
" The dispatch origin must be Root.",
|
||||
"",
|
||||
" # Warning",
|
||||
"",
|
||||
" The election process starts multiple blocks before the end of the era.",
|
||||
" If this is called just before a new era is triggered, the election process may not",
|
||||
" have enough blocks to get a result.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" - No arguments.",
|
||||
" - Weight: O(1)",
|
||||
@@ -3022,6 +3169,12 @@
|
||||
"",
|
||||
" The dispatch origin must be Root.",
|
||||
"",
|
||||
" # Warning",
|
||||
"",
|
||||
" The election process starts multiple blocks before the end of the era.",
|
||||
" If this is called just before a new era is triggered, the election process may not",
|
||||
" have enough blocks to get a result.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" - Weight: O(1)",
|
||||
" - Write: ForceEra",
|
||||
@@ -3213,6 +3366,66 @@
|
||||
" Note: Making this call only makes sense if you first set the validator preferences to",
|
||||
" block any further nominations."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "update_staking_limits",
|
||||
"args": [
|
||||
{
|
||||
"name": "min_nominator_bond",
|
||||
"type": "BalanceOf"
|
||||
},
|
||||
{
|
||||
"name": "min_validator_bond",
|
||||
"type": "BalanceOf"
|
||||
},
|
||||
{
|
||||
"name": "max_nominator_count",
|
||||
"type": "Option<u32>"
|
||||
},
|
||||
{
|
||||
"name": "max_validator_count",
|
||||
"type": "Option<u32>"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Update the various staking limits this pallet.",
|
||||
"",
|
||||
" * `min_nominator_bond`: The minimum active bond needed to be a nominator.",
|
||||
" * `min_validator_bond`: The minimum active bond needed to be a validator.",
|
||||
" * `max_nominator_count`: The max number of users who can be a nominator at once.",
|
||||
" When set to `None`, no limit is enforced.",
|
||||
" * `max_validator_count`: The max number of users who can be a validator at once.",
|
||||
" When set to `None`, no limit is enforced.",
|
||||
"",
|
||||
" Origin must be Root to call this function.",
|
||||
"",
|
||||
" NOTE: Existing nominators and validators will not be affected by this update.",
|
||||
" to kick people under the new limits, `chill_other` should be called."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chill_other",
|
||||
"args": [
|
||||
{
|
||||
"name": "controller",
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Declare a `controller` as having no desire to either validator or nominate.",
|
||||
"",
|
||||
" Effects will be felt at the beginning of the next era.",
|
||||
"",
|
||||
" The dispatch origin for this call must be _Signed_, but can be called by anyone.",
|
||||
"",
|
||||
" If the caller is the same as the controller being targeted, then no further checks",
|
||||
" are enforced. However, this call can also be made by an third party user who witnesses",
|
||||
" that this controller does not satisfy the minimum bond requirements to be in their role.",
|
||||
"",
|
||||
" This can be helpful if bond requirements are updated, and we need to remove old users",
|
||||
" who do not satisfy these requirements.",
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
@@ -3310,6 +3523,13 @@
|
||||
"documentation": [
|
||||
" A nominator has been kicked from a validator. \\[nominator, stash\\]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "StakingElectionFailed",
|
||||
"args": [],
|
||||
"documentation": [
|
||||
" The election failed. No new era is planned."
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
@@ -3336,9 +3556,8 @@
|
||||
"documentation": [
|
||||
" Number of eras that slashes are deferred by, after computation.",
|
||||
"",
|
||||
" This should be less than the bonding duration.",
|
||||
" Set to 0 if slashes should be applied immediately, without opportunity for",
|
||||
" intervention."
|
||||
" This should be less than the bonding duration. Set to 0 if slashes",
|
||||
" should be applied immediately, without opportunity for intervention."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3356,9 +3575,7 @@
|
||||
"name": "MaxNominations",
|
||||
"type": "u32",
|
||||
"value": "0x10000000",
|
||||
"documentation": [
|
||||
" Maximum number of nominations per nominator."
|
||||
]
|
||||
"documentation": []
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
@@ -3405,9 +3622,9 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "InsufficientValue",
|
||||
"name": "InsufficientBond",
|
||||
"documentation": [
|
||||
" Can not bond with value less than minimum balance."
|
||||
" Can not bond with value less than minimum required."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3481,6 +3698,26 @@
|
||||
"documentation": [
|
||||
" A nomination target was supplied that was blocked or otherwise not a validator."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CannotChillOther",
|
||||
"documentation": [
|
||||
" The user has enough bond and thus cannot be chilled forcefully by an external person."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TooManyNominators",
|
||||
"documentation": [
|
||||
" There are too many nominators in the system. Governance needs to adjust the staking settings",
|
||||
" to keep things safe for the runtime."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TooManyValidators",
|
||||
"documentation": [
|
||||
" There are too many validators in the system. Governance needs to adjust the staking settings",
|
||||
" to keep things safe for the runtime."
|
||||
]
|
||||
}
|
||||
],
|
||||
"index": 9
|
||||
@@ -3627,7 +3864,7 @@
|
||||
" Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.",
|
||||
" - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`",
|
||||
" - DbWrites: `NextKeys`, `origin account`",
|
||||
" - DbWrites per key id: `KeyOwnder`",
|
||||
" - DbWrites per key id: `KeyOwner`",
|
||||
" # </weight>"
|
||||
]
|
||||
}
|
||||
@@ -7561,17 +7798,16 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ReentranceDenied",
|
||||
"name": "TerminatedWhileReentrant",
|
||||
"documentation": [
|
||||
" The action performed is not allowed while the contract performing it is already",
|
||||
" on the call stack. Those actions are contract self destruction and restoration",
|
||||
" of a tombstone."
|
||||
" Termination of a contract is not allowed while the contract is already",
|
||||
" on the call stack. Can be triggered by `seal_terminate` or `seal_restore_to."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "InputAlreadyRead",
|
||||
"name": "InputForwarded",
|
||||
"documentation": [
|
||||
" `seal_input` was called twice from the same contract execution context."
|
||||
" `seal_call` forwarded this contracts input. It therefore is no longer available."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -7647,6 +7883,12 @@
|
||||
"documentation": [
|
||||
" The debug message specified to `seal_debug_message` does contain invalid UTF-8."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ReentranceDenied",
|
||||
"documentation": [
|
||||
" A call tried to invoke a contract that is flagged as non-reentrant."
|
||||
]
|
||||
}
|
||||
],
|
||||
"index": 18
|
||||
@@ -7951,7 +8193,7 @@
|
||||
{
|
||||
"name": "AuthorityDiscovery",
|
||||
"storage": null,
|
||||
"calls": [],
|
||||
"calls": null,
|
||||
"events": null,
|
||||
"constants": [],
|
||||
"errors": [],
|
||||
@@ -8018,7 +8260,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"calls": [],
|
||||
"calls": null,
|
||||
"events": [
|
||||
{
|
||||
"name": "Offence",
|
||||
@@ -8066,7 +8308,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"calls": [],
|
||||
"calls": null,
|
||||
"events": null,
|
||||
"constants": [],
|
||||
"errors": [],
|
||||
@@ -12825,6 +13067,10 @@
|
||||
"",
|
||||
" Emits `Destroyed` event when successful.",
|
||||
"",
|
||||
" NOTE: It can be helpful to first freeze an asset before destroying it so that you",
|
||||
" can provide accurate witness information and prevent users from manipulating state",
|
||||
" in a way that can make it harder to destroy.",
|
||||
"",
|
||||
" Weight: `O(c + p + a)` where:",
|
||||
" - `c = (witness.accounts - witness.sufficients)`",
|
||||
" - `s = witness.sufficients`",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -8,12 +8,22 @@ import { Type } from '@polkadot/types/primitive';
|
||||
import { getModuleTypes } from '@polkadot/types-known';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
// FIXME: Need some sort of solution for specifying these
|
||||
// Since we don't have insight into the origin specification, we can only define what we know about
|
||||
// in a pure Substrate/Polkadot implementation, any other custom origins won't be handled at all
|
||||
const KNOWN_ORIGINS: Record<string, string> = {
|
||||
/* eslint-disable sort-keys */
|
||||
// Substrate
|
||||
Council: 'CollectiveOrigin',
|
||||
System: 'SystemOrigin',
|
||||
TechnicalCommittee: 'CollectiveOrigin'
|
||||
TechnicalCommittee: 'CollectiveOrigin',
|
||||
// Polkadot
|
||||
Xcm: 'XcmOrigin',
|
||||
XcmPallet: 'XcmOrigin',
|
||||
// Acala
|
||||
Authority: 'AuthorityOrigin',
|
||||
GeneralCouncil: 'CollectiveOrigin'
|
||||
/* eslint-enable sort-keys */
|
||||
};
|
||||
|
||||
const BOXES = [['<', '>'], ['<', ','], [',', '>'], ['(', ')'], ['(', ','], [',', ','], [',', ')']];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-core",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
@@ -19,14 +19,14 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/metadata": "4.13.1",
|
||||
"@polkadot/rpc-provider": "4.13.1",
|
||||
"@polkadot/types": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"@polkadot/x-rxjs": "^6.7.1"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"@polkadot/rpc-provider": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.7.1"
|
||||
"@polkadot/keyring": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.13.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.16.1' };
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { of, timer } from '@polkadot/x-rxjs';
|
||||
|
||||
import { drr } from '.';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
@@ -19,19 +19,18 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/types": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"@polkadot/util-crypto": "^6.7.1",
|
||||
"@polkadot/x-fetch": "^6.7.1",
|
||||
"@polkadot/x-global": "^6.7.1",
|
||||
"@polkadot/x-ws": "^6.7.1",
|
||||
"bn.js": "^4.11.9",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1",
|
||||
"@polkadot/x-fetch": "^6.10.1",
|
||||
"@polkadot/x-global": "^6.10.1",
|
||||
"@polkadot/x-ws": "^6.10.1",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.7.1",
|
||||
"@polkadot/metadata": "4.13.1",
|
||||
"@polkadot/keyring": "^6.10.1",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^13.1.0"
|
||||
}
|
||||
|
||||
@@ -14,18 +14,18 @@ const ERROR_SUBSCRIBE = 'HTTP Provider does not have subscriptions, use WebSocke
|
||||
const l = logger('api-http');
|
||||
|
||||
/**
|
||||
* # @polkadot/rpc-provider/https
|
||||
* # @polkadot/rpc-provider
|
||||
*
|
||||
* @name HttpProvider
|
||||
*
|
||||
* @description The HTTP Provider allows sending requests using HTTP to a HTTP RPC server TCP port. It does not support subscriptions so you won't be able to listen to events such as new blocks or balance changes. It is usually preferrable using the [[WsProvider]].
|
||||
* @description The HTTP Provider allows sending requests using HTTP to a HTTP RPC server TCP port. It does not support subscriptions so you won't be able to listen to events such as new blocks or balance changes. It is usually preferable using the [[WsProvider]].
|
||||
*
|
||||
* @example
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* import Api from '@polkadot/api/promise';
|
||||
* import HttpProvider from '@polkadot/rpc-provider/http';
|
||||
* import { HttpProvider } from '@polkadot/rpc-provider';
|
||||
*
|
||||
* const provider = new HttpProvider('http://127.0.0.1:9933');
|
||||
* const api = new Api(provider);
|
||||
|
||||
@@ -8,7 +8,6 @@ import type { Codec, Registry } from '@polkadot/types/types';
|
||||
import type { ProviderInterface, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '../types';
|
||||
import type { MockStateDb, MockStateSubscriptionCallback, MockStateSubscriptions } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import EventEmitter from 'eventemitter3';
|
||||
|
||||
import { createTestKeyring } from '@polkadot/keyring/testing';
|
||||
@@ -17,7 +16,7 @@ import rpcMetadata from '@polkadot/metadata/static';
|
||||
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 { assert, bnToU8a, logger, u8aToHex } from '@polkadot/util';
|
||||
import { assert, BN, bnToU8a, logger, u8aToHex } from '@polkadot/util';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
const INTERVAL = 1000;
|
||||
@@ -57,7 +56,7 @@ export class MockProvider implements ProviderInterface {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-unsafe-member-access
|
||||
chain_getBlock: () => this.registry.createType('SignedBlock', rpcSignedBlock.result).toJSON(),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
chain_getBlockHash: () => '0x1234',
|
||||
chain_getBlockHash: () => '0x1234000000000000000000000000000000000000000000000000000000000000',
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
chain_getFinalizedHead: () => this.registry.createType('Header', rpcHeader.result).hash,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.13.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.16.1' };
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
import type { Mock } from './../mock/types';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { mockWs } from '../../test/mockWs';
|
||||
import { WsProvider } from './';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/typegen",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Type generation scripts",
|
||||
"main": "index.js",
|
||||
@@ -26,14 +26,14 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/register": "^7.13.16",
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/api": "4.13.1",
|
||||
"@polkadot/metadata": "4.13.1",
|
||||
"@polkadot/rpc-provider": "4.13.1",
|
||||
"@polkadot/types": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/register": "^7.14.5",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api": "4.16.1",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"@polkadot/rpc-provider": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"handlebars": "^4.7.7",
|
||||
"websocket": "^1.0.34",
|
||||
"yargs": "^17.0.1"
|
||||
|
||||
@@ -54,7 +54,7 @@ function documentationVecToMarkdown (docLines: Vec<Text>, indent = 0): string {
|
||||
? `${md}\n\n` // empty line
|
||||
: /^[*-]/.test(docLine.trimStart()) && !md.endsWith('\n\n')
|
||||
? `${md}\n\n${docLine}` // line calling for a preceding linebreak
|
||||
: `${md}${docLine.replace(/^#{1,3} /, '#### ')} `
|
||||
: `${md} ${docLine.replace(/^#{1,3} /, '#### ')} `
|
||||
, '')
|
||||
.replace(/#### <weight>/g, '<weight>')
|
||||
.replace(/<weight>(.|\n)*?<\/weight>/g, '')
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/typegen', version: '4.13.1' };
|
||||
export const packageInfo = { name: '@polkadot/typegen', version: '4.16.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types-known",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
@@ -19,13 +19,9 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/networks": "^6.7.1",
|
||||
"@polkadot/types": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bn.js": "^4.11.6"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/networks": "^6.10.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
import './detectPackage';
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { Text } from '@polkadot/types';
|
||||
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
||||
import type { Hash } from '@polkadot/types/interfaces';
|
||||
import type { ChainUpgradeVersion, CodecHasher, DefinitionRpc, DefinitionRpcSub, OverrideModuleType, OverrideVersionedType, Registry, RegistryTypes } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
import { bnToBn, isUndefined } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ const typesModules: Record<string, OverrideModuleType> = {
|
||||
balances: {
|
||||
Status: 'BalanceStatus'
|
||||
},
|
||||
beefy: {
|
||||
AuthorityId: 'BeefyId'
|
||||
},
|
||||
contracts: {
|
||||
StorageKey: 'ContractStorageKey'
|
||||
},
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/types-known', version: '4.13.1' };
|
||||
export const packageInfo = { name: '@polkadot/types-known', version: '4.16.1' };
|
||||
|
||||
@@ -42,6 +42,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchError: 'DispatchErrorTo198',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -60,6 +61,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -79,6 +81,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -97,6 +100,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -112,6 +116,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -126,6 +131,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259'
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
import type { ChainUpgrades } from '@polkadot/types/types';
|
||||
import type { ChainUpgradesRaw } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import networks from '@polkadot/networks';
|
||||
import { assert, hexToU8a, stringify } from '@polkadot/util';
|
||||
import { assert, BN, hexToU8a, stringify } from '@polkadot/util';
|
||||
|
||||
import kusama from './kusama';
|
||||
import polkadot from './polkadot';
|
||||
|
||||
@@ -12,7 +12,8 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[2201991, 1062], [2671528, 2005], [2704202, 2007], [2728002, 2008], [2832534, 2011],
|
||||
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
|
||||
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
|
||||
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030]
|
||||
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
|
||||
[7812476, 9040], [8010981, 9050], [8073833, 9070]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -8,7 +8,7 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12],
|
||||
[528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
|
||||
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
|
||||
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30]
|
||||
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -10,7 +10,7 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
|
||||
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
|
||||
[5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030],
|
||||
[5879822, 9031], [5896856, 9032], [5897316, 9033]
|
||||
[5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types",
|
||||
"version": "4.13.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Implementation of the Parity codec",
|
||||
"main": "index.js",
|
||||
@@ -19,15 +19,15 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.0",
|
||||
"@polkadot/metadata": "4.13.1",
|
||||
"@polkadot/util": "^6.7.1",
|
||||
"@polkadot/util-crypto": "^6.7.1",
|
||||
"@polkadot/x-rxjs": "^6.7.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.11.9"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.7.1"
|
||||
"@polkadot/keyring": "^6.10.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.11.9"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interface
|
||||
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||
import type { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEpochConfiguration, BabeEquivocationProof, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe';
|
||||
import type { AccountData, BalanceLock, BalanceLockTo212, BalanceStatus, Reasons, ReserveData, ReserveIdentifier, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
|
||||
import type { BeefyCommitment, BeefyNextAuthoritySet, BeefyPayload, BeefySignedCommitment, MmrRootHash, ValidatorSetId } from '@polkadot/types/interfaces/beefy';
|
||||
import type { BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, BeefySignedCommitment, MmrRootHash, ValidatorSetId } from '@polkadot/types/interfaces/beefy';
|
||||
import type { BridgedBlockHash, BridgedBlockNumber, BridgedHeader, InitializationData } from '@polkadot/types/interfaces/bridges';
|
||||
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
||||
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
||||
@@ -36,7 +36,7 @@ import type { DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMap
|
||||
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
|
||||
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
|
||||
import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
|
||||
import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, Retriable, Scheduling, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, SystemInherentData, TransientValidationData, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersDataTuple, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
|
||||
import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, Retriable, Scheduling, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, SystemInherentData, TransientValidationData, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersDataTuple, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
|
||||
import type { FeeDetails, InclusionFee, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
|
||||
import type { Approvals } from '@polkadot/types/interfaces/poll';
|
||||
import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy';
|
||||
@@ -57,7 +57,7 @@ import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||
import type { ClassDetails, ClassId, ClassMetadata, DepositBalance, DepositBalanceOf, DestroyWitness, InstanceDetails, InstanceId, InstanceMetadata } from '@polkadot/types/interfaces/uniques';
|
||||
import type { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
|
||||
import type { VestingInfo } from '@polkadot/types/interfaces/vesting';
|
||||
import type { AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, BodyId, BodyPart, BodyPartAtLeastProportion, BodyPartFraction, BodyPartMoreThanProportion, DoubleEncodedCall, InboundStatus, Junction, MultiAsset, MultiAssetAbstractFungible, MultiAssetAbstractNonFungible, MultiAssetConcreteFungible, MultiAssetConcreteNonFungible, MultiLocation, NetworkId, OutboundStatus, Outcome, PluralityJunction, QueueConfigData, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, Xcm, XcmAssetEffects, XcmError, XcmHrmpChannelAccepted, XcmHrmpChannelClosing, XcmHrmpNewChannelOpenRequest, XcmOrder, XcmOrderBuyExecution, XcmOrderDepositAsset, XcmOrderDepositReserveAsset, XcmOrderExchangeAsset, XcmOrderInitiateReserveWithdraw, XcmOrderInitiateTeleport, XcmOrderQueryHolding, XcmOriginKind, XcmQueryResponse, XcmRelayedFrom, XcmReserveAssetDeposit, XcmResponse, XcmTeleportAsset, XcmTransact, XcmTransferAsset, XcmTransferReserveAsset, XcmWithdrawAsset, XcmpMessageFormat } from '@polkadot/types/interfaces/xcm';
|
||||
import type { AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, BodyId, BodyPart, BodyPartAtLeastProportion, BodyPartFraction, BodyPartMoreThanProportion, DoubleEncodedCall, InboundStatus, Junction, MultiAsset, MultiAssetAbstractFungible, MultiAssetAbstractNonFungible, MultiAssetConcreteFungible, MultiAssetConcreteNonFungible, MultiLocation, NetworkId, OutboundStatus, Outcome, PluralityJunction, QueueConfigData, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, Xcm, XcmAssetEffects, XcmError, XcmHrmpChannelAccepted, XcmHrmpChannelClosing, XcmHrmpNewChannelOpenRequest, XcmOrder, XcmOrderBuyExecution, XcmOrderDepositAsset, XcmOrderDepositReserveAsset, XcmOrderExchangeAsset, XcmOrderInitiateReserveWithdraw, XcmOrderInitiateTeleport, XcmOrderQueryHolding, XcmOrigin, XcmOriginKind, XcmQueryResponse, XcmRelayedFrom, XcmReserveAssetDeposit, XcmResponse, XcmTeleportAsset, XcmTransact, XcmTransferAsset, XcmTransferReserveAsset, XcmWithdrawAsset, XcmpMessageFormat } from '@polkadot/types/interfaces/xcm';
|
||||
|
||||
declare module '@polkadot/types/types/registry' {
|
||||
export interface InterfaceTypes {
|
||||
@@ -226,6 +226,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<BalanceOf>': Option<BalanceOf>;
|
||||
'Option<BalanceStatus>': Option<BalanceStatus>;
|
||||
'Option<BeefyCommitment>': Option<BeefyCommitment>;
|
||||
'Option<BeefyId>': Option<BeefyId>;
|
||||
'Option<BeefyKey>': Option<BeefyKey>;
|
||||
'Option<BeefyNextAuthoritySet>': Option<BeefyNextAuthoritySet>;
|
||||
'Option<BeefyPayload>': Option<BeefyPayload>;
|
||||
@@ -955,6 +956,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<usize>': Option<usize>;
|
||||
'Option<USize>': Option<USize>;
|
||||
'Option<ValidationCode>': Option<ValidationCode>;
|
||||
'Option<ValidationCodeHash>': Option<ValidationCodeHash>;
|
||||
'Option<ValidationData>': Option<ValidationData>;
|
||||
'Option<ValidationDataType>': Option<ValidationDataType>;
|
||||
'Option<ValidationFunctionParams>': Option<ValidationFunctionParams>;
|
||||
@@ -1017,6 +1019,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<XcmOrderInitiateReserveWithdraw>': Option<XcmOrderInitiateReserveWithdraw>;
|
||||
'Option<XcmOrderInitiateTeleport>': Option<XcmOrderInitiateTeleport>;
|
||||
'Option<XcmOrderQueryHolding>': Option<XcmOrderQueryHolding>;
|
||||
'Option<XcmOrigin>': Option<XcmOrigin>;
|
||||
'Option<XcmOriginKind>': Option<XcmOriginKind>;
|
||||
'Option<XcmpMessageFormat>': Option<XcmpMessageFormat>;
|
||||
'Option<XcmQueryResponse>': Option<XcmQueryResponse>;
|
||||
@@ -1099,6 +1102,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<BalanceOf>': Vec<BalanceOf>;
|
||||
'Vec<BalanceStatus>': Vec<BalanceStatus>;
|
||||
'Vec<BeefyCommitment>': Vec<BeefyCommitment>;
|
||||
'Vec<BeefyId>': Vec<BeefyId>;
|
||||
'Vec<BeefyKey>': Vec<BeefyKey>;
|
||||
'Vec<BeefyNextAuthoritySet>': Vec<BeefyNextAuthoritySet>;
|
||||
'Vec<BeefyPayload>': Vec<BeefyPayload>;
|
||||
@@ -1828,6 +1832,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<usize>': Vec<usize>;
|
||||
'Vec<USize>': Vec<USize>;
|
||||
'Vec<ValidationCode>': Vec<ValidationCode>;
|
||||
'Vec<ValidationCodeHash>': Vec<ValidationCodeHash>;
|
||||
'Vec<ValidationData>': Vec<ValidationData>;
|
||||
'Vec<ValidationDataType>': Vec<ValidationDataType>;
|
||||
'Vec<ValidationFunctionParams>': Vec<ValidationFunctionParams>;
|
||||
@@ -1890,6 +1895,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<XcmOrderInitiateReserveWithdraw>': Vec<XcmOrderInitiateReserveWithdraw>;
|
||||
'Vec<XcmOrderInitiateTeleport>': Vec<XcmOrderInitiateTeleport>;
|
||||
'Vec<XcmOrderQueryHolding>': Vec<XcmOrderQueryHolding>;
|
||||
'Vec<XcmOrigin>': Vec<XcmOrigin>;
|
||||
'Vec<XcmOriginKind>': Vec<XcmOriginKind>;
|
||||
'Vec<XcmpMessageFormat>': Vec<XcmpMessageFormat>;
|
||||
'Vec<XcmQueryResponse>': Vec<XcmQueryResponse>;
|
||||
@@ -1972,6 +1978,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
BalanceOf: BalanceOf;
|
||||
BalanceStatus: BalanceStatus;
|
||||
BeefyCommitment: BeefyCommitment;
|
||||
BeefyId: BeefyId;
|
||||
BeefyKey: BeefyKey;
|
||||
BeefyNextAuthoritySet: BeefyNextAuthoritySet;
|
||||
BeefyPayload: BeefyPayload;
|
||||
@@ -2701,6 +2708,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
usize: usize;
|
||||
USize: USize;
|
||||
ValidationCode: ValidationCode;
|
||||
ValidationCodeHash: ValidationCodeHash;
|
||||
ValidationData: ValidationData;
|
||||
ValidationDataType: ValidationDataType;
|
||||
ValidationFunctionParams: ValidationFunctionParams;
|
||||
@@ -2763,6 +2771,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
XcmOrderInitiateReserveWithdraw: XcmOrderInitiateReserveWithdraw;
|
||||
XcmOrderInitiateTeleport: XcmOrderInitiateTeleport;
|
||||
XcmOrderQueryHolding: XcmOrderQueryHolding;
|
||||
XcmOrigin: XcmOrigin;
|
||||
XcmOriginKind: XcmOriginKind;
|
||||
XcmpMessageFormat: XcmpMessageFormat;
|
||||
XcmQueryResponse: XcmQueryResponse;
|
||||
|
||||
@@ -50,7 +50,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
/**
|
||||
* @description The length of the value
|
||||
*/
|
||||
public get length (): number {
|
||||
public override get length (): number {
|
||||
// only included here since we ignore inherited docs
|
||||
return super.length;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
// Overwrite the default toString representation of Array.
|
||||
const data = this.map((entry): string =>
|
||||
entry.toString()
|
||||
@@ -135,35 +135,35 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
/**
|
||||
* @description Concatenates two arrays
|
||||
*/
|
||||
public concat (other: T[]): T[] {
|
||||
public override concat (other: T[]): T[] {
|
||||
return this.toArray().concat(other instanceof AbstractArray ? other.toArray() : other);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Filters the array with the callback
|
||||
*/
|
||||
public filter (callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: unknown): T[] {
|
||||
public override filter (callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: unknown): T[] {
|
||||
return this.toArray().filter(callbackfn, thisArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Maps the array with the callback
|
||||
*/
|
||||
public map<U> (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: unknown): U[] {
|
||||
public override map<U> (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: unknown): U[] {
|
||||
return this.toArray().map(callbackfn, thisArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Checks if the array includes a specific value
|
||||
*/
|
||||
public includes (check: unknown): boolean {
|
||||
public override includes (check: unknown): boolean {
|
||||
return this.some((value: T) => value.eq(check));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns a slice of an array
|
||||
*/
|
||||
public slice (start?: number, end?: number): T[] {
|
||||
public override slice (start?: number, end?: number): T[] {
|
||||
return this.toArray().slice(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyNumber, Codec, Registry } from '../types';
|
||||
import type { UIntBitLength } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { assert, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isHex, isString, isU8a, stringify, u8aToBn } from '@polkadot/util';
|
||||
import { assert, BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, BN_ZERO, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isHex, isString, isU8a, stringify, u8aToBn } from '@polkadot/util';
|
||||
|
||||
export const DEFAULT_UINT_BITS = 64;
|
||||
|
||||
@@ -116,7 +114,7 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
/**
|
||||
* @description Returns the number of bits in the value
|
||||
*/
|
||||
public bitLength (): number {
|
||||
public override bitLength (): number {
|
||||
return this.#bitLength;
|
||||
}
|
||||
|
||||
@@ -124,7 +122,7 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
* @description Compares the value of the input to see if there is a match
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public eq (other?: unknown): boolean {
|
||||
public override eq (other?: unknown): boolean {
|
||||
// Here we are actually overriding the built-in .eq to take care of both
|
||||
// number and BN inputs (no `.eqn` needed) - numbers will be converted
|
||||
return super.eq(
|
||||
@@ -194,7 +192,7 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (onlyHex = false): any {
|
||||
public override toJSON (onlyHex = false): any {
|
||||
// FIXME this return type should by string | number, however BN returns string
|
||||
// Options here are
|
||||
// - super.bitLength() - the actual used bits
|
||||
@@ -220,7 +218,7 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
* @description Returns the string representation of the value
|
||||
* @param base The base to use for the conversion
|
||||
*/
|
||||
public toString (base?: number): string {
|
||||
public override toString (base?: number): string {
|
||||
// only included here since we do not inherit docs
|
||||
return super.toString(base);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { BN } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { U32 } from '../primitive';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { CodecHash, Hash } from '../interfaces';
|
||||
import type { AnyJson, AnyNumber, Constructor, ICompact, InterfaceTypes, Registry } from '../types';
|
||||
import type { CompactEncodable } from './types';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { CodecTo } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { BN } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { U64 } from '../primitive';
|
||||
|
||||
@@ -5,9 +5,7 @@ import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyNumber, Codec, Registry } from '../types';
|
||||
import type { UIntBitLength } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
import { BN, bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
|
||||
const BITLENGTH: UIntBitLength = 64;
|
||||
|
||||
@@ -116,7 +114,7 @@ export class CodecDate extends Date implements Codec {
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): any {
|
||||
public override toJSON (): any {
|
||||
// FIXME Return type should be number, but conflicts with Date.toJSON()
|
||||
// which returns string
|
||||
return this.toNumber();
|
||||
@@ -139,7 +137,7 @@ export class CodecDate extends Date implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
// only included here since we do not inherit docs
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class Int extends AbstractInt {
|
||||
super(registry, value, bitLength);
|
||||
}
|
||||
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return typeName || super.toRawType();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ export class Json extends Map<string, any> implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,14 @@ export class Linkage<T extends Codec> extends Struct {
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return `Linkage<${this.next.toRawType(true)}>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Custom toU8a which with bare mode does not return the linkage if empty
|
||||
*/
|
||||
public toU8a (): Uint8Array {
|
||||
public override toU8a (): Uint8Array {
|
||||
// As part of a storage query (where these appear), in the case of empty, the values
|
||||
// are NOT populated by the node - follow the same logic, leaving it empty
|
||||
return this.isEmpty
|
||||
|
||||
@@ -182,7 +182,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
/**
|
||||
* @description The length of the value
|
||||
*/
|
||||
public get length (): number {
|
||||
public override get length (): number {
|
||||
// only included here since we ignore inherited docs
|
||||
return super.length;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
* @param start The position to start at
|
||||
* @param end The position to end at
|
||||
*/
|
||||
public slice (start?: number, end?: number): Uint8Array {
|
||||
public override slice (start?: number, end?: number): Uint8Array {
|
||||
// Like subarray below, we have to follow this approach since we are extending the TypeArray.
|
||||
// This happens especially when it comes to further extensions, the length may be an override
|
||||
return Uint8Array.from(this).slice(start, end);
|
||||
@@ -104,7 +104,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
* @param begin The position to start at
|
||||
* @param end The position to end at
|
||||
*/
|
||||
public subarray (begin?: number, end?: number): Uint8Array {
|
||||
public override subarray (begin?: number, end?: number): Uint8Array {
|
||||
return Uint8Array.from(this).subarray(begin, end);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return this.toHex();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
super(registry, { Ok, Err }, value);
|
||||
}
|
||||
|
||||
public static with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | keyof InterfaceTypes; Err: Constructor<E> | keyof InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
public static override with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | keyof InterfaceTypes; Err: Constructor<E> | keyof InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
return class extends Result<O, E> {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Types.Ok, Types.Err, value);
|
||||
@@ -55,7 +55,7 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
/**
|
||||
* @description Checks if the Result has no value
|
||||
*/
|
||||
public get isEmpty (): boolean {
|
||||
public override get isEmpty (): boolean {
|
||||
return this.isOk && this.value.isEmpty;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
const Types = this._toRawStruct() as { Ok: unknown; Err: unknown };
|
||||
|
||||
return `Result<${Types.Ok as string},${Types.Err as string}>`;
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { Codec, Constructor, Registry } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { assert, bnToBn, bnToU8a, isBn, isNumber, isString, isU8a, isUndefined, stringCamelCase, stringify, stringUpperFirst, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { assert, BN, bnToBn, bnToU8a, isBn, isNumber, isString, isU8a, isUndefined, stringCamelCase, stringify, stringUpperFirst, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { compareArray } from './utils';
|
||||
|
||||
@@ -151,7 +149,7 @@ export class CodecSet extends Set<string> implements Codec {
|
||||
/**
|
||||
* @description adds a value to the Set (extended to allow for validity checking)
|
||||
*/
|
||||
public add = (key: string): this => {
|
||||
public override add = (key: string): this => {
|
||||
// ^^^ add = () property done to assign this instance's this, otherwise Set.add creates "some" chaos
|
||||
// we have the isUndefined(this._setValues) in here as well, add is used internally
|
||||
// in the Set constructor (so it is undefined at this point, and should allow)
|
||||
@@ -216,7 +214,7 @@ export class CodecSet extends Set<string> implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return `[${this.strings.join(', ')}]`;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef,
|
||||
*/
|
||||
function decodeStruct <T> (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<any, string>): T {
|
||||
if (isHex(value)) {
|
||||
return decodeStruct(registry, Types, hexToU8a(value.toString()), jsonMap);
|
||||
return decodeStruct(registry, Types, hexToU8a(value), jsonMap);
|
||||
} else if (isU8a(value)) {
|
||||
const keys = Object.keys(Types);
|
||||
const values = decodeU8a(registry, value, Object.values(Types), keys);
|
||||
@@ -245,7 +245,7 @@ export class Struct<
|
||||
* @description Returns a specific names entry in the structure
|
||||
* @param name The name of the entry to retrieve
|
||||
*/
|
||||
public get (name: keyof S): Codec | undefined {
|
||||
public override get (name: keyof S): Codec | undefined {
|
||||
return super.get(name);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ export class Struct<
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ export class Tuple extends AbstractArray<Codec> {
|
||||
/**
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
return this.reduce((total, entry) => total + entry.encodedLength, 0);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export class Tuple extends AbstractArray<Codec> {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
// Overwrite the default toString representation of Array.
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class Tuple extends AbstractArray<Codec> {
|
||||
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
public override toU8a (isBare?: boolean): Uint8Array {
|
||||
return u8aConcat(
|
||||
...this.map((entry): Uint8Array =>
|
||||
entry.toU8a(isBare)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user