Types for offchain phragmen (#1908)

This commit is contained in:
Jaco Greeff
2020-02-20 16:27:48 +01:00
committed by GitHub
parent 09617aad2e
commit e04e5577ed
5 changed files with 118 additions and 2 deletions
@@ -44,5 +44,9 @@ export default {
CheckWeight: {
extra: {},
types: {}
},
LockStakingStatus: {
extra: {},
types: {}
}
} as ExtDef;
+23 -1
View File
@@ -24,7 +24,7 @@ import { Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter }
import { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6 } from '@polkadot/types/interfaces/session';
import { Bid, BidKind, BidKindVouch, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { EraIndex, EraPoints, EraRewards, Exposure, Forcing, IndividualExposure, MomentOf, Nominations, Points, RewardDestination, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { CompactAssignments, ElectionCompute, ElectionResult, ElectionStatus, EraIndex, EraPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, PhragmenScore, Points, RewardDestination, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Key, Phase } from '@polkadot/types/interfaces/system';
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
@@ -721,6 +721,18 @@ export interface InterfaceRegistry {
VouchingStatus: VouchingStatus;
'Option<VouchingStatus>': Option<VouchingStatus>;
'Vec<VouchingStatus>': Vec<VouchingStatus>;
CompactAssignments: CompactAssignments;
'Option<CompactAssignments>': Option<CompactAssignments>;
'Vec<CompactAssignments>': Vec<CompactAssignments>;
ElectionCompute: ElectionCompute;
'Option<ElectionCompute>': Option<ElectionCompute>;
'Vec<ElectionCompute>': Vec<ElectionCompute>;
ElectionResult: ElectionResult;
'Option<ElectionResult>': Option<ElectionResult>;
'Vec<ElectionResult>': Vec<ElectionResult>;
ElectionStatus: ElectionStatus;
'Option<ElectionStatus>': Option<ElectionStatus>;
'Vec<ElectionStatus>': Vec<ElectionStatus>;
EraIndex: EraIndex;
'Compact<EraIndex>': Compact<EraIndex>;
'Option<EraIndex>': Option<EraIndex>;
@@ -740,12 +752,18 @@ export interface InterfaceRegistry {
IndividualExposure: IndividualExposure;
'Option<IndividualExposure>': Option<IndividualExposure>;
'Vec<IndividualExposure>': Vec<IndividualExposure>;
KeyType: KeyType;
'Option<KeyType>': Option<KeyType>;
'Vec<KeyType>': Vec<KeyType>;
MomentOf: MomentOf;
'Option<MomentOf>': Option<MomentOf>;
'Vec<MomentOf>': Vec<MomentOf>;
Nominations: Nominations;
'Option<Nominations>': Option<Nominations>;
'Vec<Nominations>': Vec<Nominations>;
PhragmenScore: PhragmenScore;
'Option<PhragmenScore>': Option<PhragmenScore>;
'Vec<PhragmenScore>': Vec<PhragmenScore>;
Points: Points;
'Compact<Points>': Compact<Points>;
'Option<Points>': Option<Points>;
@@ -781,6 +799,10 @@ export interface InterfaceRegistry {
UnlockChunk: UnlockChunk;
'Option<UnlockChunk>': Option<UnlockChunk>;
'Vec<UnlockChunk>': Vec<UnlockChunk>;
ValidatorIndex: ValidatorIndex;
'Compact<ValidatorIndex>': Compact<ValidatorIndex>;
'Option<ValidatorIndex>': Option<ValidatorIndex>;
'Vec<ValidatorIndex>': Vec<ValidatorIndex>;
ValidatorPrefs: ValidatorPrefs;
'Option<ValidatorPrefs>': Option<ValidatorPrefs>;
'Vec<ValidatorPrefs>': Vec<ValidatorPrefs>;
@@ -4,6 +4,39 @@
export default {
types: {
CompactAssignments: {
votes1: 'Vec<(AccountId, AccountId)>',
votes2: 'Vec<(AccountId, (AccountId, u128), AccountId)>',
votes3: 'Vec<(AccountId, [(AccountId, u128); 2], AccountId)>',
votes4: 'Vec<(AccountId, [(AccountId, u128); 3], AccountId)>',
votes5: 'Vec<(AccountId, [(AccountId, u128); 4], AccountId)>',
votes6: 'Vec<(AccountId, [(AccountId, u128); 5], AccountId)>',
votes7: 'Vec<(AccountId, [(AccountId, u128); 6], AccountId)>',
votes8: 'Vec<(AccountId, [(AccountId, u128); 7], AccountId)>',
votes9: 'Vec<(AccountId, [(AccountId, u128); 8], AccountId)>',
votes10: 'Vec<(AccountId, [(AccountId, u128); 9], AccountId)>',
votes11: 'Vec<(AccountId, [(AccountId, u128); 10], AccountId)>',
votes12: 'Vec<(AccountId, [(AccountId, u128); 11], AccountId)>',
votes13: 'Vec<(AccountId, [(AccountId, u128); 12], AccountId)>',
votes14: 'Vec<(AccountId, [(AccountId, u128); 13], AccountId)>',
votes15: 'Vec<(AccountId, [(AccountId, u128); 14], AccountId)>',
votes16: 'Vec<(AccountId, [(AccountId, u128); 15], AccountId)>',
},
ElectionCompute: {
_enum: ['OnChain', 'Signed', 'Authority']
},
ElectionResult: {
compute: 'ElectionCompute',
slotStake: 'Balance',
electedStashes: 'Vec<AccountId>',
exposures: 'Vec<(AccountId, Exposure)>'
},
ElectionStatus: {
_enum: {
Close: 'Null',
Open: 'BlockNumber'
}
},
EraIndex: 'u32',
EraPoints: {
total: 'Points',
@@ -30,12 +63,14 @@ export default {
who: 'AccountId',
value: 'Compact<Balance>'
},
KeyType: 'AccountId',
MomentOf: 'Moment',
Nominations: {
targets: 'Vec<AccountId>',
submittedIn: 'EraIndex',
suppressed: 'bool'
},
PhragmenScore: '[u128; 3]',
Points: 'u32',
RewardDestination: {
_enum: [
@@ -83,6 +118,7 @@ export default {
value: 'Compact<Balance>',
era: 'Compact<BlockNumber>'
},
ValidatorIndex: 'u16',
ValidatorPrefs: {
commission: 'Compact<Perbill>'
},
+52 -1
View File
@@ -3,9 +3,51 @@
import { ITuple } from '@polkadot/types/types';
import { Compact, Enum, Struct, Vec } from '@polkadot/types/codec';
import { bool, u32 } from '@polkadot/types/primitive';
import { bool, u128, u16, u32 } from '@polkadot/types/primitive';
import { AccountId, Balance, BlockNumber, Moment, Perbill } from '@polkadot/types/interfaces/runtime';
/** @name CompactAssignments */
export interface CompactAssignments extends Struct {
readonly votes1: Vec<ITuple<[AccountId, AccountId]>>;
readonly votes2: Vec<ITuple<[AccountId, ITuple<[AccountId, u128]>, AccountId]>>;
readonly votes3: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes4: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes5: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes6: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes7: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes8: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes9: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes10: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes11: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes12: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes13: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes14: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes15: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
readonly votes16: Vec<ITuple<[AccountId, Vec<ITuple<[AccountId, u128]>>, AccountId]>>;
}
/** @name ElectionCompute */
export interface ElectionCompute extends Enum {
readonly isOnChain: boolean;
readonly isSigned: boolean;
readonly isAuthority: boolean;
}
/** @name ElectionResult */
export interface ElectionResult extends Struct {
readonly compute: ElectionCompute;
readonly slotStake: Balance;
readonly electedStashes: Vec<AccountId>;
readonly exposures: Vec<ITuple<[AccountId, Exposure]>>;
}
/** @name ElectionStatus */
export interface ElectionStatus extends Enum {
readonly isClose: boolean;
readonly isOpen: boolean;
readonly asOpen: BlockNumber;
}
/** @name EraIndex */
export interface EraIndex extends u32 {}
@@ -42,6 +84,9 @@ export interface IndividualExposure extends Struct {
readonly value: Compact<Balance>;
}
/** @name KeyType */
export interface KeyType extends AccountId {}
/** @name MomentOf */
export interface MomentOf extends Moment {}
@@ -52,6 +97,9 @@ export interface Nominations extends Struct {
readonly suppressed: bool;
}
/** @name PhragmenScore */
export interface PhragmenScore extends Vec<u128> {}
/** @name Points */
export interface Points extends u32 {}
@@ -119,6 +167,9 @@ export interface UnlockChunk extends Struct {
readonly era: Compact<BlockNumber>;
}
/** @name ValidatorIndex */
export interface ValidatorIndex extends u16 {}
/** @name ValidatorPrefs */
export interface ValidatorPrefs extends Struct {
readonly commission: Compact<Perbill>;
+3
View File
@@ -19,6 +19,9 @@ const TYPES_MODULES: Record<string, OverrideModuleType> = {
Judgement: 'SocietyJudgement',
Vote: 'SocietyVote'
},
staking: {
Compact: 'CompactAssignments'
},
treasury: {
Proposal: 'TreasuryProposal'
}