Compare commits

...
39 Commits
Author SHA1 Message Date
Github Actions 5b9f1544a3 [CI Skip] release/stable 6.3.1
skip-checks: true
2021-10-09 13:42:12 +00:00
Jaco 9943bda41f 6.3.1 (#4041)
* 6.3.1

* Set version
2021-10-09 16:26:33 +03:00
Github Actions b99e7a3cdb [CI Skip] release/beta 6.2.2-12
skip-checks: true
2021-10-09 13:08:09 +00:00
Jaco 1e491579c1 Adjust wildcard path matches (#4040) 2021-10-09 15:49:01 +03:00
Github Actions ef83cfbdc1 [CI Skip] release/beta 6.2.2-11
skip-checks: true
2021-10-08 07:49:23 +00:00
Jaco d10407a44f Bump deps (#4037)
* Bump deps

* Bump

* revamp comments

* Only use un-aliased primitives

* Revert "Only use un-aliased primitives"

This reverts commit 93d7e28f3a73351899789acc0914b75b421d4c11.
2021-10-08 10:31:11 +03:00
Github Actions 068af8b2ab [CI Skip] release/beta 6.2.2-10
skip-checks: true
2021-10-08 05:37:11 +00:00
Jaco d9f4d3e08b Adjust xcm Fungibility (#4035)
* Adjust xcm Fungibility

* V1 & V2

* Align with master
2021-10-08 08:17:49 +03:00
Github Actions fa79f35ec2 [CI Skip] release/beta 6.2.2-9
skip-checks: true
2021-10-07 13:50:37 +00:00
Jaco 8c2c2afc37 Swap Xcm to defaults instead of V0, Polkadot runtime 9100+ (#4033)
* Swap Xcm to V1 (defaults), Polkadot runtime 9100+

* V1/V2 (latest is V1 at 9100)

* Various versions

* formatting

* V1 <= 9105, V2 >= 9106
2021-10-07 16:29:18 +03:00
Github Actions 5157d8c3f0 [CI Skip] release/beta 6.2.2-8
skip-checks: true
2021-10-07 10:05:48 +00:00
Jaco bb303361e2 queryMulti via api.at (#4031)
* queryMulti via api.at

* checkTypes

* Kusama & Polkadot added

* Revert "Kusama & Polkadot added"

This reverts commit f7f2c30290d455bad50bb0b8bb1965d65b4d2ae2.
2021-10-07 12:49:43 +03:00
Github Actions ad587b0673 [CI Skip] release/beta 6.2.2-7
skip-checks: true
2021-10-07 08:32:37 +00:00
Jaco ae5cf270f0 Bump static metadata (#4030)
* Bump static metadata

* Rebuild

* Polkadot & Kusama added
2021-10-07 11:12:08 +03:00
Github Actions 9fc33ac53a [CI Skip] release/beta 6.2.2-6
skip-checks: true
2021-10-06 11:28:59 +00:00
Jaco 60d4da934a Single getMetadata on parallel same-hash queries (#4026) 2021-10-06 14:12:13 +03:00
Github Actions 550d17d349 [CI Skip] release/beta 6.2.2-5
skip-checks: true
2021-10-06 10:07:11 +00:00
Jaco ce8a2b5e4f Dedupe findCall/findError (#4028) 2021-10-06 12:46:28 +03:00
Github Actions 4c4994e63c [CI Skip] release/beta 6.2.2-4
skip-checks: true
2021-10-06 08:54:45 +00:00
Jaco df9b6959d1 Expose findCall/findError on api.at (#4027)
* Expose findCall/findError on api.at

* Move findError/findCall
2021-10-06 11:36:18 +03:00
Github Actions 6a583ee594 [CI Skip] release/beta 6.2.2-3
skip-checks: true
2021-10-06 06:13:47 +00:00
Jaco affa6ab1bd Mark api.query.<section>.<method>.at as deprecated (#4023)
* Use api.at internally for sizeAt/entriesAt/keysAt

* Remove debug logs

* Mark api.query.<section>.<method>.at as deprecated

* formatting

* @deprecated formatting

* commenting
2021-10-06 08:53:50 +03:00
Github Actions 407aca37c1 [CI Skip] release/beta 6.2.2-2
skip-checks: true
2021-10-05 07:57:23 +00:00
Jaco 246dfaf943 Use api.at internally for sizeAt/entriesAt/keysAt (#4022)
* Use api.at internally for sizeAt/entriesAt/keysAt

* Remove debug logs
2021-10-05 10:35:23 +03:00
Github Actions a05fff302f [CI Skip] release/beta 6.2.2-1
skip-checks: true
2021-10-05 06:16:34 +00:00
Jaco d45a9cfe58 Rework derives to ensure cached registries (#4021) 2021-10-05 08:57:30 +03:00
Github Actions 32881d73a0 [CI Skip] release/beta 6.2.2-0
skip-checks: true
2021-10-04 12:58:03 +00:00
Jaco e568ffe23f Static substrate bump (#4018) 2021-10-04 15:35:56 +03:00
Github Actions 8475130a22 [CI Skip] release/stable 6.2.1
skip-checks: true
2021-10-04 08:33:37 +00:00
Jaco a7e824ff09 6.2.1 (#4016)
* 6.2.1

* CHANGELOG

* Bump static metadata

* CHANGELOG
2021-10-04 11:17:55 +03:00
Alexander Popiak 9d5fb2bf72 Add asset id in signing (#4009)
* add assetId to SignerOptions

* pull assetId into extrinsic signing

* set assetId to optional AnyNumber throughout

* add logging of extrinsic options

* add assetId to _injectSignature & add getters

* re-add import

* longer doc comments
2021-10-04 10:02:28 +03:00
Github Actions 2cf0e306dd [CI Skip] release/beta 6.1.3-3
skip-checks: true
2021-10-01 10:17:38 +00:00
Jaco 72d5330727 Use lookup types in derives (#4012)
* Use lookup types in derives

* additional

* society
2021-10-01 13:02:24 +03:00
Github Actions 1c3bdda08f [CI Skip] release/beta 6.1.3-2
skip-checks: true
2021-10-01 08:51:17 +00:00
Jaco 668ad3dfe5 Handle plain multi queries diguised as map-form (#4011) 2021-10-01 11:29:12 +03:00
Github Actions 651afaeb9a [CI Skip] release/beta 6.1.3-1
skip-checks: true
2021-09-30 06:54:52 +00:00
Jaco 5036aa9ef4 Better error messages for misformed queries (#4007)
* Better error messages for misformed queries

* Cater for raw function (no meta)
2021-09-30 09:39:13 +03:00
Github Actions 3598cc25f4 [CI Skip] release/beta 6.1.3-0
skip-checks: true
2021-09-29 12:28:47 +00:00
Jaco 987a2ec2df Adjust multi to infer return types (#4002)
* Adjust multi to infer return types

* some linting

* Additional

* Dedupe
2021-09-29 14:07:29 +02:00
110 changed files with 5918 additions and 5281 deletions
+36
View File
@@ -1,5 +1,41 @@
# CHANGELOG
## 6.3.1 Oct 9, 2021
Upgrade priority: Low. Recoemmended for Kusama & Polkadot runtime 9100+
Changes:
- Mark `api.query.*.*.at` as deprecated (use `api.at`)
- Expose `queryMulti`, `findError` and `findCall` on `api.at`
- Optimize parallel metadata retrieval/decoration
- Rework derive `.at` to ensure no additional metadata calls
- Adjust Xcm types for Kusama, Polkadot, Westend (V1 & V2 usage)
- Fix Xcm Fungibility type
- Add upgrade blocks for Westend
- Prepare for v14 metadata swap in Kusama/Polkadot (9110 runtime)
- Adjust metadata wilcard path matching (event extraction)
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 6.2.1 Oct 4, 2021
Upgrade priority: Low. Maintenance updates.
Contributed:
- Cater for new asset fee payment extension (Thanks to https://github.com/apopiak)
Changes:
- Extend error messages for malformed `queryMulti` inputs
- Correctly handle non-map queries passed to `queryMulti` in map form
- Use new metadata v14 lookup type in derive results
- Adjust definitions to infer TS types in `.multi` queries
- Fix TS lookup enum generation with nested Option & Tuple
- Bump static metadata for latest Substrate, Polkadot & Kusama
## 6.1.2 Sep 29, 2021
Upgrade priority: Low. Recommended for 6.x users using historic queries.
+3 -3
View File
@@ -26,15 +26,15 @@
"test:watch": "polkadot-dev-run-test --watch"
},
"devDependencies": {
"@babel/core": "^7.15.5",
"@babel/core": "^7.15.8",
"@babel/register": "^7.15.3",
"@babel/runtime": "^7.15.4",
"@polkadot/dev": "^0.62.68",
"@polkadot/dev": "^0.62.70",
"@polkadot/ts": "^0.4.8",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^27.0.2",
"copyfiles": "^2.4.1"
},
"version": "6.1.2",
"version": "6.3.1",
"packageManager": "yarn@3.0.1"
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
@@ -20,9 +20,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.15.4",
"@polkadot/api": "6.1.2",
"@polkadot/types": "6.1.2",
"@polkadot/api": "6.3.1",
"@polkadot/types": "6.3.1",
"@polkadot/util": "^7.4.1",
"rxjs": "^7.3.0"
"rxjs": "^7.4.0"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '6.1.2' };
export const packageInfo = { name: '@polkadot/api-contract', version: '6.3.1' };
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
@@ -20,15 +20,15 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.15.4",
"@polkadot/api": "6.1.2",
"@polkadot/rpc-core": "6.1.2",
"@polkadot/types": "6.1.2",
"@polkadot/api": "6.3.1",
"@polkadot/rpc-core": "6.3.1",
"@polkadot/types": "6.3.1",
"@polkadot/util": "^7.4.1",
"@polkadot/util-crypto": "^7.4.1",
"rxjs": "^7.3.0"
"rxjs": "^7.4.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.4.1",
"@polkadot/rpc-provider": "6.1.2"
"@polkadot/rpc-provider": "6.3.1"
}
}
+11 -8
View File
@@ -4,7 +4,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Data, Option } from '@polkadot/types';
import type { AccountId, IdentityInfoAdditional, Registration } from '@polkadot/types/interfaces';
import type { AccountId } from '@polkadot/types/interfaces';
import type { PalletIdentityIdentityInfo, PalletIdentityRegistration } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveAccountRegistration, DeriveHasIdentity } from '../types';
@@ -14,6 +15,8 @@ import { isHex, u8aToString } from '@polkadot/util';
import { memo } from '../util';
type IdentityInfoAdditional = PalletIdentityIdentityInfo['additional'][0];
const UNDEF_HEX = { toHex: () => undefined };
function dataAsString (data: Data): string | undefined {
@@ -37,7 +40,7 @@ function extractOther (additional: IdentityInfoAdditional[]): Record<string, str
}, {});
}
function extractIdentity (identityOfOpt?: Option<Registration>, superOf?: [AccountId, Data]): DeriveAccountRegistration {
function extractIdentity (identityOfOpt?: Option<PalletIdentityRegistration>, superOf?: [AccountId, Data]): DeriveAccountRegistration {
if (!identityOfOpt?.isSome) {
return { judgements: [] };
}
@@ -61,7 +64,7 @@ function extractIdentity (identityOfOpt?: Option<Registration>, superOf?: [Accou
};
}
function getParent (api: ApiInterfaceRx, identityOfOpt: Option<Registration> | undefined, superOfOpt: Option<ITuple<[AccountId, Data]>> | undefined): Observable<[Option<Registration> | undefined, [AccountId, Data] | undefined]> {
function getParent (api: ApiInterfaceRx, identityOfOpt: Option<PalletIdentityRegistration> | undefined, superOfOpt: Option<ITuple<[AccountId, Data]>> | undefined): Observable<[Option<PalletIdentityRegistration> | undefined, [AccountId, Data] | undefined]> {
if (identityOfOpt?.isSome) {
// this identity has something set
return of([identityOfOpt, undefined]);
@@ -70,7 +73,7 @@ function getParent (api: ApiInterfaceRx, identityOfOpt: Option<Registration> | u
// we have a super
return combineLatest([
api.query.identity.identityOf<Option<Registration>>(superOf[0]),
api.query.identity.identityOf(superOf[0]),
of(superOf)
]);
}
@@ -79,9 +82,9 @@ function getParent (api: ApiInterfaceRx, identityOfOpt: Option<Registration> | u
return of([undefined, undefined]);
}
function getBase (api: ApiInterfaceRx, accountId?: AccountId | Uint8Array | string): Observable<[Option<Registration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]> {
function getBase (api: ApiInterfaceRx, accountId?: AccountId | Uint8Array | string): Observable<[Option<PalletIdentityRegistration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]> {
return accountId && api.query.identity?.identityOf
? api.queryMulti<[Option<Registration>, Option<ITuple<[AccountId, Data]>>]>([
? api.queryMulti<[Option<PalletIdentityRegistration>, Option<ITuple<[AccountId, Data]>>]>([
[api.query.identity.identityOf, accountId],
[api.query.identity.superOf, accountId]
])
@@ -113,8 +116,8 @@ export function hasIdentityMulti (instanceId: string, api: ApiInterfaceRx): (acc
return memo(instanceId, (accountIds: (AccountId | Uint8Array | string)[]): Observable<DeriveHasIdentity[]> =>
api.query.identity?.identityOf
? combineLatest([
api.query.identity.identityOf.multi<Option<Registration>>(accountIds),
api.query.identity.superOf.multi<Option<ITuple<[AccountId, Data]>>>(accountIds)
api.query.identity.identityOf.multi(accountIds),
api.query.identity.superOf.multi(accountIds)
]).pipe(
map(([identities, supers]) =>
identities.map((identityOfOpt, index): DeriveHasIdentity => {
+16 -15
View File
@@ -4,7 +4,8 @@
import type { Observable } from 'rxjs';
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 { AccountId, AccountIndex, Address, Balance, BalanceLockTo212, BlockNumber, VestingSchedule } from '@polkadot/types/interfaces';
import type { PalletBalancesBalanceLock, PalletVestingVestingInfo } from '@polkadot/types/lookup';
import type { DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs';
@@ -13,15 +14,15 @@ import { BN, bnMax, isFunction } from '@polkadot/util';
import { memo } from '../util';
type BalanceLocksEntry = Vec<BalanceLock | BalanceLockTo212>;
type BalanceLocksEntry = Vec<PalletBalancesBalanceLock | BalanceLockTo212>;
type BalanceLocks = BalanceLocksEntry[];
type ResultBalance = [VestingInfo | null, ((BalanceLock | BalanceLockTo212)[])[]];
type ResultBalance = [PalletVestingVestingInfo | null, ((PalletBalancesBalanceLock | BalanceLockTo212)[])[]];
type Result = [DeriveBalancesAccount, BlockNumber, ResultBalance];
interface AllLocked {
allLocked: boolean,
lockedBalance: Balance,
lockedBreakdown: (BalanceLock | BalanceLockTo212)[],
lockedBreakdown: (PalletBalancesBalanceLock | BalanceLockTo212)[],
vestingLocked: Balance
}
@@ -33,9 +34,9 @@ type DeriveCustomLocks = ApiInterfaceRx['derive'] & {
const VESTING_ID = '0x76657374696e6720';
function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (BalanceLock | BalanceLockTo212)[]): AllLocked {
function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (PalletBalancesBalanceLock | BalanceLockTo212)[]): AllLocked {
let lockedBalance = api.registry.createType('Balance');
let lockedBreakdown: (BalanceLock | BalanceLockTo212)[] = [];
let lockedBreakdown: (PalletBalancesBalanceLock | BalanceLockTo212)[] = [];
let vestingLocked = api.registry.createType('Balance');
let allLocked = false;
@@ -56,7 +57,7 @@ function calcLocked (api: ApiInterfaceRx, bestNumber: BlockNumber, locks: (Balan
return { allLocked, lockedBalance, lockedBreakdown, vestingLocked };
}
function calcShared (api: ApiInterfaceRx, bestNumber: BlockNumber, data: DeriveBalancesAccountData, locks: (BalanceLock | BalanceLockTo212)[]): DeriveBalancesAllAccountData {
function calcShared (api: ApiInterfaceRx, bestNumber: BlockNumber, data: DeriveBalancesAccountData, locks: (PalletBalancesBalanceLock | BalanceLockTo212)[]): DeriveBalancesAllAccountData {
const { allLocked, lockedBalance, lockedBreakdown, vestingLocked } = calcLocked(api, bestNumber, locks);
return {
@@ -73,7 +74,7 @@ function calcBalances (api: ApiInterfaceRx, [data, bestNumber, [vesting, allLock
// Calculate the vesting balances,
// - offset = balance locked at startingBlock
// - perBlock is the unlock amount
const emptyVest = api.registry.createType('VestingInfo');
const emptyVest = api.registry.createType<PalletVestingVestingInfo>('VestingInfo');
const { locked: vestingTotal, perBlock, startingBlock } = vesting || emptyVest;
const isStarted = bestNumber.gt(startingBlock);
const vestedNow = isStarted ? perBlock.mul(bestNumber.sub(startingBlock)) : new BN(0);
@@ -96,7 +97,7 @@ function calcBalances (api: ApiInterfaceRx, [data, bestNumber, [vesting, allLock
// old
function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<ResultBalance> {
return api.queryMulti<[Vec<BalanceLock>, Option<VestingSchedule>]>([
return api.queryMulti<[Vec<PalletBalancesBalanceLock>, Option<VestingSchedule>]>([
[api.query.balances.locks, accountId],
[api.query.balances.vesting, accountId]
]).pipe(
@@ -106,7 +107,7 @@ function queryOld (api: ApiInterfaceRx, accountId: AccountId): Observable<Result
if (optVesting.isSome) {
const { offset: locked, perBlock, startingBlock } = optVesting.unwrap();
vestingNew = api.registry.createType('VestingInfo', { locked, perBlock, startingBlock });
vestingNew = api.registry.createType<PalletVestingVestingInfo>('VestingInfo', { locked, perBlock, startingBlock });
}
return [vestingNew, [locks]];
@@ -126,20 +127,20 @@ function queryCurrent (api: ApiInterfaceRx, accountId: AccountId, balanceInstanc
return (
api.query.vesting?.vesting
? api.queryMulti<[Option<VestingInfo>, ...BalanceLocks]>([[api.query.vesting.vesting, accountId], ...queries])
? api.queryMulti<[Option<PalletVestingVestingInfo>, ...BalanceLocks]>([[api.query.vesting.vesting, accountId], ...queries])
// TODO We need to check module instances here as well, not only the balances module
: queries.length
? api.queryMulti<[...(Vec<BalanceLock>)[]]>(queries).pipe(
map((r): [Option<VestingInfo>, ...BalanceLocks] => [api.registry.createType('Option<VestingInfo>'), ...r])
? api.queryMulti<[...(Vec<PalletBalancesBalanceLock>)[]]>(queries).pipe(
map((r): [Option<PalletVestingVestingInfo>, ...BalanceLocks] => [api.registry.createType('Option<VestingInfo>'), ...r])
)
: of([api.registry.createType('Option<VestingInfo>')] as [Option<VestingInfo>])
: of([api.registry.createType('Option<VestingInfo>')] as [Option<PalletVestingVestingInfo>])
).pipe(
map(([opt, ...locks]): ResultBalance => {
let offset = -1;
return [
opt.unwrapOr(null),
lockEmpty.map((e) => e ? api.registry.createType('Vec<BalanceLock>') : locks[++offset])
lockEmpty.map((e) => e ? api.registry.createType<Vec<PalletBalancesBalanceLock>>('Vec<BalanceLock>') : locks[++offset])
];
})
);
+38
View File
@@ -0,0 +1,38 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, Balance, BalanceLockTo212, BlockNumber, Index } from '@polkadot/types/interfaces';
import type { PalletBalancesBalanceLock } from '@polkadot/types/lookup';
export interface DeriveBalancesAccountData {
freeBalance: Balance;
frozenFee: Balance;
frozenMisc: Balance;
reservedBalance: Balance;
votingBalance: Balance;
}
export interface DeriveBalancesAccount extends DeriveBalancesAccountData {
accountId: AccountId;
accountNonce: Index;
additional: DeriveBalancesAccountData[];
}
export interface DeriveBalancesAllAccountData extends DeriveBalancesAccountData {
availableBalance: Balance;
lockedBalance: Balance;
lockedBreakdown: (PalletBalancesBalanceLock | BalanceLockTo212)[];
vestingLocked: Balance;
}
export interface DeriveBalancesAll extends DeriveBalancesAccount, DeriveBalancesAllAccountData {
additional: DeriveBalancesAllAccountData[];
isVesting: boolean;
vestedBalance: Balance;
vestedClaimable: Balance;
vestingEndBlock: BlockNumber;
vestingPerBlock: Balance;
vestingTotal: Balance;
}
export type DeriveBalancesMap = Record<string, DeriveBalancesAll>;
+5 -4
View File
@@ -4,7 +4,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { Bounty, BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import type { BountyIndex, ProposalIndex } from '@polkadot/types/interfaces';
import type { PalletBountiesBounty } from '@polkadot/types/lookup';
import type { DeriveBounties, DeriveCollectiveProposal } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs';
@@ -12,7 +13,7 @@ import { combineLatest, map, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { filterBountiesProposals } from './helpers/filterBountyProposals';
type Result = [Option<Bounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
type Result = [Option<PalletBountiesBounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
function parseResult ([maybeBounties, maybeDescriptions, ids, bountyProposals]: Result): DeriveBounties {
const bounties: DeriveBounties = [];
@@ -53,8 +54,8 @@ export function bounties (instanceId: string, api: ApiInterfaceRx): () => Observ
const ids = keys.map(({ args: [id] }) => id);
return combineLatest([
bountyBase.bounties.multi<Option<Bounty>>(ids),
bountyBase.bountyDescriptions.multi<Option<Bytes>>(ids),
bountyBase.bounties.multi(ids),
bountyBase.bountyDescriptions.multi(ids),
of(ids),
of(filterBountiesProposals(api, proposals))
]);
+13 -10
View File
@@ -5,7 +5,7 @@ import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { SignedBlockExtended } from '../type/types';
import { catchError, combineLatest, map, of } from 'rxjs';
import { catchError, combineLatest, map, of, switchMap } from 'rxjs';
import { createSignedBlockExtended } from '../type';
import { memo } from '../util';
@@ -24,15 +24,18 @@ import { memo } from '../util';
* ```
*/
export function getBlock (instanceId: string, api: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<SignedBlockExtended | undefined> {
return memo(instanceId, (hash: Uint8Array | string): Observable<SignedBlockExtended | undefined> =>
combineLatest([
api.rpc.chain.getBlock(hash),
api.query.system.events.at(hash),
api.query.session
? api.query.session.validators.at(hash)
: of([])
]).pipe(
map(([signedBlock, events, validators]): SignedBlockExtended =>
return memo(instanceId, (blockHash: Uint8Array | string): Observable<SignedBlockExtended | undefined> =>
api.queryAt(blockHash).pipe(
switchMap((queryAt) =>
combineLatest([
api.rpc.chain.getBlock(blockHash),
queryAt.system.events(),
queryAt.session
? queryAt.session.validators()
: of([])
])
),
map(([signedBlock, events, validators]) =>
createSignedBlockExtended(api.registry, signedBlock, events, validators)
),
catchError((): Observable<undefined> =>
+12 -8
View File
@@ -3,9 +3,10 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { HeaderExtended } from '../type/types';
import { catchError, combineLatest, map, of } from 'rxjs';
import { catchError, combineLatest, map, of, switchMap } from 'rxjs';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
@@ -26,13 +27,16 @@ import { memo } from '../util';
*/
export function getHeader (instanceId: string, api: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<HeaderExtended | undefined> {
return memo(instanceId, (hash: Uint8Array | string): Observable<HeaderExtended | undefined> =>
combineLatest([
api.rpc.chain.getHeader(hash),
api.query.session
? api.query.session.validators.at(hash)
: of([])
]).pipe(
map(([header, validators]): HeaderExtended =>
api.queryAt(hash).pipe(
switchMap((queryAt) =>
combineLatest([
api.rpc.chain.getHeader(hash),
queryAt.session
? queryAt.session.validators()
: of([] as AccountId[])
])
),
map(([header, validators]) =>
createHeaderExtended(header.registry, header, validators)
),
catchError((): Observable<undefined> =>
@@ -3,9 +3,7 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { EventRecord, SignedBlock } from '@polkadot/types/interfaces';
import type { HeaderExtended, SignedBlockExtended } from '../type/types';
import type { SignedBlockExtended } from '../type/types';
import { combineLatest, map, of, switchMap } from 'rxjs';
@@ -19,16 +17,21 @@ import { memo } from '../util';
export function subscribeNewBlocks (instanceId: string, api: ApiInterfaceRx): () => Observable<SignedBlockExtended> {
return memo(instanceId, (): Observable<SignedBlockExtended> =>
api.derive.chain.subscribeNewHeads().pipe(
switchMap((header): Observable<[SignedBlock, Vec<EventRecord>, HeaderExtended]> => {
switchMap((header) => {
const blockHash = header.createdAtHash || header.hash;
return combineLatest(
api.rpc.chain.getBlock(blockHash),
api.query.system.events.at(blockHash),
of(header)
// we get the block first, setting up the registry
return api.queryAt(blockHash).pipe(
switchMap((queryAt) =>
combineLatest([
of(header),
api.rpc.chain.getBlock(blockHash),
queryAt.system.events()
])
)
);
}),
map(([block, events, header]) =>
map(([header, block, events]) =>
createSignedBlockExtended(block.registry, block, events, header.validators)
)
)
@@ -40,9 +40,6 @@ function _proposalsFrom (instanceId: string, api: ApiInterfaceRx, section: strin
// however we have had cases on Edgeware where the indices have moved around after an
// upgrade, which results in invalid on-chain data
combineLatest(hashes.map((hash) =>
// this should simply be api.query[section].proposalOf.multi<Option<Proposal>>(hashes),
// however we have had cases on Edgeware where the indices have moved around after an
// upgrade, which results in invalid on-chain data
api.query[section].proposalOf<Option<Proposal>>(hash).pipe(
catchError(() => of(null))
)
+4 -3
View File
@@ -4,7 +4,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx, QueryableModuleStorage } from '@polkadot/api/types';
import type { Vec } from '@polkadot/types';
import type { AccountId, Balance, Voter } from '@polkadot/types/interfaces';
import type { AccountId, Balance } from '@polkadot/types/interfaces';
import type { PalletElectionsPhragmenVoter } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveCouncilVote, DeriveCouncilVotes } from '../types';
@@ -13,9 +14,9 @@ import { combineLatest, map, of } from 'rxjs';
import { memo } from '../util';
// Voter is current tuple is 2.x-era
type VoteEntry = Voter | ITuple<[Balance, Vec<AccountId>]>;
type VoteEntry = PalletElectionsPhragmenVoter | ITuple<[Balance, Vec<AccountId>]>;
function isVoter (value: VoteEntry): value is Voter {
function isVoter (value: VoteEntry): value is PalletElectionsPhragmenVoter {
return !Array.isArray(value);
}
@@ -3,8 +3,9 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, u64, Vec } from '@polkadot/types';
import type { BlockNumber, Hash, ReferendumIndex, Scheduled } from '@polkadot/types/interfaces';
import type { Option, Vec } from '@polkadot/types';
import type { BlockNumber, Hash, ReferendumIndex } from '@polkadot/types/interfaces';
import type { PalletSchedulerScheduledV2 } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveDispatch, DeriveProposalImage } from '../types';
@@ -42,7 +43,7 @@ function queryQueue (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
);
}
function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], (Option<Scheduled>[] | null)[]]> {
function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], (Option<PalletSchedulerScheduledV2>[] | null)[]]> {
// We don't get entries, but rather we get the keys (triggered via finished referendums) and
// the subscribe to those keys - this means we pickup when the schedulers actually executes
// at a block, the entry for that block will become empty
@@ -56,11 +57,11 @@ function schedulerEntries (api: ApiInterfaceRx): Observable<[BlockNumber[], (Opt
return blockNumbers.length
? combineLatest([
of(blockNumbers),
// this should simply be api.query.scheduler.agenda.multi<Vec<Option<Scheduled>>>,
// this should simply be api.query.scheduler.agenda.multi,
// however we have had cases on Darwinia where the indices have moved around after an
// upgrade, which results in invalid on-chain data
combineLatest(blockNumbers.map((blockNumber) =>
api.query.scheduler.agenda<Vec<Option<Scheduled>>>(blockNumber).pipe(
api.query.scheduler.agenda(blockNumber).pipe(
// this does create an issue since it discards all at that block
catchError(() => of(null))
)
@@ -86,7 +87,7 @@ function queryScheduler (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
const id = scheduled.maybeId.unwrap().toHex();
if (id.startsWith(DEMOCRACY_ID)) {
const [, index] = api.registry.createType<ITuple<[u64, ReferendumIndex]>>('(u64, ReferendumIndex)', id);
const [, index] = api.registry.createType('(u64, ReferendumIndex)', id);
const imageHash = scheduled.call.args[0] as Hash;
result.push({ at, imageHash, index });
+11 -6
View File
@@ -3,8 +3,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, Vote, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces';
import type { AccountId, ReferendumInfoTo239, Vote } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumInfo, PalletDemocracyVoteVoting } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveDemocracyLock } from '../types';
@@ -14,6 +14,11 @@ import { BN_ZERO, isUndefined } from '@polkadot/util';
import { memo } from '../util';
type ReferendumInfoFinished = PalletDemocracyReferendumInfo['asFinished'];
type VotingDelegating = PalletDemocracyVoteVoting['asDelegating'];
type VotingDirect = PalletDemocracyVoteVoting['asDirect'];
type VotingDirectVote = VotingDirect['votes'][0];
const LOCKUPS = [0, 1, 2, 4, 8, 16, 32];
function parseEnd (api: ApiInterfaceRx, vote: Vote, { approved, end }: ReferendumInfoFinished): [BN, BN] {
@@ -25,7 +30,7 @@ function parseEnd (api: ApiInterfaceRx, vote: Vote, { approved, end }: Referendu
];
}
function parseLock (api: ApiInterfaceRx, [referendumId, accountVote]: VotingDirectVote, referendum: ReferendumInfo): DeriveDemocracyLock {
function parseLock (api: ApiInterfaceRx, [referendumId, accountVote]: VotingDirectVote, referendum: PalletDemocracyReferendumInfo): DeriveDemocracyLock {
const { balance, vote } = accountVote.asStandard;
const [referendumEnd, unlockAt] = referendum.isFinished
? parseEnd(api, vote, referendum.asFinished)
@@ -57,13 +62,13 @@ function directLocks (api: ApiInterfaceRx, { votes }: VotingDirect): Observable<
return of([]);
}
return api.query.democracy.referendumInfoOf.multi<Option<ReferendumInfo | ReferendumInfoTo239>>(votes.map(([referendumId]) => referendumId)).pipe(
return api.query.democracy.referendumInfoOf.multi(votes.map(([referendumId]) => referendumId)).pipe(
map((referendums) =>
votes
.map((vote, index): [VotingDirectVote, ReferendumInfo | ReferendumInfoTo239 | null] =>
.map((vote, index): [VotingDirectVote, PalletDemocracyReferendumInfo | ReferendumInfoTo239 | null] =>
[vote, referendums[index].unwrapOr(null)]
)
.filter((item): item is [VotingDirectVote, ReferendumInfo] =>
.filter((item): item is [VotingDirectVote, PalletDemocracyReferendumInfo] =>
!!item[1] && isUndefined((item[1] as ReferendumInfoTo239).end) && item[0][1].isStandard
)
.map(([directVote, referendum]) =>
@@ -4,7 +4,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { Hash, VoteThreshold } from '@polkadot/types/interfaces';
import type { H256 } from '@polkadot/types/interfaces';
import type { PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveProposalExternal } from '../types';
@@ -12,7 +13,7 @@ import { map, of, switchMap } from 'rxjs';
import { memo } from '../util';
function withImage (api: ApiInterfaceRx, nextOpt: Option<ITuple<[Hash, VoteThreshold]>>): Observable<DeriveProposalExternal | null> {
function withImage (api: ApiInterfaceRx, nextOpt: Option<ITuple<[H256, PalletDemocracyVoteThreshold]>>): Observable<DeriveProposalExternal | null> {
if (nextOpt.isNone) {
return of(null);
}
@@ -31,7 +32,7 @@ function withImage (api: ApiInterfaceRx, nextOpt: Option<ITuple<[Hash, VoteThres
export function nextExternal (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveProposalExternal | null> {
return memo(instanceId, (): Observable<DeriveProposalExternal | null> =>
api.query.democracy?.nextExternal
? api.query.democracy.nextExternal<Option<ITuple<[Hash, VoteThreshold]>>>().pipe(
? api.query.democracy.nextExternal().pipe(
switchMap((nextOpt) => withImage(api, nextOpt))
)
: of(null)
@@ -3,9 +3,7 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { DeriveProposalImage } from '../types';
import { map } from 'rxjs';
@@ -13,11 +11,9 @@ import { map } from 'rxjs';
import { memo } from '../util';
import { parseImage } from './util';
type PreImage = Option<ITuple<[Bytes, AccountId, Balance, BlockNumber]>>;
export function preimage (instanceId: string, api: ApiInterfaceRx): (hash: Hash) => Observable<DeriveProposalImage | undefined> {
return memo(instanceId, (hash: Hash): Observable<DeriveProposalImage | undefined> =>
api.query.democracy.preimages<PreImage>(hash).pipe(
api.query.democracy.preimages(hash).pipe(
map((imageOpt) => parseImage(api, imageOpt))
)
);
@@ -3,9 +3,7 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { Hash } from '@polkadot/types/interfaces';
import type { DeriveProposalImage } from '../types';
import { map, of } from 'rxjs';
@@ -13,12 +11,10 @@ import { map, of } from 'rxjs';
import { memo } from '../util';
import { parseImage } from './util';
type PreImage = Option<ITuple<[Bytes, AccountId, Balance, BlockNumber]>>;
export function preimages (instanceId: string, api: ApiInterfaceRx): (hashes: Hash[]) => Observable<(DeriveProposalImage | undefined)[]> {
return memo(instanceId, (hashes: Hash[]): Observable<(DeriveProposalImage | undefined)[]> =>
hashes.length
? api.query.democracy.preimages.multi<PreImage>(hashes).pipe(
? api.query.democracy.preimages.multi(hashes).pipe(
map((images): (DeriveProposalImage | undefined)[] =>
images.map((imageOpt) => parseImage(api, imageOpt))
)
@@ -58,9 +58,9 @@ export function proposals (instanceId: string, api: ApiInterfaceRx): () => Obser
? combineLatest([
of(proposals),
api.derive.democracy.preimages(
proposals.map(([, hash]): Hash => hash)),
api.query.democracy.depositOf.multi<Depositors>(
proposals.map(([index]): PropIndex => index))
proposals.map(([, hash]) => hash)),
api.query.democracy.depositOf.multi(
proposals.map(([index]) => index))
])
: of<Result>([[], [], []])
),
@@ -3,23 +3,24 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { ReferendumInfo, ReferendumInfoFinished } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumInfo } from '@polkadot/types/lookup';
import { map, switchMap } from 'rxjs';
import { memo } from '../util';
type ReferendumInfoFinished = PalletDemocracyReferendumInfo['asFinished'];
export function referendumsFinished (instanceId: string, api: ApiInterfaceRx): () => Observable<ReferendumInfoFinished[]> {
return memo(instanceId, (): Observable<ReferendumInfoFinished[]> =>
api.derive.democracy.referendumIds().pipe(
switchMap((ids) =>
api.query.democracy.referendumInfoOf.multi<Option<ReferendumInfo>>(ids)
api.query.democracy.referendumInfoOf.multi(ids)
),
map((infos): ReferendumInfoFinished[] =>
infos
.map((optInfo) => optInfo.unwrapOr(null))
.filter((info): info is ReferendumInfo => !!info && info.isFinished)
.filter((info): info is PalletDemocracyReferendumInfo => !!info && info.isFinished)
.map((info) => info.asFinished)
)
)
@@ -4,7 +4,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, ReferendumInfo, ReferendumInfoTo239, Vote, Voting, VotingDelegating, VotingDirectVote } from '@polkadot/types/interfaces';
import type { AccountId, ReferendumInfoTo239, Vote } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumInfo, PalletDemocracyVoteVoting } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
@@ -15,6 +16,10 @@ import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { calcVotes, getStatus, parseImage } from './util';
type VotingDelegating = PalletDemocracyVoteVoting['asDelegating'];
type VotingDirect = PalletDemocracyVoteVoting['asDirect'];
type VotingDirectVote = VotingDirect['votes'][0];
function votesPrev (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
return api.query.democracy.votersFor<Vec<AccountId>>(referendumId).pipe(
switchMap((votersFor): Observable<[Vec<AccountId>, Vote[], DeriveBalancesAccount[]]> =>
@@ -41,7 +46,7 @@ function votesPrev (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveRef
);
}
function extractVotes (mapped: [AccountId, Voting][], referendumId: BN): DeriveReferendumVote[] {
function extractVotes (mapped: [AccountId, PalletDemocracyVoteVoting][], referendumId: BN): DeriveReferendumVote[] {
return mapped
.filter(([, voting]) => voting.isDirect)
.map(([accountId, voting]): [AccountId, VotingDirectVote[]] => [
@@ -66,9 +71,9 @@ function extractVotes (mapped: [AccountId, Voting][], referendumId: BN): DeriveR
}
function votesCurr (api: ApiInterfaceRx, referendumId: BN): Observable<DeriveReferendumVote[]> {
return api.query.democracy.votingOf.entries<Voting, [AccountId]>().pipe(
return api.query.democracy.votingOf.entries().pipe(
map((allVoting): DeriveReferendumVote[] => {
const mapped = allVoting.map(([{ args: [accountId] }, voting]): [AccountId, Voting] => [accountId, voting]);
const mapped = allVoting.map(([{ args: [accountId] }, voting]): [AccountId, PalletDemocracyVoteVoting] => [accountId, voting]);
const votes = extractVotes(mapped, referendumId);
const delegations = mapped
.filter(([, voting]) => voting.isDelegating)
@@ -123,8 +128,8 @@ export function _referendumsVotes (instanceId: string, api: ApiInterfaceRx): (re
);
}
export function _referendumInfo (instanceId: string, api: ApiInterfaceRx): (index: BN, info: Option<ReferendumInfo | ReferendumInfoTo239>) => Observable<DeriveReferendum | null> {
return memo(instanceId, (index: BN, info: Option<ReferendumInfo | ReferendumInfoTo239>): Observable<DeriveReferendum | null> => {
export function _referendumInfo (instanceId: string, api: ApiInterfaceRx): (index: BN, info: Option<PalletDemocracyReferendumInfo | ReferendumInfoTo239>) => Observable<DeriveReferendum | null> {
return memo(instanceId, (index: BN, info: Option<PalletDemocracyReferendumInfo | ReferendumInfoTo239>): Observable<DeriveReferendum | null> => {
const status = getStatus(info);
return status
@@ -143,7 +148,7 @@ export function _referendumInfo (instanceId: string, api: ApiInterfaceRx): (inde
export function referendumsInfo (instanceId: string, api: ApiInterfaceRx): (ids: BN[]) => Observable<DeriveReferendum[]> {
return memo(instanceId, (ids: BN[]): Observable<DeriveReferendum[]> =>
ids.length
? api.query.democracy.referendumInfoOf.multi<Option<ReferendumInfo>>(ids).pipe(
? api.query.democracy.referendumInfoOf.multi(ids).pipe(
switchMap((infos): Observable<(DeriveReferendum | null)[]> =>
combineLatest(
ids.map((id, index): Observable<DeriveReferendum | null> =>
+4 -3
View File
@@ -2,7 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
import type { Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, ReferendumStatus, Vote, VoteThreshold } from '@polkadot/types/interfaces';
import type { AccountId, Balance, BlockNumber, Hash, PropIndex, Proposal, ReferendumIndex, ReferendumInfoTo239, Vote } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
export interface DeriveDemocracyLock {
@@ -41,14 +42,14 @@ export interface DeriveProposal {
export interface DeriveProposalExternal {
image?: DeriveProposalImage;
imageHash: Hash;
threshold: VoteThreshold;
threshold: PalletDemocracyVoteThreshold;
}
export interface DeriveReferendum {
index: ReferendumIndex;
image?: DeriveProposalImage;
imageHash: Hash;
status: ReferendumStatus | ReferendumInfoTo239;
status: PalletDemocracyReferendumStatus | ReferendumInfoTo239;
}
export interface DeriveReferendumVote {
+10 -9
View File
@@ -3,7 +3,8 @@
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, PreimageStatus, Proposal, ReferendumInfo, ReferendumInfoTo239, ReferendumStatus, Tally, VoteThreshold } from '@polkadot/types/interfaces';
import type { AccountId, Balance, BlockNumber, PreimageStatus, Proposal, ReferendumInfoTo239, Tally } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumInfo, PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
@@ -18,12 +19,12 @@ interface ApproxState {
votedTotal: BN;
}
function isOldInfo (info: ReferendumInfo | ReferendumInfoTo239): info is ReferendumInfoTo239 {
function isOldInfo (info: PalletDemocracyReferendumInfo | ReferendumInfoTo239): info is ReferendumInfoTo239 {
return !!(info as ReferendumInfoTo239).proposalHash;
}
function isCurrentStatus (status: ReferendumStatus | ReferendumInfoTo239): status is ReferendumStatus {
return !!(status as ReferendumStatus).tally;
function isCurrentStatus (status: PalletDemocracyReferendumStatus | ReferendumInfoTo239): status is PalletDemocracyReferendumStatus {
return !!(status as PalletDemocracyReferendumStatus).tally;
}
function isCurrentPreimage (api: ApiInterfaceRx, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): imageOpt is Option<PreimageStatus> {
@@ -57,18 +58,18 @@ export function compareRationals (n1: BN, d1: BN, n2: BN, d2: BN): boolean {
}
}
function calcPassingOther (threshold: VoteThreshold, sqrtElectorate: BN, { votedAye, votedNay, votedTotal }: ApproxState): boolean {
function calcPassingOther (threshold: PalletDemocracyVoteThreshold, sqrtElectorate: BN, { votedAye, votedNay, votedTotal }: ApproxState): boolean {
const sqrtVoters = bnSqrt(votedTotal);
return sqrtVoters.isZero()
? false
: threshold.isSupermajorityapproval
: threshold.isSuperMajorityApprove
? compareRationals(votedNay, sqrtVoters, votedAye, sqrtElectorate)
: compareRationals(votedNay, sqrtElectorate, votedAye, sqrtVoters);
}
export function calcPassing (threshold: VoteThreshold, sqrtElectorate: BN, state: ApproxState): boolean {
return threshold.isSimplemajority
export function calcPassing (threshold: PalletDemocracyVoteThreshold, sqrtElectorate: BN, state: ApproxState): boolean {
return threshold.isSimpleMajority
? state.votedAye.gt(state.votedNay)
: calcPassingOther(threshold, sqrtElectorate, state);
}
@@ -134,7 +135,7 @@ export function calcVotes (sqrtElectorate: BN, referendum: DeriveReferendum, vot
};
}
export function getStatus (info: Option<ReferendumInfo | ReferendumInfoTo239>): ReferendumStatus | ReferendumInfoTo239 | null {
export function getStatus (info: Option<PalletDemocracyReferendumInfo | ReferendumInfoTo239>): PalletDemocracyReferendumStatus | ReferendumInfoTo239 | null {
if (info.isNone) {
return null;
}
@@ -3,8 +3,9 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Bytes, Option, u32 } from '@polkadot/types';
import type { Option, u32, WrapperOpaque } from '@polkadot/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { PalletImOnlineBoundedOpaqueNetworkState } from '@polkadot/types/lookup';
import type { DeriveHeartbeats } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs';
@@ -13,7 +14,9 @@ import { BN_ZERO } from '@polkadot/util';
import { memo } from '../util';
function mapResult ([result, validators, heartbeats, numBlocks]: [DeriveHeartbeats, AccountId[], Option<Bytes>[], u32[]]): DeriveHeartbeats {
type HeartbeatsOpt = Option<WrapperOpaque<PalletImOnlineBoundedOpaqueNetworkState>>;
function mapResult ([result, validators, heartbeats, numBlocks]: [DeriveHeartbeats, AccountId[], HeartbeatsOpt[], u32[]]): DeriveHeartbeats {
validators.forEach((validator, index): void => {
const validatorId = validator.toString();
const blockCount = numBlocks[index];
@@ -39,13 +42,13 @@ export function receivedHeartbeats (instanceId: string, api: ApiInterfaceRx): ()
return memo(instanceId, (): Observable<DeriveHeartbeats> =>
api.query.imOnline?.receivedHeartbeats
? api.derive.staking.overview().pipe(
switchMap(({ currentIndex, validators }): Observable<[DeriveHeartbeats, AccountId[], Option<Bytes>[], u32[]]> =>
switchMap(({ currentIndex, validators }): Observable<[DeriveHeartbeats, AccountId[], HeartbeatsOpt[], u32[]]> =>
combineLatest([
of({}),
of(validators),
api.query.imOnline.receivedHeartbeats.multi<Option<Bytes>>(
api.query.imOnline.receivedHeartbeats.multi(
validators.map((_address, index) => [currentIndex, index])),
api.query.imOnline.authoredBlocks.multi<u32>(
api.query.imOnline.authoredBlocks.multi(
validators.map((address) => [currentIndex, address]))
])
),
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '6.1.2' };
export const packageInfo = { name: '@polkadot/api-derive', version: '6.3.1' };
+10 -8
View File
@@ -3,8 +3,9 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, BalanceOf, Bid, BidKind } from '@polkadot/types/interfaces';
import type { Option } from '@polkadot/types';
import type { BalanceOf } from '@polkadot/types/interfaces';
import type { PalletSocietyBid, PalletSocietyBidKind } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveSocietyCandidate } from '../types';
@@ -12,20 +13,21 @@ import { combineLatest, map, of, switchMap } from 'rxjs';
import { memo } from '../util';
type ResultSuspend = Option<ITuple<[BalanceOf, BidKind]>>;
type Result = [Bid[], ResultSuspend[]]
type ResultSuspend = Option<ITuple<[BalanceOf, PalletSocietyBidKind]>>;
type Result = [PalletSocietyBid[], ResultSuspend[]]
/**
* @description Get the candidate info for a society
*/
export function candidates (instanceId: string, api: ApiInterfaceRx): () => Observable<DeriveSocietyCandidate[]> {
return memo(instanceId, (): Observable<DeriveSocietyCandidate[]> =>
api.query.society.candidates<Vec<Bid>>().pipe(
switchMap((candidates: Vec<Bid>): Observable<Result> =>
api.query.society.candidates().pipe(
switchMap((candidates): Observable<Result> =>
combineLatest([
of(candidates),
api.query.society.suspendedCandidates.multi<ResultSuspend>(
candidates.map(({ who }): AccountId => who))
api.query.society.suspendedCandidates.multi(
candidates.map(({ who }) => who)
)
])
),
map(([candidates, suspended]: Result): DeriveSocietyCandidate[] =>
+3 -2
View File
@@ -4,14 +4,15 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, u32, Vec } from '@polkadot/types';
import type { AccountId, BalanceOf, Bid } from '@polkadot/types/interfaces';
import type { AccountId, BalanceOf } from '@polkadot/types/interfaces';
import type { PalletSocietyBid } from '@polkadot/types/lookup';
import type { DeriveSociety } from '../types';
import { map } from 'rxjs';
import { memo } from '../util';
type Result = [Vec<Bid>, Option<AccountId>, Option<AccountId>, Option<AccountId>, u32, BalanceOf]
type Result = [Vec<PalletSocietyBid>, Option<AccountId>, Option<AccountId>, Option<AccountId>, u32, BalanceOf]
/**
* @description Get the overall info for a society
+6 -8
View File
@@ -3,9 +3,7 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { bool, Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, BlockNumber, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { DeriveSocietyMember } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs';
@@ -16,11 +14,11 @@ export function _members (instanceId: string, api: ApiInterfaceRx): (accountIds:
return memo(instanceId, (accountIds: AccountId[]): Observable<DeriveSocietyMember[]> =>
combineLatest([
of(accountIds),
api.query.society.payouts.multi<Vec<ITuple<[BlockNumber, Balance]>>>(accountIds),
api.query.society.strikes.multi<StrikeCount>(accountIds),
api.query.society.defenderVotes.multi<Option<SocietyVote>>(accountIds),
api.query.society.suspendedMembers.multi<bool>(accountIds),
api.query.society.vouching.multi<Option<VouchingStatus>>(accountIds)
api.query.society.payouts.multi(accountIds),
api.query.society.strikes.multi(accountIds),
api.query.society.defenderVotes.multi(accountIds),
api.query.society.suspendedMembers.multi(accountIds),
api.query.society.vouching.multi(accountIds)
]).pipe(
map(([accountIds, payouts, strikes, defenderVotes, suspended, vouching]) =>
accountIds.map((accountId, index) => ({
+33
View File
@@ -0,0 +1,33 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { u32 } from '@polkadot/types';
import type { AccountId, Balance, BalanceOf, BlockNumber, StrikeCount } from '@polkadot/types/interfaces';
import type { PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus } from '@polkadot/types/lookup';
export interface DeriveSociety {
bids: PalletSocietyBid[];
defender?: AccountId;
hasDefender: boolean;
head?: AccountId;
founder?: AccountId;
maxMembers: u32;
pot: BalanceOf;
}
export interface DeriveSocietyCandidate {
accountId: AccountId;
kind: PalletSocietyBidKind;
value: Balance;
isSuspended: boolean;
}
export interface DeriveSocietyMember {
accountId: AccountId;
isDefenderVoter: boolean;
isSuspended: boolean;
payouts: [BlockNumber, Balance][];
strikes: StrikeCount;
vote?: PalletSocietyVote;
vouching?: PalletSocietyVouchingStatus;
}
+6 -5
View File
@@ -3,7 +3,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Balance, StakingLedger, UnlockChunk } from '@polkadot/types/interfaces';
import type { Balance } from '@polkadot/types/interfaces';
import type { PalletStakingStakingLedger, PalletStakingUnlockChunk } from '@polkadot/types/lookup';
import type { DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types';
import { combineLatest, map, switchMap } from 'rxjs';
@@ -19,7 +20,7 @@ const QUERY_OPTS = {
withPrefs: true
};
function groupByEra (list: UnlockChunk[]): Record<string, BN> {
function groupByEra (list: PalletStakingUnlockChunk[]): Record<string, BN> {
return list.reduce((map: Record<string, BN>, { era, value }): Record<string, BN> => {
const key = era.toString();
@@ -29,7 +30,7 @@ function groupByEra (list: UnlockChunk[]): Record<string, BN> {
}, {});
}
function calculateUnlocking (api: ApiInterfaceRx, stakingLedger: StakingLedger | undefined, sessionInfo: DeriveSessionInfo): DeriveUnlocking[] | undefined {
function calculateUnlocking (api: ApiInterfaceRx, stakingLedger: PalletStakingStakingLedger | undefined, sessionInfo: DeriveSessionInfo): DeriveUnlocking[] | undefined {
const results = Object
.entries(groupByEra(
(stakingLedger?.unlocking || []).filter(({ era }) => era.unwrap().gt(sessionInfo.activeEra))
@@ -44,8 +45,8 @@ function calculateUnlocking (api: ApiInterfaceRx, stakingLedger: StakingLedger |
: undefined;
}
function redeemableSum (api: ApiInterfaceRx, stakingLedger: StakingLedger | undefined, sessionInfo: DeriveSessionInfo): Balance {
return api.registry.createType('Balance', (stakingLedger?.unlocking || [] as UnlockChunk[]).reduce((total, { era, value }): BN => {
function redeemableSum (api: ApiInterfaceRx, stakingLedger: PalletStakingStakingLedger | undefined, sessionInfo: DeriveSessionInfo): Balance {
return api.registry.createType('Balance', (stakingLedger?.unlocking || [] as PalletStakingUnlockChunk[]).reduce((total, { era, value }): BN => {
return sessionInfo.activeEra.gte(era.unwrap())
? total.iadd(value.unwrap())
: total;
@@ -3,7 +3,7 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraRewardPoints } from '@polkadot/types/interfaces';
import type { PalletStakingEraRewardPoints } from '@polkadot/types/lookup';
import { switchMap } from 'rxjs';
@@ -12,11 +12,11 @@ import { memo } from '../util';
/**
* @description Retrieve the staking overview, including elected and points earned
*/
export function currentPoints (instanceId: string, api: ApiInterfaceRx): () => Observable<EraRewardPoints> {
return memo(instanceId, (): Observable<EraRewardPoints> =>
export function currentPoints (instanceId: string, api: ApiInterfaceRx): () => Observable<PalletStakingEraRewardPoints> {
return memo(instanceId, (): Observable<PalletStakingEraRewardPoints> =>
api.derive.session.indexes().pipe(
switchMap(({ activeEra }) =>
api.query.staking.erasRewardPoints<EraRewardPoints>(activeEra)
api.query.staking.erasRewardPoints<PalletStakingEraRewardPoints>(activeEra)
)
));
}
@@ -4,14 +4,15 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { StorageKey } from '@polkadot/types';
import type { AccountId, EraIndex, Exposure } from '@polkadot/types/interfaces';
import type { AccountId, EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingExposure } from '@polkadot/types/lookup';
import type { DeriveEraExposure, DeriveEraNominatorExposure, DeriveEraValidatorExposure } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { deriveCache, memo } from '../util';
type KeysAndExposures = [StorageKey<[EraIndex, AccountId]>, Exposure][];
type KeysAndExposures = [StorageKey<[EraIndex, AccountId]>, PalletStakingExposure][];
const CACHE_KEY = 'eraExposure';
@@ -3,7 +3,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraIndex, EraRewardPoints } from '@polkadot/types/interfaces';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingEraRewardPoints } from '@polkadot/types/lookup';
import type { DeriveEraPoints, DeriveEraValPoints } from '../types';
import { map, of, switchMap } from 'rxjs';
@@ -15,7 +16,7 @@ import { filterEras } from './util';
const CACHE_KEY = 'eraPoints';
function mapValidators ({ individual }: EraRewardPoints): DeriveEraValPoints {
function mapValidators ({ individual }: PalletStakingEraRewardPoints): DeriveEraValPoints {
return [...individual.entries()]
.filter(([, points]) => points.gt(BN_ZERO))
.reduce((result: DeriveEraValPoints, [validatorId, points]): DeriveEraValPoints => {
@@ -25,7 +26,7 @@ function mapValidators ({ individual }: EraRewardPoints): DeriveEraValPoints {
}, {});
}
function mapPoints (eras: EraIndex[], points: EraRewardPoints[]): DeriveEraPoints[] {
function mapPoints (eras: EraIndex[], points: PalletStakingEraRewardPoints[]): DeriveEraPoints[] {
return eras.map((era, index): DeriveEraPoints => ({
era,
eraPoints: points[index].total,
@@ -48,7 +49,7 @@ export function _erasPoints (instanceId: string, api: ApiInterfaceRx): (eras: Er
return !remaining.length
? of(cached)
: api.query.staking.erasRewardPoints.multi<EraRewardPoints>(remaining).pipe(
: api.query.staking.erasRewardPoints.multi(remaining).pipe(
map((points): DeriveEraPoints[] => {
const query = mapPoints(remaining, points);
+3 -2
View File
@@ -4,7 +4,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { StorageKey } from '@polkadot/types';
import type { EraIndex, ValidatorPrefs } from '@polkadot/types/interfaces';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingValidatorPrefs } from '@polkadot/types/lookup';
import type { DeriveEraPrefs, DeriveEraValPrefs } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs';
@@ -13,7 +14,7 @@ import { deriveCache, memo } from '../util';
const CACHE_KEY = 'eraPrefs';
function mapPrefs (era: EraIndex, all: [StorageKey, ValidatorPrefs][]): DeriveEraPrefs {
function mapPrefs (era: EraIndex, all: [StorageKey, PalletStakingValidatorPrefs][]): DeriveEraPrefs {
const validators: DeriveEraValPrefs = {};
all.forEach(([key, prefs]): void => {
@@ -38,7 +38,7 @@ export function _erasRewards (instanceId: string, api: ApiInterfaceRx): (eras: E
return of(cached);
}
return api.query.staking.erasValidatorReward.multi<Option<Balance>>(remaining).pipe(
return api.query.staking.erasValidatorReward.multi(remaining).pipe(
map((optRewards) => {
const query = mapRewards(remaining, optRewards);
+13 -8
View File
@@ -4,7 +4,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Keys } from '@polkadot/types/interfaces';
import type { AccountId } from '@polkadot/types/interfaces';
import type { NodeRuntimeSessionKeys } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveStakingKeys } from './types';
@@ -12,13 +13,17 @@ import { combineLatest, map, of, switchMap } from 'rxjs';
import { memo } from '../util';
function extractsIds (stashId: Uint8Array | string, queuedKeys: [AccountId, Keys][], nextKeys: Option<Keys>): DeriveStakingKeys {
function extractsIds (stashId: Uint8Array | string, queuedKeys: [AccountId, NodeRuntimeSessionKeys | AccountId[]][], nextKeys: Option<NodeRuntimeSessionKeys>): DeriveStakingKeys {
const sessionIds = (queuedKeys.find(([currentId]) => currentId.eq(stashId)) || [undefined, [] as AccountId[]])[1];
const nextSessionIds = nextKeys.unwrapOr([] as AccountId[]);
return {
nextSessionIds,
sessionIds
nextSessionIds: Array.isArray(nextSessionIds)
? nextSessionIds
: [...nextSessionIds.values()] as AccountId[],
sessionIds: Array.isArray(sessionIds)
? sessionIds
: [...sessionIds.values()] as AccountId[]
};
}
@@ -33,13 +38,13 @@ export function keys (instanceId: string, api: ApiInterfaceRx): (stashId: Uint8A
export function keysMulti (instanceId: string, api: ApiInterfaceRx): (stashIds: (Uint8Array | string)[]) => Observable<DeriveStakingKeys[]> {
return memo(instanceId, (stashIds: (Uint8Array | string)[]): Observable<DeriveStakingKeys[]> =>
stashIds.length
? api.query.session.queuedKeys<Vec<ITuple<[AccountId, Keys]>>>().pipe(
switchMap((queuedKeys): Observable<[Vec<ITuple<[AccountId, Keys]>>, Option<Keys>[]]> =>
? api.query.session.queuedKeys().pipe(
switchMap((queuedKeys): Observable<[Vec<ITuple<[AccountId, NodeRuntimeSessionKeys]>>, Option<NodeRuntimeSessionKeys>[]]> =>
combineLatest([
of(queuedKeys),
api.consts.session?.dedupKeyPrefix
? api.query.session.nextKeys.multi<Option<Keys>>(stashIds.map((stashId) => [api.consts.session.dedupKeyPrefix, stashId]))
: api.query.session.nextKeys.multi<Option<Keys>>(stashIds)
? api.query.session.nextKeys.multi(stashIds.map((stashId) => [api.consts.session.dedupKeyPrefix, stashId]))
: api.query.session.nextKeys.multi(stashIds)
])
),
map(([queuedKeys, nextKeys]) =>
@@ -3,7 +3,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx, QueryableStorageMultiArg } from '@polkadot/api/types';
import type { EraIndex, Exposure } from '@polkadot/types/interfaces';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingExposure } from '@polkadot/types/lookup';
import type { DeriveOwnExposure } from '../types';
import { map, of, switchMap } from 'rxjs';
@@ -14,7 +15,7 @@ export function _ownExposures (instanceId: string, api: ApiInterfaceRx): (accoun
// eslint-disable-next-line @typescript-eslint/no-unused-vars
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveOwnExposure[]> =>
eras.length
? api.queryMulti<Exposure[]>([
? api.queryMulti<PalletStakingExposure[]>([
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.erasStakersClipped, [era, accountId]]),
...eras.map((era): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.erasStakers, [era, accountId]])
]).pipe(
+18 -17
View File
@@ -4,14 +4,15 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Option } from '@polkadot/types';
import type { AccountId, EraIndex, Exposure, Nominations, RewardDestination, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
import type { AccountId, EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingExposure, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingStakingLedger, PalletStakingValidatorPrefs } from '@polkadot/types/lookup';
import type { DeriveStakingQuery, StakingQueryFlags } from '../types';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { memo } from '../util';
function parseDetails (stashId: AccountId, controllerIdOpt: Option<AccountId> | null, nominatorsOpt: Option<Nominations>, rewardDestination: RewardDestination, validatorPrefs: ValidatorPrefs, exposure: Exposure, stakingLedgerOpt: Option<StakingLedger>): DeriveStakingQuery {
function parseDetails (stashId: AccountId, controllerIdOpt: Option<AccountId> | null, nominatorsOpt: Option<PalletStakingNominations>, rewardDestination: PalletStakingRewardDestination, validatorPrefs: PalletStakingValidatorPrefs, exposure: PalletStakingExposure, stakingLedgerOpt: Option<PalletStakingStakingLedger>): DeriveStakingQuery {
return {
accountId: stashId,
controllerId: controllerIdOpt && controllerIdOpt.unwrapOr(null),
@@ -26,21 +27,21 @@ function parseDetails (stashId: AccountId, controllerIdOpt: Option<AccountId> |
};
}
function getLedgers (api: ApiInterfaceRx, optIds: (Option<AccountId> | null)[], { withLedger = false }: StakingQueryFlags): Observable<Option<StakingLedger>[]> {
function getLedgers (api: ApiInterfaceRx, optIds: (Option<AccountId> | null)[], { withLedger = false }: StakingQueryFlags): Observable<Option<PalletStakingStakingLedger>[]> {
const ids = optIds
.filter((opt): opt is Option<AccountId> => withLedger && !!opt && opt.isSome)
.map((opt) => opt.unwrap());
const emptyLed = api.registry.createType('Option<StakingLedger>');
const emptyLed = api.registry.createType<Option<PalletStakingStakingLedger>>('Option<StakingLedger>');
return (
ids.length
? api.query.staking.ledger.multi<Option<StakingLedger>>(ids)
? api.query.staking.ledger.multi(ids)
: of([])
).pipe(
map((optLedgers): Option<StakingLedger>[] => {
map((optLedgers): Option<PalletStakingStakingLedger>[] => {
let offset = -1;
return optIds.map((opt): Option<StakingLedger> =>
return optIds.map((opt): Option<PalletStakingStakingLedger> =>
opt && opt.isSome
? optLedgers[++offset] || emptyLed
: emptyLed
@@ -49,27 +50,27 @@ function getLedgers (api: ApiInterfaceRx, optIds: (Option<AccountId> | null)[],
);
}
function getStashInfo (api: ApiInterfaceRx, stashIds: AccountId[], activeEra: EraIndex, { withController, withDestination, withExposure, withLedger, withNominations, withPrefs }: StakingQueryFlags): Observable<[(Option<AccountId> | null)[], Option<Nominations>[], RewardDestination[], ValidatorPrefs[], Exposure[]]> {
const emptyNoms = api.registry.createType('Option<Nominations>');
const emptyRewa = api.registry.createType('RewardDestination');
const emptyExpo = api.registry.createType('Exposure');
const emptyPrefs = api.registry.createType('ValidatorPrefs');
function getStashInfo (api: ApiInterfaceRx, stashIds: AccountId[], activeEra: EraIndex, { withController, withDestination, withExposure, withLedger, withNominations, withPrefs }: StakingQueryFlags): Observable<[(Option<AccountId> | null)[], Option<PalletStakingNominations>[], PalletStakingRewardDestination[], PalletStakingValidatorPrefs[], PalletStakingExposure[]]> {
const emptyNoms = api.registry.createType<Option<PalletStakingNominations>>('Option<Nominations>');
const emptyRewa = api.registry.createType<PalletStakingRewardDestination>('RewardDestination');
const emptyExpo = api.registry.createType<PalletStakingExposure>('Exposure');
const emptyPrefs = api.registry.createType<PalletStakingValidatorPrefs>('ValidatorPrefs');
return combineLatest([
withController || withLedger
? api.query.staking.bonded.multi<Option<AccountId>>(stashIds)
? api.query.staking.bonded.multi(stashIds)
: of(stashIds.map(() => null)),
withNominations
? api.query.staking.nominators.multi<Option<Nominations>>(stashIds)
? api.query.staking.nominators.multi(stashIds)
: of(stashIds.map(() => emptyNoms)),
withDestination
? api.query.staking.payee.multi<RewardDestination>(stashIds)
? api.query.staking.payee.multi(stashIds)
: of(stashIds.map(() => emptyRewa)),
withPrefs
? api.query.staking.validators.multi<ValidatorPrefs>(stashIds)
? api.query.staking.validators.multi(stashIds)
: of(stashIds.map(() => emptyPrefs)),
withExposure
? api.query.staking.erasStakers.multi<Exposure>(stashIds.map((stashId) => [activeEra, stashId]))
? api.query.staking.erasStakers.multi(stashIds.map((stashId) => [activeEra, stashId]))
: of(stashIds.map(() => emptyExpo))
]);
}
@@ -3,7 +3,7 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EraIndex, ValidatorPrefs } from '@polkadot/types/interfaces';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { DeriveStakerPrefs } from '../types';
import { map, switchMap } from 'rxjs';
@@ -13,7 +13,7 @@ import { memo } from '../util';
export function _stakerPrefs (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerPrefs[]> {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveStakerPrefs[]> =>
api.query.staking.erasValidatorPrefs.multi<ValidatorPrefs>(eras.map((era) => [era, accountId])).pipe(
api.query.staking.erasValidatorPrefs.multi(eras.map((era) => [era, accountId])).pipe(
map((all): DeriveStakerPrefs[] =>
all.map((validatorPrefs, index): DeriveStakerPrefs => ({
era: eras[index],
@@ -3,7 +3,8 @@
import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { AccountId, EraIndex, StakingLedger } from '@polkadot/types/interfaces';
import type { AccountId, EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingStakingLedger } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveEraPoints, DeriveEraPrefs, DeriveEraRewards, DeriveEraValPrefs, DeriveStakerExposure, DeriveStakerReward, DeriveStakerRewardValidator } from '../types';
import type { DeriveStakingQuery } from './types';
@@ -108,7 +109,7 @@ function removeClaimed (validators: string[], queryValidators: DeriveStakingQuer
});
}
function filterRewards (eras: EraIndex[], valInfo: [string, DeriveStakingQuery][], { rewards, stakingLedger }: { rewards: DeriveStakerReward[]; stakingLedger: StakingLedger }): DeriveStakerReward[] {
function filterRewards (eras: EraIndex[], valInfo: [string, DeriveStakingQuery][], { rewards, stakingLedger }: { rewards: DeriveStakerReward[]; stakingLedger: PalletStakingStakingLedger }): DeriveStakerReward[] {
const filter = eras.filter((era) => !stakingLedger.claimedRewards.some((e) => e.eq(era)));
const validators = valInfo.map(([v]) => v);
const queryValidators = valInfo.map(([, q]) => q);
+11 -10
View File
@@ -1,13 +1,14 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, Balance, EraIndex, Exposure, RewardDestination, RewardPoint, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
import type { AccountId, Balance, EraIndex, RewardPoint } from '@polkadot/types/interfaces';
import type { PalletStakingExposure, PalletStakingRewardDestination, PalletStakingStakingLedger, PalletStakingValidatorPrefs } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveSessionIndexes } from '../session/types';
export type DeriveEraValPoints = Record<string, RewardPoint>;
export type DeriveEraValPrefs = Record<string, ValidatorPrefs>;
export type DeriveEraValPrefs = Record<string, PalletStakingValidatorPrefs>;
export type DeriveEraValSlash = Record<string, Balance>;
@@ -40,9 +41,9 @@ export interface DeriveStakerPoints {
}
export interface DeriveOwnExposure {
clipped: Exposure;
clipped: PalletStakingExposure;
era: EraIndex;
exposure: Exposure;
exposure: PalletStakingExposure;
}
export interface DeriveEraExposureNominating {
@@ -52,7 +53,7 @@ export interface DeriveEraExposureNominating {
export type DeriveEraNominatorExposure = Record<string, DeriveEraExposureNominating[]>;
export type DeriveEraValidatorExposure = Record<string, Exposure>;
export type DeriveEraValidatorExposure = Record<string, PalletStakingExposure>;
export interface DeriveEraExposure {
era: EraIndex;
@@ -70,7 +71,7 @@ export interface DeriveStakerExposure {
export interface DeriveStakerPrefs {
era: EraIndex;
validatorPrefs: ValidatorPrefs;
validatorPrefs: PalletStakingValidatorPrefs;
}
export interface DeriveStakerRewardValidator {
@@ -106,16 +107,16 @@ export interface DeriveStakingValidators {
export interface DeriveStakingStash {
controllerId: AccountId | null;
exposure: Exposure;
exposure: PalletStakingExposure;
nominators: AccountId[];
rewardDestination: RewardDestination;
rewardDestination: PalletStakingRewardDestination;
stashId: AccountId;
validatorPrefs: ValidatorPrefs;
validatorPrefs: PalletStakingValidatorPrefs;
}
export interface DeriveStakingQuery extends DeriveStakingStash {
accountId: AccountId;
stakingLedger: StakingLedger;
stakingLedger: PalletStakingStakingLedger;
}
export interface DeriveStakingElected {
@@ -59,7 +59,7 @@ function retrieveProposals (api: ApiInterfaceRx, proposalCount: ProposalIndex, a
const allIds = [...proposalIds, ...approvalIds];
return combineLatest([
api.query.treasury.proposals.multi<Option<TreasuryProposal>>(allIds),
api.query.treasury.proposals.multi(allIds),
api.derive.council
? api.derive.council.proposals()
: of([] as DeriveCollectiveProposal[])
+10 -10
View File
@@ -5,7 +5,7 @@ import type { Observable } from 'rxjs';
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { EventRecord, Hash, SignedBlock } from '@polkadot/types/interfaces';
import { combineLatest, map } from 'rxjs';
import { combineLatest, map, switchMap } from 'rxjs';
import { memo } from '../util';
@@ -15,15 +15,15 @@ interface Result {
}
export function events (instanceId: string, api: ApiInterfaceRx): (at: Hash) => Observable<Result> {
return memo(instanceId, (at: Hash): Observable<Result> =>
combineLatest([
api.query.system.events.at(at),
api.rpc.chain.getBlock(at)
]).pipe(
map(([events, block]) => ({
block,
events
}))
return memo(instanceId, (blockHash: Hash) =>
api.queryAt(blockHash).pipe(
switchMap((queryAt) =>
combineLatest([
api.rpc.chain.getBlock(blockHash),
queryAt.system.events()
])
),
map(([block, events]): Result => ({ block, events }))
)
);
}
+5 -62
View File
@@ -2,52 +2,22 @@
// SPDX-License-Identifier: Apache-2.0
import type { u32 } from '@polkadot/types';
import type { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Bounty, BountyIndex, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VouchingStatus } from '@polkadot/types/interfaces';
import type { Balance, BlockNumber, BountyIndex, Hash, Proposal, ProposalIndex, SetIndex, TreasuryProposal, Votes } from '@polkadot/types/interfaces';
import type { PalletBountiesBounty } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
export * from './accounts/types';
export * from './balances/types';
export * from './council/types';
export * from './crowdloan/types';
export * from './democracy/types';
export * from './elections/types';
export * from './parachains/types';
export * from './session/types';
export * from './society/types';
export * from './staking/types';
export * from './type/types';
export interface DeriveBalancesAccountData {
freeBalance: Balance;
frozenFee: Balance;
frozenMisc: Balance;
reservedBalance: Balance;
votingBalance: Balance;
}
export interface DeriveBalancesAccount extends DeriveBalancesAccountData {
accountId: AccountId;
accountNonce: Index;
additional: DeriveBalancesAccountData[];
}
export interface DeriveBalancesAllAccountData extends DeriveBalancesAccountData {
availableBalance: Balance;
lockedBalance: Balance;
lockedBreakdown: (BalanceLock | BalanceLockTo212)[];
vestingLocked: Balance;
}
export interface DeriveBalancesAll extends DeriveBalancesAccount, DeriveBalancesAllAccountData {
additional: DeriveBalancesAllAccountData[];
isVesting: boolean;
vestedBalance: Balance;
vestedClaimable: Balance;
vestingEndBlock: BlockNumber;
vestingPerBlock: Balance;
vestingTotal: Balance;
}
export type DeriveBalancesMap = Record<string, DeriveBalancesAll>;
export interface DeriveContractFees {
callBaseFee: BN;
contractFee: BN;
@@ -90,33 +60,6 @@ export interface RecentlyOffline {
export type DeriveRecentlyOffline = Record<string, RecentlyOffline[]>;
export interface DeriveSociety {
bids: Bid[];
defender?: AccountId;
hasDefender: boolean;
head?: AccountId;
founder?: AccountId;
maxMembers: u32;
pot: BalanceOf;
}
export interface DeriveSocietyCandidate {
accountId: AccountId;
kind: BidKind;
value: Balance;
isSuspended: boolean;
}
export interface DeriveSocietyMember {
accountId: AccountId;
isDefenderVoter: boolean;
isSuspended: boolean;
payouts: [BlockNumber, Balance][];
strikes: StrikeCount;
vote?: SocietyVote;
vouching?: VouchingStatus;
}
export interface DeriveTreasuryProposal {
council: DeriveCollectiveProposal[];
id: ProposalIndex;
@@ -138,7 +81,7 @@ export interface VoterPosition {
export type DeriveVoterPositions = Record<string, VoterPosition>;
export interface DeriveBounty {
bounty: Bounty;
bounty: PalletBountiesBounty;
description: string;
index: BountyIndex;
proposals: DeriveCollectiveProposal[];
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
@@ -20,15 +20,15 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.15.4",
"@polkadot/api-derive": "6.1.2",
"@polkadot/api-derive": "6.3.1",
"@polkadot/keyring": "^7.4.1",
"@polkadot/rpc-core": "6.1.2",
"@polkadot/rpc-provider": "6.1.2",
"@polkadot/types": "6.1.2",
"@polkadot/types-known": "6.1.2",
"@polkadot/rpc-core": "6.3.1",
"@polkadot/rpc-provider": "6.3.1",
"@polkadot/types": "6.3.1",
"@polkadot/types-known": "6.3.1",
"@polkadot/util": "^7.4.1",
"@polkadot/util-crypto": "^7.4.1",
"eventemitter3": "^4.0.7",
"rxjs": "^7.3.0"
"rxjs": "^7.4.0"
}
}
+25 -6
View File
@@ -2,7 +2,7 @@
/* eslint-disable */
import type { ApiTypes } from '@polkadot/api/types';
import type { U8aFixed, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types';
import type { U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { Perbill, Percent, Permill } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, PalletContractsSchedule, SpVersionRuntimeVersion } from '@polkadot/types/lookup';
import type { Codec } from '@polkadot/types/types';
@@ -396,11 +396,6 @@ declare module '@polkadot/api/types/consts' {
* Must be no greater than `MaxQueueLen`.
**/
fifoQueueLen: u32 & AugmentedConst<ApiType>;
/**
* The issuance to ignore. This is subtracted from the `Currency`'s `total_issuance` to get
* the issuance by which we inflate or deflate the gilt.
**/
ignoredIssuance: u128 & AugmentedConst<ApiType>;
/**
* The number of blocks between consecutive attempts to issue more gilts in an effort to
* get to the target amount to be frozen.
@@ -796,6 +791,30 @@ declare module '@polkadot/api/types/consts' {
[key: string]: Codec;
};
transactionPayment: {
/**
* A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their
* `priority`
*
* This value is multipled by the `final_fee` to obtain a "virtual tip" that is later
* added to a tip component in regular `priority` calculations.
* It means that a `Normal` transaction can front-run a similarly-sized `Operational`
* extrinsic (with no tip), by including a tip value greater than the virtual tip.
*
* ```rust,ignore
* // For `Normal`
* let priority = priority_calc(tip);
*
* // For `Operational`
* let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier;
* let priority = priority_calc(tip + virtual_tip);
* ```
*
* Note that since we use `final_fee` the multiplier applies also to the regular `tip`
* sent with the transaction. So, not only does the transaction get a priority bump based
* on the `inclusion_fee`, but we also amplify the impact of tips applied to `Operational`
* transactions.
**/
operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;
/**
* The fee to be paid for making a transaction; the per-byte portion.
**/
+2 -21
View File
@@ -180,47 +180,28 @@ declare module '@polkadot/api/types/events' {
contracts: {
/**
* A code with the specified hash was removed.
* \[code_hash\]
*
* This happens when the last contract that uses this code hash was removed.
**/
CodeRemoved: AugmentedEvent<ApiType, [H256]>;
/**
* Code with the specified hash has been stored. \[code_hash\]
* Code with the specified hash has been stored.
**/
CodeStored: AugmentedEvent<ApiType, [H256]>;
/**
* A custom event emitted by the contract.
* \[contract, data\]
*
* # Params
*
* - `contract`: The contract that emitted the event.
* - `data`: Data supplied by the contract. Metadata generated during contract compilation
* is needed to decode it.
**/
ContractEmitted: AugmentedEvent<ApiType, [AccountId32, Bytes]>;
/**
* Contract deployed by address at the specified address. \[deployer, contract\]
* Contract deployed by address at the specified address.
**/
Instantiated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>;
/**
* Triggered when the current schedule is updated.
* \[version\]
*
* # Params
*
* - `version`: The version of the newly set schedule.
**/
ScheduleUpdated: AugmentedEvent<ApiType, [u32]>;
/**
* Contract has been removed.
* \[contract, beneficiary\]
*
* # Params
*
* - `contract`: The contract that was terminated.
* - `beneficiary`: The account that received the contracts remaining balance.
*
* # Note
*
+16 -2
View File
@@ -604,7 +604,7 @@ declare module '@polkadot/api/types/storage' {
**/
keys: AugmentedQuery<ApiType, () => Observable<Vec<PalletImOnlineSr25519AppSr25519Public>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* For each session index, we keep a mapping of 'SessionIndex` and `AuthIndex` to
* For each session index, we keep a mapping of `SessionIndex` and `AuthIndex` to
* `WrapperOpaque<BoundedOpaqueNetworkState>`.
**/
receivedHeartbeats: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<WrapperOpaque<PalletImOnlineBoundedOpaqueNetworkState>>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
@@ -787,7 +787,9 @@ declare module '@polkadot/api/types/storage' {
/**
* Indices of disabled validators.
*
* The set is cleared when `on_session_ending` returns a new set of identities.
* The vec is always kept sorted so that we can find whether a given validator is
* disabled using binary search. It gets cleared when `on_session_ending` returns
* a new set of identities.
**/
disabledValidators: AugmentedQuery<ApiType, () => Observable<Vec<u32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -1055,6 +1057,18 @@ declare module '@polkadot/api/types/storage' {
* All slashing events on nominators, mapped by era to the highest slash value of the era.
**/
nominatorSlashInEra: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<u128>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
/**
* Indices of validators that have offended in the active era and whether they are currently
* disabled.
*
* This value should be a superset of disabled validators since not all offences lead to the
* validator being disabled (if there was no slash). This is needed to track the percentage of
* validators that have offended in the current era, ensuring a new era is forced if
* `OffendingValidatorsThreshold` is reached. The vec is always kept sorted so that we can find
* whether a given validator has previously offended using binary search. It gets cleared when
* the era ends.
**/
offendingValidators: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[u32, bool]>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Where the reward payment should be made. Keyed by stash.
**/
+4 -4
View File
@@ -2572,8 +2572,8 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin of this function must be signed.
*
* # <weight>
* - Complexity: `O(1)` in number of key types.
* Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.
* - Complexity: `O(1)` in number of key types. Actual cost depends on the number of length
* of `T::Keys::key_ids()` which is fixed.
* - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`
* - DbWrites: `NextKeys`, `origin account`
* - DbWrites per key id: `KeyOwner`
@@ -2588,8 +2588,8 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin of this function must be signed.
*
* # <weight>
* - Complexity: `O(1)`
* Actual cost depends on the number of length of `T::Keys::key_ids()` which is fixed.
* - Complexity: `O(1)`. Actual cost depends on the number of length of
* `T::Keys::key_ids()` which is fixed.
* - DbReads: `origin account`, `T::ValidatorIdOf`, `NextKeys`
* - DbWrites: `origin account`, `NextKeys`
* - DbReads per key id: `KeyOwner`
+64 -24
View File
@@ -7,9 +7,9 @@ import type { Option, Raw, StorageKey, Text, u64 } from '@polkadot/types';
import type { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, CallFunction, Codec, DefinitionRpc, DefinitionRpcSub, DetectCodec, IMethod, IStorageKey, Registry, RegistryTypes } from '@polkadot/types/types';
import type { AnyFunction, AnyTuple, CallFunction, Codec, DefinitionRpc, DefinitionRpcSub, DetectCodec, IMethod, IStorageKey, Registry, RegistryError, RegistryTypes } from '@polkadot/types/types';
import type { SubmittableExtrinsic } from '../submittable/types';
import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecoratedRpcSection, DecorateMethod, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableModuleStorageAt, QueryableStorage, QueryableStorageAt, QueryableStorageEntry, QueryableStorageEntryAt, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import type { ApiDecoration, ApiInterfaceRx, ApiOptions, ApiTypes, AugmentedQuery, DecoratedErrors, DecoratedEvents, DecoratedRpc, DecoratedRpcSection, DecorateMethod, GenericStorageEntryFunction, PaginationOptions, QueryableConsts, QueryableModuleStorage, QueryableModuleStorageAt, QueryableStorage, QueryableStorageAt, QueryableStorageEntry, QueryableStorageEntryAt, QueryableStorageMulti, QueryableStorageMultiArg, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics } from '../types';
import type { VersionedRegistry } from './types';
import { BehaviorSubject, combineLatest, from, map, of, switchMap, tap, toArray } from 'rxjs';
@@ -25,6 +25,7 @@ import { augmentObject } from '../util/augmentObject';
import { decorateSections, DeriveAllSections } from '../util/decorate';
import { extractStorageArgs } from '../util/validate';
import { Events } from './Events';
import { findCall, findError } from './find';
interface MetaDecoration {
callIndex?: Uint8Array;
@@ -47,6 +48,12 @@ const l = logger('api/init');
let instanceCounter = 0;
function getAtQueryFn<ApiType extends ApiTypes> (api: ApiDecoration<ApiType>, { method, section }: StorageEntry): AugmentedQuery<'rxjs', GenericStorageEntryFunction, AnyTuple> {
assert(api.rx.query[section] && api.rx.query[section][method], () => `query.${section}.${method} is not available in this version of the metadata`);
return api.rx.query[section][method];
}
export abstract class Decorate<ApiType extends ApiTypes> extends Events {
readonly #instanceId: string;
@@ -138,6 +145,8 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this.#instanceId = `${++instanceCounter}`;
this.#registry = options.source?.registry || options.registry || new TypeRegistry();
this._rx.queryAt = (blockHash: Uint8Array | string) =>
from(this.at(blockHash)).pipe(map((a) => a.rx.query));
this._rx.registry = this.#registry;
const thisProvider = options.source
@@ -224,6 +233,14 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
augmentObject('query', storage, decoratedApi.query, fromEmpty);
augmentObject('query', storageRx, decoratedApi.rx.query, fromEmpty);
decoratedApi.findCall = (callIndex: Uint8Array | string): CallFunction =>
findCall(registry.registry, callIndex);
decoratedApi.findError = (errorIndex: Uint8Array | string): RegistryError =>
findError(registry.registry, errorIndex);
decoratedApi.queryMulti = blockHash
? this._decorateMultiAt(decoratedApi, this._decorateMethod, blockHash)
: this._decorateMulti(this._decorateMethod);
return {
decoratedApi,
decoratedMeta: registry.decoratedMeta
@@ -373,12 +390,34 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
: this._rpcCore.state.queryStorageAt)(
calls.map((args: QueryableStorageMultiArg<ApiType>) =>
Array.isArray(args)
? args[0].creator.meta.type.asMap.hashers.length === 1
? [args[0].creator, args.slice(1)]
: [args[0].creator, ...args.slice(1)]
? args[0].creator.meta.type.isPlain
? [args[0].creator]
: args[0].creator.meta.type.asMap.hashers.length === 1
? [args[0].creator, args.slice(1)]
: [args[0].creator, ...args.slice(1)]
: [args.creator])));
}
protected _decorateMultiAt<ApiType extends ApiTypes> (atApi: ApiDecoration<ApiType>, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array | string): QueryableStorageMulti<ApiType> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return decorateMethod((calls: QueryableStorageMultiArg<ApiType>[]): Observable<Codec[]> =>
this._rpcCore.state.queryStorageAt(
calls.map((args: QueryableStorageMultiArg<ApiType>) => {
if (Array.isArray(args)) {
const { creator } = getAtQueryFn(atApi, args[0].creator);
return creator.meta.type.isPlain
? [creator]
: creator.meta.type.asMap.hashers.length === 1
? [creator, args.slice(1)]
: [creator, ...args.slice(1)];
}
return [getAtQueryFn(atApi, args.creator).creator];
}),
blockHash));
}
protected _decorateExtrinsics<ApiType extends ApiTypes> ({ tx }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): SubmittableExtrinsics<ApiType> {
const creator = createSubmittable(this._type, this._rx, decorateMethod);
@@ -430,8 +469,12 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}
private _decorateStorageEntry<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): QueryableStorageEntry<ApiType> {
// get the storage arguments, with DoubleMap as an array entry, otherwise spread
const getArgs = (args: unknown[]) => extractStorageArgs(this.#registry, creator, args);
const getArgs = (args: unknown[], registry?: Registry) =>
extractStorageArgs(registry || this.#registry, creator, args);
const getQueryAt = (blockHash: Hash | Uint8Array | string): Observable<AugmentedQuery<'rxjs', GenericStorageEntryFunction, AnyTuple>> =>
from(this.at(blockHash)).pipe(
map((api) => getAtQueryFn(api, creator)));
// Disable this where it occurs for each field we are decorating
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
@@ -440,14 +483,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
decorated.creator = creator;
decorated.at = decorateMethod((hash: Hash, ...args: unknown[]): Observable<Codec> =>
from(this.at(hash)).pipe(
switchMap((api): Observable<Codec> => {
assert(api.rx.query[creator.section] && api.rx.query[creator.section][creator.method], () => `query.${creator.section}.${creator.method} is not available in this version of the metadata`);
return api.rx.query[creator.section][creator.method](...args);
})
));
decorated.at = decorateMethod((blockHash: Hash, ...args: unknown[]): Observable<Codec> =>
getQueryAt(blockHash).pipe(
switchMap((q) => q(...args))));
decorated.hash = decorateMethod((...args: unknown[]): Observable<Hash> =>
this._rpcCore.state.getStorageHash(getArgs(args)));
@@ -468,8 +506,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
decorated.size = decorateMethod((...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args)));
decorated.sizeAt = decorateMethod((hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args), hash));
decorated.sizeAt = decorateMethod((blockHash: Hash | Uint8Array | string, ...args: unknown[]): Observable<u64> =>
getQueryAt(blockHash).pipe(
switchMap((q) =>
this._rpcCore.state.getStorageSize(getArgs(args, q.creator.meta.registry), blockHash))));
// .keys() & .entries() only available on map types
if (creator.iterKey && creator.meta.type.isMap) {
@@ -478,8 +518,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this._retrieveMapEntries(creator, null, args)));
decorated.entriesAt = decorateMethod(
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<[StorageKey, Codec][]> =>
this._retrieveMapEntries(creator, hash, args)));
memo(this.#instanceId, (blockHash: Hash | Uint8Array | string, ...args: unknown[]): Observable<[StorageKey, Codec][]> =>
getQueryAt(blockHash).pipe(
switchMap((q) => this._retrieveMapEntries(q.creator, blockHash, args)))));
decorated.entriesPaged = decorateMethod(
memo(this.#instanceId, (opts: PaginationOptions): Observable<[StorageKey, Codec][]> =>
@@ -490,8 +531,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
this._retrieveMapKeys(creator, null, args)));
decorated.keysAt = decorateMethod(
memo(this.#instanceId, (hash: Hash | Uint8Array | string, ...args: unknown[]): Observable<StorageKey[]> =>
this._retrieveMapKeys(creator, hash, args)));
memo(this.#instanceId, (blockHash: Hash | Uint8Array | string, ...args: unknown[]): Observable<StorageKey[]> =>
getQueryAt(blockHash).pipe(
switchMap((q) => this._retrieveMapKeys(q.creator, blockHash, args)))));
decorated.keysPaged = decorateMethod(
memo(this.#instanceId, (opts: PaginationOptions): Observable<StorageKey[]> =>
@@ -513,7 +555,6 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}
private _decorateStorageEntryAt<ApiType extends ApiTypes> (registry: Registry, creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array): QueryableStorageEntryAt<ApiType> {
// get the storage arguments, with DoubleMap as an array entry, otherwise spread
const getArgs = (args: unknown[]): unknown[] => extractStorageArgs(registry, creator, args);
// Disable this where it occurs for each field we are decorating
@@ -544,7 +585,6 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
decorated.size = decorateMethod((...args: unknown[]): Observable<u64> =>
this._rpcCore.state.getStorageSize(getArgs(args), blockHash));
// FIXME NMap support
// .keys() & .entries() only available on map types
if (creator.iterKey && creator.meta.type.isMap) {
decorated.entries = decorateMethod(
@@ -676,7 +716,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
const specName = this._runtimeVersion?.specName.toString();
const derives = {
...this._options.derives,
...(this._options.typesBundle?.spec?.[specName ?? '']?.derives || {})
...(this._options.typesBundle?.spec?.[specName || '']?.derives || {})
};
// Pull in derive from api-derive
+16
View File
@@ -5,11 +5,13 @@ import type { RpcInterface } from '@polkadot/rpc-core/types';
import type { Text } from '@polkadot/types';
import type { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { Metadata } from '@polkadot/types/metadata';
import type { CallFunction, RegistryError } from '@polkadot/types/types';
import type { ApiDecoration, ApiInterfaceRx, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, QueryableConsts, QueryableStorage, QueryableStorageMulti, SubmittableExtrinsics } from '../types';
import { assertReturn } from '@polkadot/util';
import { packageInfo } from '../packageInfo';
import { findCall, findError } from './find';
import { Init } from './Init';
interface PkgJson {
@@ -210,4 +212,18 @@ export abstract class Getters<ApiType extends ApiTypes> extends Init<ApiType> im
public get tx (): SubmittableExtrinsics<ApiType> {
return assertResult(this._extrinsics);
}
/**
* @description Finds the definition for a specific [[CallFunction]] based on the index supplied
*/
public findCall (callIndex: Uint8Array | string): CallFunction {
return findCall(this.registry, callIndex);
}
/**
* @description Finds the definition for a specific [[RegistryError]] based on the index supplied
*/
public findError (errorIndex: Uint8Array | string): RegistryError {
return findError(this.registry, errorIndex);
}
}
+34 -16
View File
@@ -14,7 +14,7 @@ import { firstValueFrom, map, of, switchMap } from 'rxjs';
import { Metadata, TypeRegistry } from '@polkadot/types';
import { getSpecAlias, getSpecExtensions, getSpecHasher, getSpecRpc, getSpecTypes, getUpgradeVersion } from '@polkadot/types-known';
import { assert, BN_ZERO, logger, stringify, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
import { assert, BN_ZERO, isUndefined, logger, stringify, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import { detectedCapabilities } from './capabilities';
@@ -31,6 +31,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
#updateSub?: Subscription | null = null;
#waitingRegistries: Record<string, Promise<VersionedRegistry<ApiType>>> = {};
constructor (options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) {
super(options, type, decorateMethod);
@@ -118,18 +120,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
return this._createDecorated(registry, true, u8aHash).decoratedApi;
}
/**
* @description Sets up a registry based on the block hash defined
*/
public async getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
const existingViaHash = this.#registries.find(({ lastBlockHash }) =>
lastBlockHash && u8aEq(lastBlockHash, blockHash)
);
if (existingViaHash) {
return existingViaHash;
}
private async _getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
// ensure we have everything required
assert(this._genesisHash && this._runtimeVersion, 'Cannot retrieve data on an uninitialized chain');
@@ -177,12 +168,39 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
this.#registries.push(result);
// TODO This could be useful for historic, disabled due to cross-looping, i.e. .at queries
// this._detectCapabilities(registry, blockHash);
return result;
}
/**
* @description Sets up a registry based on the block hash defined
*/
public async getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
const existingViaHash = this.#registries.find(({ lastBlockHash }) =>
lastBlockHash && u8aEq(lastBlockHash, blockHash)
);
if (existingViaHash) {
return existingViaHash;
}
const blockHashHex = u8aToHex(blockHash);
let waiting = this.#waitingRegistries[blockHashHex];
if (isUndefined(waiting)) {
waiting = this._getBlockRegistry(blockHash);
this.#waitingRegistries[blockHashHex] = waiting;
// when we have resolved, remove this from the waiting list
waiting
.then((): void => {
delete this.#waitingRegistries[blockHashHex];
})
.catch(() => undefined);
}
return waiting;
}
protected async _loadMeta (): Promise<boolean> {
// on re-connection to the same chain, we don't want to re-do everything from chain again
if (this._isReady) {
+14
View File
@@ -0,0 +1,14 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { CallFunction, Registry, RegistryError } from '@polkadot/types/types';
import { u8aToU8a } from '@polkadot/util';
export function findCall (registry: Registry, callIndex: Uint8Array | string): CallFunction {
return registry.findMetaCall(u8aToU8a(callIndex));
}
export function findError (registry: Registry, errorIndex: Uint8Array | string): RegistryError {
return registry.findMetaError(u8aToU8a(errorIndex));
}
+1 -15
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2021 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { CallFunction, RegistryError, SignerPayloadRawBase } from '@polkadot/types/types';
import type { SignerPayloadRawBase } from '@polkadot/types/types';
import type { ApiOptions, ApiTypes, DecorateMethod, Signer } from '../types';
import { assert, isString, u8aToHex, u8aToU8a } from '@polkadot/util';
@@ -55,20 +55,6 @@ export abstract class ApiBase<ApiType extends ApiTypes> extends Getters<ApiType>
return this._rpcCore.disconnect();
}
/**
* @description Finds the definition for a specific [[CallFunction]] based on the index supplied
*/
public findCall (callIndex: Uint8Array | string): CallFunction {
return this.registry.findMetaCall(u8aToU8a(callIndex));
}
/**
* @description Finds the definition for a specific [[RegistryError]] based on the index supplied
*/
public findError (errorIndex: Uint8Array | string): RegistryError {
return this.registry.findMetaError(u8aToU8a(errorIndex));
}
/**
* @description Set an external signer which will be used to sign extrinsic when account passed in is not KeyringPair
*/
+14 -4
View File
@@ -80,11 +80,11 @@ async function query (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
const bal2 = await api.query.balances.totalIssuance('WRONG_ARG'); // bal2 is Codec (wrong args)
const override = await api.query.balances.totalIssuance<Header>(); // override is still available
const oldBal = await api.query.balances.totalIssuance.at('abcd');
// It's hard to correctly type .multi. Expected: `Balance[]`, actual: Codec[].
// In the meantime, we can case with `<Balance>` (this is not available on recent chains)
const multi = await api.query.balances.freeBalance.multi<Balance>([pairs.alice.address, pairs.bob.address]);
// For older queries we can cast with `<Balance>` (newer chain have multi typed)
const multia = await api.query.balances.freeBalance.multi<Balance>([pairs.alice.address, pairs.bob.address]);
const multib = await api.query.system.account.multi([pairs.alice.address, pairs.bob.address]);
console.log('query types:', bar, bal, bal2, override, oldBal, multi);
console.log('query types:', bar, bal, bal2, override, oldBal, multia, multib);
// check multi for unsub
const multiUnsub = await api.queryMulti([
@@ -104,6 +104,16 @@ async function query (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
]);
console.log(multiRes);
// check multi, via at
const apiAt = await api.at('0x12345678');
const multiResAt = await apiAt.queryMulti([
api.query.timestamp.now,
[apiAt.query.staking.validators],
[apiAt.query.system.account, pairs.eve.address]
]);
console.log(multiResAt);
}
async function queryExtra (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '6.1.2' };
export const packageInfo = { name: '@polkadot/api', version: '6.3.1' };
+1
View File
@@ -45,6 +45,7 @@ export interface SignerOptions {
nonce: AnyNumber | Codec;
signer?: Signer;
tip?: AnyNumber;
assetId?: AnyNumber;
}
export type AddressOrPair = IKeyringPair | string | AccountId | Address;
+7 -1
View File
@@ -4,13 +4,14 @@
// Augment the modules
import '@polkadot/api/augment';
import type { Observable } from 'rxjs';
import type { DeriveCustom, ExactDerive } from '@polkadot/api-derive';
import type { RpcInterface } from '@polkadot/rpc-core/types';
import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
import type { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { Metadata } from '@polkadot/types/metadata';
import type { DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, SignatureOptions, Signer } from '@polkadot/types/types';
import type { CallFunction, DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, RegistryError, SignatureOptions, Signer } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { ApiBase } from '../base';
import type { DeriveAllSections } from '../util/decorate';
@@ -94,6 +95,7 @@ export interface ApiInterfaceRx {
runtimeMetadata: Metadata;
runtimeVersion: RuntimeVersion;
query: QueryableStorage<'rxjs'>;
queryAt: (blockHash: Uint8Array | string) => Observable<QueryableStorage<'rxjs'>>;
queryMulti: QueryableStorageMulti<'rxjs'>;
rpc: DecoratedRpc<'rxjs', RpcInterface>;
tx: SubmittableExtrinsics<'rxjs'>;
@@ -116,4 +118,8 @@ export interface ApiDecoration<ApiType extends ApiTypes> {
rx: {
query: QueryableStorage<'rxjs'>;
}
findCall (callIndex: Uint8Array | string): CallFunction;
findError (errorIndex: Uint8Array | string): RegistryError;
queryMulti: QueryableStorageMulti<ApiType>;
}
+36 -21
View File
@@ -8,13 +8,19 @@ import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, Callback, Codec, IStorageKey } from '@polkadot/types/types';
import type { ApiTypes, DropLast, MethodResult, ObsInnerType, PaginationOptions, PromiseOrObs, UnsubscribePromise } from './base';
interface StorageEntryObservableMulti {
<T extends Codec>(args: (unknown[] | unknown)[]): Observable<T[]>;
type AsCodec<R extends Codec | any> = R extends Codec
? R
: Codec;
type ReturnCodec<F extends AnyFunction> = AsCodec<ObsInnerType<ReturnType<F>>>;
interface StorageEntryObservableMulti<R extends Codec = Codec> {
<T extends Codec = R>(args: (unknown[] | unknown)[]): Observable<T[]>;
}
interface StorageEntryPromiseMulti {
<T extends Codec>(args: (unknown[] | unknown)[]): Promise<T[]>;
<T extends Codec>(args: (unknown[] | unknown)[], callback: Callback<T[]>): UnsubscribePromise;
interface StorageEntryPromiseMulti<R extends Codec = Codec> {
<T extends Codec = R>(args: (unknown[] | unknown)[]): Promise<T[]>;
<T extends Codec = R>(args: (unknown[] | unknown)[], callback: Callback<T[]>): UnsubscribePromise;
}
export interface StorageEntryPromiseOverloads {
@@ -32,7 +38,7 @@ export interface StorageEntryPromiseOverloadsAt {
}
// This is the most generic typings we can have for a storage entry function
type GenericStorageEntryFunction = (...args: unknown[]) => Observable<Codec>
export type GenericStorageEntryFunction = (...args: unknown[]) => Observable<Codec>
export type QueryableStorageEntry<ApiType extends ApiTypes, A extends AnyTuple = AnyTuple> =
ApiType extends 'rxjs'
@@ -52,28 +58,37 @@ export interface QueryableStorageAt<ApiType extends ApiTypes> extends AugmentedQ
[key: string]: QueryableModuleStorageAt<ApiType>;
}
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> {
at: <T extends Codec | any = ObsInnerType<ReturnType<F>>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
export interface StorageEntryBase<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> extends StorageEntryBaseAt<ApiType, F, A> {
/**
* @deprecated Use api.at(<blockHash>)
*/
at: <T extends Codec | any = ReturnCodec<F>>(hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, T>;
creator: StorageEntry;
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entriesAt: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entriesPaged: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
key: (...args: Parameters<F>) => string;
keyPrefix: (...args: DropLast<Parameters<F>>) => string;
keys: <K extends AnyTuple = A> (...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
/**
* @deprecated Use api.at(<blockHash>)
*/
entriesAt: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entriesPaged: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
/**
* @deprecated Use api.at(<blockHash>)
*/
keysAt: <K extends AnyTuple = A> (hash: Hash | Uint8Array | string, ...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
keysPaged: <K extends AnyTuple = A> (opts: PaginationOptions<Parameters<F>[0]>) => PromiseOrObs<ApiType, StorageKey<K>[]>;
// @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>;
/**
* @deprecated The underlying RPC this been marked unsafe and is generally not exposed
*/
range: <T extends Codec | any = ReturnCodec<F>>([from, to]: [Hash | Uint8Array | string, Hash | Uint8Array | string | undefined] | [Hash | Uint8Array | string], ...args: Parameters<F>) => PromiseOrObs<ApiType, [Hash, T][]>;
/**
* @deprecated Use api.at(<blockHash>)
*/
sizeAt: (hash: Hash | Uint8Array | string, ...args: Parameters<F>) => PromiseOrObs<ApiType, u64>;
multi: ApiType extends 'rxjs' ? StorageEntryObservableMulti : StorageEntryPromiseMulti;
multi: ApiType extends 'rxjs'
? StorageEntryObservableMulti<ReturnCodec<F>>
: StorageEntryPromiseMulti<ReturnCodec<F>>;
}
export interface StorageEntryBaseAt<ApiType extends ApiTypes, F extends AnyFunction, A extends AnyTuple = AnyTuple> {
entries: <T extends Codec | any = ObsInnerType<ReturnType<F>>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
entries: <T extends Codec | any = ReturnCodec<F>, K extends AnyTuple = A>(...args: DropLast<Parameters<F>>) => PromiseOrObs<ApiType, [StorageKey<K>, T][]>;
hash: (...args: Parameters<F>) => PromiseOrObs<ApiType, Hash>;
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
key: (...args: Parameters<F>) => string;
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
@@ -20,10 +20,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.15.4",
"@polkadot/rpc-provider": "6.1.2",
"@polkadot/types": "6.1.2",
"@polkadot/rpc-provider": "6.3.1",
"@polkadot/types": "6.3.1",
"@polkadot/util": "^7.4.1",
"rxjs": "^7.3.0"
"rxjs": "^7.4.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.4.1"
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '6.1.2' };
export const packageInfo = { name: '@polkadot/rpc-core', version: '6.3.1' };
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "Transport providers for the API",
"main": "index.js",
@@ -20,7 +20,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.15.4",
"@polkadot/types": "6.1.2",
"@polkadot/types": "6.3.1",
"@polkadot/util": "^7.4.1",
"@polkadot/util-crypto": "^7.4.1",
"@polkadot/x-fetch": "^7.4.1",
@@ -30,8 +30,8 @@
},
"devDependencies": {
"@polkadot/keyring": "^7.4.1",
"@polkadot/types": "6.1.2",
"mock-socket": "^9.0.3",
"@polkadot/types": "6.3.1",
"mock-socket": "^9.0.5",
"nock": "^13.1.3"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.1.2' };
export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.3.1' };
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "Type generation scripts",
"main": "index.js",
@@ -26,13 +26,13 @@
"bugs": "https://github.com/polkadot-js/api/issues",
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
"dependencies": {
"@babel/core": "^7.15.5",
"@babel/core": "^7.15.8",
"@babel/register": "^7.15.3",
"@babel/runtime": "^7.15.4",
"@polkadot/api": "6.1.2",
"@polkadot/rpc-provider": "6.1.2",
"@polkadot/types": "6.1.2",
"@polkadot/types-support": "6.1.2",
"@polkadot/api": "6.3.1",
"@polkadot/rpc-provider": "6.3.1",
"@polkadot/types": "6.3.1",
"@polkadot/types-support": "6.3.1",
"@polkadot/util": "^7.4.1",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
-4
View File
@@ -41,10 +41,6 @@ function entrySignature (lookup: PortableRegistry, allDefs: Record<string, Modul
const keyTypes = similarTypes.map((t) => t.join(' | '));
const defValue = lookup.getTypeDef(value);
if (value.toNumber() === 416) {
console.log(JSON.stringify(defValue));
}
setImports(allDefs, imports, [
...similarTypes.reduce<string[]>((all, t) => all.concat(t), []),
storageEntry.modifier.isOptional
+1 -1
View File
@@ -55,7 +55,7 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
const keys = (sub as TypeDef[]).map((def, index): string => {
const { info, lookupName, name = `unknown${index}`, type } = def;
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_')));
const isComplex = [TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const isComplex = [TypeDefInfo.Option, TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
? ''
: createGetter(definitions, `as${getter}`, lookupName || (isComplex ? formatType(registry, definitions, info === TypeDefInfo.Struct ? def : type, imports, false) : type), imports);
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '6.1.2' };
export const packageInfo = { name: '@polkadot/typegen', version: '6.3.1' };
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "Known type definitions",
"main": "index.js",
@@ -21,7 +21,7 @@
"dependencies": {
"@babel/runtime": "^7.15.4",
"@polkadot/networks": "^7.4.1",
"@polkadot/types": "6.1.2",
"@polkadot/types": "6.3.1",
"@polkadot/util": "^7.4.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '6.1.2' };
export const packageInfo = { name: '@polkadot/types-known', version: '6.3.1' };
+19 -7
View File
@@ -5,6 +5,8 @@
import type { OverrideVersionedType } from '@polkadot/types/types';
import { mapXcm } from '@polkadot/types/interfaces/xcm/definitions';
const sharedTypes = {
CompactAssignments: 'CompactAssignmentsWith24',
RawSolution: 'RawSolutionWith24',
@@ -191,15 +193,25 @@ const versioned: OverrideVersionedType[] = [
}
},
{
minmax: [9010, undefined],
minmax: [9010, 9099],
types: {
...sharedTypes,
AssetInstance: 'AssetInstanceV0',
MultiAsset: 'MultiAssetV0',
MultiLocation: 'MultiLocationV0',
Response: 'ResponseV0',
Xcm: 'XcmV0',
XcmOrder: 'XcmOrderV0'
...mapXcm('V0')
}
},
{
// jump from 9100 to 9110, however align with Rococo
minmax: [9100, 9105],
types: {
...sharedTypes,
...mapXcm('V1')
}
},
{
// metadata v14
minmax: [9106, undefined],
types: {
...sharedTypes
}
}
];
+8 -1
View File
@@ -74,7 +74,14 @@ const versioned: OverrideVersionedType[] = [
}
},
{
minmax: [30, undefined],
minmax: [30, 9109],
types: {
...sharedTypes
}
},
{
// metadata v14
minmax: [9110, undefined],
types: {
...sharedTypes
}
+18 -7
View File
@@ -5,6 +5,8 @@
import type { OverrideVersionedType } from '@polkadot/types/types';
import { mapXcm } from '@polkadot/types/interfaces/xcm/definitions';
// structs need to be in order
/* eslint-disable sort-keys */
@@ -38,15 +40,24 @@ const versioned: OverrideVersionedType[] = [
}
},
{
minmax: [229, undefined],
minmax: [229, 9099],
types: {
...sharedTypes,
AssetInstance: 'AssetInstanceV0',
MultiAsset: 'MultiAssetV0',
MultiLocation: 'MultiLocationV0',
Response: 'ResponseV0',
Xcm: 'XcmV0',
XcmOrder: 'XcmOrderV0'
...mapXcm('V0')
}
},
{
minmax: [9100, 9105],
types: {
...sharedTypes,
...mapXcm('V1')
}
},
{
// metadata v14
minmax: [9106, undefined],
types: {
...sharedTypes
}
}
];
+18 -7
View File
@@ -5,6 +5,8 @@
import type { OverrideVersionedType } from '@polkadot/types/types';
import { mapXcm } from '@polkadot/types/interfaces/xcm/definitions';
const sharedTypes = {
// 16 validators
CompactAssignments: 'CompactAssignmentsWith16',
@@ -89,15 +91,24 @@ const versioned: OverrideVersionedType[] = [
}
},
{
minmax: [50, undefined],
minmax: [50, 9099],
types: {
...sharedTypes,
AssetInstance: 'AssetInstanceV0',
MultiAsset: 'MultiAssetV0',
MultiLocation: 'MultiLocationV0',
Response: 'ResponseV0',
Xcm: 'XcmV0',
XcmOrder: 'XcmOrderV0'
...mapXcm('V0')
}
},
{
minmax: [9100, 9105],
types: {
...sharedTypes,
...mapXcm('V1')
}
},
{
// metadata v14
minmax: [9106, undefined],
types: {
...sharedTypes
}
}
];
+1 -1
View File
@@ -11,7 +11,7 @@ const upgrades: ChainUpgradesRaw = [
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
[5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030],
[5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070],
[6379314, 9080], [6979141, 9090]
[6379314, 9080], [6979141, 9090], [7568453, 9100]
];
export default upgrades;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-support",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "Supporting files for types, mostly for testing",
"main": "index.js",
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-support', version: '6.1.2' };
export const packageInfo = { name: '@polkadot/types-support', version: '6.3.1' };
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "6.1.2",
"version": "6.3.1",
"type": "module",
"description": "Implementation of the Parity codec",
"main": "index.js",
@@ -22,11 +22,11 @@
"@babel/runtime": "^7.15.4",
"@polkadot/util": "^7.4.1",
"@polkadot/util-crypto": "^7.4.1",
"rxjs": "^7.3.0"
"rxjs": "^7.4.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.4.1",
"@polkadot/types-support": "6.1.2",
"@polkadot/types-support": "6.3.1",
"@types/bn.js": "^4.11.6",
"bn.js": "^4.12.0"
}
+19 -28
View File
@@ -138,12 +138,9 @@ export default {
xcm: 'XcmV2Xcm',
},
Transact: {
_alias: {
call_: 'call',
},
originType: 'XcmV0OriginKind',
requireWeightAtMost: 'Compact<u64>',
call_: 'XcmDoubleEncoded',
call: 'XcmDoubleEncoded',
},
HrmpNewChannelOpenRequest: {
sender: 'Compact<u32>',
@@ -266,7 +263,7 @@ export default {
_enum: {
Null: 'Null',
Assets: 'XcmV1MultiassetMultiAssets',
ExecutionResult: 'Result<Null, (u32,XcmV2TraitsError)>',
ExecutionResult: 'Option<(u32,XcmV2TraitsError)>',
Version: 'u32'
}
},
@@ -421,7 +418,7 @@ export default {
}
},
/**
* Lookup239: kusama_runtime::SessionKeys
* Lookup241: kusama_runtime::SessionKeys
**/
KusamaRuntimeSessionKeys: {
grandpa: 'SpFinalityGrandpaAppPublic',
@@ -432,7 +429,7 @@ export default {
authorityDiscovery: 'SpAuthorityDiscoveryAppPublic'
},
/**
* Lookup369: kusama_runtime::NposCompactSolution24
* Lookup371: kusama_runtime::NposCompactSolution24
**/
KusamaRuntimeNposCompactSolution24: {
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
@@ -461,7 +458,7 @@ export default {
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
},
/**
* Lookup502: xcm::VersionedXcm<Call>
* Lookup504: xcm::VersionedXcm<Call>
**/
XcmVersionedXcm: {
_enum: {
@@ -471,7 +468,7 @@ export default {
}
},
/**
* Lookup503: xcm::v0::Xcm<Call>
* Lookup505: xcm::v0::Xcm<Call>
**/
XcmV0Xcm: {
_enum: {
@@ -501,12 +498,9 @@ export default {
effects: 'Vec<XcmV0Order>',
},
Transact: {
_alias: {
call_: 'call',
},
originType: 'XcmV0OriginKind',
requireWeightAtMost: 'u64',
call_: 'XcmDoubleEncoded',
call: 'XcmDoubleEncoded',
},
HrmpNewChannelOpenRequest: {
sender: 'Compact<u32>',
@@ -528,7 +522,7 @@ export default {
}
},
/**
* Lookup505: xcm::v0::order::Order<Call>
* Lookup507: xcm::v0::order::Order<Call>
**/
XcmV0Order: {
_enum: {
@@ -571,7 +565,7 @@ export default {
}
},
/**
* Lookup507: xcm::v0::Response
* Lookup509: xcm::v0::Response
**/
XcmV0Response: {
_enum: {
@@ -579,7 +573,7 @@ export default {
}
},
/**
* Lookup508: xcm::v1::Xcm<Call>
* Lookup510: xcm::v1::Xcm<Call>
**/
XcmV1Xcm: {
_enum: {
@@ -609,12 +603,9 @@ export default {
effects: 'Vec<XcmV1Order>',
},
Transact: {
_alias: {
call_: 'call',
},
originType: 'XcmV0OriginKind',
requireWeightAtMost: 'u64',
call_: 'XcmDoubleEncoded',
call: 'XcmDoubleEncoded',
},
HrmpNewChannelOpenRequest: {
sender: 'Compact<u32>',
@@ -641,7 +632,7 @@ export default {
}
},
/**
* Lookup510: xcm::v1::order::Order<Call>
* Lookup512: xcm::v1::order::Order<Call>
**/
XcmV1Order: {
_enum: {
@@ -686,7 +677,7 @@ export default {
}
},
/**
* Lookup512: xcm::v1::Response
* Lookup514: xcm::v1::Response
**/
XcmV1Response: {
_enum: {
@@ -695,7 +686,7 @@ export default {
}
},
/**
* Lookup573: kusama_runtime::OriginCaller
* Lookup575: kusama_runtime::OriginCaller
**/
KusamaRuntimeOriginCaller: {
_enum: {
@@ -802,7 +793,7 @@ export default {
}
},
/**
* Lookup578: pallet_xcm::pallet::Origin
* Lookup580: pallet_xcm::pallet::Origin
**/
PalletXcmOrigin: {
_enum: {
@@ -811,7 +802,7 @@ export default {
}
},
/**
* Lookup682: pallet_xcm::pallet::QueryStatus<BlockNumber>
* Lookup689: pallet_xcm::pallet::QueryStatus<BlockNumber>
**/
PalletXcmQueryStatus: {
_enum: {
@@ -831,7 +822,7 @@ export default {
}
},
/**
* Lookup685: xcm::VersionedResponse
* Lookup692: xcm::VersionedResponse
**/
XcmVersionedResponse: {
_enum: {
@@ -841,7 +832,7 @@ export default {
}
},
/**
* Lookup691: pallet_xcm::pallet::VersionMigrationStage
* Lookup698: pallet_xcm::pallet::VersionMigrationStage
**/
PalletXcmVersionMigrationStage: {
_enum: {
@@ -852,7 +843,7 @@ export default {
}
},
/**
* Lookup703: kusama_runtime::Runtime
* Lookup710: kusama_runtime::Runtime
**/
KusamaRuntimeRuntime: 'Null'
} as DefinitionsTypes;
+47 -47
View File
@@ -60,40 +60,32 @@ export default {
**/
XcmV2TraitsError: {
_enum: {
Undefined: 'Null',
Overflow: 'Null',
Unimplemented: 'Null',
UnhandledXcmVersion: 'Null',
UnhandledXcmMessage: 'Null',
UnhandledEffect: 'Null',
EscalationOfPrivilege: 'Null',
UntrustedReserveLocation: 'Null',
UntrustedTeleportLocation: 'Null',
DestinationBufferOverflow: 'Null',
MultiLocationFull: 'Null',
MultiLocationNotInvertible: 'Null',
FailedToDecode: 'Null',
BadOrigin: 'Null',
ExceedsMaxMessageSize: 'Null',
InvalidLocation: 'Null',
AssetNotFound: 'Null',
FailedToTransactAsset: 'Null',
WeightLimitReached: 'u64',
Wildcard: 'Null',
TooMuchWeightRequired: 'Null',
NotHoldingFees: 'Null',
WeightNotComputable: 'Null',
Barrier: 'Null',
NotWithdrawable: 'Null',
LocationCannotHold: 'Null',
TooExpensive: 'Null',
AssetNotFound: 'Null',
ExceedsMaxMessageSize: 'Null',
DestinationUnsupported: 'Null',
RecursionLimitReached: 'Null',
Transport: 'Null',
Unroutable: 'Null',
UnknownWeightRequired: 'Null',
Trap: 'u64',
UnknownClaim: 'Null',
InvalidLocation: 'Null'
FailedToDecode: 'Null',
TooMuchWeightRequired: 'Null',
NotHoldingFees: 'Null',
TooExpensive: 'Null',
Trap: 'u64',
UnhandledXcmVersion: 'Null',
WeightLimitReached: 'u64',
Barrier: 'Null',
WeightNotComputable: 'Null'
}
},
/**
@@ -336,7 +328,7 @@ export default {
}
},
/**
* Lookup506: polkadot_runtime_parachains::configuration::HostConfiguration<BlockNumber>
* Lookup508: polkadot_runtime_parachains::configuration::HostConfiguration<BlockNumber>
**/
PolkadotRuntimeParachainsConfigurationHostConfiguration: {
maxCodeSize: 'u32',
@@ -381,14 +373,14 @@ export default {
umpMaxIndividualWeight: 'u64'
},
/**
* Lookup510: polkadot_runtime_parachains::inclusion::AvailabilityBitfieldRecord<N>
* Lookup512: polkadot_runtime_parachains::inclusion::AvailabilityBitfieldRecord<N>
**/
PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord: {
bitfield: 'BitVec',
submittedAt: 'u32'
},
/**
* Lookup511: polkadot_runtime_parachains::inclusion::CandidatePendingAvailability<primitive_types::H256, N>
* Lookup513: polkadot_runtime_parachains::inclusion::CandidatePendingAvailability<primitive_types::H256, N>
**/
PolkadotRuntimeParachainsInclusionCandidatePendingAvailability: {
_alias: {
@@ -404,32 +396,40 @@ export default {
backingGroup: 'u32'
},
/**
* Lookup515: polkadot_runtime_parachains::scheduler::ParathreadClaimQueue
* Lookup515: polkadot_primitives::v1::ScrapedOnChainVotes<primitive_types::H256>
**/
PolkadotPrimitivesV1ScrapedOnChainVotes: {
session: 'u32',
backingValidatorsPerCandidate: 'Vec<(PolkadotPrimitivesV1CandidateReceipt,Vec<(u32,PolkadotPrimitivesV0ValidityAttestation)>)>',
disputes: 'Vec<PolkadotPrimitivesV1DisputeStatementSet>'
},
/**
* Lookup522: polkadot_runtime_parachains::scheduler::ParathreadClaimQueue
**/
PolkadotRuntimeParachainsSchedulerParathreadClaimQueue: {
queue: 'Vec<PolkadotRuntimeParachainsSchedulerQueuedParathread>',
nextCoreOffset: 'u32'
},
/**
* Lookup517: polkadot_runtime_parachains::scheduler::QueuedParathread
* Lookup524: polkadot_runtime_parachains::scheduler::QueuedParathread
**/
PolkadotRuntimeParachainsSchedulerQueuedParathread: {
claim: 'PolkadotPrimitivesV1ParathreadEntry',
coreOffset: 'u32'
},
/**
* Lookup518: polkadot_primitives::v1::ParathreadEntry
* Lookup525: polkadot_primitives::v1::ParathreadEntry
**/
PolkadotPrimitivesV1ParathreadEntry: {
claim: 'PolkadotPrimitivesV1ParathreadClaim',
retries: 'u32'
},
/**
* Lookup519: polkadot_primitives::v1::ParathreadClaim
* Lookup526: polkadot_primitives::v1::ParathreadClaim
**/
PolkadotPrimitivesV1ParathreadClaim: '(u32,PolkadotPrimitivesV0CollatorAppPublic)',
/**
* Lookup522: polkadot_primitives::v1::CoreOccupied
* Lookup529: polkadot_primitives::v1::CoreOccupied
**/
PolkadotPrimitivesV1CoreOccupied: {
_enum: {
@@ -438,7 +438,7 @@ export default {
}
},
/**
* Lookup525: polkadot_runtime_parachains::scheduler::CoreAssignment
* Lookup532: polkadot_runtime_parachains::scheduler::CoreAssignment
**/
PolkadotRuntimeParachainsSchedulerCoreAssignment: {
core: 'u32',
@@ -447,7 +447,7 @@ export default {
groupIdx: 'u32'
},
/**
* Lookup526: polkadot_runtime_parachains::scheduler::AssignmentKind
* Lookup533: polkadot_runtime_parachains::scheduler::AssignmentKind
**/
PolkadotRuntimeParachainsSchedulerAssignmentKind: {
_enum: {
@@ -456,39 +456,39 @@ export default {
}
},
/**
* Lookup527: polkadot_runtime_parachains::paras::ParaLifecycle
* Lookup534: polkadot_runtime_parachains::paras::ParaLifecycle
**/
PolkadotRuntimeParachainsParasParaLifecycle: {
_enum: ['Onboarding', 'Parathread', 'Parachain', 'UpgradingParathread', 'DowngradingParachain', 'OffboardingParathread', 'OffboardingParachain']
},
/**
* Lookup529: polkadot_runtime_parachains::paras::ParaPastCodeMeta<N>
* Lookup536: polkadot_runtime_parachains::paras::ParaPastCodeMeta<N>
**/
PolkadotRuntimeParachainsParasParaPastCodeMeta: {
upgradeTimes: 'Vec<PolkadotRuntimeParachainsParasReplacementTimes>',
lastPruned: 'Option<u32>'
},
/**
* Lookup531: polkadot_runtime_parachains::paras::ReplacementTimes<N>
* Lookup538: polkadot_runtime_parachains::paras::ReplacementTimes<N>
**/
PolkadotRuntimeParachainsParasReplacementTimes: {
expectedAt: 'u32',
activatedAt: 'u32'
},
/**
* Lookup533: polkadot_primitives::v1::UpgradeGoAhead
* Lookup540: polkadot_primitives::v1::UpgradeGoAhead
**/
PolkadotPrimitivesV1UpgradeGoAhead: {
_enum: ['Abort', 'GoAhead']
},
/**
* Lookup534: polkadot_primitives::v1::UpgradeRestriction
* Lookup541: polkadot_primitives::v1::UpgradeRestriction
**/
PolkadotPrimitivesV1UpgradeRestriction: {
_enum: ['Present']
},
/**
* Lookup535: polkadot_runtime_parachains::paras::ParaGenesisArgs
* Lookup542: polkadot_runtime_parachains::paras::ParaGenesisArgs
**/
PolkadotRuntimeParachainsParasParaGenesisArgs: {
genesisHead: 'Bytes',
@@ -496,7 +496,7 @@ export default {
parachain: 'bool'
},
/**
* Lookup538: polkadot_runtime_parachains::initializer::BufferedSessionChange
* Lookup545: polkadot_runtime_parachains::initializer::BufferedSessionChange
**/
PolkadotRuntimeParachainsInitializerBufferedSessionChange: {
validators: 'Vec<PolkadotPrimitivesV0ValidatorAppPublic>',
@@ -504,14 +504,14 @@ export default {
sessionIndex: 'u32'
},
/**
* Lookup540: polkadot_core_primitives::InboundDownwardMessage<BlockNumber>
* Lookup547: polkadot_core_primitives::InboundDownwardMessage<BlockNumber>
**/
PolkadotCorePrimitivesInboundDownwardMessage: {
sentAt: 'u32',
msg: 'Bytes'
},
/**
* Lookup543: polkadot_runtime_parachains::hrmp::HrmpOpenChannelRequest
* Lookup550: polkadot_runtime_parachains::hrmp::HrmpOpenChannelRequest
**/
PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest: {
confirmed: 'bool',
@@ -522,7 +522,7 @@ export default {
maxTotalSize: 'u32'
},
/**
* Lookup545: polkadot_runtime_parachains::hrmp::HrmpChannel
* Lookup552: polkadot_runtime_parachains::hrmp::HrmpChannel
**/
PolkadotRuntimeParachainsHrmpHrmpChannel: {
maxCapacity: 'u32',
@@ -535,14 +535,14 @@ export default {
recipientDeposit: 'u128'
},
/**
* Lookup548: polkadot_core_primitives::InboundHrmpMessage<BlockNumber>
* Lookup555: polkadot_core_primitives::InboundHrmpMessage<BlockNumber>
**/
PolkadotCorePrimitivesInboundHrmpMessage: {
sentAt: 'u32',
data: 'Bytes'
},
/**
* Lookup553: polkadot_primitives::v1::SessionInfo
* Lookup560: polkadot_primitives::v1::SessionInfo
**/
PolkadotPrimitivesV1SessionInfo: {
validators: 'Vec<PolkadotPrimitivesV0ValidatorAppPublic>',
@@ -557,7 +557,7 @@ export default {
neededApprovals: 'u32'
},
/**
* Lookup555: polkadot_runtime_common::paras_registrar::ParaInfo<sp_core::crypto::AccountId32, Balance>
* Lookup562: polkadot_runtime_common::paras_registrar::ParaInfo<sp_core::crypto::AccountId32, Balance>
**/
PolkadotRuntimeCommonParasRegistrarParaInfo: {
manager: 'AccountId32',
@@ -565,7 +565,7 @@ export default {
locked: 'bool'
},
/**
* Lookup565: polkadot_runtime_common::crowdloan::FundInfo<sp_core::crypto::AccountId32, Balance, BlockNumber, LeasePeriod>
* Lookup572: polkadot_runtime_common::crowdloan::FundInfo<sp_core::crypto::AccountId32, Balance, BlockNumber, LeasePeriod>
**/
PolkadotRuntimeCommonCrowdloanFundInfo: {
depositor: 'AccountId32',
@@ -580,7 +580,7 @@ export default {
trieIndex: 'u32'
},
/**
* Lookup566: polkadot_runtime_common::crowdloan::LastContribution<BlockNumber>
* Lookup573: polkadot_runtime_common::crowdloan::LastContribution<BlockNumber>
**/
PolkadotRuntimeCommonCrowdloanLastContribution: {
_enum: {
@@ -590,11 +590,11 @@ export default {
}
},
/**
* Lookup578: polkadot_runtime_common::claims::PrevalidateAttests<T>
* Lookup585: polkadot_runtime_common::claims::PrevalidateAttests<T>
**/
PolkadotRuntimeCommonClaimsPrevalidateAttests: 'Null',
/**
* Lookup579: polkadot_runtime::Runtime
* Lookup586: polkadot_runtime::Runtime
**/
PolkadotRuntimeRuntime: 'Null'
} as DefinitionsTypes;
+76 -81
View File
@@ -755,17 +755,17 @@ export default {
paidOut: 'u128'
},
/**
* Lookup361: pallet_staking::Releases
* Lookup363: pallet_staking::Releases
**/
PalletStakingReleases: {
_enum: ['V1_0_0Ancient', 'V2_0_0', 'V3_0_0', 'V4_0_0', 'V5_0_0', 'V6_0_0', 'V7_0_0', 'V8_0_0']
},
/**
* Lookup366: sp_core::crypto::KeyTypeId
* Lookup368: sp_core::crypto::KeyTypeId
**/
SpCoreCryptoKeyTypeId: '[u8;4]',
/**
* Lookup371: pallet_democracy::PreimageStatus<sp_core::crypto::AccountId32, Balance, BlockNumber>
* Lookup373: pallet_democracy::PreimageStatus<sp_core::crypto::AccountId32, Balance, BlockNumber>
**/
PalletDemocracyPreimageStatus: {
_enum: {
@@ -780,7 +780,7 @@ export default {
}
},
/**
* Lookup372: pallet_democracy::types::ReferendumInfo<BlockNumber, primitive_types::H256, Balance>
* Lookup374: pallet_democracy::types::ReferendumInfo<BlockNumber, primitive_types::H256, Balance>
**/
PalletDemocracyReferendumInfo: {
_enum: {
@@ -792,7 +792,7 @@ export default {
}
},
/**
* Lookup373: pallet_democracy::types::ReferendumStatus<BlockNumber, primitive_types::H256, Balance>
* Lookup375: pallet_democracy::types::ReferendumStatus<BlockNumber, primitive_types::H256, Balance>
**/
PalletDemocracyReferendumStatus: {
end: 'u32',
@@ -802,7 +802,7 @@ export default {
tally: 'PalletDemocracyTally'
},
/**
* Lookup374: pallet_democracy::types::Tally<Balance>
* Lookup376: pallet_democracy::types::Tally<Balance>
**/
PalletDemocracyTally: {
ayes: 'u128',
@@ -810,7 +810,7 @@ export default {
turnout: 'u128'
},
/**
* Lookup375: pallet_democracy::vote::Voting<Balance, sp_core::crypto::AccountId32, BlockNumber>
* Lookup377: pallet_democracy::vote::Voting<Balance, sp_core::crypto::AccountId32, BlockNumber>
**/
PalletDemocracyVoteVoting: {
_enum: {
@@ -829,24 +829,24 @@ export default {
}
},
/**
* Lookup378: pallet_democracy::types::Delegations<Balance>
* Lookup380: pallet_democracy::types::Delegations<Balance>
**/
PalletDemocracyDelegations: {
votes: 'u128',
capital: 'u128'
},
/**
* Lookup379: pallet_democracy::vote::PriorLock<BlockNumber, Balance>
* Lookup381: pallet_democracy::vote::PriorLock<BlockNumber, Balance>
**/
PalletDemocracyVotePriorLock: '(u32,u128)',
/**
* Lookup382: pallet_democracy::Releases
* Lookup384: pallet_democracy::Releases
**/
PalletDemocracyReleases: {
_enum: ['V1']
},
/**
* Lookup385: pallet_collective::Votes<sp_core::crypto::AccountId32, BlockNumber>
* Lookup387: pallet_collective::Votes<sp_core::crypto::AccountId32, BlockNumber>
**/
PalletCollectiveVotes: {
index: 'u32',
@@ -856,7 +856,7 @@ export default {
end: 'u32'
},
/**
* Lookup390: pallet_elections_phragmen::SeatHolder<sp_core::crypto::AccountId32, Balance>
* Lookup392: pallet_elections_phragmen::SeatHolder<sp_core::crypto::AccountId32, Balance>
**/
PalletElectionsPhragmenSeatHolder: {
who: 'AccountId32',
@@ -864,7 +864,7 @@ export default {
deposit: 'u128'
},
/**
* Lookup391: pallet_elections_phragmen::Voter<sp_core::crypto::AccountId32, Balance>
* Lookup393: pallet_elections_phragmen::Voter<sp_core::crypto::AccountId32, Balance>
**/
PalletElectionsPhragmenVoter: {
votes: 'Vec<AccountId32>',
@@ -872,7 +872,7 @@ export default {
deposit: 'u128'
},
/**
* Lookup394: pallet_grandpa::StoredState<N>
* Lookup396: pallet_grandpa::StoredState<N>
**/
PalletGrandpaStoredState: {
_enum: {
@@ -889,7 +889,7 @@ export default {
}
},
/**
* Lookup395: pallet_grandpa::StoredPendingChange<N, Limit>
* Lookup397: pallet_grandpa::StoredPendingChange<N, Limit>
**/
PalletGrandpaStoredPendingChange: {
scheduledAt: 'u32',
@@ -898,7 +898,7 @@ export default {
forced: 'Option<u32>'
},
/**
* Lookup398: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
* Lookup400: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
**/
PalletTreasuryProposal: {
proposer: 'AccountId32',
@@ -907,11 +907,11 @@ export default {
bond: 'u128'
},
/**
* Lookup401: frame_support::PalletId
* Lookup403: frame_support::PalletId
**/
FrameSupportPalletId: '[u8;8]',
/**
* Lookup403: pallet_contracts::wasm::PrefabWasmModule<T>
* Lookup405: pallet_contracts::wasm::PrefabWasmModule<T>
**/
PalletContractsWasmPrefabWasmModule: {
instructionWeightsVersion: 'Compact<u32>',
@@ -923,7 +923,7 @@ export default {
originalCodeLen: 'u32'
},
/**
* Lookup405: pallet_contracts::storage::RawContractInfo<primitive_types::H256>
* Lookup407: pallet_contracts::storage::RawContractInfo<primitive_types::H256>
**/
PalletContractsStorageRawContractInfo: {
trieId: 'Bytes',
@@ -931,13 +931,13 @@ export default {
reserved: 'Option<Null>'
},
/**
* Lookup407: pallet_contracts::storage::DeletedContract
* Lookup409: pallet_contracts::storage::DeletedContract
**/
PalletContractsStorageDeletedContract: {
trieId: 'Bytes'
},
/**
* Lookup408: pallet_contracts::schedule::Schedule<T>
* Lookup410: pallet_contracts::schedule::Schedule<T>
**/
PalletContractsSchedule: {
limits: 'PalletContractsScheduleLimits',
@@ -945,7 +945,7 @@ export default {
hostFnWeights: 'PalletContractsScheduleHostFnWeights'
},
/**
* Lookup409: pallet_contracts::schedule::Limits
* Lookup411: pallet_contracts::schedule::Limits
**/
PalletContractsScheduleLimits: {
eventTopics: 'u32',
@@ -961,12 +961,11 @@ export default {
codeLen: 'u32'
},
/**
* Lookup410: pallet_contracts::schedule::InstructionWeights<T>
* Lookup412: pallet_contracts::schedule::InstructionWeights<T>
**/
PalletContractsScheduleInstructionWeights: {
_alias: {
r_if: 'r#if',
call_: 'call'
r_if: 'r#if'
},
version: 'u32',
i64Const: 'u32',
@@ -978,7 +977,7 @@ export default {
brIf: 'u32',
brTable: 'u32',
brTablePerEntry: 'u32',
call_: 'u32',
call: 'u32',
callIndirect: 'u32',
callIndirectPerParam: 'u32',
localGet: 'u32',
@@ -1022,12 +1021,11 @@ export default {
i64Rotr: 'u32'
},
/**
* Lookup411: pallet_contracts::schedule::HostFnWeights<T>
* Lookup413: pallet_contracts::schedule::HostFnWeights<T>
**/
PalletContractsScheduleHostFnWeights: {
_alias: {
r_return: 'r#return',
call_: 'call'
r_return: 'r#return'
},
caller: 'u64',
address: 'u64',
@@ -1056,7 +1054,7 @@ export default {
getStorage: 'u64',
getStoragePerByte: 'u64',
transfer: 'u64',
call_: 'u64',
call: 'u64',
callTransferSurcharge: 'u64',
callPerInputByte: 'u64',
callPerOutputByte: 'u64',
@@ -1075,21 +1073,21 @@ export default {
ecdsaRecover: 'u64'
},
/**
* Lookup417: pallet_im_online::BoundedOpaqueNetworkState<PeerIdEncodingLimit, MultiAddrEncodingLimit, AddressesLimit>
* Lookup419: pallet_im_online::BoundedOpaqueNetworkState<PeerIdEncodingLimit, MultiAddrEncodingLimit, AddressesLimit>
**/
PalletImOnlineBoundedOpaqueNetworkState: {
peerId: 'Bytes',
externalAddresses: 'Vec<Bytes>'
},
/**
* Lookup422: sp_staking::offence::OffenceDetails<sp_core::crypto::AccountId32, Offender>
* Lookup424: sp_staking::offence::OffenceDetails<sp_core::crypto::AccountId32, Offender>
**/
SpStakingOffenceOffenceDetails: {
offender: '(AccountId32,PalletStakingExposure)',
reporters: 'Vec<AccountId32>'
},
/**
* Lookup424: pallet_identity::types::Registration<Balance, MaxJudgements, MaxAdditionalFields>
* Lookup426: pallet_identity::types::Registration<Balance, MaxJudgements, MaxAdditionalFields>
**/
PalletIdentityRegistration: {
judgements: 'Vec<(u32,PalletIdentityJudgement)>',
@@ -1097,7 +1095,7 @@ export default {
info: 'PalletIdentityIdentityInfo'
},
/**
* Lookup432: pallet_identity::types::RegistrarInfo<Balance, sp_core::crypto::AccountId32>
* Lookup434: pallet_identity::types::RegistrarInfo<Balance, sp_core::crypto::AccountId32>
**/
PalletIdentityRegistrarInfo: {
account: 'AccountId32',
@@ -1105,7 +1103,7 @@ export default {
fields: 'PalletIdentityBitFlags'
},
/**
* Lookup436: pallet_society::Bid<sp_core::crypto::AccountId32, Balance>
* Lookup438: pallet_society::Bid<sp_core::crypto::AccountId32, Balance>
**/
PalletSocietyBid: {
who: 'AccountId32',
@@ -1113,7 +1111,7 @@ export default {
value: 'u128'
},
/**
* Lookup437: pallet_society::BidKind<sp_core::crypto::AccountId32, Balance>
* Lookup439: pallet_society::BidKind<sp_core::crypto::AccountId32, Balance>
**/
PalletSocietyBidKind: {
_enum: {
@@ -1122,19 +1120,19 @@ export default {
}
},
/**
* Lookup439: pallet_society::VouchingStatus
* Lookup441: pallet_society::VouchingStatus
**/
PalletSocietyVouchingStatus: {
_enum: ['Vouching', 'Banned']
},
/**
* Lookup443: pallet_society::Vote
* Lookup445: pallet_society::Vote
**/
PalletSocietyVote: {
_enum: ['Skeptic', 'Reject', 'Approve']
},
/**
* Lookup445: pallet_recovery::RecoveryConfig<BlockNumber, Balance, sp_core::crypto::AccountId32>
* Lookup447: pallet_recovery::RecoveryConfig<BlockNumber, Balance, sp_core::crypto::AccountId32>
**/
PalletRecoveryRecoveryConfig: {
delayPeriod: 'u32',
@@ -1143,7 +1141,7 @@ export default {
threshold: 'u16'
},
/**
* Lookup446: pallet_recovery::ActiveRecovery<BlockNumber, Balance, sp_core::crypto::AccountId32>
* Lookup448: pallet_recovery::ActiveRecovery<BlockNumber, Balance, sp_core::crypto::AccountId32>
**/
PalletRecoveryActiveRecovery: {
created: 'u32',
@@ -1151,26 +1149,23 @@ export default {
friends: 'Vec<AccountId32>'
},
/**
* Lookup450: pallet_vesting::Releases
* Lookup452: pallet_vesting::Releases
**/
PalletVestingReleases: {
_enum: ['V0', 'V1']
},
/**
* Lookup454: pallet_scheduler::ScheduledV2<node_runtime::Call, BlockNumber, node_runtime::OriginCaller, sp_core::crypto::AccountId32>
* Lookup456: pallet_scheduler::ScheduledV2<node_runtime::Call, BlockNumber, node_runtime::OriginCaller, sp_core::crypto::AccountId32>
**/
PalletSchedulerScheduledV2: {
_alias: {
call_: 'call'
},
maybeId: 'Option<Bytes>',
priority: 'u8',
call_: 'Call',
call: 'Call',
maybePeriodic: 'Option<(u32,u32)>',
origin: 'NodeRuntimeOriginCaller'
},
/**
* Lookup455: node_runtime::OriginCaller
* Lookup457: node_runtime::OriginCaller
**/
NodeRuntimeOriginCaller: {
_enum: {
@@ -1191,7 +1186,7 @@ export default {
}
},
/**
* Lookup456: frame_system::RawOrigin<sp_core::crypto::AccountId32>
* Lookup458: frame_system::RawOrigin<sp_core::crypto::AccountId32>
**/
FrameSystemRawOrigin: {
_enum: {
@@ -1201,7 +1196,7 @@ export default {
}
},
/**
* Lookup457: pallet_collective::RawOrigin<sp_core::crypto::AccountId32, I>
* Lookup459: pallet_collective::RawOrigin<sp_core::crypto::AccountId32, I>
**/
PalletCollectiveRawOrigin: {
_enum: {
@@ -1211,17 +1206,17 @@ export default {
}
},
/**
* Lookup459: sp_core::Void
* Lookup461: sp_core::Void
**/
SpCoreVoid: 'Null',
/**
* Lookup460: pallet_scheduler::Releases
* Lookup462: pallet_scheduler::Releases
**/
PalletSchedulerReleases: {
_enum: ['V1', 'V2']
},
/**
* Lookup464: pallet_proxy::ProxyDefinition<sp_core::crypto::AccountId32, node_runtime::ProxyType, BlockNumber>
* Lookup466: pallet_proxy::ProxyDefinition<sp_core::crypto::AccountId32, node_runtime::ProxyType, BlockNumber>
**/
PalletProxyProxyDefinition: {
delegate: 'AccountId32',
@@ -1229,7 +1224,7 @@ export default {
delay: 'u32'
},
/**
* Lookup468: pallet_proxy::Announcement<sp_core::crypto::AccountId32, primitive_types::H256, BlockNumber>
* Lookup470: pallet_proxy::Announcement<sp_core::crypto::AccountId32, primitive_types::H256, BlockNumber>
**/
PalletProxyAnnouncement: {
real: 'AccountId32',
@@ -1237,7 +1232,7 @@ export default {
height: 'u32'
},
/**
* Lookup472: pallet_multisig::Multisig<BlockNumber, Balance, sp_core::crypto::AccountId32>
* Lookup474: pallet_multisig::Multisig<BlockNumber, Balance, sp_core::crypto::AccountId32>
**/
PalletMultisigMultisig: {
when: 'PalletMultisigTimepoint',
@@ -1246,7 +1241,7 @@ export default {
approvals: 'Vec<AccountId32>'
},
/**
* Lookup475: pallet_bounties::Bounty<sp_core::crypto::AccountId32, Balance, BlockNumber>
* Lookup477: pallet_bounties::Bounty<sp_core::crypto::AccountId32, Balance, BlockNumber>
**/
PalletBountiesBounty: {
proposer: 'AccountId32',
@@ -1257,7 +1252,7 @@ export default {
status: 'PalletBountiesBountyStatus'
},
/**
* Lookup476: pallet_bounties::BountyStatus<sp_core::crypto::AccountId32, BlockNumber>
* Lookup478: pallet_bounties::BountyStatus<sp_core::crypto::AccountId32, BlockNumber>
**/
PalletBountiesBountyStatus: {
_enum: {
@@ -1279,7 +1274,7 @@ export default {
}
},
/**
* Lookup478: pallet_tips::OpenTip<sp_core::crypto::AccountId32, Balance, BlockNumber, primitive_types::H256>
* Lookup480: pallet_tips::OpenTip<sp_core::crypto::AccountId32, Balance, BlockNumber, primitive_types::H256>
**/
PalletTipsOpenTip: {
reason: 'H256',
@@ -1291,7 +1286,7 @@ export default {
findersFee: 'bool'
},
/**
* Lookup480: pallet_assets::types::AssetDetails<Balance, sp_core::crypto::AccountId32, DepositBalance>
* Lookup482: pallet_assets::types::AssetDetails<Balance, sp_core::crypto::AccountId32, DepositBalance>
**/
PalletAssetsAssetDetails: {
owner: 'AccountId32',
@@ -1308,7 +1303,7 @@ export default {
isFrozen: 'bool'
},
/**
* Lookup481: pallet_assets::types::AssetBalance<Balance, Extra>
* Lookup483: pallet_assets::types::AssetBalance<Balance, Extra>
**/
PalletAssetsAssetBalance: {
balance: 'u64',
@@ -1317,14 +1312,14 @@ export default {
extra: 'Null'
},
/**
* Lookup483: pallet_assets::types::Approval<Balance, DepositBalance>
* Lookup485: pallet_assets::types::Approval<Balance, DepositBalance>
**/
PalletAssetsApproval: {
amount: 'u64',
deposit: 'u128'
},
/**
* Lookup484: pallet_assets::types::AssetMetadata<DepositBalance, frame_support::storage::bounded_vec::BoundedVec<T, S>>
* Lookup486: pallet_assets::types::AssetMetadata<DepositBalance, frame_support::storage::bounded_vec::BoundedVec<T, S>>
**/
PalletAssetsAssetMetadata: {
deposit: 'u128',
@@ -1334,7 +1329,7 @@ export default {
isFrozen: 'bool'
},
/**
* Lookup486: pallet_lottery::LotteryConfig<BlockNumber, Balance>
* Lookup488: pallet_lottery::LotteryConfig<BlockNumber, Balance>
**/
PalletLotteryLotteryConfig: {
price: 'u128',
@@ -1344,14 +1339,14 @@ export default {
repeat: 'bool'
},
/**
* Lookup491: pallet_gilt::pallet::GiltBid<Balance, sp_core::crypto::AccountId32>
* Lookup493: pallet_gilt::pallet::GiltBid<Balance, sp_core::crypto::AccountId32>
**/
PalletGiltGiltBid: {
amount: 'u128',
who: 'AccountId32'
},
/**
* Lookup492: pallet_gilt::pallet::ActiveGiltsTotal<Balance>
* Lookup494: pallet_gilt::pallet::ActiveGiltsTotal<Balance>
**/
PalletGiltActiveGiltsTotal: {
frozen: 'u128',
@@ -1360,7 +1355,7 @@ export default {
target: 'Perquintill'
},
/**
* Lookup493: pallet_gilt::pallet::ActiveGilt<Balance, sp_core::crypto::AccountId32, BlockNumber>
* Lookup495: pallet_gilt::pallet::ActiveGilt<Balance, sp_core::crypto::AccountId32, BlockNumber>
**/
PalletGiltActiveGilt: {
proportion: 'Perquintill',
@@ -1369,7 +1364,7 @@ export default {
expiry: 'u32'
},
/**
* Lookup495: pallet_uniques::types::ClassDetails<sp_core::crypto::AccountId32, DepositBalance>
* Lookup497: pallet_uniques::types::ClassDetails<sp_core::crypto::AccountId32, DepositBalance>
**/
PalletUniquesClassDetails: {
owner: 'AccountId32',
@@ -1384,7 +1379,7 @@ export default {
isFrozen: 'bool'
},
/**
* Lookup497: pallet_uniques::types::InstanceDetails<sp_core::crypto::AccountId32, DepositBalance>
* Lookup499: pallet_uniques::types::InstanceDetails<sp_core::crypto::AccountId32, DepositBalance>
**/
PalletUniquesInstanceDetails: {
owner: 'AccountId32',
@@ -1393,7 +1388,7 @@ export default {
deposit: 'u128'
},
/**
* Lookup498: pallet_uniques::types::ClassMetadata<DepositBalance, StringLimit>
* Lookup500: pallet_uniques::types::ClassMetadata<DepositBalance, StringLimit>
**/
PalletUniquesClassMetadata: {
deposit: 'u128',
@@ -1401,7 +1396,7 @@ export default {
isFrozen: 'bool'
},
/**
* Lookup499: pallet_uniques::types::InstanceMetadata<DepositBalance, StringLimit>
* Lookup501: pallet_uniques::types::InstanceMetadata<DepositBalance, StringLimit>
**/
PalletUniquesInstanceMetadata: {
deposit: 'u128',
@@ -1409,7 +1404,7 @@ export default {
isFrozen: 'bool'
},
/**
* Lookup504: pallet_transaction_storage::TransactionInfo
* Lookup506: pallet_transaction_storage::TransactionInfo
**/
PalletTransactionStorageTransactionInfo: {
_alias: {
@@ -1421,7 +1416,7 @@ export default {
blockChunks: 'u32'
},
/**
* Lookup506: pallet_bags_list::list::Node<T>
* Lookup508: pallet_bags_list::list::Node<T>
**/
PalletBagsListListNode: {
id: 'AccountId32',
@@ -1430,14 +1425,14 @@ export default {
bagUpper: 'u64'
},
/**
* Lookup507: pallet_bags_list::list::Bag<T>
* Lookup509: pallet_bags_list::list::Bag<T>
**/
PalletBagsListListBag: {
head: 'Option<AccountId32>',
tail: 'Option<AccountId32>'
},
/**
* Lookup510: sp_runtime::MultiSignature
* Lookup512: sp_runtime::MultiSignature
**/
SpRuntimeMultiSignature: {
_enum: {
@@ -1447,35 +1442,35 @@ export default {
}
},
/**
* Lookup511: sp_core::ecdsa::Signature
* Lookup513: sp_core::ecdsa::Signature
**/
SpCoreEcdsaSignature: '[u8;65]',
/**
* Lookup514: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
* Lookup516: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
**/
FrameSystemExtensionsCheckSpecVersion: 'Null',
/**
* Lookup515: frame_system::extensions::check_tx_version::CheckTxVersion<T>
* Lookup517: frame_system::extensions::check_tx_version::CheckTxVersion<T>
**/
FrameSystemExtensionsCheckTxVersion: 'Null',
/**
* Lookup516: frame_system::extensions::check_genesis::CheckGenesis<T>
* Lookup518: frame_system::extensions::check_genesis::CheckGenesis<T>
**/
FrameSystemExtensionsCheckGenesis: 'Null',
/**
* Lookup519: frame_system::extensions::check_nonce::CheckNonce<T>
* Lookup521: frame_system::extensions::check_nonce::CheckNonce<T>
**/
FrameSystemExtensionsCheckNonce: 'Compact<u32>',
/**
* Lookup520: frame_system::extensions::check_weight::CheckWeight<T>
* Lookup522: frame_system::extensions::check_weight::CheckWeight<T>
**/
FrameSystemExtensionsCheckWeight: 'Null',
/**
* Lookup521: pallet_transaction_payment::ChargeTransactionPayment<T>
* Lookup523: pallet_transaction_payment::ChargeTransactionPayment<T>
**/
PalletTransactionPaymentChargeTransactionPayment: 'Compact<u128>',
/**
* Lookup522: node_runtime::Runtime
* Lookup524: node_runtime::Runtime
**/
NodeRuntimeRuntime: 'Null'
} as DefinitionsTypes;
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Bytes, Compact, Enum, Null, Option, Result, Struct, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { Bytes, Compact, Enum, Null, Option, Struct, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
import type { PerU16 } from '@polkadot/types/interfaces/runtime';
import type { ITuple } from '@polkadot/types/types';
@@ -156,7 +156,7 @@ declare module '@polkadot/types/lookup' {
readonly asTransact: {
readonly originType: XcmV0OriginKind;
readonly requireWeightAtMost: Compact<u64>;
readonly call_: XcmDoubleEncoded;
readonly call: XcmDoubleEncoded;
} & Struct;
readonly isHrmpNewChannelOpenRequest: boolean;
readonly asHrmpNewChannelOpenRequest: {
@@ -290,7 +290,7 @@ declare module '@polkadot/types/lookup' {
readonly isAssets: boolean;
readonly asAssets: XcmV1MultiassetMultiAssets;
readonly isExecutionResult: boolean;
readonly asExecutionResult: Result<Null, ITuple<[u32, XcmV2TraitsError]>>;
readonly asExecutionResult: Option<ITuple<[u32, XcmV2TraitsError]>>;
readonly isVersion: boolean;
readonly asVersion: u32;
}
@@ -454,7 +454,7 @@ declare module '@polkadot/types/lookup' {
readonly asV1: XcmV1MultiLocation;
}
/** @name KusamaRuntimeSessionKeys (239) */
/** @name KusamaRuntimeSessionKeys (241) */
export interface KusamaRuntimeSessionKeys extends Struct {
readonly grandpa: SpFinalityGrandpaAppPublic;
readonly babe: SpConsensusBabeAppPublic;
@@ -464,7 +464,7 @@ declare module '@polkadot/types/lookup' {
readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic;
}
/** @name KusamaRuntimeNposCompactSolution24 (369) */
/** @name KusamaRuntimeNposCompactSolution24 (371) */
export interface KusamaRuntimeNposCompactSolution24 extends Struct {
readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>;
readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>;
@@ -492,7 +492,7 @@ declare module '@polkadot/types/lookup' {
readonly votes24: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>;
}
/** @name XcmVersionedXcm (502) */
/** @name XcmVersionedXcm (504) */
export interface XcmVersionedXcm extends Enum {
readonly isV0: boolean;
readonly asV0: XcmV0Xcm;
@@ -502,7 +502,7 @@ declare module '@polkadot/types/lookup' {
readonly asV2: XcmV2Xcm;
}
/** @name XcmV0Xcm (503) */
/** @name XcmV0Xcm (505) */
export interface XcmV0Xcm extends Enum {
readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: {
@@ -539,7 +539,7 @@ declare module '@polkadot/types/lookup' {
readonly asTransact: {
readonly originType: XcmV0OriginKind;
readonly requireWeightAtMost: u64;
readonly call_: XcmDoubleEncoded;
readonly call: XcmDoubleEncoded;
} & Struct;
readonly isHrmpNewChannelOpenRequest: boolean;
readonly asHrmpNewChannelOpenRequest: {
@@ -564,7 +564,7 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name XcmV0Order (505) */
/** @name XcmV0Order (507) */
export interface XcmV0Order extends Enum {
readonly isNull: boolean;
readonly isDepositAsset: boolean;
@@ -611,13 +611,13 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name XcmV0Response (507) */
/** @name XcmV0Response (509) */
export interface XcmV0Response extends Enum {
readonly isAssets: boolean;
readonly asAssets: Vec<XcmV0MultiAsset>;
}
/** @name XcmV1Xcm (508) */
/** @name XcmV1Xcm (510) */
export interface XcmV1Xcm extends Enum {
readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: {
@@ -654,7 +654,7 @@ declare module '@polkadot/types/lookup' {
readonly asTransact: {
readonly originType: XcmV0OriginKind;
readonly requireWeightAtMost: u64;
readonly call_: XcmDoubleEncoded;
readonly call: XcmDoubleEncoded;
} & Struct;
readonly isHrmpNewChannelOpenRequest: boolean;
readonly asHrmpNewChannelOpenRequest: {
@@ -685,7 +685,7 @@ declare module '@polkadot/types/lookup' {
readonly isUnsubscribeVersion: boolean;
}
/** @name XcmV1Order (510) */
/** @name XcmV1Order (512) */
export interface XcmV1Order extends Enum {
readonly isNoop: boolean;
readonly isDepositAsset: boolean;
@@ -734,7 +734,7 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name XcmV1Response (512) */
/** @name XcmV1Response (514) */
export interface XcmV1Response extends Enum {
readonly isAssets: boolean;
readonly asAssets: XcmV1MultiassetMultiAssets;
@@ -742,7 +742,7 @@ declare module '@polkadot/types/lookup' {
readonly asVersion: u32;
}
/** @name KusamaRuntimeOriginCaller (573) */
/** @name KusamaRuntimeOriginCaller (575) */
export interface KusamaRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin;
@@ -851,7 +851,7 @@ declare module '@polkadot/types/lookup' {
readonly asXcmPallet: PalletXcmOrigin;
}
/** @name PalletXcmOrigin (578) */
/** @name PalletXcmOrigin (580) */
export interface PalletXcmOrigin extends Enum {
readonly isXcm: boolean;
readonly asXcm: XcmV1MultiLocation;
@@ -859,7 +859,7 @@ declare module '@polkadot/types/lookup' {
readonly asResponse: XcmV1MultiLocation;
}
/** @name PalletXcmQueryStatus (682) */
/** @name PalletXcmQueryStatus (689) */
export interface PalletXcmQueryStatus extends Enum {
readonly isPending: boolean;
readonly asPending: {
@@ -879,7 +879,7 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name XcmVersionedResponse (685) */
/** @name XcmVersionedResponse (692) */
export interface XcmVersionedResponse extends Enum {
readonly isV0: boolean;
readonly asV0: XcmV0Response;
@@ -889,7 +889,7 @@ declare module '@polkadot/types/lookup' {
readonly asV2: XcmV2Response;
}
/** @name PalletXcmVersionMigrationStage (691) */
/** @name PalletXcmVersionMigrationStage (698) */
export interface PalletXcmVersionMigrationStage extends Enum {
readonly isMigrateSupportedVersion: boolean;
readonly isMigrateVersionNotifiers: boolean;
@@ -898,7 +898,7 @@ declare module '@polkadot/types/lookup' {
readonly isMigrateAndNotifyOldTargets: boolean;
}
/** @name KusamaRuntimeRuntime (703) */
/** @name KusamaRuntimeRuntime (710) */
export type KusamaRuntimeRuntime = Null;
}
@@ -59,42 +59,34 @@ declare module '@polkadot/types/lookup' {
/** @name XcmV2TraitsError (96) */
export interface XcmV2TraitsError extends Enum {
readonly isUndefined: boolean;
readonly isOverflow: boolean;
readonly isUnimplemented: boolean;
readonly isUnhandledXcmVersion: boolean;
readonly isUnhandledXcmMessage: boolean;
readonly isUnhandledEffect: boolean;
readonly isEscalationOfPrivilege: boolean;
readonly isUntrustedReserveLocation: boolean;
readonly isUntrustedTeleportLocation: boolean;
readonly isDestinationBufferOverflow: boolean;
readonly isMultiLocationFull: boolean;
readonly isMultiLocationNotInvertible: boolean;
readonly isFailedToDecode: boolean;
readonly isBadOrigin: boolean;
readonly isExceedsMaxMessageSize: boolean;
readonly isInvalidLocation: boolean;
readonly isAssetNotFound: boolean;
readonly isFailedToTransactAsset: boolean;
readonly isWeightLimitReached: boolean;
readonly asWeightLimitReached: u64;
readonly isWildcard: boolean;
readonly isTooMuchWeightRequired: boolean;
readonly isNotHoldingFees: boolean;
readonly isWeightNotComputable: boolean;
readonly isBarrier: boolean;
readonly isNotWithdrawable: boolean;
readonly isLocationCannotHold: boolean;
readonly isTooExpensive: boolean;
readonly isAssetNotFound: boolean;
readonly isExceedsMaxMessageSize: boolean;
readonly isDestinationUnsupported: boolean;
readonly isRecursionLimitReached: boolean;
readonly isTransport: boolean;
readonly isUnroutable: boolean;
readonly isUnknownWeightRequired: boolean;
readonly isUnknownClaim: boolean;
readonly isFailedToDecode: boolean;
readonly isTooMuchWeightRequired: boolean;
readonly isNotHoldingFees: boolean;
readonly isTooExpensive: boolean;
readonly isTrap: boolean;
readonly asTrap: u64;
readonly isUnknownClaim: boolean;
readonly isInvalidLocation: boolean;
readonly isUnhandledXcmVersion: boolean;
readonly isWeightLimitReached: boolean;
readonly asWeightLimitReached: u64;
readonly isBarrier: boolean;
readonly isWeightNotComputable: boolean;
}
/** @name PolkadotParachainPrimitivesHrmpChannelId (98) */
@@ -315,7 +307,7 @@ declare module '@polkadot/types/lookup' {
readonly asParachain: u32;
}
/** @name PolkadotRuntimeParachainsConfigurationHostConfiguration (506) */
/** @name PolkadotRuntimeParachainsConfigurationHostConfiguration (508) */
export interface PolkadotRuntimeParachainsConfigurationHostConfiguration extends Struct {
readonly maxCodeSize: u32;
readonly maxHeadDataSize: u32;
@@ -359,13 +351,13 @@ declare module '@polkadot/types/lookup' {
readonly umpMaxIndividualWeight: u64;
}
/** @name PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord (510) */
/** @name PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord (512) */
export interface PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord extends Struct {
readonly bitfield: BitVec;
readonly submittedAt: u32;
}
/** @name PolkadotRuntimeParachainsInclusionCandidatePendingAvailability (511) */
/** @name PolkadotRuntimeParachainsInclusionCandidatePendingAvailability (513) */
export interface PolkadotRuntimeParachainsInclusionCandidatePendingAvailability extends Struct {
readonly core: u32;
readonly hash_: H256;
@@ -377,35 +369,42 @@ declare module '@polkadot/types/lookup' {
readonly backingGroup: u32;
}
/** @name PolkadotRuntimeParachainsSchedulerParathreadClaimQueue (515) */
/** @name PolkadotPrimitivesV1ScrapedOnChainVotes (515) */
export interface PolkadotPrimitivesV1ScrapedOnChainVotes extends Struct {
readonly session: u32;
readonly backingValidatorsPerCandidate: Vec<ITuple<[PolkadotPrimitivesV1CandidateReceipt, Vec<ITuple<[u32, PolkadotPrimitivesV0ValidityAttestation]>>]>>;
readonly disputes: Vec<PolkadotPrimitivesV1DisputeStatementSet>;
}
/** @name PolkadotRuntimeParachainsSchedulerParathreadClaimQueue (522) */
export interface PolkadotRuntimeParachainsSchedulerParathreadClaimQueue extends Struct {
readonly queue: Vec<PolkadotRuntimeParachainsSchedulerQueuedParathread>;
readonly nextCoreOffset: u32;
}
/** @name PolkadotRuntimeParachainsSchedulerQueuedParathread (517) */
/** @name PolkadotRuntimeParachainsSchedulerQueuedParathread (524) */
export interface PolkadotRuntimeParachainsSchedulerQueuedParathread extends Struct {
readonly claim: PolkadotPrimitivesV1ParathreadEntry;
readonly coreOffset: u32;
}
/** @name PolkadotPrimitivesV1ParathreadEntry (518) */
/** @name PolkadotPrimitivesV1ParathreadEntry (525) */
export interface PolkadotPrimitivesV1ParathreadEntry extends Struct {
readonly claim: PolkadotPrimitivesV1ParathreadClaim;
readonly retries: u32;
}
/** @name PolkadotPrimitivesV1ParathreadClaim (519) */
/** @name PolkadotPrimitivesV1ParathreadClaim (526) */
export interface PolkadotPrimitivesV1ParathreadClaim extends ITuple<[u32, PolkadotPrimitivesV0CollatorAppPublic]> {}
/** @name PolkadotPrimitivesV1CoreOccupied (522) */
/** @name PolkadotPrimitivesV1CoreOccupied (529) */
export interface PolkadotPrimitivesV1CoreOccupied extends Enum {
readonly isParathread: boolean;
readonly asParathread: PolkadotPrimitivesV1ParathreadEntry;
readonly isParachain: boolean;
}
/** @name PolkadotRuntimeParachainsSchedulerCoreAssignment (525) */
/** @name PolkadotRuntimeParachainsSchedulerCoreAssignment (532) */
export interface PolkadotRuntimeParachainsSchedulerCoreAssignment extends Struct {
readonly core: u32;
readonly paraId: u32;
@@ -413,14 +412,14 @@ declare module '@polkadot/types/lookup' {
readonly groupIdx: u32;
}
/** @name PolkadotRuntimeParachainsSchedulerAssignmentKind (526) */
/** @name PolkadotRuntimeParachainsSchedulerAssignmentKind (533) */
export interface PolkadotRuntimeParachainsSchedulerAssignmentKind extends Enum {
readonly isParachain: boolean;
readonly isParathread: boolean;
readonly asParathread: ITuple<[PolkadotPrimitivesV0CollatorAppPublic, u32]>;
}
/** @name PolkadotRuntimeParachainsParasParaLifecycle (527) */
/** @name PolkadotRuntimeParachainsParasParaLifecycle (534) */
export interface PolkadotRuntimeParachainsParasParaLifecycle extends Enum {
readonly isOnboarding: boolean;
readonly isParathread: boolean;
@@ -431,50 +430,50 @@ declare module '@polkadot/types/lookup' {
readonly isOffboardingParachain: boolean;
}
/** @name PolkadotRuntimeParachainsParasParaPastCodeMeta (529) */
/** @name PolkadotRuntimeParachainsParasParaPastCodeMeta (536) */
export interface PolkadotRuntimeParachainsParasParaPastCodeMeta extends Struct {
readonly upgradeTimes: Vec<PolkadotRuntimeParachainsParasReplacementTimes>;
readonly lastPruned: Option<u32>;
}
/** @name PolkadotRuntimeParachainsParasReplacementTimes (531) */
/** @name PolkadotRuntimeParachainsParasReplacementTimes (538) */
export interface PolkadotRuntimeParachainsParasReplacementTimes extends Struct {
readonly expectedAt: u32;
readonly activatedAt: u32;
}
/** @name PolkadotPrimitivesV1UpgradeGoAhead (533) */
/** @name PolkadotPrimitivesV1UpgradeGoAhead (540) */
export interface PolkadotPrimitivesV1UpgradeGoAhead extends Enum {
readonly isAbort: boolean;
readonly isGoAhead: boolean;
}
/** @name PolkadotPrimitivesV1UpgradeRestriction (534) */
/** @name PolkadotPrimitivesV1UpgradeRestriction (541) */
export interface PolkadotPrimitivesV1UpgradeRestriction extends Enum {
readonly isPresent: boolean;
}
/** @name PolkadotRuntimeParachainsParasParaGenesisArgs (535) */
/** @name PolkadotRuntimeParachainsParasParaGenesisArgs (542) */
export interface PolkadotRuntimeParachainsParasParaGenesisArgs extends Struct {
readonly genesisHead: Bytes;
readonly validationCode: Bytes;
readonly parachain: bool;
}
/** @name PolkadotRuntimeParachainsInitializerBufferedSessionChange (538) */
/** @name PolkadotRuntimeParachainsInitializerBufferedSessionChange (545) */
export interface PolkadotRuntimeParachainsInitializerBufferedSessionChange extends Struct {
readonly validators: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
readonly queued: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
readonly sessionIndex: u32;
}
/** @name PolkadotCorePrimitivesInboundDownwardMessage (540) */
/** @name PolkadotCorePrimitivesInboundDownwardMessage (547) */
export interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct {
readonly sentAt: u32;
readonly msg: Bytes;
}
/** @name PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest (543) */
/** @name PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest (550) */
export interface PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest extends Struct {
readonly confirmed: bool;
readonly age: u32;
@@ -484,7 +483,7 @@ declare module '@polkadot/types/lookup' {
readonly maxTotalSize: u32;
}
/** @name PolkadotRuntimeParachainsHrmpHrmpChannel (545) */
/** @name PolkadotRuntimeParachainsHrmpHrmpChannel (552) */
export interface PolkadotRuntimeParachainsHrmpHrmpChannel extends Struct {
readonly maxCapacity: u32;
readonly maxTotalSize: u32;
@@ -496,13 +495,13 @@ declare module '@polkadot/types/lookup' {
readonly recipientDeposit: u128;
}
/** @name PolkadotCorePrimitivesInboundHrmpMessage (548) */
/** @name PolkadotCorePrimitivesInboundHrmpMessage (555) */
export interface PolkadotCorePrimitivesInboundHrmpMessage extends Struct {
readonly sentAt: u32;
readonly data: Bytes;
}
/** @name PolkadotPrimitivesV1SessionInfo (553) */
/** @name PolkadotPrimitivesV1SessionInfo (560) */
export interface PolkadotPrimitivesV1SessionInfo extends Struct {
readonly validators: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
readonly discoveryKeys: Vec<SpAuthorityDiscoveryAppPublic>;
@@ -516,14 +515,14 @@ declare module '@polkadot/types/lookup' {
readonly neededApprovals: u32;
}
/** @name PolkadotRuntimeCommonParasRegistrarParaInfo (555) */
/** @name PolkadotRuntimeCommonParasRegistrarParaInfo (562) */
export interface PolkadotRuntimeCommonParasRegistrarParaInfo extends Struct {
readonly manager: AccountId32;
readonly deposit: u128;
readonly locked: bool;
}
/** @name PolkadotRuntimeCommonCrowdloanFundInfo (565) */
/** @name PolkadotRuntimeCommonCrowdloanFundInfo (572) */
export interface PolkadotRuntimeCommonCrowdloanFundInfo extends Struct {
readonly depositor: AccountId32;
readonly verifier: Option<SpRuntimeMultiSigner>;
@@ -537,7 +536,7 @@ declare module '@polkadot/types/lookup' {
readonly trieIndex: u32;
}
/** @name PolkadotRuntimeCommonCrowdloanLastContribution (566) */
/** @name PolkadotRuntimeCommonCrowdloanLastContribution (573) */
export interface PolkadotRuntimeCommonCrowdloanLastContribution extends Enum {
readonly isNever: boolean;
readonly isPreEnding: boolean;
@@ -546,10 +545,10 @@ declare module '@polkadot/types/lookup' {
readonly asEnding: u32;
}
/** @name PolkadotRuntimeCommonClaimsPrevalidateAttests (578) */
/** @name PolkadotRuntimeCommonClaimsPrevalidateAttests (585) */
export type PolkadotRuntimeCommonClaimsPrevalidateAttests = Null;
/** @name PolkadotRuntimeRuntime (579) */
/** @name PolkadotRuntimeRuntime (586) */
export type PolkadotRuntimeRuntime = Null;
}
@@ -826,7 +826,7 @@ declare module '@polkadot/types/lookup' {
readonly paidOut: u128;
}
/** @name PalletStakingReleases (361) */
/** @name PalletStakingReleases (363) */
export interface PalletStakingReleases extends Enum {
readonly isV100Ancient: boolean;
readonly isV200: boolean;
@@ -838,10 +838,10 @@ declare module '@polkadot/types/lookup' {
readonly isV800: boolean;
}
/** @name SpCoreCryptoKeyTypeId (366) */
/** @name SpCoreCryptoKeyTypeId (368) */
export interface SpCoreCryptoKeyTypeId extends U8aFixed {}
/** @name PalletDemocracyPreimageStatus (371) */
/** @name PalletDemocracyPreimageStatus (373) */
export interface PalletDemocracyPreimageStatus extends Enum {
readonly isMissing: boolean;
readonly asMissing: u32;
@@ -855,7 +855,7 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name PalletDemocracyReferendumInfo (372) */
/** @name PalletDemocracyReferendumInfo (374) */
export interface PalletDemocracyReferendumInfo extends Enum {
readonly isOngoing: boolean;
readonly asOngoing: PalletDemocracyReferendumStatus;
@@ -866,7 +866,7 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name PalletDemocracyReferendumStatus (373) */
/** @name PalletDemocracyReferendumStatus (375) */
export interface PalletDemocracyReferendumStatus extends Struct {
readonly end: u32;
readonly proposalHash: H256;
@@ -875,14 +875,14 @@ declare module '@polkadot/types/lookup' {
readonly tally: PalletDemocracyTally;
}
/** @name PalletDemocracyTally (374) */
/** @name PalletDemocracyTally (376) */
export interface PalletDemocracyTally extends Struct {
readonly ayes: u128;
readonly nays: u128;
readonly turnout: u128;
}
/** @name PalletDemocracyVoteVoting (375) */
/** @name PalletDemocracyVoteVoting (377) */
export interface PalletDemocracyVoteVoting extends Enum {
readonly isDirect: boolean;
readonly asDirect: {
@@ -900,21 +900,21 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name PalletDemocracyDelegations (378) */
/** @name PalletDemocracyDelegations (380) */
export interface PalletDemocracyDelegations extends Struct {
readonly votes: u128;
readonly capital: u128;
}
/** @name PalletDemocracyVotePriorLock (379) */
/** @name PalletDemocracyVotePriorLock (381) */
export interface PalletDemocracyVotePriorLock extends ITuple<[u32, u128]> {}
/** @name PalletDemocracyReleases (382) */
/** @name PalletDemocracyReleases (384) */
export interface PalletDemocracyReleases extends Enum {
readonly isV1: boolean;
}
/** @name PalletCollectiveVotes (385) */
/** @name PalletCollectiveVotes (387) */
export interface PalletCollectiveVotes extends Struct {
readonly index: u32;
readonly threshold: u32;
@@ -923,21 +923,21 @@ declare module '@polkadot/types/lookup' {
readonly end: u32;
}
/** @name PalletElectionsPhragmenSeatHolder (390) */
/** @name PalletElectionsPhragmenSeatHolder (392) */
export interface PalletElectionsPhragmenSeatHolder extends Struct {
readonly who: AccountId32;
readonly stake: u128;
readonly deposit: u128;
}
/** @name PalletElectionsPhragmenVoter (391) */
/** @name PalletElectionsPhragmenVoter (393) */
export interface PalletElectionsPhragmenVoter extends Struct {
readonly votes: Vec<AccountId32>;
readonly stake: u128;
readonly deposit: u128;
}
/** @name PalletGrandpaStoredState (394) */
/** @name PalletGrandpaStoredState (396) */
export interface PalletGrandpaStoredState extends Enum {
readonly isLive: boolean;
readonly isPendingPause: boolean;
@@ -953,7 +953,7 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name PalletGrandpaStoredPendingChange (395) */
/** @name PalletGrandpaStoredPendingChange (397) */
export interface PalletGrandpaStoredPendingChange extends Struct {
readonly scheduledAt: u32;
readonly delay: u32;
@@ -961,7 +961,7 @@ declare module '@polkadot/types/lookup' {
readonly forced: Option<u32>;
}
/** @name PalletTreasuryProposal (398) */
/** @name PalletTreasuryProposal (400) */
export interface PalletTreasuryProposal extends Struct {
readonly proposer: AccountId32;
readonly value: u128;
@@ -969,10 +969,10 @@ declare module '@polkadot/types/lookup' {
readonly bond: u128;
}
/** @name FrameSupportPalletId (401) */
/** @name FrameSupportPalletId (403) */
export interface FrameSupportPalletId extends U8aFixed {}
/** @name PalletContractsWasmPrefabWasmModule (403) */
/** @name PalletContractsWasmPrefabWasmModule (405) */
export interface PalletContractsWasmPrefabWasmModule extends Struct {
readonly instructionWeightsVersion: Compact<u32>;
readonly initial: Compact<u32>;
@@ -983,26 +983,26 @@ declare module '@polkadot/types/lookup' {
readonly originalCodeLen: u32;
}
/** @name PalletContractsStorageRawContractInfo (405) */
/** @name PalletContractsStorageRawContractInfo (407) */
export interface PalletContractsStorageRawContractInfo extends Struct {
readonly trieId: Bytes;
readonly codeHash: H256;
readonly reserved: Option<Null>;
}
/** @name PalletContractsStorageDeletedContract (407) */
/** @name PalletContractsStorageDeletedContract (409) */
export interface PalletContractsStorageDeletedContract extends Struct {
readonly trieId: Bytes;
}
/** @name PalletContractsSchedule (408) */
/** @name PalletContractsSchedule (410) */
export interface PalletContractsSchedule extends Struct {
readonly limits: PalletContractsScheduleLimits;
readonly instructionWeights: PalletContractsScheduleInstructionWeights;
readonly hostFnWeights: PalletContractsScheduleHostFnWeights;
}
/** @name PalletContractsScheduleLimits (409) */
/** @name PalletContractsScheduleLimits (411) */
export interface PalletContractsScheduleLimits extends Struct {
readonly eventTopics: u32;
readonly stackHeight: u32;
@@ -1017,7 +1017,7 @@ declare module '@polkadot/types/lookup' {
readonly codeLen: u32;
}
/** @name PalletContractsScheduleInstructionWeights (410) */
/** @name PalletContractsScheduleInstructionWeights (412) */
export interface PalletContractsScheduleInstructionWeights extends Struct {
readonly version: u32;
readonly i64Const: u32;
@@ -1029,7 +1029,7 @@ declare module '@polkadot/types/lookup' {
readonly brIf: u32;
readonly brTable: u32;
readonly brTablePerEntry: u32;
readonly call_: u32;
readonly call: u32;
readonly callIndirect: u32;
readonly callIndirectPerParam: u32;
readonly localGet: u32;
@@ -1073,7 +1073,7 @@ declare module '@polkadot/types/lookup' {
readonly i64Rotr: u32;
}
/** @name PalletContractsScheduleHostFnWeights (411) */
/** @name PalletContractsScheduleHostFnWeights (413) */
export interface PalletContractsScheduleHostFnWeights extends Struct {
readonly caller: u64;
readonly address: u64;
@@ -1102,7 +1102,7 @@ declare module '@polkadot/types/lookup' {
readonly getStorage: u64;
readonly getStoragePerByte: u64;
readonly transfer: u64;
readonly call_: u64;
readonly call: u64;
readonly callTransferSurcharge: u64;
readonly callPerInputByte: u64;
readonly callPerOutputByte: u64;
@@ -1121,40 +1121,40 @@ declare module '@polkadot/types/lookup' {
readonly ecdsaRecover: u64;
}
/** @name PalletImOnlineBoundedOpaqueNetworkState (417) */
/** @name PalletImOnlineBoundedOpaqueNetworkState (419) */
export interface PalletImOnlineBoundedOpaqueNetworkState extends Struct {
readonly peerId: Bytes;
readonly externalAddresses: Vec<Bytes>;
}
/** @name SpStakingOffenceOffenceDetails (422) */
/** @name SpStakingOffenceOffenceDetails (424) */
export interface SpStakingOffenceOffenceDetails extends Struct {
readonly offender: ITuple<[AccountId32, PalletStakingExposure]>;
readonly reporters: Vec<AccountId32>;
}
/** @name PalletIdentityRegistration (424) */
/** @name PalletIdentityRegistration (426) */
export interface PalletIdentityRegistration extends Struct {
readonly judgements: Vec<ITuple<[u32, PalletIdentityJudgement]>>;
readonly deposit: u128;
readonly info: PalletIdentityIdentityInfo;
}
/** @name PalletIdentityRegistrarInfo (432) */
/** @name PalletIdentityRegistrarInfo (434) */
export interface PalletIdentityRegistrarInfo extends Struct {
readonly account: AccountId32;
readonly fee: u128;
readonly fields: PalletIdentityBitFlags;
}
/** @name PalletSocietyBid (436) */
/** @name PalletSocietyBid (438) */
export interface PalletSocietyBid extends Struct {
readonly who: AccountId32;
readonly kind: PalletSocietyBidKind;
readonly value: u128;
}
/** @name PalletSocietyBidKind (437) */
/** @name PalletSocietyBidKind (439) */
export interface PalletSocietyBidKind extends Enum {
readonly isDeposit: boolean;
readonly asDeposit: u128;
@@ -1162,20 +1162,20 @@ declare module '@polkadot/types/lookup' {
readonly asVouch: ITuple<[AccountId32, u128]>;
}
/** @name PalletSocietyVouchingStatus (439) */
/** @name PalletSocietyVouchingStatus (441) */
export interface PalletSocietyVouchingStatus extends Enum {
readonly isVouching: boolean;
readonly isBanned: boolean;
}
/** @name PalletSocietyVote (443) */
/** @name PalletSocietyVote (445) */
export interface PalletSocietyVote extends Enum {
readonly isSkeptic: boolean;
readonly isReject: boolean;
readonly isApprove: boolean;
}
/** @name PalletRecoveryRecoveryConfig (445) */
/** @name PalletRecoveryRecoveryConfig (447) */
export interface PalletRecoveryRecoveryConfig extends Struct {
readonly delayPeriod: u32;
readonly deposit: u128;
@@ -1183,29 +1183,29 @@ declare module '@polkadot/types/lookup' {
readonly threshold: u16;
}
/** @name PalletRecoveryActiveRecovery (446) */
/** @name PalletRecoveryActiveRecovery (448) */
export interface PalletRecoveryActiveRecovery extends Struct {
readonly created: u32;
readonly deposit: u128;
readonly friends: Vec<AccountId32>;
}
/** @name PalletVestingReleases (450) */
/** @name PalletVestingReleases (452) */
export interface PalletVestingReleases extends Enum {
readonly isV0: boolean;
readonly isV1: boolean;
}
/** @name PalletSchedulerScheduledV2 (454) */
/** @name PalletSchedulerScheduledV2 (456) */
export interface PalletSchedulerScheduledV2 extends Struct {
readonly maybeId: Option<Bytes>;
readonly priority: u8;
readonly call_: Call;
readonly call: Call;
readonly maybePeriodic: Option<ITuple<[u32, u32]>>;
readonly origin: NodeRuntimeOriginCaller;
}
/** @name NodeRuntimeOriginCaller (455) */
/** @name NodeRuntimeOriginCaller (457) */
export interface NodeRuntimeOriginCaller extends Enum {
readonly isSystem: boolean;
readonly asSystem: FrameSystemRawOrigin;
@@ -1226,7 +1226,7 @@ declare module '@polkadot/types/lookup' {
readonly asTechnicalCommittee: PalletCollectiveRawOrigin;
}
/** @name FrameSystemRawOrigin (456) */
/** @name FrameSystemRawOrigin (458) */
export interface FrameSystemRawOrigin extends Enum {
readonly isRoot: boolean;
readonly isSigned: boolean;
@@ -1234,7 +1234,7 @@ declare module '@polkadot/types/lookup' {
readonly isNone: boolean;
}
/** @name PalletCollectiveRawOrigin (457) */
/** @name PalletCollectiveRawOrigin (459) */
export interface PalletCollectiveRawOrigin extends Enum {
readonly isMembers: boolean;
readonly asMembers: ITuple<[u32, u32]>;
@@ -1243,30 +1243,30 @@ declare module '@polkadot/types/lookup' {
readonly isPhantom: boolean;
}
/** @name SpCoreVoid (459) */
/** @name SpCoreVoid (461) */
export type SpCoreVoid = Null;
/** @name PalletSchedulerReleases (460) */
/** @name PalletSchedulerReleases (462) */
export interface PalletSchedulerReleases extends Enum {
readonly isV1: boolean;
readonly isV2: boolean;
}
/** @name PalletProxyProxyDefinition (464) */
/** @name PalletProxyProxyDefinition (466) */
export interface PalletProxyProxyDefinition extends Struct {
readonly delegate: AccountId32;
readonly proxyType: NodeRuntimeProxyType;
readonly delay: u32;
}
/** @name PalletProxyAnnouncement (468) */
/** @name PalletProxyAnnouncement (470) */
export interface PalletProxyAnnouncement extends Struct {
readonly real: AccountId32;
readonly callHash: H256;
readonly height: u32;
}
/** @name PalletMultisigMultisig (472) */
/** @name PalletMultisigMultisig (474) */
export interface PalletMultisigMultisig extends Struct {
readonly when: PalletMultisigTimepoint;
readonly deposit: u128;
@@ -1274,7 +1274,7 @@ declare module '@polkadot/types/lookup' {
readonly approvals: Vec<AccountId32>;
}
/** @name PalletBountiesBounty (475) */
/** @name PalletBountiesBounty (477) */
export interface PalletBountiesBounty extends Struct {
readonly proposer: AccountId32;
readonly value: u128;
@@ -1284,7 +1284,7 @@ declare module '@polkadot/types/lookup' {
readonly status: PalletBountiesBountyStatus;
}
/** @name PalletBountiesBountyStatus (476) */
/** @name PalletBountiesBountyStatus (478) */
export interface PalletBountiesBountyStatus extends Enum {
readonly isProposed: boolean;
readonly isApproved: boolean;
@@ -1306,7 +1306,7 @@ declare module '@polkadot/types/lookup' {
} & Struct;
}
/** @name PalletTipsOpenTip (478) */
/** @name PalletTipsOpenTip (480) */
export interface PalletTipsOpenTip extends Struct {
readonly reason: H256;
readonly who: AccountId32;
@@ -1317,7 +1317,7 @@ declare module '@polkadot/types/lookup' {
readonly findersFee: bool;
}
/** @name PalletAssetsAssetDetails (480) */
/** @name PalletAssetsAssetDetails (482) */
export interface PalletAssetsAssetDetails extends Struct {
readonly owner: AccountId32;
readonly issuer: AccountId32;
@@ -1333,7 +1333,7 @@ declare module '@polkadot/types/lookup' {
readonly isFrozen: bool;
}
/** @name PalletAssetsAssetBalance (481) */
/** @name PalletAssetsAssetBalance (483) */
export interface PalletAssetsAssetBalance extends Struct {
readonly balance: u64;
readonly isFrozen: bool;
@@ -1341,13 +1341,13 @@ declare module '@polkadot/types/lookup' {
readonly extra: Null;
}
/** @name PalletAssetsApproval (483) */
/** @name PalletAssetsApproval (485) */
export interface PalletAssetsApproval extends Struct {
readonly amount: u64;
readonly deposit: u128;
}
/** @name PalletAssetsAssetMetadata (484) */
/** @name PalletAssetsAssetMetadata (486) */
export interface PalletAssetsAssetMetadata extends Struct {
readonly deposit: u128;
readonly name: Bytes;
@@ -1356,7 +1356,7 @@ declare module '@polkadot/types/lookup' {
readonly isFrozen: bool;
}
/** @name PalletLotteryLotteryConfig (486) */
/** @name PalletLotteryLotteryConfig (488) */
export interface PalletLotteryLotteryConfig extends Struct {
readonly price: u128;
readonly start: u32;
@@ -1365,13 +1365,13 @@ declare module '@polkadot/types/lookup' {
readonly repeat: bool;
}
/** @name PalletGiltGiltBid (491) */
/** @name PalletGiltGiltBid (493) */
export interface PalletGiltGiltBid extends Struct {
readonly amount: u128;
readonly who: AccountId32;
}
/** @name PalletGiltActiveGiltsTotal (492) */
/** @name PalletGiltActiveGiltsTotal (494) */
export interface PalletGiltActiveGiltsTotal extends Struct {
readonly frozen: u128;
readonly proportion: Perquintill;
@@ -1379,7 +1379,7 @@ declare module '@polkadot/types/lookup' {
readonly target: Perquintill;
}
/** @name PalletGiltActiveGilt (493) */
/** @name PalletGiltActiveGilt (495) */
export interface PalletGiltActiveGilt extends Struct {
readonly proportion: Perquintill;
readonly amount: u128;
@@ -1387,7 +1387,7 @@ declare module '@polkadot/types/lookup' {
readonly expiry: u32;
}
/** @name PalletUniquesClassDetails (495) */
/** @name PalletUniquesClassDetails (497) */
export interface PalletUniquesClassDetails extends Struct {
readonly owner: AccountId32;
readonly issuer: AccountId32;
@@ -1401,7 +1401,7 @@ declare module '@polkadot/types/lookup' {
readonly isFrozen: bool;
}
/** @name PalletUniquesInstanceDetails (497) */
/** @name PalletUniquesInstanceDetails (499) */
export interface PalletUniquesInstanceDetails extends Struct {
readonly owner: AccountId32;
readonly approved: Option<AccountId32>;
@@ -1409,21 +1409,21 @@ declare module '@polkadot/types/lookup' {
readonly deposit: u128;
}
/** @name PalletUniquesClassMetadata (498) */
/** @name PalletUniquesClassMetadata (500) */
export interface PalletUniquesClassMetadata extends Struct {
readonly deposit: u128;
readonly data: Bytes;
readonly isFrozen: bool;
}
/** @name PalletUniquesInstanceMetadata (499) */
/** @name PalletUniquesInstanceMetadata (501) */
export interface PalletUniquesInstanceMetadata extends Struct {
readonly deposit: u128;
readonly data: Bytes;
readonly isFrozen: bool;
}
/** @name PalletTransactionStorageTransactionInfo (504) */
/** @name PalletTransactionStorageTransactionInfo (506) */
export interface PalletTransactionStorageTransactionInfo extends Struct {
readonly chunkRoot: H256;
readonly contentHash: H256;
@@ -1431,7 +1431,7 @@ declare module '@polkadot/types/lookup' {
readonly blockChunks: u32;
}
/** @name PalletBagsListListNode (506) */
/** @name PalletBagsListListNode (508) */
export interface PalletBagsListListNode extends Struct {
readonly id: AccountId32;
readonly prev: Option<AccountId32>;
@@ -1439,13 +1439,13 @@ declare module '@polkadot/types/lookup' {
readonly bagUpper: u64;
}
/** @name PalletBagsListListBag (507) */
/** @name PalletBagsListListBag (509) */
export interface PalletBagsListListBag extends Struct {
readonly head: Option<AccountId32>;
readonly tail: Option<AccountId32>;
}
/** @name SpRuntimeMultiSignature (510) */
/** @name SpRuntimeMultiSignature (512) */
export interface SpRuntimeMultiSignature extends Enum {
readonly isEd25519: boolean;
readonly asEd25519: SpCoreEd25519Signature;
@@ -1455,28 +1455,28 @@ declare module '@polkadot/types/lookup' {
readonly asEcdsa: SpCoreEcdsaSignature;
}
/** @name SpCoreEcdsaSignature (511) */
/** @name SpCoreEcdsaSignature (513) */
export interface SpCoreEcdsaSignature extends U8aFixed {}
/** @name FrameSystemExtensionsCheckSpecVersion (514) */
/** @name FrameSystemExtensionsCheckSpecVersion (516) */
export type FrameSystemExtensionsCheckSpecVersion = Null;
/** @name FrameSystemExtensionsCheckTxVersion (515) */
/** @name FrameSystemExtensionsCheckTxVersion (517) */
export type FrameSystemExtensionsCheckTxVersion = Null;
/** @name FrameSystemExtensionsCheckGenesis (516) */
/** @name FrameSystemExtensionsCheckGenesis (518) */
export type FrameSystemExtensionsCheckGenesis = Null;
/** @name FrameSystemExtensionsCheckNonce (519) */
/** @name FrameSystemExtensionsCheckNonce (521) */
export interface FrameSystemExtensionsCheckNonce extends Compact<u32> {}
/** @name FrameSystemExtensionsCheckWeight (520) */
/** @name FrameSystemExtensionsCheckWeight (522) */
export type FrameSystemExtensionsCheckWeight = Null;
/** @name PalletTransactionPaymentChargeTransactionPayment (521) */
/** @name PalletTransactionPaymentChargeTransactionPayment (523) */
export interface PalletTransactionPaymentChargeTransactionPayment extends Compact<u128> {}
/** @name NodeRuntimeRuntime (522) */
/** @name NodeRuntimeRuntime (524) */
export type NodeRuntimeRuntime = Null;
}
+10 -1
View File
@@ -57,7 +57,7 @@ import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
import type { ClassDetails, ClassId, ClassMetadata, DepositBalance, DepositBalanceOf, DestroyWitness, InstanceDetails, InstanceId, InstanceMetadata } from '@polkadot/types/interfaces/uniques';
import type { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import type { VestingInfo } from '@polkadot/types/interfaces/vesting';
import type { AssetInstance, AssetInstanceV0, AssetInstanceV1, BodyId, BodyPart, DoubleEncodedCall, Fungibility, InboundStatus, InstructionV2, InteriorMultiLocation, Junction, JunctionV0, JunctionV1, JunctionV2, Junctions, JunctionsV1, JunctionsV2, MultiAsset, MultiAssetFilter, MultiAssetFilterV1, MultiAssetFilterV2, MultiAssetV0, MultiAssetV1, MultiAssetV2, MultiAssets, MultiAssetsV1, MultiAssetsV2, MultiLocation, MultiLocationV0, MultiLocationV1, MultiLocationV2, NetworkId, OriginKindV0, OriginKindV1, OriginKindV2, OutboundStatus, Outcome, QueryId, QueryStatus, QueueConfigData, Response, ResponseV0, ResponseV1, ResponseV2, ResponseV2Error, ResponseV2Result, VersionMigrationStage, VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation, VersionedResponse, VersionedXcm, WeightLimitV2, WildFungibility, WildMultiAsset, WildMultiAssetV1, Xcm, XcmAssetId, XcmError, XcmErrorV0, XcmErrorV1, XcmErrorV2, XcmOrder, XcmOrderV0, XcmOrderV1, XcmOrigin, XcmOriginKind, XcmV0, XcmV1, XcmV2, XcmVersion, XcmpMessageFormat } from '@polkadot/types/interfaces/xcm';
import type { AssetInstance, AssetInstanceV0, AssetInstanceV1, AssetInstanceV2, BodyId, BodyPart, DoubleEncodedCall, Fungibility, FungibilityV0, FungibilityV1, FungibilityV2, InboundStatus, InstructionV2, InteriorMultiLocation, Junction, JunctionV0, JunctionV1, JunctionV2, Junctions, JunctionsV1, JunctionsV2, MultiAsset, MultiAssetFilter, MultiAssetFilterV1, MultiAssetFilterV2, MultiAssetV0, MultiAssetV1, MultiAssetV2, MultiAssets, MultiAssetsV1, MultiAssetsV2, MultiLocation, MultiLocationV0, MultiLocationV1, MultiLocationV2, NetworkId, OriginKindV0, OriginKindV1, OriginKindV2, OutboundStatus, Outcome, QueryId, QueryStatus, QueueConfigData, Response, ResponseV0, ResponseV1, ResponseV2, ResponseV2Error, ResponseV2Result, VersionMigrationStage, VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation, VersionedResponse, VersionedXcm, WeightLimitV2, WildFungibility, WildFungibilityV0, WildFungibilityV1, WildFungibilityV2, WildMultiAsset, WildMultiAssetV1, WildMultiAssetV2, Xcm, XcmAssetId, XcmError, XcmErrorV0, XcmErrorV1, XcmErrorV2, XcmOrder, XcmOrderV0, XcmOrderV1, XcmOrderV2, XcmOrigin, XcmOriginKind, XcmV0, XcmV1, XcmV2, XcmVersion, XcmpMessageFormat } from '@polkadot/types/interfaces/xcm';
declare module '@polkadot/types/types/registry' {
export interface InterfaceTypes {
@@ -104,6 +104,7 @@ declare module '@polkadot/types/types/registry' {
AssetInstance: AssetInstance;
AssetInstanceV0: AssetInstanceV0;
AssetInstanceV1: AssetInstanceV1;
AssetInstanceV2: AssetInstanceV2;
AssetMetadata: AssetMetadata;
AssetOptions: AssetOptions;
AssignmentId: AssignmentId;
@@ -406,6 +407,9 @@ declare module '@polkadot/types/types/registry' {
FundIndex: FundIndex;
FundInfo: FundInfo;
Fungibility: Fungibility;
FungibilityV0: FungibilityV0;
FungibilityV1: FungibilityV1;
FungibilityV2: FungibilityV2;
Gas: Gas;
GiltBid: GiltBid;
GlobalValidationData: GlobalValidationData;
@@ -1020,8 +1024,12 @@ declare module '@polkadot/types/types/registry' {
WeightPerClass: WeightPerClass;
WeightToFeeCoefficient: WeightToFeeCoefficient;
WildFungibility: WildFungibility;
WildFungibilityV0: WildFungibilityV0;
WildFungibilityV1: WildFungibilityV1;
WildFungibilityV2: WildFungibilityV2;
WildMultiAsset: WildMultiAsset;
WildMultiAssetV1: WildMultiAssetV1;
WildMultiAssetV2: WildMultiAssetV2;
WinnersData: WinnersData;
WinnersDataTuple: WinnersDataTuple;
WinningData: WinningData;
@@ -1036,6 +1044,7 @@ declare module '@polkadot/types/types/registry' {
XcmOrder: XcmOrder;
XcmOrderV0: XcmOrderV0;
XcmOrderV1: XcmOrderV1;
XcmOrderV2: XcmOrderV2;
XcmOrigin: XcmOrigin;
XcmOriginKind: XcmOriginKind;
XcmpMessageFormat: XcmpMessageFormat;
+10 -3
View File
@@ -327,10 +327,17 @@ export class TypeRegistry implements Registry {
}
public getClassName (Type: Constructor): string | undefined {
const entry = [...this.#classes.entries()].find(([, Clazz]) => Type === Clazz);
// we cannot rely on export order (anymore, since babel/core 7.15.8), so in the case of
// items such as u32 & U32, we get the lowercase versions here... not quite as optimal
// (previously this used to be a simple find & return)
const names = [...this.#classes.entries()]
.filter(([, Clazz]) => Type === Clazz)
.map(([name]) => name)
.sort()
.reverse();
return entry
? entry[0]
return names.length
? names[0]
: undefined;
}
@@ -3,11 +3,12 @@
import type { SignOptions } from '@polkadot/keyring/types';
import type { ExtrinsicEra } from '../../interfaces/extrinsics';
import type { Balance, Hash, Index } from '../../interfaces/runtime';
import type { AssetId, Balance, Hash, Index } from '../../interfaces/runtime';
import type { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../types';
import { Compact } from '../../codec/Compact';
import { Enum } from '../../codec/Enum';
import { Option } from '../../codec/Option';
import { Struct } from '../../codec/Struct';
import { Bytes } from '../../primitive/Bytes';
import { u32 } from '../../primitive/U32';
@@ -92,6 +93,14 @@ export class GenericExtrinsicPayloadV4 extends Struct {
return this.get('transactionVersion') as u32;
}
/**
* @description
* The (optional) asset id for this signature for chains that support transaction fees in assets
*/
public get assetId (): Option<AssetId> {
return this.get('assetId') as Option<AssetId>;
}
/**
* @description Sign the payload with the keypair
*/
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { EcdsaSignature, Ed25519Signature, ExtrinsicEra, ExtrinsicSignature, Sr25519Signature } from '../../interfaces/extrinsics';
import type { Address, Balance, Call, Index } from '../../interfaces/runtime';
import type { Address, AssetId, Balance, Call, Index } from '../../interfaces/runtime';
import type { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../types';
import type { ExtrinsicSignatureOptions } from '../types';
@@ -10,6 +10,7 @@ import { assert, isU8a, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
import { Compact } from '../../codec/Compact';
import { Enum } from '../../codec/Enum';
import { Option } from '../../codec/Option';
import { Struct } from '../../codec/Struct';
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
import { GenericExtrinsicPayloadV4 } from './ExtrinsicPayload';
@@ -114,12 +115,21 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
return this.get('tip') as Compact<Balance>;
}
protected _injectSignature (signer: Address, signature: ExtrinsicSignature, { era, nonce, tip }: GenericExtrinsicPayloadV4): IExtrinsicSignature {
/**
* @description
* The (optional) asset id for this signature for chains that support transaction fees in assets
*/
public get assetId (): Option<AssetId> {
return this.get('assetId') as Option<AssetId>;
}
protected _injectSignature (signer: Address, signature: ExtrinsicSignature, { assetId, era, nonce, tip }: GenericExtrinsicPayloadV4): IExtrinsicSignature {
this.set('era', era);
this.set('nonce', nonce);
this.set('signer', signer);
this.set('signature', signature);
this.set('tip', tip);
this.set('assetId', assetId);
return this;
}
@@ -138,8 +148,9 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
/**
* @description Creates a payload from the supplied options
*/
public createPayload (method: Call, { blockHash, era, genesisHash, nonce, runtimeVersion: { specVersion, transactionVersion }, tip }: SignatureOptions): GenericExtrinsicPayloadV4 {
public createPayload (method: Call, { assetId, blockHash, era, genesisHash, nonce, runtimeVersion: { specVersion, transactionVersion }, tip }: SignatureOptions): GenericExtrinsicPayloadV4 {
return new GenericExtrinsicPayloadV4(this.registry, {
assetId,
blockHash,
era: era || IMMORTAL_ERA,
genesisHash,
@@ -50,19 +50,32 @@ const SETS = [
// These we never use these as top-level names, they are wrappers
const WRAPPERS = ['BoundedBTreeMap', 'BoundedVec', 'Box', 'BTreeMap', 'Cow', 'Result', 'Option', 'WeakBoundedVec', 'WrapperOpaque'];
// These are reserved and/or conflicts with built-in Codec definitions
const RESERVED = ['call', 'entries', 'hash', 'keys', 'new', 'size'];
// These are reserved and/or conflicts with built-in Codec or JS definitions
const RESERVED = ['entries', 'hash', 'keys', 'new', 'size'];
function matchParts (first: string[], second: (string | Text)[]): boolean {
return first.length === second.length && first.every((a, index) => {
const b = second[index].toString();
return (a === '*') || (a === b) || (
a.includes('*') &&
a.includes('_') &&
b.includes('_') &&
matchParts(a.split('_'), b.split('_'))
);
if ((a === '*') || (a === b)) {
return true;
}
if (a.includes('*') && a.includes('_') && b.includes('_')) {
const suba = a.split('_');
const subb = b.split('_');
if (suba[0] === '*') {
// the first parts where the length is greater is always a match
while (suba.length < subb.length) {
subb.shift();
}
}
return matchParts(suba, subb);
}
return false;
});
}
@@ -33,9 +33,9 @@ export default {
},
VoteThreshold: {
_enum: [
'Super majority approval',
'Super majority rejection',
'Simple majority'
'Super Majority Approve',
'Super Majority Against',
'Simple Majority'
]
}
}
@@ -41,9 +41,9 @@ export interface VoterInfo extends Struct {
/** @name VoteThreshold */
export interface VoteThreshold extends Enum {
readonly isSupermajorityapproval: boolean;
readonly isSupermajorityrejection: boolean;
readonly isSimplemajority: boolean;
readonly isSuperMajorityApprove: boolean;
readonly isSuperMajorityAgainst: boolean;
readonly isSimpleMajority: boolean;
}
export type PHANTOM_ELECTIONS = 'elections';

Some files were not shown because too many files have changed in this diff Show More