Type capability detection (#3075)

* Type capability detection

* re-add Observable export

* Remove unused exports

* Decorate capabilities

* log capabilities

* Detect capabilities for historic

* Re-add logging

* Log

* Rework ValidatorPrefs types
This commit is contained in:
Jaco Greeff
2021-01-19 13:15:18 +01:00
committed by GitHub
parent 2f94662837
commit e98e8d6a0d
6 changed files with 115 additions and 16 deletions
+7 -4
View File
@@ -43,7 +43,7 @@ import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys7, SessionKeys8, SessionKeys9, ValidatorCount } from '@polkadot/types/interfaces/session';
import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactScore, CompactScoreCompact, ElectionCompute, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, 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, ValidatorPrefsBlocked, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
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, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission } 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, AccountInfoWithProviders, AccountInfoWithRefCount, 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';
@@ -804,9 +804,10 @@ declare module '@polkadot/types/types/registry' {
'Option<ValidatorIndex>': Option<ValidatorIndex>;
'Option<ValidatorIndexCompact>': Option<ValidatorIndexCompact>;
'Option<ValidatorPrefs>': Option<ValidatorPrefs>;
'Option<ValidatorPrefsBlocked>': Option<ValidatorPrefsBlocked>;
'Option<ValidatorPrefsTo145>': Option<ValidatorPrefsTo145>;
'Option<ValidatorPrefsTo196>': Option<ValidatorPrefsTo196>;
'Option<ValidatorPrefsWithBlocked>': Option<ValidatorPrefsWithBlocked>;
'Option<ValidatorPrefsWithCommission>': Option<ValidatorPrefsWithCommission>;
'Option<ValidatorSignature>': Option<ValidatorSignature>;
'Option<ValidityAttestation>': Option<ValidityAttestation>;
'Option<VersionedMultiAsset>': Option<VersionedMultiAsset>;
@@ -1511,9 +1512,10 @@ declare module '@polkadot/types/types/registry' {
'Vec<ValidatorIndex>': Vec<ValidatorIndex>;
'Vec<ValidatorIndexCompact>': Vec<ValidatorIndexCompact>;
'Vec<ValidatorPrefs>': Vec<ValidatorPrefs>;
'Vec<ValidatorPrefsBlocked>': Vec<ValidatorPrefsBlocked>;
'Vec<ValidatorPrefsTo145>': Vec<ValidatorPrefsTo145>;
'Vec<ValidatorPrefsTo196>': Vec<ValidatorPrefsTo196>;
'Vec<ValidatorPrefsWithBlocked>': Vec<ValidatorPrefsWithBlocked>;
'Vec<ValidatorPrefsWithCommission>': Vec<ValidatorPrefsWithCommission>;
'Vec<ValidatorSignature>': Vec<ValidatorSignature>;
'Vec<ValidityAttestation>': Vec<ValidityAttestation>;
'Vec<VersionedMultiAsset>': Vec<VersionedMultiAsset>;
@@ -2218,9 +2220,10 @@ declare module '@polkadot/types/types/registry' {
ValidatorIndex: ValidatorIndex;
ValidatorIndexCompact: ValidatorIndexCompact;
ValidatorPrefs: ValidatorPrefs;
ValidatorPrefsBlocked: ValidatorPrefsBlocked;
ValidatorPrefsTo145: ValidatorPrefsTo145;
ValidatorPrefsTo196: ValidatorPrefsTo196;
ValidatorPrefsWithBlocked: ValidatorPrefsWithBlocked;
ValidatorPrefsWithCommission: ValidatorPrefsWithCommission;
ValidatorSignature: ValidatorSignature;
ValidityAttestation: ValidityAttestation;
VersionedMultiAsset: VersionedMultiAsset;
@@ -190,10 +190,11 @@ export default {
},
ValidatorIndex: 'u16',
ValidatorIndexCompact: 'Compact<ValidatorIndex>',
ValidatorPrefs: {
ValidatorPrefs: 'ValidatorPrefsWithCommission',
ValidatorPrefsWithCommission: {
commission: 'Compact<Perbill>'
},
ValidatorPrefsBlocked: {
ValidatorPrefsWithBlocked: {
commission: 'Compact<Perbill>',
blocked: 'bool'
},
+12 -9
View File
@@ -262,15 +262,7 @@ export interface ValidatorIndex extends u16 {}
export interface ValidatorIndexCompact extends Compact<ValidatorIndex> {}
/** @name ValidatorPrefs */
export interface ValidatorPrefs extends Struct {
readonly commission: Compact<Perbill>;
}
/** @name ValidatorPrefsBlocked */
export interface ValidatorPrefsBlocked extends Struct {
readonly commission: Compact<Perbill>;
readonly blocked: bool;
}
export interface ValidatorPrefs extends ValidatorPrefsWithCommission {}
/** @name ValidatorPrefsTo145 */
export interface ValidatorPrefsTo145 extends Struct {
@@ -283,4 +275,15 @@ export interface ValidatorPrefsTo196 extends Struct {
readonly validatorPayment: Compact<Balance>;
}
/** @name ValidatorPrefsWithBlocked */
export interface ValidatorPrefsWithBlocked extends Struct {
readonly commission: Compact<Perbill>;
readonly blocked: bool;
}
/** @name ValidatorPrefsWithCommission */
export interface ValidatorPrefsWithCommission extends Struct {
readonly commission: Compact<Perbill>;
}
export type PHANTOM_STAKING = 'staking';
+1
View File
@@ -13,4 +13,5 @@ export * from './extrinsic';
export * from './interfaces';
export * from './registry';
// used inside augmented definitions
export type { Observable } from '@polkadot/x-rxjs';