Compare commits

..
28 Commits
Author SHA1 Message Date
Github Actions c03068f0ec [CI Skip] release/stable 4.16.2
skip-checks: true
2021-06-27 04:03:48 +00:00
Jaco e8f352930d Correct CompactAssignments & RawSolution types for Polkadot (#3705)
* Correct `CompactAssignments` & `RawSolution` types for Polkadot

* Default to Solution 16
2021-06-27 05:55:11 +02:00
Github Actions bf2c560db5 [CI Skip] release/stable 4.16.1
skip-checks: true
2021-06-26 08:48:42 +00:00
Jaco 63189a6196 4.16 (#3701) 2021-06-26 10:37:06 +02:00
Jaco 9990690332 Bump common (#3700) 2021-06-26 10:10:46 +02:00
Github Actions ee163cc342 [CI Skip] release/beta 4.15.2-10
skip-checks: true
2021-06-26 05:54:47 +00:00
Jaco cf27f7e11b Add Kusama & Westend 9070 upgrade blocks (#3699) 2021-06-26 08:43:58 +03:00
Github Actions 12986865c8 [CI Skip] release/beta 4.15.2-9
skip-checks: true
2021-06-25 15:14:24 +00:00
Jaco aac0fc741a Add polkadot 9050 upgrade block (#3698)
* Add polkadot 9050 upgrade block

* CHANGELOG expansion

* CHAGELOG wording
2021-06-25 17:04:07 +02:00
Github Actions c33f95d64b [CI Skip] release/beta 4.15.2-8
skip-checks: true
2021-06-25 11:14:03 +00:00
Jaco eb7255b34f Bump util (#3695) 2021-06-25 13:04:35 +02:00
Github Actions 3982798d5e [CI Skip] release/beta 4.15.2-7
skip-checks: true
2021-06-25 09:39:35 +00:00
Yuri ded1ebd4e7 fixes #3693 Fix uniques return types (#3694) 2021-06-25 11:30:44 +02:00
Github Actions c261d4e333 [CI Skip] release/beta 4.15.2-6
skip-checks: true
2021-06-23 14:27:46 +00:00
Jaco 7b1400e238 Bump common (#3690) 2021-06-23 16:18:49 +02:00
Github Actions 7c2048bc6b [CI Skip] release/beta 4.15.2-5
skip-checks: true
2021-06-23 13:00:32 +00:00
Jaco 2b1d5664fe Adjust contract registry (#3689) 2021-06-23 14:49:51 +02:00
Github Actions 5403686e20 [CI Skip] release/beta 4.15.2-4
skip-checks: true
2021-06-23 12:39:41 +00:00
Jaco e90c72fc8b ABI indexes are 0-based from 0.7+ (#3688) 2021-06-23 14:31:18 +02:00
Github Actions 1910ef54a4 [CI Skip] release/beta 4.15.2-3
skip-checks: true
2021-06-23 09:18:59 +00:00
Jaco 45686f9482 Bump deps (#3686)
* Bump deps

* Add override (as applicable)
2021-06-23 11:10:12 +02:00
Github Actions a6b0d214af [CI Skip] release/beta 4.15.2-2
skip-checks: true
2021-06-22 08:36:05 +00:00
Jaco 2a1a2a936b Update .123trigger 2021-06-22 10:24:33 +02:00
Jaco 060275d1ae Event lazy create classes (#3685)
* Event lazy create classes

* head fallback
2021-06-22 09:49:45 +02:00
Github Actions abb54d2538 [CI Skip] release/beta 4.15.2-1
skip-checks: true
2021-06-21 12:16:05 +00:00
Jaco 98fc472a40 Add 9050 upgrade blocks (#3683)
* Add 9050 upgrade blocks

* CHANGELOG
2021-06-21 14:06:09 +02:00
Github Actions 4034429042 [CI Skip] release/beta 4.15.2-0
skip-checks: true
2021-06-21 09:16:45 +00:00
Jaco ca212b8736 Bump static metadata (#3682) 2021-06-21 11:06:38 +02:00
92 changed files with 1186 additions and 885 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
30 31
1.4.2 1.4.2
1.6.2 1.6.2
1.11.2 1.11.2
@@ -23,3 +23,5 @@
4.7.2 4.7.2
4.9.2 4.9.2
4.11.2 4.11.2
4.16.2
+29
View File
@@ -1,5 +1,34 @@
# CHANGELOG # CHANGELOG
## 4.16.2 Jun 27, 2021
Upgrade priority: Low. Recommended for Polkadot with runtime >= 9050.
Changes:
- Correct `CompactAssignments` & `RawSolution` types for Polkadot
## 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 ## 4.15.1 Jun 19, 2021
Upgrade priority: Medium. Recommended for all chains where Xcm is used (addition of new `XcmOrigin`) Upgrade priority: Medium. Recommended for all chains where Xcm is used (addition of new `XcmOrigin`)
+6 -6
View File
@@ -8,7 +8,7 @@
"packages/*" "packages/*"
], ],
"resolutions": { "resolutions": {
"typescript": "^4.3.2" "typescript": "^4.3.4"
}, },
"scripts": { "scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts", "build": "yarn build:interfaces && polkadot-dev-build-ts",
@@ -25,14 +25,14 @@
"test:watch": "polkadot-dev-run-test --watch" "test:watch": "polkadot-dev-run-test --watch"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.14.5", "@babel/core": "^7.14.6",
"@babel/register": "^7.14.5", "@babel/register": "^7.14.5",
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/dev": "^0.62.42", "@polkadot/dev": "^0.62.43",
"@polkadot/ts": "^0.3.90", "@polkadot/ts": "^0.4.1",
"@polkadot/typegen": "workspace:packages/typegen", "@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.23", "@types/jest": "^26.0.23",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
}, },
"version": "4.15.1" "version": "4.16.2"
} }
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api-contract", "name": "@polkadot/api-contract",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs", "description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js", "main": "index.js",
@@ -19,10 +19,10 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/api": "4.15.1", "@polkadot/api": "4.16.2",
"@polkadot/types": "4.15.1", "@polkadot/types": "4.16.2",
"@polkadot/util": "^6.9.1", "@polkadot/util": "^6.10.1",
"@polkadot/x-rxjs": "^6.9.1" "@polkadot/x-rxjs": "^6.10.1"
} }
} }
+3 -3
View File
@@ -19,7 +19,7 @@ function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string
? list.find(({ identifier }) => [identifier, stringCamelCase(identifier)].includes(messageOrId.toString())) ? list.find(({ identifier }) => [identifier, stringCamelCase(identifier)].includes(messageOrId.toString()))
: messageOrId; : 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 { export class Abi {
@@ -127,7 +127,7 @@ export class Abi {
const args = this.#createArgs(spec.args, spec); const args = this.#createArgs(spec.args, spec);
const event = { const event = {
args, args,
docs: spec.docs.map((doc) => doc.toString()), docs: spec.docs.map((d) => d.toString()),
fromU8a: (data: Uint8Array): DecodedEvent => ({ fromU8a: (data: Uint8Array): DecodedEvent => ({
args: this.#decodeArgs(args, data), args: this.#decodeArgs(args, data),
event event
@@ -145,7 +145,7 @@ export class Abi {
const message = { const message = {
...add, ...add,
args, args,
docs: spec.docs.map((doc) => doc.toString()), docs: spec.docs.map((d) => d.toString()),
fromU8a: (data: Uint8Array): DecodedMessage => ({ fromU8a: (data: Uint8Array): DecodedMessage => ({
args: this.#decodeArgs(args, data), args: this.#decodeArgs(args, data),
message message
+32 -40
View File
@@ -35,8 +35,10 @@ export class MetaRegistry extends TypeRegistry {
constructor (metadataVersion: string, chainProperties?: ChainProperties) { constructor (metadataVersion: string, chainProperties?: ChainProperties) {
super(); super();
// type indexes are 1-based pre-1.0 and 0-based post-1.0 const [major, minor] = metadataVersion.split('.').map((n) => parseInt(n, 10));
this.typeOffset = metadataVersion.split('.')[0] === '0' ? 1 : 0;
// type indexes are 1-based pre 0.7 and 0-based post
this.typeOffset = (major === 0 && minor < 7) ? 1 : 0;
if (chainProperties) { if (chainProperties) {
this.setChainProperties(chainProperties); this.setChainProperties(chainProperties);
@@ -124,7 +126,7 @@ export class MetaRegistry extends TypeRegistry {
: {} : {}
), ),
...(path.length > 1 ...(path.length > 1
? { namespace: path.map((segment) => segment.toString()).join('::') } ? { namespace: path.map((s) => s.toString()).join('::') }
: {} : {}
), ),
...(type.params.length > 0 ...(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'); assert(isTuple || isStruct, 'Invalid fields type detected, expected either Tuple or Struct');
const sub = fields.map(({ name, type }) => { const sub = fields.map(({ name, type }) => ({
return { ...this.getMetaTypeDef({ type }),
...this.getMetaTypeDef({ type }), ...(name.isSome
...(name.isSome ? { name: name.unwrap().toString() }
? { name: name.unwrap().toString() } : {}
: {} )
) }));
};
});
return isTuple && sub.length === 1 return isTuple && sub.length === 1
? sub[0] ? sub[0]
@@ -213,32 +213,28 @@ export class MetaRegistry extends TypeRegistry {
const { params, path } = this.#getMetaType(id); const { params, path } = this.#getMetaType(id);
const specialVariant = path[0].toString(); const specialVariant = path[0].toString();
if (specialVariant === 'Option') { return specialVariant === 'Option'
return { ? {
info: TypeDefInfo.Option, info: TypeDefInfo.Option,
sub: this.getMetaTypeDef({ type: params[0] }) sub: this.getMetaTypeDef({ type: params[0] })
}; }
} else if (specialVariant === 'Result') { : specialVariant === 'Result'
return { ? {
info: TypeDefInfo.Result, info: TypeDefInfo.Result,
sub: params.map((type, index) => ({ sub: params.map((type, index) => ({
name: ['Ok', 'Error'][index], name: ['Ok', 'Error'][index],
...this.getMetaTypeDef({ type }) ...this.getMetaTypeDef({ type })
})) }))
}; }
} : {
info: TypeDefInfo.Enum,
return { sub: this.#extractVariantSub(variants)
info: TypeDefInfo.Enum, };
sub: this.#extractVariantSub(variants)
};
} }
#extractVariantSub = (variants: SiVariant[]): TypeDef[] => { #extractVariantSub = (variants: SiVariant[]): TypeDef[] => {
const isAllUnitVariants = variants.every(({ fields }) => fields.length === 0); return variants.every(({ fields }) => fields.length === 0)
? variants.map(({ discriminant, name }) => ({
if (isAllUnitVariants) {
return variants.map(({ discriminant, name }) => ({
...( ...(
discriminant.isSome discriminant.isSome
? { ext: { discriminant: discriminant.unwrap().toNumber() } } ? { ext: { discriminant: discriminant.unwrap().toNumber() } }
@@ -247,14 +243,10 @@ export class MetaRegistry extends TypeRegistry {
info: TypeDefInfo.Plain, info: TypeDefInfo.Plain,
name: name.toString(), name: name.toString(),
type: 'Null' type: 'Null'
})); }))
} : variants.map(({ fields, name }) => withTypeString({
return variants.map(({ fields, name }) =>
withTypeString({
...this.#extractFields(fields), ...this.#extractFields(fields),
name: name.toString() name: name.toString()
}) }));
);
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/api-contract', version: '4.16.2' };
+10 -10
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api-derive", "name": "@polkadot/api-derive",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.", "description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js", "main": "index.js",
@@ -19,16 +19,16 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/api": "4.15.1", "@polkadot/api": "4.16.2",
"@polkadot/rpc-core": "4.15.1", "@polkadot/rpc-core": "4.16.2",
"@polkadot/types": "4.15.1", "@polkadot/types": "4.16.2",
"@polkadot/util": "^6.9.1", "@polkadot/util": "^6.10.1",
"@polkadot/util-crypto": "^6.9.1", "@polkadot/util-crypto": "^6.10.1",
"@polkadot/x-rxjs": "^6.9.1" "@polkadot/x-rxjs": "^6.10.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^6.9.1", "@polkadot/keyring": "^6.10.1",
"@polkadot/rpc-provider": "4.15.1" "@polkadot/rpc-provider": "4.16.2"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/api-derive', version: '4.16.2' };
+12 -12
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/api", "name": "@polkadot/api",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC", "description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js", "main": "index.js",
@@ -19,17 +19,17 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/api-derive": "4.15.1", "@polkadot/api-derive": "4.16.2",
"@polkadot/keyring": "^6.9.1", "@polkadot/keyring": "^6.10.1",
"@polkadot/metadata": "4.15.1", "@polkadot/metadata": "4.16.2",
"@polkadot/rpc-core": "4.15.1", "@polkadot/rpc-core": "4.16.2",
"@polkadot/rpc-provider": "4.15.1", "@polkadot/rpc-provider": "4.16.2",
"@polkadot/types": "4.15.1", "@polkadot/types": "4.16.2",
"@polkadot/types-known": "4.15.1", "@polkadot/types-known": "4.16.2",
"@polkadot/util": "^6.9.1", "@polkadot/util": "^6.10.1",
"@polkadot/util-crypto": "^6.9.1", "@polkadot/util-crypto": "^6.10.1",
"@polkadot/x-rxjs": "^6.9.1", "@polkadot/x-rxjs": "^6.10.1",
"eventemitter3": "^4.0.7" "eventemitter3": "^4.0.7"
} }
} }
+20 -2
View File
@@ -551,6 +551,10 @@ declare module '@polkadot/api/types/errors' {
[key: string]: AugmentedError<ApiType>; [key: string]: AugmentedError<ApiType>;
}; };
electionProviderMultiPhase: { electionProviderMultiPhase: {
/**
* The call is not allowed at this point.
**/
CallNotAllowed: AugmentedError<ApiType>;
/** /**
* OCW submitted solution for wrong round * OCW submitted solution for wrong round
**/ **/
@@ -1182,6 +1186,10 @@ declare module '@polkadot/api/types/errors' {
* A nomination target was supplied that was blocked or otherwise not a validator. * A nomination target was supplied that was blocked or otherwise not a validator.
**/ **/
BadTarget: AugmentedError<ApiType>; BadTarget: AugmentedError<ApiType>;
/**
* The user has enough bond and thus cannot be chilled forcefully by an external person.
**/
CannotChillOther: AugmentedError<ApiType>;
/** /**
* Duplicate index. * Duplicate index.
**/ **/
@@ -1203,9 +1211,9 @@ declare module '@polkadot/api/types/errors' {
**/ **/
IncorrectSlashingSpans: AugmentedError<ApiType>; 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. * Invalid era to reward.
**/ **/
@@ -1238,10 +1246,20 @@ declare module '@polkadot/api/types/errors' {
* Can not rebond without unlocking chunks. * Can not rebond without unlocking chunks.
**/ **/
NoUnlockChunk: AugmentedError<ApiType>; 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. * Too many nomination targets supplied.
**/ **/
TooManyTargets: AugmentedError<ApiType>; 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 * Generic error
**/ **/
+4
View File
@@ -835,6 +835,10 @@ declare module '@polkadot/api/types/events' {
* A new set of stakers was elected. * A new set of stakers was elected.
**/ **/
StakingElection: AugmentedEvent<ApiType, []>; StakingElection: AugmentedEvent<ApiType, []>;
/**
* The election failed. No new era is planned.
**/
StakingElectionFailed: AugmentedEvent<ApiType, []>;
/** /**
* An account has unbonded this amount. \[stash, amount\] * An account has unbonded this amount. \[stash, amount\]
**/ **/
+32
View File
@@ -883,6 +883,14 @@ declare module '@polkadot/api/types/storage' {
* canceled by extraordinary circumstances (e.g. governance). * canceled by extraordinary circumstances (e.g. governance).
**/ **/
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>; 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. * 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. * 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]>; 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. * Minimum number of staking participants before emergency conditions are imposed.
**/ **/
minimumValidatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>; 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. * 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]>; 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, []>; validatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/** /**
* 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`.
**/ **/
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>; validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
/** /**
+67 -3
View File
@@ -19,7 +19,7 @@ import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber,
import type { Period, Priority } from '@polkadot/types/interfaces/scheduler'; import type { Period, Priority } from '@polkadot/types/interfaces/scheduler';
import type { Keys } from '@polkadot/types/interfaces/session'; import type { Keys } from '@polkadot/types/interfaces/session';
import type { SocietyJudgement } from '@polkadot/types/interfaces/society'; 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 { Key } from '@polkadot/types/interfaces/system';
import type { BountyIndex } from '@polkadot/types/interfaces/treasury'; import type { BountyIndex } from '@polkadot/types/interfaces/treasury';
import type { ClassId, DestroyWitness, InstanceId } from '@polkadot/types/interfaces/uniques'; import type { ClassId, DestroyWitness, InstanceId } from '@polkadot/types/interfaces/uniques';
@@ -1246,6 +1246,17 @@ declare module '@polkadot/api/types/submittable' {
[key: string]: SubmittableExtrinsicFunction<ApiType>; [key: string]: SubmittableExtrinsicFunction<ApiType>;
}; };
electionProviderMultiPhase: { 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`. * Set a new value for `MinimumUntrustedScore`.
* *
@@ -2550,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. * Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.
* - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account` * - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`
* - DbWrites: `NextKeys`, `origin account` * - DbWrites: `NextKeys`, `origin account`
* - DbWrites per key id: `KeyOwnder` * - DbWrites per key id: `KeyOwner`
* # </weight> * # </weight>
**/ **/
purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>; purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
@@ -2985,12 +2996,34 @@ declare module '@polkadot/api/types/submittable' {
* # </weight> * # </weight>
**/ **/
chill: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>; 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 * 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. * reset to normal (non-forced) behaviour.
* *
* The dispatch origin must be Root. * 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>
* - No arguments. * - No arguments.
* - Weight: O(1) * - Weight: O(1)
@@ -3003,6 +3036,12 @@ declare module '@polkadot/api/types/submittable' {
* *
* The dispatch origin must be Root. * 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>
* - Weight: O(1) * - Weight: O(1)
* - Write: ForceEra * - Write: ForceEra
@@ -3014,6 +3053,12 @@ declare module '@polkadot/api/types/submittable' {
* *
* The dispatch origin must be Root. * 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> * # <weight>
* - No arguments. * - No arguments.
* - Weight: O(1) * - Weight: O(1)
@@ -3254,6 +3299,9 @@ declare module '@polkadot/api/types/submittable' {
* can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need * 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). * 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. * 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`. * And, it can be only called when [`EraElectionStatus`] is `Closed`.
* *
@@ -3277,6 +3325,22 @@ declare module '@polkadot/api/types/submittable' {
* </weight> * </weight>
**/ **/
unbond: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>]>; 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. * Declare the desire to validate for the origin controller.
* *
@@ -4077,7 +4141,7 @@ declare module '@polkadot/api/types/submittable' {
* - `m = witness.instance_metdadatas` * - `m = witness.instance_metdadatas`
* - `a = witness.attributes` * - `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. * Alter the attributes of a given asset.
* *
-7
View File
@@ -82,13 +82,6 @@ export abstract class Getters<ApiType extends ApiTypes> extends Init<ApiType> {
return assertResult(this._genesisHash); 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 * @description true is the underlying provider is connected
*/ */
+1 -1
View File
@@ -286,7 +286,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
} }
// get unique types & validate // get unique types & validate
metadata.getUniqTypes(false); metadata.getUniqTypes(this._options.throwOnUnknown || false);
return [genesisHash, metadata]; return [genesisHash, metadata];
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/api', version: '4.16.2' };
+3 -1
View File
@@ -3,6 +3,8 @@
import type { SubmittableExtrinsic } from '../types'; import type { SubmittableExtrinsic } from '../types';
import { jest } from '@jest/globals';
import { createPair } from '@polkadot/keyring/pair'; import { createPair } from '@polkadot/keyring/pair';
import { createTestKeyring } from '@polkadot/keyring/testing'; import { createTestKeyring } from '@polkadot/keyring/testing';
import { MockProvider } from '@polkadot/rpc-provider/mock'; import { MockProvider } from '@polkadot/rpc-provider/mock';
@@ -91,7 +93,7 @@ describe('ApiPromise', (): void => {
super({ provider }); super({ provider });
} }
protected _loadMeta (): Promise<boolean> { protected override _loadMeta (): Promise<boolean> {
throw new Error('Simulate failure to load meta'); throw new Error('Simulate failure to load meta');
} }
} }
+1 -1
View File
@@ -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) * @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 * @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), {})); super.sign(account, this.#makeSignOptions(this.#optionsOrNonce(optionsOrNonce), {}));
return this; return this;
+4
View File
@@ -73,6 +73,10 @@ export interface ApiOptions extends RegisteredTypes {
* @description Throws an error when the initial connection fails (same as isReadyOrError) * @description Throws an error when the initial connection fails (same as isReadyOrError)
*/ */
throwOnConnect?: boolean; 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 // A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
+2
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2021 @polkadot/api authors & contributors // Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import { jest } from '@jest/globals';
import { ApiPromise, WsProvider } from '@polkadot/api'; import { ApiPromise, WsProvider } from '@polkadot/api';
describe('misc online tests', (): void => { 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 { AccountId, AccountIndex, AccountInfo, Address, Balance, BlockNumber, Index } from '@polkadot/types/interfaces';
import type { Observable } from '@polkadot/x-rxjs'; import type { Observable } from '@polkadot/x-rxjs';
import { jest } from '@jest/globals';
import { ApiPromise, WsProvider } from '@polkadot/api'; import { ApiPromise, WsProvider } from '@polkadot/api';
import { memo } from '@polkadot/api-derive/util/memo'; import { memo } from '@polkadot/api-derive/util/memo';
import { combineLatest, of } from '@polkadot/x-rxjs'; import { combineLatest, of } from '@polkadot/x-rxjs';
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/metadata", "name": "@polkadot/metadata",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "Helpers to extract information from runtime metadata", "description": "Helpers to extract information from runtime metadata",
"main": "index.js", "main": "index.js",
@@ -19,13 +19,13 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/types": "4.15.1", "@polkadot/types": "4.16.2",
"@polkadot/types-known": "4.15.1", "@polkadot/types-known": "4.16.2",
"@polkadot/util": "^6.9.1", "@polkadot/util": "^6.10.1",
"@polkadot/util-crypto": "^6.9.1" "@polkadot/util-crypto": "^6.10.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^6.9.1" "@polkadot/keyring": "^6.10.1"
} }
} }
+1 -1
View File
@@ -142,7 +142,7 @@ export class MetadataVersioned extends Struct {
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @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 // 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) // needed to ensure we have the correct overrides (which is only applied in toLatest)
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
@@ -89,7 +89,7 @@ function extendHeadMeta (registry: Registry, { meta: { documentation, name, type
// meta fallback only applies to actual entry values, create one for head // meta fallback only applies to actual entry values, create one for head
(iterFn as IterFn).meta = registry.createType('StorageEntryMetadataLatest', { (iterFn as IterFn).meta = registry.createType('StorageEntryMetadataLatest', {
documentation, documentation,
fallback: registry.createType('Bytes', registry.createType(outputType.toString() as 'Raw').toHex()), fallback: registry.createType('Bytes'),
modifier: registry.createType('StorageEntryModifierLatest', 1), // required modifier: registry.createType('StorageEntryModifierLatest', 1), // required
name, name,
type: registry.createType('StorageEntryTypeLatest', registry.createType('Type', outputType), 0) type: registry.createType('StorageEntryTypeLatest', registry.createType('Type', outputType), 0)
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/metadata', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/metadata', version: '4.16.2' };
+216 -9
View File
@@ -2015,6 +2015,25 @@
"", "",
" This check can be turned off by setting the value to `None`." " 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": [ "events": [
@@ -2139,6 +2158,12 @@
"documentation": [ "documentation": [
" OCW submitted solution for wrong round" " OCW submitted solution for wrong round"
] ]
},
{
"name": "CallNotAllowed",
"documentation": [
" The call is not allowed at this point."
]
} }
], ],
"index": 8 "index": 8
@@ -2216,6 +2241,28 @@
" Map from all locked \"stash\" accounts to the controller account." " 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", "name": "Ledger",
"modifier": "Optional", "modifier": "Optional",
@@ -2261,7 +2308,33 @@
}, },
"fallback": "0x0000", "fallback": "0x0000",
"documentation": [ "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."
] ]
}, },
{ {
@@ -2277,7 +2350,33 @@
}, },
"fallback": "0x00", "fallback": "0x00",
"documentation": [ "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."
] ]
}, },
{ {
@@ -2613,7 +2712,7 @@
"type": { "type": {
"plain": "Releases" "plain": "Releases"
}, },
"fallback": "0x05", "fallback": "0x06",
"documentation": [ "documentation": [
" True if network has been upgraded to this version.", " True if network has been upgraded to this version.",
" Storage version of the pallet.", " Storage version of the pallet.",
@@ -2717,6 +2816,9 @@
" can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need", " 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).", " 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.", " 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`.", " And, it can be only called when [`EraElectionStatus`] is `Closed`.",
"", "",
@@ -2980,6 +3082,12 @@
"", "",
" The dispatch origin must be Root.", " 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>", " # <weight>",
" - No arguments.", " - No arguments.",
" - Weight: O(1)", " - Weight: O(1)",
@@ -2996,6 +3104,12 @@
"", "",
" The dispatch origin must be Root.", " 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>",
" - No arguments.", " - No arguments.",
" - Weight: O(1)", " - Weight: O(1)",
@@ -3055,6 +3169,12 @@
"", "",
" The dispatch origin must be Root.", " 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>",
" - Weight: O(1)", " - Weight: O(1)",
" - Write: ForceEra", " - Write: ForceEra",
@@ -3246,6 +3366,66 @@
" Note: Making this call only makes sense if you first set the validator preferences to", " Note: Making this call only makes sense if you first set the validator preferences to",
" block any further nominations." " 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": [ "events": [
@@ -3343,6 +3523,13 @@
"documentation": [ "documentation": [
" A nominator has been kicked from a validator. \\[nominator, stash\\]" " A nominator has been kicked from a validator. \\[nominator, stash\\]"
] ]
},
{
"name": "StakingElectionFailed",
"args": [],
"documentation": [
" The election failed. No new era is planned."
]
} }
], ],
"constants": [ "constants": [
@@ -3435,9 +3622,9 @@
] ]
}, },
{ {
"name": "InsufficientValue", "name": "InsufficientBond",
"documentation": [ "documentation": [
" Can not bond with value less than minimum balance." " Can not bond with value less than minimum required."
] ]
}, },
{ {
@@ -3511,6 +3698,26 @@
"documentation": [ "documentation": [
" A nomination target was supplied that was blocked or otherwise not a validator." " 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 "index": 9
@@ -3657,7 +3864,7 @@
" Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.", " Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.",
" - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`", " - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`",
" - DbWrites: `NextKeys`, `origin account`", " - DbWrites: `NextKeys`, `origin account`",
" - DbWrites per key id: `KeyOwnder`", " - DbWrites per key id: `KeyOwner`",
" # </weight>" " # </weight>"
] ]
} }
@@ -7986,7 +8193,7 @@
{ {
"name": "AuthorityDiscovery", "name": "AuthorityDiscovery",
"storage": null, "storage": null,
"calls": [], "calls": null,
"events": null, "events": null,
"constants": [], "constants": [],
"errors": [], "errors": [],
@@ -8053,7 +8260,7 @@
} }
] ]
}, },
"calls": [], "calls": null,
"events": [ "events": [
{ {
"name": "Offence", "name": "Offence",
@@ -8101,7 +8308,7 @@
} }
] ]
}, },
"calls": [], "calls": null,
"events": null, "events": null,
"constants": [], "constants": [],
"errors": [], "errors": [],
File diff suppressed because one or more lines are too long
+8 -8
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/rpc-core", "name": "@polkadot/rpc-core",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "main": "index.js",
@@ -19,14 +19,14 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/metadata": "4.15.1", "@polkadot/metadata": "4.16.2",
"@polkadot/rpc-provider": "4.15.1", "@polkadot/rpc-provider": "4.16.2",
"@polkadot/types": "4.15.1", "@polkadot/types": "4.16.2",
"@polkadot/util": "^6.9.1", "@polkadot/util": "^6.10.1",
"@polkadot/x-rxjs": "^6.9.1" "@polkadot/x-rxjs": "^6.10.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^6.9.1" "@polkadot/keyring": "^6.10.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/rpc-core', version: '4.16.2' };
+2
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors // Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import { jest } from '@jest/globals';
import { of, timer } from '@polkadot/x-rxjs'; import { of, timer } from '@polkadot/x-rxjs';
import { drr } from '.'; import { drr } from '.';
+10 -10
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/rpc-provider", "name": "@polkadot/rpc-provider",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "Transport providers for the API", "description": "Transport providers for the API",
"main": "index.js", "main": "index.js",
@@ -19,18 +19,18 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/types": "4.15.1", "@polkadot/types": "4.16.2",
"@polkadot/util": "^6.9.1", "@polkadot/util": "^6.10.1",
"@polkadot/util-crypto": "^6.9.1", "@polkadot/util-crypto": "^6.10.1",
"@polkadot/x-fetch": "^6.9.1", "@polkadot/x-fetch": "^6.10.1",
"@polkadot/x-global": "^6.9.1", "@polkadot/x-global": "^6.10.1",
"@polkadot/x-ws": "^6.9.1", "@polkadot/x-ws": "^6.10.1",
"eventemitter3": "^4.0.7" "eventemitter3": "^4.0.7"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^6.9.1", "@polkadot/keyring": "^6.10.1",
"@polkadot/metadata": "4.15.1", "@polkadot/metadata": "4.16.2",
"mock-socket": "^9.0.3", "mock-socket": "^9.0.3",
"nock": "^13.1.0" "nock": "^13.1.0"
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.16.2' };
@@ -3,6 +3,8 @@
import type { Mock } from './../mock/types'; import type { Mock } from './../mock/types';
import { jest } from '@jest/globals';
import { mockWs } from '../../test/mockWs'; import { mockWs } from '../../test/mockWs';
import { WsProvider } from './'; import { WsProvider } from './';
+8 -8
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/typegen", "name": "@polkadot/typegen",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "Type generation scripts", "description": "Type generation scripts",
"main": "index.js", "main": "index.js",
@@ -26,14 +26,14 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"dependencies": { "dependencies": {
"@babel/core": "^7.14.5", "@babel/core": "^7.14.6",
"@babel/register": "^7.14.5", "@babel/register": "^7.14.5",
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/api": "4.15.1", "@polkadot/api": "4.16.2",
"@polkadot/metadata": "4.15.1", "@polkadot/metadata": "4.16.2",
"@polkadot/rpc-provider": "4.15.1", "@polkadot/rpc-provider": "4.16.2",
"@polkadot/types": "4.15.1", "@polkadot/types": "4.16.2",
"@polkadot/util": "^6.9.1", "@polkadot/util": "^6.10.1",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"websocket": "^1.0.34", "websocket": "^1.0.34",
"yargs": "^17.0.1" "yargs": "^17.0.1"
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/typegen', version: '4.16.2' };
+5 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/types-known", "name": "@polkadot/types-known",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface", "description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js", "main": "index.js",
@@ -19,9 +19,9 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/networks": "^6.9.1", "@polkadot/networks": "^6.10.1",
"@polkadot/types": "4.15.1", "@polkadot/types": "4.16.2",
"@polkadot/util": "^6.9.1" "@polkadot/util": "^6.10.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/types-known', version: '4.16.2' };
+10 -2
View File
@@ -6,6 +6,8 @@
import type { OverrideVersionedType } from '@polkadot/types/types'; import type { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = { const sharedTypes = {
CompactAssignments: 'CompactAssignmentsWith24',
RawSolution: 'RawSolutionWith24',
Keys: 'SessionKeys6', Keys: 'SessionKeys6',
ProxyType: { ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy'] _enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement', 'CancelProxy']
@@ -16,9 +18,9 @@ const addrIndicesTypes = {
AccountInfo: 'AccountInfoWithRefCount', AccountInfo: 'AccountInfoWithRefCount',
Address: 'LookupSource', Address: 'LookupSource',
CompactAssignments: 'CompactAssignmentsWith16', CompactAssignments: 'CompactAssignmentsWith16',
RawSolution: 'RawSolutionWith16',
Keys: 'SessionKeys5', Keys: 'SessionKeys5',
LookupSource: 'IndicesLookupSource', LookupSource: 'IndicesLookupSource',
RawSolution: 'RawSolutionWith16',
ValidatorPrefs: 'ValidatorPrefsWithCommission' ValidatorPrefs: 'ValidatorPrefsWithCommission'
}; };
@@ -26,9 +28,9 @@ const addrAccountIdTypes = {
AccountInfo: 'AccountInfoWithRefCount', AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId', Address: 'AccountId',
CompactAssignments: 'CompactAssignmentsWith16', CompactAssignments: 'CompactAssignmentsWith16',
RawSolution: 'RawSolutionWith16',
Keys: 'SessionKeys5', Keys: 'SessionKeys5',
LookupSource: 'AccountId', LookupSource: 'AccountId',
RawSolution: 'RawSolutionWith16',
ValidatorPrefs: 'ValidatorPrefsWithCommission' ValidatorPrefs: 'ValidatorPrefsWithCommission'
}; };
@@ -42,6 +44,7 @@ const versioned: OverrideVersionedType[] = [
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchError: 'DispatchErrorTo198', DispatchError: 'DispatchErrorTo198',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
Keys: 'SessionKeys5', Keys: 'SessionKeys5',
Multiplier: 'Fixed64', Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
@@ -60,6 +63,7 @@ const versioned: OverrideVersionedType[] = [
BalanceLock: 'BalanceLockTo212', BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
Keys: 'SessionKeys5', Keys: 'SessionKeys5',
Multiplier: 'Fixed64', Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
@@ -79,6 +83,7 @@ const versioned: OverrideVersionedType[] = [
BalanceLock: 'BalanceLockTo212', BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
Keys: 'SessionKeys5', Keys: 'SessionKeys5',
Multiplier: 'Fixed64', Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
@@ -97,6 +102,7 @@ const versioned: OverrideVersionedType[] = [
...addrAccountIdTypes, ...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
Multiplier: 'Fixed64', Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259', RefCount: 'RefCountTo259',
@@ -112,6 +118,7 @@ const versioned: OverrideVersionedType[] = [
...addrAccountIdTypes, ...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
Multiplier: 'Fixed64', Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259', RefCount: 'RefCountTo259',
@@ -126,6 +133,7 @@ const versioned: OverrideVersionedType[] = [
...addrAccountIdTypes, ...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257', CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244', DispatchInfo: 'DispatchInfoTo244',
Heartbeat: 'HeartbeatTo244',
OpenTip: 'OpenTipTo225', OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259' RefCount: 'RefCountTo259'
} }
+3 -13
View File
@@ -6,6 +6,8 @@
import type { OverrideVersionedType } from '@polkadot/types/types'; import type { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = { const sharedTypes = {
CompactAssignments: 'CompactAssignmentsWith16',
RawSolution: 'RawSolutionWith16',
Keys: 'SessionKeys6', Keys: 'SessionKeys6',
ProxyType: { ProxyType: {
_enum: { _enum: {
@@ -23,10 +25,8 @@ const sharedTypes = {
const addrAccountIdTypes = { const addrAccountIdTypes = {
AccountInfo: 'AccountInfoWithRefCount', AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId', Address: 'AccountId',
CompactAssignments: 'CompactAssignmentsWith16',
Keys: 'SessionKeys5', Keys: 'SessionKeys5',
LookupSource: 'AccountId', LookupSource: 'AccountId',
RawSolution: 'RawSolutionWith16',
ValidatorPrefs: 'ValidatorPrefsWithCommission' ValidatorPrefs: 'ValidatorPrefsWithCommission'
}; };
@@ -70,21 +70,11 @@ const versioned: OverrideVersionedType[] = [
minmax: [28, 29], minmax: [28, 29],
types: { types: {
...sharedTypes, ...sharedTypes,
CompactAssignments: 'CompactAssignmentsWith16',
RawSolution: 'RawSolutionWith16',
AccountInfo: 'AccountInfoWithDualRefCount' AccountInfo: 'AccountInfoWithDualRefCount'
} }
}, },
{ {
minmax: [30, 9000], minmax: [30, undefined],
types: {
...sharedTypes,
CompactAssignments: 'CompactAssignmentsWith16',
RawSolution: 'RawSolutionWith16'
}
},
{
minmax: [9010, undefined],
types: { types: {
...sharedTypes ...sharedTypes
} }
+1 -1
View File
@@ -13,7 +13,7 @@ const upgrades: ChainUpgradesRaw = [
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022], [2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027], [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] [7812476, 9040], [8010981, 9050], [8073833, 9070]
]; ];
export default upgrades; export default upgrades;
@@ -8,7 +8,7 @@ const upgrades: ChainUpgradesRaw = [
[244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12], [244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12],
[528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17], [528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26], [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; export default upgrades;
+1 -1
View File
@@ -10,7 +10,7 @@ const upgrades: ChainUpgradesRaw = [
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44], [1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49], [2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
[5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030], [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; export default upgrades;
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@polkadot/types", "name": "@polkadot/types",
"version": "4.15.1", "version": "4.16.2",
"type": "module", "type": "module",
"description": "Implementation of the Parity codec", "description": "Implementation of the Parity codec",
"main": "index.js", "main": "index.js",
@@ -19,14 +19,14 @@
"bugs": "https://github.com/polkadot-js/api/issues", "bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.14.5", "@babel/runtime": "^7.14.6",
"@polkadot/metadata": "4.15.1", "@polkadot/metadata": "4.16.2",
"@polkadot/util": "^6.9.1", "@polkadot/util": "^6.10.1",
"@polkadot/util-crypto": "^6.9.1", "@polkadot/util-crypto": "^6.10.1",
"@polkadot/x-rxjs": "^6.9.1" "@polkadot/x-rxjs": "^6.10.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^6.9.1", "@polkadot/keyring": "^6.10.1",
"@types/bn.js": "^4.11.6", "@types/bn.js": "^4.11.6",
"bn.js": "^4.11.9" "bn.js": "^4.11.9"
} }
+7 -7
View File
@@ -50,7 +50,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
/** /**
* @description The length of the value * @description The length of the value
*/ */
public get length (): number { public override get length (): number {
// only included here since we ignore inherited docs // only included here since we ignore inherited docs
return super.length; 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 * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
// Overwrite the default toString representation of Array. // Overwrite the default toString representation of Array.
const data = this.map((entry): string => const data = this.map((entry): string =>
entry.toString() entry.toString()
@@ -135,35 +135,35 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
/** /**
* @description Concatenates two arrays * @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); return this.toArray().concat(other instanceof AbstractArray ? other.toArray() : other);
} }
/** /**
* @description Filters the array with the callback * @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); return this.toArray().filter(callbackfn, thisArg);
} }
/** /**
* @description Maps the array with the callback * @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); return this.toArray().map(callbackfn, thisArg);
} }
/** /**
* @description Checks if the array includes a specific value * @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)); return this.some((value: T) => value.eq(check));
} }
/** /**
* @description Returns a slice of an array * @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); return this.toArray().slice(start, end);
} }
} }
+4 -4
View File
@@ -114,7 +114,7 @@ export abstract class AbstractInt extends BN implements Codec {
/** /**
* @description Returns the number of bits in the value * @description Returns the number of bits in the value
*/ */
public bitLength (): number { public override bitLength (): number {
return this.#bitLength; return this.#bitLength;
} }
@@ -122,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 * @description Compares the value of the input to see if there is a match
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any // 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 // 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 // number and BN inputs (no `.eqn` needed) - numbers will be converted
return super.eq( return super.eq(
@@ -192,7 +192,7 @@ export abstract class AbstractInt extends BN implements Codec {
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @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 // FIXME this return type should by string | number, however BN returns string
// Options here are // Options here are
// - super.bitLength() - the actual used bits // - super.bitLength() - the actual used bits
@@ -218,7 +218,7 @@ export abstract class AbstractInt extends BN implements Codec {
* @description Returns the string representation of the value * @description Returns the string representation of the value
* @param base The base to use for the conversion * @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 // only included here since we do not inherit docs
return super.toString(base); return super.toString(base);
} }
+1 -1
View File
@@ -175,7 +175,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements Codec {
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return stringify(this.toJSON()); return stringify(this.toJSON());
} }
+2 -2
View File
@@ -114,7 +114,7 @@ export class CodecDate extends Date implements Codec {
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @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() // FIXME Return type should be number, but conflicts with Date.toJSON()
// which returns string // which returns string
return this.toNumber(); return this.toNumber();
@@ -137,7 +137,7 @@ export class CodecDate extends Date implements Codec {
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
// only included here since we do not inherit docs // only included here since we do not inherit docs
return super.toString(); return super.toString();
} }
+1 -1
View File
@@ -27,7 +27,7 @@ export class Int extends AbstractInt {
super(registry, value, bitLength); super(registry, value, bitLength);
} }
public toRawType (): string { public override toRawType (): string {
return typeName || super.toRawType(); return typeName || super.toRawType();
} }
}; };
+1 -1
View File
@@ -111,7 +111,7 @@ export class Json extends Map<string, any> implements Codec {
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return stringify(this.toJSON()); return stringify(this.toJSON());
} }
+2 -2
View File
@@ -44,14 +44,14 @@ export class Linkage<T extends Codec> extends Struct {
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return `Linkage<${this.next.toRawType(true)}>`; return `Linkage<${this.next.toRawType(true)}>`;
} }
/** /**
* @description Custom toU8a which with bare mode does not return the linkage if empty * @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 // 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 // are NOT populated by the node - follow the same logic, leaving it empty
return this.isEmpty return this.isEmpty
+1 -1
View File
@@ -182,7 +182,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return stringify(this.toJSON()); return stringify(this.toJSON());
} }
+4 -4
View File
@@ -64,7 +64,7 @@ export class Raw extends Uint8Array implements IU8a {
/** /**
* @description The length of the value * @description The length of the value
*/ */
public get length (): number { public override get length (): number {
// only included here since we ignore inherited docs // only included here since we ignore inherited docs
return super.length; return super.length;
} }
@@ -93,7 +93,7 @@ export class Raw extends Uint8Array implements IU8a {
* @param start The position to start at * @param start The position to start at
* @param end The position to end 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. // 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 // This happens especially when it comes to further extensions, the length may be an override
return Uint8Array.from(this).slice(start, end); 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 begin The position to start at
* @param end The position to end 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); 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 * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return this.toHex(); return this.toHex();
} }
+3 -3
View File
@@ -19,7 +19,7 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
super(registry, { Ok, Err }, value); 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> { return class extends Result<O, E> {
constructor (registry: Registry, value?: unknown) { constructor (registry: Registry, value?: unknown) {
super(registry, Types.Ok, Types.Err, value); 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 * @description Checks if the Result has no value
*/ */
public get isEmpty (): boolean { public override get isEmpty (): boolean {
return this.isOk && this.value.isEmpty; 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 * @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 }; const Types = this._toRawStruct() as { Ok: unknown; Err: unknown };
return `Result<${Types.Ok as string},${Types.Err as string}>`; return `Result<${Types.Ok as string},${Types.Err as string}>`;
+2 -2
View File
@@ -149,7 +149,7 @@ export class CodecSet extends Set<string> implements Codec {
/** /**
* @description adds a value to the Set (extended to allow for validity checking) * @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 // ^^^ 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 // 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) // in the Set constructor (so it is undefined at this point, and should allow)
@@ -214,7 +214,7 @@ export class CodecSet extends Set<string> implements Codec {
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return `[${this.strings.join(', ')}]`; return `[${this.strings.join(', ')}]`;
} }
+3 -3
View File
@@ -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 { function decodeStruct <T> (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<any, string>): T {
if (isHex(value)) { if (isHex(value)) {
return decodeStruct(registry, Types, hexToU8a(value.toString()), jsonMap); return decodeStruct(registry, Types, hexToU8a(value), jsonMap);
} else if (isU8a(value)) { } else if (isU8a(value)) {
const keys = Object.keys(Types); const keys = Object.keys(Types);
const values = decodeU8a(registry, value, Object.values(Types), keys); 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 * @description Returns a specific names entry in the structure
* @param name The name of the entry to retrieve * @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); return super.get(name);
} }
@@ -309,7 +309,7 @@ export class Struct<
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return stringify(this.toJSON()); return stringify(this.toJSON());
} }
+3 -3
View File
@@ -73,7 +73,7 @@ export class Tuple extends AbstractArray<Codec> {
/** /**
* @description The length of the value when encoded as a Uint8Array * @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); 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 * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
// Overwrite the default toString representation of Array. // Overwrite the default toString representation of Array.
return stringify(this.toJSON()); 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 * @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) * @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( return u8aConcat(
...this.map((entry): Uint8Array => ...this.map((entry): Uint8Array =>
entry.toU8a(isBare) entry.toU8a(isBare)
+2 -2
View File
@@ -43,7 +43,7 @@ export class U8aFixed extends Raw {
super(registry, value, bitLength); super(registry, value, bitLength);
} }
public toRawType (): string { public override toRawType (): string {
return typeName || super.toRawType(); return typeName || super.toRawType();
} }
}; };
@@ -52,7 +52,7 @@ export class U8aFixed extends Raw {
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return `[u8;${this.length}]`; return `[u8;${this.length}]`;
} }
} }
+1 -1
View File
@@ -23,7 +23,7 @@ export class UInt extends AbstractInt {
super(registry, value, bitLength); super(registry, value, bitLength);
} }
public toRawType (): string { public override toRawType (): string {
return typeName || super.toRawType(); return typeName || super.toRawType();
} }
}; };
+1 -1
View File
@@ -73,7 +73,7 @@ export class Vec<T extends Codec> extends AbstractArray<T> {
/** /**
* @description Finds the index of the value in the array * @description Finds the index of the value in the array
*/ */
public indexOf (_other?: unknown): number { public override indexOf (_other?: unknown): number {
// convert type first, this removes overhead from the eq // convert type first, this removes overhead from the eq
const other = _other instanceof this._Type const other = _other instanceof this._Type
? _other ? _other
+2 -2
View File
@@ -62,11 +62,11 @@ export class VecFixed<T extends Codec> extends AbstractArray<T> {
/** /**
* @description The length of the value when encoded as a Uint8Array * @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); return this.reduce((total, entry) => total + entry.encodedLength, 0);
} }
public toU8a (): Uint8Array { public override toU8a (): Uint8Array {
// we override, we don't add the length prefix for ourselves, and at the same time we // we override, we don't add the length prefix for ourselves, and at the same time we
// ignore isBare on entries, since they should be properly encoded at all times // ignore isBare on entries, since they should be properly encoded at all times
const encoded = this.map((entry) => entry.toU8a()); const encoded = this.map((entry) => entry.toU8a());
+1 -1
View File
@@ -40,7 +40,7 @@ function initType<T extends Codec = Codec, K extends string = string> (registry:
if (isU8a(value)) { if (isU8a(value)) {
checkInstance(value, created); checkInstance(value, created);
} else if (isHex(value)) { } else if (isHex(value)) {
checkInstance(u8aToU8a(value.toString()), created); checkInstance(u8aToU8a(value), created);
} }
} }
+15 -14
View File
@@ -51,31 +51,32 @@ function injectErrors (_: Registry, metadata: Metadata, metadataErrors: Record<s
// create event classes from metadata // create event classes from metadata
function injectEvents (registry: Registry, metadata: Metadata, metadataEvents: Record<string, Constructor<GenericEventData>>): void { function injectEvents (registry: Registry, metadata: Metadata, metadataEvents: Record<string, Constructor<GenericEventData>>): void {
const modules = metadata.asLatest.modules;
// decorate the events // decorate the events
modules metadata.asLatest.modules
.filter(({ events }) => events.isSome) .filter(({ events }) => events.isSome)
.forEach((section, _sectionIndex): void => { .forEach((section, _sectionIndex): void => {
const sectionIndex = metadata.version >= 12 ? section.index.toNumber() : _sectionIndex; const sectionIndex = metadata.version >= 12
? section.index.toNumber()
: _sectionIndex;
const sectionName = stringCamelCase(section.name); const sectionName = stringCamelCase(section.name);
section.events.unwrap().forEach((meta, methodIndex): void => { section.events.unwrap().forEach((meta, methodIndex): void => {
const methodName = meta.name.toString(); const methodName = meta.name.toString();
const eventIndex = new Uint8Array([sectionIndex, methodIndex]);
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
const typeDef = meta.args.map((arg) => getTypeDef(arg)); const typeDef = meta.args.map((arg) => getTypeDef(arg));
let Types: Constructor<Codec>[] = []; let Types: Constructor<Codec>[] | null = null;
try { // Lazy create the actual type classes right at the point of use
Types = typeDef.map((typeDef) => getTypeClass(registry, typeDef)); const getTypes = (): Constructor<Codec>[] => {
} catch (error) { if (!Types) {
l.error(error); Types = typeDef.map((typeDef) => getTypeClass(registry, typeDef));
} }
metadataEvents[u8aToHex(eventIndex)] = class extends GenericEventData { return Types;
};
metadataEvents[u8aToHex(new Uint8Array([sectionIndex, methodIndex]))] = class extends GenericEventData {
constructor (registry: Registry, value: Uint8Array) { constructor (registry: Registry, value: Uint8Array) {
super(registry, value, Types, typeDef, meta, sectionName, methodName); super(registry, value, getTypes(), typeDef, meta, sectionName, methodName);
} }
}; };
}); });
+7 -7
View File
@@ -13,9 +13,9 @@ function decodeAccountId (value: AnyU8a | AnyString): AnyU8a {
if (isU8a(value) || Array.isArray(value)) { if (isU8a(value) || Array.isArray(value)) {
return u8aToU8a(value); return u8aToU8a(value);
} else if (isHex(value) || isEthereumAddress(value)) { } else if (isHex(value) || isEthereumAddress(value)) {
return hexToU8a(value.toString()); return hexToU8a(value);
} else if (isString(value)) { } else if (isString(value)) {
return u8aToU8a((value as string).toString()); return u8aToU8a(value);
} }
return value; return value;
@@ -40,35 +40,35 @@ export class GenericEthereumAccountId extends U8aFixed {
/** /**
* @description Compares the value of the input to see if there is a match * @description Compares the value of the input to see if there is a match
*/ */
public eq (other?: unknown): boolean { public override eq (other?: unknown): boolean {
return super.eq(decodeAccountId(other as AnyU8a)); return super.eq(decodeAccountId(other as AnyU8a));
} }
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (): string { public override toHuman (): string {
return this.toJSON(); return this.toJSON();
} }
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @description Converts the Object to JSON, typically used for RPC transfers
*/ */
public toJSON (): string { public override toJSON (): string {
return this.toString(); return this.toString();
} }
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return GenericEthereumAccountId.encode(this); return GenericEthereumAccountId.encode(this);
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'AccountId'; return 'AccountId';
} }
} }
+4 -4
View File
@@ -69,7 +69,7 @@ export class GenericEthereumLookupSource extends Base<GenericEthereumAccountId |
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
const rawLength = this._rawLength; const rawLength = this._rawLength;
return rawLength + ( return rawLength + (
@@ -92,14 +92,14 @@ export class GenericEthereumLookupSource extends Base<GenericEthereumAccountId |
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (): string { public override toHex (): string {
return u8aToHex(this.toU8a()); return u8aToHex(this.toU8a());
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'Address'; return 'Address';
} }
@@ -107,7 +107,7 @@ export class GenericEthereumLookupSource extends Base<GenericEthereumAccountId |
* @description Encodes the value as a Uint8Array as per the SCALE specifications * @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) * @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 {
const encoded = this._raw.toU8a().subarray(0, this._rawLength); const encoded = this._raw.toU8a().subarray(0, this._rawLength);
return isBare return isBare
+6 -6
View File
@@ -73,7 +73,7 @@ abstract class ExtrinsicBase<A extends AnyTuple> extends Base<ExtrinsicVx | Extr
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
return this.toU8a().length; return this.toU8a().length;
} }
@@ -243,14 +243,14 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (isBare?: boolean): string { public override toHex (isBare?: boolean): string {
return u8aToHex(this.toU8a(isBare)); return u8aToHex(this.toU8a(isBare));
} }
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (isExpanded?: boolean): AnyJson { public override toHuman (isExpanded?: boolean): AnyJson {
return { return {
isSigned: this.isSigned, isSigned: this.isSigned,
method: this.method.toHuman(isExpanded), method: this.method.toHuman(isExpanded),
@@ -270,14 +270,14 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @description Converts the Object to JSON, typically used for RPC transfers
*/ */
public toJSON (): string { public override toJSON (): string {
return this.toHex(); return this.toHex();
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'Extrinsic'; return 'Extrinsic';
} }
@@ -285,7 +285,7 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
* @description Encodes the value as a Uint8Array as per the SCALE specifications * @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value is not length-prefixed * @param isBare true when the value is not length-prefixed
*/ */
public toU8a (isBare?: boolean): Uint8Array { public override toU8a (isBare?: boolean): Uint8Array {
// we do not apply bare to the internal values, rather this only determines out length addition, // we do not apply bare to the internal values, rather this only determines out length addition,
// where we strip all lengths this creates an extrinsic that cannot be decoded // where we strip all lengths this creates an extrinsic that cannot be decoded
const encoded = u8aConcat(new Uint8Array([this.version]), this._raw.toU8a()); const encoded = u8aConcat(new Uint8Array([this.version]), this._raw.toU8a());
+6 -6
View File
@@ -113,7 +113,7 @@ export class MortalEra extends Tuple {
/** /**
* @description Encoded length for mortals occupy 2 bytes, different from the actual Tuple since it is encoded. This is a shortcut fro `toU8a().length` * @description Encoded length for mortals occupy 2 bytes, different from the actual Tuple since it is encoded. This is a shortcut fro `toU8a().length`
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
return 2; return 2;
} }
@@ -134,7 +134,7 @@ export class MortalEra extends Tuple {
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (): any { public override toHuman (): any {
return { return {
period: formatNumber(this.period), period: formatNumber(this.period),
phase: formatNumber(this.phase) phase: formatNumber(this.phase)
@@ -144,7 +144,7 @@ export class MortalEra extends Tuple {
/** /**
* @description Returns a JSON representation of the actual value * @description Returns a JSON representation of the actual value
*/ */
public toJSON (): any { public override toJSON (): any {
return this.toHex(); return this.toHex();
} }
@@ -159,7 +159,7 @@ export class MortalEra extends Tuple {
* `period` is. * `period` is.
*/ */
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public toU8a (isBare?: boolean): Uint8Array { public override toU8a (isBare?: boolean): Uint8Array {
const period = this.period.toNumber(); const period = this.period.toNumber();
const phase = this.phase.toNumber(); const phase = this.phase.toNumber();
const quantizeFactor = Math.max(period >> 12, 1); const quantizeFactor = Math.max(period >> 12, 1);
@@ -235,7 +235,7 @@ export class GenericExtrinsicEra extends Enum implements IExtrinsicEra {
/** /**
* @description Override the encoded length method * @description Override the encoded length method
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
return this.isImmortalEra return this.isImmortalEra
? this.asImmortalEra.encodedLength ? this.asImmortalEra.encodedLength
: this.asMortalEra.encodedLength; : this.asMortalEra.encodedLength;
@@ -277,7 +277,7 @@ export class GenericExtrinsicEra extends Enum implements IExtrinsicEra {
* @description Encodes the value as a Uint8Array as per the parity-codec specifications * @description Encodes the value as a Uint8Array as per the parity-codec specifications
* @param isBare true when the value has none of the type-specific prefixes (internal) * @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 this.isMortalEra return this.isMortalEra
? this.asMortalEra.toU8a(isBare) ? this.asMortalEra.toU8a(isBare)
: this.asImmortalEra.toU8a(isBare); : this.asImmortalEra.toU8a(isBare);
@@ -112,7 +112,7 @@ export class GenericExtrinsicPayload extends Base<ExtrinsicPayloadVx> {
/** /**
* @description Compares the value of the input to see if there is a match * @description Compares the value of the input to see if there is a match
*/ */
public eq (other?: unknown): boolean { public override eq (other?: unknown): boolean {
return this._raw.eq(other); return this._raw.eq(other);
} }
@@ -134,28 +134,28 @@ export class GenericExtrinsicPayload extends Base<ExtrinsicPayloadVx> {
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (isExtended?: boolean): AnyJson { public override toHuman (isExtended?: boolean): AnyJson {
return this._raw.toHuman(isExtended); return this._raw.toHuman(isExtended);
} }
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @description Converts the Object to JSON, typically used for RPC transfers
*/ */
public toJSON (): any { public override toJSON (): any {
return this.toHex(); return this.toHex();
} }
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return this.toHex(); return this.toHex();
} }
/** /**
* @description Returns a serialized u8a form * @description Returns a serialized u8a form
*/ */
public toU8a (isBare?: BareOpts): Uint8Array { public override toU8a (isBare?: BareOpts): Uint8Array {
// call our parent, with only the method stripped // call our parent, with only the method stripped
return super.toU8a(isBare ? { method: true } : false); return super.toU8a(isBare ? { method: true } : false);
} }
+1 -1
View File
@@ -54,7 +54,7 @@ export class GenericExtrinsicV4 extends Struct implements IExtrinsicImpl {
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
return this.toU8a().length; return this.toU8a().length;
} }
@@ -58,7 +58,7 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
return this.isSigned return this.isSigned
? super.encodedLength ? super.encodedLength
: 0; : 0;
@@ -181,7 +181,7 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
* @description Encodes the value as a Uint8Array as per the SCALE specifications * @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) * @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 this.isSigned return this.isSigned
? super.toU8a(isBare) ? super.toU8a(isBare)
: EMPTY_U8A; : EMPTY_U8A;
+8 -8
View File
@@ -14,10 +14,10 @@ function decodeAccountId (value?: AnyU8a | AnyString): Uint8Array {
return new Uint8Array(); return new Uint8Array();
} else if (isU8a(value) || Array.isArray(value)) { } else if (isU8a(value) || Array.isArray(value)) {
return u8aToU8a(value); return u8aToU8a(value);
} else if (isHex(value)) {
return hexToU8a(value);
} else if (isString(value)) { } else if (isString(value)) {
return isHex(value) return decodeAddress(value);
? hexToU8a(value.toString())
: decodeAddress((value as string).toString());
} }
throw new Error(`Unknown type passed to AccountId constructor, found typeof ${typeof value}`); throw new Error(`Unknown type passed to AccountId constructor, found typeof ${typeof value}`);
@@ -43,35 +43,35 @@ export class GenericAccountId extends U8aFixed {
/** /**
* @description Compares the value of the input to see if there is a match * @description Compares the value of the input to see if there is a match
*/ */
public eq (other?: unknown): boolean { public override eq (other?: unknown): boolean {
return super.eq(decodeAccountId(other as AnyU8a)); return super.eq(decodeAccountId(other as AnyU8a));
} }
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (): string { public override toHuman (): string {
return this.toJSON(); return this.toJSON();
} }
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @description Converts the Object to JSON, typically used for RPC transfers
*/ */
public toJSON (): string { public override toJSON (): string {
return this.toString(); return this.toString();
} }
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return encodeAddress(this, this.registry.chainSS58); return encodeAddress(this, this.registry.chainSS58);
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'AccountId'; return 'AccountId';
} }
} }
+5 -5
View File
@@ -81,7 +81,7 @@ export class GenericAccountIndex extends u32 {
/** /**
* @description Compares the value of the input to see if there is a match * @description Compares the value of the input to see if there is a match
*/ */
public eq (other?: unknown): boolean { public override eq (other?: unknown): boolean {
// shortcut for BN or Number, don't create an object // shortcut for BN or Number, don't create an object
if (isBn(other as string) || isNumber(other)) { if (isBn(other as string) || isNumber(other)) {
return super.eq(other); return super.eq(other);
@@ -94,21 +94,21 @@ export class GenericAccountIndex extends u32 {
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (): string { public override toHuman (): string {
return this.toJSON(); return this.toJSON();
} }
/** /**
* @description Converts the Object to JSON, typically used for RPC transfers * @description Converts the Object to JSON, typically used for RPC transfers
*/ */
public toJSON (): string { public override toJSON (): string {
return this.toString(); return this.toString();
} }
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
const length = GenericAccountIndex.calcLength(this); const length = GenericAccountIndex.calcLength(this);
return encodeAddress(this.toU8a().subarray(0, length), this.registry.chainSS58); return encodeAddress(this.toU8a().subarray(0, length), this.registry.chainSS58);
@@ -117,7 +117,7 @@ export class GenericAccountIndex extends u32 {
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'AccountIndex'; return 'AccountIndex';
} }
} }
+1 -1
View File
@@ -52,7 +52,7 @@ export class GenericBlock extends Struct {
/** /**
* @description Block/header [[Hash]] * @description Block/header [[Hash]]
*/ */
public get hash (): CodecHash { public override get hash (): CodecHash {
return this.header.hash; return this.header.hash;
} }
+3 -3
View File
@@ -93,7 +93,7 @@ function decodeCallViaU8a (registry: Registry, value: Uint8Array, _meta?: Functi
*/ */
function decodeCall (registry: Registry, value: unknown | DecodedMethod | Uint8Array | string = new Uint8Array(), _meta?: FunctionMetadataLatest): DecodedMethod { function decodeCall (registry: Registry, value: unknown | DecodedMethod | Uint8Array | string = new Uint8Array(), _meta?: FunctionMetadataLatest): DecodedMethod {
if (isHex(value) || isU8a(value)) { if (isHex(value) || isU8a(value)) {
return decodeCallViaU8a(registry, u8aToU8a(value as string), _meta); return decodeCallViaU8a(registry, u8aToU8a(value), _meta);
} else if (isObject(value) && value.callIndex && value.args) { } else if (isObject(value) && value.callIndex && value.args) {
return decodeCallViaObject(registry, value as DecodedMethod, _meta); return decodeCallViaObject(registry, value as DecodedMethod, _meta);
} }
@@ -216,7 +216,7 @@ export class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implement
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (isExpanded?: boolean): Record<string, AnyJson> { public override toHuman (isExpanded?: boolean): Record<string, AnyJson> {
let call: CallFunction | undefined; let call: CallFunction | undefined;
try { try {
@@ -244,7 +244,7 @@ export class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implement
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'Call'; return 'Call';
} }
} }
@@ -103,21 +103,21 @@ export class GenericConsensusEngineId extends U8aFixed {
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (): string { public override toHuman (): string {
return this.toString(); return this.toString();
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'ConsensusEngineId'; return 'ConsensusEngineId';
} }
/** /**
* @description Override the default toString to return a 4-byte string * @description Override the default toString to return a 4-byte string
*/ */
public toString (): string { public override toString (): string {
return this.isAscii return this.isAscii
? u8aToString(this) ? u8aToString(this)
: u8aToHex(this); : u8aToHex(this);
+27 -19
View File
@@ -10,6 +10,31 @@ import { Struct } from '../codec/Struct';
import { Tuple } from '../codec/Tuple'; import { Tuple } from '../codec/Tuple';
import { Null } from '../primitive/Null'; import { Null } from '../primitive/Null';
interface Decoded {
DataType: Constructor<Null> | Constructor<GenericEventData>;
value?: {
index: Uint8Array;
data: Uint8Array;
}
}
/** @internal */
function decodeEvent (registry: Registry, value?: Uint8Array): Decoded {
if (!value || !value.length) {
return { DataType: Null };
}
const index = value.subarray(0, 2);
return {
DataType: registry.findMetaEvent(index),
value: {
data: value.subarray(2),
index
}
};
}
/** /**
* @name GenericEventData * @name GenericEventData
* @description * @description
@@ -72,7 +97,7 @@ export class GenericEvent extends Struct implements IEvent<Codec[]> {
// Currently we _only_ decode from Uint8Array, since we expect it to // Currently we _only_ decode from Uint8Array, since we expect it to
// be used via EventRecord // be used via EventRecord
constructor (registry: Registry, _value?: Uint8Array) { constructor (registry: Registry, _value?: Uint8Array) {
const { DataType, value } = GenericEvent.decodeEvent(registry, _value); const { DataType, value } = decodeEvent(registry, _value);
super(registry, { super(registry, {
index: 'EventId', index: 'EventId',
@@ -81,23 +106,6 @@ export class GenericEvent extends Struct implements IEvent<Codec[]> {
}, value); }, value);
} }
/** @internal */
public static decodeEvent (registry: Registry, value: Uint8Array = new Uint8Array()): { DataType: Constructor<Null> | Constructor<GenericEventData>; value?: { index: Uint8Array; data: Uint8Array } } {
if (!value.length) {
return { DataType: Null };
}
const index = value.subarray(0, 2);
return {
DataType: registry.findMetaEvent(index),
value: {
data: value.subarray(2),
index
}
};
}
/** /**
* @description The wrapped [[EventData]] * @description The wrapped [[EventData]]
*/ */
@@ -143,7 +151,7 @@ export class GenericEvent extends Struct implements IEvent<Codec[]> {
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (isExpanded?: boolean): Record<string, AnyJson> { public override toHuman (isExpanded?: boolean): Record<string, AnyJson> {
return { return {
method: this.method, method: this.method,
section: this.section, section: this.section,
+4 -4
View File
@@ -69,7 +69,7 @@ export class GenericLookupSource extends Base<GenericAccountId | GenericAccountI
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
const rawLength = this._rawLength; const rawLength = this._rawLength;
return rawLength + ( return rawLength + (
@@ -92,14 +92,14 @@ export class GenericLookupSource extends Base<GenericAccountId | GenericAccountI
/** /**
* @description Returns a hex string representation of the value * @description Returns a hex string representation of the value
*/ */
public toHex (): string { public override toHex (): string {
return u8aToHex(this.toU8a()); return u8aToHex(this.toU8a());
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'Address'; return 'Address';
} }
@@ -107,7 +107,7 @@ export class GenericLookupSource extends Base<GenericAccountId | GenericAccountI
* @description Encodes the value as a Uint8Array as per the SCALE specifications * @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) * @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 {
const encoded = this._raw.toU8a().subarray(0, this._rawLength); const encoded = this._raw.toU8a().subarray(0, this._rawLength);
return isBare return isBare
+1 -1
View File
@@ -54,7 +54,7 @@ export class GenericMultiAddress extends Enum {
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return this.value.toString(); return this.value.toString();
} }
} }
+2 -2
View File
@@ -105,7 +105,7 @@ export class GenericVote extends U8aFixed {
/** /**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/ */
public toHuman (isExpanded?: boolean): AnyJson { public override toHuman (isExpanded?: boolean): AnyJson {
return { return {
conviction: this.conviction.toHuman(isExpanded), conviction: this.conviction.toHuman(isExpanded),
vote: this.isAye ? 'Aye' : 'Nay' vote: this.isAye ? 'Aye' : 'Nay'
@@ -115,7 +115,7 @@ export class GenericVote extends U8aFixed {
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'Vote'; return 'Vote';
} }
} }
@@ -15,7 +15,7 @@ const deprecated = {
}; };
const phragmen = { const phragmen = {
CompactAssignments: 'CompactAssignmentsWith24', CompactAssignments: 'CompactAssignmentsWith16',
CompactAssignmentsWith16: { CompactAssignmentsWith16: {
votes1: 'Vec<(NominatorIndexCompact, ValidatorIndexCompact)>', votes1: 'Vec<(NominatorIndexCompact, ValidatorIndexCompact)>',
votes2: 'Vec<(NominatorIndexCompact, CompactScoreCompact, ValidatorIndexCompact)>', votes2: 'Vec<(NominatorIndexCompact, CompactScoreCompact, ValidatorIndexCompact)>',
@@ -111,7 +111,7 @@ const phragmen = {
} }
}, },
ExtendedBalance: 'u128', ExtendedBalance: 'u128',
RawSolution: 'RawSolutionWith24', RawSolution: 'RawSolutionWith16',
RawSolutionWith16: { RawSolutionWith16: {
compact: 'CompactAssignmentsWith16', compact: 'CompactAssignmentsWith16',
score: 'ElectionScore', score: 'ElectionScore',
@@ -12,7 +12,7 @@ export interface ActiveEraInfo extends Struct {
} }
/** @name CompactAssignments */ /** @name CompactAssignments */
export interface CompactAssignments extends CompactAssignmentsWith24 {} export interface CompactAssignments extends CompactAssignmentsWith16 {}
/** @name CompactAssignmentsTo257 */ /** @name CompactAssignmentsTo257 */
export interface CompactAssignmentsTo257 extends Struct { export interface CompactAssignmentsTo257 extends Struct {
@@ -207,7 +207,7 @@ export interface PhragmenScore extends Vec<u128> {}
export interface Points extends u32 {} export interface Points extends u32 {}
/** @name RawSolution */ /** @name RawSolution */
export interface RawSolution extends RawSolutionWith24 {} export interface RawSolution extends RawSolutionWith16 {}
/** @name RawSolutionTo265 */ /** @name RawSolutionTo265 */
export interface RawSolutionTo265 extends RawSolutionWith16 {} export interface RawSolutionTo265 extends RawSolutionWith16 {}
@@ -27,7 +27,8 @@ export default {
}, },
DestroyWitness: { DestroyWitness: {
instances: 'Compact<u32>', instances: 'Compact<u32>',
instanceMetadatas: 'Compact<u32>' instanceMetadatas: 'Compact<u32>',
attributes: 'Compact<u32>'
}, },
InstanceDetails: { InstanceDetails: {
owner: 'AccountId', owner: 'AccountId',
@@ -37,14 +38,12 @@ export default {
}, },
ClassMetadata: { ClassMetadata: {
deposit: 'DepositBalance', deposit: 'DepositBalance',
name: 'Vec<u8>', data: 'Vec<u8>',
information: 'Vec<u8>',
isFrozen: 'bool' isFrozen: 'bool'
}, },
InstanceMetadata: { InstanceMetadata: {
deposit: 'DepositBalance', deposit: 'DepositBalance',
name: 'Vec<u8>', data: 'Vec<u8>',
information: 'Vec<u8>',
isFrozen: 'bool' isFrozen: 'bool'
} }
} }
@@ -24,8 +24,7 @@ export interface ClassId extends u32 {}
/** @name ClassMetadata */ /** @name ClassMetadata */
export interface ClassMetadata extends Struct { export interface ClassMetadata extends Struct {
readonly deposit: DepositBalance; readonly deposit: DepositBalance;
readonly name: Bytes; readonly data: Bytes;
readonly information: Bytes;
readonly isFrozen: bool; readonly isFrozen: bool;
} }
@@ -39,6 +38,7 @@ export interface DepositBalanceOf extends Balance {}
export interface DestroyWitness extends Struct { export interface DestroyWitness extends Struct {
readonly instances: Compact<u32>; readonly instances: Compact<u32>;
readonly instanceMetadatas: Compact<u32>; readonly instanceMetadatas: Compact<u32>;
readonly attributes: Compact<u32>;
} }
/** @name InstanceDetails */ /** @name InstanceDetails */
@@ -55,8 +55,7 @@ export interface InstanceId extends u32 {}
/** @name InstanceMetadata */ /** @name InstanceMetadata */
export interface InstanceMetadata extends Struct { export interface InstanceMetadata extends Struct {
readonly deposit: DepositBalance; readonly deposit: DepositBalance;
readonly name: Bytes; readonly data: Bytes;
readonly information: Bytes;
readonly isFrozen: bool; readonly isFrozen: bool;
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit // Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types', version: '4.15.1' }; export const packageInfo = { name: '@polkadot/types', version: '4.16.2' };
+4 -4
View File
@@ -53,18 +53,18 @@ export class BitVec extends Raw {
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
return this.length + compactToU8a(this._decodedLength).length; return this.length + compactToU8a(this._decodedLength).length;
} }
public toHuman (): string { public override toHuman (): string {
return `0b${[...this.toU8a(true)].map((d) => `00000000${d.toString(2)}`.slice(-8)).join('_')}`; return `0b${[...this.toU8a(true)].map((d) => `00000000${d.toString(2)}`.slice(-8)).join('_')}`;
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'BitVec'; return 'BitVec';
} }
@@ -72,7 +72,7 @@ export class BitVec extends Raw {
* @description Encodes the value as a Uint8Array as per the SCALE specifications * @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) * @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 {
const bitVec = super.toU8a(); const bitVec = super.toU8a();
return isBare return isBare
+1 -1
View File
@@ -112,7 +112,7 @@ export class bool extends Boolean implements Codec {
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return this.toJSON().toString(); return this.toJSON().toString();
} }
+3 -3
View File
@@ -54,14 +54,14 @@ export class Bytes extends Raw {
/** /**
* @description The length of the value when encoded as a Uint8Array * @description The length of the value when encoded as a Uint8Array
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
return this.length + compactToU8a(this.length).length; return this.length + compactToU8a(this.length).length;
} }
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'Bytes'; return 'Bytes';
} }
@@ -69,7 +69,7 @@ export class Bytes extends Raw {
* @description Encodes the value as a Uint8Array as per the SCALE specifications * @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) * @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 isBare return isBare
? super.toU8a(isBare) ? super.toU8a(isBare)
: compactAddLength(this); : compactAddLength(this);
+13 -13
View File
@@ -61,61 +61,61 @@ export class Data extends Enum {
assert(!this.isRaw || this.asRaw.length <= 32, 'Data.Raw values are limited to a maximum length of 32 bytes'); assert(!this.isRaw || this.asRaw.length <= 32, 'Data.Raw values are limited to a maximum length of 32 bytes');
} }
get asBlakeTwo256 (): H256 { public get asBlakeTwo256 (): H256 {
return this.value as H256; return this.value as H256;
} }
get asKeccak256 (): H256 { public get asKeccak256 (): H256 {
return this.value as H256; return this.value as H256;
} }
get asRaw (): Bytes { public get asRaw (): Bytes {
return this.value as Bytes; return this.value as Bytes;
} }
get asSha256 (): H256 { public get asSha256 (): H256 {
return this.value as H256; return this.value as H256;
} }
get asShaThree256 (): H256 { public get asShaThree256 (): H256 {
return this.value as H256; return this.value as H256;
} }
get isBlakeTwo256 (): boolean { public get isBlakeTwo256 (): boolean {
return this.index === 2; return this.index === 2;
} }
get isKeccak256 (): boolean { public get isKeccak256 (): boolean {
return this.index === 4; return this.index === 4;
} }
get isNone (): boolean { public override get isNone (): boolean {
return this.index === 0; return this.index === 0;
} }
get isRaw (): boolean { public get isRaw (): boolean {
return this.index === 1; return this.index === 1;
} }
get isSha256 (): boolean { public get isSha256 (): boolean {
return this.index === 3; return this.index === 3;
} }
get isShaThree256 (): boolean { public get isShaThree256 (): boolean {
return this.index === 5; return this.index === 5;
} }
/** /**
* @description The encoded length * @description The encoded length
*/ */
public get encodedLength (): number { public override get encodedLength (): number {
return this.toU8a().length; return this.toU8a().length;
} }
/** /**
* @description Encodes the value as a Uint8Array as per the SCALE specifications * @description Encodes the value as a Uint8Array as per the SCALE specifications
*/ */
public toU8a (): Uint8Array { public override toU8a (): Uint8Array {
if (this.index === 0) { if (this.index === 0) {
return new Uint8Array(1); return new Uint8Array(1);
} else if (this.index === 1) { } else if (this.index === 1) {
+2 -2
View File
@@ -252,7 +252,7 @@ export class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements
/** /**
* @description Returns the Human representation for this type * @description Returns the Human representation for this type
*/ */
public toHuman (): AnyJson { public override toHuman (): AnyJson {
return this._args.length return this._args.length
? this._args.map((arg) => arg.toHuman()) ? this._args.map((arg) => arg.toHuman())
: super.toHuman(); : super.toHuman();
@@ -261,7 +261,7 @@ export class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements
/** /**
* @description Returns the raw type for this * @description Returns the raw type for this
*/ */
public toRawType (): string { public override toRawType (): string {
return 'StorageKey'; return 'StorageKey';
} }
} }
+3 -3
View File
@@ -13,7 +13,7 @@ const MAX_LENGTH = 128 * 1024;
/** @internal */ /** @internal */
function decodeText (value?: null | Text | string | AnyU8a | { toString: () => string }): string { function decodeText (value?: null | Text | string | AnyU8a | { toString: () => string }): string {
if (isHex(value)) { if (isHex(value)) {
return u8aToString(hexToU8a(value.toString())); return u8aToString(hexToU8a(value));
} else if (value instanceof Uint8Array) { } else if (value instanceof Uint8Array) {
if (!value.length) { if (!value.length) {
return ''; return '';
@@ -84,7 +84,7 @@ export class Text extends String implements Codec {
/** /**
* @description The length of the value * @description The length of the value
*/ */
public get length (): number { public override get length (): number {
// only included here since we ignore inherited docs // only included here since we ignore inherited docs
return super.length; return super.length;
} }
@@ -138,7 +138,7 @@ export class Text extends String implements Codec {
/** /**
* @description Returns the string representation of the value * @description Returns the string representation of the value
*/ */
public toString (): string { public override toString (): string {
return this.#override || super.toString(); return this.#override || super.toString();
} }
+1 -1
View File
@@ -23,7 +23,7 @@ export class Type extends Text {
/** /**
* @description Returns the base runtime type name for this instance * @description Returns the base runtime type name for this instance
*/ */
public toRawType (): string { public override toRawType (): string {
return 'Type'; return 'Type';
} }
} }
+477 -536
View File
File diff suppressed because it is too large Load Diff