Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeff764345 | ||
|
|
4870ec4f40 | ||
|
|
1c3cfbfa0c | ||
|
|
3c9b7de6c7 | ||
|
|
22e5488f16 | ||
|
|
b37887993e | ||
|
|
75361cb0ff | ||
|
|
894992bc4c | ||
|
|
d955fab169 | ||
|
|
580d225387 | ||
|
|
d48f59e48d | ||
|
|
108b49ea03 | ||
|
|
9295349886 | ||
|
|
a51658ffac | ||
|
|
47f08e9e04 | ||
|
|
7906ae63dc | ||
|
|
0e76271dba | ||
|
|
e117619e34 | ||
|
|
67b416fe80 | ||
|
|
78dbfa46fa | ||
|
|
01db9261d5 | ||
|
|
674c38b384 | ||
|
|
0700e824eb | ||
|
|
0362eaf472 | ||
|
|
696b3964e6 | ||
|
|
5d0c2eed7b | ||
|
|
e4c3289ad8 | ||
|
|
4449bdae6f | ||
|
|
064957db81 | ||
|
|
ccd89ef0a6 | ||
|
|
47beb5f41f | ||
|
|
9f205392a3 | ||
|
|
adce7ccbee | ||
|
|
b83b3a9437 | ||
|
|
147dbcf24f | ||
|
|
2afff1b41f |
File diff suppressed because one or more lines are too long
+1
-1
@@ -10,4 +10,4 @@ plugins:
|
|||||||
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
|
||||||
spec: "@yarnpkg/plugin-version"
|
spec: "@yarnpkg/plugin-version"
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-2.4.0.cjs
|
yarnPath: .yarn/releases/yarn-2.4.1.cjs
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 4.0.1 Mar 7, 2021
|
||||||
|
|
||||||
|
Upgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
|
||||||
|
|
||||||
|
**Important** In the 4.0 version the default package type has been changed to ESM modules by default. This should not affect usage, however since the output formats changed, a new major version is required.
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Expose `unknownTypes` on the registry interface (Thanks to https://github.com/ii-ii-ii)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Build to ESM by default (with cjs versions via export map)
|
||||||
|
- Enum `.toSON()` now encodes all keys as `camelCase` (aligning with the output from Substrate)
|
||||||
|
- Add `createdAtHash?: Hash` to `Codec` interface (filled-in by storage retrievals)
|
||||||
|
- Expose the source hash as `wamHash` on Abi parsed instances
|
||||||
|
- Use `parentHash` when creating mortal era (handles frequent forks better)
|
||||||
|
- Add `AccountInfoWithTripleRefCount` to cater for latest Substrate
|
||||||
|
- Add upgrade block for Westend 49
|
||||||
|
|
||||||
|
|
||||||
## 3.11.1 Feb 28, 2021
|
## 3.11.1 Feb 28, 2021
|
||||||
|
|
||||||
Upgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
|
Upgrade priority: Low. Recommended for users wanting to keep updated with chain changes.
|
||||||
|
|||||||
@@ -26,5 +26,5 @@ module.exports = Object.assign({}, config, {
|
|||||||
'<rootDir>/packages/types/build',
|
'<rootDir>/packages/types/build',
|
||||||
'<rootDir>/packages/types-known/build'
|
'<rootDir>/packages/types-known/build'
|
||||||
],
|
],
|
||||||
resolver: '@polkadot/dev/config/jest-resolver.cjs'
|
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/|rxjs/_esm5)']
|
||||||
});
|
});
|
||||||
+5
-5
@@ -8,7 +8,7 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"typescript": "^4.1.5"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||||
@@ -27,12 +27,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.13.8",
|
"@babel/core": "^7.13.8",
|
||||||
"@babel/register": "^7.13.8",
|
"@babel/register": "^7.13.8",
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/dev": "^0.61.30",
|
"@polkadot/dev": "^0.62.5",
|
||||||
"@polkadot/ts": "^0.3.59",
|
"@polkadot/ts": "^0.3.61",
|
||||||
"@polkadot/typegen": "workspace:packages/typegen",
|
"@polkadot/typegen": "workspace:packages/typegen",
|
||||||
"@types/jest": "^26.0.20",
|
"@types/jest": "^26.0.20",
|
||||||
"copyfiles": "^2.4.1"
|
"copyfiles": "^2.4.1"
|
||||||
},
|
},
|
||||||
"version": "3.11.1"
|
"version": "4.0.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/api-contract",
|
"name": "@polkadot/api-contract",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
@@ -15,11 +16,11 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/api": "3.11.1",
|
"@polkadot/api": "4.0.1",
|
||||||
"@polkadot/types": "3.11.1",
|
"@polkadot/types": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"@polkadot/x-rxjs": "^5.9.2",
|
"@polkadot/x-rxjs": "^6.0.4",
|
||||||
"bn.js": "^4.11.9"
|
"bn.js": "^4.11.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { blake2AsHex } from '@polkadot/util-crypto';
|
||||||
|
|
||||||
import abis from '../test/contracts';
|
import abis from '../test/contracts';
|
||||||
import { Abi } from '.';
|
import { Abi } from '.';
|
||||||
|
|
||||||
interface JSONAbi {
|
interface JSONAbi {
|
||||||
|
source: {
|
||||||
|
compiler: string,
|
||||||
|
hash: string,
|
||||||
|
language: string,
|
||||||
|
wasm: string
|
||||||
|
},
|
||||||
spec: {
|
spec: {
|
||||||
messages: {
|
messages: {
|
||||||
name: string[] | string
|
name: string[] | string
|
||||||
@@ -27,4 +35,18 @@ describe('Abi', (): void => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('has the correct hash for the source', (): void => {
|
||||||
|
const bundle = abis.ink_flipperBundle as JSONAbi;
|
||||||
|
const abi = new Abi(bundle as any);
|
||||||
|
|
||||||
|
// manual
|
||||||
|
expect(bundle.source.hash).toEqual(blake2AsHex(bundle.source.wasm));
|
||||||
|
|
||||||
|
// the Codec hash
|
||||||
|
expect(bundle.source.hash).toEqual(abi.project.source.wasm.hash.toHex());
|
||||||
|
|
||||||
|
// the hash as per the actual Abi
|
||||||
|
expect(bundle.source.hash).toEqual(abi.project.source.wasmHash.toHex());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/api-contract', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/api-contract', version: '4.0.1' };
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"info": 6,
|
||||||
|
"type": "bool"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -6,5 +6,6 @@ export { default as dns } from './dns.json';
|
|||||||
export { default as erc20 } from './erc20.json';
|
export { default as erc20 } from './erc20.json';
|
||||||
export { default as erc721 } from './erc721.json';
|
export { default as erc721 } from './erc721.json';
|
||||||
export { default as flipper } from './flipper.json';
|
export { default as flipper } from './flipper.json';
|
||||||
|
export { default as flipperBundle } from './flipper.contract.json';
|
||||||
export { default as incrementer } from './incrementer.json';
|
export { default as incrementer } from './incrementer.json';
|
||||||
export { default as multisigPlain } from './multisig_plain.json';
|
export { default as multisigPlain } from './multisig_plain.json';
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/api-derive",
|
"name": "@polkadot/api-derive",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
@@ -15,17 +16,17 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/api": "3.11.1",
|
"@polkadot/api": "4.0.1",
|
||||||
"@polkadot/rpc-core": "3.11.1",
|
"@polkadot/rpc-core": "4.0.1",
|
||||||
"@polkadot/types": "3.11.1",
|
"@polkadot/types": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"@polkadot/util-crypto": "^5.9.2",
|
"@polkadot/util-crypto": "^6.0.4",
|
||||||
"@polkadot/x-rxjs": "^5.9.2",
|
"@polkadot/x-rxjs": "^6.0.4",
|
||||||
"bn.js": "^4.11.9"
|
"bn.js": "^4.11.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^5.9.2",
|
"@polkadot/keyring": "^6.0.4",
|
||||||
"@polkadot/rpc-provider": "3.11.1"
|
"@polkadot/rpc-provider": "4.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ type BalanceResult = [Balance, Balance, Balance, Balance];
|
|||||||
|
|
||||||
type Result = [Index, BalanceResult[]];
|
type Result = [Index, BalanceResult[]];
|
||||||
|
|
||||||
|
type DeriveCustomAccount = ApiInterfaceRx['derive'] & {
|
||||||
|
[custom: string]: {
|
||||||
|
customAccount?: ApiInterfaceRx['query']['balances']['account']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenFee, frozenMisc]: BalanceResult): DeriveBalancesAccountData {
|
function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenFee, frozenMisc]: BalanceResult): DeriveBalancesAccountData {
|
||||||
return {
|
return {
|
||||||
freeBalance,
|
freeBalance,
|
||||||
@@ -55,7 +61,13 @@ function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observab
|
|||||||
}
|
}
|
||||||
|
|
||||||
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
|
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
|
||||||
const balances = modules.map((m): QueryableStorageMultiArg<'rxjs'> => [api.query[m].account, accountId]);
|
const balances = modules.map(
|
||||||
|
(m): QueryableStorageMultiArg<'rxjs'> => [
|
||||||
|
(api.derive as DeriveCustomAccount)[m]?.customAccount || api.query[m].account,
|
||||||
|
accountId
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
const extract = (data: AccountData[]) =>
|
const extract = (data: AccountData[]) =>
|
||||||
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen]);
|
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen]);
|
||||||
|
|
||||||
@@ -75,9 +87,11 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
|
|||||||
const { feeFrozen, free, miscFrozen, reserved } = (infoOrTuple as AccountInfo).nonce
|
const { feeFrozen, free, miscFrozen, reserved } = (infoOrTuple as AccountInfo).nonce
|
||||||
? (infoOrTuple as AccountInfo).data
|
? (infoOrTuple as AccountInfo).data
|
||||||
: (infoOrTuple as [Index, AccountData])[1];
|
: (infoOrTuple as [Index, AccountData])[1];
|
||||||
const accountNonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
|
|
||||||
|
|
||||||
return [accountNonce, [[free, reserved, feeFrozen, miscFrozen]]];
|
return [
|
||||||
|
(infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0],
|
||||||
|
[[free, reserved, feeFrozen, miscFrozen]]
|
||||||
|
];
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type { DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAl
|
|||||||
|
|
||||||
import BN from 'bn.js';
|
import BN from 'bn.js';
|
||||||
|
|
||||||
import { bnMax } from '@polkadot/util';
|
import { bnMax, isFunction } from '@polkadot/util';
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
@@ -27,6 +27,12 @@ interface AllLocked {
|
|||||||
vestingLocked: Balance
|
vestingLocked: Balance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DeriveCustomLocks = ApiInterfaceRx['derive'] & {
|
||||||
|
[custom: string]: {
|
||||||
|
customLocks?: ApiInterfaceRx['query']['balances']['locks']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const VESTING_ID = '0x76657374696e6720';
|
const VESTING_ID = '0x76657374696e6720';
|
||||||
|
|
||||||
function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (BalanceLock | BalanceLockTo212)[]): AllLocked {
|
function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (BalanceLock | BalanceLockTo212)[]): AllLocked {
|
||||||
@@ -54,11 +60,10 @@ function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (Balan
|
|||||||
|
|
||||||
function calcShared (api: ApiInterfaceRx, bestNumber: BlockNumber, data: DeriveBalancesAccountData, locks: (BalanceLock | BalanceLockTo212)[]): DeriveBalancesAllAccountData {
|
function calcShared (api: ApiInterfaceRx, bestNumber: BlockNumber, data: DeriveBalancesAccountData, locks: (BalanceLock | BalanceLockTo212)[]): DeriveBalancesAllAccountData {
|
||||||
const { allLocked, lockedBalance, lockedBreakdown, vestingLocked } = calcLocked(api, bestNumber, locks);
|
const { allLocked, lockedBalance, lockedBreakdown, vestingLocked } = calcLocked(api, bestNumber, locks);
|
||||||
const availableBalance = api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), data.freeBalance.sub(lockedBalance)));
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...data,
|
...data,
|
||||||
availableBalance,
|
availableBalance: api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), data.freeBalance.sub(lockedBalance))),
|
||||||
lockedBalance,
|
lockedBalance,
|
||||||
lockedBreakdown,
|
lockedBreakdown,
|
||||||
vestingLocked
|
vestingLocked
|
||||||
@@ -75,8 +80,6 @@ function calcBalances (api: ApiInterfaceRx, [data, bestNumber, [vesting, allLock
|
|||||||
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
|
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
|
||||||
const vestedBalance = vestedNow.gt(vestingTotal) ? vestingTotal : api.registry.createType('Balance', vestedNow);
|
const vestedBalance = vestedNow.gt(vestingTotal) ? vestingTotal : api.registry.createType('Balance', vestedNow);
|
||||||
const isVesting = isStarted && !shared.vestingLocked.isZero();
|
const isVesting = isStarted && !shared.vestingLocked.isZero();
|
||||||
const vestedClaimable = api.registry.createType('Balance', isVesting ? shared.vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0);
|
|
||||||
const vestingEndBlock = api.registry.createType('BlockNumber', isVesting ? vestingTotal.div(perBlock).add(startingBlock) : 0);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...shared,
|
...shared,
|
||||||
@@ -85,8 +88,8 @@ function calcBalances (api: ApiInterfaceRx, [data, bestNumber, [vesting, allLock
|
|||||||
additional: allLocks.filter((_, index) => index !== 0).map((l, index) => calcShared(api, bestNumber, data.additional[index], l)),
|
additional: allLocks.filter((_, index) => index !== 0).map((l, index) => calcShared(api, bestNumber, data.additional[index], l)),
|
||||||
isVesting,
|
isVesting,
|
||||||
vestedBalance,
|
vestedBalance,
|
||||||
vestedClaimable,
|
vestedClaimable: api.registry.createType('Balance', isVesting ? shared.vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0),
|
||||||
vestingEndBlock,
|
vestingEndBlock: api.registry.createType('BlockNumber', isVesting ? vestingTotal.div(perBlock).add(startingBlock) : 0),
|
||||||
vestingPerBlock: perBlock,
|
vestingPerBlock: perBlock,
|
||||||
vestingTotal
|
vestingTotal
|
||||||
};
|
};
|
||||||
@@ -112,11 +115,17 @@ function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isNonNullable = <T>(nullable: T): nullable is NonNullable<T> => !!nullable;
|
||||||
|
|
||||||
// current (balances, vesting)
|
// current (balances, vesting)
|
||||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
|
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
|
||||||
const lockCalls = balanceInstances.map((m) => api.query[m].locks);
|
const lockCalls = balanceInstances.map(
|
||||||
|
(m): ApiInterfaceRx['query']['balances']['locks'] | undefined =>
|
||||||
|
(api.derive as DeriveCustomLocks)[m]?.customLocks || api.query[m as 'balances']?.locks
|
||||||
|
);
|
||||||
|
|
||||||
const lockEmpty = lockCalls.map((c) => !c);
|
const lockEmpty = lockCalls.map((c) => !c);
|
||||||
const lockQueries = lockCalls.filter((c) => c).map((c): QueryableStorageMultiArg<'rxjs'> => [c, accountId]);
|
const lockQueries = lockCalls.filter(isNonNullable).map((c): QueryableStorageMultiArg<'rxjs'> => [c, accountId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
api.query.vesting?.vesting
|
api.query.vesting?.vesting
|
||||||
@@ -166,7 +175,7 @@ export function all (instanceId: string, api: ApiInterfaceRx): (address: Account
|
|||||||
? combineLatest([
|
? combineLatest([
|
||||||
of(account),
|
of(account),
|
||||||
api.derive.chain.bestNumber(),
|
api.derive.chain.bestNumber(),
|
||||||
api.query.system?.account || api.query.balances?.account
|
isFunction(api.query.system?.account) || isFunction(api.query.balances?.account)
|
||||||
? queryCurrent(api, account.accountId, balanceInstances)
|
? queryCurrent(api, account.accountId, balanceInstances)
|
||||||
: queryOld(api, account.accountId)
|
: queryOld(api, account.accountId)
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||||
import type { AccountId, EventRecord, SignedBlock } from '@polkadot/types/interfaces';
|
import type { Vec } from '@polkadot/types';
|
||||||
|
import type { EventRecord, SignedBlock } from '@polkadot/types/interfaces';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
import type { HeaderExtended } from '../type';
|
||||||
|
|
||||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
@@ -18,17 +20,17 @@ import { memo } from '../util';
|
|||||||
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<SignedBlockExtended> {
|
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<SignedBlockExtended> {
|
||||||
return memo(instanceId, (): Observable<SignedBlockExtended> =>
|
return memo(instanceId, (): Observable<SignedBlockExtended> =>
|
||||||
api.derive.chain.subscribeNewHeads().pipe(
|
api.derive.chain.subscribeNewHeads().pipe(
|
||||||
switchMap((header): Observable<[SignedBlock, EventRecord[], AccountId[] | undefined]> => {
|
switchMap((header): Observable<[SignedBlock, Vec<EventRecord>, HeaderExtended]> => {
|
||||||
const blockHash = header.hash;
|
const blockHash = header.createdAtHash || header.hash;
|
||||||
|
|
||||||
return combineLatest(
|
return combineLatest(
|
||||||
api.rpc.chain.getBlock(blockHash),
|
api.rpc.chain.getBlock(blockHash),
|
||||||
api.query.system.events.at(blockHash),
|
api.query.system.events.at(blockHash),
|
||||||
of(header.validators)
|
of(header)
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
map(([block, events, validators]) =>
|
map(([block, events, header]) =>
|
||||||
new SignedBlockExtended(api.registry, block, events, validators)
|
new SignedBlockExtended(api.registry, block, events, header.validators)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,10 +29,13 @@ export function subscribeNewHeads (instanceId: string, api: ApiInterfaceRx): ()
|
|||||||
api.rpc.chain.subscribeNewHeads(),
|
api.rpc.chain.subscribeNewHeads(),
|
||||||
api.query.session
|
api.query.session
|
||||||
? api.query.session.validators()
|
? api.query.session.validators()
|
||||||
: of([])
|
: of(undefined)
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([header, validators]): HeaderExtended =>
|
map(([header, validators]): HeaderExtended => {
|
||||||
new HeaderExtended(api.registry, header, validators)
|
header.createdAtHash = header.hash;
|
||||||
|
|
||||||
|
return new HeaderExtended(api.registry, header, validators);
|
||||||
|
})
|
||||||
)
|
)
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function parse ([proposals, images, optDepositors]: Result): DeriveProposal[] {
|
|||||||
|
|
||||||
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveProposal[]> {
|
export function proposals (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveProposal[]> {
|
||||||
return memo(instanceId, (): Observable<DeriveProposal[]> =>
|
return memo(instanceId, (): Observable<DeriveProposal[]> =>
|
||||||
api.query.democracy?.publicProps && api.query.democracy?.preimages
|
isFunction(api.query.democracy?.publicProps) && isFunction(api.query.democracy?.preimages)
|
||||||
? api.query.democracy.publicProps<Proposals>().pipe(
|
? api.query.democracy.publicProps<Proposals>().pipe(
|
||||||
switchMap((proposals) =>
|
switchMap((proposals) =>
|
||||||
combineLatest([
|
combineLatest([
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/api-derive', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/api-derive', version: '4.0.1' };
|
||||||
|
|||||||
@@ -5,16 +5,41 @@ import type { ApiInterfaceRx } from '@polkadot/api/types';
|
|||||||
import type { AccountId } from '@polkadot/types/interfaces';
|
import type { AccountId } from '@polkadot/types/interfaces';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
|
|
||||||
import { map } from '@polkadot/x-rxjs/operators';
|
import { map, startWith, switchMap } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { drr, memo } from '../util';
|
||||||
|
|
||||||
|
function onBondedEvent (api: ApiInterfaceRx): Observable<number> {
|
||||||
|
let current = Date.now();
|
||||||
|
|
||||||
|
return api.query.system.events().pipe(
|
||||||
|
map((events): number => {
|
||||||
|
current = events.filter(({ event, phase }): boolean => {
|
||||||
|
try {
|
||||||
|
return phase.isApplyExtrinsic &&
|
||||||
|
event.section === 'staking' &&
|
||||||
|
event.method === 'Bonded';
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
? Date.now()
|
||||||
|
: current;
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}),
|
||||||
|
startWith(current),
|
||||||
|
drr({ skipTimeout: true })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Retrieve the list of all validator stashes
|
* @description Retrieve the list of all validator stashes
|
||||||
*/
|
*/
|
||||||
export function stashes (instanceId: string, api: ApiInterfaceRx): () => Observable<AccountId[]> {
|
export function stashes (instanceId: string, api: ApiInterfaceRx): () => Observable<AccountId[]> {
|
||||||
return memo(instanceId, (): Observable<AccountId[]> =>
|
return memo(instanceId, (): Observable<AccountId[]> =>
|
||||||
api.query.staking.validators.keys().pipe(
|
onBondedEvent(api).pipe(
|
||||||
|
switchMap(() => api.query.staking.validators.keys()),
|
||||||
map((keys) => keys.map(({ args: [validatorId] }) => validatorId).filter((a) => a))
|
map((keys) => keys.map(({ args: [validatorId] }) => validatorId).filter((a) => a))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -33,10 +33,19 @@ function nextNonce (api: ApiInterfaceRx, address: string): Observable<Index> {
|
|||||||
function signingHeader (api: ApiInterfaceRx): Observable<Header> {
|
function signingHeader (api: ApiInterfaceRx): Observable<Header> {
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
api.rpc.chain.getHeader(),
|
api.rpc.chain.getHeader(),
|
||||||
api.rpc.chain.getFinalizedHead().pipe(
|
api.rpc.chain.getFinalizedHead()
|
||||||
switchMap((hash) => api.rpc.chain.getHeader(hash))
|
|
||||||
)
|
|
||||||
]).pipe(
|
]).pipe(
|
||||||
|
switchMap(([bestHeader, finHash]) =>
|
||||||
|
// retrieve the headers - in the case of the current block, we use the parent
|
||||||
|
// to minimize (not completely remove) the impact that forks do have on the system
|
||||||
|
// (when at genesis, just return the current header as the last known)
|
||||||
|
bestHeader.parentHash.isEmpty
|
||||||
|
? of([bestHeader, bestHeader])
|
||||||
|
: combineLatest([
|
||||||
|
api.rpc.chain.getHeader(bestHeader.parentHash),
|
||||||
|
api.rpc.chain.getHeader(finHash)
|
||||||
|
])
|
||||||
|
),
|
||||||
map(([current, finalized]) =>
|
map(([current, finalized]) =>
|
||||||
// determine the hash to use, current when lag > max, else finalized
|
// determine the hash to use, current when lag > max, else finalized
|
||||||
current.number.unwrap().sub(finalized.number.unwrap()).gt(MAX_FINALITY_LAG)
|
current.number.unwrap().sub(finalized.number.unwrap()).gt(MAX_FINALITY_LAG)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export class HeaderExtended extends _Header {
|
|||||||
|
|
||||||
this.#author = extractAuthor(this.digest, validators);
|
this.#author = extractAuthor(this.digest, validators);
|
||||||
this.#validators = validators;
|
this.#validators = validators;
|
||||||
|
this.createdAtHash = header?.createdAtHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -53,12 +53,13 @@ export class SignedBlockExtended extends _SignedBlock {
|
|||||||
readonly #events: EventRecord[];
|
readonly #events: EventRecord[];
|
||||||
readonly #extrinsics: TxWithEvent[];
|
readonly #extrinsics: TxWithEvent[];
|
||||||
|
|
||||||
constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], sessionValidators?: AccountId[]) {
|
constructor (registry: Registry, block?: SignedBlock, events?: EventRecord[], validators?: AccountId[]) {
|
||||||
super(registry, block);
|
super(registry, block);
|
||||||
|
|
||||||
this.#author = extractAuthor(this.block.header.digest, sessionValidators);
|
this.#author = extractAuthor(this.block.header.digest, validators);
|
||||||
this.#events = events || ([] as EventRecord[]);
|
this.#events = events || ([] as EventRecord[]);
|
||||||
this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events);
|
this.#extrinsics = mapExtrinsics(this.block.extrinsics, this.#events);
|
||||||
|
this.createdAtHash = block?.createdAtHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+14
-13
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/api",
|
"name": "@polkadot/api",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
@@ -15,17 +16,17 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/api-derive": "3.11.1",
|
"@polkadot/api-derive": "4.0.1",
|
||||||
"@polkadot/keyring": "^5.9.2",
|
"@polkadot/keyring": "^6.0.4",
|
||||||
"@polkadot/metadata": "3.11.1",
|
"@polkadot/metadata": "4.0.1",
|
||||||
"@polkadot/rpc-core": "3.11.1",
|
"@polkadot/rpc-core": "4.0.1",
|
||||||
"@polkadot/rpc-provider": "3.11.1",
|
"@polkadot/rpc-provider": "4.0.1",
|
||||||
"@polkadot/types": "3.11.1",
|
"@polkadot/types": "4.0.1",
|
||||||
"@polkadot/types-known": "3.11.1",
|
"@polkadot/types-known": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"@polkadot/util-crypto": "^5.9.2",
|
"@polkadot/util-crypto": "^6.0.4",
|
||||||
"@polkadot/x-rxjs": "^5.9.2",
|
"@polkadot/x-rxjs": "^6.0.4",
|
||||||
"bn.js": "^4.11.9",
|
"bn.js": "^4.11.9",
|
||||||
"eventemitter3": "^4.0.7"
|
"eventemitter3": "^4.0.7"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3080,7 +3080,7 @@ declare module '@polkadot/api/types/submittable' {
|
|||||||
* - Write: Nominators, Validators
|
* - Write: Nominators, Validators
|
||||||
* # </weight>
|
* # </weight>
|
||||||
**/
|
**/
|
||||||
validate: AugmentedSubmittable<(prefs: ValidatorPrefs | { commission?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [ValidatorPrefs]>;
|
validate: AugmentedSubmittable<(prefs: ValidatorPrefs | { commission?: any; blocked?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [ValidatorPrefs]>;
|
||||||
/**
|
/**
|
||||||
* Remove any unlocked chunks from the `unlocking` queue from our management.
|
* Remove any unlocked chunks from the `unlocking` queue from our management.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -492,9 +492,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
tap((keys): void => {
|
tap((keys): void => {
|
||||||
|
setTimeout((): void => {
|
||||||
keys.length === PAGE_SIZE
|
keys.length === PAGE_SIZE
|
||||||
? startSubject.next(keys[PAGE_SIZE - 1].toHex())
|
? startSubject.next(keys[PAGE_SIZE - 1].toHex())
|
||||||
: startSubject.complete();
|
: startSubject.complete();
|
||||||
|
}, 0);
|
||||||
}),
|
}),
|
||||||
toArray(), // toArray since we want to startSubject to be completed
|
toArray(), // toArray since we want to startSubject to be completed
|
||||||
map((keysArr: StorageKey[][]) => arrayFlatten(keysArr))
|
map((keysArr: StorageKey[][]) => arrayFlatten(keysArr))
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
|||||||
|
|
||||||
// nothing has been found, construct new
|
// nothing has been found, construct new
|
||||||
const metadata = await this._rpcCore.state.getMetadata(header.parentHash).toPromise();
|
const metadata = await this._rpcCore.state.getMetadata(header.parentHash).toPromise();
|
||||||
const registry = this._initRegistry(new TypeRegistry(), this._runtimeChain as Text, version, metadata);
|
const registry = this._initRegistry(new TypeRegistry(blockHash), this._runtimeChain as Text, version, metadata);
|
||||||
|
|
||||||
// For now, since this is new we ignore the capability lookups (this could be useful once proven)
|
// For now, since this is new we ignore the capability lookups (this could be useful once proven)
|
||||||
// this._detectCapabilities(registry, blockHash);
|
// this._detectCapabilities(registry, blockHash);
|
||||||
|
|||||||
@@ -10,25 +10,32 @@ import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
|
|||||||
import { map, take } from '@polkadot/x-rxjs/operators';
|
import { map, take } from '@polkadot/x-rxjs/operators';
|
||||||
|
|
||||||
// the order and types needs to map with the all array setup below
|
// the order and types needs to map with the all array setup below
|
||||||
type Extracted = [bool | null, bool | null, Releases | null];
|
type Extracted = [bool | null, bool | null, bool | null, Releases | null];
|
||||||
|
|
||||||
type DetectedKeys = keyof Pick<InterfaceTypes, 'AccountInfo' | 'ValidatorPrefs'>;
|
type DetectedKeys = keyof Pick<InterfaceTypes, 'AccountInfo' | 'ValidatorPrefs'>;
|
||||||
|
|
||||||
type DetectedValues = keyof InterfaceTypes;
|
type DetectedValues = keyof InterfaceTypes;
|
||||||
|
|
||||||
interface DetectedTypes extends Record<DetectedKeys, DetectedValues> {
|
interface DetectedTypes extends Record<DetectedKeys, DetectedValues> {
|
||||||
AccountInfo: 'AccountInfoWithRefCount' | 'AccountInfoWithProviders',
|
AccountInfo: 'AccountInfoWithRefCount' | 'AccountInfoWithDualRefCount' | 'AccountInfoWithTripleRefCount',
|
||||||
|
RefCount: 'u8' | 'u32',
|
||||||
ValidatorPrefs: 'ValidatorPrefsWithBlocked' | 'ValidatorPrefsWithCommission';
|
ValidatorPrefs: 'ValidatorPrefsWithBlocked' | 'ValidatorPrefsWithCommission';
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapCapabilities ([systemRefcount32, systemRefcountDual, stakingVersion]: Extracted): Partial<DetectedTypes> {
|
function mapCapabilities ([systemRefcount32, systemRefcountDual, systemRefcountTriple, stakingVersion]: Extracted): Partial<DetectedTypes> {
|
||||||
const types: Partial<DetectedTypes> = {};
|
const types: Partial<DetectedTypes> = {};
|
||||||
|
|
||||||
// AccountInfo
|
// AccountInfo
|
||||||
if (systemRefcountDual && systemRefcountDual.isTrue) {
|
if (systemRefcountTriple && systemRefcountTriple.isTrue) {
|
||||||
types.AccountInfo = 'AccountInfoWithProviders';
|
types.AccountInfo = 'AccountInfoWithTripleRefCount';
|
||||||
} else if (systemRefcount32 && systemRefcount32.isTrue) {
|
} else if (systemRefcountDual && systemRefcountDual.isTrue) {
|
||||||
|
types.AccountInfo = 'AccountInfoWithDualRefCount';
|
||||||
|
} else {
|
||||||
types.AccountInfo = 'AccountInfoWithRefCount';
|
types.AccountInfo = 'AccountInfoWithRefCount';
|
||||||
|
|
||||||
|
if (!systemRefcount32 || systemRefcount32.isFalse) {
|
||||||
|
types.RefCount = 'u8';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidatorPrefs
|
// ValidatorPrefs
|
||||||
@@ -50,6 +57,7 @@ export function detectedCapabilities (api: ApiInterfaceRx, blockHash?: Uint8Arra
|
|||||||
const all = [
|
const all = [
|
||||||
api.query.system?.upgradedToU32RefCount,
|
api.query.system?.upgradedToU32RefCount,
|
||||||
api.query.system?.upgradedToDualRefCount,
|
api.query.system?.upgradedToDualRefCount,
|
||||||
|
api.query.system?.upgradedToTripleRefCount,
|
||||||
api.query.staking?.storageVersion
|
api.query.staking?.storageVersion
|
||||||
];
|
];
|
||||||
const included = all.map((c) => !!c);
|
const included = all.map((c) => !!c);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/api authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/api', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/api', version: '4.0.1' };
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/metadata",
|
"name": "@polkadot/metadata",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "Helpers to extract information from runtime metadata",
|
"description": "Helpers to extract information from runtime metadata",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"repository": "github:polkadot-js/api",
|
"repository": "github:polkadot-js/api",
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
@@ -15,14 +16,14 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/types": "3.11.1",
|
"@polkadot/types": "4.0.1",
|
||||||
"@polkadot/types-known": "3.11.1",
|
"@polkadot/types-known": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"@polkadot/util-crypto": "^5.9.2",
|
"@polkadot/util-crypto": "^6.0.4",
|
||||||
"bn.js": "^4.11.9"
|
"bn.js": "^4.11.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^5.9.2"
|
"@polkadot/keyring": "^6.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/metadata authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/metadata', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/metadata', version: '4.0.1' };
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/rpc-core",
|
"name": "@polkadot/rpc-core",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
@@ -15,14 +16,14 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/metadata": "3.11.1",
|
"@polkadot/metadata": "4.0.1",
|
||||||
"@polkadot/rpc-provider": "3.11.1",
|
"@polkadot/rpc-provider": "4.0.1",
|
||||||
"@polkadot/types": "3.11.1",
|
"@polkadot/types": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"@polkadot/x-rxjs": "^5.9.2"
|
"@polkadot/x-rxjs": "^6.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^5.9.2"
|
"@polkadot/keyring": "^6.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,17 +244,17 @@ export class RpcCore implements RpcInterface {
|
|||||||
|
|
||||||
// execute the RPC call, doing a registry swap for historic as applicable
|
// execute the RPC call, doing a registry swap for historic as applicable
|
||||||
const callWithRegistry = async (outputAs: OutputType, values: any[]): Promise<Codec | Codec[]> => {
|
const callWithRegistry = async (outputAs: OutputType, values: any[]): Promise<Codec | Codec[]> => {
|
||||||
const hash = hashIndex === -1
|
const blockHash = hashIndex === -1
|
||||||
? undefined
|
? null
|
||||||
: values[hashIndex] as Uint8Array;
|
: values[hashIndex] as Uint8Array;
|
||||||
const { registry } = hash && this.#getBlockRegistry
|
const { registry } = blockHash && this.#getBlockRegistry
|
||||||
? await this.#getBlockRegistry(hash)
|
? await this.#getBlockRegistry(blockHash)
|
||||||
: { registry: this.#registryDefault };
|
: { registry: this.#registryDefault };
|
||||||
const params = this._formatInputs(registry, def, values);
|
const params = this._formatInputs(registry, null, def, values);
|
||||||
const data = await this.provider.send(rpcName, params.map((param): AnyJson => param.toJSON())) as AnyJson;
|
const data = await this.provider.send(rpcName, params.map((param): AnyJson => param.toJSON())) as AnyJson;
|
||||||
|
|
||||||
return outputAs === 'scale'
|
return outputAs === 'scale'
|
||||||
? this._formatOutput(registry, method, def, params, data)
|
? this._formatOutput(registry, blockHash, method, def, params, data)
|
||||||
: registry.createType(outputAs === 'raw' ? 'Raw' : 'Json', data);
|
: registry.createType(outputAs === 'raw' ? 'Raw' : 'Json', data);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ export class RpcCore implements RpcInterface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const params = this._formatInputs(registry, def, values);
|
const params = this._formatInputs(registry, null, def, values);
|
||||||
const paramsJson = params.map((param): AnyJson => param.toJSON());
|
const paramsJson = params.map((param): AnyJson => param.toJSON());
|
||||||
|
|
||||||
const update = (error?: Error | null, result?: any): void => {
|
const update = (error?: Error | null, result?: any): void => {
|
||||||
@@ -337,7 +337,7 @@ export class RpcCore implements RpcInterface {
|
|||||||
try {
|
try {
|
||||||
observer.next(
|
observer.next(
|
||||||
outputAs === 'scale'
|
outputAs === 'scale'
|
||||||
? this._formatOutput(registry, method, def, params, result)
|
? this._formatOutput(registry, null, method, def, params, result)
|
||||||
: registry.createType(outputAs === 'raw' ? 'Raw' : 'Json', result)
|
: registry.createType(outputAs === 'raw' ? 'Raw' : 'Json', result)
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -372,8 +372,8 @@ export class RpcCore implements RpcInterface {
|
|||||||
return memoized;
|
return memoized;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _formatInputs (registry: Registry, def: DefinitionRpc, inputs: any[]): Codec[] {
|
private _formatInputs (registry: Registry, blockHash: Uint8Array | string | null | undefined, def: DefinitionRpc, inputs: any[]): Codec[] {
|
||||||
const reqArgCount = def.params.filter(({ isOptional }): boolean => !isOptional).length;
|
const reqArgCount = def.params.filter(({ isOptional }) => !isOptional).length;
|
||||||
const optText = reqArgCount === def.params.length
|
const optText = reqArgCount === def.params.length
|
||||||
? ''
|
? ''
|
||||||
: ` (${def.params.length - reqArgCount} optional)`;
|
: ` (${def.params.length - reqArgCount} optional)`;
|
||||||
@@ -381,25 +381,25 @@ export class RpcCore implements RpcInterface {
|
|||||||
assert(inputs.length >= reqArgCount && inputs.length <= def.params.length, `Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
|
assert(inputs.length >= reqArgCount && inputs.length <= def.params.length, `Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
|
||||||
|
|
||||||
return inputs.map((input, index): Codec =>
|
return inputs.map((input, index): Codec =>
|
||||||
createTypeUnsafe(registry, def.params[index].type, [input])
|
createTypeUnsafe(registry, def.params[index].type, [input], { blockHash })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _formatOutput (registry: Registry, method: string, rpc: DefinitionRpc, params: Codec[], result?: any): Codec | Codec[] {
|
private _formatOutput (registry: Registry, blockHash: Uint8Array | string | null | undefined, method: string, rpc: DefinitionRpc, params: Codec[], result?: any): Codec | Codec[] {
|
||||||
if (rpc.type === 'StorageData') {
|
if (rpc.type === 'StorageData') {
|
||||||
const key = params[0] as StorageKey;
|
const key = params[0] as StorageKey;
|
||||||
|
|
||||||
return this._formatStorageData(registry, key, result);
|
return this._formatStorageData(registry, blockHash, key, result);
|
||||||
} else if (rpc.type === 'StorageChangeSet') {
|
} else if (rpc.type === 'StorageChangeSet') {
|
||||||
const keys = params[0] as Vec<StorageKey>;
|
const keys = params[0] as Vec<StorageKey>;
|
||||||
|
|
||||||
return keys
|
return keys
|
||||||
? this._formatStorageSet(registry, keys, (result as StorageChangeSetJSON).changes)
|
? this._formatStorageSet(registry, (result as StorageChangeSetJSON).block, keys, (result as StorageChangeSetJSON).changes)
|
||||||
: registry.createType('StorageChangeSet', result);
|
: registry.createType('StorageChangeSet', result);
|
||||||
} else if (rpc.type === 'Vec<StorageChangeSet>') {
|
} else if (rpc.type === 'Vec<StorageChangeSet>') {
|
||||||
const mapped = (result as StorageChangeSetJSON[]).map(({ block, changes }): [Hash, Codec[]] => [
|
const mapped = (result as StorageChangeSetJSON[]).map(({ block, changes }): [Hash, Codec[]] => [
|
||||||
registry.createType('Hash', block),
|
registry.createType('Hash', block),
|
||||||
this._formatStorageSet(registry, params[0] as Vec<StorageKey>, changes)
|
this._formatStorageSet(registry, block, params[0] as Vec<StorageKey>, changes)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// we only query at a specific block, not a range - flatten
|
// we only query at a specific block, not a range - flatten
|
||||||
@@ -408,10 +408,10 @@ export class RpcCore implements RpcInterface {
|
|||||||
: mapped as unknown as Codec[];
|
: mapped as unknown as Codec[];
|
||||||
}
|
}
|
||||||
|
|
||||||
return createTypeUnsafe(registry, rpc.type, [result]);
|
return createTypeUnsafe(registry, rpc.type, [result], { blockHash });
|
||||||
}
|
}
|
||||||
|
|
||||||
private _formatStorageData (registry: Registry, key: StorageKey, value: string | null): Codec {
|
private _formatStorageData (registry: Registry, blockHash: Uint8Array | string | null | undefined, key: StorageKey, value: string | null): Codec {
|
||||||
const isEmpty = isNull(value);
|
const isEmpty = isNull(value);
|
||||||
|
|
||||||
// we convert to Uint8Array since it maps to the raw encoding, all
|
// we convert to Uint8Array since it maps to the raw encoding, all
|
||||||
@@ -422,10 +422,10 @@ export class RpcCore implements RpcInterface {
|
|||||||
? value
|
? value
|
||||||
: u8aToU8a(value);
|
: u8aToU8a(value);
|
||||||
|
|
||||||
return this._newType(registry, key, input, isEmpty);
|
return this._newType(registry, blockHash, key, input, isEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _formatStorageSet (registry: Registry, keys: Vec<StorageKey>, changes: [string, string | null][]): Codec[] {
|
private _formatStorageSet (registry: Registry, blockHash: string, keys: Vec<StorageKey>, changes: [string, string | null][]): Codec[] {
|
||||||
// For StorageChangeSet, the changes has the [key, value] mappings
|
// For StorageChangeSet, the changes has the [key, value] mappings
|
||||||
const withCache = keys.length !== 1;
|
const withCache = keys.length !== 1;
|
||||||
|
|
||||||
@@ -434,13 +434,13 @@ export class RpcCore implements RpcInterface {
|
|||||||
// - Codec - There is a valid value, non-empty
|
// - Codec - There is a valid value, non-empty
|
||||||
// - null - The storage key is empty
|
// - null - The storage key is empty
|
||||||
return keys.reduce((results: Codec[], key: StorageKey, index): Codec[] => {
|
return keys.reduce((results: Codec[], key: StorageKey, index): Codec[] => {
|
||||||
results.push(this._formatStorageSetEntry(registry, key, changes, withCache, index));
|
results.push(this._formatStorageSetEntry(registry, blockHash, key, changes, withCache, index));
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}, []);
|
}, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _formatStorageSetEntry (registry: Registry, key: StorageKey, changes: [string, string | null][], witCache: boolean, entryIndex: number): Codec {
|
private _formatStorageSetEntry (registry: Registry, blockHash: string, key: StorageKey, changes: [string, string | null][], witCache: boolean, entryIndex: number): Codec {
|
||||||
const hexKey = key.toHex();
|
const hexKey = key.toHex();
|
||||||
const found = changes.find(([key]) => key === hexKey);
|
const found = changes.find(([key]) => key === hexKey);
|
||||||
|
|
||||||
@@ -461,10 +461,10 @@ export class RpcCore implements RpcInterface {
|
|||||||
// will increase memory beyond what is allowed.
|
// will increase memory beyond what is allowed.
|
||||||
this.#storageCache.set(hexKey, value);
|
this.#storageCache.set(hexKey, value);
|
||||||
|
|
||||||
return this._newType(registry, key, input, isEmpty, entryIndex);
|
return this._newType(registry, blockHash, key, input, isEmpty, entryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _newType (registry: Registry, key: StorageKey, input: string | Uint8Array | null, isEmpty: boolean, entryIndex = -1): Codec {
|
private _newType (registry: Registry, blockHash: Uint8Array | string | null | undefined, key: StorageKey, input: string | Uint8Array | null, isEmpty: boolean, entryIndex = -1): Codec {
|
||||||
// single return value (via state.getStorage), decode the value based on the
|
// single return value (via state.getStorage), decode the value based on the
|
||||||
// outputType that we have specified. Fallback to Raw on nothing
|
// outputType that we have specified. Fallback to Raw on nothing
|
||||||
const type = key.outputType || 'Raw';
|
const type = key.outputType || 'Raw';
|
||||||
@@ -478,13 +478,19 @@ export class RpcCore implements RpcInterface {
|
|||||||
|
|
||||||
if (!isEmpty) {
|
if (!isEmpty) {
|
||||||
try {
|
try {
|
||||||
inner = createTypeUnsafe(registry, type, [input], { isPedantic: true });
|
inner = createTypeUnsafe(registry, type, [input], { blockHash, isPedantic: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
l.error(`Unable to decode storage ${key.section || 'unknown'}.${key.method || 'unknown'}:${entryNum}`, (error as Error).message);
|
l.error(`Unable to decode storage ${key.section || 'unknown'}.${key.method || 'unknown'}:${entryNum}`, (error as Error).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Option(registry, createClass(registry, type), inner);
|
const option = new Option(registry, createClass(registry, type), inner);
|
||||||
|
|
||||||
|
if (blockHash) {
|
||||||
|
option.createdAtHash = registry.createType('Hash', blockHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -494,11 +500,11 @@ export class RpcCore implements RpcInterface {
|
|||||||
? hexToU8a(meta.fallback.toHex())
|
? hexToU8a(meta.fallback.toHex())
|
||||||
: undefined
|
: undefined
|
||||||
: input
|
: input
|
||||||
], { isPedantic: true });
|
], { blockHash, isPedantic: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
l.error(`Unable to decode storage ${key.section || 'unknown'}.${key.method || 'unknown'}:${entryNum}`, (error as Error).message);
|
l.error(`Unable to decode storage ${key.section || 'unknown'}.${key.method || 'unknown'}:${entryNum}`, (error as Error).message);
|
||||||
|
|
||||||
return registry.createType('Raw', input);
|
return createTypeUnsafe(registry, 'Raw', [input], { blockHash });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/rpc-core', version: '4.0.1' };
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/rpc-provider",
|
"name": "@polkadot/rpc-provider",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "Transport providers for the API",
|
"description": "Transport providers for the API",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
@@ -15,20 +16,20 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/types": "3.11.1",
|
"@polkadot/types": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"@polkadot/util-crypto": "^5.9.2",
|
"@polkadot/util-crypto": "^6.0.4",
|
||||||
"@polkadot/x-fetch": "^5.9.2",
|
"@polkadot/x-fetch": "^6.0.4",
|
||||||
"@polkadot/x-global": "^5.9.2",
|
"@polkadot/x-global": "^6.0.4",
|
||||||
"@polkadot/x-ws": "^5.9.2",
|
"@polkadot/x-ws": "^6.0.4",
|
||||||
"bn.js": "^4.11.9",
|
"bn.js": "^4.11.9",
|
||||||
"eventemitter3": "^4.0.7"
|
"eventemitter3": "^4.0.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^5.9.2",
|
"@polkadot/keyring": "^6.0.4",
|
||||||
"@polkadot/metadata": "3.11.1",
|
"@polkadot/metadata": "4.0.1",
|
||||||
"mock-socket": "^9.0.3",
|
"mock-socket": "^9.0.3",
|
||||||
"nock": "^13.0.9"
|
"nock": "^13.0.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/rpc-provider', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/rpc-provider', version: '4.0.1' };
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/typegen",
|
"name": "@polkadot/typegen",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "Type generation scripts",
|
"description": "Type generation scripts",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.js",
|
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
|
||||||
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.js",
|
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.cjs",
|
||||||
"polkadot-types-from-defs": "./scripts/polkadot-types-from-defs.js",
|
"polkadot-types-from-defs": "./scripts/polkadot-types-from-defs.cjs",
|
||||||
"polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.js",
|
"polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.cjs",
|
||||||
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.js"
|
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs"
|
||||||
},
|
},
|
||||||
"repository": "github:polkadot-js/api",
|
"repository": "github:polkadot-js/api",
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
@@ -24,18 +25,18 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.13.8",
|
"@babel/core": "^7.13.8",
|
||||||
"@babel/register": "^7.13.8",
|
"@babel/register": "^7.13.8",
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/api": "3.11.1",
|
"@polkadot/api": "4.0.1",
|
||||||
"@polkadot/metadata": "3.11.1",
|
"@polkadot/metadata": "4.0.1",
|
||||||
"@polkadot/rpc-provider": "3.11.1",
|
"@polkadot/rpc-provider": "4.0.1",
|
||||||
"@polkadot/types": "3.11.1",
|
"@polkadot/types": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"handlebars": "^4.7.7",
|
"handlebars": "^4.7.7",
|
||||||
"websocket": "^1.0.33",
|
"websocket": "^1.0.33",
|
||||||
"yargs": "^16.2.0"
|
"yargs": "^16.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/websocket": "^1.0.1",
|
"@types/websocket": "^1.0.2",
|
||||||
"@types/yargs": "^16.0.0"
|
"@types/yargs": "^16.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -7,8 +7,10 @@
|
|||||||
let main;
|
let main;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
main = require('../extractChain').main;
|
main = require('../extractChain.cjs').main;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
process.env.JEST_WORKER_ID = '123';
|
||||||
|
|
||||||
require('@babel/register')({
|
require('@babel/register')({
|
||||||
extensions: ['.js', '.ts'],
|
extensions: ['.js', '.ts'],
|
||||||
plugins: [
|
plugins: [
|
||||||
+3
-1
@@ -7,8 +7,10 @@
|
|||||||
let main;
|
let main;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
main = require('../fromChain').main;
|
main = require('../fromChain.cjs').main;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
process.env.JEST_WORKER_ID = '123';
|
||||||
|
|
||||||
require('@babel/register')({
|
require('@babel/register')({
|
||||||
extensions: ['.js', '.ts'],
|
extensions: ['.js', '.ts'],
|
||||||
plugins: [
|
plugins: [
|
||||||
+3
-1
@@ -7,8 +7,10 @@
|
|||||||
let main;
|
let main;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
main = require('../fromDefs').main;
|
main = require('../fromDefs.cjs').main;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
process.env.JEST_WORKER_ID = '123';
|
||||||
|
|
||||||
require('@babel/register')({
|
require('@babel/register')({
|
||||||
extensions: ['.js', '.ts'],
|
extensions: ['.js', '.ts'],
|
||||||
plugins: [
|
plugins: [
|
||||||
+3
-1
@@ -7,8 +7,10 @@
|
|||||||
let main;
|
let main;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
main = require('../interfacesTs').main;
|
main = require('../interfacesTs.cjs').main;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
process.env.JEST_WORKER_ID = '123';
|
||||||
|
|
||||||
require('@babel/register')({
|
require('@babel/register')({
|
||||||
extensions: ['.js', '.ts'],
|
extensions: ['.js', '.ts'],
|
||||||
plugins: [
|
plugins: [
|
||||||
+3
-1
@@ -7,8 +7,10 @@
|
|||||||
let main;
|
let main;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
main = require('../metadataMd').main;
|
main = require('../metadataMd.cjs').main;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
process.env.JEST_WORKER_ID = '123';
|
||||||
|
|
||||||
require('@babel/register')({
|
require('@babel/register')({
|
||||||
extensions: ['.js', '.ts'],
|
extensions: ['.js', '.ts'],
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/typegen', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/typegen', version: '4.0.1' };
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/types-known",
|
"name": "@polkadot/types-known",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
@@ -15,10 +16,10 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/networks": "^5.9.2",
|
"@polkadot/networks": "^6.0.4",
|
||||||
"@polkadot/types": "3.11.1",
|
"@polkadot/types": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"bn.js": "^4.11.9"
|
"bn.js": "^4.11.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/types-known authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/types-known', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/types-known', version: '4.0.1' };
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||||
|
|
||||||
const sharedTypes = {
|
const sharedTypes = {
|
||||||
AccountInfo: 'AccountInfoWithProviders',
|
AccountInfo: 'AccountInfoWithDualRefCount',
|
||||||
Address: 'MultiAddress',
|
Address: 'MultiAddress',
|
||||||
Keys: 'SessionKeys6',
|
Keys: 'SessionKeys6',
|
||||||
LookupSource: 'MultiAddress',
|
LookupSource: 'MultiAddress',
|
||||||
@@ -47,7 +47,6 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259',
|
||||||
ReferendumInfo: 'ReferendumInfoTo239',
|
ReferendumInfo: 'ReferendumInfoTo239',
|
||||||
RewardDestination: 'RewardDestinationTo257',
|
|
||||||
SlashingSpans: 'SlashingSpansTo204',
|
SlashingSpans: 'SlashingSpansTo204',
|
||||||
StakingLedger: 'StakingLedgerTo223',
|
StakingLedger: 'StakingLedgerTo223',
|
||||||
Votes: 'VotesTo230',
|
Votes: 'VotesTo230',
|
||||||
@@ -66,7 +65,6 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259',
|
||||||
ReferendumInfo: 'ReferendumInfoTo239',
|
ReferendumInfo: 'ReferendumInfoTo239',
|
||||||
RewardDestination: 'RewardDestinationTo257',
|
|
||||||
SlashingSpans: 'SlashingSpansTo204',
|
SlashingSpans: 'SlashingSpansTo204',
|
||||||
StakingLedger: 'StakingLedgerTo223',
|
StakingLedger: 'StakingLedgerTo223',
|
||||||
Votes: 'VotesTo230',
|
Votes: 'VotesTo230',
|
||||||
@@ -86,7 +84,6 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259',
|
||||||
ReferendumInfo: 'ReferendumInfoTo239',
|
ReferendumInfo: 'ReferendumInfoTo239',
|
||||||
RewardDestination: 'RewardDestinationTo257',
|
|
||||||
StakingLedger: 'StakingLedgerTo223',
|
StakingLedger: 'StakingLedgerTo223',
|
||||||
Votes: 'VotesTo230',
|
Votes: 'VotesTo230',
|
||||||
Weight: 'u32'
|
Weight: 'u32'
|
||||||
@@ -104,7 +101,6 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259',
|
||||||
ReferendumInfo: 'ReferendumInfoTo239',
|
ReferendumInfo: 'ReferendumInfoTo239',
|
||||||
RewardDestination: 'RewardDestinationTo257',
|
|
||||||
StakingLedger: 'StakingLedgerTo240',
|
StakingLedger: 'StakingLedgerTo240',
|
||||||
Weight: 'u32'
|
Weight: 'u32'
|
||||||
}
|
}
|
||||||
@@ -119,7 +115,6 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
Multiplier: 'Fixed64',
|
Multiplier: 'Fixed64',
|
||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259',
|
||||||
RewardDestination: 'RewardDestinationTo257',
|
|
||||||
StakingLedger: 'StakingLedgerTo240',
|
StakingLedger: 'StakingLedgerTo240',
|
||||||
Weight: 'u32'
|
Weight: 'u32'
|
||||||
}
|
}
|
||||||
@@ -132,8 +127,7 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
CompactAssignments: 'CompactAssignmentsTo257',
|
CompactAssignments: 'CompactAssignmentsTo257',
|
||||||
DispatchInfo: 'DispatchInfoTo244',
|
DispatchInfo: 'DispatchInfoTo244',
|
||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259'
|
||||||
RewardDestination: 'RewardDestinationTo257'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -143,8 +137,7 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
...addrAccountIdTypes,
|
...addrAccountIdTypes,
|
||||||
CompactAssignments: 'CompactAssignmentsTo257',
|
CompactAssignments: 'CompactAssignmentsTo257',
|
||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259'
|
||||||
RewardDestination: 'RewardDestinationTo257'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -153,8 +146,7 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
...sharedTypes,
|
...sharedTypes,
|
||||||
...addrAccountIdTypes,
|
...addrAccountIdTypes,
|
||||||
CompactAssignments: 'CompactAssignmentsTo257',
|
CompactAssignments: 'CompactAssignmentsTo257',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259'
|
||||||
RewardDestination: 'RewardDestinationTo257'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
{
|
{
|
||||||
minmax: [261, undefined],
|
minmax: [261, undefined],
|
||||||
types: {
|
types: {
|
||||||
AccountInfo: 'AccountInfoWithProviders',
|
AccountInfo: 'AccountInfoWithDualRefCount',
|
||||||
Address: 'MultiAddress',
|
Address: 'MultiAddress',
|
||||||
LookupSource: 'MultiAddress'
|
LookupSource: 'MultiAddress'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||||
|
|
||||||
const sharedTypes = {
|
const sharedTypes = {
|
||||||
AccountInfo: 'AccountInfoWithProviders',
|
AccountInfo: 'AccountInfoWithDualRefCount',
|
||||||
Address: 'MultiAddress',
|
Address: 'MultiAddress',
|
||||||
Keys: 'SessionKeys6',
|
Keys: 'SessionKeys6',
|
||||||
LookupSource: 'MultiAddress',
|
LookupSource: 'MultiAddress',
|
||||||
@@ -41,8 +41,7 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
...addrAccountIdTypes,
|
...addrAccountIdTypes,
|
||||||
CompactAssignments: 'CompactAssignmentsTo257',
|
CompactAssignments: 'CompactAssignmentsTo257',
|
||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259'
|
||||||
RewardDestination: 'RewardDestinationTo257'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -51,8 +50,7 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
...sharedTypes,
|
...sharedTypes,
|
||||||
...addrAccountIdTypes,
|
...addrAccountIdTypes,
|
||||||
CompactAssignments: 'CompactAssignmentsTo257',
|
CompactAssignments: 'CompactAssignmentsTo257',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259'
|
||||||
RewardDestination: 'RewardDestinationTo257'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
|
|||||||
/* eslint-disable sort-keys */
|
/* eslint-disable sort-keys */
|
||||||
|
|
||||||
const sharedTypes = {
|
const sharedTypes = {
|
||||||
AccountInfo: 'AccountInfoWithProviders',
|
AccountInfo: 'AccountInfoWithDualRefCount',
|
||||||
Address: 'MultiAddress',
|
Address: 'MultiAddress',
|
||||||
FullIdentification: '()', // No staking, only session (as per config)
|
FullIdentification: '()', // No staking, only session (as per config)
|
||||||
LookupSource: 'MultiAddress',
|
LookupSource: 'MultiAddress',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||||
|
|
||||||
const sharedTypes = {
|
const sharedTypes = {
|
||||||
AccountInfo: 'AccountInfoWithProviders',
|
AccountInfo: 'AccountInfoWithDualRefCount',
|
||||||
Address: 'MultiAddress',
|
Address: 'MultiAddress',
|
||||||
Keys: 'SessionKeys6',
|
Keys: 'SessionKeys6',
|
||||||
LookupSource: 'MultiAddress',
|
LookupSource: 'MultiAddress',
|
||||||
@@ -35,7 +35,6 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
Multiplier: 'Fixed64',
|
Multiplier: 'Fixed64',
|
||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259',
|
||||||
RewardDestination: 'RewardDestinationTo257',
|
|
||||||
Weight: 'u32'
|
Weight: 'u32'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -46,8 +45,7 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
...addrAccountIdTypes,
|
...addrAccountIdTypes,
|
||||||
CompactAssignments: 'CompactAssignmentsTo257',
|
CompactAssignments: 'CompactAssignmentsTo257',
|
||||||
OpenTip: 'OpenTipTo225',
|
OpenTip: 'OpenTipTo225',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259'
|
||||||
RewardDestination: 'RewardDestinationTo257'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -56,8 +54,7 @@ const versioned: OverrideVersionedType[] = [
|
|||||||
...sharedTypes,
|
...sharedTypes,
|
||||||
...addrAccountIdTypes,
|
...addrAccountIdTypes,
|
||||||
CompactAssignments: 'CompactAssignmentsTo257',
|
CompactAssignments: 'CompactAssignmentsTo257',
|
||||||
RefCount: 'RefCountTo259',
|
RefCount: 'RefCountTo259'
|
||||||
RewardDestination: 'RewardDestinationTo257'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const upgrades: ChainUpgradesRaw = [
|
|||||||
[879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29],
|
[879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29],
|
||||||
[1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35],
|
[1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35],
|
||||||
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
|
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
|
||||||
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48]
|
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49]
|
||||||
];
|
];
|
||||||
|
|
||||||
export default upgrades;
|
export default upgrades;
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/types",
|
"name": "@polkadot/types",
|
||||||
"version": "3.11.1",
|
"version": "4.0.1",
|
||||||
|
"type": "module",
|
||||||
"description": "Implementation of the Parity codec",
|
"description": "Implementation of the Parity codec",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"./detectPackage.js",
|
"./detectPackage.js",
|
||||||
"./detectPackage.mjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"maintainers": [],
|
"maintainers": [],
|
||||||
@@ -15,15 +16,15 @@
|
|||||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.13.8",
|
"@babel/runtime": "^7.13.9",
|
||||||
"@polkadot/metadata": "3.11.1",
|
"@polkadot/metadata": "4.0.1",
|
||||||
"@polkadot/util": "^5.9.2",
|
"@polkadot/util": "^6.0.4",
|
||||||
"@polkadot/util-crypto": "^5.9.2",
|
"@polkadot/util-crypto": "^6.0.4",
|
||||||
"@polkadot/x-rxjs": "^5.9.2",
|
"@polkadot/x-rxjs": "^6.0.4",
|
||||||
"@types/bn.js": "^4.11.6",
|
"@types/bn.js": "^4.11.6",
|
||||||
"bn.js": "^4.11.9"
|
"bn.js": "^4.11.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^5.9.2"
|
"@polkadot/keyring": "^6.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray
|
|||||||
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
||||||
import type { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys7, SessionKeys8, SessionKeys9, ValidatorCount } from '@polkadot/types/interfaces/session';
|
import type { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys7, SessionKeys8, SessionKeys9, ValidatorCount } from '@polkadot/types/interfaces/session';
|
||||||
import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
|
import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
|
||||||
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactScore, CompactScoreCompact, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, ReadySolution, RewardDestination, RewardDestinationTo257, RewardPoint, RoundSnapshot, SeatHolder, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
|
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactScore, CompactScoreCompact, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
|
||||||
import type { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
|
import type { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
|
||||||
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||||
import type { AccountInfo, AccountInfoWithProviders, AccountInfoWithRefCount, ApplyExtrinsicResult, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system';
|
import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system';
|
||||||
import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
||||||
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||||
import type { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
|
import type { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
|
||||||
@@ -152,8 +152,10 @@ declare module '@polkadot/types/types/registry' {
|
|||||||
'Option<AccountIndex>': Option<AccountIndex>;
|
'Option<AccountIndex>': Option<AccountIndex>;
|
||||||
'Option<AccountIndex64Junction>': Option<AccountIndex64Junction>;
|
'Option<AccountIndex64Junction>': Option<AccountIndex64Junction>;
|
||||||
'Option<AccountInfo>': Option<AccountInfo>;
|
'Option<AccountInfo>': Option<AccountInfo>;
|
||||||
|
'Option<AccountInfoWithDualRefCount>': Option<AccountInfoWithDualRefCount>;
|
||||||
'Option<AccountInfoWithProviders>': Option<AccountInfoWithProviders>;
|
'Option<AccountInfoWithProviders>': Option<AccountInfoWithProviders>;
|
||||||
'Option<AccountInfoWithRefCount>': Option<AccountInfoWithRefCount>;
|
'Option<AccountInfoWithRefCount>': Option<AccountInfoWithRefCount>;
|
||||||
|
'Option<AccountInfoWithTripleRefCount>': Option<AccountInfoWithTripleRefCount>;
|
||||||
'Option<AccountKey20Junction>': Option<AccountKey20Junction>;
|
'Option<AccountKey20Junction>': Option<AccountKey20Junction>;
|
||||||
'Option<AccountStatus>': Option<AccountStatus>;
|
'Option<AccountStatus>': Option<AccountStatus>;
|
||||||
'Option<AccountValidity>': Option<AccountValidity>;
|
'Option<AccountValidity>': Option<AccountValidity>;
|
||||||
@@ -687,7 +689,6 @@ declare module '@polkadot/types/types/registry' {
|
|||||||
'Option<ReserveAssetDeposit>': Option<ReserveAssetDeposit>;
|
'Option<ReserveAssetDeposit>': Option<ReserveAssetDeposit>;
|
||||||
'Option<Retriable>': Option<Retriable>;
|
'Option<Retriable>': Option<Retriable>;
|
||||||
'Option<RewardDestination>': Option<RewardDestination>;
|
'Option<RewardDestination>': Option<RewardDestination>;
|
||||||
'Option<RewardDestinationTo257>': Option<RewardDestinationTo257>;
|
|
||||||
'Option<RewardPoint>': Option<RewardPoint>;
|
'Option<RewardPoint>': Option<RewardPoint>;
|
||||||
'Option<RoundSnapshot>': Option<RoundSnapshot>;
|
'Option<RoundSnapshot>': Option<RoundSnapshot>;
|
||||||
'Option<RoundState>': Option<RoundState>;
|
'Option<RoundState>': Option<RoundState>;
|
||||||
@@ -896,8 +897,10 @@ declare module '@polkadot/types/types/registry' {
|
|||||||
'Vec<AccountIndex>': Vec<AccountIndex>;
|
'Vec<AccountIndex>': Vec<AccountIndex>;
|
||||||
'Vec<AccountIndex64Junction>': Vec<AccountIndex64Junction>;
|
'Vec<AccountIndex64Junction>': Vec<AccountIndex64Junction>;
|
||||||
'Vec<AccountInfo>': Vec<AccountInfo>;
|
'Vec<AccountInfo>': Vec<AccountInfo>;
|
||||||
|
'Vec<AccountInfoWithDualRefCount>': Vec<AccountInfoWithDualRefCount>;
|
||||||
'Vec<AccountInfoWithProviders>': Vec<AccountInfoWithProviders>;
|
'Vec<AccountInfoWithProviders>': Vec<AccountInfoWithProviders>;
|
||||||
'Vec<AccountInfoWithRefCount>': Vec<AccountInfoWithRefCount>;
|
'Vec<AccountInfoWithRefCount>': Vec<AccountInfoWithRefCount>;
|
||||||
|
'Vec<AccountInfoWithTripleRefCount>': Vec<AccountInfoWithTripleRefCount>;
|
||||||
'Vec<AccountKey20Junction>': Vec<AccountKey20Junction>;
|
'Vec<AccountKey20Junction>': Vec<AccountKey20Junction>;
|
||||||
'Vec<AccountStatus>': Vec<AccountStatus>;
|
'Vec<AccountStatus>': Vec<AccountStatus>;
|
||||||
'Vec<AccountValidity>': Vec<AccountValidity>;
|
'Vec<AccountValidity>': Vec<AccountValidity>;
|
||||||
@@ -1431,7 +1434,6 @@ declare module '@polkadot/types/types/registry' {
|
|||||||
'Vec<ReserveAssetDeposit>': Vec<ReserveAssetDeposit>;
|
'Vec<ReserveAssetDeposit>': Vec<ReserveAssetDeposit>;
|
||||||
'Vec<Retriable>': Vec<Retriable>;
|
'Vec<Retriable>': Vec<Retriable>;
|
||||||
'Vec<RewardDestination>': Vec<RewardDestination>;
|
'Vec<RewardDestination>': Vec<RewardDestination>;
|
||||||
'Vec<RewardDestinationTo257>': Vec<RewardDestinationTo257>;
|
|
||||||
'Vec<RewardPoint>': Vec<RewardPoint>;
|
'Vec<RewardPoint>': Vec<RewardPoint>;
|
||||||
'Vec<RoundSnapshot>': Vec<RoundSnapshot>;
|
'Vec<RoundSnapshot>': Vec<RoundSnapshot>;
|
||||||
'Vec<RoundState>': Vec<RoundState>;
|
'Vec<RoundState>': Vec<RoundState>;
|
||||||
@@ -1640,8 +1642,10 @@ declare module '@polkadot/types/types/registry' {
|
|||||||
AccountIndex: AccountIndex;
|
AccountIndex: AccountIndex;
|
||||||
AccountIndex64Junction: AccountIndex64Junction;
|
AccountIndex64Junction: AccountIndex64Junction;
|
||||||
AccountInfo: AccountInfo;
|
AccountInfo: AccountInfo;
|
||||||
|
AccountInfoWithDualRefCount: AccountInfoWithDualRefCount;
|
||||||
AccountInfoWithProviders: AccountInfoWithProviders;
|
AccountInfoWithProviders: AccountInfoWithProviders;
|
||||||
AccountInfoWithRefCount: AccountInfoWithRefCount;
|
AccountInfoWithRefCount: AccountInfoWithRefCount;
|
||||||
|
AccountInfoWithTripleRefCount: AccountInfoWithTripleRefCount;
|
||||||
AccountKey20Junction: AccountKey20Junction;
|
AccountKey20Junction: AccountKey20Junction;
|
||||||
AccountStatus: AccountStatus;
|
AccountStatus: AccountStatus;
|
||||||
AccountValidity: AccountValidity;
|
AccountValidity: AccountValidity;
|
||||||
@@ -2175,7 +2179,6 @@ declare module '@polkadot/types/types/registry' {
|
|||||||
ReserveAssetDeposit: ReserveAssetDeposit;
|
ReserveAssetDeposit: ReserveAssetDeposit;
|
||||||
Retriable: Retriable;
|
Retriable: Retriable;
|
||||||
RewardDestination: RewardDestination;
|
RewardDestination: RewardDestination;
|
||||||
RewardDestinationTo257: RewardDestinationTo257;
|
|
||||||
RewardPoint: RewardPoint;
|
RewardPoint: RewardPoint;
|
||||||
RoundSnapshot: RoundSnapshot;
|
RoundSnapshot: RoundSnapshot;
|
||||||
RoundState: RoundState;
|
RoundState: RoundState;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyJson, Codec, Registry } from '../types';
|
import type { AnyJson, Codec, Registry } from '../types';
|
||||||
|
|
||||||
import { compactToU8a, u8aConcat, u8aToHex } from '@polkadot/util';
|
import { compactToU8a, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||||
@@ -18,6 +18,8 @@ import { compareArray } from './utils';
|
|||||||
export abstract class AbstractArray<T extends Codec> extends Array<T> implements Codec {
|
export abstract class AbstractArray<T extends Codec> extends Array<T> implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
protected constructor (registry: Registry, ...values: T[]) {
|
protected constructor (registry: Registry, ...values: T[]) {
|
||||||
super(...values);
|
super(...values);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyNumber, Codec, Registry } from '../types';
|
import type { AnyNumber, Codec, Registry } from '../types';
|
||||||
import type { UIntBitLength } from './types';
|
import type { UIntBitLength } from './types';
|
||||||
|
|
||||||
@@ -67,6 +67,8 @@ function decodeAbstractInt (value: AnyNumber, bitLength: UIntBitLength, isNegati
|
|||||||
export abstract class AbstractInt extends BN implements Codec {
|
export abstract class AbstractInt extends BN implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
readonly #bitLength: UIntBitLength;
|
readonly #bitLength: UIntBitLength;
|
||||||
|
|
||||||
readonly #isSigned: boolean;
|
readonly #isSigned: boolean;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||||
|
|
||||||
import { compactFromU8a, compactToU8a, isHex, isU8a, logger, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
import { compactFromU8a, compactToU8a, isHex, isU8a, logger, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||||
@@ -79,6 +79,8 @@ function decodeSet<V extends Codec = Codec> (registry: Registry, valType: Constr
|
|||||||
export class BTreeSet<V extends Codec = Codec> extends Set<V> implements Codec {
|
export class BTreeSet<V extends Codec = Codec> extends Set<V> implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
readonly #ValClass: Constructor<V>;
|
readonly #ValClass: Constructor<V>;
|
||||||
|
|
||||||
constructor (registry: Registry, valType: Constructor<V> | keyof InterfaceTypes, rawValue?: Uint8Array | string | string[] | Set<any>) {
|
constructor (registry: Registry, valType: Constructor<V> | keyof InterfaceTypes, rawValue?: Uint8Array | string | string[] | Set<any>) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyJson, BareOpts, Codec, Registry } from '../types';
|
import type { AnyJson, BareOpts, Codec, Registry } from '../types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,6 +11,8 @@ import type { AnyJson, BareOpts, Codec, Registry } from '../types';
|
|||||||
export abstract class Base<T extends Codec> implements Codec {
|
export abstract class Base<T extends Codec> implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
protected readonly _raw: T;
|
protected readonly _raw: T;
|
||||||
|
|
||||||
protected constructor (registry: Registry, value: T) {
|
protected constructor (registry: Registry, value: T) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces';
|
import type { CodecHash, Hash } from '../interfaces';
|
||||||
import type { AnyJson, AnyNumber, Constructor, ICompact, InterfaceTypes, Registry } from '../types';
|
import type { AnyJson, AnyNumber, Constructor, ICompact, InterfaceTypes, Registry } from '../types';
|
||||||
import type { CompactEncodable, UIntBitLength } from './types';
|
import type { CompactEncodable, UIntBitLength } from './types';
|
||||||
|
|
||||||
@@ -22,6 +22,8 @@ import { typeToConstructor } from './utils';
|
|||||||
export class Compact<T extends CompactEncodable> implements ICompact<T> {
|
export class Compact<T extends CompactEncodable> implements ICompact<T> {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
readonly #Type: Constructor<T>;
|
readonly #Type: Constructor<T>;
|
||||||
|
|
||||||
readonly #raw: T;
|
readonly #raw: T;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyNumber, Codec, Registry } from '../types';
|
import type { AnyNumber, Codec, Registry } from '../types';
|
||||||
import type { UIntBitLength } from './types';
|
import type { UIntBitLength } from './types';
|
||||||
|
|
||||||
@@ -24,6 +24,8 @@ const BITLENGTH: UIntBitLength = 64;
|
|||||||
export class CodecDate extends Date implements Codec {
|
export class CodecDate extends Date implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
constructor (registry: Registry, value: CodecDate | Date | AnyNumber = 0) {
|
constructor (registry: Registry, value: CodecDate | Date | AnyNumber = 0) {
|
||||||
super(CodecDate.decodeDate(value));
|
super(CodecDate.decodeDate(value));
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ describe('Enum', (): void => {
|
|||||||
{ Text, U32 },
|
{ Text, U32 },
|
||||||
new Uint8Array([1, 2 << 2, 49, 50])
|
new Uint8Array([1, 2 << 2, 49, 50])
|
||||||
).toString()
|
).toString()
|
||||||
).toEqual('{"U32":3289352}');
|
).toEqual('{"u32":3289352}');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('decodes from a JSON input (lowercase)', (): void => {
|
it('decodes from a JSON input (lowercase)', (): void => {
|
||||||
@@ -43,7 +43,7 @@ describe('Enum', (): void => {
|
|||||||
).toEqual('some text value');
|
).toEqual('some text value');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('decodes reusing instanciated inputs', (): void => {
|
it('decodes reusing instantiated inputs', (): void => {
|
||||||
const foo = new Text(registry, 'bar');
|
const foo = new Text(registry, 'bar');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
@@ -144,8 +144,8 @@ describe('Enum', (): void => {
|
|||||||
class C extends Null { }
|
class C extends Null { }
|
||||||
const Test = Enum.with({ A, B, C });
|
const Test = Enum.with({ A, B, C });
|
||||||
|
|
||||||
expect(new Test(registry).toJSON()).toEqual({ A: null });
|
expect(new Test(registry).toJSON()).toEqual({ a: null });
|
||||||
expect(new Test(registry, 1234, 1).toJSON()).toEqual({ B: 1234 });
|
expect(new Test(registry, 1234, 1).toJSON()).toEqual({ b: 1234 });
|
||||||
expect(new Test(registry, 0x1234, 1).toU8a()).toEqual(new Uint8Array([1, 0x34, 0x12, 0x00, 0x00]));
|
expect(new Test(registry, 0x1234, 1).toU8a()).toEqual(new Uint8Array([1, 0x34, 0x12, 0x00, 0x00]));
|
||||||
expect(new Test(registry, 0x1234, 1).toU8a(true)).toEqual(new Uint8Array([0x34, 0x12, 0x00, 0x00]));
|
expect(new Test(registry, 0x1234, 1).toU8a(true)).toEqual(new Uint8Array([0x34, 0x12, 0x00, 0x00]));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces';
|
import type { CodecHash, Hash } from '../interfaces';
|
||||||
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||||
|
|
||||||
import { assert, hexToU8a, isHex, isNumber, isObject, isString, isU8a, isUndefined, stringCamelCase, stringUpperFirst, u8aConcat, u8aToHex } from '@polkadot/util';
|
import { assert, hexToU8a, isHex, isNumber, isObject, isString, isU8a, isUndefined, stringCamelCase, stringUpperFirst, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||||
@@ -99,7 +99,7 @@ function createFromValue (registry: Registry, def: TypesDef, index = 0, value?:
|
|||||||
}
|
}
|
||||||
|
|
||||||
function decodeFromJSON (registry: Registry, def: TypesDef, key: string, value?: any): Decoded {
|
function decodeFromJSON (registry: Registry, def: TypesDef, key: string, value?: any): Decoded {
|
||||||
// JSON comes in the form of { "<type (lowercased)>": "<value for type>" }, here we
|
// JSON comes in the form of { "<type (camelCase)>": "<value for type>" }, here we
|
||||||
// additionally force to lower to ensure forward compat
|
// additionally force to lower to ensure forward compat
|
||||||
const keys = Object.keys(def).map((k) => k.toLowerCase());
|
const keys = Object.keys(def).map((k) => k.toLowerCase());
|
||||||
const keyLower = key.toLowerCase();
|
const keyLower = key.toLowerCase();
|
||||||
@@ -166,6 +166,8 @@ function decodeEnum (registry: Registry, def: TypesDef, value?: any, index?: num
|
|||||||
export class Enum implements Codec {
|
export class Enum implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
readonly #def: TypesDef;
|
readonly #def: TypesDef;
|
||||||
|
|
||||||
readonly #entryIndex: number;
|
readonly #entryIndex: number;
|
||||||
@@ -343,7 +345,7 @@ export class Enum implements Codec {
|
|||||||
public toJSON (): AnyJson {
|
public toJSON (): AnyJson {
|
||||||
return this.#isBasic
|
return this.#isBasic
|
||||||
? this.type
|
? this.type
|
||||||
: { [this.type]: this.#raw.toJSON() };
|
: { [stringCamelCase(this.type)]: this.#raw.toJSON() };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyJson, Codec, Registry } from '../types';
|
import type { AnyJson, Codec, Registry } from '../types';
|
||||||
|
|
||||||
import { isFunction, isUndefined } from '@polkadot/util';
|
import { isFunction, isUndefined } from '@polkadot/util';
|
||||||
@@ -24,6 +24,8 @@ function decodeJson (value?: Record<string, unknown> | null): [string, any][] {
|
|||||||
export class Json extends Map<string, any> implements Codec {
|
export class Json extends Map<string, any> implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
constructor (registry: Registry, value?: Record<string, unknown> | null) {
|
constructor (registry: Registry, value?: Record<string, unknown> | null) {
|
||||||
const decoded = decodeJson(value);
|
const decoded = decodeJson(value);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ describe('Linkage', (): void => {
|
|||||||
// prefs sanity check
|
// prefs sanity check
|
||||||
expect(
|
expect(
|
||||||
registry.createType(
|
registry.createType(
|
||||||
'ValidatorPrefs',
|
'ValidatorPrefsWithCommission',
|
||||||
'0x0284d717'
|
'0x0284d717'
|
||||||
).toHuman()
|
).toHuman()
|
||||||
).toEqual(PREFS);
|
).toEqual(PREFS);
|
||||||
@@ -33,7 +33,7 @@ describe('Linkage', (): void => {
|
|||||||
// actual check
|
// actual check
|
||||||
expect(
|
expect(
|
||||||
registry.createType(
|
registry.createType(
|
||||||
'(ValidatorPrefs, Linkage<AccountId>)' as 'u32',
|
'(ValidatorPrefsWithCommission, Linkage<AccountId>)' as 'u32',
|
||||||
'0x0284d7170001da30b68f54f686f586ddb29de12b682dd8bd1404566fb8a8db5dec20aa5b6b36'
|
'0x0284d7170001da30b68f54f686f586ddb29de12b682dd8bd1404566fb8a8db5dec20aa5b6b36'
|
||||||
).toHuman()
|
).toHuman()
|
||||||
).toEqual([PREFS, LINKA]);
|
).toEqual([PREFS, LINKA]);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||||
|
|
||||||
import { compactFromU8a, compactToU8a, isHex, isObject, isU8a, logger, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
import { compactFromU8a, compactToU8a, isHex, isObject, isU8a, logger, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||||
@@ -88,6 +88,8 @@ function decodeMap<K extends Codec = Codec, V extends Codec = Codec> (registry:
|
|||||||
export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends Map<K, V> implements Codec {
|
export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends Map<K, V> implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
readonly #KeyClass: Constructor<K>;
|
readonly #KeyClass: Constructor<K>;
|
||||||
|
|
||||||
readonly #ValClass: Constructor<V>;
|
readonly #ValClass: Constructor<V>;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces';
|
import type { CodecHash, Hash } from '../interfaces';
|
||||||
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||||
|
|
||||||
import { assert, isNull, isU8a, isUndefined, u8aToHex } from '@polkadot/util';
|
import { assert, isNull, isU8a, isUndefined, u8aToHex } from '@polkadot/util';
|
||||||
@@ -50,6 +50,8 @@ function decodeOption (registry: Registry, typeName: Constructor | keyof Interfa
|
|||||||
export class Option<T extends Codec> implements Codec {
|
export class Option<T extends Codec> implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
readonly #Type: Constructor<T>;
|
readonly #Type: Constructor<T>;
|
||||||
|
|
||||||
readonly #raw: T;
|
readonly #raw: T;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyJson, AnyU8a, IU8a, Registry } from '../types';
|
import type { AnyJson, AnyU8a, IU8a, Registry } from '../types';
|
||||||
|
|
||||||
import { assert, isAscii, isUndefined, isUtf8, u8aToHex, u8aToString, u8aToU8a } from '@polkadot/util';
|
import { assert, isAscii, isUndefined, isUtf8, u8aToHex, u8aToString, u8aToU8a } from '@polkadot/util';
|
||||||
@@ -18,6 +18,8 @@ import { assert, isAscii, isUndefined, isUtf8, u8aToHex, u8aToString, u8aToU8a }
|
|||||||
export class Raw extends Uint8Array implements IU8a {
|
export class Raw extends Uint8Array implements IU8a {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
constructor (registry: Registry, value?: AnyU8a) {
|
constructor (registry: Registry, value?: AnyU8a) {
|
||||||
super(u8aToU8a(value));
|
super(u8aToU8a(value));
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe('Result', (): void => {
|
|||||||
expect(result.asOk.toU8a()).toEqual(new Uint8Array([1, 2, 3, 4]));
|
expect(result.asOk.toU8a()).toEqual(new Uint8Array([1, 2, 3, 4]));
|
||||||
expect(result.toHex()).toEqual('0x0001020304');
|
expect(result.toHex()).toEqual('0x0001020304');
|
||||||
expect(result.toJSON()).toEqual({
|
expect(result.toJSON()).toEqual({
|
||||||
Ok: 0x04030201
|
ok: 0x04030201
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ describe('Result', (): void => {
|
|||||||
expect(result.asErr.toU8a()).toEqual(new Uint8Array([4 << 2, 100, 101, 102, 103]));
|
expect(result.asErr.toU8a()).toEqual(new Uint8Array([4 << 2, 100, 101, 102, 103]));
|
||||||
expect(result.toHex()).toEqual('0x011064656667');
|
expect(result.toHex()).toEqual('0x011064656667');
|
||||||
expect(result.toJSON()).toEqual({
|
expect(result.toJSON()).toEqual({
|
||||||
Err: hexToString('0x64656667')
|
err: hexToString('0x64656667')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { Codec, Constructor, Registry } from '../types';
|
import type { Codec, Constructor, Registry } from '../types';
|
||||||
|
|
||||||
import BN from 'bn.js';
|
import BN from 'bn.js';
|
||||||
@@ -80,6 +80,8 @@ function decodeSet (setValues: SetValues, value: string[] | Set<string> | Uint8A
|
|||||||
export class CodecSet extends Set<string> implements Codec {
|
export class CodecSet extends Set<string> implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
readonly #allowed: SetValues;
|
readonly #allowed: SetValues;
|
||||||
|
|
||||||
readonly #byteLength: number;
|
readonly #byteLength: number;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyJson, BareOpts, Codec, Constructor, ConstructorDef, InterfaceTypes, Registry } from '../types';
|
import type { AnyJson, BareOpts, Codec, Constructor, ConstructorDef, InterfaceTypes, Registry } from '../types';
|
||||||
|
|
||||||
import { hexToU8a, isBoolean, isFunction, isHex, isObject, isU8a, isUndefined, stringCamelCase, u8aConcat, u8aToHex } from '@polkadot/util';
|
import { hexToU8a, isBoolean, isFunction, isHex, isObject, isU8a, isUndefined, stringCamelCase, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||||
@@ -135,6 +135,8 @@ export class Struct<
|
|||||||
E extends { [K in keyof S]: string } = { [K in keyof S]: string }> extends Map<keyof S, Codec> implements Codec {
|
E extends { [K in keyof S]: string } = { [K in keyof S]: string }> extends Map<keyof S, Codec> implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
readonly #jsonMap: Map<keyof S, string>;
|
readonly #jsonMap: Map<keyof S, string>;
|
||||||
|
|
||||||
readonly #Types: ConstructorDef;
|
readonly #Types: ConstructorDef;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ describe('createType', (): void => {
|
|||||||
it('allows creation of a Enum (with types)', (): void => {
|
it('allows creation of a Enum (with types)', (): void => {
|
||||||
expect(
|
expect(
|
||||||
createTypeUnsafe(registry, '{"_enum": {"A": null, "B": "u32", "C": null} }', [1]).toJSON()
|
createTypeUnsafe(registry, '{"_enum": {"A": null, "B": "u32", "C": null} }', [1]).toJSON()
|
||||||
).toEqual({ B: 0 });
|
).toEqual({ b: 0 });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows creation of a Enum (with indexes)', (): void => {
|
it('allows creation of a Enum (with indexes)', (): void => {
|
||||||
@@ -72,7 +72,7 @@ describe('createType', (): void => {
|
|||||||
it('allows creation of a Result', (): void => {
|
it('allows creation of a Result', (): void => {
|
||||||
expect(
|
expect(
|
||||||
createTypeUnsafe(registry, 'Result<u32,Text>', ['0x011064656667']).toJSON()
|
createTypeUnsafe(registry, 'Result<u32,Text>', ['0x011064656667']).toJSON()
|
||||||
).toEqual({ Err: 'defg' });
|
).toEqual({ err: 'defg' });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows creation of a Set', (): void => {
|
it('allows creation of a Set', (): void => {
|
||||||
|
|||||||
@@ -4,72 +4,72 @@
|
|||||||
import type { Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
import type { Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||||
import type { FromReg } from './types';
|
import type { FromReg } from './types';
|
||||||
|
|
||||||
import { isU8a, logger, u8aToHex } from '@polkadot/util';
|
import { logger } from '@polkadot/util';
|
||||||
|
|
||||||
import { createClass } from './createClass';
|
import { createClass } from './createClass';
|
||||||
|
|
||||||
interface UnsafeOptions {
|
interface CreateOptions {
|
||||||
|
blockHash?: Uint8Array | string | null;
|
||||||
isPedantic?: boolean;
|
isPedantic?: boolean;
|
||||||
withoutLog?: boolean;
|
withoutLog?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const l = logger('registry');
|
const l = logger('registry');
|
||||||
|
|
||||||
function u8aHasValue (value: Uint8Array): boolean {
|
// TODO: Fix and re-enable
|
||||||
return value.some((v): boolean => !!v);
|
|
||||||
}
|
|
||||||
|
|
||||||
// With isPedantic, actually check that the encoding matches that supplied. This
|
// With isPedantic, actually check that the encoding matches that supplied. This
|
||||||
// is much slower, but verifies that we have the correct types defined
|
// is much slower, but verifies that we have the correct types defined
|
||||||
function checkInstance<T extends Codec = Codec, K extends string = string> (value: Uint8Array, created: FromReg<T, K>): void {
|
// function checkInstance<T extends Codec = Codec, K extends string = string> (value: Uint8Array, created: FromReg<T, K>): void {
|
||||||
// the underlying type created.toRawType()
|
// // the underlying type created.toRawType()
|
||||||
const rawType = created.toRawType();
|
// const rawType = created.toRawType();
|
||||||
|
|
||||||
// ignore bytes completely - this is probably a FIXME, since these are somewhat
|
// // ignore bytes completely - this is probably a FIXME, since these are somewhat
|
||||||
// breaking for at least online queries - not quite sure wtf is going wrong here
|
// // breaking for at least online queries - not quite sure wtf is going wrong here
|
||||||
if (rawType === 'Bytes') {
|
// if (rawType === 'Bytes') {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// the hex values for what we have
|
// // the hex values for what we have
|
||||||
const inHex = u8aToHex(value);
|
// const inHex = u8aToHex(value);
|
||||||
const crHex = created.toHex();
|
// const crHex = created.toHex();
|
||||||
|
|
||||||
// Check equality, based on some different approaches (as decoded)
|
// // Check equality, based on some different approaches (as decoded)
|
||||||
const isEqual = inHex === crHex || // raw hex values, quick path
|
// const isEqual = inHex === crHex || // raw hex values, quick path
|
||||||
inHex === created.toHex(true) || // wrapped options
|
// inHex === created.toHex(true) || // wrapped options
|
||||||
u8aToHex(value.reverse()) === crHex; // reverse (for numbers, which are BE)
|
// u8aToHex(value.reverse()) === crHex; // reverse (for numbers, which are BE)
|
||||||
|
|
||||||
// if the hex doesn't match and the value for both is non-empty, complain... bitterly
|
// // if the hex doesn't match and the value for both is non-empty, complain... bitterly
|
||||||
if (!isEqual && (u8aHasValue(value) || u8aHasValue(created.toU8a(true)))) {
|
// if (!isEqual && (u8aHasValue(value) || u8aHasValue(created.toU8a(true)))) {
|
||||||
l.warn(`${rawType}:: Input doesn't match output, received ${u8aToHex(value)}, created ${crHex}`);
|
// l.warn(`${rawType}:: Input doesn't match output, received ${u8aToHex(value)}, created ${crHex}`);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Initializes a type with a value. This also checks for fallbacks and in the cases
|
// Initializes a type with a value. This also checks for fallbacks and in the cases
|
||||||
// where isPedantic is specified (storage decoding), also check the format/structure
|
// where isPedantic is specified (storage decoding), also check the format/structure
|
||||||
function initType<T extends Codec = Codec, K extends string = string> (registry: Registry, Type: Constructor<FromReg<T, K>>, params: any[] = [], isPedantic?: boolean): FromReg<T, K> {
|
function initType<T extends Codec = Codec, K extends string = string> (registry: Registry, Type: Constructor<FromReg<T, K>>, params: any[] = [], { blockHash }: CreateOptions = {}): FromReg<T, K> {
|
||||||
const created = new Type(registry, ...params);
|
const created = new Type(registry, ...params);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
||||||
const [value] = params;
|
|
||||||
|
|
||||||
if (isPedantic && isU8a(value)) {
|
if (blockHash) {
|
||||||
checkInstance(value, created);
|
created.createdAtHash = createType(registry, 'Hash', blockHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (isPedantic && isU8a(value)) {
|
||||||
|
// checkInstance(value, created);
|
||||||
|
// }
|
||||||
|
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
// An unsafe version of the `createType` below. It's unsafe because the `type`
|
// An unsafe version of the `createType` below. It's unsafe because the `type`
|
||||||
// argument here can be any string, which, when it cannot parse, will yield a
|
// argument here can be any string, which, when it cannot parse, will yield a
|
||||||
// runtime error.
|
// runtime error.
|
||||||
export function createTypeUnsafe<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K, params: any[] = [], { withoutLog }: UnsafeOptions = {}): T {
|
export function createTypeUnsafe<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K, params: any[] = [], options: CreateOptions = {}): T {
|
||||||
try {
|
try {
|
||||||
// Circle back to isPedantic when it handles all cases 100% - as of now,
|
// Circle back to isPedantic when it handles all cases 100% - as of now,
|
||||||
// it provides false warning which is more hinderance than help
|
// it provides false warning which is more hinderance than help
|
||||||
return initType(registry, createClass<T, K>(registry, type), params); // , isPedantic);
|
return initType(registry, createClass<T, K>(registry, type), params, options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
!withoutLog && l.error(error);
|
!options.withoutLog && l.error(error);
|
||||||
|
|
||||||
throw new Error(`createType(${type}):: ${(error as Error).message}`);
|
throw new Error(`createType(${type}):: ${(error as Error).message}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
|
|
||||||
import type { ExtDef } from '../extrinsic/signedExtensions/types';
|
import type { ExtDef } from '../extrinsic/signedExtensions/types';
|
||||||
import type { ChainProperties, CodecHash, DispatchErrorModule } from '../interfaces/types';
|
import type { ChainProperties, CodecHash, DispatchErrorModule, Hash } from '../interfaces/types';
|
||||||
import type { CallFunction, Codec, CodecHasher, Constructor, InterfaceTypes, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types';
|
import type { CallFunction, Codec, CodecHasher, Constructor, InterfaceTypes, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types';
|
||||||
|
|
||||||
// we are attempting to avoid circular refs, hence the Metadata path import
|
// we are attempting to avoid circular refs, hence the Metadata path import
|
||||||
@@ -136,11 +136,17 @@ export class TypeRegistry implements Registry {
|
|||||||
|
|
||||||
#userExtensions?: ExtDef;
|
#userExtensions?: ExtDef;
|
||||||
|
|
||||||
constructor () {
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
|
constructor (createdAtHash?: Hash | Uint8Array | string) {
|
||||||
this.#knownDefaults = { Json, Metadata, Raw, ...baseTypes };
|
this.#knownDefaults = { Json, Metadata, Raw, ...baseTypes };
|
||||||
this.#knownDefinitions = definitions as unknown as Record<string, { types: RegistryTypes }>;
|
this.#knownDefinitions = definitions as unknown as Record<string, { types: RegistryTypes }>;
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
|
if (createdAtHash) {
|
||||||
|
this.createdAtHash = this.createType('Hash', createdAtHash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public init (): this {
|
public init (): this {
|
||||||
@@ -193,6 +199,10 @@ export class TypeRegistry implements Registry {
|
|||||||
return this.#knownTypes;
|
return this.#knownTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get unknownTypes (): string[] {
|
||||||
|
return [...this.#unknownTypes.keys()];
|
||||||
|
}
|
||||||
|
|
||||||
public get signedExtensions (): string[] {
|
public get signedExtensions (): string[] {
|
||||||
return this.#signedExtensions;
|
return this.#signedExtensions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ describe('ExtrinsicEra', (): void => {
|
|||||||
const extrinsicEra = new ExtrinsicEra(registry, new Uint8Array([0]));
|
const extrinsicEra = new ExtrinsicEra(registry, new Uint8Array([0]));
|
||||||
|
|
||||||
expect(extrinsicEra.asImmortalEra).toBeDefined();
|
expect(extrinsicEra.asImmortalEra).toBeDefined();
|
||||||
expect(extrinsicEra.toJSON()).toEqual({ ImmortalEra: '0x00' });
|
expect(extrinsicEra.toJSON()).toEqual({ immortalEra: '0x00' });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('decodes an Extrinsic Era from u8 as mortal', (): void => {
|
it('decodes an Extrinsic Era from u8 as mortal', (): void => {
|
||||||
@@ -35,13 +35,13 @@ describe('ExtrinsicEra', (): void => {
|
|||||||
expect(extrinsicEra.asMortalEra.phase.toNumber()).toEqual(120);
|
expect(extrinsicEra.asMortalEra.phase.toNumber()).toEqual(120);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('serializes and de-serializes from JSON', (): void => {
|
it.only('serializes and de-serializes from JSON', (): void => {
|
||||||
const extrinsicEra = new ExtrinsicEra(registry, new Uint8Array([78, 156]));
|
const extrinsicEra = new ExtrinsicEra(registry, new Uint8Array([78, 156]));
|
||||||
const u8a = extrinsicEra.toU8a();
|
const u8a = extrinsicEra.toU8a();
|
||||||
const json = extrinsicEra.toJSON();
|
const json = extrinsicEra.toJSON();
|
||||||
|
|
||||||
expect(u8a).toEqual(new Uint8Array([78, 156]));
|
expect(u8a).toEqual(new Uint8Array([78, 156]));
|
||||||
expect(json).toEqual({ MortalEra: '0x4e9c' });
|
expect(json).toEqual({ mortalEra: '0x4e9c' });
|
||||||
expect(new ExtrinsicEra(registry, json).toU8a()).toEqual(u8a);
|
expect(new ExtrinsicEra(registry, json).toU8a()).toEqual(u8a);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -218,11 +218,15 @@ export class GenericExtrinsicEra extends Enum implements IExtrinsicEra {
|
|||||||
? new Uint8Array([0])
|
? new Uint8Array([0])
|
||||||
: new Uint8Array([1, value[0], value[1]]);
|
: new Uint8Array([1, value[0], value[1]]);
|
||||||
} else if (isObject(value)) {
|
} else if (isObject(value)) {
|
||||||
|
const entries = Object.entries(value as MortalEnumDef).map(([k, v]): [string, any] => [k.toLowerCase(), v]);
|
||||||
|
const mortal = entries.find(([k]) => k.toLowerCase() === 'mortalera');
|
||||||
|
const immortal = entries.find(([k]) => k.toLowerCase() === 'immortalera');
|
||||||
|
|
||||||
// this is to de-serialize from JSON
|
// this is to de-serialize from JSON
|
||||||
return (value as MortalEnumDef).MortalEra
|
return mortal
|
||||||
? { MortalEra: (value as MortalEnumDef).MortalEra }
|
? { MortalEra: mortal[1] as string }
|
||||||
: (value as ImmortalEnumDef).ImmortalEra
|
: immortal
|
||||||
? { ImmortalEra: (value as ImmortalEnumDef).ImmortalEra }
|
? { ImmortalEra: immortal[1] as string }
|
||||||
: { MortalEra: value };
|
: { MortalEra: value };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,10 @@ export default {
|
|||||||
license: 'Option<Text>'
|
license: 'Option<Text>'
|
||||||
},
|
},
|
||||||
ContractProjectSource: {
|
ContractProjectSource: {
|
||||||
hash: '[u8; 32]',
|
_alias: {
|
||||||
|
wasmHash: 'hash'
|
||||||
|
},
|
||||||
|
wasmHash: '[u8; 32]',
|
||||||
language: 'Text',
|
language: 'Text',
|
||||||
compiler: 'Text',
|
compiler: 'Text',
|
||||||
wasm: 'Raw'
|
wasm: 'Raw'
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export interface ContractProjectContract extends Struct {
|
|||||||
|
|
||||||
/** @name ContractProjectSource */
|
/** @name ContractProjectSource */
|
||||||
export interface ContractProjectSource extends Struct {
|
export interface ContractProjectSource extends Struct {
|
||||||
readonly hash: U8aFixed;
|
readonly wasmHash: U8aFixed;
|
||||||
readonly language: Text;
|
readonly language: Text;
|
||||||
readonly compiler: Text;
|
readonly compiler: Text;
|
||||||
readonly wasm: Raw;
|
readonly wasm: Raw;
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ describe('Registration', (): void => {
|
|||||||
deposit: 10000000000000, // '0x0000000000000000000009184e72a000',
|
deposit: 10000000000000, // '0x0000000000000000000009184e72a000',
|
||||||
info: {
|
info: {
|
||||||
additional: [],
|
additional: [],
|
||||||
display: { Raw: '0x9911' },
|
display: { raw: '0x9911' },
|
||||||
email: { Raw: '0x9933' },
|
email: { raw: '0x9933' },
|
||||||
image: { None: null },
|
image: { none: null },
|
||||||
legal: { Raw: '0x9922' },
|
legal: { raw: '0x9922' },
|
||||||
pgpFingerprint: null,
|
pgpFingerprint: null,
|
||||||
riot: { Raw: '0x9955' },
|
riot: { raw: '0x9955' },
|
||||||
twitter: { Raw: '0x9966' },
|
twitter: { raw: '0x9966' },
|
||||||
web: { Raw: '0x9944' }
|
web: { raw: '0x9944' }
|
||||||
},
|
},
|
||||||
judgements: []
|
judgements: []
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { TypeRegistry } from '../../create';
|
||||||
|
|
||||||
|
describe('offchain definitions', (): void => {
|
||||||
|
const registry = new TypeRegistry();
|
||||||
|
|
||||||
|
describe('StorageKind', (): void => {
|
||||||
|
it('has the correct indexes', (): void => {
|
||||||
|
expect(registry.createType('StorageKind').index).toEqual(1);
|
||||||
|
expect(registry.createType('StorageKind', 'LOCAL').index).toEqual(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has a correct JSON for the type', (): void => {
|
||||||
|
expect(registry.createType('StorageKind').toJSON()).toEqual('PERSISTENT');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -166,13 +166,6 @@ export default {
|
|||||||
Account: 'AccountId'
|
Account: 'AccountId'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
RewardDestinationTo257: {
|
|
||||||
_enum: [
|
|
||||||
'Staked',
|
|
||||||
'Stash',
|
|
||||||
'Controller'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
RewardPoint: 'u32',
|
RewardPoint: 'u32',
|
||||||
SlashJournalEntry: {
|
SlashJournalEntry: {
|
||||||
who: 'AccountId',
|
who: 'AccountId',
|
||||||
@@ -229,7 +222,7 @@ export default {
|
|||||||
},
|
},
|
||||||
ValidatorIndex: 'u16',
|
ValidatorIndex: 'u16',
|
||||||
ValidatorIndexCompact: 'Compact<ValidatorIndex>',
|
ValidatorIndexCompact: 'Compact<ValidatorIndex>',
|
||||||
ValidatorPrefs: 'ValidatorPrefsWithCommission',
|
ValidatorPrefs: 'ValidatorPrefsWithBlocked',
|
||||||
ValidatorPrefsWithCommission: {
|
ValidatorPrefsWithCommission: {
|
||||||
commission: 'Compact<Perbill>'
|
commission: 'Compact<Perbill>'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -187,13 +187,6 @@ export interface RewardDestination extends Enum {
|
|||||||
readonly asAccount: AccountId;
|
readonly asAccount: AccountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @name RewardDestinationTo257 */
|
|
||||||
export interface RewardDestinationTo257 extends Enum {
|
|
||||||
readonly isStaked: boolean;
|
|
||||||
readonly isStash: boolean;
|
|
||||||
readonly isController: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @name RewardPoint */
|
/** @name RewardPoint */
|
||||||
export interface RewardPoint extends u32 {}
|
export interface RewardPoint extends u32 {}
|
||||||
|
|
||||||
@@ -307,7 +300,7 @@ export interface ValidatorIndex extends u16 {}
|
|||||||
export interface ValidatorIndexCompact extends Compact<ValidatorIndex> {}
|
export interface ValidatorIndexCompact extends Compact<ValidatorIndex> {}
|
||||||
|
|
||||||
/** @name ValidatorPrefs */
|
/** @name ValidatorPrefs */
|
||||||
export interface ValidatorPrefs extends ValidatorPrefsWithCommission {}
|
export interface ValidatorPrefs extends ValidatorPrefsWithBlocked {}
|
||||||
|
|
||||||
/** @name ValidatorPrefsTo145 */
|
/** @name ValidatorPrefsTo145 */
|
||||||
export interface ValidatorPrefsTo145 extends Struct {
|
export interface ValidatorPrefsTo145 extends Struct {
|
||||||
|
|||||||
@@ -140,12 +140,21 @@ export default {
|
|||||||
refcount: 'RefCount',
|
refcount: 'RefCount',
|
||||||
data: 'AccountData'
|
data: 'AccountData'
|
||||||
},
|
},
|
||||||
AccountInfoWithProviders: {
|
AccountInfoWithDualRefCount: {
|
||||||
nonce: 'Index',
|
nonce: 'Index',
|
||||||
consumers: 'RefCount',
|
consumers: 'RefCount',
|
||||||
providers: 'RefCount',
|
providers: 'RefCount',
|
||||||
data: 'AccountData'
|
data: 'AccountData'
|
||||||
},
|
},
|
||||||
|
// original naming
|
||||||
|
AccountInfoWithProviders: 'AccountInfoWithDualRefCount',
|
||||||
|
AccountInfoWithTripleRefCount: {
|
||||||
|
nonce: 'Index',
|
||||||
|
consumers: 'RefCount',
|
||||||
|
providers: 'RefCount',
|
||||||
|
sufficients: 'RefCount',
|
||||||
|
data: 'AccountData'
|
||||||
|
},
|
||||||
ApplyExtrinsicResult: 'Result<DispatchOutcome, TransactionValidityError>',
|
ApplyExtrinsicResult: 'Result<DispatchOutcome, TransactionValidityError>',
|
||||||
BlockLength: {
|
BlockLength: {
|
||||||
max: 'PerDispatchClassU32'
|
max: 'PerDispatchClassU32'
|
||||||
|
|||||||
@@ -9,14 +9,17 @@ import type { AccountId, BlockNumber, Digest, Hash, Index, Pays, Weight } from '
|
|||||||
/** @name AccountInfo */
|
/** @name AccountInfo */
|
||||||
export interface AccountInfo extends AccountInfoWithRefCount {}
|
export interface AccountInfo extends AccountInfoWithRefCount {}
|
||||||
|
|
||||||
/** @name AccountInfoWithProviders */
|
/** @name AccountInfoWithDualRefCount */
|
||||||
export interface AccountInfoWithProviders extends Struct {
|
export interface AccountInfoWithDualRefCount extends Struct {
|
||||||
readonly nonce: Index;
|
readonly nonce: Index;
|
||||||
readonly consumers: RefCount;
|
readonly consumers: RefCount;
|
||||||
readonly providers: RefCount;
|
readonly providers: RefCount;
|
||||||
readonly data: AccountData;
|
readonly data: AccountData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @name AccountInfoWithProviders */
|
||||||
|
export interface AccountInfoWithProviders extends AccountInfoWithDualRefCount {}
|
||||||
|
|
||||||
/** @name AccountInfoWithRefCount */
|
/** @name AccountInfoWithRefCount */
|
||||||
export interface AccountInfoWithRefCount extends Struct {
|
export interface AccountInfoWithRefCount extends Struct {
|
||||||
readonly nonce: Index;
|
readonly nonce: Index;
|
||||||
@@ -24,6 +27,15 @@ export interface AccountInfoWithRefCount extends Struct {
|
|||||||
readonly data: AccountData;
|
readonly data: AccountData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @name AccountInfoWithTripleRefCount */
|
||||||
|
export interface AccountInfoWithTripleRefCount extends Struct {
|
||||||
|
readonly nonce: Index;
|
||||||
|
readonly consumers: RefCount;
|
||||||
|
readonly providers: RefCount;
|
||||||
|
readonly sufficients: RefCount;
|
||||||
|
readonly data: AccountData;
|
||||||
|
}
|
||||||
|
|
||||||
/** @name ApplyExtrinsicResult */
|
/** @name ApplyExtrinsicResult */
|
||||||
export interface ApplyExtrinsicResult extends Result<DispatchOutcome, TransactionValidityError> {
|
export interface ApplyExtrinsicResult extends Result<DispatchOutcome, TransactionValidityError> {
|
||||||
readonly isErr: boolean;
|
readonly isErr: boolean;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2017-2021 @polkadot/dev authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Auto-generated by @polkadot/dev, do not edit
|
// Auto-generated by @polkadot/dev, do not edit
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/types', version: '3.11.1' };
|
export const packageInfo = { name: '@polkadot/types', version: '4.0.1' };
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { Codec, Registry } from '../types';
|
import type { Codec, Registry } from '../types';
|
||||||
|
|
||||||
import { isU8a, u8aToHex } from '@polkadot/util';
|
import { isU8a, u8aToHex } from '@polkadot/util';
|
||||||
@@ -26,6 +26,8 @@ function decodeBool (value: any): boolean {
|
|||||||
export class bool extends Boolean implements Codec {
|
export class bool extends Boolean implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
constructor (registry: Registry, value: bool | Boolean | Uint8Array | boolean | number = false) {
|
constructor (registry: Registry, value: bool | Boolean | Uint8Array | boolean | number = false) {
|
||||||
super(decodeBool(value));
|
super(decodeBool(value));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { Codec, Registry } from '../types';
|
import type { Codec, Registry } from '../types';
|
||||||
|
|
||||||
import { isNull } from '@polkadot/util';
|
import { isNull } from '@polkadot/util';
|
||||||
@@ -14,6 +14,8 @@ import { isNull } from '@polkadot/util';
|
|||||||
export class Null implements Codec {
|
export class Null implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
constructor (registry: Registry) {
|
constructor (registry: Registry) {
|
||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { AnyU8a, Codec, Registry } from '../types';
|
import type { AnyU8a, Codec, Registry } from '../types';
|
||||||
|
|
||||||
import { assert, compactAddLength, compactFromU8a, hexToU8a, isHex, isString, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
import { assert, compactAddLength, compactFromU8a, hexToU8a, isHex, isString, stringToU8a, u8aToHex, u8aToString } from '@polkadot/util';
|
||||||
@@ -50,6 +50,8 @@ function decodeText (value?: null | Text | string | AnyU8a | { toString: () => s
|
|||||||
export class Text extends String implements Codec {
|
export class Text extends String implements Codec {
|
||||||
public readonly registry: Registry;
|
public readonly registry: Registry;
|
||||||
|
|
||||||
|
public createdAtHash?: Hash;
|
||||||
|
|
||||||
#override: string | null = null;
|
#override: string | null = null;
|
||||||
|
|
||||||
constructor (registry: Registry, value?: null | Text | string | AnyU8a | { toString: () => string }) {
|
constructor (registry: Registry, value?: null | Text | string | AnyU8a | { toString: () => string }) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type BN from 'bn.js';
|
import type BN from 'bn.js';
|
||||||
import type { H256 } from '../interfaces/runtime';
|
import type { Hash } from '../interfaces/runtime';
|
||||||
import type { Registry } from './registry';
|
import type { Registry } from './registry';
|
||||||
|
|
||||||
export type AnyJson = string | number | boolean | null | undefined | AnyJson[] | { [index: string]: AnyJson };
|
export type AnyJson = string | number | boolean | null | undefined | AnyJson[] | { [index: string]: AnyJson };
|
||||||
@@ -46,7 +46,7 @@ export interface Codec {
|
|||||||
/**
|
/**
|
||||||
* @description Returns a hash of the value
|
* @description Returns a hash of the value
|
||||||
*/
|
*/
|
||||||
readonly hash: H256;
|
readonly hash: Hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Checks if the value is an empty value
|
* @description Checks if the value is an empty value
|
||||||
@@ -58,6 +58,11 @@ export interface Codec {
|
|||||||
*/
|
*/
|
||||||
readonly registry: Registry;
|
readonly registry: Registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description The block at which this value was retrieved/created (set to non-empty when retrieved from storage)
|
||||||
|
*/
|
||||||
|
createdAtHash?: Hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Compares the value of the input to see if there is a match
|
* @description Compares the value of the input to see if there is a match
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type BN from 'bn.js';
|
|||||||
import type { Metadata } from '@polkadot/metadata';
|
import type { Metadata } from '@polkadot/metadata';
|
||||||
import type { Observable } from '@polkadot/x-rxjs';
|
import type { Observable } from '@polkadot/x-rxjs';
|
||||||
import type { ExtDef } from '../extrinsic/signedExtensions/types';
|
import type { ExtDef } from '../extrinsic/signedExtensions/types';
|
||||||
import type { CodecHash } from '../interfaces/runtime';
|
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||||
import type { ChainProperties } from '../interfaces/system';
|
import type { ChainProperties } from '../interfaces/system';
|
||||||
import type { CallFunction } from './calls';
|
import type { CallFunction } from './calls';
|
||||||
import type { Codec, Constructor } from './codec';
|
import type { Codec, Constructor } from './codec';
|
||||||
@@ -98,8 +98,11 @@ export interface Registry {
|
|||||||
readonly chainSS58: number | undefined;
|
readonly chainSS58: number | undefined;
|
||||||
readonly chainTokens: string[];
|
readonly chainTokens: string[];
|
||||||
readonly knownTypes: RegisteredTypes;
|
readonly knownTypes: RegisteredTypes;
|
||||||
|
readonly unknownTypes: string[];
|
||||||
readonly signedExtensions: string[];
|
readonly signedExtensions: string[];
|
||||||
|
|
||||||
|
createdAtHash?: Hash;
|
||||||
|
|
||||||
findMetaCall (callIndex: Uint8Array): CallFunction;
|
findMetaCall (callIndex: Uint8Array): CallFunction;
|
||||||
findMetaError (errorIndex: Uint8Array | { error: BN, index: BN }): RegistryError;
|
findMetaError (errorIndex: Uint8Array | { error: BN, index: BN }): RegistryError;
|
||||||
// due to same circular imports where types don't really want to import from EventData,
|
// due to same circular imports where types don't really want to import from EventData,
|
||||||
|
|||||||
Reference in New Issue
Block a user