Update with new consumed Weight structures (#2928)

* Update with new consumed Weight structures

* dispatch(Info, Error} optional in result

* Update for maximumBlockWeight
This commit is contained in:
Jaco Greeff
2020-12-08 17:26:13 +01:00
committed by GitHub
parent a74382c539
commit 0cb7b34ff0
11 changed files with 85 additions and 77 deletions
+13 -1
View File
@@ -44,7 +44,7 @@ import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, Vouching
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactScore, CompactScoreCompact, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RewardDestination, RewardDestinationTo257, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import type { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import type { AccountInfo, ApplyExtrinsicResult, ChainProperties, ChainType, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TransactionValidityError, UnknownTransaction } from '@polkadot/types/interfaces/system';
import type { AccountInfo, ApplyExtrinsicResult, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system';
import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
import type { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
@@ -1167,12 +1167,18 @@ declare module '@polkadot/types/types/registry' {
ApplyExtrinsicResult: ApplyExtrinsicResult;
'Option<ApplyExtrinsicResult>': Option<ApplyExtrinsicResult>;
'Vec<ApplyExtrinsicResult>': Vec<ApplyExtrinsicResult>;
BlockWeights: BlockWeights;
'Option<BlockWeights>': Option<BlockWeights>;
'Vec<BlockWeights>': Vec<BlockWeights>;
ChainProperties: ChainProperties;
'Option<ChainProperties>': Option<ChainProperties>;
'Vec<ChainProperties>': Vec<ChainProperties>;
ChainType: ChainType;
'Option<ChainType>': Option<ChainType>;
'Vec<ChainType>': Vec<ChainType>;
ConsumedWeight: ConsumedWeight;
'Option<ConsumedWeight>': Option<ConsumedWeight>;
'Vec<ConsumedWeight>': Vec<ConsumedWeight>;
DigestOf: DigestOf;
'Option<DigestOf>': Option<DigestOf>;
'Vec<DigestOf>': Vec<DigestOf>;
@@ -1264,6 +1270,9 @@ declare module '@polkadot/types/types/registry' {
PeerInfo: PeerInfo;
'Option<PeerInfo>': Option<PeerInfo>;
'Vec<PeerInfo>': Vec<PeerInfo>;
PerDispatchClass: PerDispatchClass;
'Option<PerDispatchClass>': Option<PerDispatchClass>;
'Vec<PerDispatchClass>': Vec<PerDispatchClass>;
Phase: Phase;
'Option<Phase>': Option<Phase>;
'Vec<Phase>': Vec<Phase>;
@@ -1290,6 +1299,9 @@ declare module '@polkadot/types/types/registry' {
UnknownTransaction: UnknownTransaction;
'Option<UnknownTransaction>': Option<UnknownTransaction>;
'Vec<UnknownTransaction>': Vec<UnknownTransaction>;
WeightPerClass: WeightPerClass;
'Option<WeightPerClass>': Option<WeightPerClass>;
'Vec<WeightPerClass>': Vec<WeightPerClass>;
Bounty: Bounty;
'Option<Bounty>': Option<Bounty>;
'Vec<Bounty>': Vec<Bounty>;
@@ -139,6 +139,11 @@ export default {
data: 'AccountData'
},
ApplyExtrinsicResult: 'Result<DispatchOutcome, TransactionValidityError>',
BlockWeights: {
baseBlock: 'Weight',
maxBlock: 'Weight',
perClass: 'PerDispatchClass'
},
ChainProperties: {
ss58Format: 'Option<u8>',
tokenDecimals: 'Option<u32>',
@@ -152,6 +157,7 @@ export default {
Custom: 'Text'
}
},
ConsumedWeight: 'PerDispatchClass',
DigestOf: 'Digest',
DispatchClass: {
_enum: ['Normal', 'Operational', 'Mandatory']
@@ -283,6 +289,11 @@ export default {
bestHash: 'Hash',
bestNumber: 'BlockNumber'
},
PerDispatchClass: {
normal: 'WeightPerClass',
operational: 'WeightPerClass',
mandatory: 'WeightPerClass'
},
Phase: {
_enum: {
ApplyExtrinsic: 'u32',
@@ -317,6 +328,12 @@ export default {
NoUnsignedValidator: 'Null',
Custom: 'u8'
}
},
WeightPerClass: {
baseExtrinsic: 'Weight',
maxExtrinsic: 'Weight',
maxTotal: 'Option<Weight>',
reserved: 'Option<Weight>'
}
}
} as Definitions;
@@ -21,6 +21,13 @@ export interface ApplyExtrinsicResult extends Result<DispatchOutcome, Transactio
readonly asOk: DispatchOutcome;
}
/** @name BlockWeights */
export interface BlockWeights extends Struct {
readonly baseBlock: Weight;
readonly maxBlock: Weight;
readonly perClass: PerDispatchClass;
}
/** @name ChainProperties */
export interface ChainProperties extends Struct {
readonly ss58Format: Option<u8>;
@@ -37,6 +44,9 @@ export interface ChainType extends Enum {
readonly asCustom: Text;
}
/** @name ConsumedWeight */
export interface ConsumedWeight extends PerDispatchClass {}
/** @name DigestOf */
export interface DigestOf extends Digest {}
@@ -238,6 +248,13 @@ export interface PeerPing extends Struct {
readonly secs: u64;
}
/** @name PerDispatchClass */
export interface PerDispatchClass extends Struct {
readonly normal: WeightPerClass;
readonly operational: WeightPerClass;
readonly mandatory: WeightPerClass;
}
/** @name Phase */
export interface Phase extends Enum {
readonly isApplyExtrinsic: boolean;
@@ -286,4 +303,12 @@ export interface UnknownTransaction extends Enum {
readonly asCustom: u8;
}
/** @name WeightPerClass */
export interface WeightPerClass extends Struct {
readonly baseExtrinsic: Weight;
readonly maxExtrinsic: Weight;
readonly maxTotal: Option<Weight>;
readonly reserved: Option<Weight>;
}
export type PHANTOM_SYSTEM = 'system';
+3 -1
View File
@@ -4,12 +4,14 @@
import { ExtrinsicStatus } from '../interfaces/author';
import { EcdsaSignature, Ed25519Signature, Sr25519Signature } from '../interfaces/extrinsics';
import { Address, Balance, Call, H256, Index } from '../interfaces/runtime';
import { EventRecord } from '../interfaces/system';
import { DispatchError, DispatchInfo, EventRecord } from '../interfaces/system';
import { Codec } from './codec';
import { AnyJson, AnyNumber, AnyU8a } from './helpers';
import { ICompact, IKeyringPair, IMethod, IRuntimeVersion } from './interfaces';
export interface ISubmittableResult {
readonly dispatchError?: DispatchError;
readonly dispatchInfo?: DispatchInfo;
readonly events: EventRecord[];
readonly status: ExtrinsicStatus;
readonly isCompleted: boolean;