Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf2c560db5 | ||
|
|
63189a6196 | ||
|
|
9990690332 | ||
|
|
ee163cc342 | ||
|
|
cf27f7e11b | ||
|
|
12986865c8 | ||
|
|
aac0fc741a | ||
|
|
c33f95d64b | ||
|
|
eb7255b34f | ||
|
|
3982798d5e | ||
|
|
ded1ebd4e7 | ||
|
|
c261d4e333 | ||
|
|
7b1400e238 | ||
|
|
7c2048bc6b | ||
|
|
2b1d5664fe | ||
|
|
5403686e20 | ||
|
|
e90c72fc8b | ||
|
|
1910ef54a4 | ||
|
|
45686f9482 | ||
|
|
a6b0d214af | ||
|
|
2a1a2a936b | ||
|
|
060275d1ae | ||
|
|
abb54d2538 | ||
|
|
98fc472a40 | ||
|
|
4034429042 | ||
|
|
ca212b8736 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
30
|
||||
31
|
||||
1.4.2
|
||||
1.6.2
|
||||
1.11.2
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 4.16.1 Jun 26, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for full from-genesis queries on Kusama.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Adjust types for uniques (Thanks to https://github.com/Yuripetusko)
|
||||
|
||||
Changes:
|
||||
|
||||
- Add Kusama, Polkadot & Westend 9050 upgrade blocks
|
||||
- Add Kusama & Westend 9070 upgrade blocks
|
||||
- Adjust API decoration to lazy-create event and storage types
|
||||
- Use TS `override` as applicable (with `--noImplicitOverrides` option)
|
||||
- Add missing historic `Heartbeat: HeartbeatTo244` mapping to Kusama
|
||||
- Remove duplication from contracts registry
|
||||
- Add explicit check for scale-info 0.7+ (contracts index lookups)
|
||||
- Align static metadata with latest Substrate
|
||||
|
||||
|
||||
## 4.15.1 Jun 19, 2021
|
||||
|
||||
Upgrade priority: Medium. Recommended for all chains where Xcm is used (addition of new `XcmOrigin`)
|
||||
|
||||
+6
-6
@@ -8,7 +8,7 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"typescript": "^4.3.2"
|
||||
"typescript": "^4.3.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||
@@ -25,14 +25,14 @@
|
||||
"test:watch": "polkadot-dev-run-test --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.5",
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/register": "^7.14.5",
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/dev": "^0.62.42",
|
||||
"@polkadot/ts": "^0.3.90",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/dev": "^0.62.43",
|
||||
"@polkadot/ts": "^0.4.1",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^26.0.23",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"version": "4.15.1"
|
||||
"version": "4.16.1"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
@@ -19,10 +19,10 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/api": "4.15.1",
|
||||
"@polkadot/types": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1",
|
||||
"@polkadot/x-rxjs": "^6.9.1"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ function findMessage <T extends AbiMessage> (list: T[], messageOrId: T | string
|
||||
? list.find(({ identifier }) => [identifier, stringCamelCase(identifier)].includes(messageOrId.toString()))
|
||||
: messageOrId;
|
||||
|
||||
return assertReturn(message, `Attempted to call an invalid contract interface, ${stringify(messageOrId)}`);
|
||||
return assertReturn(message, () => `Attempted to call an invalid contract interface, ${stringify(messageOrId)}`);
|
||||
}
|
||||
|
||||
export class Abi {
|
||||
@@ -127,7 +127,7 @@ export class Abi {
|
||||
const args = this.#createArgs(spec.args, spec);
|
||||
const event = {
|
||||
args,
|
||||
docs: spec.docs.map((doc) => doc.toString()),
|
||||
docs: spec.docs.map((d) => d.toString()),
|
||||
fromU8a: (data: Uint8Array): DecodedEvent => ({
|
||||
args: this.#decodeArgs(args, data),
|
||||
event
|
||||
@@ -145,7 +145,7 @@ export class Abi {
|
||||
const message = {
|
||||
...add,
|
||||
args,
|
||||
docs: spec.docs.map((doc) => doc.toString()),
|
||||
docs: spec.docs.map((d) => d.toString()),
|
||||
fromU8a: (data: Uint8Array): DecodedMessage => ({
|
||||
args: this.#decodeArgs(args, data),
|
||||
message
|
||||
|
||||
@@ -35,8 +35,10 @@ export class MetaRegistry extends TypeRegistry {
|
||||
constructor (metadataVersion: string, chainProperties?: ChainProperties) {
|
||||
super();
|
||||
|
||||
// type indexes are 1-based pre-1.0 and 0-based post-1.0
|
||||
this.typeOffset = metadataVersion.split('.')[0] === '0' ? 1 : 0;
|
||||
const [major, minor] = metadataVersion.split('.').map((n) => parseInt(n, 10));
|
||||
|
||||
// type indexes are 1-based pre 0.7 and 0-based post
|
||||
this.typeOffset = (major === 0 && minor < 7) ? 1 : 0;
|
||||
|
||||
if (chainProperties) {
|
||||
this.setChainProperties(chainProperties);
|
||||
@@ -124,7 +126,7 @@ export class MetaRegistry extends TypeRegistry {
|
||||
: {}
|
||||
),
|
||||
...(path.length > 1
|
||||
? { namespace: path.map((segment) => segment.toString()).join('::') }
|
||||
? { namespace: path.map((s) => s.toString()).join('::') }
|
||||
: {}
|
||||
),
|
||||
...(type.params.length > 0
|
||||
@@ -154,15 +156,13 @@ export class MetaRegistry extends TypeRegistry {
|
||||
|
||||
assert(isTuple || isStruct, 'Invalid fields type detected, expected either Tuple or Struct');
|
||||
|
||||
const sub = fields.map(({ name, type }) => {
|
||||
return {
|
||||
...this.getMetaTypeDef({ type }),
|
||||
...(name.isSome
|
||||
? { name: name.unwrap().toString() }
|
||||
: {}
|
||||
)
|
||||
};
|
||||
});
|
||||
const sub = fields.map(({ name, type }) => ({
|
||||
...this.getMetaTypeDef({ type }),
|
||||
...(name.isSome
|
||||
? { name: name.unwrap().toString() }
|
||||
: {}
|
||||
)
|
||||
}));
|
||||
|
||||
return isTuple && sub.length === 1
|
||||
? sub[0]
|
||||
@@ -213,32 +213,28 @@ export class MetaRegistry extends TypeRegistry {
|
||||
const { params, path } = this.#getMetaType(id);
|
||||
const specialVariant = path[0].toString();
|
||||
|
||||
if (specialVariant === 'Option') {
|
||||
return {
|
||||
return specialVariant === 'Option'
|
||||
? {
|
||||
info: TypeDefInfo.Option,
|
||||
sub: this.getMetaTypeDef({ type: params[0] })
|
||||
};
|
||||
} else if (specialVariant === 'Result') {
|
||||
return {
|
||||
info: TypeDefInfo.Result,
|
||||
sub: params.map((type, index) => ({
|
||||
name: ['Ok', 'Error'][index],
|
||||
...this.getMetaTypeDef({ type })
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
info: TypeDefInfo.Enum,
|
||||
sub: this.#extractVariantSub(variants)
|
||||
};
|
||||
}
|
||||
: specialVariant === 'Result'
|
||||
? {
|
||||
info: TypeDefInfo.Result,
|
||||
sub: params.map((type, index) => ({
|
||||
name: ['Ok', 'Error'][index],
|
||||
...this.getMetaTypeDef({ type })
|
||||
}))
|
||||
}
|
||||
: {
|
||||
info: TypeDefInfo.Enum,
|
||||
sub: this.#extractVariantSub(variants)
|
||||
};
|
||||
}
|
||||
|
||||
#extractVariantSub = (variants: SiVariant[]): TypeDef[] => {
|
||||
const isAllUnitVariants = variants.every(({ fields }) => fields.length === 0);
|
||||
|
||||
if (isAllUnitVariants) {
|
||||
return variants.map(({ discriminant, name }) => ({
|
||||
return variants.every(({ fields }) => fields.length === 0)
|
||||
? variants.map(({ discriminant, name }) => ({
|
||||
...(
|
||||
discriminant.isSome
|
||||
? { ext: { discriminant: discriminant.unwrap().toNumber() } }
|
||||
@@ -247,14 +243,10 @@ export class MetaRegistry extends TypeRegistry {
|
||||
info: TypeDefInfo.Plain,
|
||||
name: name.toString(),
|
||||
type: 'Null'
|
||||
}));
|
||||
}
|
||||
|
||||
return variants.map(({ fields, name }) =>
|
||||
withTypeString({
|
||||
}))
|
||||
: variants.map(({ fields, name }) => withTypeString({
|
||||
...this.#extractFields(fields),
|
||||
name: name.toString()
|
||||
})
|
||||
);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// 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.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
@@ -19,16 +19,16 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/api": "4.15.1",
|
||||
"@polkadot/rpc-core": "4.15.1",
|
||||
"@polkadot/types": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1",
|
||||
"@polkadot/util-crypto": "^6.9.1",
|
||||
"@polkadot/x-rxjs": "^6.9.1"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api": "4.16.1",
|
||||
"@polkadot/rpc-core": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.9.1",
|
||||
"@polkadot/rpc-provider": "4.15.1"
|
||||
"@polkadot/keyring": "^6.10.1",
|
||||
"@polkadot/rpc-provider": "4.16.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// 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.1' };
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
@@ -19,17 +19,17 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/api-derive": "4.15.1",
|
||||
"@polkadot/keyring": "^6.9.1",
|
||||
"@polkadot/metadata": "4.15.1",
|
||||
"@polkadot/rpc-core": "4.15.1",
|
||||
"@polkadot/rpc-provider": "4.15.1",
|
||||
"@polkadot/types": "4.15.1",
|
||||
"@polkadot/types-known": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1",
|
||||
"@polkadot/util-crypto": "^6.9.1",
|
||||
"@polkadot/x-rxjs": "^6.9.1",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api-derive": "4.16.1",
|
||||
"@polkadot/keyring": "^6.10.1",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"@polkadot/rpc-core": "4.16.1",
|
||||
"@polkadot/rpc-provider": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/types-known": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1",
|
||||
"eventemitter3": "^4.0.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,6 +551,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
[key: string]: AugmentedError<ApiType>;
|
||||
};
|
||||
electionProviderMultiPhase: {
|
||||
/**
|
||||
* The call is not allowed at this point.
|
||||
**/
|
||||
CallNotAllowed: AugmentedError<ApiType>;
|
||||
/**
|
||||
* OCW submitted solution for wrong round
|
||||
**/
|
||||
@@ -1182,6 +1186,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
* A nomination target was supplied that was blocked or otherwise not a validator.
|
||||
**/
|
||||
BadTarget: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The user has enough bond and thus cannot be chilled forcefully by an external person.
|
||||
**/
|
||||
CannotChillOther: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Duplicate index.
|
||||
**/
|
||||
@@ -1203,9 +1211,9 @@ declare module '@polkadot/api/types/errors' {
|
||||
**/
|
||||
IncorrectSlashingSpans: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Can not bond with value less than minimum balance.
|
||||
* Can not bond with value less than minimum required.
|
||||
**/
|
||||
InsufficientValue: AugmentedError<ApiType>;
|
||||
InsufficientBond: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Invalid era to reward.
|
||||
**/
|
||||
@@ -1238,10 +1246,20 @@ declare module '@polkadot/api/types/errors' {
|
||||
* Can not rebond without unlocking chunks.
|
||||
**/
|
||||
NoUnlockChunk: AugmentedError<ApiType>;
|
||||
/**
|
||||
* There are too many nominators in the system. Governance needs to adjust the staking settings
|
||||
* to keep things safe for the runtime.
|
||||
**/
|
||||
TooManyNominators: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Too many nomination targets supplied.
|
||||
**/
|
||||
TooManyTargets: AugmentedError<ApiType>;
|
||||
/**
|
||||
* There are too many validators in the system. Governance needs to adjust the staking settings
|
||||
* to keep things safe for the runtime.
|
||||
**/
|
||||
TooManyValidators: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Generic error
|
||||
**/
|
||||
|
||||
@@ -835,6 +835,10 @@ declare module '@polkadot/api/types/events' {
|
||||
* A new set of stakers was elected.
|
||||
**/
|
||||
StakingElection: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* The election failed. No new era is planned.
|
||||
**/
|
||||
StakingElectionFailed: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* An account has unbonded this amount. \[stash, amount\]
|
||||
**/
|
||||
|
||||
@@ -883,6 +883,14 @@ declare module '@polkadot/api/types/storage' {
|
||||
* canceled by extraordinary circumstances (e.g. governance).
|
||||
**/
|
||||
canceledSlashPayout: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* A tracker to keep count of the number of items in the `Nominators` map.
|
||||
**/
|
||||
counterForNominators: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* A tracker to keep count of the number of items in the `Validators` map.
|
||||
**/
|
||||
counterForValidators: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The current era index.
|
||||
*
|
||||
@@ -978,12 +986,34 @@ declare module '@polkadot/api/types/storage' {
|
||||
* Map from all (unlocked) "controller" accounts to the info regarding the staking.
|
||||
**/
|
||||
ledger: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<StakingLedger>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
/**
|
||||
* The maximum nominator count before we stop allowing new validators to join.
|
||||
*
|
||||
* When this value is not set, no limits are enforced.
|
||||
**/
|
||||
maxNominatorsCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The maximum validator count before we stop allowing new validators to join.
|
||||
*
|
||||
* When this value is not set, no limits are enforced.
|
||||
**/
|
||||
maxValidatorsCount: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Minimum number of staking participants before emergency conditions are imposed.
|
||||
**/
|
||||
minimumValidatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The minimum active bond to become and maintain the role of a nominator.
|
||||
**/
|
||||
minNominatorBond: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The minimum active bond to become and maintain the role of a validator.
|
||||
**/
|
||||
minValidatorBond: AugmentedQuery<ApiType, () => Observable<BalanceOf>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The map from nominator stash key to the set of stash keys of all validators to nominate.
|
||||
*
|
||||
* When updating this storage item, you must also update the `CounterForNominators`.
|
||||
**/
|
||||
nominators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<Nominations>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
/**
|
||||
@@ -1026,6 +1056,8 @@ declare module '@polkadot/api/types/storage' {
|
||||
validatorCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The map from (wannabe) validator stash key to the preferences of that validator.
|
||||
*
|
||||
* When updating this storage item, you must also update the `CounterForValidators`.
|
||||
**/
|
||||
validators: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ValidatorPrefs>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber,
|
||||
import type { Period, Priority } from '@polkadot/types/interfaces/scheduler';
|
||||
import type { Keys } from '@polkadot/types/interfaces/session';
|
||||
import type { SocietyJudgement } from '@polkadot/types/interfaces/society';
|
||||
import type { ElectionScore, EraIndex, RawSolution, RewardDestination, SolutionOrSnapshotSize, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
||||
import type { ElectionScore, EraIndex, RawSolution, ReadySolution, RewardDestination, SolutionOrSnapshotSize, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
||||
import type { Key } from '@polkadot/types/interfaces/system';
|
||||
import type { BountyIndex } from '@polkadot/types/interfaces/treasury';
|
||||
import type { ClassId, DestroyWitness, InstanceId } from '@polkadot/types/interfaces/uniques';
|
||||
@@ -1246,6 +1246,17 @@ declare module '@polkadot/api/types/submittable' {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
};
|
||||
electionProviderMultiPhase: {
|
||||
/**
|
||||
* Set a solution in the queue, to be handed out to the client of this pallet in the next
|
||||
* call to `ElectionProvider::elect`.
|
||||
*
|
||||
* This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`.
|
||||
*
|
||||
* The solution is not checked for any feasibility and is assumed to be trustworthy, as any
|
||||
* feasibility check itself can in principle cause the election process to fail (due to
|
||||
* memory/weight constrains).
|
||||
**/
|
||||
setEmergencyElectionResult: AugmentedSubmittable<(solution: ReadySolution | { supports?: any; score?: any; compute?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [ReadySolution]>;
|
||||
/**
|
||||
* Set a new value for `MinimumUntrustedScore`.
|
||||
*
|
||||
@@ -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.
|
||||
* - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`
|
||||
* - DbWrites: `NextKeys`, `origin account`
|
||||
* - DbWrites per key id: `KeyOwnder`
|
||||
* - DbWrites per key id: `KeyOwner`
|
||||
* # </weight>
|
||||
**/
|
||||
purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
@@ -2985,12 +2996,34 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* # </weight>
|
||||
**/
|
||||
chill: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
/**
|
||||
* Declare a `controller` as having no desire to either validator or nominate.
|
||||
*
|
||||
* Effects will be felt at the beginning of the next era.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_, but can be called by anyone.
|
||||
*
|
||||
* If the caller is the same as the controller being targeted, then no further checks
|
||||
* are enforced. However, this call can also be made by an third party user who witnesses
|
||||
* that this controller does not satisfy the minimum bond requirements to be in their role.
|
||||
*
|
||||
* This can be helpful if bond requirements are updated, and we need to remove old users
|
||||
* who do not satisfy these requirements.
|
||||
*
|
||||
**/
|
||||
chillOther: AugmentedSubmittable<(controller: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId]>;
|
||||
/**
|
||||
* Force there to be a new era at the end of the next session. After this, it will be
|
||||
* reset to normal (non-forced) behaviour.
|
||||
*
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # Warning
|
||||
*
|
||||
* The election process starts multiple blocks before the end of the era.
|
||||
* If this is called just before a new era is triggered, the election process may not
|
||||
* have enough blocks to get a result.
|
||||
*
|
||||
* # <weight>
|
||||
* - No arguments.
|
||||
* - Weight: O(1)
|
||||
@@ -3003,6 +3036,12 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # Warning
|
||||
*
|
||||
* The election process starts multiple blocks before the end of the era.
|
||||
* If this is called just before a new era is triggered, the election process may not
|
||||
* have enough blocks to get a result.
|
||||
*
|
||||
* # <weight>
|
||||
* - Weight: O(1)
|
||||
* - Write: ForceEra
|
||||
@@ -3014,6 +3053,12 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # Warning
|
||||
*
|
||||
* The election process starts multiple blocks before the end of the era.
|
||||
* Thus the election process may be ongoing when this is called. In this case the
|
||||
* election will continue until the next era is triggered.
|
||||
*
|
||||
* # <weight>
|
||||
* - No arguments.
|
||||
* - Weight: O(1)
|
||||
@@ -3254,6 +3299,9 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need
|
||||
* to be called first to remove some of the chunks (if possible).
|
||||
*
|
||||
* If a user encounters the `InsufficientBond` error when calling this extrinsic,
|
||||
* they should call `chill` first in order to free up their bonded funds.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_ by the controller, not the stash.
|
||||
* And, it can be only called when [`EraElectionStatus`] is `Closed`.
|
||||
*
|
||||
@@ -3277,6 +3325,22 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* </weight>
|
||||
**/
|
||||
unbond: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>]>;
|
||||
/**
|
||||
* Update the various staking limits this pallet.
|
||||
*
|
||||
* * `min_nominator_bond`: The minimum active bond needed to be a nominator.
|
||||
* * `min_validator_bond`: The minimum active bond needed to be a validator.
|
||||
* * `max_nominator_count`: The max number of users who can be a nominator at once.
|
||||
* When set to `None`, no limit is enforced.
|
||||
* * `max_validator_count`: The max number of users who can be a validator at once.
|
||||
* When set to `None`, no limit is enforced.
|
||||
*
|
||||
* Origin must be Root to call this function.
|
||||
*
|
||||
* NOTE: Existing nominators and validators will not be affected by this update.
|
||||
* to kick people under the new limits, `chill_other` should be called.
|
||||
**/
|
||||
updateStakingLimits: AugmentedSubmittable<(minNominatorBond: BalanceOf | AnyNumber | Uint8Array, minValidatorBond: BalanceOf | AnyNumber | Uint8Array, maxNominatorCount: Option<u32> | null | object | string | Uint8Array, maxValidatorCount: Option<u32> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [BalanceOf, BalanceOf, Option<u32>, Option<u32>]>;
|
||||
/**
|
||||
* Declare the desire to validate for the origin controller.
|
||||
*
|
||||
@@ -4077,7 +4141,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - `m = witness.instance_metdadatas`
|
||||
* - `a = witness.attributes`
|
||||
**/
|
||||
destroy: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, witness: DestroyWitness | { instances?: any; instanceMetadatas?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, DestroyWitness]>;
|
||||
destroy: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, witness: DestroyWitness | { instances?: any; instanceMetadatas?: any; attributes?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, DestroyWitness]>;
|
||||
/**
|
||||
* Alter the attributes of a given asset.
|
||||
*
|
||||
|
||||
@@ -82,13 +82,6 @@ export abstract class Getters<ApiType extends ApiTypes> extends Init<ApiType> {
|
||||
return assertResult(this._genesisHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` when subscriptions are supported
|
||||
*/
|
||||
public get hasSubscriptions (): boolean {
|
||||
return this._rpcCore.provider.hasSubscriptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description true is the underlying provider is connected
|
||||
*/
|
||||
|
||||
@@ -286,7 +286,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
}
|
||||
|
||||
// get unique types & validate
|
||||
metadata.getUniqTypes(false);
|
||||
metadata.getUniqTypes(this._options.throwOnUnknown || false);
|
||||
|
||||
return [genesisHash, metadata];
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// 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.1' };
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
import type { SubmittableExtrinsic } from '../types';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { createPair } from '@polkadot/keyring/pair';
|
||||
import { createTestKeyring } from '@polkadot/keyring/testing';
|
||||
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
||||
@@ -91,7 +93,7 @@ describe('ApiPromise', (): void => {
|
||||
super({ provider });
|
||||
}
|
||||
|
||||
protected _loadMeta (): Promise<boolean> {
|
||||
protected override _loadMeta (): Promise<boolean> {
|
||||
throw new Error('Simulate failure to load meta');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, decorate
|
||||
* @description Sign a transaction, returning the this to allow chaining, i.e. .sign(...).send(). When options, e.g. nonce/blockHash are not specified, it will be inferred. To retrieve eg. nonce use `signAsync` (the preferred interface, this is provided for backwards compatibility)
|
||||
* @deprecated
|
||||
*/
|
||||
public sign (account: IKeyringPair, optionsOrNonce?: Partial<SignerOptions>): this {
|
||||
public override sign (account: IKeyringPair, optionsOrNonce?: Partial<SignerOptions>): this {
|
||||
super.sign(account, this.#makeSignOptions(this.#optionsOrNonce(optionsOrNonce), {}));
|
||||
|
||||
return this;
|
||||
|
||||
@@ -73,6 +73,10 @@ export interface ApiOptions extends RegisteredTypes {
|
||||
* @description Throws an error when the initial connection fails (same as isReadyOrError)
|
||||
*/
|
||||
throwOnConnect?: boolean;
|
||||
/**
|
||||
* @description Throws an error when some types are unknown (useful with throwOnConnect)
|
||||
*/
|
||||
throwOnUnknown?: boolean;
|
||||
}
|
||||
|
||||
// A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { ApiPromise, WsProvider } from '@polkadot/api';
|
||||
|
||||
describe('misc online tests', (): void => {
|
||||
|
||||
@@ -7,6 +7,8 @@ import type { Option } from '@polkadot/types/codec';
|
||||
import type { AccountId, AccountIndex, AccountInfo, Address, Balance, BlockNumber, Index } from '@polkadot/types/interfaces';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { ApiPromise, WsProvider } from '@polkadot/api';
|
||||
import { memo } from '@polkadot/api-derive/util/memo';
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/metadata",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Helpers to extract information from runtime metadata",
|
||||
"main": "index.js",
|
||||
@@ -19,13 +19,13 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/types": "4.15.1",
|
||||
"@polkadot/types-known": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1",
|
||||
"@polkadot/util-crypto": "^6.9.1"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/types-known": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.9.1"
|
||||
"@polkadot/keyring": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ export class MetadataVersioned extends Struct {
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): Record<string, AnyJson> {
|
||||
public override toJSON (): Record<string, AnyJson> {
|
||||
// HACK(y): ensure that we apply the aliases if we have not done so already, this is
|
||||
// needed to ensure we have the correct overrides (which is only applied in toLatest)
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
|
||||
@@ -89,7 +89,7 @@ function extendHeadMeta (registry: Registry, { meta: { documentation, name, type
|
||||
// meta fallback only applies to actual entry values, create one for head
|
||||
(iterFn as IterFn).meta = registry.createType('StorageEntryMetadataLatest', {
|
||||
documentation,
|
||||
fallback: registry.createType('Bytes', registry.createType(outputType.toString() as 'Raw').toHex()),
|
||||
fallback: registry.createType('Bytes'),
|
||||
modifier: registry.createType('StorageEntryModifierLatest', 1), // required
|
||||
name,
|
||||
type: registry.createType('StorageEntryTypeLatest', registry.createType('Type', outputType), 0)
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/metadata', version: '4.15.1' };
|
||||
export const packageInfo = { name: '@polkadot/metadata', version: '4.16.1' };
|
||||
|
||||
@@ -2015,6 +2015,25 @@
|
||||
"",
|
||||
" This check can be turned off by setting the value to `None`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "set_emergency_election_result",
|
||||
"args": [
|
||||
{
|
||||
"name": "solution",
|
||||
"type": "ReadySolution"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Set a solution in the queue, to be handed out to the client of this pallet in the next",
|
||||
" call to `ElectionProvider::elect`.",
|
||||
"",
|
||||
" This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`.",
|
||||
"",
|
||||
" The solution is not checked for any feasibility and is assumed to be trustworthy, as any",
|
||||
" feasibility check itself can in principle cause the election process to fail (due to",
|
||||
" memory/weight constrains)."
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
@@ -2139,6 +2158,12 @@
|
||||
"documentation": [
|
||||
" OCW submitted solution for wrong round"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CallNotAllowed",
|
||||
"documentation": [
|
||||
" The call is not allowed at this point."
|
||||
]
|
||||
}
|
||||
],
|
||||
"index": 8
|
||||
@@ -2216,6 +2241,28 @@
|
||||
" Map from all locked \"stash\" accounts to the controller account."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MinNominatorBond",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"plain": "BalanceOf"
|
||||
},
|
||||
"fallback": "0x00000000000000000000000000000000",
|
||||
"documentation": [
|
||||
" The minimum active bond to become and maintain the role of a nominator."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MinValidatorBond",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"plain": "BalanceOf"
|
||||
},
|
||||
"fallback": "0x00000000000000000000000000000000",
|
||||
"documentation": [
|
||||
" The minimum active bond to become and maintain the role of a validator."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Ledger",
|
||||
"modifier": "Optional",
|
||||
@@ -2261,7 +2308,33 @@
|
||||
},
|
||||
"fallback": "0x0000",
|
||||
"documentation": [
|
||||
" The map from (wannabe) validator stash key to the preferences of that validator."
|
||||
" The map from (wannabe) validator stash key to the preferences of that validator.",
|
||||
"",
|
||||
" When updating this storage item, you must also update the `CounterForValidators`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CounterForValidators",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"plain": "u32"
|
||||
},
|
||||
"fallback": "0x00000000",
|
||||
"documentation": [
|
||||
" A tracker to keep count of the number of items in the `Validators` map."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxValidatorsCount",
|
||||
"modifier": "Optional",
|
||||
"type": {
|
||||
"plain": "u32"
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" The maximum validator count before we stop allowing new validators to join.",
|
||||
"",
|
||||
" When this value is not set, no limits are enforced."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -2277,7 +2350,33 @@
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" The map from nominator stash key to the set of stash keys of all validators to nominate."
|
||||
" The map from nominator stash key to the set of stash keys of all validators to nominate.",
|
||||
"",
|
||||
" When updating this storage item, you must also update the `CounterForNominators`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CounterForNominators",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"plain": "u32"
|
||||
},
|
||||
"fallback": "0x00000000",
|
||||
"documentation": [
|
||||
" A tracker to keep count of the number of items in the `Nominators` map."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "MaxNominatorsCount",
|
||||
"modifier": "Optional",
|
||||
"type": {
|
||||
"plain": "u32"
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" The maximum nominator count before we stop allowing new validators to join.",
|
||||
"",
|
||||
" When this value is not set, no limits are enforced."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -2613,7 +2712,7 @@
|
||||
"type": {
|
||||
"plain": "Releases"
|
||||
},
|
||||
"fallback": "0x05",
|
||||
"fallback": "0x06",
|
||||
"documentation": [
|
||||
" True if network has been upgraded to this version.",
|
||||
" Storage version of the pallet.",
|
||||
@@ -2717,6 +2816,9 @@
|
||||
" can co-exists at the same time. In that case, [`Call::withdraw_unbonded`] need",
|
||||
" to be called first to remove some of the chunks (if possible).",
|
||||
"",
|
||||
" If a user encounters the `InsufficientBond` error when calling this extrinsic,",
|
||||
" they should call `chill` first in order to free up their bonded funds.",
|
||||
"",
|
||||
" The dispatch origin for this call must be _Signed_ by the controller, not the stash.",
|
||||
" And, it can be only called when [`EraElectionStatus`] is `Closed`.",
|
||||
"",
|
||||
@@ -2980,6 +3082,12 @@
|
||||
"",
|
||||
" The dispatch origin must be Root.",
|
||||
"",
|
||||
" # Warning",
|
||||
"",
|
||||
" The election process starts multiple blocks before the end of the era.",
|
||||
" Thus the election process may be ongoing when this is called. In this case the",
|
||||
" election will continue until the next era is triggered.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" - No arguments.",
|
||||
" - Weight: O(1)",
|
||||
@@ -2996,6 +3104,12 @@
|
||||
"",
|
||||
" The dispatch origin must be Root.",
|
||||
"",
|
||||
" # Warning",
|
||||
"",
|
||||
" The election process starts multiple blocks before the end of the era.",
|
||||
" If this is called just before a new era is triggered, the election process may not",
|
||||
" have enough blocks to get a result.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" - No arguments.",
|
||||
" - Weight: O(1)",
|
||||
@@ -3055,6 +3169,12 @@
|
||||
"",
|
||||
" The dispatch origin must be Root.",
|
||||
"",
|
||||
" # Warning",
|
||||
"",
|
||||
" The election process starts multiple blocks before the end of the era.",
|
||||
" If this is called just before a new era is triggered, the election process may not",
|
||||
" have enough blocks to get a result.",
|
||||
"",
|
||||
" # <weight>",
|
||||
" - Weight: O(1)",
|
||||
" - Write: ForceEra",
|
||||
@@ -3246,6 +3366,66 @@
|
||||
" Note: Making this call only makes sense if you first set the validator preferences to",
|
||||
" block any further nominations."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "update_staking_limits",
|
||||
"args": [
|
||||
{
|
||||
"name": "min_nominator_bond",
|
||||
"type": "BalanceOf"
|
||||
},
|
||||
{
|
||||
"name": "min_validator_bond",
|
||||
"type": "BalanceOf"
|
||||
},
|
||||
{
|
||||
"name": "max_nominator_count",
|
||||
"type": "Option<u32>"
|
||||
},
|
||||
{
|
||||
"name": "max_validator_count",
|
||||
"type": "Option<u32>"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Update the various staking limits this pallet.",
|
||||
"",
|
||||
" * `min_nominator_bond`: The minimum active bond needed to be a nominator.",
|
||||
" * `min_validator_bond`: The minimum active bond needed to be a validator.",
|
||||
" * `max_nominator_count`: The max number of users who can be a nominator at once.",
|
||||
" When set to `None`, no limit is enforced.",
|
||||
" * `max_validator_count`: The max number of users who can be a validator at once.",
|
||||
" When set to `None`, no limit is enforced.",
|
||||
"",
|
||||
" Origin must be Root to call this function.",
|
||||
"",
|
||||
" NOTE: Existing nominators and validators will not be affected by this update.",
|
||||
" to kick people under the new limits, `chill_other` should be called."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chill_other",
|
||||
"args": [
|
||||
{
|
||||
"name": "controller",
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Declare a `controller` as having no desire to either validator or nominate.",
|
||||
"",
|
||||
" Effects will be felt at the beginning of the next era.",
|
||||
"",
|
||||
" The dispatch origin for this call must be _Signed_, but can be called by anyone.",
|
||||
"",
|
||||
" If the caller is the same as the controller being targeted, then no further checks",
|
||||
" are enforced. However, this call can also be made by an third party user who witnesses",
|
||||
" that this controller does not satisfy the minimum bond requirements to be in their role.",
|
||||
"",
|
||||
" This can be helpful if bond requirements are updated, and we need to remove old users",
|
||||
" who do not satisfy these requirements.",
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
@@ -3343,6 +3523,13 @@
|
||||
"documentation": [
|
||||
" A nominator has been kicked from a validator. \\[nominator, stash\\]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "StakingElectionFailed",
|
||||
"args": [],
|
||||
"documentation": [
|
||||
" The election failed. No new era is planned."
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
@@ -3435,9 +3622,9 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "InsufficientValue",
|
||||
"name": "InsufficientBond",
|
||||
"documentation": [
|
||||
" Can not bond with value less than minimum balance."
|
||||
" Can not bond with value less than minimum required."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3511,6 +3698,26 @@
|
||||
"documentation": [
|
||||
" A nomination target was supplied that was blocked or otherwise not a validator."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CannotChillOther",
|
||||
"documentation": [
|
||||
" The user has enough bond and thus cannot be chilled forcefully by an external person."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TooManyNominators",
|
||||
"documentation": [
|
||||
" There are too many nominators in the system. Governance needs to adjust the staking settings",
|
||||
" to keep things safe for the runtime."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TooManyValidators",
|
||||
"documentation": [
|
||||
" There are too many validators in the system. Governance needs to adjust the staking settings",
|
||||
" to keep things safe for the runtime."
|
||||
]
|
||||
}
|
||||
],
|
||||
"index": 9
|
||||
@@ -3657,7 +3864,7 @@
|
||||
" Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.",
|
||||
" - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`",
|
||||
" - DbWrites: `NextKeys`, `origin account`",
|
||||
" - DbWrites per key id: `KeyOwnder`",
|
||||
" - DbWrites per key id: `KeyOwner`",
|
||||
" # </weight>"
|
||||
]
|
||||
}
|
||||
@@ -7986,7 +8193,7 @@
|
||||
{
|
||||
"name": "AuthorityDiscovery",
|
||||
"storage": null,
|
||||
"calls": [],
|
||||
"calls": null,
|
||||
"events": null,
|
||||
"constants": [],
|
||||
"errors": [],
|
||||
@@ -8053,7 +8260,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"calls": [],
|
||||
"calls": null,
|
||||
"events": [
|
||||
{
|
||||
"name": "Offence",
|
||||
@@ -8101,7 +8308,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"calls": [],
|
||||
"calls": null,
|
||||
"events": null,
|
||||
"constants": [],
|
||||
"errors": [],
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-core",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
@@ -19,14 +19,14 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/metadata": "4.15.1",
|
||||
"@polkadot/rpc-provider": "4.15.1",
|
||||
"@polkadot/types": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1",
|
||||
"@polkadot/x-rxjs": "^6.9.1"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"@polkadot/rpc-provider": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.9.1"
|
||||
"@polkadot/keyring": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.15.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.16.1' };
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { of, timer } from '@polkadot/x-rxjs';
|
||||
|
||||
import { drr } from '.';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
@@ -19,18 +19,18 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/types": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1",
|
||||
"@polkadot/util-crypto": "^6.9.1",
|
||||
"@polkadot/x-fetch": "^6.9.1",
|
||||
"@polkadot/x-global": "^6.9.1",
|
||||
"@polkadot/x-ws": "^6.9.1",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1",
|
||||
"@polkadot/x-fetch": "^6.10.1",
|
||||
"@polkadot/x-global": "^6.10.1",
|
||||
"@polkadot/x-ws": "^6.10.1",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.9.1",
|
||||
"@polkadot/metadata": "4.15.1",
|
||||
"@polkadot/keyring": "^6.10.1",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^13.1.0"
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// 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.1' };
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
import type { Mock } from './../mock/types';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { mockWs } from '../../test/mockWs';
|
||||
import { WsProvider } from './';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/typegen",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Type generation scripts",
|
||||
"main": "index.js",
|
||||
@@ -26,14 +26,14 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.14.5",
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/register": "^7.14.5",
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/api": "4.15.1",
|
||||
"@polkadot/metadata": "4.15.1",
|
||||
"@polkadot/rpc-provider": "4.15.1",
|
||||
"@polkadot/types": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/api": "4.16.1",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"@polkadot/rpc-provider": "4.16.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"handlebars": "^4.7.7",
|
||||
"websocket": "^1.0.34",
|
||||
"yargs": "^17.0.1"
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// 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.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types-known",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
@@ -19,9 +19,9 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/networks": "^6.9.1",
|
||||
"@polkadot/types": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/networks": "^6.10.1",
|
||||
"@polkadot/types": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// 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.1' };
|
||||
|
||||
@@ -42,6 +42,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchError: 'DispatchErrorTo198',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -60,6 +61,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -79,6 +81,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Keys: 'SessionKeys5',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -97,6 +100,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -112,6 +116,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -126,6 +131,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Heartbeat: 'HeartbeatTo244',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259'
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
|
||||
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
|
||||
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
|
||||
[7812476, 9040]
|
||||
[7812476, 9040], [8010981, 9050], [8073833, 9070]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -8,7 +8,7 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[244358, 8], [303079, 9], [314201, 10], [342400, 11], [443963, 12],
|
||||
[528470, 13], [687751, 14], [746085, 15], [787923, 16], [799302, 17],
|
||||
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
|
||||
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30]
|
||||
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -10,7 +10,7 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
|
||||
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
|
||||
[5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030],
|
||||
[5879822, 9031], [5896856, 9032], [5897316, 9033]
|
||||
[5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types",
|
||||
"version": "4.15.1",
|
||||
"version": "4.16.1",
|
||||
"type": "module",
|
||||
"description": "Implementation of the Parity codec",
|
||||
"main": "index.js",
|
||||
@@ -19,14 +19,14 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.14.5",
|
||||
"@polkadot/metadata": "4.15.1",
|
||||
"@polkadot/util": "^6.9.1",
|
||||
"@polkadot/util-crypto": "^6.9.1",
|
||||
"@polkadot/x-rxjs": "^6.9.1"
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@polkadot/metadata": "4.16.1",
|
||||
"@polkadot/util": "^6.10.1",
|
||||
"@polkadot/util-crypto": "^6.10.1",
|
||||
"@polkadot/x-rxjs": "^6.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^6.9.1",
|
||||
"@polkadot/keyring": "^6.10.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.11.9"
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
/**
|
||||
* @description The length of the value
|
||||
*/
|
||||
public get length (): number {
|
||||
public override get length (): number {
|
||||
// only included here since we ignore inherited docs
|
||||
return super.length;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
// Overwrite the default toString representation of Array.
|
||||
const data = this.map((entry): string =>
|
||||
entry.toString()
|
||||
@@ -135,35 +135,35 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
/**
|
||||
* @description Concatenates two arrays
|
||||
*/
|
||||
public concat (other: T[]): T[] {
|
||||
public override concat (other: T[]): T[] {
|
||||
return this.toArray().concat(other instanceof AbstractArray ? other.toArray() : other);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Filters the array with the callback
|
||||
*/
|
||||
public filter (callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: unknown): T[] {
|
||||
public override filter (callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: unknown): T[] {
|
||||
return this.toArray().filter(callbackfn, thisArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Maps the array with the callback
|
||||
*/
|
||||
public map<U> (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: unknown): U[] {
|
||||
public override map<U> (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: unknown): U[] {
|
||||
return this.toArray().map(callbackfn, thisArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Checks if the array includes a specific value
|
||||
*/
|
||||
public includes (check: unknown): boolean {
|
||||
public override includes (check: unknown): boolean {
|
||||
return this.some((value: T) => value.eq(check));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns a slice of an array
|
||||
*/
|
||||
public slice (start?: number, end?: number): T[] {
|
||||
public override slice (start?: number, end?: number): T[] {
|
||||
return this.toArray().slice(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
/**
|
||||
* @description Returns the number of bits in the value
|
||||
*/
|
||||
public bitLength (): number {
|
||||
public override bitLength (): number {
|
||||
return this.#bitLength;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public eq (other?: unknown): boolean {
|
||||
public override eq (other?: unknown): boolean {
|
||||
// Here we are actually overriding the built-in .eq to take care of both
|
||||
// number and BN inputs (no `.eqn` needed) - numbers will be converted
|
||||
return super.eq(
|
||||
@@ -192,7 +192,7 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (onlyHex = false): any {
|
||||
public override toJSON (onlyHex = false): any {
|
||||
// FIXME this return type should by string | number, however BN returns string
|
||||
// Options here are
|
||||
// - super.bitLength() - the actual used bits
|
||||
@@ -218,7 +218,7 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
* @description Returns the string representation of the value
|
||||
* @param base The base to use for the conversion
|
||||
*/
|
||||
public toString (base?: number): string {
|
||||
public override toString (base?: number): string {
|
||||
// only included here since we do not inherit docs
|
||||
return super.toString(base);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ export class CodecDate extends Date implements Codec {
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): any {
|
||||
public override toJSON (): any {
|
||||
// FIXME Return type should be number, but conflicts with Date.toJSON()
|
||||
// which returns string
|
||||
return this.toNumber();
|
||||
@@ -137,7 +137,7 @@ export class CodecDate extends Date implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
// only included here since we do not inherit docs
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class Int extends AbstractInt {
|
||||
super(registry, value, bitLength);
|
||||
}
|
||||
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return typeName || super.toRawType();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ export class Json extends Map<string, any> implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,14 @@ export class Linkage<T extends Codec> extends Struct {
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return `Linkage<${this.next.toRawType(true)}>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Custom toU8a which with bare mode does not return the linkage if empty
|
||||
*/
|
||||
public toU8a (): Uint8Array {
|
||||
public override toU8a (): Uint8Array {
|
||||
// As part of a storage query (where these appear), in the case of empty, the values
|
||||
// are NOT populated by the node - follow the same logic, leaving it empty
|
||||
return this.isEmpty
|
||||
|
||||
@@ -182,7 +182,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
/**
|
||||
* @description The length of the value
|
||||
*/
|
||||
public get length (): number {
|
||||
public override get length (): number {
|
||||
// only included here since we ignore inherited docs
|
||||
return super.length;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
* @param start The position to start at
|
||||
* @param end The position to end at
|
||||
*/
|
||||
public slice (start?: number, end?: number): Uint8Array {
|
||||
public override slice (start?: number, end?: number): Uint8Array {
|
||||
// Like subarray below, we have to follow this approach since we are extending the TypeArray.
|
||||
// This happens especially when it comes to further extensions, the length may be an override
|
||||
return Uint8Array.from(this).slice(start, end);
|
||||
@@ -104,7 +104,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
* @param begin The position to start at
|
||||
* @param end The position to end at
|
||||
*/
|
||||
public subarray (begin?: number, end?: number): Uint8Array {
|
||||
public override subarray (begin?: number, end?: number): Uint8Array {
|
||||
return Uint8Array.from(this).subarray(begin, end);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return this.toHex();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
super(registry, { Ok, Err }, value);
|
||||
}
|
||||
|
||||
public static with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | keyof InterfaceTypes; Err: Constructor<E> | keyof InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
public static override with<O extends Codec, E extends Codec> (Types: { Ok: Constructor<O> | keyof InterfaceTypes; Err: Constructor<E> | keyof InterfaceTypes }): Constructor<Result<O, E>> {
|
||||
return class extends Result<O, E> {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Types.Ok, Types.Err, value);
|
||||
@@ -55,7 +55,7 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
/**
|
||||
* @description Checks if the Result has no value
|
||||
*/
|
||||
public get isEmpty (): boolean {
|
||||
public override get isEmpty (): boolean {
|
||||
return this.isOk && this.value.isEmpty;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ export class Result<O extends Codec, E extends Codec> extends Enum {
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
const Types = this._toRawStruct() as { Ok: unknown; Err: unknown };
|
||||
|
||||
return `Result<${Types.Ok as string},${Types.Err as string}>`;
|
||||
|
||||
@@ -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)
|
||||
*/
|
||||
public add = (key: string): this => {
|
||||
public override add = (key: string): this => {
|
||||
// ^^^ add = () property done to assign this instance's this, otherwise Set.add creates "some" chaos
|
||||
// we have the isUndefined(this._setValues) in here as well, add is used internally
|
||||
// in the Set constructor (so it is undefined at this point, and should allow)
|
||||
@@ -214,7 +214,7 @@ export class CodecSet extends Set<string> implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return `[${this.strings.join(', ')}]`;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef,
|
||||
*/
|
||||
function decodeStruct <T> (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<any, string>): T {
|
||||
if (isHex(value)) {
|
||||
return decodeStruct(registry, Types, hexToU8a(value.toString()), jsonMap);
|
||||
return decodeStruct(registry, Types, hexToU8a(value), jsonMap);
|
||||
} else if (isU8a(value)) {
|
||||
const keys = Object.keys(Types);
|
||||
const values = decodeU8a(registry, value, Object.values(Types), keys);
|
||||
@@ -245,7 +245,7 @@ export class Struct<
|
||||
* @description Returns a specific names entry in the structure
|
||||
* @param name The name of the entry to retrieve
|
||||
*/
|
||||
public get (name: keyof S): Codec | undefined {
|
||||
public override get (name: keyof S): Codec | undefined {
|
||||
return super.get(name);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ export class Struct<
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ export class Tuple extends AbstractArray<Codec> {
|
||||
/**
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
return this.reduce((total, entry) => total + entry.encodedLength, 0);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export class Tuple extends AbstractArray<Codec> {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
// Overwrite the default toString representation of Array.
|
||||
return stringify(this.toJSON());
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class Tuple extends AbstractArray<Codec> {
|
||||
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
public override toU8a (isBare?: boolean): Uint8Array {
|
||||
return u8aConcat(
|
||||
...this.map((entry): Uint8Array =>
|
||||
entry.toU8a(isBare)
|
||||
|
||||
@@ -43,7 +43,7 @@ export class U8aFixed extends Raw {
|
||||
super(registry, value, bitLength);
|
||||
}
|
||||
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return typeName || super.toRawType();
|
||||
}
|
||||
};
|
||||
@@ -52,7 +52,7 @@ export class U8aFixed extends Raw {
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return `[u8;${this.length}]`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export class UInt extends AbstractInt {
|
||||
super(registry, value, bitLength);
|
||||
}
|
||||
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return typeName || super.toRawType();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ export class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
/**
|
||||
* @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
|
||||
const other = _other instanceof this._Type
|
||||
? _other
|
||||
|
||||
@@ -62,11 +62,11 @@ export class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
public toU8a (): Uint8Array {
|
||||
public override toU8a (): Uint8Array {
|
||||
// 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
|
||||
const encoded = this.map((entry) => entry.toU8a());
|
||||
|
||||
@@ -40,7 +40,7 @@ function initType<T extends Codec = Codec, K extends string = string> (registry:
|
||||
if (isU8a(value)) {
|
||||
checkInstance(value, created);
|
||||
} else if (isHex(value)) {
|
||||
checkInstance(u8aToU8a(value.toString()), created);
|
||||
checkInstance(u8aToU8a(value), created);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,31 +51,32 @@ function injectErrors (_: Registry, metadata: Metadata, metadataErrors: Record<s
|
||||
|
||||
// create event classes from metadata
|
||||
function injectEvents (registry: Registry, metadata: Metadata, metadataEvents: Record<string, Constructor<GenericEventData>>): void {
|
||||
const modules = metadata.asLatest.modules;
|
||||
|
||||
// decorate the events
|
||||
modules
|
||||
metadata.asLatest.modules
|
||||
.filter(({ events }) => events.isSome)
|
||||
.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);
|
||||
|
||||
section.events.unwrap().forEach((meta, methodIndex): void => {
|
||||
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));
|
||||
let Types: Constructor<Codec>[] = [];
|
||||
let Types: Constructor<Codec>[] | null = null;
|
||||
|
||||
try {
|
||||
Types = typeDef.map((typeDef) => getTypeClass(registry, typeDef));
|
||||
} catch (error) {
|
||||
l.error(error);
|
||||
}
|
||||
// Lazy create the actual type classes right at the point of use
|
||||
const getTypes = (): Constructor<Codec>[] => {
|
||||
if (!Types) {
|
||||
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) {
|
||||
super(registry, value, Types, typeDef, meta, sectionName, methodName);
|
||||
super(registry, value, getTypes(), typeDef, meta, sectionName, methodName);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -13,9 +13,9 @@ function decodeAccountId (value: AnyU8a | AnyString): AnyU8a {
|
||||
if (isU8a(value) || Array.isArray(value)) {
|
||||
return u8aToU8a(value);
|
||||
} else if (isHex(value) || isEthereumAddress(value)) {
|
||||
return hexToU8a(value.toString());
|
||||
return hexToU8a(value);
|
||||
} else if (isString(value)) {
|
||||
return u8aToU8a((value as string).toString());
|
||||
return u8aToU8a(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
|
||||
*/
|
||||
public eq (other?: unknown): boolean {
|
||||
public override eq (other?: unknown): boolean {
|
||||
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
|
||||
*/
|
||||
public toHuman (): string {
|
||||
public override toHuman (): string {
|
||||
return this.toJSON();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): string {
|
||||
public override toJSON (): string {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return GenericEthereumAccountId.encode(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'AccountId';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export class GenericEthereumLookupSource extends Base<GenericEthereumAccountId |
|
||||
/**
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
const rawLength = this._rawLength;
|
||||
|
||||
return rawLength + (
|
||||
@@ -92,14 +92,14 @@ export class GenericEthereumLookupSource extends Base<GenericEthereumAccountId |
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public override toHex (): string {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'Address';
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export class GenericEthereumLookupSource extends Base<GenericEthereumAccountId |
|
||||
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
public override toU8a (isBare?: boolean): Uint8Array {
|
||||
const encoded = this._raw.toU8a().subarray(0, this._rawLength);
|
||||
|
||||
return isBare
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
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
|
||||
*/
|
||||
public toHex (isBare?: boolean): string {
|
||||
public override toHex (isBare?: boolean): string {
|
||||
return u8aToHex(this.toU8a(isBare));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 {
|
||||
isSigned: this.isSigned,
|
||||
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
|
||||
*/
|
||||
public toJSON (): string {
|
||||
public override toJSON (): string {
|
||||
return this.toHex();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
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
|
||||
* @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,
|
||||
// where we strip all lengths this creates an extrinsic that cannot be decoded
|
||||
const encoded = u8aConcat(new Uint8Array([this.version]), this._raw.toU8a());
|
||||
|
||||
@@ -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`
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
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
|
||||
*/
|
||||
public toHuman (): any {
|
||||
public override toHuman (): any {
|
||||
return {
|
||||
period: formatNumber(this.period),
|
||||
phase: formatNumber(this.phase)
|
||||
@@ -144,7 +144,7 @@ export class MortalEra extends Tuple {
|
||||
/**
|
||||
* @description Returns a JSON representation of the actual value
|
||||
*/
|
||||
public toJSON (): any {
|
||||
public override toJSON (): any {
|
||||
return this.toHex();
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ export class MortalEra extends Tuple {
|
||||
* `period` is.
|
||||
*/
|
||||
// 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 phase = this.phase.toNumber();
|
||||
const quantizeFactor = Math.max(period >> 12, 1);
|
||||
@@ -235,7 +235,7 @@ export class GenericExtrinsicEra extends Enum implements IExtrinsicEra {
|
||||
/**
|
||||
* @description Override the encoded length method
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
return this.isImmortalEra
|
||||
? this.asImmortalEra.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
|
||||
* @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
|
||||
? this.asMortalEra.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
|
||||
*/
|
||||
public eq (other?: unknown): boolean {
|
||||
public override eq (other?: unknown): boolean {
|
||||
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
|
||||
*/
|
||||
public toHuman (isExtended?: boolean): AnyJson {
|
||||
public override toHuman (isExtended?: boolean): AnyJson {
|
||||
return this._raw.toHuman(isExtended);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): any {
|
||||
public override toJSON (): any {
|
||||
return this.toHex();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return this.toHex();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
return super.toU8a(isBare ? { method: true } : false);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export class GenericExtrinsicV4 extends Struct implements IExtrinsicImpl {
|
||||
/**
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
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
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
return this.isSigned
|
||||
? super.encodedLength
|
||||
: 0;
|
||||
@@ -181,7 +181,7 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
|
||||
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
public override toU8a (isBare?: boolean): Uint8Array {
|
||||
return this.isSigned
|
||||
? super.toU8a(isBare)
|
||||
: EMPTY_U8A;
|
||||
|
||||
@@ -14,10 +14,10 @@ function decodeAccountId (value?: AnyU8a | AnyString): Uint8Array {
|
||||
return new Uint8Array();
|
||||
} else if (isU8a(value) || Array.isArray(value)) {
|
||||
return u8aToU8a(value);
|
||||
} else if (isHex(value)) {
|
||||
return hexToU8a(value);
|
||||
} else if (isString(value)) {
|
||||
return isHex(value)
|
||||
? hexToU8a(value.toString())
|
||||
: decodeAddress((value as string).toString());
|
||||
return decodeAddress(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
|
||||
*/
|
||||
public eq (other?: unknown): boolean {
|
||||
public override eq (other?: unknown): boolean {
|
||||
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
|
||||
*/
|
||||
public toHuman (): string {
|
||||
public override toHuman (): string {
|
||||
return this.toJSON();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): string {
|
||||
public override toJSON (): string {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return encodeAddress(this, this.registry.chainSS58);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'AccountId';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ export class GenericAccountIndex extends u32 {
|
||||
/**
|
||||
* @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
|
||||
if (isBn(other as string) || isNumber(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
|
||||
*/
|
||||
public toHuman (): string {
|
||||
public override toHuman (): string {
|
||||
return this.toJSON();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): string {
|
||||
public override toJSON (): string {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
const length = GenericAccountIndex.calcLength(this);
|
||||
|
||||
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
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'AccountIndex';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export class GenericBlock extends Struct {
|
||||
/**
|
||||
* @description Block/header [[Hash]]
|
||||
*/
|
||||
public get hash (): CodecHash {
|
||||
public override get hash (): CodecHash {
|
||||
return this.header.hash;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
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) {
|
||||
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
|
||||
*/
|
||||
public toHuman (isExpanded?: boolean): Record<string, AnyJson> {
|
||||
public override toHuman (isExpanded?: boolean): Record<string, AnyJson> {
|
||||
let call: CallFunction | undefined;
|
||||
|
||||
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
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
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
|
||||
*/
|
||||
public toHuman (): string {
|
||||
public override toHuman (): string {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'ConsensusEngineId';
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Override the default toString to return a 4-byte string
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return this.isAscii
|
||||
? u8aToString(this)
|
||||
: u8aToHex(this);
|
||||
|
||||
@@ -10,6 +10,31 @@ import { Struct } from '../codec/Struct';
|
||||
import { Tuple } from '../codec/Tuple';
|
||||
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
|
||||
* @description
|
||||
@@ -72,7 +97,7 @@ export class GenericEvent extends Struct implements IEvent<Codec[]> {
|
||||
// Currently we _only_ decode from Uint8Array, since we expect it to
|
||||
// be used via EventRecord
|
||||
constructor (registry: Registry, _value?: Uint8Array) {
|
||||
const { DataType, value } = GenericEvent.decodeEvent(registry, _value);
|
||||
const { DataType, value } = decodeEvent(registry, _value);
|
||||
|
||||
super(registry, {
|
||||
index: 'EventId',
|
||||
@@ -81,23 +106,6 @@ export class GenericEvent extends Struct implements IEvent<Codec[]> {
|
||||
}, 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]]
|
||||
*/
|
||||
@@ -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
|
||||
*/
|
||||
public toHuman (isExpanded?: boolean): Record<string, AnyJson> {
|
||||
public override toHuman (isExpanded?: boolean): Record<string, AnyJson> {
|
||||
return {
|
||||
method: this.method,
|
||||
section: this.section,
|
||||
|
||||
@@ -69,7 +69,7 @@ export class GenericLookupSource extends Base<GenericAccountId | GenericAccountI
|
||||
/**
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
const rawLength = this._rawLength;
|
||||
|
||||
return rawLength + (
|
||||
@@ -92,14 +92,14 @@ export class GenericLookupSource extends Base<GenericAccountId | GenericAccountI
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public override toHex (): string {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
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
|
||||
* @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);
|
||||
|
||||
return isBare
|
||||
|
||||
@@ -54,7 +54,7 @@ export class GenericMultiAddress extends Enum {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return this.value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
public toHuman (isExpanded?: boolean): AnyJson {
|
||||
public override toHuman (isExpanded?: boolean): AnyJson {
|
||||
return {
|
||||
conviction: this.conviction.toHuman(isExpanded),
|
||||
vote: this.isAye ? 'Aye' : 'Nay'
|
||||
@@ -115,7 +115,7 @@ export class GenericVote extends U8aFixed {
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'Vote';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ export default {
|
||||
},
|
||||
DestroyWitness: {
|
||||
instances: 'Compact<u32>',
|
||||
instanceMetadatas: 'Compact<u32>'
|
||||
instanceMetadatas: 'Compact<u32>',
|
||||
attributes: 'Compact<u32>'
|
||||
},
|
||||
InstanceDetails: {
|
||||
owner: 'AccountId',
|
||||
@@ -37,14 +38,12 @@ export default {
|
||||
},
|
||||
ClassMetadata: {
|
||||
deposit: 'DepositBalance',
|
||||
name: 'Vec<u8>',
|
||||
information: 'Vec<u8>',
|
||||
data: 'Vec<u8>',
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
InstanceMetadata: {
|
||||
deposit: 'DepositBalance',
|
||||
name: 'Vec<u8>',
|
||||
information: 'Vec<u8>',
|
||||
data: 'Vec<u8>',
|
||||
isFrozen: 'bool'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ export interface ClassId extends u32 {}
|
||||
/** @name ClassMetadata */
|
||||
export interface ClassMetadata extends Struct {
|
||||
readonly deposit: DepositBalance;
|
||||
readonly name: Bytes;
|
||||
readonly information: Bytes;
|
||||
readonly data: Bytes;
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
@@ -39,6 +38,7 @@ export interface DepositBalanceOf extends Balance {}
|
||||
export interface DestroyWitness extends Struct {
|
||||
readonly instances: Compact<u32>;
|
||||
readonly instanceMetadatas: Compact<u32>;
|
||||
readonly attributes: Compact<u32>;
|
||||
}
|
||||
|
||||
/** @name InstanceDetails */
|
||||
@@ -55,8 +55,7 @@ export interface InstanceId extends u32 {}
|
||||
/** @name InstanceMetadata */
|
||||
export interface InstanceMetadata extends Struct {
|
||||
readonly deposit: DepositBalance;
|
||||
readonly name: Bytes;
|
||||
readonly information: Bytes;
|
||||
readonly data: Bytes;
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// 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.1' };
|
||||
|
||||
@@ -53,18 +53,18 @@ export class BitVec extends Raw {
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
public toHuman (): string {
|
||||
public override toHuman (): string {
|
||||
return `0b${[...this.toU8a(true)].map((d) => `00000000${d.toString(2)}`.slice(-8)).join('_')}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'BitVec';
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ export class BitVec extends Raw {
|
||||
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
public override toU8a (isBare?: boolean): Uint8Array {
|
||||
const bitVec = super.toU8a();
|
||||
|
||||
return isBare
|
||||
|
||||
@@ -112,7 +112,7 @@ export class bool extends Boolean implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return this.toJSON().toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,14 +54,14 @@ export class Bytes extends Raw {
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'Bytes';
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export class Bytes extends Raw {
|
||||
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
public override toU8a (isBare?: boolean): Uint8Array {
|
||||
return isBare
|
||||
? super.toU8a(isBare)
|
||||
: compactAddLength(this);
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
get asBlakeTwo256 (): H256 {
|
||||
public get asBlakeTwo256 (): H256 {
|
||||
return this.value as H256;
|
||||
}
|
||||
|
||||
get asKeccak256 (): H256 {
|
||||
public get asKeccak256 (): H256 {
|
||||
return this.value as H256;
|
||||
}
|
||||
|
||||
get asRaw (): Bytes {
|
||||
public get asRaw (): Bytes {
|
||||
return this.value as Bytes;
|
||||
}
|
||||
|
||||
get asSha256 (): H256 {
|
||||
public get asSha256 (): H256 {
|
||||
return this.value as H256;
|
||||
}
|
||||
|
||||
get asShaThree256 (): H256 {
|
||||
public get asShaThree256 (): H256 {
|
||||
return this.value as H256;
|
||||
}
|
||||
|
||||
get isBlakeTwo256 (): boolean {
|
||||
public get isBlakeTwo256 (): boolean {
|
||||
return this.index === 2;
|
||||
}
|
||||
|
||||
get isKeccak256 (): boolean {
|
||||
public get isKeccak256 (): boolean {
|
||||
return this.index === 4;
|
||||
}
|
||||
|
||||
get isNone (): boolean {
|
||||
public override get isNone (): boolean {
|
||||
return this.index === 0;
|
||||
}
|
||||
|
||||
get isRaw (): boolean {
|
||||
public get isRaw (): boolean {
|
||||
return this.index === 1;
|
||||
}
|
||||
|
||||
get isSha256 (): boolean {
|
||||
public get isSha256 (): boolean {
|
||||
return this.index === 3;
|
||||
}
|
||||
|
||||
get isShaThree256 (): boolean {
|
||||
public get isShaThree256 (): boolean {
|
||||
return this.index === 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The encoded length
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
public override get encodedLength (): number {
|
||||
return this.toU8a().length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Encodes the value as a Uint8Array as per the SCALE specifications
|
||||
*/
|
||||
public toU8a (): Uint8Array {
|
||||
public override toU8a (): Uint8Array {
|
||||
if (this.index === 0) {
|
||||
return new Uint8Array(1);
|
||||
} else if (this.index === 1) {
|
||||
|
||||
@@ -252,7 +252,7 @@ export class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements
|
||||
/**
|
||||
* @description Returns the Human representation for this type
|
||||
*/
|
||||
public toHuman (): AnyJson {
|
||||
public override toHuman (): AnyJson {
|
||||
return this._args.length
|
||||
? this._args.map((arg) => arg.toHuman())
|
||||
: super.toHuman();
|
||||
@@ -261,7 +261,7 @@ export class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements
|
||||
/**
|
||||
* @description Returns the raw type for this
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'StorageKey';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ const MAX_LENGTH = 128 * 1024;
|
||||
/** @internal */
|
||||
function decodeText (value?: null | Text | string | AnyU8a | { toString: () => string }): string {
|
||||
if (isHex(value)) {
|
||||
return u8aToString(hexToU8a(value.toString()));
|
||||
return u8aToString(hexToU8a(value));
|
||||
} else if (value instanceof Uint8Array) {
|
||||
if (!value.length) {
|
||||
return '';
|
||||
@@ -84,7 +84,7 @@ export class Text extends String implements Codec {
|
||||
/**
|
||||
* @description The length of the value
|
||||
*/
|
||||
public get length (): number {
|
||||
public override get length (): number {
|
||||
// only included here since we ignore inherited docs
|
||||
return super.length;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ export class Text extends String implements Codec {
|
||||
/**
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public toString (): string {
|
||||
public override toString (): string {
|
||||
return this.#override || super.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export class Type extends Text {
|
||||
/**
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
public override toRawType (): string {
|
||||
return 'Type';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user