Cater for new dispatch scheduler (#2130)
* Cater for new dispatch scheduler * Updated * debug logs * Update types.ts
This commit is contained in:
@@ -4,35 +4,86 @@
|
||||
|
||||
import { BlockNumber, Hash, ReferendumIndex } from '@polkadot/types/interfaces';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { DeriveDispatch } from '../types';
|
||||
import { DeriveDispatch, DeriveProposalImage } from '../types';
|
||||
|
||||
import { Observable, combineLatest, of } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { Vec } from '@polkadot/types';
|
||||
import { Vec, u64 } from '@polkadot/types';
|
||||
import { stringToHex } from '@polkadot/util';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
export function dispatchQueue (api: ApiInterfaceRx): () => Observable<DeriveDispatch[]> {
|
||||
return memo((): Observable<DeriveDispatch[]> =>
|
||||
api.query.democracy?.dispatchQueue
|
||||
? api.query.democracy.dispatchQueue<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>().pipe(
|
||||
switchMap((dispatches) =>
|
||||
combineLatest([
|
||||
of(dispatches),
|
||||
api.derive.democracy.preimages(
|
||||
dispatches.map(([, hash]) => hash))
|
||||
])
|
||||
),
|
||||
map(([dispatches, images]) =>
|
||||
dispatches.map(([at, imageHash, index], dispatchIndex): DeriveDispatch => ({
|
||||
at,
|
||||
image: images[dispatchIndex],
|
||||
imageHash,
|
||||
index
|
||||
}))
|
||||
)
|
||||
)
|
||||
: of([])
|
||||
const DEMOCRACY_ID = stringToHex('democrac');
|
||||
|
||||
interface SchedulerInfo {
|
||||
at: BlockNumber;
|
||||
imageHash: Hash;
|
||||
index: ReferendumIndex;
|
||||
}
|
||||
|
||||
function queryQueue (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
|
||||
return api.query.democracy.dispatchQueue<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>().pipe(
|
||||
switchMap((dispatches) =>
|
||||
combineLatest([
|
||||
of(dispatches),
|
||||
api.derive.democracy.preimages(
|
||||
dispatches.map(([, hash]) => hash))
|
||||
])
|
||||
),
|
||||
map(([dispatches, images]) =>
|
||||
dispatches.map(([at, imageHash, index], dispatchIndex): DeriveDispatch => ({
|
||||
at,
|
||||
image: images[dispatchIndex],
|
||||
imageHash,
|
||||
index
|
||||
}))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function queryScheduler (api: ApiInterfaceRx): Observable<DeriveDispatch[]> {
|
||||
return api.derive.democracy.referendumsFinished().pipe(
|
||||
switchMap(() => api.query.scheduler.agenda.entries()),
|
||||
switchMap((all): Observable<[SchedulerInfo[], (DeriveProposalImage | undefined)[]]> => {
|
||||
const info = all.reduce((result: SchedulerInfo[], [key, allScheduled]): SchedulerInfo[] => {
|
||||
const at = key.args[0] as BlockNumber;
|
||||
|
||||
allScheduled.filter((optScheduled) => optScheduled.isSome).forEach((optScheduled): void => {
|
||||
const scheduled = optScheduled.unwrap();
|
||||
|
||||
if (scheduled.maybeId.isSome) {
|
||||
const id = scheduled.maybeId.unwrap().toHex();
|
||||
|
||||
if (id.startsWith(DEMOCRACY_ID)) {
|
||||
const [, index] = api.registry.createType('(u64, ReferendumIndex)' as any, id) as ITuple<[u64, ReferendumIndex]>;
|
||||
const imageHash = scheduled.call.args[0] as Hash;
|
||||
|
||||
result.push({ at, imageHash, index });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
return combineLatest([
|
||||
of(info),
|
||||
api.derive.democracy.preimages(info.map(({ imageHash }) => imageHash))
|
||||
]);
|
||||
}),
|
||||
map(([infos, images]): DeriveDispatch[] =>
|
||||
infos.map((info, index) => ({ ...info, image: images[index] }))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function dispatchQueue (api: ApiInterfaceRx): () => Observable<DeriveDispatch[]> {
|
||||
return memo((): Observable<DeriveDispatch[]> =>
|
||||
api.query.scheduler?.agenda
|
||||
? queryScheduler(api)
|
||||
: api.query.democracy.dispatchQueue
|
||||
? queryQueue(api)
|
||||
: of([])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ export * from './nextExternal';
|
||||
export * from './preimage';
|
||||
export * from './preimages';
|
||||
export * from './proposals';
|
||||
export * from './referendumIds';
|
||||
export * from './referendums';
|
||||
export * from './referendumsActive';
|
||||
export * from './referendumsFinished';
|
||||
export * from './referendumsInfo';
|
||||
export * from './sqrtElectorate';
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { ReferendumIndex } from '@polkadot/types/interfaces';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
export function referendumIds (api: ApiInterfaceRx): () => Observable<BN[]> {
|
||||
return memo((): Observable<BN[]> =>
|
||||
api.query.democracy?.lowestUnbaked
|
||||
? api.queryMulti<[ReferendumIndex, ReferendumIndex]>([
|
||||
api.query.democracy.lowestUnbaked,
|
||||
api.query.democracy.referendumCount
|
||||
]).pipe(
|
||||
map(([first, total]): BN[] =>
|
||||
total.gt(first)
|
||||
? [...Array(total.sub(first).toNumber())].map((_, i): BN => first.addn(i))
|
||||
: []
|
||||
)
|
||||
)
|
||||
: of([])
|
||||
);
|
||||
}
|
||||
@@ -3,10 +3,8 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { ReferendumIndex } from '@polkadot/types/interfaces';
|
||||
import { DeriveReferendum } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
|
||||
@@ -14,19 +12,12 @@ import { memo } from '../util';
|
||||
|
||||
export function referendumsActive (api: ApiInterfaceRx): () => Observable<DeriveReferendum[]> {
|
||||
return memo((): Observable<DeriveReferendum[]> =>
|
||||
api.query.democracy?.lowestUnbaked
|
||||
? api.queryMulti<[ReferendumIndex, ReferendumIndex]>([
|
||||
api.query.democracy.lowestUnbaked,
|
||||
api.query.democracy.referendumCount
|
||||
]).pipe(
|
||||
switchMap(([first, total]): Observable<DeriveReferendum[]> =>
|
||||
total.gt(first)
|
||||
? api.derive.democracy.referendumsInfo(
|
||||
[...Array(total.sub(first).toNumber())].map((_, i): BN => first.addn(i))
|
||||
)
|
||||
: of([])
|
||||
)
|
||||
api.derive.democracy.referendumIds().pipe(
|
||||
switchMap((ids): Observable<DeriveReferendum[]> =>
|
||||
ids.length
|
||||
? api.derive.democracy.referendumsInfo(ids)
|
||||
: of([])
|
||||
)
|
||||
: of([])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { ReferendumInfo, ReferendumInfoFinished } from '@polkadot/types/interfaces';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { Option } from '@polkadot/types';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
export function referendumsFinished (api: ApiInterfaceRx): () => Observable<ReferendumInfoFinished[]> {
|
||||
return memo((): Observable<ReferendumInfoFinished[]> =>
|
||||
api.derive.democracy.referendumIds().pipe(
|
||||
switchMap((ids) => api.query.democracy.referendumInfoOf.multi<Option<ReferendumInfo>>(ids)),
|
||||
map((infos): ReferendumInfoFinished[] =>
|
||||
infos
|
||||
.filter((optInfo) => optInfo.isSome)
|
||||
.map((optInfo) => optInfo.unwrap())
|
||||
.filter((info) => info.isFinished)
|
||||
.map((info) => info.asFinished)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { AccountId, Balance, BlockNumber, Proposal, ReferendumInfo, ReferendumInfoTo239, ReferendumStatus, Tally, VoteThreshold } from '@polkadot/types/interfaces';
|
||||
import { AccountId, Balance, BlockNumber, PreimageStatus, Proposal, ReferendumInfo, ReferendumInfoTo239, ReferendumStatus, Tally, VoteThreshold } from '@polkadot/types/interfaces';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { DeriveProposalImage, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
|
||||
|
||||
@@ -11,6 +11,9 @@ import BN from 'bn.js';
|
||||
import { Bytes, Option } from '@polkadot/types';
|
||||
import { bnSqrt } from '@polkadot/util';
|
||||
|
||||
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
|
||||
type OldPreimage = ITuple<PreimageInfo>;
|
||||
|
||||
function isOldInfo (info: ReferendumInfo | ReferendumInfoTo239): info is ReferendumInfoTo239 {
|
||||
return !!(info as ReferendumInfoTo239).proposalHash;
|
||||
}
|
||||
@@ -19,6 +22,10 @@ function isCurrentStatus (status: ReferendumStatus | ReferendumInfoTo239): statu
|
||||
return !!(status as ReferendumStatus).tally;
|
||||
}
|
||||
|
||||
function isCurrentPreimage (api: ApiInterfaceRx, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): imageOpt is Option<PreimageStatus> {
|
||||
return !!imageOpt && !api.query.democracy.dispatchQueue;
|
||||
}
|
||||
|
||||
export function compareRationals (n1: BN, d1: BN, n2: BN, d2: BN): boolean {
|
||||
while (true) {
|
||||
const q1 = n1.div(d1);
|
||||
@@ -145,13 +152,8 @@ export function getStatus (info: Option<ReferendumInfo | ReferendumInfoTo239>):
|
||||
return null;
|
||||
}
|
||||
|
||||
export function parseImage (api: ApiInterfaceRx, imageOpt: Option<ITuple<[Bytes, AccountId, Balance, BlockNumber]>>): DeriveProposalImage | undefined {
|
||||
if (imageOpt.isNone) {
|
||||
return;
|
||||
}
|
||||
|
||||
function constructProposal (api: ApiInterfaceRx, [bytes, proposer, balance, at]: PreimageInfo): DeriveProposalImage {
|
||||
let proposal: Proposal | undefined;
|
||||
const [bytes, proposer, balance, at] = imageOpt.unwrap();
|
||||
|
||||
try {
|
||||
proposal = api.registry.createType('Proposal', bytes.toU8a(true));
|
||||
@@ -161,3 +163,23 @@ export function parseImage (api: ApiInterfaceRx, imageOpt: Option<ITuple<[Bytes,
|
||||
|
||||
return { at, balance, proposal, proposer };
|
||||
}
|
||||
|
||||
export function parseImage (api: ApiInterfaceRx, imageOpt: Option<OldPreimage> | Option<PreimageStatus>): DeriveProposalImage | undefined {
|
||||
if (imageOpt.isNone) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCurrentPreimage(api, imageOpt)) {
|
||||
const status = imageOpt.unwrap();
|
||||
|
||||
if (status.isMissing) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { data, deposit, provider, since } = status.asAvailable;
|
||||
|
||||
return constructProposal(api, [data, provider, deposit, since]);
|
||||
}
|
||||
|
||||
return constructProposal(api, imageOpt.unwrap());
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { AccountData, BalanceLock, ReleasesBalances } from '@polkadot/types/inte
|
||||
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
|
||||
import { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
|
||||
import { CodeHash, ContractInfo, Gas, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
|
||||
import { PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy';
|
||||
import { PreimageStatus, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, Voting } from '@polkadot/types/interfaces/democracy';
|
||||
import { VoteThreshold } from '@polkadot/types/interfaces/elections';
|
||||
import { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
|
||||
import { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity';
|
||||
@@ -18,6 +18,7 @@ import { AuthIndex } from '@polkadot/types/interfaces/imOnline';
|
||||
import { DeferredOffenceOf, Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
|
||||
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
|
||||
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, KeyTypeId, Moment, Perbill, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
||||
import { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
|
||||
import { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
|
||||
import { ActiveEraInfo, ElectionResult, ElectionStatus, EraIndex, EraRewardPoints, Exposure, Forcing, Nominations, PhragmenScore, ReleasesStaking, RewardDestination, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
|
||||
@@ -195,10 +196,6 @@ declare module '@polkadot/api/types/storage' {
|
||||
* Those who have locked a deposit.
|
||||
**/
|
||||
depositOf: AugmentedQuery<ApiType, (arg: PropIndex | AnyNumber | Uint8Array) => Observable<Option<ITuple<[BalanceOf, Vec<AccountId>]>>>> & QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* Queue of successful referenda to be dispatched. Stored ordered by block number.
|
||||
**/
|
||||
dispatchQueue: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[BlockNumber, Hash, ReferendumIndex]>>>> & QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* True if the last referendum tabled was submitted externally. False if it was a public
|
||||
* proposal.
|
||||
@@ -225,7 +222,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
* Map of hashes to the proposal preimage, along with who registered it and their deposit.
|
||||
* The block number is the block at which it was deposited.
|
||||
**/
|
||||
preimages: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<ITuple<[Bytes, AccountId, BalanceOf, BlockNumber]>>>> & QueryableStorageEntry<ApiType>;
|
||||
preimages: AugmentedQuery<ApiType, (arg: Hash | string | Uint8Array) => Observable<Option<PreimageStatus>>> & QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* Who is able to vote for whom. Value is the fund-holding account, key is the
|
||||
* vote-transaction-sending account.
|
||||
@@ -411,6 +408,17 @@ declare module '@polkadot/api/types/storage' {
|
||||
**/
|
||||
recoverable: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<RecoveryConfig>>> & QueryableStorageEntry<ApiType>;
|
||||
};
|
||||
scheduler: {
|
||||
[index: string]: QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* Items to be executed, indexed by the block number that they should be executed on.
|
||||
**/
|
||||
agenda: AugmentedQuery<ApiType, (arg: BlockNumber | AnyNumber | Uint8Array) => Observable<Vec<Option<Scheduled>>>> & QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
* Lookup from identity to the block number and index of the task.
|
||||
**/
|
||||
lookup: AugmentedQuery<ApiType, (arg: Bytes | string | Uint8Array) => Observable<Option<TaskAddress>>> & QueryableStorageEntry<ApiType>;
|
||||
};
|
||||
session: {
|
||||
[index: string]: QueryableStorageEntry<ApiType>;
|
||||
/**
|
||||
|
||||
@@ -248,6 +248,10 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* # </weight>
|
||||
**/
|
||||
emergencyCancel: AugmentedSubmittable<(refIndex: ReferendumIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Enact a proposal from a referendum. For now we just make the weight be the maximum.
|
||||
**/
|
||||
enactProposal: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array, index: ReferendumIndex | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
|
||||
/**
|
||||
* Schedule a referendum to be tabled once it is legal to schedule an external
|
||||
* referendum.
|
||||
|
||||
@@ -3204,7 +3204,7 @@
|
||||
"Map": {
|
||||
"hasher": "Identity",
|
||||
"key": "Hash",
|
||||
"value": "(Bytes,AccountId,BalanceOf,BlockNumber)",
|
||||
"value": "PreimageStatus",
|
||||
"linked": false
|
||||
}
|
||||
},
|
||||
@@ -3253,17 +3253,6 @@
|
||||
" Information concerning any given referendum."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "DispatchQueue",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"Plain": "Vec<(BlockNumber,Hash,ReferendumIndex)>"
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" Queue of successful referenda to be dispatched. Stored ordered by block number."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "VotingOf",
|
||||
"modifier": "Default",
|
||||
@@ -4087,6 +4076,22 @@
|
||||
" - `O(R + log R)` where R is the number of referenda that `target` has voted on.",
|
||||
" # </weight>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "enact_proposal",
|
||||
"args": [
|
||||
{
|
||||
"name": "proposal_hash",
|
||||
"type": "Hash"
|
||||
},
|
||||
{
|
||||
"name": "index",
|
||||
"type": "ReferendumIndex"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
" Enact a proposal from a referendum. For now we just make the weight be the maximum."
|
||||
]
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
@@ -9472,6 +9477,67 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Scheduler",
|
||||
"storage": {
|
||||
"prefix": "Scheduler",
|
||||
"items": [
|
||||
{
|
||||
"name": "Agenda",
|
||||
"modifier": "Default",
|
||||
"type": {
|
||||
"Map": {
|
||||
"hasher": "Twox64Concat",
|
||||
"key": "BlockNumber",
|
||||
"value": "Vec<Option<Scheduled>>",
|
||||
"linked": false
|
||||
}
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" Items to be executed, indexed by the block number that they should be executed on."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Lookup",
|
||||
"modifier": "Optional",
|
||||
"type": {
|
||||
"Map": {
|
||||
"hasher": "Twox64Concat",
|
||||
"key": "Bytes",
|
||||
"value": "TaskAddress",
|
||||
"linked": false
|
||||
}
|
||||
},
|
||||
"fallback": "0x00",
|
||||
"documentation": [
|
||||
" Lookup from identity to the block number and index of the task."
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"calls": [],
|
||||
"events": [
|
||||
{
|
||||
"name": "Scheduled",
|
||||
"args": [
|
||||
"BlockNumber"
|
||||
],
|
||||
"documentation": []
|
||||
},
|
||||
{
|
||||
"name": "Dispatched",
|
||||
"args": [
|
||||
"TaskAddress",
|
||||
"Option<Bytes>",
|
||||
"DispatchResult"
|
||||
],
|
||||
"documentation": []
|
||||
}
|
||||
],
|
||||
"constants": [],
|
||||
"errors": []
|
||||
}
|
||||
],
|
||||
"extrinsic": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -15,7 +15,7 @@ import { EthereumAddress } from '@polkadot/types/interfaces/claims';
|
||||
import { MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
|
||||
import { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
|
||||
import { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultSuccess, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
|
||||
import { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
|
||||
import { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
|
||||
import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
|
||||
import { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
|
||||
import { Account, Log } from '@polkadot/types/interfaces/evm';
|
||||
@@ -32,6 +32,7 @@ import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
|
||||
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
|
||||
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
|
||||
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, Fixed64, H160, H256, H512, Hash, Header, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, Moment, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, SignedBlock, StorageData, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
|
||||
import { SchedulePeriod, SchedulePriority, Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
|
||||
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6 } from '@polkadot/types/interfaces/session';
|
||||
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
|
||||
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
|
||||
@@ -436,6 +437,12 @@ declare module '@polkadot/types/types/registry' {
|
||||
Delegations: Delegations;
|
||||
'Option<Delegations>': Option<Delegations>;
|
||||
'Vec<Delegations>': Vec<Delegations>;
|
||||
PreimageStatus: PreimageStatus;
|
||||
'Option<PreimageStatus>': Option<PreimageStatus>;
|
||||
'Vec<PreimageStatus>': Vec<PreimageStatus>;
|
||||
PreimageStatusAvailable: PreimageStatusAvailable;
|
||||
'Option<PreimageStatusAvailable>': Option<PreimageStatusAvailable>;
|
||||
'Vec<PreimageStatusAvailable>': Vec<PreimageStatusAvailable>;
|
||||
PriorLock: PriorLock;
|
||||
'Option<PriorLock>': Option<PriorLock>;
|
||||
'Vec<PriorLock>': Vec<PriorLock>;
|
||||
@@ -704,6 +711,19 @@ declare module '@polkadot/types/types/registry' {
|
||||
RecoveryConfig: RecoveryConfig;
|
||||
'Option<RecoveryConfig>': Option<RecoveryConfig>;
|
||||
'Vec<RecoveryConfig>': Vec<RecoveryConfig>;
|
||||
SchedulePeriod: SchedulePeriod;
|
||||
'Option<SchedulePeriod>': Option<SchedulePeriod>;
|
||||
'Vec<SchedulePeriod>': Vec<SchedulePeriod>;
|
||||
SchedulePriority: SchedulePriority;
|
||||
'Compact<SchedulePriority>': Compact<SchedulePriority>;
|
||||
'Option<SchedulePriority>': Option<SchedulePriority>;
|
||||
'Vec<SchedulePriority>': Vec<SchedulePriority>;
|
||||
Scheduled: Scheduled;
|
||||
'Option<Scheduled>': Option<Scheduled>;
|
||||
'Vec<Scheduled>': Vec<Scheduled>;
|
||||
TaskAddress: TaskAddress;
|
||||
'Option<TaskAddress>': Option<TaskAddress>;
|
||||
'Vec<TaskAddress>': Vec<TaskAddress>;
|
||||
Keys: Keys;
|
||||
'Option<Keys>': Option<Keys>;
|
||||
'Vec<Keys>': Vec<Keys>;
|
||||
|
||||
@@ -24,6 +24,7 @@ export { default as identity } from './identity/definitions';
|
||||
export { default as imOnline } from './imOnline/definitions';
|
||||
export { default as offences } from './offences/definitions';
|
||||
export { default as recovery } from './recovery/definitions';
|
||||
export { default as scheduler } from './scheduler/definitions';
|
||||
export { default as session } from './session/definitions';
|
||||
export { default as society } from './society/definitions';
|
||||
export { default as staking } from './staking/definitions';
|
||||
|
||||
@@ -50,6 +50,19 @@ export default {
|
||||
votes: 'Balance',
|
||||
capital: 'Balance'
|
||||
},
|
||||
PreimageStatus: {
|
||||
_enum: {
|
||||
Missing: 'BlockNumber',
|
||||
Available: 'PreimageStatusAvailable'
|
||||
}
|
||||
},
|
||||
PreimageStatusAvailable: {
|
||||
data: 'Bytes',
|
||||
provider: 'AccountId',
|
||||
deposit: 'Balance',
|
||||
since: 'BlockNumber',
|
||||
expiry: 'Option<BlockNumber>'
|
||||
},
|
||||
PriorLock: '(BlockNumber, Balance)',
|
||||
PropIndex: 'u32',
|
||||
Proposal: 'Call',
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/* eslint-disable */
|
||||
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { bool, u32 } from '@polkadot/types/primitive';
|
||||
import { Enum, Option, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, bool, u32 } from '@polkadot/types/primitive';
|
||||
import { Vote, VoteThreshold } from '@polkadot/types/interfaces/elections';
|
||||
import { AccountId, Balance, BlockNumber, Call, Hash } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
@@ -44,6 +44,23 @@ export interface Delegations extends Struct {
|
||||
readonly capital: Balance;
|
||||
}
|
||||
|
||||
/** @name PreimageStatus */
|
||||
export interface PreimageStatus extends Enum {
|
||||
readonly isMissing: boolean;
|
||||
readonly asMissing: BlockNumber;
|
||||
readonly isAvailable: boolean;
|
||||
readonly asAvailable: PreimageStatusAvailable;
|
||||
}
|
||||
|
||||
/** @name PreimageStatusAvailable */
|
||||
export interface PreimageStatusAvailable extends Struct {
|
||||
readonly data: Bytes;
|
||||
readonly provider: AccountId;
|
||||
readonly deposit: Balance;
|
||||
readonly since: BlockNumber;
|
||||
readonly expiry: Option<BlockNumber>;
|
||||
}
|
||||
|
||||
/** @name PriorLock */
|
||||
export interface PriorLock extends ITuple<[BlockNumber, Balance]> {}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
// order important in structs... :)
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import { Definitions } from '../../types';
|
||||
|
||||
export default {
|
||||
rpc: {},
|
||||
types: {
|
||||
SchedulePeriod: '(BlockNumber, u32)',
|
||||
SchedulePriority: 'u8',
|
||||
Scheduled: {
|
||||
maybeId: 'Option<Bytes>',
|
||||
priority: 'SchedulePriority',
|
||||
call: 'Call',
|
||||
maybePeriodic: 'Option<SchedulePeriod>'
|
||||
},
|
||||
TaskAddress: '(BlockNumber, u32)'
|
||||
}
|
||||
} as Definitions;
|
||||
@@ -0,0 +1,4 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
export * from './types';
|
||||
@@ -0,0 +1,26 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Option, Struct } from '@polkadot/types/codec';
|
||||
import { Bytes, u32, u8 } from '@polkadot/types/primitive';
|
||||
import { BlockNumber, Call } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name Scheduled */
|
||||
export interface Scheduled extends Struct {
|
||||
readonly maybeId: Option<Bytes>;
|
||||
readonly priority: SchedulePriority;
|
||||
readonly call: Call;
|
||||
readonly maybePeriodic: Option<SchedulePeriod>;
|
||||
}
|
||||
|
||||
/** @name SchedulePeriod */
|
||||
export interface SchedulePeriod extends ITuple<[BlockNumber, u32]> {}
|
||||
|
||||
/** @name SchedulePriority */
|
||||
export interface SchedulePriority extends u8 {}
|
||||
|
||||
/** @name TaskAddress */
|
||||
export interface TaskAddress extends ITuple<[BlockNumber, u32]> {}
|
||||
|
||||
export type PHANTOM_SCHEDULER = 'scheduler';
|
||||
@@ -20,6 +20,7 @@ export * from './identity/types';
|
||||
export * from './imOnline/types';
|
||||
export * from './offences/types';
|
||||
export * from './recovery/types';
|
||||
export * from './scheduler/types';
|
||||
export * from './session/types';
|
||||
export * from './society/types';
|
||||
export * from './staking/types';
|
||||
|
||||
Reference in New Issue
Block a user