Types for new slashing (#1585)
* Types for new slashing * Unwrap new nominations structures * Small cleanups
This commit is contained in:
@@ -36,10 +36,12 @@ const mappings: Mapper[] = [
|
||||
_alias('Lookup::Source', 'Address'),
|
||||
// alias Lookup::Target to AccountId (always the case)
|
||||
_alias('Lookup::Target', 'AccountId'),
|
||||
// alias for grandpa, as used in polkadot
|
||||
_alias('grandpa::AuthorityId', 'AuthorityId'),
|
||||
// specific for SessionIndex (could make this session::, but be conservative)
|
||||
_alias('session::SessionIndex', 'SessionIndex'),
|
||||
// alias for grandpa internal, as used in polkadot
|
||||
_alias('grandpa::', ''),
|
||||
// specific for session internal
|
||||
_alias('session::', ''),
|
||||
// specific for staking/slashing.rs internal
|
||||
_alias('slashing::', ''),
|
||||
// HACK duplication between contracts & primitives, however contracts prefixed with exec
|
||||
_alias('exec::StorageKey', 'ContractStorageKey'),
|
||||
// Phantom
|
||||
|
||||
@@ -19,7 +19,7 @@ import { AuthorityIndex, AuthorityList, AuthorityWeight, NextAuthority, PendingP
|
||||
import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline';
|
||||
import { Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
|
||||
import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeysPolkadot, SessionKeysSubstrate } from '@polkadot/types/interfaces/session';
|
||||
import { EraIndex, EraPoints, EraRewards, Exposure, Forcing, IndividualExposure, MomentOf, Points, RewardDestination, SlashJournalEntry, StakingLedger, UnlockChunk, ValidatorPrefs, ValidatorPrefs0to145 } from '@polkadot/types/interfaces/staking';
|
||||
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';
|
||||
import { DigestOf, DispatchError, Event, EventId, EventIndex, EventRecord, EventRecord0to76, Key, Phase } from '@polkadot/types/interfaces/system';
|
||||
import { TreasuryProposal } from '@polkadot/types/interfaces/treasury';
|
||||
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
|
||||
@@ -618,6 +618,9 @@ export interface InterfaceRegistry {
|
||||
MomentOf: MomentOf;
|
||||
'Option<MomentOf>': Option<MomentOf>;
|
||||
'Vec<MomentOf>': Vec<MomentOf>;
|
||||
Nominations: Nominations;
|
||||
'Option<Nominations>': Option<Nominations>;
|
||||
'Vec<Nominations>': Vec<Nominations>;
|
||||
Points: Points;
|
||||
'Compact<Points>': Compact<Points>;
|
||||
'Option<Points>': Option<Points>;
|
||||
@@ -628,9 +631,25 @@ export interface InterfaceRegistry {
|
||||
SlashJournalEntry: SlashJournalEntry;
|
||||
'Option<SlashJournalEntry>': Option<SlashJournalEntry>;
|
||||
'Vec<SlashJournalEntry>': Vec<SlashJournalEntry>;
|
||||
SlashingSpans: SlashingSpans;
|
||||
'Option<SlashingSpans>': Option<SlashingSpans>;
|
||||
'Vec<SlashingSpans>': Vec<SlashingSpans>;
|
||||
SpanIndex: SpanIndex;
|
||||
'Compact<SpanIndex>': Compact<SpanIndex>;
|
||||
'Option<SpanIndex>': Option<SpanIndex>;
|
||||
'Vec<SpanIndex>': Vec<SpanIndex>;
|
||||
SpanRecord: SpanRecord;
|
||||
'Option<SpanRecord>': Option<SpanRecord>;
|
||||
'Vec<SpanRecord>': Vec<SpanRecord>;
|
||||
StakingLedger: StakingLedger;
|
||||
'Option<StakingLedger>': Option<StakingLedger>;
|
||||
'Vec<StakingLedger>': Vec<StakingLedger>;
|
||||
UnappliedSlashOther: UnappliedSlashOther;
|
||||
'Option<UnappliedSlashOther>': Option<UnappliedSlashOther>;
|
||||
'Vec<UnappliedSlashOther>': Vec<UnappliedSlashOther>;
|
||||
UnappliedSlash: UnappliedSlash;
|
||||
'Option<UnappliedSlash>': Option<UnappliedSlash>;
|
||||
'Vec<UnappliedSlash>': Vec<UnappliedSlash>;
|
||||
UnlockChunk: UnlockChunk;
|
||||
'Option<UnlockChunk>': Option<UnlockChunk>;
|
||||
'Vec<UnlockChunk>': Vec<UnlockChunk>;
|
||||
|
||||
@@ -31,6 +31,11 @@ export default {
|
||||
value: 'Compact<Balance>'
|
||||
},
|
||||
MomentOf: 'Moment',
|
||||
Nominations: {
|
||||
targets: 'Vec<AccountId>',
|
||||
submittedIn: 'EraIndex',
|
||||
suppressed: 'bool'
|
||||
},
|
||||
Points: 'u32',
|
||||
RewardDestination: {
|
||||
_enum: [
|
||||
@@ -44,12 +49,30 @@ export default {
|
||||
amount: 'Balance',
|
||||
ownSlash: 'Balance'
|
||||
},
|
||||
SlashingSpans: {
|
||||
spanIndex: 'SpanIndex',
|
||||
lastStart: 'EraIndex',
|
||||
prior: 'Vec<EraIndex>'
|
||||
},
|
||||
SpanIndex: 'u32',
|
||||
SpanRecord: {
|
||||
slashed: 'Balance',
|
||||
paidOut: 'Balance'
|
||||
},
|
||||
StakingLedger: {
|
||||
stash: 'AccountId',
|
||||
total: 'Compact<Balance>',
|
||||
active: 'Compact<Balance>',
|
||||
unlocking: 'Vec<UnlockChunk>'
|
||||
},
|
||||
UnappliedSlashOther: '(AccountId, Balance)',
|
||||
UnappliedSlash: {
|
||||
validator: 'AccountId',
|
||||
own: 'Balance',
|
||||
others: 'Vec<UnappliedSlashOther>',
|
||||
reporters: 'Vec<AccountId>',
|
||||
payout: 'Balance'
|
||||
},
|
||||
UnlockChunk: {
|
||||
value: 'Compact<Balance>',
|
||||
era: 'Compact<BlockNumber>'
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Auto-generated via `yarn build:interfaces`, do not edit
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Compact, Enum, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { u32 } from '@polkadot/types/primitive';
|
||||
import { bool, u32 } from '@polkadot/types/primitive';
|
||||
import { AccountId, Balance, BlockNumber, Moment } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** u32 */
|
||||
@@ -57,6 +58,16 @@ export interface IndividualExposure extends Struct {
|
||||
/** Moment */
|
||||
export interface MomentOf extends Moment {}
|
||||
|
||||
/** Struct */
|
||||
export interface Nominations extends Struct {
|
||||
/** Vec<AccountId> */
|
||||
readonly targets: Vec<AccountId>;
|
||||
/** EraIndex */
|
||||
readonly submittedIn: EraIndex;
|
||||
/** bool */
|
||||
readonly suppressed: bool;
|
||||
}
|
||||
|
||||
/** u32 */
|
||||
export interface Points extends u32 {}
|
||||
|
||||
@@ -70,6 +81,16 @@ export interface RewardDestination extends Enum {
|
||||
readonly isController: boolean;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface SlashingSpans extends Struct {
|
||||
/** SpanIndex */
|
||||
readonly spanIndex: SpanIndex;
|
||||
/** EraIndex */
|
||||
readonly lastStart: EraIndex;
|
||||
/** Vec<EraIndex> */
|
||||
readonly prior: Vec<EraIndex>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface SlashJournalEntry extends Struct {
|
||||
/** AccountId */
|
||||
@@ -80,6 +101,17 @@ export interface SlashJournalEntry extends Struct {
|
||||
readonly ownSlash: Balance;
|
||||
}
|
||||
|
||||
/** u32 */
|
||||
export interface SpanIndex extends u32 {}
|
||||
|
||||
/** Struct */
|
||||
export interface SpanRecord extends Struct {
|
||||
/** Balance */
|
||||
readonly slashed: Balance;
|
||||
/** Balance */
|
||||
readonly paidOut: Balance;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface StakingLedger extends Struct {
|
||||
/** AccountId */
|
||||
@@ -92,6 +124,23 @@ export interface StakingLedger extends Struct {
|
||||
readonly unlocking: Vec<UnlockChunk>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface UnappliedSlash extends Struct {
|
||||
/** AccountId */
|
||||
readonly validator: AccountId;
|
||||
/** Balance */
|
||||
readonly own: Balance;
|
||||
/** Vec<UnappliedSlashOther> */
|
||||
readonly others: Vec<UnappliedSlashOther>;
|
||||
/** Vec<AccountId> */
|
||||
readonly reporters: Vec<AccountId>;
|
||||
/** Balance */
|
||||
readonly payout: Balance;
|
||||
}
|
||||
|
||||
/** ITuple<[AccountId, Balance]> */
|
||||
export interface UnappliedSlashOther extends ITuple<[AccountId, Balance]> {}
|
||||
|
||||
/** Struct */
|
||||
export interface UnlockChunk extends Struct {
|
||||
/** Compact<Balance> */
|
||||
|
||||
Reference in New Issue
Block a user