Skip to content

Commit eade586

Browse files
authored
ValidatorPrefs with commission: Perbill (#1618)
* ValidatorPrefs with commission: Perbill * Update naming for old interfaces * Compact commission
1 parent c227c66 commit eade586

File tree

6 files changed

+31
-18
lines changed

6 files changed

+31
-18
lines changed

packages/api/src/base/typeInjector.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const TYPES_POLKADOT_VERSIONED: VersionedType[] = [
2121
{
2222
minmax: [0, 1018], // CC2
2323
types: {
24-
Keys: 'SessionKeys4'
24+
Keys: 'SessionKeys4',
25+
ValidatorPrefs: 'ValidatorPrefsTo196'
2526
}
2627
},
2728
{
@@ -46,8 +47,8 @@ const TYPES_META: VersionedType[] = [
4647
types: {
4748
BlockNumber: 'u64',
4849
Index: 'u64',
49-
EventRecord: 'EventRecord0to76',
50-
ValidatorPrefs: 'ValidatorPrefs0to145'
50+
EventRecord: 'EventRecordTo76',
51+
ValidatorPrefs: 'ValidatorPrefsTo145'
5152
}
5253
}
5354
];

packages/types/src/interfaceRegistry.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import { AuthorityIndex, AuthorityList, AuthorityWeight, NextAuthority, PendingP
1919
import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline';
2020
import { Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
2121
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6 } from '@polkadot/types/interfaces/session';
22-
import { EraIndex, EraPoints, EraRewards, Exposure, Forcing, IndividualExposure, MomentOf, Nominations, Points, RewardDestination, SlashJournalEntry, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorPrefs, ValidatorPrefs0to145 } from '@polkadot/types/interfaces/staking';
23-
import { DigestOf, DispatchError, Event, EventId, EventIndex, EventRecord, EventRecord0to76, Key, Phase } from '@polkadot/types/interfaces/system';
22+
import { EraIndex, EraPoints, EraRewards, Exposure, Forcing, IndividualExposure, MomentOf, Nominations, Points, RewardDestination, SlashJournalEntry, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
23+
import { DigestOf, DispatchError, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Key, Phase } from '@polkadot/types/interfaces/system';
2424
import { TreasuryProposal } from '@polkadot/types/interfaces/treasury';
2525
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
2626
import { DispatchResult, DispatchResultOf } from '@polkadot/types/interfaces/utility';
@@ -662,9 +662,12 @@ export interface InterfaceRegistry {
662662
ValidatorPrefs: ValidatorPrefs;
663663
'Option<ValidatorPrefs>': Option<ValidatorPrefs>;
664664
'Vec<ValidatorPrefs>': Vec<ValidatorPrefs>;
665-
ValidatorPrefs0to145: ValidatorPrefs0to145;
666-
'Option<ValidatorPrefs0to145>': Option<ValidatorPrefs0to145>;
667-
'Vec<ValidatorPrefs0to145>': Vec<ValidatorPrefs0to145>;
665+
ValidatorPrefsTo196: ValidatorPrefsTo196;
666+
'Option<ValidatorPrefsTo196>': Option<ValidatorPrefsTo196>;
667+
'Vec<ValidatorPrefsTo196>': Vec<ValidatorPrefsTo196>;
668+
ValidatorPrefsTo145: ValidatorPrefsTo145;
669+
'Option<ValidatorPrefsTo145>': Option<ValidatorPrefsTo145>;
670+
'Vec<ValidatorPrefsTo145>': Vec<ValidatorPrefsTo145>;
668671
DigestOf: DigestOf;
669672
'Option<DigestOf>': Option<DigestOf>;
670673
'Vec<DigestOf>': Vec<DigestOf>;
@@ -684,9 +687,9 @@ export interface InterfaceRegistry {
684687
EventRecord: EventRecord;
685688
'Option<EventRecord>': Option<EventRecord>;
686689
'Vec<EventRecord>': Vec<EventRecord>;
687-
EventRecord0to76: EventRecord0to76;
688-
'Option<EventRecord0to76>': Option<EventRecord0to76>;
689-
'Vec<EventRecord0to76>': Vec<EventRecord0to76>;
690+
EventRecordTo76: EventRecordTo76;
691+
'Option<EventRecordTo76>': Option<EventRecordTo76>;
692+
'Vec<EventRecordTo76>': Vec<EventRecordTo76>;
690693
Key: Key;
691694
'Option<Key>': Option<Key>;
692695
'Vec<Key>': Vec<Key>;

packages/types/src/interfaces/staking/definitions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ export default {
7878
era: 'Compact<BlockNumber>'
7979
},
8080
ValidatorPrefs: {
81+
commission: 'Compact<Perbill>'
82+
},
83+
ValidatorPrefsTo196: {
8184
validatorPayment: 'Compact<Balance>'
8285
},
83-
ValidatorPrefs0to145: {
86+
ValidatorPrefsTo145: {
8487
unstakeThreshold: 'Compact<u32>',
8588
validatorPayment: 'Compact<Balance>'
8689
}

packages/types/src/interfaces/staking/types.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { ITuple } from '@polkadot/types/types';
55
import { Compact, Enum, Struct, Vec } from '@polkadot/types/codec';
66
import { bool, u32 } from '@polkadot/types/primitive';
7-
import { AccountId, Balance, BlockNumber, Moment } from '@polkadot/types/interfaces/runtime';
7+
import { AccountId, Balance, BlockNumber, Moment, Perbill } from '@polkadot/types/interfaces/runtime';
88

99
/** u32 */
1010
export interface EraIndex extends u32 {}
@@ -151,14 +151,20 @@ export interface UnlockChunk extends Struct {
151151

152152
/** Struct */
153153
export interface ValidatorPrefs extends Struct {
154-
/** Compact<Balance> */
155-
readonly validatorPayment: Compact<Balance>;
154+
/** Compact<Perbill> */
155+
readonly commission: Compact<Perbill>;
156156
}
157157

158158
/** Struct */
159-
export interface ValidatorPrefs0to145 extends Struct {
159+
export interface ValidatorPrefsTo145 extends Struct {
160160
/** Compact<u32> */
161161
readonly unstakeThreshold: Compact<u32>;
162162
/** Compact<Balance> */
163163
readonly validatorPayment: Compact<Balance>;
164164
}
165+
166+
/** Struct */
167+
export interface ValidatorPrefsTo196 extends Struct {
168+
/** Compact<Balance> */
169+
readonly validatorPayment: Compact<Balance>;
170+
}

packages/types/src/interfaces/system/definitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default {
1717
event: 'Event',
1818
topics: 'Vec<Hash>'
1919
},
20-
EventRecord0to76: {
20+
EventRecordTo76: {
2121
phase: 'Phase',
2222
event: 'Event'
2323
},

packages/types/src/interfaces/system/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export interface EventRecord extends Struct {
3737
}
3838

3939
/** Struct */
40-
export interface EventRecord0to76 extends Struct {
40+
export interface EventRecordTo76 extends Struct {
4141
/** Phase */
4242
readonly phase: Phase;
4343
/** Event */

0 commit comments

Comments
 (0)