Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f623b382f7 | ||
|
|
51537c619a | ||
|
|
3df943572f | ||
|
|
aa10804f6f | ||
|
|
981407f00f | ||
|
|
74f7098e0a | ||
|
|
c2e46bf16d | ||
|
|
78b26d2d40 | ||
|
|
e4d5be85f6 | ||
|
|
23b5601eeb | ||
|
|
859679ce09 | ||
|
|
71543c2351 | ||
|
|
edae5057c8 | ||
|
|
8dd450ded4 | ||
|
|
bc2061723e | ||
|
|
5753e37307 | ||
|
|
e74da70a9d | ||
|
|
737bbc225a | ||
|
|
9313551559 | ||
|
|
5b8f53f050 | ||
|
|
7358e4715b | ||
|
|
a9005d86d6 | ||
|
|
788c05d86e | ||
|
|
de6ba69631 | ||
|
|
4153fed250 | ||
|
|
c68b89831e | ||
|
|
01c9c5ed53 | ||
|
|
573fb135a7 | ||
|
|
0ee7256e37 | ||
|
|
9829ee558c | ||
|
|
34b563dd48 | ||
|
|
f6bb200146 | ||
|
|
af36e3a52c | ||
|
|
c50c7ae6ef | ||
|
|
61739d5ba1 | ||
|
|
34c4a6055e | ||
|
|
27dabdaf52 | ||
|
|
2ee3242f41 | ||
|
|
67ae9627af | ||
|
|
29f7e12df6 | ||
|
|
a4bb2c8268 | ||
|
|
6521c5f533 | ||
|
|
6925c18821 | ||
|
|
9269d94677 | ||
|
|
d438814ad6 | ||
|
|
bc205a350b | ||
|
|
6bf6fddd28 | ||
|
|
23f8eb9713 | ||
|
|
8ab3097328 | ||
|
|
644d0e6c2e | ||
|
|
6a69fdfbbf | ||
|
|
16e9a64941 | ||
|
|
f3cbc070ea | ||
|
|
df22526229 | ||
|
|
3739bdaa89 | ||
|
|
1f55f38bd2 | ||
|
|
c9deb0d88f | ||
|
|
eecfb39463 | ||
|
|
51bb27da42 | ||
|
|
9c0d296e87 | ||
|
|
0793e0bf8c | ||
|
|
e9ad88d50e | ||
|
|
fbe24c04b8 | ||
|
|
8a7d4d3be3 | ||
|
|
61c9a3bb93 | ||
|
|
3721a11f34 | ||
|
|
21039dec1f | ||
|
|
1393f565d8 | ||
|
|
1530e55f9d | ||
|
|
c982505f73 | ||
|
|
ec8c0d3e8b | ||
|
|
8cb0269676 | ||
|
|
27f460cfe3 | ||
|
|
e98e8d6a0d | ||
|
|
2f94662837 | ||
|
|
d46d6a9acd | ||
|
|
093d2cfa7c | ||
|
|
35b31a21dc | ||
|
|
8b9741a722 | ||
|
|
d5cfa9b0e9 | ||
|
|
129d1214fe | ||
|
|
abb3375c3a | ||
|
|
4cfa06b43f | ||
|
|
8fa80ac0f6 | ||
|
|
2d011c68df | ||
|
|
640ef4bdab | ||
|
|
cdd20c0b99 | ||
|
|
3a12123bf9 | ||
|
|
5657d5395b | ||
|
|
66b1108c5c | ||
|
|
7bf7e207c2 | ||
|
|
01098395ec | ||
|
|
3e21dfdc03 | ||
|
|
a400fb2362 | ||
|
|
44172aa359 | ||
|
|
82cab2827a | ||
|
|
a198eb1515 | ||
|
|
6e67cd6c97 | ||
|
|
e51e89df56 | ||
|
|
e46fd07d39 | ||
|
|
b2cf9aed83 | ||
|
|
c632030437 | ||
|
|
9dc683d289 | ||
|
|
6cef6190b1 | ||
|
|
75dd443d79 | ||
|
|
13dacb591d | ||
|
|
429bf5456e | ||
|
|
527c0f5015 | ||
|
|
527ab27bee | ||
|
|
7991403022 | ||
|
|
61d2e6c5e5 | ||
|
|
e005a3fc0c | ||
|
|
2dfb0fb59a | ||
|
|
70c011e7e2 | ||
|
|
8134322626 | ||
|
|
60152749bb | ||
|
|
b257e120d4 | ||
|
|
6dc75acd21 | ||
|
|
a04400170c |
+5
-1
@@ -9,4 +9,8 @@
|
||||
3.2.2
|
||||
3.2.3
|
||||
|
||||
3.3.2
|
||||
3.3.2
|
||||
3.6.2
|
||||
3.6.3
|
||||
3.6.4
|
||||
3.7.2
|
||||
@@ -1,5 +1,80 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 3.7.2 Feb 2, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjusted the `Keys` type for the 28 runtime on Kusama, Polkadot & Westend
|
||||
|
||||
|
||||
## 3.7.1 Feb 1, 2021
|
||||
|
||||
Upgrade priority: Low. However recommended for current Substrate master, Polkadot and Rococo users and those wishing to support the upcoming Polkadot 28 runtime with the new `MultiAddress`.
|
||||
|
||||
- **Breaking change** As indicated in the 3.5.1 release notes, the `Address`/`LookupSource` defaults have now been adjusted for `MultiAddress`. If your chain does not use these types, explicitly add the correct `Address`/`LookupSource` types. This new extensible format is mean to cater for all address types into the future, removing a lot of discrepancies between chains.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Extraction of the block author on Moonbeam (Thanks to https://github.com/joelamouche)
|
||||
- Cleanup logs with HTTP providers, no subs (Thanks to https://github.com/Tbaut)
|
||||
|
||||
Changes:
|
||||
|
||||
- Allow `.slice` operator on the `Vec` type
|
||||
- Apply `MultiAddress` as a default
|
||||
- Adds support for the upcoming Polkadot 28 and Kusama 2028 runtimes
|
||||
- Add checkpoint for Kusama 2027 upgrade
|
||||
- Update all parachain types (as per latest Rococo)
|
||||
- Correctly use relay blockNumber in parachain validation data
|
||||
- remove information log for capabilities detection (creates confusion)
|
||||
- Remove explicit references to `global`, use the `x-global` detection
|
||||
- Remove explicit `module` in `package.json` (exports map available)
|
||||
|
||||
|
||||
## 3.6.1 Jan 24, 2020
|
||||
|
||||
Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it.
|
||||
|
||||
- **Breaking change** To support chains with multiple tokens, such as bridges, the `ChainProperties` type now returns an array of tokens and decimals (instead of singular values) in the `token{Decimals, Symbol}` getters. Additionally, this means that the `registry` interfaces has been changes, to `registry.chainDecimals: number[]` and `registry.chainTokens: string[]`. Where used the `[0]` index will return the first value if only interested in a single, for a straight conversion.
|
||||
|
||||
Changes:
|
||||
|
||||
- Allow for the detection of on-chain capabilities as available (e.g. `AccountData`, `ValidatorPrefs`)
|
||||
- Cater for multiple tokens and decimals in the chain the chain `system.properties` (as per the chain specification)
|
||||
- Add a `instances: { [key]: [module1, module2] }` definition in teh bundle types, allowing for multiple instances (e.g. Balances)
|
||||
- Adjust the `api-derive` for balances to retrieve values via `instances` as well as across multiple modules
|
||||
- Ensure all types are registered for all metadata typegen steps
|
||||
- Add `rpc.payment.queryFeeDetails` RPC endpoint
|
||||
- Update types & metadata to latest Substrate
|
||||
- Move the `@polkadot/x-rxjs` package into the common repo
|
||||
- Allow doc generation for errors/events (markdown outputs)
|
||||
|
||||
|
||||
## 3.5.1 Jan 18, 2020
|
||||
|
||||
Upgrade priority: Low. Recommended for parachain developers.
|
||||
|
||||
- **Important** The default for Substrate on the Address types are `MultiAddress`. It is recommended that chains add explicit definitions for `Address` and `LookupSource` in their types, instead of relying on the API-defaults. A future update will swap the API defaults to align with Substrate.
|
||||
- **Important** Like the above changes in Substrate, the `AccountInfo` structure has also changed. It is recommended that chain developers explicitly add `AccountInfo: 'AccountInfoWithRefCount'` for the version with `refCount` on and `AccountInfoWithProviders` for the latest Substrate version. As per the above, the API defaults will be changed to align with Substrate.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Apply correct TypeScript type for `toBigInt()` (Thanks to https://github.com/ianhe8x)
|
||||
- Expand type definitions for storage key tuples (Thanks to https://github.com/monitz87)
|
||||
- Adjust bounty derive to cater for non-council chains (Thanks to https://github.com/ekowalsk)
|
||||
|
||||
Changes:
|
||||
|
||||
- Remove recursion in vector/struct U8a stream decoding
|
||||
- Availability of staking made optional in session length calcs (era does require it)
|
||||
- Updates to parachain types, ensuring it has coverage for all the latest
|
||||
- Update all Rococo types to the latest (session keys, session reports, parachain indexes)
|
||||
- Update known upgrade checkpoints fo WestEnd
|
||||
- Add types of the lottery module in Substrate
|
||||
- Add and extend types for the crowdloan module in Polkadot
|
||||
- Adjust node-template to default to `MultiAddress` on specVersion >= 100
|
||||
|
||||
|
||||
## 3.4.1 Jan 11, 2020
|
||||
|
||||
Upgrade priority: Low. Fixes for parachain types, `.entries()` (with no values) and `event.is(...)` checks, users of these interfaces will have benefit.
|
||||
|
||||
+2
-4
@@ -13,8 +13,7 @@ module.exports = Object.assign({}, config, {
|
||||
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
|
||||
'@polkadot/types-known(.*)$': '<rootDir>/packages/types-known/src/$1',
|
||||
// eslint-disable-next-line sort-keys
|
||||
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1',
|
||||
'@polkadot/x-rxjs(.*)$': '<rootDir>/packages/x-rxjs/src/$1'
|
||||
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
|
||||
},
|
||||
modulePathIgnorePatterns: [
|
||||
'<rootDir>/packages/api/build',
|
||||
@@ -25,8 +24,7 @@ module.exports = Object.assign({}, config, {
|
||||
'<rootDir>/packages/rpc-provider/build',
|
||||
'<rootDir>/packages/typegen/build',
|
||||
'<rootDir>/packages/types/build',
|
||||
'<rootDir>/packages/types-known/build',
|
||||
'<rootDir>/packages/x-rxjs/build'
|
||||
'<rootDir>/packages/types-known/build'
|
||||
],
|
||||
resolver: '@polkadot/dev/config/jest-resolver.cjs'
|
||||
});
|
||||
|
||||
+1
-1
@@ -34,5 +34,5 @@
|
||||
"@types/jest": "^26.0.20",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"version": "3.4.1"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": false,
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
@@ -14,10 +13,10 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/api": "3.4.1",
|
||||
"@polkadot/types": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/x-rxjs": "3.4.1",
|
||||
"@polkadot/api": "3.7.2",
|
||||
"@polkadot/types": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"@polkadot/x-rxjs": "^5.5.1",
|
||||
"bn.js": "^4.11.9"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": false,
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
@@ -14,16 +13,16 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/api": "3.4.1",
|
||||
"@polkadot/rpc-core": "3.4.1",
|
||||
"@polkadot/types": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/util-crypto": "^5.2.3",
|
||||
"@polkadot/x-rxjs": "3.4.1",
|
||||
"@polkadot/api": "3.7.2",
|
||||
"@polkadot/rpc-core": "3.7.2",
|
||||
"@polkadot/types": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"@polkadot/util-crypto": "^5.5.1",
|
||||
"@polkadot/x-rxjs": "^5.5.1",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.2.3",
|
||||
"@polkadot/rpc-provider": "3.4.1"
|
||||
"@polkadot/keyring": "^5.5.1",
|
||||
"@polkadot/rpc-provider": "3.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { AccountIndex } from '@polkadot/types/interfaces';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { AccountIndexes } from '../types';
|
||||
|
||||
@@ -18,7 +17,7 @@ function queryAccounts (api: ApiInterfaceRx): Observable<AccountIndexes> {
|
||||
map((entries): AccountIndexes =>
|
||||
entries.reduce((indexes: AccountIndexes, [key, idOpt]): AccountIndexes => {
|
||||
if (idOpt.isSome) {
|
||||
indexes[idOpt.unwrap()[0].toString()] = key.args[0] as AccountIndex;
|
||||
indexes[idOpt.unwrap()[0].toString()] = key.args[0];
|
||||
}
|
||||
|
||||
return indexes;
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||
import type { AccountData, AccountId, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveBalancesAccount } from '../types';
|
||||
import type { DeriveBalancesAccount, DeriveBalancesAccountData } from '../types';
|
||||
|
||||
import { isFunction } from '@polkadot/util';
|
||||
import { assert, isFunction } from '@polkadot/util';
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
type Result = [Balance, Balance, Balance, Balance, Index];
|
||||
type BalanceResult = [Balance, Balance, Balance, Balance];
|
||||
|
||||
function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBalance, frozenFee, frozenMisc, accountNonce]]: [AccountId, Result]): DeriveBalancesAccount {
|
||||
type Result = [Index, BalanceResult[]];
|
||||
|
||||
function getBalance (api: ApiInterfaceRx, [freeBalance, reservedBalance, frozenFee, frozenMisc]: BalanceResult): DeriveBalancesAccountData {
|
||||
return {
|
||||
accountId,
|
||||
accountNonce,
|
||||
freeBalance,
|
||||
frozenFee,
|
||||
frozenMisc,
|
||||
@@ -27,6 +27,19 @@ function calcBalances (api: ApiInterfaceRx, [accountId, [freeBalance, reservedBa
|
||||
};
|
||||
}
|
||||
|
||||
function calcBalances (api: ApiInterfaceRx, [accountId, [accountNonce, balances]]: [AccountId, Result]): DeriveBalancesAccount {
|
||||
const primary = balances[0];
|
||||
|
||||
assert(primary, 'No balances retrieved for account');
|
||||
|
||||
return {
|
||||
accountId,
|
||||
accountNonce,
|
||||
additional: balances.filter((_, index) => index !== 0).map((b) => getBalance(api, b)),
|
||||
...getBalance(api, primary)
|
||||
};
|
||||
}
|
||||
|
||||
// old
|
||||
function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
return api.queryMulti<[Balance, Balance, Index]>([
|
||||
@@ -34,21 +47,25 @@ function queryBalancesFree (api: ApiInterfaceRx, accountId: AccountId): Observab
|
||||
[api.query.balances.reservedBalance, accountId],
|
||||
[api.query.system.accountNonce, accountId]
|
||||
]).pipe(
|
||||
map(([freeBalance, reservedBalance, accountNonce]): Result =>
|
||||
[freeBalance, reservedBalance, api.registry.createType('Balance'), api.registry.createType('Balance'), accountNonce]
|
||||
)
|
||||
map(([freeBalance, reservedBalance, accountNonce]): Result => [
|
||||
accountNonce,
|
||||
[[freeBalance, reservedBalance, api.registry.createType('Balance'), api.registry.createType('Balance')]]
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
return api.queryMulti<[AccountData, Index]>([
|
||||
[api.query.balances.account, accountId],
|
||||
[api.query.system.accountNonce, accountId]
|
||||
]).pipe(
|
||||
map(([{ feeFrozen, free, miscFrozen, reserved }, accountNonce]): Result =>
|
||||
[free, reserved, feeFrozen, miscFrozen, accountNonce]
|
||||
function queryBalancesAccount (api: ApiInterfaceRx, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
|
||||
const balances = modules.map((m): QueryableStorageMultiArg<'rxjs'> => [api.query[m].account, accountId]);
|
||||
const extract = (data: AccountData[]) =>
|
||||
data.map(({ feeFrozen, free, miscFrozen, reserved }): BalanceResult => [free, reserved, feeFrozen, miscFrozen]);
|
||||
|
||||
return isFunction(api.query.system.account)
|
||||
? api.queryMulti<[AccountInfo, ...(AccountData[])]>([[api.query.system.account, accountId], ...balances]).pipe(
|
||||
map(([{ nonce }, ...balances]): Result => [nonce, extract(balances)])
|
||||
)
|
||||
);
|
||||
: api.queryMulti<[Index, ...(AccountData[])]>([[api.query.system.accountNonce, accountId], ...balances]).pipe(
|
||||
map(([nonce, ...balances]): Result => [nonce, extract(balances)])
|
||||
);
|
||||
}
|
||||
|
||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Result> {
|
||||
@@ -60,7 +77,7 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
|
||||
: (infoOrTuple as [Index, AccountData])[1];
|
||||
const accountNonce = (infoOrTuple as AccountInfo).nonce || (infoOrTuple as [Index, AccountData])[0];
|
||||
|
||||
return [free, reserved, feeFrozen, miscFrozen, accountNonce];
|
||||
return [accountNonce, [[free, reserved, feeFrozen, miscFrozen]]];
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -81,19 +98,29 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
|
||||
* ```
|
||||
*/
|
||||
export function account (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAccount> {
|
||||
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
|
||||
|
||||
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAccount> =>
|
||||
api.derive.accounts.accountId(address).pipe(
|
||||
switchMap((accountId): Observable<[AccountId, Result]> =>
|
||||
(accountId
|
||||
? combineLatest([
|
||||
of(accountId),
|
||||
isFunction(api.query.system.account)
|
||||
? queryCurrent(api, accountId)
|
||||
: isFunction(api.query.balances.account)
|
||||
? queryBalancesAccount(api, accountId)
|
||||
: queryBalancesFree(api, accountId)
|
||||
balanceInstances
|
||||
? queryBalancesAccount(api, accountId, balanceInstances)
|
||||
: isFunction(api.query.system.account)
|
||||
? queryCurrent(api, accountId)
|
||||
: isFunction(api.query.balances.account)
|
||||
? queryBalancesAccount(api, accountId)
|
||||
: queryBalancesFree(api, accountId)
|
||||
])
|
||||
: of([
|
||||
api.registry.createType('AccountId'),
|
||||
[
|
||||
api.registry.createType('Index'),
|
||||
[[api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance')]]
|
||||
]
|
||||
])
|
||||
: of([api.registry.createType('AccountId'), [api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Balance'), api.registry.createType('Index')]])
|
||||
)
|
||||
),
|
||||
map((result): DeriveBalancesAccount => calcBalances(api, result))
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
|
||||
import type { Option, Vec } from '@polkadot/types';
|
||||
import type { AccountId, AccountIndex, Address, Balance, BalanceLock, BalanceLockTo212, BlockNumber, VestingInfo, VestingSchedule } from '@polkadot/types/interfaces';
|
||||
import type { Observable } from '@polkadot/x-rxjs';
|
||||
import type { DeriveBalancesAccount, DeriveBalancesAll } from '../types';
|
||||
import type { DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { bnMax, isFunction } from '@polkadot/util';
|
||||
import { bnMax } from '@polkadot/util';
|
||||
import { combineLatest, of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
type ResultBalance = [VestingInfo | null, (BalanceLock | BalanceLockTo212)[]];
|
||||
type BalanceLocksEntry = Vec<BalanceLock | BalanceLockTo212>;
|
||||
type BalanceLocks = BalanceLocksEntry[];
|
||||
type ResultBalance = [VestingInfo | null, ((BalanceLock | BalanceLockTo212)[])[]];
|
||||
type Result = [DeriveBalancesAccount, BlockNumber, ResultBalance];
|
||||
|
||||
interface AllLocked {
|
||||
@@ -50,8 +52,21 @@ function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (Balan
|
||||
return { allLocked, lockedBalance, lockedBreakdown, vestingLocked };
|
||||
}
|
||||
|
||||
function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBalance, frozenFee, frozenMisc, reservedBalance, votingBalance }, bestNumber, [vesting, locks]]: Result): DeriveBalancesAll {
|
||||
function calcShared (api: ApiInterfaceRx, bestNumber: BlockNumber, data: DeriveBalancesAccountData, locks: (BalanceLock | BalanceLockTo212)[]): DeriveBalancesAllAccountData {
|
||||
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 {
|
||||
...data,
|
||||
availableBalance,
|
||||
lockedBalance,
|
||||
lockedBreakdown,
|
||||
vestingLocked
|
||||
};
|
||||
}
|
||||
|
||||
function calcBalances (api: ApiInterfaceRx, [data, bestNumber, [vesting, allLocks]]: Result): DeriveBalancesAll {
|
||||
const shared = calcShared(api, bestNumber, data, allLocks[0]);
|
||||
// Calculate the vesting balances,
|
||||
// - offset = balance locked at startingBlock
|
||||
// - perBlock is the unlock amount
|
||||
@@ -59,29 +74,21 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
|
||||
const isStarted = bestNumber.gt(startingBlock);
|
||||
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
|
||||
const vestedBalance = vestedNow.gt(vestingTotal) ? vestingTotal : api.registry.createType('Balance', vestedNow);
|
||||
const isVesting = isStarted && !vestingLocked.isZero();
|
||||
const vestedClaimable = api.registry.createType('Balance', isVesting ? vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0);
|
||||
const availableBalance = api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), freeBalance.sub(lockedBalance)));
|
||||
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 {
|
||||
accountId,
|
||||
accountNonce,
|
||||
availableBalance,
|
||||
freeBalance,
|
||||
frozenFee,
|
||||
frozenMisc,
|
||||
...shared,
|
||||
accountId: data.accountId,
|
||||
accountNonce: data.accountNonce,
|
||||
additional: allLocks.filter((_, index) => index !== 0).map((l, index) => calcShared(api, bestNumber, data.additional[index], l)),
|
||||
isVesting,
|
||||
lockedBalance,
|
||||
lockedBreakdown,
|
||||
reservedBalance,
|
||||
vestedBalance,
|
||||
vestedClaimable,
|
||||
vestingEndBlock,
|
||||
vestingLocked,
|
||||
vestingPerBlock: perBlock,
|
||||
vestingTotal,
|
||||
votingBalance
|
||||
vestingTotal
|
||||
};
|
||||
}
|
||||
|
||||
@@ -100,28 +107,37 @@ function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result
|
||||
vestingNew = api.registry.createType('VestingInfo', { locked, perBlock, startingBlock });
|
||||
}
|
||||
|
||||
return [vestingNew, locks];
|
||||
return [vestingNew, [locks]];
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// current (balances vesting)
|
||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
|
||||
// current (balances, vesting)
|
||||
function queryCurrent (api: ApiInterfaceRx, accountId: AccountId, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
|
||||
const lockCalls = balanceInstances.map((m) => api.query[m].locks);
|
||||
const lockEmpty = lockCalls.map((c) => !c);
|
||||
const lockQueries = lockCalls.filter((c) => c).map((c): QueryableStorageMultiArg<'rxjs'> => [c, accountId]);
|
||||
|
||||
return (
|
||||
api.query.vesting?.vesting
|
||||
? api.queryMulti<[Vec<BalanceLock>, Option<VestingInfo>]>([
|
||||
[api.query.balances.locks, accountId],
|
||||
[api.query.vesting.vesting, accountId]
|
||||
? api.queryMulti<[Option<VestingInfo>, ...BalanceLocks]>([
|
||||
[api.query.vesting.vesting, accountId],
|
||||
...lockQueries
|
||||
])
|
||||
: api.query.balances.locks(accountId).pipe(
|
||||
map((locks): [Vec<BalanceLock>, Option<VestingInfo>] =>
|
||||
[locks, api.registry.createType('Option<VestingInfo>')]
|
||||
// TODO We need to check module instances here as well, not only the balances module
|
||||
: lockQueries.length
|
||||
? api.queryMulti<[...(Vec<BalanceLock>)[]]>(lockQueries).pipe(
|
||||
map((locks): [Option<VestingInfo>, ...BalanceLocks] =>
|
||||
[api.registry.createType('Option<VestingInfo>'), ...locks]
|
||||
)
|
||||
)
|
||||
)
|
||||
: of([api.registry.createType('Option<VestingInfo>')] as [Option<VestingInfo>])
|
||||
).pipe(
|
||||
map(([locks, optVesting]): ResultBalance =>
|
||||
[optVesting.unwrapOr(null), locks]
|
||||
)
|
||||
map(([optVesting, ...locks]): ResultBalance => {
|
||||
let offset = -1;
|
||||
|
||||
return [optVesting.unwrapOr(null), lockEmpty.map((e) => e ? api.registry.createType('Vec<BalanceLock>') : locks[++offset])];
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -141,6 +157,8 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId): Observable<Re
|
||||
* ```
|
||||
*/
|
||||
export function all (instanceId: string, api: ApiInterfaceRx): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAll> {
|
||||
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
|
||||
|
||||
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAll> =>
|
||||
api.derive.balances.account(address).pipe(
|
||||
switchMap((account): Observable<Result> =>
|
||||
@@ -148,11 +166,11 @@ export function all (instanceId: string, api: ApiInterfaceRx): (address: Account
|
||||
? combineLatest([
|
||||
of(account),
|
||||
api.derive.chain.bestNumber(),
|
||||
isFunction(api.query.system.account) || isFunction(api.query.balances.account)
|
||||
? queryCurrent(api, account.accountId)
|
||||
api.query.system?.account || api.query.balances?.account
|
||||
? queryCurrent(api, account.accountId, balanceInstances)
|
||||
: queryOld(api, account.accountId)
|
||||
])
|
||||
: of([account, api.registry.createType('BlockNumber'), [null, api.registry.createType('Vec<BalanceLock>')]])
|
||||
: of([account, api.registry.createType('BlockNumber'), [null, []]])
|
||||
)
|
||||
),
|
||||
map((result): DeriveBalancesAll => calcBalances(api, result))
|
||||
|
||||
@@ -59,7 +59,7 @@ describe('bounties derive', () => {
|
||||
bountyDescriptions: {
|
||||
multi: () => of([
|
||||
optionOf(bytes('make polkadot even better')),
|
||||
optionOf(bytes('this will be totally ignored'))
|
||||
optionOf(bytes('some other bounty'))
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,28 @@ describe('bounties derive', () => {
|
||||
expect(result[1].proposals).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('when no council, returns bounties without motions', async () => {
|
||||
const mockApi = {
|
||||
...defaultMockApi,
|
||||
query: {
|
||||
...defaultMockApi.query,
|
||||
council: null
|
||||
}
|
||||
} as unknown as ApiInterfaceRx;
|
||||
|
||||
const result = await bounties('', mockApi)().toPromise();
|
||||
|
||||
expect(result).toHaveLength(2);
|
||||
expect(result[0].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
|
||||
expect(result[0].description).toEqual('make polkadot even better');
|
||||
expect(result[0].index.eq(0)).toBe(true);
|
||||
expect(result[0].proposals).toHaveLength(0);
|
||||
expect(result[1].bounty.proposer.toString()).toEqual(DEFAULT_PROPOSER);
|
||||
expect(result[1].description).toEqual('some other bounty');
|
||||
expect(result[1].index.eq(1)).toBe(true);
|
||||
expect(result[1].proposals).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('combines bounties with motions', async () => {
|
||||
const mockApi = {
|
||||
...defaultMockApi,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { DeriveBounties, DeriveCollectiveProposal } from '@polkadot/api-derive/types';
|
||||
import type { Bytes, Option } from '@polkadot/types';
|
||||
import type { Bytes, Option, StorageKey } from '@polkadot/types';
|
||||
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
|
||||
|
||||
import { memo } from '@polkadot/api-derive/util';
|
||||
@@ -37,16 +37,16 @@ export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observ
|
||||
return memo(instanceId, (): Observable<DeriveBounties> =>
|
||||
combineLatest([
|
||||
bountyBase.bountyCount<BountyIndex>(),
|
||||
api.query.council.proposalCount<ProposalIndex>()
|
||||
api.query.council ? api.query.council.proposalCount<ProposalIndex>() : of(0)
|
||||
]).pipe(
|
||||
switchMap(() =>
|
||||
combineLatest([
|
||||
bountyBase.bounties.keys(),
|
||||
api.derive.council.proposals()
|
||||
api.derive.council ? api.derive.council.proposals() : of([])
|
||||
])
|
||||
),
|
||||
switchMap(([keys, proposals]): Observable<Result> => {
|
||||
const ids = keys.map(({ args: [id] }) => id as BountyIndex);
|
||||
const ids = (keys as StorageKey<[BountyIndex]>[]).map(({ args: [id] }) => id);
|
||||
|
||||
return combineLatest([
|
||||
bountyBase.bounties.multi<Option<Bounty>>(ids),
|
||||
|
||||
@@ -51,7 +51,7 @@ function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], Opti
|
||||
api.query.scheduler.agenda.keys()
|
||||
),
|
||||
switchMap((keys) => {
|
||||
const blockNumbers = keys.map((key) => key.args[0] as BlockNumber);
|
||||
const blockNumbers = keys.map((key) => key.args[0]);
|
||||
|
||||
return combineLatest([
|
||||
of(blockNumbers),
|
||||
|
||||
@@ -69,7 +69,7 @@ function extractVotes (mapped: [AccountId, Voting][], referendumId: BN): DeriveR
|
||||
function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
|
||||
return api.query.democracy.votingOf.entries<Voting>().pipe(
|
||||
map((allVoting): DeriveReferendumVote[] => {
|
||||
const mapped = allVoting.map(([key, voting]): [AccountId, Voting] => [key.args[0] as AccountId, voting]);
|
||||
const mapped = allVoting.map(([key, voting]): [AccountId, Voting] => [key.args[0], voting]);
|
||||
const votes = extractVotes(mapped, referendumId);
|
||||
const delegations = mapped
|
||||
.filter(([, voting]) => voting.isDelegating)
|
||||
|
||||
@@ -35,6 +35,7 @@ function queryAura (api: ApiInterfaceRx): Observable<DeriveSessionInfo> {
|
||||
[
|
||||
false,
|
||||
api.registry.createType('u64', 1),
|
||||
// we may have aura without staking (permissioned)
|
||||
api.consts.staking?.sessionsPerEra || api.registry.createType('SessionIndex', 1)
|
||||
],
|
||||
indexes
|
||||
@@ -50,7 +51,8 @@ function queryBabe (api: ApiInterfaceRx): Observable<DeriveSessionInfo> {
|
||||
[
|
||||
true,
|
||||
api.consts.babe.epochDuration,
|
||||
api.consts.staking.sessionsPerEra
|
||||
// we may have babe without staking (permissioned)
|
||||
api.consts.staking?.sessionsPerEra || api.registry.createType('SessionIndex', 1)
|
||||
],
|
||||
indexes
|
||||
])
|
||||
|
||||
@@ -12,6 +12,7 @@ import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
type ResultSlotsNoSession = [u64, u64, u64];
|
||||
type ResultSlots = [u64, u64, u64, Option<SessionIndex>];
|
||||
type ResultSlotsFlat = [u64, u64, u64, SessionIndex];
|
||||
|
||||
@@ -39,19 +40,26 @@ function queryAura (api: ApiInterfaceRx): Observable<DeriveSessionProgress> {
|
||||
|
||||
function queryBabe (api: ApiInterfaceRx): Observable<[DeriveSessionInfo, ResultSlotsFlat]> {
|
||||
return api.derive.session.info().pipe(
|
||||
switchMap((info): Observable<[DeriveSessionInfo, ResultSlots]> =>
|
||||
switchMap((info): Observable<[DeriveSessionInfo, ResultSlots | ResultSlotsNoSession]> =>
|
||||
combineLatest([
|
||||
of(info),
|
||||
api.queryMulti<ResultSlots>([
|
||||
api.query.babe.currentSlot,
|
||||
api.query.babe.epochIndex,
|
||||
api.query.babe.genesisSlot,
|
||||
[api.query.staking.erasStartSessionIndex, info.activeEra]
|
||||
])
|
||||
// we may have no staking, but have babe (permissioned)
|
||||
api.query.staking
|
||||
? api.queryMulti<ResultSlots>([
|
||||
api.query.babe.currentSlot,
|
||||
api.query.babe.epochIndex,
|
||||
api.query.babe.genesisSlot,
|
||||
[api.query.staking.erasStartSessionIndex, info.activeEra]
|
||||
])
|
||||
: api.queryMulti<ResultSlotsNoSession>([
|
||||
api.query.babe.currentSlot,
|
||||
api.query.babe.epochIndex,
|
||||
api.query.babe.genesisSlot
|
||||
])
|
||||
])
|
||||
),
|
||||
map(([info, [currentSlot, epochIndex, genesisSlot, optStartIndex]]): [DeriveSessionInfo, ResultSlotsFlat] => [
|
||||
info, [currentSlot, epochIndex, genesisSlot, optStartIndex.unwrapOr(api.registry.createType('SessionIndex', 1))]
|
||||
info, [currentSlot, epochIndex, genesisSlot, optStartIndex && optStartIndex.isSome ? optStartIndex.unwrap() : api.registry.createType('SessionIndex', 1)]
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { memo } from '../util';
|
||||
export function stashes (instanceId: string, api: ApiInterfaceRx): () => Observable<AccountId[]> {
|
||||
return memo(instanceId, (): Observable<AccountId[]> =>
|
||||
api.query.staking.validators.keys().pipe(
|
||||
map((keys) => keys.map((key) => key.args[0] as AccountId).filter((a) => a))
|
||||
map((keys) => keys.map((key) => key.args[0]).filter((a) => a))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export function nextElected (instanceId: string, api: ApiInterfaceRx): () => Obs
|
||||
// only populate for next era in the last session, so track both here - entries are not
|
||||
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
|
||||
switchMap(({ currentEra }) => api.query.staking.erasStakers.keys(currentEra)),
|
||||
map((keys) => keys.map((key) => key.args[1] as AccountId))
|
||||
map((keys) => keys.map((key) => key.args[1]))
|
||||
)
|
||||
: api.query.staking.currentElected<AccountId[]>()
|
||||
);
|
||||
|
||||
@@ -4,19 +4,17 @@
|
||||
import type { AccountId, Digest } from '@polkadot/types/interfaces';
|
||||
|
||||
export function extractAuthor (digest: Digest, sessionValidators: AccountId[] = []): AccountId | undefined {
|
||||
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
|
||||
const [citem] = digest.logs.filter(({ type }) => type === 'Consensus');
|
||||
|
||||
// extract from the substrate 2.0 PreRuntime digest
|
||||
if (pitem) {
|
||||
const [engine, data] = pitem.asPreRuntime;
|
||||
if (citem) {
|
||||
const [engine, data] = citem.asConsensus;
|
||||
|
||||
return engine.extractAuthor(data, sessionValidators);
|
||||
} else {
|
||||
const [citem] = digest.logs.filter(({ type }) => type === 'Consensus');
|
||||
const [pitem] = digest.logs.filter(({ type }) => type === 'PreRuntime');
|
||||
|
||||
// extract author from the consensus (substrate 1.0, digest)
|
||||
if (citem) {
|
||||
const [engine, data] = citem.asConsensus;
|
||||
if (pitem) {
|
||||
const [engine, data] = pitem.asPreRuntime;
|
||||
|
||||
return engine.extractAuthor(data, sessionValidators);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ export * from './parachains/types';
|
||||
export * from './session/types';
|
||||
export * from './staking/types';
|
||||
|
||||
export interface DeriveBalancesAccount {
|
||||
accountId: AccountId;
|
||||
accountNonce: Index;
|
||||
export interface DeriveBalancesAccountData {
|
||||
freeBalance: Balance;
|
||||
frozenFee: Balance;
|
||||
frozenMisc: Balance;
|
||||
@@ -23,16 +21,25 @@ export interface DeriveBalancesAccount {
|
||||
votingBalance: Balance;
|
||||
}
|
||||
|
||||
export interface DeriveBalancesAll extends DeriveBalancesAccount {
|
||||
isVesting: boolean;
|
||||
export interface DeriveBalancesAccount extends DeriveBalancesAccountData {
|
||||
accountId: AccountId;
|
||||
accountNonce: Index;
|
||||
additional: DeriveBalancesAccountData[];
|
||||
}
|
||||
|
||||
export interface DeriveBalancesAllAccountData extends DeriveBalancesAccountData {
|
||||
availableBalance: Balance;
|
||||
lockedBalance: Balance;
|
||||
lockedBreakdown: (BalanceLock | BalanceLockTo212)[];
|
||||
availableBalance: Balance;
|
||||
votingBalance: Balance;
|
||||
vestingLocked: Balance;
|
||||
}
|
||||
|
||||
export interface DeriveBalancesAll extends DeriveBalancesAccount, DeriveBalancesAllAccountData {
|
||||
additional: DeriveBalancesAllAccountData[];
|
||||
isVesting: boolean;
|
||||
vestedBalance: Balance;
|
||||
vestedClaimable: Balance;
|
||||
vestingEndBlock: BlockNumber;
|
||||
vestingLocked: Balance;
|
||||
vestingPerBlock: Balance;
|
||||
vestingTotal: Balance;
|
||||
}
|
||||
|
||||
+11
-12
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.mjs"
|
||||
@@ -17,16 +16,16 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/api-derive": "3.4.1",
|
||||
"@polkadot/keyring": "^5.2.3",
|
||||
"@polkadot/metadata": "3.4.1",
|
||||
"@polkadot/rpc-core": "3.4.1",
|
||||
"@polkadot/rpc-provider": "3.4.1",
|
||||
"@polkadot/types": "3.4.1",
|
||||
"@polkadot/types-known": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/util-crypto": "^5.2.3",
|
||||
"@polkadot/x-rxjs": "3.4.1",
|
||||
"@polkadot/api-derive": "3.7.2",
|
||||
"@polkadot/keyring": "^5.5.1",
|
||||
"@polkadot/metadata": "3.7.2",
|
||||
"@polkadot/rpc-core": "3.7.2",
|
||||
"@polkadot/rpc-provider": "3.7.2",
|
||||
"@polkadot/types": "3.7.2",
|
||||
"@polkadot/types-known": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"@polkadot/util-crypto": "^5.5.1",
|
||||
"@polkadot/x-rxjs": "^5.5.1",
|
||||
"bn.js": "^4.11.9",
|
||||
"eventemitter3": "^4.0.7"
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
|
||||
import type { Vec, u16, u32, u64, u8 } from '@polkadot/types';
|
||||
import type { Codec } from '@polkadot/types/types';
|
||||
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, ModuleId, Moment, Perbill, Percent, Permill, RuntimeDbWeight } from '@polkadot/types/interfaces/runtime';
|
||||
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, ModuleId, Moment, Perbill, Percent, Permill, RuntimeDbWeight, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import type { SessionIndex } from '@polkadot/types/interfaces/session';
|
||||
import type { EraIndex } from '@polkadot/types/interfaces/staking';
|
||||
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
|
||||
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||
import type { BlockWeights } from '@polkadot/types/interfaces/system';
|
||||
import type { BlockLength, BlockWeights } from '@polkadot/types/interfaces/system';
|
||||
import type { ApiTypes } from '@polkadot/api/types';
|
||||
|
||||
declare module '@polkadot/api/types/consts' {
|
||||
@@ -17,6 +18,9 @@ declare module '@polkadot/api/types/consts' {
|
||||
/**
|
||||
* The number of **slots** that an epoch takes. We couple sessions to
|
||||
* epochs, i.e. we start a new session once the new epoch begins.
|
||||
* NOTE: Currently it is not possible to change the epoch duration
|
||||
* after the chain has started. Attempting to do so will brick block
|
||||
* production.
|
||||
**/
|
||||
epochDuration: u64 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
@@ -49,6 +53,10 @@ declare module '@polkadot/api/types/consts' {
|
||||
* The delay period for which a bounty beneficiary need to wait before claim the payout.
|
||||
**/
|
||||
bountyDepositPayoutDelay: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Bounty duration in blocks.
|
||||
**/
|
||||
bountyUpdatePeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Minimum value for a bounty.
|
||||
**/
|
||||
@@ -64,6 +72,40 @@ declare module '@polkadot/api/types/consts' {
|
||||
};
|
||||
contracts: {
|
||||
[key: string]: Codec;
|
||||
/**
|
||||
* The maximum number of tries that can be queued for deletion.
|
||||
**/
|
||||
deletionQueueDepth: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum amount of weight that can be consumed per block for lazy trie removal.
|
||||
**/
|
||||
deletionWeightLimit: Weight & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The balance every contract needs to deposit to stay alive indefinitely.
|
||||
*
|
||||
* This is different from the [`Self::TombstoneDeposit`] because this only needs to be
|
||||
* deposited while the contract is alive. Costs for additional storage are added to
|
||||
* this base cost.
|
||||
*
|
||||
* This is a simple way to ensure that contracts with empty storage eventually get deleted by
|
||||
* making them pay rent. This creates an incentive to remove them early in order to save rent.
|
||||
**/
|
||||
depositPerContract: BalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The balance a contract needs to deposit per storage byte to stay alive indefinitely.
|
||||
*
|
||||
* Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day,
|
||||
* then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent.
|
||||
* But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000,
|
||||
* then it would pay 500 BU/day.
|
||||
**/
|
||||
depositPerStorageByte: BalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The balance a contract needs to deposit per storage item to stay alive indefinitely.
|
||||
*
|
||||
* It works the same as [`Self::DepositPerStorageByte`] but for storage items.
|
||||
**/
|
||||
depositPerStorageItem: BalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum nesting level of a call/instantiate stack. A reasonable default
|
||||
* value is 100.
|
||||
@@ -74,19 +116,13 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
maxValueSize: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Price of a byte of storage per one block interval. Should be greater than 0.
|
||||
**/
|
||||
rentByteFee: BalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The amount of funds a contract should deposit in order to offset
|
||||
* the cost of one byte.
|
||||
* The fraction of the deposit that should be used as rent per block.
|
||||
*
|
||||
* Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day,
|
||||
* then a contract with 1,000,000 BU that uses 1,000 bytes of storage would pay no rent.
|
||||
* But if the balance reduced to 500,000 BU and the storage stayed the same at 1,000,
|
||||
* then it would pay 500 BU/day.
|
||||
* When a contract hasn't enough balance deposited to stay alive indefinitely it needs
|
||||
* to pay per block for the storage it consumes that is not covered by the deposit.
|
||||
* This determines how high this rent payment is per block as a fraction of the deposit.
|
||||
**/
|
||||
rentDepositOffset: BalanceOf & AugmentedConst<ApiType>;
|
||||
rentFraction: Perbill & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Number of block delay an extrinsic claim surcharge has.
|
||||
*
|
||||
@@ -94,15 +130,6 @@ declare module '@polkadot/api/types/consts' {
|
||||
* for current_block - delay
|
||||
**/
|
||||
signedClaimHandicap: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* A size offset for an contract. A just created account with untouched storage will have that
|
||||
* much of storage from the perspective of the state rent.
|
||||
*
|
||||
* This is a simple way to ensure that contracts with empty storage eventually get deleted
|
||||
* by making them pay rent. This creates an incentive to remove them early in order to save
|
||||
* rent.
|
||||
**/
|
||||
storageSizeOffset: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Reward that is received by the party whose touch has led
|
||||
* to removal of a contract.
|
||||
@@ -159,7 +186,8 @@ declare module '@polkadot/api/types/consts' {
|
||||
desiredRunnersUp: u32 & AugmentedConst<ApiType>;
|
||||
moduleId: LockIdentifier & AugmentedConst<ApiType>;
|
||||
termDuration: BlockNumber & AugmentedConst<ApiType>;
|
||||
votingBond: BalanceOf & AugmentedConst<ApiType>;
|
||||
votingBondBase: BalanceOf & AugmentedConst<ApiType>;
|
||||
votingBondFactor: BalanceOf & AugmentedConst<ApiType>;
|
||||
};
|
||||
identity: {
|
||||
[key: string]: Codec;
|
||||
@@ -199,6 +227,11 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
deposit: BalanceOf & AugmentedConst<ApiType>;
|
||||
};
|
||||
lottery: {
|
||||
[key: string]: Codec;
|
||||
maxCalls: u32 & AugmentedConst<ApiType>;
|
||||
moduleId: ModuleId & AugmentedConst<ApiType>;
|
||||
};
|
||||
multisig: {
|
||||
[key: string]: Codec;
|
||||
/**
|
||||
@@ -343,11 +376,15 @@ declare module '@polkadot/api/types/consts' {
|
||||
system: {
|
||||
[key: string]: Codec;
|
||||
/**
|
||||
* The maximum number of blocks to allow in mortal eras.
|
||||
* Maximum number of block number to block hash mappings to keep (oldest pruned first).
|
||||
**/
|
||||
blockHashCount: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The weight configuration (limits & base values) for each class of extrinsics and block.
|
||||
* The maximum length of a block (in bytes).
|
||||
**/
|
||||
blockLength: BlockLength & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Block & extrinsics weights: base values and limits.
|
||||
**/
|
||||
blockWeights: BlockWeights & AugmentedConst<ApiType>;
|
||||
/**
|
||||
@@ -362,6 +399,10 @@ declare module '@polkadot/api/types/consts' {
|
||||
* an identifier of the chain.
|
||||
**/
|
||||
ss58Prefix: u8 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Get the chain's current version.
|
||||
**/
|
||||
version: RuntimeVersion & AugmentedConst<ApiType>;
|
||||
};
|
||||
timestamp: {
|
||||
[key: string]: Codec;
|
||||
|
||||
@@ -11,6 +11,14 @@ declare module '@polkadot/api/types/errors' {
|
||||
* Transfer amount should be non-zero.
|
||||
**/
|
||||
AmountZero: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Invalid metadata given.
|
||||
**/
|
||||
BadMetadata: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Some internal state is broken.
|
||||
**/
|
||||
BadState: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Invalid witness data given.
|
||||
**/
|
||||
@@ -179,6 +187,13 @@ declare module '@polkadot/api/types/errors' {
|
||||
* The code supplied to `put_code` exceeds the limit specified in the current schedule.
|
||||
**/
|
||||
CodeTooLarge: AugmentedError<ApiType>;
|
||||
/**
|
||||
* A contract could not be evicted because it has enough balance to pay rent.
|
||||
*
|
||||
* This can be returned from [`Module::claim_surcharge`] because the target
|
||||
* contract has enough balance to pay for its rent.
|
||||
**/
|
||||
ContractNotEvictable: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Contract trapped during execution.
|
||||
**/
|
||||
@@ -187,6 +202,14 @@ declare module '@polkadot/api/types/errors' {
|
||||
* Input passed to a contract API function failed to decode as expected type.
|
||||
**/
|
||||
DecodingFailed: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Removal of a contract failed because the deletion queue is full.
|
||||
*
|
||||
* This can happen when either calling [`Module::claim_surcharge`] or `seal_terminate`.
|
||||
* The queue is filled by deleting contracts and emptied by a fixed amount each block.
|
||||
* Trying again during another block is the only way to resolve this issue.
|
||||
**/
|
||||
DeletionQueueFull: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The topics passed to `seal_deposit_events` contains at least one duplicate.
|
||||
**/
|
||||
@@ -229,6 +252,12 @@ declare module '@polkadot/api/types/errors' {
|
||||
* its contructor. No contracts are allowed to exist below that threshold.
|
||||
**/
|
||||
NewContractNotFunded: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The chain does not provide a chain extension. Calling the chain extension results
|
||||
* in this error. Note that this usually shouldn't happen as deploying such contracts
|
||||
* is rejected.
|
||||
**/
|
||||
NoChainExtension: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The contract that was called is either no contract at all (a plain account)
|
||||
* or is a tombstone.
|
||||
@@ -256,6 +285,13 @@ declare module '@polkadot/api/types/errors' {
|
||||
* of a tombstone.
|
||||
**/
|
||||
ReentranceDenied: AugmentedError<ApiType>;
|
||||
/**
|
||||
* A storage modification exhausted the 32bit type that holds the storage size.
|
||||
*
|
||||
* This can either happen when the accumulated storage in bytes is too large or
|
||||
* when number of storage items is too large.
|
||||
**/
|
||||
StorageExhausted: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The amount of topics passed to `seal_deposit_events` exceeds the limit.
|
||||
**/
|
||||
@@ -468,10 +504,6 @@ declare module '@polkadot/api/types/errors' {
|
||||
* Candidate does not have enough funds.
|
||||
**/
|
||||
InsufficientCandidateFunds: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The provided count of number of candidates is incorrect.
|
||||
**/
|
||||
InvalidCandidateCount: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The renouncing origin presented a wrong `Renouncing` parameter.
|
||||
**/
|
||||
@@ -484,6 +516,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
* The provided count of number of votes is incorrect.
|
||||
**/
|
||||
InvalidVoteCount: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The provided count of number of candidates is incorrect.
|
||||
**/
|
||||
InvalidWitnessData: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Cannot vote with stake less than minimum balance.
|
||||
**/
|
||||
@@ -515,7 +551,7 @@ declare module '@polkadot/api/types/errors' {
|
||||
/**
|
||||
* Runner cannot re-submit candidacy.
|
||||
**/
|
||||
RunnerSubmit: AugmentedError<ApiType>;
|
||||
RunnerUpSubmit: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Cannot vote more than candidates.
|
||||
**/
|
||||
@@ -752,6 +788,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
* This user has already vouched for this recovery
|
||||
**/
|
||||
AlreadyVouched: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Some internal state is broken.
|
||||
**/
|
||||
BadState: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The friend must wait until the delay period to vouch for this recovery
|
||||
**/
|
||||
@@ -830,6 +870,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
* Invalid ownership proof.
|
||||
**/
|
||||
InvalidProof: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Key setting account is not live, so it's impossible to associate keys.
|
||||
**/
|
||||
NoAccount: AugmentedError<ApiType>;
|
||||
/**
|
||||
* No associated validator ID for account.
|
||||
**/
|
||||
@@ -928,6 +972,14 @@ declare module '@polkadot/api/types/errors' {
|
||||
* Controller is already paired.
|
||||
**/
|
||||
AlreadyPaired: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Internal state has become somehow corrupted and the operation cannot continue.
|
||||
**/
|
||||
BadState: AugmentedError<ApiType>;
|
||||
/**
|
||||
* A nomination target was supplied that was blocked or otherwise not a validator.
|
||||
**/
|
||||
BadTarget: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The call is not allowed at the given time due to restrictions of election period.
|
||||
**/
|
||||
@@ -1043,6 +1095,10 @@ declare module '@polkadot/api/types/errors' {
|
||||
* The snapshot data of the current window is missing.
|
||||
**/
|
||||
SnapshotUnavailable: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Too many nomination targets supplied.
|
||||
**/
|
||||
TooManyTargets: AugmentedError<ApiType>;
|
||||
};
|
||||
sudo: {
|
||||
[key: string]: AugmentedError<ApiType>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Bytes, Option, Vec, bool, u16, u32 } from '@polkadot/types';
|
||||
import type { Bytes, Option, Vec, bool, u16, u32, u8 } from '@polkadot/types';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { TAssetBalance } from '@polkadot/types/interfaces/assets';
|
||||
import type { BalanceStatus } from '@polkadot/types/interfaces/balances';
|
||||
@@ -11,6 +11,7 @@ import type { PropIndex, ReferendumIndex } from '@polkadot/types/interfaces/demo
|
||||
import type { VoteThreshold } from '@polkadot/types/interfaces/elections';
|
||||
import type { AuthorityList } from '@polkadot/types/interfaces/grandpa';
|
||||
import type { RegistrarIndex } from '@polkadot/types/interfaces/identity';
|
||||
import type { CallIndex } from '@polkadot/types/interfaces/lottery';
|
||||
import type { Kind, OpaqueTimeSlot } from '@polkadot/types/interfaces/offences';
|
||||
import type { ProxyType } from '@polkadot/types/interfaces/proxy';
|
||||
import type { AccountId, AccountIndex, AssetId, Balance, BlockNumber, CallHash, Hash, PhantomData } from '@polkadot/types/interfaces/runtime';
|
||||
@@ -26,6 +27,14 @@ declare module '@polkadot/api/types/events' {
|
||||
export interface AugmentedEvents<ApiType> {
|
||||
assets: {
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
/**
|
||||
* Some asset `asset_id` was frozen. \[asset_id\]
|
||||
**/
|
||||
AssetFrozen: AugmentedEvent<ApiType, [AssetId]>;
|
||||
/**
|
||||
* Some asset `asset_id` was thawed. \[asset_id\]
|
||||
**/
|
||||
AssetThawed: AugmentedEvent<ApiType, [AssetId]>;
|
||||
/**
|
||||
* Some assets were destroyed. \[asset_id, owner, balance\]
|
||||
**/
|
||||
@@ -58,6 +67,10 @@ declare module '@polkadot/api/types/events' {
|
||||
* The maximum amount of zombies allowed has changed. \[asset_id, max_zombies\]
|
||||
**/
|
||||
MaxZombiesChanged: AugmentedEvent<ApiType, [AssetId, u32]>;
|
||||
/**
|
||||
* New metadata has been set for an asset. \[asset_id, name, symbol, decimals\]
|
||||
**/
|
||||
MetadataSet: AugmentedEvent<ApiType, [AssetId, Bytes, Bytes, u8]>;
|
||||
/**
|
||||
* The owner changed \[asset_id, owner\]
|
||||
**/
|
||||
@@ -309,7 +322,10 @@ declare module '@polkadot/api/types/events' {
|
||||
elections: {
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
/**
|
||||
* A candidate was slashed due to failing to obtain a seat as member or runner-up
|
||||
* A \[candidate\] was slashed by \[amount\] due to failing to obtain a seat as member or
|
||||
* runner-up.
|
||||
*
|
||||
* Note that old members and runners-up are also candidates.
|
||||
**/
|
||||
CandidateSlashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
/**
|
||||
@@ -326,10 +342,6 @@ declare module '@polkadot/api/types/events' {
|
||||
* `EmptyTerm`.
|
||||
**/
|
||||
MemberKicked: AugmentedEvent<ApiType, [AccountId]>;
|
||||
/**
|
||||
* A \[member\] has renounced their candidacy.
|
||||
**/
|
||||
MemberRenounced: AugmentedEvent<ApiType, [AccountId]>;
|
||||
/**
|
||||
* A new term with \[new_members\]. This indicates that enough candidates existed to run the
|
||||
* election, not that enough have has been elected. The inner value must be examined for
|
||||
@@ -338,14 +350,13 @@ declare module '@polkadot/api/types/events' {
|
||||
**/
|
||||
NewTerm: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId, Balance]>>]>;
|
||||
/**
|
||||
* A seat holder (member or runner-up) was slashed due to failing to retaining their position.
|
||||
* Someone has renounced their candidacy.
|
||||
**/
|
||||
Renounced: AugmentedEvent<ApiType, [AccountId]>;
|
||||
/**
|
||||
* A \[seat holder\] was slashed by \[amount\] by being forcefully removed from the set.
|
||||
**/
|
||||
SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
/**
|
||||
* A voter was reported with the the report being successful or not.
|
||||
* \[voter, reporter, success\]
|
||||
**/
|
||||
VoterReported: AugmentedEvent<ApiType, [AccountId, AccountId, bool]>;
|
||||
};
|
||||
grandpa: {
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
@@ -437,6 +448,25 @@ declare module '@polkadot/api/types/events' {
|
||||
**/
|
||||
IndexFrozen: AugmentedEvent<ApiType, [AccountIndex, AccountId]>;
|
||||
};
|
||||
lottery: {
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
/**
|
||||
* A new set of calls have been set!
|
||||
**/
|
||||
CallsUpdated: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* A lottery has been started!
|
||||
**/
|
||||
LotteryStarted: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* A ticket has been bought!
|
||||
**/
|
||||
TicketBought: AugmentedEvent<ApiType, [AccountId, CallIndex]>;
|
||||
/**
|
||||
* A winner has been chosen!
|
||||
**/
|
||||
Winner: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
};
|
||||
multisig: {
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
/**
|
||||
@@ -622,6 +652,10 @@ declare module '@polkadot/api/types/events' {
|
||||
* \[era_index, validator_payout, remainder\]
|
||||
**/
|
||||
EraPayout: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
|
||||
/**
|
||||
* A nominator has been kicked from a validator. \[nominator, stash\]
|
||||
**/
|
||||
Kicked: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
||||
/**
|
||||
* An old slashing report from a prior era was discarded because it could
|
||||
* not be processed. \[session_index\]
|
||||
|
||||
@@ -3,18 +3,19 @@
|
||||
|
||||
import type { Bytes, Data, Option, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
|
||||
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
|
||||
import type { AssetBalance, AssetDetails } from '@polkadot/types/interfaces/assets';
|
||||
import type { AssetBalance, AssetDetails, AssetMetadata } from '@polkadot/types/interfaces/assets';
|
||||
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||
import type { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
|
||||
import type { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
|
||||
import type { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
|
||||
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
|
||||
import type { CodeHash, ContractInfo, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
|
||||
import type { CodeHash, ContractInfo, DeletedContract, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
|
||||
import type { PreimageStatus, PropIndex, Proposal, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy';
|
||||
import type { VoteThreshold } from '@polkadot/types/interfaces/elections';
|
||||
import type { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
|
||||
import type { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
|
||||
import type { AuthIndex } from '@polkadot/types/interfaces/imOnline';
|
||||
import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lottery';
|
||||
import type { DeferredOffenceOf, Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
|
||||
import type { ProxyAnnouncement, ProxyDefinition } from '@polkadot/types/interfaces/proxy';
|
||||
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
|
||||
@@ -22,7 +23,7 @@ import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber,
|
||||
import type { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
||||
import type { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
|
||||
import type { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
|
||||
import type { ActiveEraInfo, ElectionResult, ElectionScore, ElectionStatus, EraIndex, EraRewardPoints, Exposure, Forcing, Nominations, RewardDestination, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
||||
import type { ActiveEraInfo, ElectionResult, ElectionScore, ElectionStatus, EraIndex, EraRewardPoints, Exposure, Forcing, Nominations, RewardDestination, SeatHolder, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs, Voter } from '@polkadot/types/interfaces/staking';
|
||||
import type { AccountInfo, ConsumedWeight, DigestOf, EventIndex, EventRecord, LastRuntimeUpgradeInfo, Phase } from '@polkadot/types/interfaces/system';
|
||||
import type { Bounty, BountyIndex, OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
||||
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||
@@ -42,6 +43,10 @@ declare module '@polkadot/api/types/storage' {
|
||||
* Details of an asset.
|
||||
**/
|
||||
asset: AugmentedQuery<ApiType, (arg: AssetId | AnyNumber | Uint8Array) => Observable<Option<AssetDetails>>, [AssetId]> & QueryableStorageEntry<ApiType, [AssetId]>;
|
||||
/**
|
||||
* Metadata of an asset.
|
||||
**/
|
||||
metadata: AugmentedQuery<ApiType, (arg: AssetId | AnyNumber | Uint8Array) => Observable<AssetMetadata>, [AssetId]> & QueryableStorageEntry<ApiType, [AssetId]>;
|
||||
};
|
||||
authorship: {
|
||||
[key: string]: QueryableStorageEntry<ApiType>;
|
||||
@@ -96,6 +101,10 @@ declare module '@polkadot/api/types/storage' {
|
||||
* execution context should always yield zero.
|
||||
**/
|
||||
lateness: AugmentedQuery<ApiType, () => Observable<BlockNumber>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Next epoch authorities.
|
||||
**/
|
||||
nextAuthorities: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AuthorityId, BabeAuthorityWeight]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Next epoch configuration, if changed.
|
||||
**/
|
||||
@@ -197,6 +206,13 @@ declare module '@polkadot/api/types/storage' {
|
||||
* Current cost schedule for contracts.
|
||||
**/
|
||||
currentSchedule: AugmentedQuery<ApiType, () => Observable<Schedule>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Evicted contracts that await child trie deletion.
|
||||
*
|
||||
* Child trie deletion is a heavy operation depending on the amount of storage items
|
||||
* stored in said trie. Therefore this operation is performed lazily in `on_initialize`.
|
||||
**/
|
||||
deletionQueue: AugmentedQuery<ApiType, () => Observable<Vec<DeletedContract>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* A mapping from an original code hash to the original code, untouched by instrumentation.
|
||||
**/
|
||||
@@ -310,28 +326,37 @@ declare module '@polkadot/api/types/storage' {
|
||||
elections: {
|
||||
[key: string]: QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* The present candidate list. Sorted based on account-id. A current member or runner-up
|
||||
* can never enter this vector and is always implicitly assumed to be a candidate.
|
||||
* The present candidate list. A current member or runner-up can never enter this vector
|
||||
* and is always implicitly assumed to be a candidate.
|
||||
*
|
||||
* Second element is the deposit.
|
||||
*
|
||||
* Invariant: Always sorted based on account id.
|
||||
**/
|
||||
candidates: AugmentedQuery<ApiType, () => Observable<Vec<AccountId>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
candidates: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The total number of vote rounds that have happened, excluding the upcoming one.
|
||||
**/
|
||||
electionRounds: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The current elected membership. Sorted based on account id.
|
||||
* The current elected members.
|
||||
*
|
||||
* Invariant: Always sorted based on account id.
|
||||
**/
|
||||
members: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
members: AugmentedQuery<ApiType, () => Observable<Vec<SeatHolder>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The current runners_up. Sorted based on low to high merit (worse to best).
|
||||
* The current reserved runners-up.
|
||||
*
|
||||
* Invariant: Always sorted based on rank (worse to best). Upon removal of a member, the
|
||||
* last (i.e. _best_) runner-up will be replaced.
|
||||
**/
|
||||
runnersUp: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId, BalanceOf]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
runnersUp: AugmentedQuery<ApiType, () => Observable<Vec<SeatHolder>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Votes and locked stake of a particular voter.
|
||||
*
|
||||
* TWOX-NOTE: SAFE as `AccountId` is a crypto hash
|
||||
* TWOX-NOTE: SAFE as `AccountId` is a crypto hash.
|
||||
**/
|
||||
voting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[BalanceOf, Vec<AccountId>]>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
voting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Voter>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
};
|
||||
grandpa: {
|
||||
[key: string]: QueryableStorageEntry<ApiType>;
|
||||
@@ -426,6 +451,34 @@ declare module '@polkadot/api/types/storage' {
|
||||
**/
|
||||
accounts: AugmentedQuery<ApiType, (arg: AccountIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[AccountId, BalanceOf, bool]>>>, [AccountIndex]> & QueryableStorageEntry<ApiType, [AccountIndex]>;
|
||||
};
|
||||
lottery: {
|
||||
[key: string]: QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* The calls stored in this pallet to be used in an active lottery if configured
|
||||
* by `Config::ValidateCall`.
|
||||
**/
|
||||
callIndices: AugmentedQuery<ApiType, () => Observable<Vec<CallIndex>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The configuration for the current lottery.
|
||||
**/
|
||||
lottery: AugmentedQuery<ApiType, () => Observable<Option<LotteryConfig>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
lotteryIndex: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Users who have purchased a ticket. (Lottery Index, Tickets Purchased)
|
||||
**/
|
||||
participants: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[u32, Vec<CallIndex>]>>, [AccountId]> & QueryableStorageEntry<ApiType, [AccountId]>;
|
||||
/**
|
||||
* Each ticket's owner.
|
||||
*
|
||||
* May have residual storage from previous lotteries. Use `TicketsCount` to see which ones
|
||||
* are actually valid ticket mappings.
|
||||
**/
|
||||
tickets: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<AccountId>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||
/**
|
||||
* Total number of tickets sold.
|
||||
**/
|
||||
ticketsCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
};
|
||||
mmr: {
|
||||
[key: string]: QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
@@ -817,7 +870,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
* True if network has been upgraded to this version.
|
||||
* Storage version of the pallet.
|
||||
*
|
||||
* This is set to v3.0.0 for new networks.
|
||||
* This is set to v5.0.0 for new networks.
|
||||
**/
|
||||
storageVersion: AugmentedQuery<ApiType, () => Observable<Releases>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
@@ -912,6 +965,11 @@ declare module '@polkadot/api/types/storage' {
|
||||
* Hash of the previous block.
|
||||
**/
|
||||
parentHash: AugmentedQuery<ApiType, () => Observable<Hash>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* True if we have upgraded so that AccountInfo contains two types of `RefCount`. False
|
||||
* (default) if not.
|
||||
**/
|
||||
upgradedToDualRefCount: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* True if we have upgraded so that `type RefCount` is `u32`. False (default) if not.
|
||||
**/
|
||||
|
||||
@@ -15,7 +15,7 @@ import type { EthAccount, EthCallRequest, EthFilter, EthLog, EthReceipt, EthRich
|
||||
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';
|
||||
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
|
||||
import type { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
|
||||
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
|
||||
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
|
||||
import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
|
||||
import type { ReadProof, RuntimeVersion } from '@polkadot/types/interfaces/state';
|
||||
@@ -316,6 +316,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
|
||||
localStorageSet: AugmentedRpc<(kind: StorageKind | '__UNUSED' | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>;
|
||||
};
|
||||
payment: {
|
||||
/**
|
||||
* Query the detailed fee of a given encoded extrinsic
|
||||
**/
|
||||
queryFeeDetails: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<FeeDetails>>;
|
||||
/**
|
||||
* Retrieves the fee information for an encoded extrinsic
|
||||
**/
|
||||
|
||||
+224
-164
@@ -1,20 +1,20 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u16, u32, u64 } from '@polkadot/types';
|
||||
import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u16, u32, u64, u8 } from '@polkadot/types';
|
||||
import type { AnyNumber, ITuple } from '@polkadot/types/types';
|
||||
import type { TAssetBalance } from '@polkadot/types/interfaces/assets';
|
||||
import type { BabeEquivocationProof } from '@polkadot/types/interfaces/babe';
|
||||
import type { MemberCount, ProposalIndex } from '@polkadot/types/interfaces/collective';
|
||||
import type { CodeHash, Gas, Schedule } from '@polkadot/types/interfaces/contracts';
|
||||
import type { AccountVote, Conviction, PropIndex, Proposal, ReferendumIndex } from '@polkadot/types/interfaces/democracy';
|
||||
import type { DefunctVoter, Renouncing } from '@polkadot/types/interfaces/elections';
|
||||
import type { Renouncing } from '@polkadot/types/interfaces/elections';
|
||||
import type { Extrinsic, Signature } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/interfaces/grandpa';
|
||||
import type { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity';
|
||||
import type { Heartbeat } from '@polkadot/types/interfaces/imOnline';
|
||||
import type { ProxyType } from '@polkadot/types/interfaces/proxy';
|
||||
import type { AccountId, AccountIndex, Address, AssetId, Balance, BalanceOf, BlockNumber, Call, CallHashOf, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, Call, CallHashOf, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import type { Period, Priority } from '@polkadot/types/interfaces/scheduler';
|
||||
import type { Keys } from '@polkadot/types/interfaces/session';
|
||||
import type { SocietyJudgement } from '@polkadot/types/interfaces/society';
|
||||
@@ -46,7 +46,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Weight: `O(1)`
|
||||
* Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
|
||||
**/
|
||||
burn: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
burn: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
/**
|
||||
* Issue a new class of fungible assets from a public origin.
|
||||
*
|
||||
@@ -72,7 +72,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: TAssetBalance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, u32, TAssetBalance]>;
|
||||
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: TAssetBalance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, u32, TAssetBalance]>;
|
||||
/**
|
||||
* Destroy a class of fungible assets owned by the sender.
|
||||
*
|
||||
@@ -109,7 +109,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<u32>, Compact<TAssetBalance>]>;
|
||||
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<u32>, Compact<TAssetBalance>]>;
|
||||
/**
|
||||
* Destroy a class of fungible assets.
|
||||
*
|
||||
@@ -144,7 +144,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Modes: Pre-existence of `dest`; Post-existence of `source`; Prior & post zombie-status
|
||||
* of `source`; Account pre-existence of `dest`.
|
||||
**/
|
||||
forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, Compact<TAssetBalance>]>;
|
||||
forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, Compact<TAssetBalance>]>;
|
||||
/**
|
||||
* Disallow further unprivileged transfers from an account.
|
||||
*
|
||||
@@ -157,7 +157,19 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
freeze: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
freeze: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
/**
|
||||
* Disallow further unprivileged transfers for the asset class.
|
||||
*
|
||||
* Origin must be Signed and the sender should be the Freezer of the asset `id`.
|
||||
*
|
||||
* - `id`: The identifier of the asset to be frozen.
|
||||
*
|
||||
* Emits `Frozen`.
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
freezeAsset: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>]>;
|
||||
/**
|
||||
* Mint assets of a particular class.
|
||||
*
|
||||
@@ -172,8 +184,47 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Weight: `O(1)`
|
||||
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
|
||||
**/
|
||||
mint: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
mint: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
/**
|
||||
* Set the maximum number of zombie accounts for an asset.
|
||||
*
|
||||
* Origin must be Signed and the sender should be the Owner of the asset `id`.
|
||||
*
|
||||
* Funds of sender are reserved according to the formula:
|
||||
* `AssetDepositBase + AssetDepositPerZombie * max_zombies` taking into account
|
||||
* any already reserved funds.
|
||||
*
|
||||
* - `id`: The identifier of the asset to update zombie count.
|
||||
* - `max_zombies`: The new number of zombies allowed for this asset.
|
||||
*
|
||||
* Emits `MaxZombiesChanged`.
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
setMaxZombies: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, Compact<u32>]>;
|
||||
/**
|
||||
* Set the metadata for an asset.
|
||||
*
|
||||
* NOTE: There is no `unset_metadata` call. Simply pass an empty name, symbol,
|
||||
* and 0 decimals to this function to remove the metadata of an asset and
|
||||
* return your deposit.
|
||||
*
|
||||
* Origin must be Signed and the sender should be the Owner of the asset `id`.
|
||||
*
|
||||
* Funds of sender are reserved according to the formula:
|
||||
* `MetadataDepositBase + MetadataDepositPerByte * (name.len + symbol.len)` taking into
|
||||
* account any already reserved funds.
|
||||
*
|
||||
* - `id`: The identifier of the asset to update.
|
||||
* - `name`: The user friendly name of this asset. Limited in length by `StringLimit`.
|
||||
* - `symbol`: The exchange symbol for this asset. Limited in length by `StringLimit`.
|
||||
* - `decimals`: The number of decimals this asset uses to represent one unit.
|
||||
*
|
||||
* Emits `MaxZombiesChanged`.
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
setMetadata: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, name: Bytes | string | Uint8Array, symbol: Bytes | string | Uint8Array, decimals: u8 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, Bytes, Bytes, u8]>;
|
||||
/**
|
||||
* Change the Issuer, Admin and Freezer of an asset.
|
||||
*
|
||||
@@ -188,7 +239,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
setTeam: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, issuer: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, freezer: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, LookupSource]>;
|
||||
setTeam: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, issuer: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, admin: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, freezer: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, LookupSource]>;
|
||||
/**
|
||||
* Allow unprivileged transfers from an account again.
|
||||
*
|
||||
@@ -201,7 +252,19 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
thaw: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
thaw: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
/**
|
||||
* Allow unprivileged transfers for the asset again.
|
||||
*
|
||||
* Origin must be Signed and the sender should be the Admin of the asset `id`.
|
||||
*
|
||||
* - `id`: The identifier of the asset to be frozen.
|
||||
*
|
||||
* Emits `Thawed`.
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
thawAsset: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>]>;
|
||||
/**
|
||||
* Move some assets from the sender account to another.
|
||||
*
|
||||
@@ -222,7 +285,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status
|
||||
* of sender; Account pre-existence of `target`.
|
||||
**/
|
||||
transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
|
||||
/**
|
||||
* Change the Owner of an asset.
|
||||
*
|
||||
@@ -235,7 +298,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
transferOwnership: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
transferOwnership: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
|
||||
};
|
||||
authorship: {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
@@ -275,7 +338,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* not assumed to be in the overlay.
|
||||
* # </weight>
|
||||
**/
|
||||
forceTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, Compact<Balance>]>;
|
||||
forceTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, Compact<Balance>]>;
|
||||
/**
|
||||
* Set the balances of a given account.
|
||||
*
|
||||
@@ -296,7 +359,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - DB Weight: 1 Read, 1 Write to `who`
|
||||
* # </weight>
|
||||
**/
|
||||
setBalance: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, newFree: Compact<Balance> | AnyNumber | Uint8Array, newReserved: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>, Compact<Balance>]>;
|
||||
setBalance: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact<Balance> | AnyNumber | Uint8Array, newReserved: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>, Compact<Balance>]>;
|
||||
/**
|
||||
* Transfer some liquid free balance to another account.
|
||||
*
|
||||
@@ -326,7 +389,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Origin account is already in memory, so no DB operations for them.
|
||||
* # </weight>
|
||||
**/
|
||||
transfer: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
transfer: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
/**
|
||||
* Same as the [`transfer`] call, but with a check that the transfer will not kill the
|
||||
* origin account.
|
||||
@@ -340,7 +403,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already)
|
||||
* #</weight>
|
||||
**/
|
||||
transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
|
||||
};
|
||||
bounties: {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
@@ -378,7 +441,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - O(1).
|
||||
* # </weight>
|
||||
**/
|
||||
awardBounty: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource]>;
|
||||
awardBounty: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource]>;
|
||||
/**
|
||||
* Claim the payout from an awarded bounty after payout delay.
|
||||
*
|
||||
@@ -441,7 +504,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - O(1).
|
||||
* # </weight>
|
||||
**/
|
||||
proposeCurator: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, curator: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, fee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource, Compact<BalanceOf>]>;
|
||||
proposeCurator: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, curator: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, fee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource, Compact<BalanceOf>]>;
|
||||
/**
|
||||
* Unassign curator from a bounty.
|
||||
*
|
||||
@@ -475,13 +538,17 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* * If no account exists and the call value is not less than `existential_deposit`,
|
||||
* a regular account will be created and any value will be transferred.
|
||||
**/
|
||||
call: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, Compact<Gas>, Bytes]>;
|
||||
call: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, Compact<Gas>, Bytes]>;
|
||||
/**
|
||||
* Allows block producers to claim a small reward for evicting a contract. If a block producer
|
||||
* fails to do so, a regular users will be allowed to claim the reward.
|
||||
* Allows block producers to claim a small reward for evicting a contract. If a block
|
||||
* producer fails to do so, a regular users will be allowed to claim the reward.
|
||||
*
|
||||
* If contract is not evicted as a result of this call, no actions are taken and
|
||||
* the sender is not eligible for the reward.
|
||||
* In case of a successful eviction no fees are charged from the sender. However, the
|
||||
* reward is capped by the total amount of rent that was payed by the contract while
|
||||
* it was alive.
|
||||
*
|
||||
* If contract is not evicted as a result of this call, [`Error::ContractNotEvictable`]
|
||||
* is returned and the sender is not eligible for the reward.
|
||||
**/
|
||||
claimSurcharge: AugmentedSubmittable<(dest: AccountId | string | Uint8Array, auxSender: Option<AccountId> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId, Option<AccountId>]>;
|
||||
/**
|
||||
@@ -986,6 +1053,19 @@ declare module '@polkadot/api/types/submittable' {
|
||||
};
|
||||
elections: {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
/**
|
||||
* Clean all voters who are defunct (i.e. they do not serve any purpose at all). The
|
||||
* deposit of the removed voters are returned.
|
||||
*
|
||||
* This is an root function to be used only for cleaning the state.
|
||||
*
|
||||
* The dispatch origin of this call must be root.
|
||||
*
|
||||
* # <weight>
|
||||
* The total number of voters and those that are defunct must be provided as witness data.
|
||||
* # </weight>
|
||||
**/
|
||||
cleanDefunctVoters: AugmentedSubmittable<(numVoters: u32 | AnyNumber | Uint8Array, numDefunct: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
|
||||
/**
|
||||
* Remove a particular member from the set. This is effective immediately and the bond of
|
||||
* the outgoing member is slashed.
|
||||
@@ -993,125 +1073,59 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* If a runner-up is available, then the best runner-up will be removed and replaces the
|
||||
* outgoing member. Otherwise, a new phragmen election is started.
|
||||
*
|
||||
* The dispatch origin of this call must be root.
|
||||
*
|
||||
* Note that this does not affect the designated block number of the next election.
|
||||
*
|
||||
* # <weight>
|
||||
* If we have a replacement:
|
||||
* - Base weight: 50.93 µs
|
||||
* - State reads:
|
||||
* - RunnersUp.len()
|
||||
* - Members, RunnersUp (remove_and_replace_member)
|
||||
* - State writes:
|
||||
* - Members, RunnersUp (remove_and_replace_member)
|
||||
* Else, since this is a root call and will go into phragmen, we assume full block for now.
|
||||
* If we have a replacement, we use a small weight. Else, since this is a root call and
|
||||
* will go into phragmen, we assume full block for now.
|
||||
* # </weight>
|
||||
**/
|
||||
removeMember: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
removeMember: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
/**
|
||||
* Remove `origin` as a voter. This removes the lock and returns the bond.
|
||||
* Remove `origin` as a voter.
|
||||
*
|
||||
* # <weight>
|
||||
* Base weight: 36.8 µs
|
||||
* All state access is from do_remove_voter.
|
||||
* State reads:
|
||||
* - Voting
|
||||
* - [AccountData(who)]
|
||||
* State writes:
|
||||
* - Voting
|
||||
* - Locks
|
||||
* - [AccountData(who)]
|
||||
* # </weight>
|
||||
* This removes the lock and returns the deposit.
|
||||
*
|
||||
* The dispatch origin of this call must be signed and be a voter.
|
||||
**/
|
||||
removeVoter: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
/**
|
||||
* Renounce one's intention to be a candidate for the next election round. 3 potential
|
||||
* outcomes exist:
|
||||
* - `origin` is a candidate and not elected in any set. In this case, the bond is
|
||||
*
|
||||
* - `origin` is a candidate and not elected in any set. In this case, the deposit is
|
||||
* unreserved, returned and origin is removed as a candidate.
|
||||
* - `origin` is a current runner-up. In this case, the bond is unreserved, returned and
|
||||
* - `origin` is a current runner-up. In this case, the deposit is unreserved, returned and
|
||||
* origin is removed as a runner-up.
|
||||
* - `origin` is a current member. In this case, the bond is unreserved and origin is
|
||||
* - `origin` is a current member. In this case, the deposit is unreserved and origin is
|
||||
* removed as a member, consequently not being a candidate for the next round anymore.
|
||||
* Similar to [`remove_voter`], if replacement runners exists, they are immediately used.
|
||||
* <weight>
|
||||
* If a candidate is renouncing:
|
||||
* Base weight: 17.28 µs
|
||||
* Complexity of candidate_count: 0.235 µs
|
||||
* State reads:
|
||||
* - Candidates
|
||||
* - [AccountBalance(who) (unreserve)]
|
||||
* State writes:
|
||||
* - Candidates
|
||||
* - [AccountBalance(who) (unreserve)]
|
||||
* If member is renouncing:
|
||||
* Base weight: 46.25 µs
|
||||
* State reads:
|
||||
* - Members, RunnersUp (remove_and_replace_member),
|
||||
* - [AccountData(who) (unreserve)]
|
||||
* State writes:
|
||||
* - Members, RunnersUp (remove_and_replace_member),
|
||||
* - [AccountData(who) (unreserve)]
|
||||
* If runner is renouncing:
|
||||
* Base weight: 46.25 µs
|
||||
* State reads:
|
||||
* - RunnersUp (remove_and_replace_member),
|
||||
* - [AccountData(who) (unreserve)]
|
||||
* State writes:
|
||||
* - RunnersUp (remove_and_replace_member),
|
||||
* - [AccountData(who) (unreserve)]
|
||||
* </weight>
|
||||
* Similar to [`remove_members`], if replacement runners exists, they are immediately used.
|
||||
* If the prime is renouncing, then no prime will exist until the next round.
|
||||
*
|
||||
* The dispatch origin of this call must be signed, and have one of the above roles.
|
||||
*
|
||||
* # <weight>
|
||||
* The type of renouncing must be provided as witness data.
|
||||
* # </weight>
|
||||
**/
|
||||
renounceCandidacy: AugmentedSubmittable<(renouncing: Renouncing | { Member: any } | { RunnerUp: any } | { Candidate: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Renouncing]>;
|
||||
/**
|
||||
* Report `target` for being an defunct voter. In case of a valid report, the reporter is
|
||||
* rewarded by the bond amount of `target`. Otherwise, the reporter itself is removed and
|
||||
* their bond is slashed.
|
||||
* Submit oneself for candidacy. A fixed amount of deposit is recorded.
|
||||
*
|
||||
* A defunct voter is defined to be:
|
||||
* - a voter whose current submitted votes are all invalid. i.e. all of them are no
|
||||
* longer a candidate nor an active member or a runner-up.
|
||||
* All candidates are wiped at the end of the term. They either become a member/runner-up,
|
||||
* or leave the system while their deposit is slashed.
|
||||
*
|
||||
* The dispatch origin of this call must be signed.
|
||||
*
|
||||
* The origin must provide the number of current candidates and votes of the reported target
|
||||
* for the purpose of accurate weight calculation.
|
||||
* ### Warning
|
||||
*
|
||||
* Even if a candidate ends up being a member, they must call [`Call::renounce_candidacy`]
|
||||
* to get their deposit back. Losing the spot in an election will always lead to a slash.
|
||||
*
|
||||
* # <weight>
|
||||
* No Base weight based on min square analysis.
|
||||
* Complexity of candidate_count: 1.755 µs
|
||||
* Complexity of vote_count: 18.51 µs
|
||||
* State reads:
|
||||
* - Voting(reporter)
|
||||
* - Candidate.len()
|
||||
* - Voting(Target)
|
||||
* - Candidates, Members, RunnersUp (is_defunct_voter)
|
||||
* State writes:
|
||||
* - Lock(reporter || target)
|
||||
* - [AccountBalance(reporter)] + AccountBalance(target)
|
||||
* - Voting(reporter || target)
|
||||
* Note: the db access is worse with respect to db, which is when the report is correct.
|
||||
* # </weight>
|
||||
**/
|
||||
reportDefunctVoter: AugmentedSubmittable<(defunct: DefunctVoter | { who?: any; voteCount?: any; candidateCount?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [DefunctVoter]>;
|
||||
/**
|
||||
* Submit oneself for candidacy.
|
||||
*
|
||||
* A candidate will either:
|
||||
* - Lose at the end of the term and forfeit their deposit.
|
||||
* - Win and become a member. Members will eventually get their stash back.
|
||||
* - Become a runner-up. Runners-ups are reserved members in case one gets forcefully
|
||||
* removed.
|
||||
*
|
||||
* # <weight>
|
||||
* Base weight = 33.33 µs
|
||||
* Complexity of candidate_count: 0.375 µs
|
||||
* State reads:
|
||||
* - Candidates
|
||||
* - Members
|
||||
* - RunnersUp
|
||||
* - [AccountBalance(who)]
|
||||
* State writes:
|
||||
* - [AccountBalance(who)]
|
||||
* - Candidates
|
||||
* The number of current candidates must be provided as witness data.
|
||||
* # </weight>
|
||||
**/
|
||||
submitCandidacy: AugmentedSubmittable<(candidateCount: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
|
||||
@@ -1119,28 +1133,25 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Vote for a set of candidates for the upcoming round of election. This can be called to
|
||||
* set the initial votes, or update already existing votes.
|
||||
*
|
||||
* Upon initial voting, `value` units of `who`'s balance is locked and a bond amount is
|
||||
* reserved.
|
||||
* Upon initial voting, `value` units of `who`'s balance is locked and a deposit amount is
|
||||
* reserved. The deposit is based on the number of votes and can be updated over time.
|
||||
*
|
||||
* The `votes` should:
|
||||
* - not be empty.
|
||||
* - be less than the number of possible candidates. Note that all current members and
|
||||
* runners-up are also automatically candidates for the next round.
|
||||
*
|
||||
* It is the responsibility of the caller to not place all of their balance into the lock
|
||||
* and keep some for further transactions.
|
||||
* If `value` is more than `who`'s total balance, then the maximum of the two is used.
|
||||
*
|
||||
* The dispatch origin of this call must be signed.
|
||||
*
|
||||
* ### Warning
|
||||
*
|
||||
* It is the responsibility of the caller to **NOT** place all of their balance into the
|
||||
* lock and keep some for further operations.
|
||||
*
|
||||
* # <weight>
|
||||
* Base weight: 47.93 µs
|
||||
* State reads:
|
||||
* - Candidates.len() + Members.len() + RunnersUp.len()
|
||||
* - Voting (is_voter)
|
||||
* - Lock
|
||||
* - [AccountBalance(who) (unreserve + total_balance)]
|
||||
* State writes:
|
||||
* - Voting
|
||||
* - Lock
|
||||
* - [AccountBalance(who) (unreserve -- only when creating a new voter)]
|
||||
* We assume the maximum weight among all 3 cases: vote_equal, vote_more and vote_less.
|
||||
* # </weight>
|
||||
**/
|
||||
vote: AugmentedSubmittable<(votes: Vec<AccountId> | (AccountId | string | Uint8Array)[], value: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<AccountId>, Compact<BalanceOf>]>;
|
||||
@@ -1204,7 +1215,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
|
||||
* sub identity of `sub`.
|
||||
**/
|
||||
addSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
|
||||
addSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
|
||||
/**
|
||||
* Cancel a previous request.
|
||||
*
|
||||
@@ -1267,7 +1278,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
killIdentity: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Provide a judgement for an account's identity.
|
||||
*
|
||||
@@ -1289,7 +1300,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - One event.
|
||||
* # </weight>
|
||||
**/
|
||||
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<RegistrarIndex>, LookupSource, IdentityJudgement]>;
|
||||
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<RegistrarIndex>, LookupSource, IdentityJudgement]>;
|
||||
/**
|
||||
* Remove the sender as a sub-account.
|
||||
*
|
||||
@@ -1312,14 +1323,14 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
|
||||
* sub identity of `sub`.
|
||||
**/
|
||||
removeSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
removeSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Alter the associated name of the given sub-account.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_ and the sender must have a registered
|
||||
* sub identity of `sub`.
|
||||
**/
|
||||
renameSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
|
||||
renameSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
|
||||
/**
|
||||
* Request a judgement from a registrar.
|
||||
*
|
||||
@@ -1568,6 +1579,52 @@ declare module '@polkadot/api/types/submittable' {
|
||||
**/
|
||||
transfer: AugmentedSubmittable<(updated: AccountId | string | Uint8Array, index: AccountIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId, AccountIndex]>;
|
||||
};
|
||||
lottery: {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
/**
|
||||
* Buy a ticket to enter the lottery.
|
||||
*
|
||||
* This extrinsic acts as a passthrough function for `call`. In all
|
||||
* situations where `call` alone would succeed, this extrinsic should
|
||||
* succeed.
|
||||
*
|
||||
* If `call` is successful, then we will attempt to purchase a ticket,
|
||||
* which may fail silently. To detect success of a ticket purchase, you
|
||||
* should listen for the `TicketBought` event.
|
||||
*
|
||||
* This extrinsic must be called by a signed origin.
|
||||
**/
|
||||
buyTicket: AugmentedSubmittable<(call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
|
||||
/**
|
||||
* Set calls in storage which can be used to purchase a lottery ticket.
|
||||
*
|
||||
* This function only matters if you use the `ValidateCall` implementation
|
||||
* provided by this pallet, which uses storage to determine the valid calls.
|
||||
*
|
||||
* This extrinsic must be called by the Manager origin.
|
||||
**/
|
||||
setCalls: AugmentedSubmittable<(calls: Vec<Call> | (Call | { callIndex?: any; args?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;
|
||||
/**
|
||||
* Start a lottery using the provided configuration.
|
||||
*
|
||||
* This extrinsic must be called by the `ManagerOrigin`.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* * `price`: The cost of a single ticket.
|
||||
* * `length`: How long the lottery should run for starting at the current block.
|
||||
* * `delay`: How long after the lottery end we should wait before picking a winner.
|
||||
* * `repeat`: If the lottery should repeat when completed.
|
||||
**/
|
||||
startLottery: AugmentedSubmittable<(price: BalanceOf | AnyNumber | Uint8Array, length: BlockNumber | AnyNumber | Uint8Array, delay: BlockNumber | AnyNumber | Uint8Array, repeat: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [BalanceOf, BlockNumber, BlockNumber, bool]>;
|
||||
/**
|
||||
* If a lottery is repeating, you can use this to stop the repeat.
|
||||
* The lottery will continue to run to completion.
|
||||
*
|
||||
* This extrinsic must be called by the `ManagerOrigin`.
|
||||
**/
|
||||
stopRepeat: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
};
|
||||
multisig: {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
/**
|
||||
@@ -2481,7 +2538,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Total Complexity: O(M + logM + C)
|
||||
* # </weight>
|
||||
**/
|
||||
vote: AugmentedSubmittable<(candidate: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
vote: AugmentedSubmittable<(candidate: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
|
||||
/**
|
||||
* As a member, vouch for someone to join society by placing a bid on their behalf.
|
||||
*
|
||||
@@ -2556,7 +2613,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Write: Bonded, Payee, [Origin Account], Locks, Ledger
|
||||
* # </weight>
|
||||
**/
|
||||
bond: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, RewardDestination]>;
|
||||
bond: AugmentedSubmittable<(controller: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, RewardDestination]>;
|
||||
/**
|
||||
* Add some extra amount that have appeared in the stash `free_balance` into the balance up
|
||||
* for staking.
|
||||
@@ -2676,6 +2733,22 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* # </weight>
|
||||
**/
|
||||
increaseValidatorCount: AugmentedSubmittable<(additional: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
|
||||
/**
|
||||
* Remove the given nominations from the calling validator.
|
||||
*
|
||||
* Effects will be felt at the beginning of the next era.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_ by the controller, not the stash.
|
||||
* And, it can be only called when [`EraElectionStatus`] is `Closed`. The controller
|
||||
* account should represent a validator.
|
||||
*
|
||||
* - `who`: A list of nominator stash accounts who are nominating this validator which
|
||||
* should no longer be nominating this validator.
|
||||
*
|
||||
* Note: Making this call only makes sense if you first set the validator preferences to
|
||||
* block any further nominations.
|
||||
**/
|
||||
kick: AugmentedSubmittable<(who: Vec<LookupSource> | (LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
|
||||
/**
|
||||
* Declare the desire to nominate `targets` for the origin controller.
|
||||
*
|
||||
@@ -2697,7 +2770,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Writes: Validators, Nominators
|
||||
* # </weight>
|
||||
**/
|
||||
nominate: AugmentedSubmittable<(targets: Vec<LookupSource> | (LookupSource | Address | AccountId | AccountIndex | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
|
||||
nominate: AugmentedSubmittable<(targets: Vec<LookupSource> | (LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
|
||||
/**
|
||||
* Pay out all the stakers behind a single validator for a single era.
|
||||
*
|
||||
@@ -2730,9 +2803,9 @@ declare module '@polkadot/api/types/submittable' {
|
||||
**/
|
||||
payoutStakers: AugmentedSubmittable<(validatorStash: AccountId | string | Uint8Array, era: EraIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId, EraIndex]>;
|
||||
/**
|
||||
* Remove all data structure concerning a staker/stash once its balance is zero.
|
||||
* Remove all data structure concerning a staker/stash once its balance is at the minimum.
|
||||
* This is essentially equivalent to `withdraw_unbonded` except it can be called by anyone
|
||||
* and the target `stash` must have no funds left.
|
||||
* and the target `stash` must have no funds left beyond the ED.
|
||||
*
|
||||
* This can be called from any origin.
|
||||
*
|
||||
@@ -2792,7 +2865,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Write: Bonded, Ledger New Controller, Ledger Old Controller
|
||||
* # </weight>
|
||||
**/
|
||||
setController: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
setController: AugmentedSubmittable<(controller: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Set `HistoryDepth` value. This function will delete any history information
|
||||
* when `HistoryDepth` is reduced.
|
||||
@@ -3025,7 +3098,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - One DB change.
|
||||
* # </weight>
|
||||
**/
|
||||
setKey: AugmentedSubmittable<(updated: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
setKey: AugmentedSubmittable<(updated: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Authenticates the sudo key and dispatches a function call with `Root` origin.
|
||||
*
|
||||
@@ -3052,7 +3125,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Weight of derivative `call` execution + 10,000.
|
||||
* # </weight>
|
||||
**/
|
||||
sudoAs: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Call]>;
|
||||
sudoAs: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Call]>;
|
||||
/**
|
||||
* Authenticates the sudo key and dispatches a function call with `Root` origin.
|
||||
* This function does not check the weight of the call, and instead allows the
|
||||
@@ -3167,19 +3240,6 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* # </weight>
|
||||
**/
|
||||
setStorage: AugmentedSubmittable<(items: Vec<KeyValue> | (KeyValue)[]) => SubmittableExtrinsic<ApiType>, [Vec<KeyValue>]>;
|
||||
/**
|
||||
* Kill the sending account, assuming there are no references outstanding and the composite
|
||||
* data is equal to its default value.
|
||||
*
|
||||
* # <weight>
|
||||
* - `O(1)`
|
||||
* - 1 storage read and deletion.
|
||||
* --------------------
|
||||
* Base Weight: 8.626 µs
|
||||
* No DB Read or Write operations because caller is already in overlay
|
||||
* # </weight>
|
||||
**/
|
||||
suicide: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
};
|
||||
technicalCommittee: {
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
@@ -3552,7 +3612,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - DbWrites: `ProposalCount`, `Proposals`, `origin account`
|
||||
* # </weight>
|
||||
**/
|
||||
proposeSpend: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, LookupSource]>;
|
||||
proposeSpend: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, LookupSource]>;
|
||||
/**
|
||||
* Reject a proposed spend. The original deposit will be slashed.
|
||||
*
|
||||
@@ -3643,7 +3703,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Writes: Vesting Storage, Balances Locks, Target Account, Source Account
|
||||
* # </weight>
|
||||
**/
|
||||
forceVestedTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, VestingInfo]>;
|
||||
forceVestedTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, VestingInfo]>;
|
||||
/**
|
||||
* Unlock any vested funds of the sender account.
|
||||
*
|
||||
@@ -3677,7 +3737,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Writes: Vesting Storage, Balances Locks, Target Account
|
||||
* # </weight>
|
||||
**/
|
||||
vestOther: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
vestOther: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Create a vested transfer.
|
||||
*
|
||||
@@ -3696,7 +3756,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]
|
||||
* # </weight>
|
||||
**/
|
||||
vestedTransfer: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, VestingInfo]>;
|
||||
vestedTransfer: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, VestingInfo]>;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,13 @@ import { Metadata } from '@polkadot/metadata';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { LATEST_EXTRINSIC_VERSION } from '@polkadot/types/extrinsic/Extrinsic';
|
||||
import { getSpecAlias, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
|
||||
import { assert, BN_ZERO, logger, u8aEq, u8aToU8a } from '@polkadot/util';
|
||||
import { assert, BN_ZERO, logger, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
import { of } from '@polkadot/x-rxjs';
|
||||
import { map, switchMap } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
import { Decorate } from './Decorate';
|
||||
import { detectedCapabilities } from './util';
|
||||
|
||||
const KEEPALIVE_INTERVAL = 15000;
|
||||
const DEFAULT_BLOCKNUMBER = { unwrap: () => BN_ZERO };
|
||||
@@ -36,10 +37,6 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
constructor (options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) {
|
||||
super(options, type, decorateMethod);
|
||||
|
||||
if (!this.hasSubscriptions) {
|
||||
l.warn('Api will be available in a limited mode since the provider does not support subscriptions');
|
||||
}
|
||||
|
||||
// all injected types added to the registry for overrides
|
||||
this.registry.setKnownTypes(options);
|
||||
|
||||
@@ -63,9 +60,14 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
this._rx.signer = options.signer;
|
||||
|
||||
this._rpcCore.setRegistrySwap((hash: string | Uint8Array) => this.getBlockRegistry(hash));
|
||||
this._rpcCore.provider.on('disconnected', this.#onProviderDisconnect);
|
||||
this._rpcCore.provider.on('error', this.#onProviderError);
|
||||
this._rpcCore.provider.on('connected', this.#onProviderConnect);
|
||||
|
||||
if (this.hasSubscriptions) {
|
||||
this._rpcCore.provider.on('disconnected', this.#onProviderDisconnect);
|
||||
this._rpcCore.provider.on('error', this.#onProviderError);
|
||||
this._rpcCore.provider.on('connected', this.#onProviderConnect);
|
||||
} else {
|
||||
l.warn('Api will be available in a limited mode since the provider does not support subscriptions');
|
||||
}
|
||||
|
||||
// If the provider was instantiated earlier, and has already emitted a
|
||||
// 'connected' event, then the `on('connected')` won't fire anymore. To
|
||||
@@ -135,6 +137,11 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
// nothing has been found, construct new
|
||||
const metadata = await this._rpcCore.state.getMetadata(header.parentHash).toPromise();
|
||||
const registry = this._initRegistry(new TypeRegistry(), this._runtimeChain as Text, version, metadata);
|
||||
|
||||
// For now, since this is new we ignore the capability lookups (this could be useful once proven)
|
||||
// this._detectCapabilities(registry, blockHash);
|
||||
|
||||
// add our new registry
|
||||
const result = { isDefault: false, lastBlockHash, metadata, metadataConsts: null, registry, specVersion: version.specVersion };
|
||||
|
||||
this.#registries.push(result);
|
||||
@@ -180,6 +187,19 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
return [source.genesisHash, source.runtimeMetadata];
|
||||
}
|
||||
|
||||
private _detectCapabilities (registry?: Registry, blockHash?: string | Uint8Array): void {
|
||||
detectedCapabilities(this._rx, blockHash)
|
||||
.toPromise()
|
||||
.then((types): void => {
|
||||
if (Object.keys(types).length) {
|
||||
(registry || this.registry).register(types as Record<string, string>);
|
||||
|
||||
l.debug(`Capabilities detected${blockHash ? ` (${u8aToHex(u8aToU8a(blockHash))})` : ''}: ${JSON.stringify(types)}`);
|
||||
}
|
||||
})
|
||||
.catch(l.error);
|
||||
}
|
||||
|
||||
// subscribe to metadata updates, inject the types on changes
|
||||
private _subscribeUpdates (): void {
|
||||
if (this.#updateSub || !this.hasSubscriptions) {
|
||||
@@ -212,6 +232,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
// clear the registry types to ensure that we override correctly
|
||||
this._initRegistry(thisRegistry.registry.init(), this._runtimeChain as Text, version, metadata);
|
||||
this.injectMetadata(metadata, false, thisRegistry.registry);
|
||||
this._detectCapabilities(thisRegistry.registry);
|
||||
|
||||
return true;
|
||||
})
|
||||
@@ -277,9 +298,11 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
|
||||
this._rx.extrinsicType = this._extrinsicType;
|
||||
this._rx.genesisHash = this._genesisHash;
|
||||
this._rx.runtimeVersion = this._runtimeVersion;
|
||||
this._rx.runtimeVersion = this._runtimeVersion as RuntimeVersion; // must be set here
|
||||
|
||||
// inject metadata and adjust the types as detected
|
||||
this.injectMetadata(metadata, true);
|
||||
this._detectCapabilities();
|
||||
|
||||
// derive is last, since it uses the decorated rx
|
||||
this._rx.derive = this._decorateDeriveRx(this._rxDecorateMethod);
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { bool } from '@polkadot/types';
|
||||
import type { Releases } from '@polkadot/types/interfaces';
|
||||
import type { InterfaceTypes } from '@polkadot/types/types';
|
||||
|
||||
import { combineLatest, Observable, of } from '@polkadot/x-rxjs';
|
||||
import { map, take } from '@polkadot/x-rxjs/operators';
|
||||
|
||||
// the order and types needs to map with the all array setup below
|
||||
type Extracted = [bool | null, bool | null, Releases | null];
|
||||
|
||||
type DetectedKeys = keyof Pick<InterfaceTypes, 'AccountInfo' | 'ValidatorPrefs'>;
|
||||
|
||||
type DetectedValues = keyof InterfaceTypes;
|
||||
|
||||
interface DetectedTypes extends Record<DetectedKeys, DetectedValues> {
|
||||
AccountInfo: 'AccountInfoWithRefCount' | 'AccountInfoWithProviders',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithBlocked' | 'ValidatorPrefsWithCommission';
|
||||
}
|
||||
|
||||
function mapCapabilities ([systemRefcount32, systemRefcountDual, stakingVersion]: Extracted): Partial<DetectedTypes> {
|
||||
const types: Partial<DetectedTypes> = {};
|
||||
|
||||
// AccountInfo
|
||||
if (systemRefcountDual && systemRefcountDual.isTrue) {
|
||||
types.AccountInfo = 'AccountInfoWithProviders';
|
||||
} else if (systemRefcount32 && systemRefcount32.isTrue) {
|
||||
types.AccountInfo = 'AccountInfoWithRefCount';
|
||||
}
|
||||
|
||||
// ValidatorPrefs
|
||||
if (stakingVersion) {
|
||||
if (stakingVersion.index >= 4) { // v1 = index 0, V5 = index 4
|
||||
types.ValidatorPrefs = 'ValidatorPrefsWithBlocked';
|
||||
} else {
|
||||
types.ValidatorPrefs = 'ValidatorPrefsWithCommission';
|
||||
}
|
||||
}
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Query the chain for the specific capabilities
|
||||
*/
|
||||
export function detectedCapabilities (api: ApiInterfaceRx, blockHash?: Uint8Array | string | undefined): Observable<Partial<DetectedTypes>> {
|
||||
const all = [
|
||||
api.query.system?.upgradedToU32RefCount,
|
||||
api.query.system?.upgradedToDualRefCount,
|
||||
api.query.staking?.storageVersion
|
||||
];
|
||||
const included = all.map((c) => !!c);
|
||||
const filtered = all.filter((_, index) => included[index]);
|
||||
|
||||
return (
|
||||
filtered.length
|
||||
? blockHash
|
||||
? combineLatest(filtered.map((c) => c.at(blockHash)))
|
||||
: api.queryMulti(filtered)
|
||||
: of([])
|
||||
).pipe(
|
||||
map((results): Partial<DetectedTypes> => {
|
||||
let offset = -1;
|
||||
|
||||
return mapCapabilities(
|
||||
included.map((isIncluded) => isIncluded ? results[++offset] : null) as Extracted
|
||||
);
|
||||
}),
|
||||
take(1)
|
||||
);
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import { hexToU8a } from '@polkadot/util';
|
||||
import { SingleAccountSigner } from '../../test/util';
|
||||
import { ApiPromise } from '.';
|
||||
|
||||
const TRANSFER_SIG = '0x7a10e5ed9a14284eca7bea53f81631981dddda5a3d2dee973b136475947264801465726e4829ae3994d9058df638d959d4e043c7f1924299546790dda1dea20a';
|
||||
const TRANSFER_SIG = '0x54f39e43f32376a5ab6cdfd4d0ce57802aa9ff85514a7ffa9f2a949078f02beca16af87427c45fe60d54aa847fd241d127ed39e21b101806f6b1f50f7a82500b';
|
||||
|
||||
describe('ApiPromise', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -81,7 +81,7 @@ export interface ApiInterfaceRx {
|
||||
hasSubscriptions: boolean;
|
||||
registry: Registry;
|
||||
runtimeMetadata: Metadata;
|
||||
runtimeVersion?: RuntimeVersion;
|
||||
runtimeVersion: RuntimeVersion;
|
||||
query: QueryableStorage<'rxjs'>;
|
||||
queryMulti: QueryableStorageMulti<'rxjs'>;
|
||||
rpc: DecoratedRpc<'rxjs', RpcInterface>;
|
||||
|
||||
@@ -38,16 +38,16 @@ export type QueryableStorageEntry<ApiType extends ApiTypes, A extends AnyTuple =
|
||||
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple> {
|
||||
at: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
|
||||
creator: StorageEntry;
|
||||
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey, T][]>;
|
||||
entriesAt: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(hash: Hash | Uint8Array | string, arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey, T][]>;
|
||||
entriesPaged: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey, T][]>;
|
||||
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey<A>, T][]>;
|
||||
entriesAt: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(hash: Hash | Uint8Array | string, arg?: Parameters<F>[0]) => PromiseOrObs<ApiType, [StorageKey<A>, T][]>;
|
||||
entriesPaged: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<A>, T][]>;
|
||||
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
|
||||
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
|
||||
key: (...args: Parameters<F>) => string;
|
||||
keyPrefix: () => string;
|
||||
keys: (arg?: any) => PromiseOrObs<ApiType, StorageKey[]>;
|
||||
keysAt: (hash: Hash | Uint8Array | string, arg?: any) => PromiseOrObs<ApiType, StorageKey[]>;
|
||||
keysPaged: (opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, StorageKey[]>;
|
||||
keys: (arg?: any) => PromiseOrObs<ApiType, StorageKey<A>[]>;
|
||||
keysAt: (hash: Hash | Uint8Array | string, arg?: any) => PromiseOrObs<ApiType, StorageKey<A>[]>;
|
||||
keysPaged: (opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, StorageKey<A>[]>;
|
||||
// @deprecated The underlying RPC this been marked unsafe and is generally not exposed
|
||||
range: <T extends Codec | any = ObsInnerType<ReturnType<F>>>([from, to]: [Hash | Uint8Array | string, Hash | Uint8Array | string | undefined] | [Hash | Uint8Array | string], ...args: Parameters<F>) => PromiseOrObs<ApiType, [Hash, T][]>;
|
||||
size: (...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/metadata",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Helpers to extract information from runtime metadata",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.mjs"
|
||||
@@ -17,13 +16,13 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/types": "3.4.1",
|
||||
"@polkadot/types-known": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/util-crypto": "^5.2.3",
|
||||
"@polkadot/types": "3.7.2",
|
||||
"@polkadot/types-known": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"@polkadot/util-crypto": "^5.5.1",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.2.3"
|
||||
"@polkadot/keyring": "^5.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ const registry = new TypeRegistry();
|
||||
const metadata = new Metadata(registry, metadataStatic);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
registry.register({ Address: 'IndicesLookupSource', LookupSource: 'IndicesLookupSource' });
|
||||
|
||||
const extrinsics = decorateExtrinsics(registry, metadata.asLatest, metadata.version);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-core",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": false,
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
@@ -14,13 +13,13 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/metadata": "3.4.1",
|
||||
"@polkadot/rpc-provider": "3.4.1",
|
||||
"@polkadot/types": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/x-rxjs": "3.4.1"
|
||||
"@polkadot/metadata": "3.7.2",
|
||||
"@polkadot/rpc-provider": "3.7.2",
|
||||
"@polkadot/types": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"@polkadot/x-rxjs": "^5.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.2.3"
|
||||
"@polkadot/keyring": "^5.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": false,
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
@@ -14,18 +13,19 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/types": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/util-crypto": "^5.2.3",
|
||||
"@polkadot/x-fetch": "^5.2.3",
|
||||
"@polkadot/x-ws": "^5.2.3",
|
||||
"@polkadot/types": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"@polkadot/util-crypto": "^5.5.1",
|
||||
"@polkadot/x-fetch": "^5.5.1",
|
||||
"@polkadot/x-global": "^5.5.1",
|
||||
"@polkadot/x-ws": "^5.5.1",
|
||||
"bn.js": "^4.11.9",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.2.3",
|
||||
"@polkadot/metadata": "3.4.1",
|
||||
"@polkadot/keyring": "^5.5.1",
|
||||
"@polkadot/metadata": "3.7.2",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^13.0.5"
|
||||
"nock": "^13.0.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, Pro
|
||||
import EventEmitter from 'eventemitter3';
|
||||
|
||||
import { assert, isChildClass, isNull, isUndefined, logger } from '@polkadot/util';
|
||||
import { xglobal } from '@polkadot/x-global';
|
||||
import { WebSocket } from '@polkadot/x-ws';
|
||||
|
||||
import { RpcCoder } from '../coder';
|
||||
@@ -160,7 +161,7 @@ export class WsProvider implements ProviderInterface {
|
||||
public async connect (): Promise<void> {
|
||||
try {
|
||||
this.#endpointIndex = (this.#endpointIndex + 1) % this.#endpoints.length;
|
||||
this.#websocket = typeof global.WebSocket !== 'undefined' && isChildClass(global.WebSocket, WebSocket)
|
||||
this.#websocket = typeof xglobal.WebSocket !== 'undefined' && isChildClass(xglobal.WebSocket, WebSocket)
|
||||
? new WebSocket(this.#endpoints[this.#endpointIndex])
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/typegen",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Type generation scripts",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": false,
|
||||
"bin": {
|
||||
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.js",
|
||||
@@ -23,17 +22,17 @@
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/register": "^7.12.10",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/api": "3.4.1",
|
||||
"@polkadot/metadata": "3.4.1",
|
||||
"@polkadot/rpc-provider": "3.4.1",
|
||||
"@polkadot/types": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/api": "3.7.2",
|
||||
"@polkadot/metadata": "3.7.2",
|
||||
"@polkadot/rpc-provider": "3.7.2",
|
||||
"@polkadot/types": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"handlebars": "^4.7.6",
|
||||
"websocket": "^1.0.33",
|
||||
"yargs": "^16.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/websocket": "^1.0.1",
|
||||
"@types/yargs": "^15.0.12"
|
||||
"@types/yargs": "^15.0.13"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ function generate (metaHex: string, pkg: string | undefined, output: string, isS
|
||||
: {};
|
||||
|
||||
generateDefaultConsts(path.join(process.cwd(), output, 'augment-api-consts.ts'), metaHex, extraTypes, isStrict);
|
||||
generateDefaultErrors(path.join(process.cwd(), output, 'augment-api-errors.ts'), metaHex, isStrict);
|
||||
generateDefaultErrors(path.join(process.cwd(), output, 'augment-api-errors.ts'), metaHex, extraTypes, isStrict);
|
||||
generateDefaultEvents(path.join(process.cwd(), output, 'augment-api-events.ts'), metaHex, extraTypes, isStrict);
|
||||
generateDefaultQuery(path.join(process.cwd(), output, 'augment-api-query.ts'), metaHex, extraTypes, isStrict);
|
||||
generateDefaultRpc(path.join(process.cwd(), output, 'augment-api-rpc.ts'), extraTypes);
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import staticData from '@polkadot/metadata/static';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, formatType, readTemplate, registerDefinitions, setImports, writeFile } from '../util';
|
||||
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
|
||||
|
||||
const template = readTemplate('consts');
|
||||
const generateForMetaTemplate = Handlebars.compile(template);
|
||||
|
||||
/** @internal */
|
||||
function generateForMeta (meta: Metadata, dest: string, extraTypes: Record<string, Record<string, { types: Record<string, any> }>>, isStrict: boolean): void {
|
||||
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes: Record<string, Record<string, { types: Record<string, unknown> }>> = { '@polkadot/types/interfaces': defaultDefs, ...extraTypes };
|
||||
const allTypes = { '@polkadot/types/interfaces': defaultDefs, ...extraTypes };
|
||||
const imports = createImports(allTypes);
|
||||
const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => {
|
||||
return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs);
|
||||
@@ -74,14 +74,8 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: Record<strin
|
||||
|
||||
// Call `generateForMeta()` with current static metadata
|
||||
/** @internal */
|
||||
export function generateDefaultConsts (dest = 'packages/api/src/augment/consts.ts', data = staticData, extraTypes: Record<string, Record<string, { types: Record<string, any> }>> = {}, isStrict = false): void {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registerDefinitions(registry, extraTypes);
|
||||
|
||||
const metadata = new Metadata(registry, data);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
export function generateDefaultConsts (dest = 'packages/api/src/augment/consts.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void {
|
||||
const { metadata } = initMeta(data, extraTypes);
|
||||
|
||||
return generateForMeta(metadata, dest, extraTypes, isStrict);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import staticData from '@polkadot/metadata/static';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, readTemplate, writeFile } from '../util';
|
||||
import { compareName, createImports, initMeta, readTemplate, writeFile } from '../util';
|
||||
|
||||
const template = readTemplate('errors');
|
||||
const generateForMetaTemplate = Handlebars.compile(template);
|
||||
@@ -50,11 +50,8 @@ function generateForMeta (meta: Metadata, dest: string, isStrict: boolean): void
|
||||
|
||||
// Call `generateForMeta()` with current static metadata
|
||||
/** @internal */
|
||||
export function generateDefaultErrors (dest = 'packages/api/src/augment/errors.ts', data = staticData, isStrict = false): void {
|
||||
const registry = new TypeRegistry();
|
||||
const metadata = new Metadata(registry, data);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
export function generateDefaultErrors (dest = 'packages/api/src/augment/errors.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void {
|
||||
const { metadata } = initMeta(data, extraTypes);
|
||||
|
||||
return generateForMeta(metadata, dest, isStrict);
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import staticData from '@polkadot/metadata/static';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, formatType, readTemplate, registerDefinitions, setImports, writeFile } from '../util';
|
||||
import { compareName, createImports, formatType, initMeta, readTemplate, setImports, writeFile } from '../util';
|
||||
|
||||
const template = readTemplate('events');
|
||||
const generateForMetaTemplate = Handlebars.compile(template);
|
||||
|
||||
/** @internal */
|
||||
function generateForMeta (meta: Metadata, dest: string, extraTypes: Record<string, Record<string, { types: Record<string, any> }>>, isStrict: boolean): void {
|
||||
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes: Record<string, Record<string, { types: Record<string, unknown> }>> = { '@polkadot/types/interfaces': defaultDefs, ...extraTypes };
|
||||
const allTypes = { '@polkadot/types/interfaces': defaultDefs, ...extraTypes };
|
||||
const imports = createImports(allTypes);
|
||||
const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => {
|
||||
return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs);
|
||||
@@ -67,14 +67,8 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: Record<strin
|
||||
|
||||
// Call `generateForMeta()` with current static metadata
|
||||
/** @internal */
|
||||
export function generateDefaultEvents (dest = 'packages/api/src/augment/events.ts', data = staticData, extraTypes: Record<string, Record<string, { types: Record<string, any> }>> = {}, isStrict = false): void {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registerDefinitions(registry, extraTypes);
|
||||
|
||||
const metadata = new Metadata(registry, data);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
export function generateDefaultEvents (dest = 'packages/api/src/augment/events.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void {
|
||||
const { metadata } = initMeta(data, extraTypes);
|
||||
|
||||
return generateForMeta(metadata, dest, extraTypes, isStrict);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
|
||||
return generateInterfaceTypesTemplate({
|
||||
headerType: 'defs',
|
||||
imports,
|
||||
items,
|
||||
items: items.sort((a, b) => a.localeCompare(b)),
|
||||
types
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import type { StorageEntryMetadataLatest } from '@polkadot/types/interfaces/metadata';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import staticData from '@polkadot/metadata/static';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
|
||||
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, formatType, getSimilarTypes, readTemplate, registerDefinitions, setImports, TypeImports, writeFile } from '../util';
|
||||
import { compareName, createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, TypeImports, writeFile } from '../util';
|
||||
import { ModuleTypes } from '../util/imports';
|
||||
|
||||
// From a storage entry metadata, we return [args, returnType]
|
||||
@@ -67,9 +66,9 @@ const template = readTemplate('query');
|
||||
const generateForMetaTemplate = Handlebars.compile(template);
|
||||
|
||||
/** @internal */
|
||||
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: Record<string, Record<string, { types: Record<string, any> }>>, isStrict: boolean): void {
|
||||
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes: Record<string, Record<string, { types: Record<string, any> }>> = { '@polkadot/types/interfaces': defaultDefs, ...extraTypes };
|
||||
const allTypes: ExtraTypes = { '@polkadot/types/interfaces': defaultDefs, ...extraTypes };
|
||||
const imports = createImports(allTypes);
|
||||
const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => {
|
||||
return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs);
|
||||
@@ -130,14 +129,8 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
|
||||
// Call `generateForMeta()` with current static metadata
|
||||
/** @internal */
|
||||
export function generateDefaultQuery (dest = 'packages/api/src/augment/query.ts', data = staticData, extraTypes: Record<string, Record<string, { types: Record<string, any> }>> = {}, isStrict = false): void {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registerDefinitions(registry, extraTypes);
|
||||
|
||||
const metadata = new Metadata(registry, data);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
export function generateDefaultQuery (dest = 'packages/api/src/augment/query.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void {
|
||||
const { metadata, registry } = initMeta(data, extraTypes);
|
||||
|
||||
return generateForMeta(registry, metadata, dest, extraTypes, isStrict);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { TypeRegistry } from '@polkadot/types/create';
|
||||
import type { Definitions } from '@polkadot/types/types';
|
||||
import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
|
||||
|
||||
import { createImports, formatType, getSimilarTypes, readTemplate, registerDefinitions, setImports, writeFile } from '../util';
|
||||
import { createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, writeFile } from '../util';
|
||||
|
||||
interface ItemDef {
|
||||
args: string;
|
||||
@@ -29,9 +30,9 @@ const template = readTemplate('rpc');
|
||||
const generateRpcTypesTemplate = Handlebars.compile(template);
|
||||
|
||||
/** @internal */
|
||||
export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Record<string, Definitions>, dest: string, extraTypes: Record<string, Record<string, { types: Record<string, any> }>> = {}): void {
|
||||
export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Record<string, Definitions>, dest: string, extraTypes: ExtraTypes = {}): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes: Record<string, Record<string, { types: Record<string, any> }>> = { '@polkadot/types/interfaces': importDefinitions, ...extraTypes };
|
||||
const allTypes: ExtraTypes = { '@polkadot/types/interfaces': importDefinitions, ...extraTypes };
|
||||
const imports = createImports(allTypes);
|
||||
const definitions = imports.definitions as Record<string, Definitions>;
|
||||
const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => {
|
||||
@@ -141,10 +142,8 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
|
||||
});
|
||||
}
|
||||
|
||||
export function generateDefaultRpc (dest = 'packages/api/src/augment/rpc.ts', extraTypes: Record<string, Record<string, { types: Record<string, any> }>> = {}): void {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registerDefinitions(registry, extraTypes);
|
||||
export function generateDefaultRpc (dest = 'packages/api/src/augment/rpc.ts', extraTypes: ExtraTypes = {}): void {
|
||||
const { registry } = initMeta(undefined, extraTypes);
|
||||
|
||||
generateRpcTypes(
|
||||
registry,
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { ExtraTypes } from './types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import staticData from '@polkadot/metadata/static';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import * as defaultDefs from '@polkadot/types/interfaces/definitions';
|
||||
import { Text } from '@polkadot/types/primitive';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { compareName, createImports, formatType, getSimilarTypes, readTemplate, registerDefinitions, setImports, writeFile } from '../util';
|
||||
import { compareName, createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, writeFile } from '../util';
|
||||
|
||||
const MAPPED_NAMES: Record<string, string> = {
|
||||
new: 'updated'
|
||||
@@ -28,9 +27,9 @@ const template = readTemplate('tx');
|
||||
const generateForMetaTemplate = Handlebars.compile(template);
|
||||
|
||||
/** @internal */
|
||||
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: Record<string, Record<string, { types: Record<string, any> }>>, isStrict: boolean): void {
|
||||
function generateForMeta (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean): void {
|
||||
writeFile(dest, (): string => {
|
||||
const allTypes: Record<string, Record<string, { types: Record<string, any> }>> = { '@polkadot/types/interfaces': defaultDefs, ...extraTypes };
|
||||
const allTypes: ExtraTypes = { '@polkadot/types/interfaces': defaultDefs, ...extraTypes };
|
||||
const imports = createImports(allTypes);
|
||||
const allDefs = Object.entries(allTypes).reduce((defs, [path, obj]) => {
|
||||
return Object.entries(obj).reduce((defs, [key, value]) => ({ ...defs, [`${path}/${key}`]: value }), defs);
|
||||
@@ -93,14 +92,8 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
|
||||
// Call `generateForMeta()` with current static metadata
|
||||
/** @internal */
|
||||
export function generateDefaultTx (dest = 'packages/api/src/augment/tx.ts', data = staticData, extraTypes: Record<string, Record<string, { types: Record<string, any> }>> = {}, isStrict = false): void {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registerDefinitions(registry, extraTypes);
|
||||
|
||||
const metadata = new Metadata(registry, data);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
export function generateDefaultTx (dest = 'packages/api/src/augment/tx.ts', data?: string, extraTypes: ExtraTypes = {}, isStrict = false): void {
|
||||
const { metadata, registry } = initMeta(data, extraTypes);
|
||||
|
||||
return generateForMeta(registry, metadata, dest, extraTypes, isStrict);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export type ExtraTypes = Record<string, Record<string, { types: Record<string, any> }>>;
|
||||
@@ -275,6 +275,7 @@ function addEvents (metadata: MetadataLatest): string {
|
||||
const args = func.args.map((type): string => '`' + type.toString() + '`').join(', ');
|
||||
|
||||
return {
|
||||
interface: '`' + `api.events.${stringCamelCase(meta.name)}.${methodName}.is` + '`',
|
||||
name: `${methodName}(${args})`,
|
||||
...(func.documentation.length && { summary: func.documentation })
|
||||
};
|
||||
@@ -296,6 +297,7 @@ function addErrors (metadata: MetadataLatest): string {
|
||||
items: moduleMetadata.errors
|
||||
.sort(sortByName)
|
||||
.map((error) => ({
|
||||
interface: '`' + `api.errors.${stringCamelCase(moduleMetadata.name)}.${error.name.toString()}.is` + '`',
|
||||
name: error.name.toString(),
|
||||
...(error.documentation.length && { summary: error.documentation })
|
||||
})),
|
||||
|
||||
@@ -6,6 +6,7 @@ export * from './docs';
|
||||
export * from './file';
|
||||
export * from './formatting';
|
||||
export * from './imports';
|
||||
export * from './initMeta';
|
||||
export * from './register';
|
||||
|
||||
export const compareName = (a: { name: { toString(): string } }, b: { name: { toString(): string } }): number =>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ExtraTypes } from '../generate/types';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata/Metadata';
|
||||
import staticData from '@polkadot/metadata/static';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
|
||||
import { registerDefinitions } from './register';
|
||||
|
||||
interface Result {
|
||||
metadata: Metadata;
|
||||
registry: TypeRegistry;
|
||||
}
|
||||
|
||||
export function initMeta (data = staticData, extraTypes: ExtraTypes = {}): Result {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registerDefinitions(registry, extraTypes);
|
||||
|
||||
const metadata = new Metadata(registry, data);
|
||||
|
||||
registry.setMetadata(metadata);
|
||||
|
||||
return { metadata, registry };
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/types-known",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": false,
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
@@ -14,8 +13,8 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/types": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/types": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -36,15 +36,24 @@ const typesModules: Record<string, OverrideModuleType> = {
|
||||
identity: {
|
||||
Judgement: 'IdentityJudgement'
|
||||
},
|
||||
inclusion: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
parachains: {
|
||||
Id: 'ParaId'
|
||||
},
|
||||
parasScheduler: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
proposeParachain: {
|
||||
Proposal: 'ParachainProposal'
|
||||
},
|
||||
proxy: {
|
||||
Announcement: 'ProxyAnnouncement'
|
||||
},
|
||||
scheduler: {
|
||||
ValidatorIndex: 'ParaValidatorIndex'
|
||||
},
|
||||
society: {
|
||||
Judgement: 'SocietyJudgement',
|
||||
Vote: 'SocietyVote'
|
||||
|
||||
@@ -6,19 +6,30 @@
|
||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
Keys: 'SessionKeys6',
|
||||
LookupSource: 'MultiAddress',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement']
|
||||
},
|
||||
ValidatorPrefs: 'ValidatorPrefsWithBlocked'
|
||||
};
|
||||
|
||||
const addrIndicesTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'LookupSource',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'IndicesLookupSource',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement']
|
||||
}
|
||||
};
|
||||
|
||||
const indicesTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'LookupSource',
|
||||
LookupSource: 'IndicesLookupSource'
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
@@ -26,7 +37,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
// 1020 is first CC3
|
||||
minmax: [1019, 1031],
|
||||
types: {
|
||||
...indicesTypes,
|
||||
...addrIndicesTypes,
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchError: 'DispatchErrorTo198',
|
||||
@@ -46,7 +57,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [1032, 1042],
|
||||
types: {
|
||||
...indicesTypes,
|
||||
...addrIndicesTypes,
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
@@ -66,7 +77,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
// actual at 1045 (1043-1044 is dev)
|
||||
minmax: [1043, 1045],
|
||||
types: {
|
||||
...indicesTypes,
|
||||
...addrIndicesTypes,
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
@@ -86,6 +97,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
types: {
|
||||
// Indices optional, not in transaction
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
@@ -101,6 +113,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1055, 1056],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
Multiplier: 'Fixed64',
|
||||
@@ -115,6 +128,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1057, 1061],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
DispatchInfo: 'DispatchInfoTo244',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -126,6 +140,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1062, 2012],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -136,6 +151,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [2013, 2022],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259',
|
||||
RewardDestination: 'RewardDestinationTo257'
|
||||
@@ -145,11 +161,19 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [2023, 2024],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
RefCount: 'RefCountTo259'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [2025, undefined],
|
||||
minmax: [2025, 2027],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [2028, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, undefined],
|
||||
types: {
|
||||
Address: 'AccountId',
|
||||
LookupSource: 'AccountId'
|
||||
Address: 'MultiAddress',
|
||||
LookupSource: 'MultiAddress'
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
// these are override types for Polkadot
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
{
|
||||
minmax: [0, 259],
|
||||
minmax: [0, 260],
|
||||
types: {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'LookupSource',
|
||||
@@ -16,9 +16,9 @@ const versioned: OverrideVersionedType[] = [
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [260, undefined],
|
||||
minmax: [261, undefined],
|
||||
types: {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
LookupSource: 'MultiAddress'
|
||||
}
|
||||
|
||||
@@ -6,14 +6,23 @@
|
||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
Keys: 'SessionKeys6',
|
||||
LookupSource: 'MultiAddress',
|
||||
ProxyType: {
|
||||
// was: SudoBalances
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'Unused', 'IdentityJudgement']
|
||||
},
|
||||
ValidatorPrefs: 'ValidatorPrefsWithBlocked'
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
ProxyType: {
|
||||
// was: SudoBalances
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'Unused', 'IdentityJudgement']
|
||||
}
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
// these are override types for Polkadot
|
||||
@@ -22,6 +31,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [0, 12],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -32,6 +42,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [13, 22],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259',
|
||||
RewardDestination: 'RewardDestinationTo257'
|
||||
@@ -41,11 +52,19 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [23, 24],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
RefCount: 'RefCountTo259'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [25, undefined],
|
||||
minmax: [25, 27],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [28, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
|
||||
@@ -9,10 +9,11 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
const sharedTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId'
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
FullIdentification: '()', // No staking, only session (as per config)
|
||||
LookupSource: 'MultiAddress',
|
||||
Keys: 'SessionKeys6'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
@@ -20,13 +21,36 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [0, 9],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
LookupSource: 'AccountId',
|
||||
RefCount: 'RefCountTo259',
|
||||
RewardDestination: 'RewardDestinationTo257'
|
||||
RewardDestination: 'RewardDestinationTo257',
|
||||
Keys: 'SessionKeys5'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [10, undefined],
|
||||
minmax: [10, 12],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [13, 201],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
LookupSource: 'AccountId'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [202, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
|
||||
@@ -6,14 +6,23 @@
|
||||
import type { OverrideVersionedType } from '@polkadot/types/types';
|
||||
|
||||
const sharedTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId',
|
||||
AccountInfo: 'AccountInfoWithProviders',
|
||||
Address: 'MultiAddress',
|
||||
Keys: 'SessionKeys6',
|
||||
LookupSource: 'MultiAddress',
|
||||
ProxyType: {
|
||||
// was: SudoBalances
|
||||
_enum: ['Any', 'NonTransfer', 'Staking', 'Unused', 'IdentityJudgement']
|
||||
}
|
||||
},
|
||||
ValidatorPrefs: 'ValidatorPrefsWithBlocked'
|
||||
};
|
||||
|
||||
const addrAccountIdTypes = {
|
||||
AccountInfo: 'AccountInfoWithRefCount',
|
||||
Address: 'AccountId',
|
||||
LookupSource: 'AccountId',
|
||||
Keys: 'SessionKeys5',
|
||||
ValidatorPrefs: 'ValidatorPrefsWithCommission'
|
||||
};
|
||||
|
||||
const versioned: OverrideVersionedType[] = [
|
||||
@@ -21,6 +30,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [1, 2],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
Multiplier: 'Fixed64',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
@@ -33,6 +43,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [3, 22],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
OpenTip: 'OpenTipTo225',
|
||||
RefCount: 'RefCountTo259',
|
||||
@@ -43,6 +54,7 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [23, 42],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
CompactAssignments: 'CompactAssignmentsTo257',
|
||||
RefCount: 'RefCountTo259',
|
||||
RewardDestination: 'RewardDestinationTo257'
|
||||
@@ -52,11 +64,19 @@ const versioned: OverrideVersionedType[] = [
|
||||
minmax: [43, 44],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes,
|
||||
RefCount: 'RefCountTo259'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [45, undefined],
|
||||
minmax: [45, 47],
|
||||
types: {
|
||||
...sharedTypes,
|
||||
...addrAccountIdTypes
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [48, undefined],
|
||||
types: {
|
||||
...sharedTypes
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ const upgrades: ChainUpgradesRaw = {
|
||||
[1472960, 1052], [1475648, 1053], [1491596, 1054], [1574408, 1055], [2064961, 1058],
|
||||
[2201991, 1062], [2671528, 2005], [2704202, 2007], [2728002, 2008], [2832534, 2011],
|
||||
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
|
||||
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026]
|
||||
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027]
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const upgrades: ChainUpgradesRaw = {
|
||||
[879238, 25], [889472, 26], [902937, 27], [932751, 28], [991142, 29],
|
||||
[1030162, 31], [1119657, 32], [1199282, 33], [1342534, 34], [1392263, 35],
|
||||
[1431703, 36], [1433369, 37], [1490972, 41], [2087397, 43], [2316688, 44],
|
||||
[2549864, 45]
|
||||
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48]
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@polkadot/types",
|
||||
"version": "3.4.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Implementation of the Parity codec",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.mjs"
|
||||
@@ -17,14 +16,14 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/metadata": "3.4.1",
|
||||
"@polkadot/util": "^5.2.3",
|
||||
"@polkadot/util-crypto": "^5.2.3",
|
||||
"@polkadot/x-rxjs": "3.4.1",
|
||||
"@polkadot/metadata": "3.7.2",
|
||||
"@polkadot/util": "^5.5.1",
|
||||
"@polkadot/util-crypto": "^5.5.1",
|
||||
"@polkadot/x-rxjs": "^5.5.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.11.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^5.2.3"
|
||||
"@polkadot/keyring": "^5.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
+2245
-2153
File diff suppressed because it is too large
Load Diff
@@ -159,4 +159,11 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
public includes (check: unknown): boolean {
|
||||
return this.some((value: T) => value.eq(check));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns a slice of an array
|
||||
*/
|
||||
public slice (start?: number, end?: number): T[] {
|
||||
return this.toArray().slice(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
/**
|
||||
* @description Returns a BigInt representation of the number
|
||||
*/
|
||||
public toBigInt (): BigInt {
|
||||
public toBigInt (): bigint {
|
||||
return BigInt(this.toString());
|
||||
}
|
||||
|
||||
@@ -179,7 +179,9 @@ export abstract class AbstractInt extends BN implements Codec {
|
||||
if (rawType === 'Balance') {
|
||||
return this.isMax()
|
||||
? 'everything'
|
||||
: formatBalance(this, { decimals: this.registry.chainDecimals, withSi: true, withUnit: this.registry.chainToken });
|
||||
// FIXME In the case of multiples we need some way of detecting which instance this belongs
|
||||
// to. as it stands we will always format (incorrectly) against the first token defined
|
||||
: formatBalance(this, { decimals: this.registry.chainDecimals[0], withSi: true, withUnit: this.registry.chainTokens[0] });
|
||||
}
|
||||
|
||||
const [, divisor] = FORMATTERS.find(([type]) => type === rawType) || [];
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { H256 } from '../interfaces/runtime';
|
||||
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||
|
||||
import { compactFromU8a, compactToU8a, hexToU8a, isHex, isU8a, logger, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { compactFromU8a, compactToU8a, isHex, isU8a, logger, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { compareSet, decodeU8a, typeToConstructor } from './utils';
|
||||
|
||||
@@ -67,9 +67,7 @@ function decodeSet<V extends Codec = Codec> (registry: Registry, valType: Constr
|
||||
|
||||
const ValClass = typeToConstructor(registry, valType);
|
||||
|
||||
if (isHex(value)) {
|
||||
return decodeSet(registry, ValClass, hexToU8a(value));
|
||||
} else if (isU8a(value)) {
|
||||
if (isHex(value) || isU8a(value)) {
|
||||
return decodeSetFromU8a<V>(registry, ValClass, u8aToU8a(value));
|
||||
} else if (Array.isArray(value) || value instanceof Set) {
|
||||
return decodeSetFromSet<V>(registry, ValClass, value);
|
||||
|
||||
@@ -73,7 +73,9 @@ describe('Compact', (): void => {
|
||||
});
|
||||
|
||||
it('has a valid toBigInt interface', (): void => {
|
||||
expect(new (Compact.with('u128'))(registry, 12345678987654321n).toBigInt() === 12345678987654321n).toBe(true);
|
||||
expect(
|
||||
(new (Compact.with('u128'))(registry, 12345678987654321n).toBigInt() + 1n) === 12345678987654322n
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ export class Compact<T extends CompactEncodable> implements ICompact<T> {
|
||||
/**
|
||||
* @description Returns a BigInt representation of the number
|
||||
*/
|
||||
public toBigInt (): BigInt {
|
||||
public toBigInt (): bigint {
|
||||
return BigInt(this.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,12 @@ describe('Date', (): void => {
|
||||
new CodecDate(registry, 3).toHex(true)
|
||||
).toEqual('0x0300000000000000');
|
||||
});
|
||||
|
||||
it('encodes correctly to BigInt', (): void => {
|
||||
expect(
|
||||
new CodecDate(registry, 41).toBigInt() + 1n
|
||||
).toEqual(42n);
|
||||
});
|
||||
});
|
||||
|
||||
describe('utils', (): void => {
|
||||
|
||||
@@ -83,7 +83,7 @@ export class CodecDate extends Date implements Codec {
|
||||
/**
|
||||
* @description Returns a BigInt representation of the number
|
||||
*/
|
||||
public toBigInt (): BigInt {
|
||||
public toBigInt (): bigint {
|
||||
return BigInt(this.toNumber());
|
||||
}
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ describe('Enum', (): void => {
|
||||
expect(test.toHex()).toEqual(
|
||||
'0x' +
|
||||
'00' + // index
|
||||
'ff' + // Address indicating an embedded AccountId
|
||||
'00' + // MultiAddress indicating an embedded AccountId
|
||||
'0001020304050607080910111213141516171819202122232425262728293031' // AccountId
|
||||
);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { H256 } from '../interfaces/runtime';
|
||||
import type { AnyJson, Codec, Registry } from '../types';
|
||||
|
||||
import { isUndefined } from '@polkadot/util';
|
||||
import { isFunction, isUndefined } from '@polkadot/util';
|
||||
|
||||
import { compareMap } from './utils';
|
||||
|
||||
@@ -79,7 +79,13 @@ export class Json extends Map<string, any> implements Codec {
|
||||
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
||||
*/
|
||||
public toHuman (): Record<string, AnyJson> {
|
||||
return this.toJSON();
|
||||
return [...this.entries()].reduce((json: Record<string, AnyJson>, [key, value]): Record<string, AnyJson> => {
|
||||
json[key] = isFunction((value as Codec).toHuman)
|
||||
? (value as Codec).toHuman()
|
||||
: value as AnyJson;
|
||||
|
||||
return json;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { H256 } from '../interfaces/runtime';
|
||||
import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||
|
||||
import { compactFromU8a, compactToU8a, hexToU8a, isHex, isObject, isU8a, logger, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { compactFromU8a, compactToU8a, isHex, isObject, isU8a, logger, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { compareMap, decodeU8a, typeToConstructor } from './utils';
|
||||
|
||||
@@ -74,9 +74,7 @@ function decodeMap<K extends Codec = Codec, V extends Codec = Codec> (registry:
|
||||
|
||||
if (!value) {
|
||||
return new Map<K, V>();
|
||||
} else if (isHex(value)) {
|
||||
return decodeMap(registry, KeyClass, ValClass, hexToU8a(value));
|
||||
} else if (isU8a(value)) {
|
||||
} else if (isU8a(value) || isHex(value)) {
|
||||
return decodeMapFromU8a<K, V>(registry, KeyClass, ValClass, u8aToU8a(value));
|
||||
} else if (value instanceof Map) {
|
||||
return decodeMapFromMap<K, V>(registry, KeyClass, ValClass, value);
|
||||
|
||||
@@ -4,16 +4,7 @@
|
||||
import type { H256 } from '../interfaces/runtime';
|
||||
import type { AnyJson, AnyU8a, IU8a, Registry } from '../types';
|
||||
|
||||
import { assert, isAscii, isU8a, isUndefined, isUtf8, u8aToHex, u8aToString, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
/** @internal */
|
||||
function decodeU8a (value?: any): Uint8Array {
|
||||
if (isU8a(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return u8aToU8a(value);
|
||||
}
|
||||
import { assert, isAscii, isUndefined, isUtf8, u8aToHex, u8aToString, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
/**
|
||||
* @name Raw
|
||||
@@ -28,7 +19,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
public readonly registry: Registry;
|
||||
|
||||
constructor (registry: Registry, value?: AnyU8a) {
|
||||
super(decodeU8a(value));
|
||||
super(u8aToU8a(value));
|
||||
|
||||
this.registry = registry;
|
||||
}
|
||||
@@ -92,7 +83,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
!this.some((value, index) => value !== other[index]);
|
||||
}
|
||||
|
||||
return this.eq(decodeU8a(other));
|
||||
return this.eq(u8aToU8a(other as any));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { AnyNumber, AnyString, AnyU8a, Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||
|
||||
import { hexToU8a, isHex, isU8a, u8aConcat } from '@polkadot/util';
|
||||
import { isHex, isU8a, u8aConcat, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { AbstractArray } from './AbstractArray';
|
||||
import { decodeU8a, mapToTypeMap, typeToConstructor } from './utils';
|
||||
@@ -20,10 +20,8 @@ type TupleTypes = (Constructor | keyof InterfaceTypes)[] | {
|
||||
|
||||
/** @internal */
|
||||
function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: AnyTuple): Codec[] {
|
||||
if (isU8a(value)) {
|
||||
return decodeU8a(registry, value, _Types);
|
||||
} else if (isHex(value)) {
|
||||
return decodeTuple(registry, _Types, hexToU8a(value));
|
||||
if (isU8a(value) || isHex(value)) {
|
||||
return decodeU8a(registry, u8aToU8a(value), _Types);
|
||||
}
|
||||
|
||||
const Types: Constructor[] = Array.isArray(_Types)
|
||||
|
||||
@@ -45,6 +45,12 @@ describe('UInt', (): void => {
|
||||
).toEqual(4567);
|
||||
});
|
||||
|
||||
it('has a working toBigInt', (): void => {
|
||||
expect(
|
||||
new UInt(registry, 4567).toBigInt() + BigInt(1)
|
||||
).toEqual(BigInt(4568));
|
||||
});
|
||||
|
||||
it('converts to Little Endian from the provided value', (): void => {
|
||||
expect(
|
||||
new UInt(registry, 1234567).toU8a()
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { Codec, CodecTo } from '../types';
|
||||
|
||||
import { Metadata } from '@polkadot/metadata';
|
||||
import rpcMetadata from '@polkadot/metadata/static';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { createTypeUnsafe, TypeRegistry } from '../create';
|
||||
import { GenericAccountId as AccountId } from '../generic';
|
||||
@@ -170,5 +171,14 @@ describe('Vec', (): void => {
|
||||
|
||||
expect(vec.indexOf(myId)).toEqual(2);
|
||||
});
|
||||
|
||||
it('allows a slice operator', (): void => {
|
||||
const vec = registry.createType('Vec<AccountId>', [
|
||||
randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a(), randomAsU8a()
|
||||
]);
|
||||
|
||||
expect(vec).toHaveLength(10);
|
||||
expect(vec.slice(2, 7)).toHaveLength(5);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
import type { Codec, Constructor, Registry } from '../../types';
|
||||
|
||||
import { arrayFlatten } from '@polkadot/util';
|
||||
|
||||
/**
|
||||
* Given an u8a, and an array of Type constructors, decode the u8a against the
|
||||
* types, and return an array of decoded values.
|
||||
@@ -16,13 +14,15 @@ export function decodeU8a (registry: Registry, u8a: Uint8Array, _types: Construc
|
||||
const types = Array.isArray(_types)
|
||||
? _types
|
||||
: Object.values(_types);
|
||||
const result: Codec[] = [];
|
||||
let offset = 0;
|
||||
|
||||
if (!types.length) {
|
||||
return [];
|
||||
for (let i = 0; i < types.length; i++) {
|
||||
const value = new types[i](registry, u8a.subarray(offset));
|
||||
|
||||
result.push(value);
|
||||
offset += value.encodedLength;
|
||||
}
|
||||
|
||||
const Type = types[0];
|
||||
const value = new Type(registry, u8a);
|
||||
|
||||
return arrayFlatten([[value], decodeU8a(registry, u8a.subarray(value.encodedLength), types.slice(1))]);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -104,10 +104,9 @@ function extractProperties (registry: Registry, metadata: Metadata): ChainProper
|
||||
return original;
|
||||
}
|
||||
|
||||
return registry.createType('ChainProperties', {
|
||||
...(original || {}),
|
||||
ss58Format
|
||||
});
|
||||
const { tokenDecimals, tokenSymbol } = original || {};
|
||||
|
||||
return registry.createType('ChainProperties', { ss58Format, tokenDecimals, tokenSymbol });
|
||||
}
|
||||
|
||||
export class TypeRegistry implements Registry {
|
||||
@@ -160,10 +159,16 @@ export class TypeRegistry implements Registry {
|
||||
return this;
|
||||
}
|
||||
|
||||
public get chainDecimals (): number {
|
||||
return this.#chainProperties?.tokenDecimals.isSome
|
||||
? this.#chainProperties.tokenDecimals.unwrap().toNumber()
|
||||
: 12;
|
||||
public get chainDecimals (): number[] {
|
||||
if (this.#chainProperties?.tokenDecimals.isSome) {
|
||||
const allDecimals = this.#chainProperties.tokenDecimals.unwrap();
|
||||
|
||||
if (allDecimals.length) {
|
||||
return allDecimals.map((b) => b.toNumber());
|
||||
}
|
||||
}
|
||||
|
||||
return [12];
|
||||
}
|
||||
|
||||
public get chainSS58 (): number | undefined {
|
||||
@@ -172,10 +177,16 @@ export class TypeRegistry implements Registry {
|
||||
: undefined;
|
||||
}
|
||||
|
||||
public get chainToken (): string {
|
||||
return this.#chainProperties?.tokenSymbol.isSome
|
||||
? this.#chainProperties.tokenSymbol.unwrap().toString()
|
||||
: formatBalance.getDefaults().unit;
|
||||
public get chainTokens (): string[] {
|
||||
if (this.#chainProperties?.tokenSymbol.isSome) {
|
||||
const allTokens = this.#chainProperties.tokenSymbol.unwrap();
|
||||
|
||||
if (allTokens.length) {
|
||||
return allTokens.map((s) => s.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return [formatBalance.getDefaults().unit];
|
||||
}
|
||||
|
||||
public get knownTypes (): RegisteredTypes {
|
||||
@@ -268,8 +279,12 @@ export class TypeRegistry implements Registry {
|
||||
: undefined;
|
||||
}
|
||||
|
||||
public getDefinition (name: string): string | undefined {
|
||||
return this.#definitions.get(name);
|
||||
public getDefinition (typeName: string): string | undefined {
|
||||
return this.#definitions.get(typeName);
|
||||
}
|
||||
|
||||
public getModuleInstances (specName: string, moduleName: string): string[] | undefined {
|
||||
return this.#knownTypes?.typesBundle?.spec?.[specName]?.instances?.[moduleName];
|
||||
}
|
||||
|
||||
public getOrThrow <T extends Codec = Codec> (name: string, msg?: string): Constructor<T> {
|
||||
@@ -316,6 +331,7 @@ export class TypeRegistry implements Registry {
|
||||
this.#classes.set(arg1.name, arg1);
|
||||
} else if (isString(arg1)) {
|
||||
assert(isFunction(arg2), `Expected class definition passed to '${arg1}' registration`);
|
||||
assert(arg1 !== arg2.toString(), `Unable to register circular ${arg1} === ${arg1}`);
|
||||
|
||||
this.#classes.set(arg1, arg2);
|
||||
} else {
|
||||
@@ -333,6 +349,8 @@ export class TypeRegistry implements Registry {
|
||||
? type
|
||||
: JSON.stringify(type);
|
||||
|
||||
assert(name !== def, `Unable to register circular ${name} === ${def}`);
|
||||
|
||||
// we already have this type, remove the classes registered for it
|
||||
if (this.#classes.has(name)) {
|
||||
this.#classes.delete(name);
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('Extrinsic', (): void => {
|
||||
'0x' +
|
||||
'5d02' + // length
|
||||
'84' + // V4, signing bit set
|
||||
'ff' + // lookup, AccountId of sender follows
|
||||
'00' + // MultiAddress, AccountId of sender follows
|
||||
'fcc4910cb536b4333db4bccb40e2cf6427b4766518e754b91e70c97e4a87dbb3' + // sender
|
||||
'00' + // multisig, type ed25519
|
||||
'd99ffe3e610ad234e1414bda5831395a6df9098bf80b01561ce89a5065ae89d5' + // sig first 32
|
||||
@@ -29,7 +29,7 @@ describe('Extrinsic', (): void => {
|
||||
'1101' + // nonce, compact 68
|
||||
'0700ac23fc06' + // tip, 0.03 KSM
|
||||
'0600' + // balances.transfer (on Kusama this was 0400, changed here to match metadata)
|
||||
'ff' + // lookup, AccountId of recipient follows
|
||||
'00' + // MultiAddress, AccountId of recipient follows
|
||||
'495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718' + // recipient
|
||||
'0bc01eb1fc185f' // value, 104.560 KSM
|
||||
);
|
||||
@@ -38,7 +38,7 @@ describe('Extrinsic', (): void => {
|
||||
expect(extrinsic.nonce.toNumber()).toEqual(68);
|
||||
expect(extrinsic.tip.toHuman()).toEqual('30.0000 mUnit');
|
||||
expect(extrinsic.callIndex).toEqual(new Uint8Array([6, 0]));
|
||||
expect(extrinsic.args[0].toHex()).toEqual('0xff495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718');
|
||||
expect(extrinsic.args[0].toHex()).toEqual('0x00495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718');
|
||||
expect(extrinsic.args[1].toHuman()).toEqual('104.5609 Unit');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('SignerPayload', (): void => {
|
||||
blockNumber: '0x00231d30',
|
||||
era: '0x0703',
|
||||
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
||||
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
|
||||
method: '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
|
||||
nonce: '0x00001234',
|
||||
signedExtensions: ['CheckNonce', 'CheckWeight'],
|
||||
specVersion: '0x00000006',
|
||||
@@ -36,7 +36,7 @@ describe('SignerPayload', (): void => {
|
||||
blockNumber: '0x231d30',
|
||||
era: registry.createType('ExtrinsicEra', { current: 2301232, period: 200 }),
|
||||
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
||||
method: registry.createType('Call', '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
|
||||
method: registry.createType('Call', '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
|
||||
nonce: 0x1234,
|
||||
signedExtensions: ['CheckNonce'],
|
||||
tip: 0x5678,
|
||||
@@ -48,7 +48,7 @@ describe('SignerPayload', (): void => {
|
||||
blockNumber: '0x00231d30',
|
||||
era: '0x0703',
|
||||
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
|
||||
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
|
||||
method: '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
|
||||
nonce: '0x00001234',
|
||||
signedExtensions: ['CheckNonce'],
|
||||
specVersion: '0x00000000',
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('ExtrinsicSignatureV4', (): void => {
|
||||
|
||||
const u8a = new Uint8Array([
|
||||
// signer as an AccountIndex
|
||||
0x09,
|
||||
0x01, 0x08, // 4 << 2
|
||||
// signature type
|
||||
0x01,
|
||||
// signature
|
||||
@@ -65,7 +65,7 @@ describe('ExtrinsicSignatureV4', (): void => {
|
||||
).toHex()
|
||||
).toEqual(
|
||||
'0x' +
|
||||
'ff' +
|
||||
'00' + // MultiAddress
|
||||
'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' +
|
||||
'01' +
|
||||
'4242424242424242424242424242424242424242424242424242424242424242' +
|
||||
@@ -93,7 +93,7 @@ describe('ExtrinsicSignatureV4', (): void => {
|
||||
).toEqual(
|
||||
'0x' +
|
||||
// Address = AccountId
|
||||
// 'ff' +
|
||||
// '00' +
|
||||
'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' +
|
||||
// This is a prefix-less signature, anySignture as opposed to Multi above
|
||||
// '01' +
|
||||
|
||||
@@ -19,12 +19,16 @@ describe('Call', (): void => {
|
||||
args: [],
|
||||
callIndex: [6, 1] // balances.setBalance
|
||||
}).toU8a()
|
||||
).toEqual(new Uint8Array([6, 1, 0, 0, 0]));
|
||||
).toEqual(
|
||||
new Uint8Array([6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
|
||||
);
|
||||
});
|
||||
|
||||
it('handles creation from a hex value properly', (): void => {
|
||||
expect(
|
||||
new Call(registry, '0x0601').toU8a()
|
||||
).toEqual(new Uint8Array([6, 1, 0, 0, 0])); // balances.setBalance
|
||||
).toEqual(
|
||||
new Uint8Array([6, 1, 1, 110, 7, 17, 0, 0, 0])
|
||||
); // balances.setBalance
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
|
||||
describe('ChainProperties', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
it('decodes from a null value (setting defaults)', (): void => {
|
||||
expect(
|
||||
[...registry.createType('ChainProperties', null).keys()]
|
||||
).toEqual(['ss58Format', 'tokenDecimals', 'tokenSymbol']);
|
||||
});
|
||||
|
||||
it('decodes from an actual JSON', (): void => {
|
||||
const { ss58Format, tokenDecimals, tokenSymbol } = registry.createType('ChainProperties', JSON.parse('{"ss58Format":2,"tokenDecimals":12,"tokenSymbol":"KSM"}'));
|
||||
|
||||
expect(ss58Format.unwrap().eq(2)).toBe(true);
|
||||
expect(tokenDecimals.unwrap().eq([12])).toBe(true);
|
||||
expect(tokenSymbol.unwrap().eq(['KSM'])).toBe(true);
|
||||
});
|
||||
|
||||
it('decodes from an actual object (multiple tokens)', (): void => {
|
||||
const { ss58Format, tokenDecimals, tokenSymbol } = registry.createType('ChainProperties', {
|
||||
ss58Format: undefined,
|
||||
tokenDecimals: [10, 12],
|
||||
tokenSymbol: ['pDOT', 'pKSM']
|
||||
});
|
||||
|
||||
expect(ss58Format.isNone).toBe(true);
|
||||
expect(tokenDecimals.unwrap().eq([10, 12])).toBe(true);
|
||||
expect(tokenSymbol.unwrap().eq(['pDOT', 'pKSM'])).toBe(true);
|
||||
});
|
||||
|
||||
it('decodes from an object, flagged for non-existent ss58Format', (): void => {
|
||||
const { ss58Format, tokenDecimals, tokenSymbol } = registry.createType('ChainProperties', { tokenSymbol: 'DEV' });
|
||||
|
||||
expect(ss58Format.isNone).toBe(true);
|
||||
expect(tokenDecimals.isNone).toBe(true);
|
||||
expect(tokenSymbol.isSome).toBe(true);
|
||||
});
|
||||
|
||||
it('decodes from a ChainProperties object', (): void => {
|
||||
const original = registry.createType('ChainProperties', {
|
||||
ss58Format: 2,
|
||||
tokenDecimals: 15,
|
||||
tokenSymbol: 'KSM'
|
||||
});
|
||||
const { ss58Format, tokenDecimals, tokenSymbol } = registry.createType('ChainProperties', original);
|
||||
|
||||
expect(ss58Format.unwrap().eq(2)).toBe(true);
|
||||
expect(tokenDecimals.unwrap().eq([15])).toBe(true);
|
||||
expect(tokenSymbol.unwrap().eq(['KSM'])).toBe(true);
|
||||
});
|
||||
|
||||
it('has a sane toHuman', (): void => {
|
||||
expect(
|
||||
registry.createType('ChainProperties', {
|
||||
ss58Format: 42,
|
||||
tokenDecimals: registry.createType('u32', 9),
|
||||
tokenSymbol: ['Unit', 'Aux1']
|
||||
}).toHuman()
|
||||
).toEqual({
|
||||
ss58Format: '42',
|
||||
tokenDecimals: ['9'],
|
||||
tokenSymbol: ['Unit', 'Aux1']
|
||||
});
|
||||
});
|
||||
|
||||
it('has a sane toHuman', (): void => {
|
||||
expect(
|
||||
registry.createType('ChainProperties', {
|
||||
ss58Format: 2,
|
||||
tokenDecimals: [registry.createType('u32', 12), 8],
|
||||
tokenSymbol: ['KSM', 'BTC']
|
||||
}).toHuman()
|
||||
).toEqual({
|
||||
ss58Format: '2',
|
||||
tokenDecimals: ['12', '8'],
|
||||
tokenSymbol: ['KSM', 'BTC']
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Codec, Registry } from '../types';
|
||||
|
||||
import { isFunction, isNull, isUndefined } from '@polkadot/util';
|
||||
|
||||
import { Json } from '../codec/Json';
|
||||
import { Option } from '../codec/Option';
|
||||
import { Vec } from '../codec/Vec';
|
||||
import { Text } from '../primitive/Text';
|
||||
import { u32 } from '../primitive/U32';
|
||||
|
||||
function createValue (registry: Registry, type: string, value: unknown, asArray = true): Option<Codec> {
|
||||
// We detect codec here as well - when found, generally this is constructed from itself
|
||||
if (value && isFunction((value as Option<Codec>).unwrapOrDefault)) {
|
||||
return value as Option<Codec>;
|
||||
}
|
||||
|
||||
return registry.createType(
|
||||
type as 'Option<u32>',
|
||||
asArray
|
||||
? isNull(value) || isUndefined(value)
|
||||
? null
|
||||
: Array.isArray(value)
|
||||
? value
|
||||
: [value]
|
||||
: value
|
||||
);
|
||||
}
|
||||
|
||||
function decodeValue (registry: Registry, key: string, value: unknown): unknown {
|
||||
return key === 'ss58Format'
|
||||
? createValue(registry, 'Option<u32>', value, false)
|
||||
: key === 'tokenDecimals'
|
||||
? createValue(registry, 'Option<Vec<u32>>' as 'Vec<u32>', value)
|
||||
: key === 'tokenSymbol'
|
||||
? createValue(registry, 'Option<Vec<Text>>' as 'Vec<Text>', value)
|
||||
: value;
|
||||
}
|
||||
|
||||
function decode (registry: Registry, value?: Map<string, unknown> | Record<string, unknown> | null): Record<string, unknown> {
|
||||
return (
|
||||
// allow decoding from a map as well (ourselves)
|
||||
value && isFunction((value as Map<string, unknown>).entries)
|
||||
? [...(value as Map<string, unknown>).entries()]
|
||||
: Object.entries(value || {})
|
||||
).reduce((all: Record<string, unknown>, [key, value]) => {
|
||||
all[key] = decodeValue(registry, key, value);
|
||||
|
||||
return all;
|
||||
}, {
|
||||
ss58Format: registry.createType('Option<u32>'),
|
||||
tokenDecimals: registry.createType('Option<Vec<u32>>' as 'Vec<u32>'),
|
||||
tokenSymbol: registry.createType('Option<Vec<Text>>' as 'Vec<Text>')
|
||||
});
|
||||
}
|
||||
|
||||
export class GenericChainProperties extends Json {
|
||||
constructor (registry: Registry, value?: Map<string, unknown> | Record<string, unknown> | null) {
|
||||
super(registry, decode(registry, value));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The chain ss58Format
|
||||
*/
|
||||
public get ss58Format (): Option<u32> {
|
||||
return this.get('ss58Format') as Option<u32>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The decimals for each of the tokens
|
||||
*/
|
||||
public get tokenDecimals (): Option<Vec<u32>> {
|
||||
return this.get('tokenDecimals') as Option<Vec<u32>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The symbols for the tokens
|
||||
*/
|
||||
public get tokenSymbol (): Option<Vec<Text>> {
|
||||
return this.get('tokenSymbol') as Option<Vec<Text>>;
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,10 @@ export class GenericConsensusEngineId extends u32 {
|
||||
return this.registry.createType('AccountId', bytes);
|
||||
}
|
||||
|
||||
private _getH160Author (bytes: Bytes): AccountId {
|
||||
return this.registry.createType('AccountId', bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description From the input bytes, decode into an author
|
||||
*/
|
||||
@@ -104,6 +108,11 @@ export class GenericConsensusEngineId extends u32 {
|
||||
return this._getPowAuthor(bytes);
|
||||
}
|
||||
|
||||
// Moonbeam is neither Aura nor Babe nor Pow and uses h160 addresses
|
||||
if (bytes.length === 20) {
|
||||
return this._getH160Author(bytes);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('LookupSource', (): void => {
|
||||
|
||||
const testDecode = (type: string, input: LookupSource | AccountId | AccountIndex | number[] | Uint8Array, expected: string): void =>
|
||||
it(`can decode from ${type}`, (): void => {
|
||||
const a = registry.createType('Address', input);
|
||||
const a = registry.createType('IndicesLookupSource', input);
|
||||
|
||||
expect(a.toString()).toBe(expected);
|
||||
});
|
||||
@@ -18,19 +18,19 @@ describe('LookupSource', (): void => {
|
||||
it('equals on AccountId', (): void => {
|
||||
const addr = '5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo';
|
||||
|
||||
expect(registry.createType('LookupSource', addr).eq(addr)).toBe(true);
|
||||
expect(registry.createType('IndicesLookupSource', addr).eq(addr)).toBe(true);
|
||||
});
|
||||
|
||||
it('equals on AccountIndex', (): void => {
|
||||
// see the test below - these are equivalent (with different prefix encoding)
|
||||
expect(registry.createType('LookupSource', '2jpAFn').eq('25GUyv')).toBe(true);
|
||||
expect(registry.createType('IndicesLookupSource', '2jpAFn').eq('25GUyv')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('decoding', (): void => {
|
||||
testDecode(
|
||||
'Address',
|
||||
registry.createType('LookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'),
|
||||
registry.createType('IndicesLookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'),
|
||||
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
|
||||
);
|
||||
testDecode(
|
||||
@@ -40,7 +40,7 @@ describe('LookupSource', (): void => {
|
||||
);
|
||||
testDecode(
|
||||
'AccountIndex (mixed prefixes)',
|
||||
registry.createType('LookupSource', '2jpAFn'),
|
||||
registry.createType('IndicesLookupSource', '2jpAFn'),
|
||||
// NOTE Expected adress here is encoded with prefix 42, input above with 68
|
||||
'25GUyv'
|
||||
);
|
||||
@@ -95,7 +95,7 @@ describe('LookupSource', (): void => {
|
||||
describe('encoding', (): void => {
|
||||
const testEncode = (to: 'toHex' | 'toString' | 'toU8a', expected: string | Uint8Array): void =>
|
||||
it(`can encode ${to}`, (): void => {
|
||||
const a = registry.createType('Address', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
const a = registry.createType('IndicesLookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
|
||||
|
||||
expect(a[to]()).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ export { GenericAccountId } from './AccountId';
|
||||
export { GenericAccountIndex } from './AccountIndex';
|
||||
export { GenericBlock } from './Block';
|
||||
export { GenericCall } from './Call';
|
||||
export { GenericChainProperties } from './ChainProperties';
|
||||
export { GenericConsensusEngineId } from './ConsensusEngineId';
|
||||
export { GenericEvent, GenericEventData } from './Event';
|
||||
export { GenericLookupSource } from './LookupSource';
|
||||
|
||||
@@ -26,6 +26,12 @@ export default {
|
||||
zombies: 'u32',
|
||||
accounts: 'u32'
|
||||
},
|
||||
AssetMetadata: {
|
||||
deposit: 'TAssetDepositBalance',
|
||||
name: 'Vec<u8>',
|
||||
symbol: 'Vec<u8>',
|
||||
decimals: 'u8'
|
||||
},
|
||||
TAssetBalance: 'u64',
|
||||
TAssetDepositBalance: 'BalanceOf'
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Struct, bool, u32, u64 } from '@polkadot/types';
|
||||
import type { Bytes, Struct, bool, u32, u64, u8 } from '@polkadot/types';
|
||||
import type { AccountId, BalanceOf } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name AssetBalance */
|
||||
@@ -25,6 +25,14 @@ export interface AssetDetails extends Struct {
|
||||
readonly accounts: u32;
|
||||
}
|
||||
|
||||
/** @name AssetMetadata */
|
||||
export interface AssetMetadata extends Struct {
|
||||
readonly deposit: TAssetDepositBalance;
|
||||
readonly name: Bytes;
|
||||
readonly symbol: Bytes;
|
||||
readonly decimals: u8;
|
||||
}
|
||||
|
||||
/** @name TAssetBalance */
|
||||
export interface TAssetBalance extends u64 {}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// order important in structs... :)
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { Definitions } from '../../types';
|
||||
|
||||
export default {
|
||||
rpc: {},
|
||||
types: {
|
||||
FundIndex: 'u32',
|
||||
LastContribution: {
|
||||
_enum: {
|
||||
Never: 'Null',
|
||||
PreEnding: 'AuctionIndex',
|
||||
Ending: 'BlockNumber'
|
||||
}
|
||||
},
|
||||
DeployData: {
|
||||
codeHash: 'Hash',
|
||||
codeSize: 'u32',
|
||||
initialHeadData: 'HeadData'
|
||||
},
|
||||
FundInfo: {
|
||||
parachain: 'Option<ParaId>',
|
||||
owner: 'AccountId',
|
||||
deposit: 'Balance',
|
||||
raised: 'Balance',
|
||||
end: 'BlockNumber',
|
||||
cap: 'Balance',
|
||||
lastContribution: 'LastContribution',
|
||||
firstSlot: 'BlockNumber',
|
||||
lastSlot: 'BlockNumber',
|
||||
deployData: 'Option<DeployData>'
|
||||
}
|
||||
}
|
||||
} as Definitions;
|
||||
@@ -0,0 +1,4 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
export * from './types';
|
||||
@@ -0,0 +1,41 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Enum, Option, Struct, u32 } from '@polkadot/types';
|
||||
import type { AuctionIndex, HeadData, ParaId } from '@polkadot/types/interfaces/parachains';
|
||||
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name DeployData */
|
||||
export interface DeployData extends Struct {
|
||||
readonly codeHash: Hash;
|
||||
readonly codeSize: u32;
|
||||
readonly initialHeadData: HeadData;
|
||||
}
|
||||
|
||||
/** @name FundIndex */
|
||||
export interface FundIndex extends u32 {}
|
||||
|
||||
/** @name FundInfo */
|
||||
export interface FundInfo extends Struct {
|
||||
readonly parachain: Option<ParaId>;
|
||||
readonly owner: AccountId;
|
||||
readonly deposit: Balance;
|
||||
readonly raised: Balance;
|
||||
readonly end: BlockNumber;
|
||||
readonly cap: Balance;
|
||||
readonly lastContribution: LastContribution;
|
||||
readonly firstSlot: BlockNumber;
|
||||
readonly lastSlot: BlockNumber;
|
||||
readonly deployData: Option<DeployData>;
|
||||
}
|
||||
|
||||
/** @name LastContribution */
|
||||
export interface LastContribution extends Enum {
|
||||
readonly isNever: boolean;
|
||||
readonly isPreEnding: boolean;
|
||||
readonly asPreEnding: AuctionIndex;
|
||||
readonly isEnding: boolean;
|
||||
readonly asEnding: BlockNumber;
|
||||
}
|
||||
|
||||
export type PHANTOM_CROWDLOAN = 'crowdloan';
|
||||
@@ -22,6 +22,7 @@ export { default as genericAsset } from './genericAsset/definitions';
|
||||
export { default as grandpa } from './grandpa/definitions';
|
||||
export { default as identity } from './identity/definitions';
|
||||
export { default as imOnline } from './imOnline/definitions';
|
||||
export { default as lottery } from './lottery/definitions';
|
||||
export { default as offences } from './offences/definitions';
|
||||
export { default as proxy } from './proxy/definitions';
|
||||
export { default as recovery } from './recovery/definitions';
|
||||
@@ -40,6 +41,7 @@ export { default as vesting } from './vesting/definitions';
|
||||
// polkadot-specific types
|
||||
export { default as attestations } from './attestations/definitions';
|
||||
export { default as claims } from './claims/definitions';
|
||||
export { default as crowdloan } from './crowdloan/definitions';
|
||||
export { default as parachains } from './parachains/definitions';
|
||||
export { default as poll } from './poll/definitions';
|
||||
export { default as purchase } from './purchase/definitions';
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// order important in structs... :)
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import type { Definitions } from '../../types';
|
||||
|
||||
export default {
|
||||
rpc: {},
|
||||
types: {
|
||||
CallIndex: '(u8, u8)',
|
||||
LotteryConfig: {
|
||||
price: 'Balance',
|
||||
start: 'BlockNumber',
|
||||
length: 'BlockNumber',
|
||||
delay: 'BlockNumber',
|
||||
repeat: 'bool'
|
||||
}
|
||||
}
|
||||
} as Definitions;
|
||||
@@ -0,0 +1,4 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
export * from './types';
|
||||
@@ -0,0 +1,20 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Struct, bool, u8 } from '@polkadot/types';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { Balance, BlockNumber } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name CallIndex */
|
||||
export interface CallIndex extends ITuple<[u8, u8]> {}
|
||||
|
||||
/** @name LotteryConfig */
|
||||
export interface LotteryConfig extends Struct {
|
||||
readonly price: Balance;
|
||||
readonly start: BlockNumber;
|
||||
readonly length: BlockNumber;
|
||||
readonly delay: BlockNumber;
|
||||
readonly repeat: bool;
|
||||
}
|
||||
|
||||
export type PHANTOM_LOTTERY = 'lottery';
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
|
||||
const KILT = '0x8d01d51627af4cb8414b6ad454e7204424e7e8489738c5fabe20cee3256bd69b7534d12b2798b04e574d05fb8a4b163745b1e610fb75de59399271bd57e49738506a7a93ee0038dd6a1b3bfbb58f747a7b2052058620839a8e2d03f5a43b48ca6000c66a00299600004412f5d19eed1a0cbafadd3b050b6e87fbcdff0a4b2ab0dce498d2180f7d7fe40000000000000000000000000000000000000000000000000000000000000000000000200318f49e207f03cfdce586301014700e2c25930041585f078d434d6125b40443fe11fd292d13a410000008004c5f0ec2d17a76153ff51817f12d9cfc3c7f0400c106807ff6802ca40549562ffe6b52b99b82732a11693a9f94e719eb6091a28361553b7e1d6f8071c05107fa3ba69c860039b5eaf97de7405f1b96f158678ce0581618e4cb00ed8020617372d0786928a794bc2168d93a97c9934583395972b4d4ab49c99242035380947dbbbf1d13550ebd1c60bdad2e6e4905e72acf2135a3ecf9539b14ac336a1e8048b33fdf9c46b272d66e2467dba4fa4709dd3e560183d5ef462c8bdf09aa14e58083a5a2c804e9dbc8839a7d520a726c0518a82ff872d1ec2932c1142866c945648090bbb5b7644e54d533f3630580cb8074409ddcc510eab64ecc32216c912ac87a8071959a3ccb6903f9fb571c5eb87649e1a4d7fc095b7a9d88fd6941dadf0d251280ba7052563c97b91cccc3a3762e0a8d73a0fd2018bd63932fdf6e6dfb8e998705807970bd80ad702930fe83ab570956c242563c1ea2560e5bed94456168ded1ec2e801c3452fb59635b2a0def7e3a91cd071d57beb4d92294484ee948728d72a8a2ed80974da04ec2f2a432413995b1c30d9903e6c69b63d25ea3564c3fd604513c045480365249e4644cac1c396b92b70c2d8daa355a87236ca6ff3fdcf0e0039351fa911501802100803d7774397092a7bd12ebb498311ea37c46eeeec8460cbf88e03f55bfa109817f80f2ce141c02c934f343545350b70e54c8c2a0bb12f886462797399672b145ff0cad019e0da05ca59913bc38a8630590f2627c014180412934e1ef5da416397acfe5b81b2c604c81fd696fabcb082451b88dd46feafc585f078d434d6125b40443fe11fd292d13a410000008008077b468c9a59a67ed7ae15442240aba9ae23e7b632fe6e5bdb97b2b40b4aa10a135037f0006de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385a50200005000008000000800000000200000000400000500000005000000580200002c010000000020030004000000286bee0000000004000000040000000500000000000000000000000000000000000000000000000000000000000000000000000800000000200000040000000400000000040000b004000000000000000000001400000004000000040000000000000000000000000a000000000000000000000000000000000000009901801804800fcf38b60d2719964e4c4cc392848e51c8ce99e85efc57368586ed54938b6bf180aebb1dfa081e0f528a33c48cc0d64717ff2e6de6f73e001bc0c608d24f5b79b7809ee0a05d790e73768b384a037678e8cdc4fcfcb90ca782824c5119294de00fdb0000';
|
||||
|
||||
describe('SystemInherentData', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registry.register({ BlockNumber: 'u64' });
|
||||
|
||||
it('can decode Kilt', (): void => {
|
||||
const value = registry.createType('SystemInherentData', KILT);
|
||||
|
||||
console.log(JSON.stringify(value.toHuman(), null, 2));
|
||||
|
||||
expect(value).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -6,15 +6,16 @@
|
||||
|
||||
import type { Definitions } from '../../types';
|
||||
|
||||
const SLOT_RANGE_COUNT = 10;
|
||||
import hrmpTypes from './hrmp';
|
||||
import slotTypes from './slots';
|
||||
|
||||
// proposeParachain
|
||||
const proposeTypes = {
|
||||
ParachainProposal: {
|
||||
proposer: 'AccountId',
|
||||
validationFunction: 'ValidationCode',
|
||||
initialHeadState: 'HeadData',
|
||||
genesisHead: 'HeadData',
|
||||
validators: 'Vec<ValidatorId>',
|
||||
name: 'Vec<u8>',
|
||||
name: 'Bytes',
|
||||
balance: 'Balance'
|
||||
},
|
||||
RegisteredParachainInfo: {
|
||||
@@ -27,6 +28,8 @@ export default {
|
||||
rpc: {},
|
||||
types: {
|
||||
...proposeTypes,
|
||||
...hrmpTypes,
|
||||
...slotTypes,
|
||||
AbridgedCandidateReceipt: {
|
||||
parachainIndex: 'ParaId',
|
||||
relayParent: 'Hash',
|
||||
@@ -36,6 +39,25 @@ export default {
|
||||
povBlockHash: 'Hash',
|
||||
commitments: 'CandidateCommitments'
|
||||
},
|
||||
AbridgedHostConfiguration: {
|
||||
maxCodeSize: 'u32',
|
||||
maxHeadDataSize: 'u32',
|
||||
maxUpwardQueueCount: 'u32',
|
||||
maxUpwardQueueSize: 'u32',
|
||||
maxUpwardMessageSize: 'u32',
|
||||
maxUpwardMessageNumPerCandidate: 'u32',
|
||||
hrmpMaxMessageNumPerCandidate: 'u32',
|
||||
validationUpgradeFrequency: 'BlockNumber',
|
||||
validationUpgradeDelay: 'BlockNumber'
|
||||
},
|
||||
AbridgedHrmpChannel: {
|
||||
maxCapacity: 'u32',
|
||||
maxTotalSize: 'u32',
|
||||
maxMessageSize: 'u32',
|
||||
msgCount: 'u32',
|
||||
totalSize: 'u32',
|
||||
mqcHead: 'Option<Hash>'
|
||||
},
|
||||
AssignmentId: 'AccountId',
|
||||
AssignmentKind: {
|
||||
_enum: {
|
||||
@@ -49,7 +71,6 @@ export default {
|
||||
validatorIndices: 'BitVec'
|
||||
},
|
||||
AuthorityDiscoveryId: 'AccountId',
|
||||
AuctionIndex: 'u32',
|
||||
AvailabilityBitfield: 'BitVec',
|
||||
AvailabilityBitfieldRecord: {
|
||||
bitfield: 'AvailabilityBitfield',
|
||||
@@ -60,12 +81,6 @@ export default {
|
||||
validityVotes: 'Vec<ValidityAttestation>',
|
||||
validatorIndices: 'BitVec'
|
||||
},
|
||||
Bidder: {
|
||||
_enum: {
|
||||
New: 'NewBidder',
|
||||
Existing: 'ParaId'
|
||||
}
|
||||
},
|
||||
BufferedSessionChange: {
|
||||
applyAt: 'BlockNumber',
|
||||
validators: 'Vec<ValidatorId>',
|
||||
@@ -83,11 +98,12 @@ export default {
|
||||
CandidateDescriptor: {
|
||||
paraId: 'ParaId',
|
||||
relayParent: 'Hash',
|
||||
collatorId: 'Hash',
|
||||
collatorId: 'CollatorId',
|
||||
persistedValidationDataHash: 'Hash',
|
||||
povHash: 'Hash',
|
||||
erasureRoot: 'Hash',
|
||||
signature: 'Signature'
|
||||
signature: 'CollatorSignature',
|
||||
paraHead: 'Hash'
|
||||
},
|
||||
CandidateHash: 'Hash',
|
||||
CandidatePendingAvailability: {
|
||||
@@ -103,7 +119,7 @@ export default {
|
||||
descriptor: 'CandidateDescriptor',
|
||||
commitmentsHash: 'Hash'
|
||||
},
|
||||
CollatorId: '[u8; 32]',
|
||||
CollatorId: 'H256',
|
||||
CollatorSignature: 'Signature',
|
||||
CommittedCandidateReceipt: {
|
||||
descriptor: 'CandidateDescriptor',
|
||||
@@ -138,12 +154,29 @@ export default {
|
||||
},
|
||||
HeadData: 'Bytes',
|
||||
HostConfiguration: {
|
||||
validationUpgradeFrequency: 'BlockNumber',
|
||||
validationUpgradeDelay: 'BlockNumber',
|
||||
acceptancePeriod: 'BlockNumber',
|
||||
maxCodeSize: 'u32',
|
||||
maxHeadDataSize: 'u32',
|
||||
maxUpwardQueueCount: 'u32',
|
||||
maxUpwardQueueSize: 'u32',
|
||||
maxUpwardMessageSize: 'u32',
|
||||
maxUpwardMessageNumPerCandidate: 'u32',
|
||||
hrmpMaxMessageNumPerCandidate: 'u32',
|
||||
validationUpgradeFrequency: 'BlockNumber',
|
||||
validationUpgradeDelay: 'BlockNumber',
|
||||
maxPovSize: 'u32',
|
||||
maxDownwardMessageSize: 'u32',
|
||||
preferredDispatchableUpwardMessagesStepWeight: 'Weight',
|
||||
hrmpMaxParachainOutboundChannels: 'u32',
|
||||
hrmpMaxParathreadOutboundChannels: 'u32',
|
||||
hrmpOpenRequestTtl: 'u32',
|
||||
hrmpSenderDeposit: 'Balance',
|
||||
hrmpRecipientDeposit: 'Balance',
|
||||
hrmpChannelMaxCapacity: 'u32',
|
||||
hrmpChannelMaxTotalSize: 'u32',
|
||||
hrmpMaxParachainInboundChannels: 'u32',
|
||||
hrmpMaxParathreadInboundChannels: 'u32',
|
||||
hrmpChannelMaxMessageSize: 'u32',
|
||||
acceptancePeriod: 'BlockNumber',
|
||||
parathreadCores: 'u32',
|
||||
parathreadRetries: 'u32',
|
||||
groupRotationFrequency: 'BlockNumber',
|
||||
@@ -156,46 +189,7 @@ export default {
|
||||
nDelayTranches: 'u32',
|
||||
zerothDelayTrancheWidth: 'u32',
|
||||
neededApprovals: 'u32',
|
||||
relayVrfModuloSamples: 'u32',
|
||||
maxUpwardQueueCount: 'u32',
|
||||
maxUpwardQueueSize: 'u32',
|
||||
maxDownwardMessageSize: 'u32',
|
||||
preferredDispatchableUpwardMessagesStepWeight: 'Weight',
|
||||
maxUpwardMessageSize: 'u32',
|
||||
maxUpwardMessageNumPerCandidate: 'u32',
|
||||
hrmpOpenRequestTtl: 'u32',
|
||||
hrmpSenderDeposit: 'Balance',
|
||||
hrmpRecipientDeposit: 'Balance',
|
||||
hrmpChannelMaxCapacity: 'u32',
|
||||
hrmpChannelMaxTotalSize: 'u32',
|
||||
hrmpMaxParachainInboundChannels: 'u32',
|
||||
hrmpMaxParathreadInboundChannels: 'u32',
|
||||
hrmpChannelMaxMessageSize: 'u32',
|
||||
hrmpMaxParachainOutboundChannels: 'u32',
|
||||
hrmpMaxParathreadOutboundChannels: 'u32',
|
||||
hrmpMaxMessageNumPerCandidate: 'u32'
|
||||
},
|
||||
HrmpChannel: {
|
||||
senderDeposit: 'Balance',
|
||||
recipientDeposit: 'Balance',
|
||||
maxCapacity: 'u32',
|
||||
maxTotalSize: 'u32',
|
||||
maxMessageSize: 'u32',
|
||||
msgCount: 'u32',
|
||||
totalSize: 'u32',
|
||||
mqcHead: 'Option<Hash>'
|
||||
},
|
||||
HrmpChannelId: {
|
||||
sender: 'u32',
|
||||
receiver: 'u32'
|
||||
},
|
||||
HrmpOpenChannelRequest: {
|
||||
confirmed: 'bool',
|
||||
age: 'SessionIndex',
|
||||
senderDeposit: 'Balance',
|
||||
maxMessageSize: 'u32',
|
||||
maxCapacity: 'u32',
|
||||
maxTotalSize: 'u32'
|
||||
relayVrfModuloSamples: 'u32'
|
||||
},
|
||||
InboundDownwardMessage: {
|
||||
pubSentAt: 'BlockNumber',
|
||||
@@ -206,24 +200,6 @@ export default {
|
||||
data: 'Bytes'
|
||||
},
|
||||
InboundHrmpMessages: 'Vec<InboundHrmpMessage>',
|
||||
IncomingParachain: {
|
||||
_enum: {
|
||||
Unset: 'NewBidder',
|
||||
Fixed: 'IncomingParachainFixed',
|
||||
Deploy: 'IncomingParachainDeploy'
|
||||
}
|
||||
},
|
||||
IncomingParachainFixed: {
|
||||
codeHash: 'Hash',
|
||||
codeSize: 'u32',
|
||||
initialHeadData: 'HeadData'
|
||||
},
|
||||
IncomingParachainDeploy: {
|
||||
code: 'ValidationCode',
|
||||
initialHeadData: 'HeadData'
|
||||
},
|
||||
LeasePeriod: 'BlockNumber',
|
||||
LeasePeriodOf: 'LeasePeriod',
|
||||
LocalValidationData: {
|
||||
parentHead: 'HeadData',
|
||||
balance: 'Balance',
|
||||
@@ -233,10 +209,6 @@ export default {
|
||||
downwardMessages: 'Vec<InboundDownwardMessage>',
|
||||
horizontalMessages: 'BTreeMap<ParaId, InboundHrmpMessages>'
|
||||
},
|
||||
NewBidder: {
|
||||
who: 'AccountId',
|
||||
sub: 'SubId'
|
||||
},
|
||||
OutboundHrmpMessage: {
|
||||
recipient: 'u32',
|
||||
data: 'Bytes'
|
||||
@@ -269,14 +241,16 @@ export default {
|
||||
claim: 'ParathreadClaim',
|
||||
retries: 'u32'
|
||||
},
|
||||
ParaValidatorIndex: 'u32',
|
||||
PersistedValidationData: {
|
||||
parentHead: 'HeadData',
|
||||
blockNumber: 'BlockNumber',
|
||||
blockNumber: 'RelayChainBlockNumber',
|
||||
relayStorageRoot: 'Hash',
|
||||
hrmpMqcHeads: 'Vec<(u32, Hash)>',
|
||||
dmqMqcHead: 'Hash',
|
||||
maxPovSize: 'u32'
|
||||
},
|
||||
RelayChainBlockNumber: 'BlockNumber',
|
||||
RelayChainBlockNumber: 'u32',
|
||||
QueuedParathread: {
|
||||
claim: 'ParathreadEntry',
|
||||
coreOffset: 'u32'
|
||||
@@ -295,7 +269,7 @@ export default {
|
||||
validators: 'Vec<ValidatorId>',
|
||||
discoveryKeys: 'Vec<AuthorityDiscoveryId>',
|
||||
assignmentKeys: 'Vec<AssignmentId>',
|
||||
validatorGroups: 'Vec<ValidatorGroup>',
|
||||
validatorGroups: 'Vec<SessionInfoValidatorGroup>',
|
||||
nCores: 'u32',
|
||||
zerothDelayTrancheWidth: 'u32',
|
||||
relayVrfModuloSamples: 'u32',
|
||||
@@ -303,19 +277,17 @@ export default {
|
||||
noShowSlots: 'u32',
|
||||
neededApprovals: 'u32'
|
||||
},
|
||||
SessionInfoValidatorGroup: 'Vec<ParaValidatorIndex>',
|
||||
SignedAvailabilityBitfield: {
|
||||
payload: 'BitVec',
|
||||
validatorIndex: 'u32',
|
||||
signature: 'Signature'
|
||||
validatorIndex: 'ParaValidatorIndex',
|
||||
signature: 'ValidatorSignature'
|
||||
},
|
||||
SignedAvailabilityBitfields: 'Vec<SignedAvailabilityBitfield>',
|
||||
SigningContext: {
|
||||
sessionIndex: 'SessionIndex',
|
||||
parentHash: 'Hash'
|
||||
},
|
||||
SlotRange: {
|
||||
_enum: ['ZeroZero', 'ZeroOne', 'ZeroTwo', 'ZeroThree', 'OneOne', 'OneTwo', 'OneThree', 'TwoTwo', 'TwoThree', 'ThreeThree']
|
||||
},
|
||||
Statement: {
|
||||
_enum: {
|
||||
Never: 'Null', // starts at 1
|
||||
@@ -324,7 +296,6 @@ export default {
|
||||
Invalid: 'Hash'
|
||||
}
|
||||
},
|
||||
SubId: 'u32',
|
||||
TransientValidationData: {
|
||||
maxCodeSize: 'u32',
|
||||
maxHeadDataSize: 'u32',
|
||||
@@ -343,7 +314,10 @@ export default {
|
||||
persisted: 'PersistedValidationData',
|
||||
transient: 'TransientValidationData'
|
||||
},
|
||||
ValidatorGroup: 'Vec<ValidatorIndex>',
|
||||
ValidationDataType: {
|
||||
validationData: 'ValidationData',
|
||||
relayChainState: 'Vec<Bytes>'
|
||||
},
|
||||
ValidatorSignature: 'Signature',
|
||||
ValidityAttestation: {
|
||||
_enum: {
|
||||
@@ -357,8 +331,6 @@ export default {
|
||||
V0: 'Xcm'
|
||||
}
|
||||
},
|
||||
WinningData: `[WinningDataEntry; ${SLOT_RANGE_COUNT}]`,
|
||||
WinningDataEntry: 'Option<Bidder>',
|
||||
WithdrawAsset: {
|
||||
assets: 'Vec<MultiAsset>',
|
||||
effects: 'Vec<Order>'
|
||||
@@ -547,6 +519,18 @@ export default {
|
||||
InitiateTeleport: 'InitiateTeleport',
|
||||
QueryHolding: 'QueryHolding'
|
||||
}
|
||||
}
|
||||
},
|
||||
MessagingStateSnapshot: {
|
||||
relayDispatchQueueSize: '(u32, u32)',
|
||||
egressChannels: 'Vec<MessagingStateSnapshotEgressEntry>'
|
||||
},
|
||||
MessagingStateSnapshotEgressEntry: '(ParaId, AbridgedHrmpChannel)',
|
||||
SystemInherentData: {
|
||||
validationData: 'PersistedValidationData',
|
||||
relayChainState: 'StorageProof',
|
||||
downwardMessages: 'Vec<InboundDownwardMessage>',
|
||||
horizontalMessages: 'BTreeMap<ParaId, VecInboundHrmpMessage>'
|
||||
},
|
||||
VecInboundHrmpMessage: 'Vec<InboundHrmpMessage>'
|
||||
}
|
||||
} as Definitions;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// order important in structs... :)
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
export default {
|
||||
HrmpChannel: {
|
||||
maxCapacity: 'u32',
|
||||
maxTotalSize: 'u32',
|
||||
maxMessageSize: 'u32',
|
||||
msgCount: 'u32',
|
||||
totalSize: 'u32',
|
||||
mqcHead: 'Option<Hash>',
|
||||
senderDeposit: 'Balance',
|
||||
recipientDeposit: 'Balance'
|
||||
},
|
||||
HrmpChannelId: {
|
||||
sender: 'u32',
|
||||
receiver: 'u32'
|
||||
},
|
||||
HrmpOpenChannelRequest: {
|
||||
confirmed: 'bool',
|
||||
age: 'SessionIndex',
|
||||
senderDeposit: 'Balance',
|
||||
maxMessageSize: 'u32',
|
||||
maxCapacity: 'u32',
|
||||
maxTotalSize: 'u32'
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user