diff --git a/packages/types/README.md b/packages/types/README.md index 5842d26230..6dc0c1d7e7 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -105,7 +105,7 @@ These custom types implement specific types that are found as part of the Substr | [[InherentOfflineReport]] | Describes the offline-reporting extrinsic | | [[Justification]] | A generic justification as a stream of [[Bytes]], this is specific per consensus implementation | | [[Key]] | The Substrate Key representation as a [[Bytes]] (`vec`) | -| [[Keys]] | The session keys | +| [[Keys]] | The session keys for both Grandpa (ed25519) and Babe (sr25519) | | [[KeyValue]] | KeyValue structure. Since most of the keys and resultant values in Subtrate are hashed and/or encoded, keys and values are reprsented as [[Bytes]] | | [[KeyValueOption]] | A key/value change. Similar to the [[KeyValue]] structure, but the value can be optional | | [[LockIdentifier]] | The Substrate LockIdentifier for staking | @@ -132,7 +132,6 @@ These custom types implement specific types that are found as part of the Substr | [[SeedOf]] | The Substrate SeedOf representation as a [[Hash]] | | [[SessionIndex]] | Simple index type with which we can count sessions as [[U32]] | | [[SessionKey]] | Wrapper for a SessionKey. Same as an normal [[AuthorityId]], i.e. a wrapper around publicKey | -| [[SessionKeys]] | Wrapper for the session and authority ids | | [[SetIndex]] | Set index, implemented as a [[U32]] | | [[StakingLedger]] | The ledger of a (bonded) stash | | [[StoredPendingChange]] | Stored pending change for a Grandpa events | diff --git a/packages/types/src/interfaceRegistry.ts b/packages/types/src/interfaceRegistry.ts index abc9e9d6af..d853bd1b11 100644 --- a/packages/types/src/interfaceRegistry.ts +++ b/packages/types/src/interfaceRegistry.ts @@ -2,7 +2,7 @@ import { Compact, Option, Vec } from './codec'; import { Bytes, Data, Fixed64, H160, H256, H512, Moment, Null, StorageHasher, StorageKey, Text, Type, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from './primitive'; -import { AccountId, AccountIdOf, AccountIndex, Address, Balance, BalanceOf, Block, BlockNumber, Consensus, ConsensusEngineId, Digest, DigestItem, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Method, MortalEra, Origin, Perbill, Permill, Phantom, PreRuntime, Seal, SealV0, SessionKeys, Signature, SignedBlock, Sr25519Signature, StorageData, ValidatorId, Weight, WeightMultiplier } from './interfaces/runtime'; +import { AccountId, AccountIdOf, AccountIndex, Address, Balance, BalanceOf, Block, BlockNumber, Consensus, ConsensusEngineId, Digest, DigestItem, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Method, MortalEra, Origin, Perbill, Permill, Phantom, PreRuntime, Seal, SealV0, Signature, SignedBlock, Sr25519Signature, StorageData, ValidatorId, Weight, WeightMultiplier } from './interfaces/runtime'; import { AuthorityId } from './interfaces/consensus'; import { Keys, SessionIndex } from './interfaces/session'; import { AuthorityWeight, NextAuthority, PendingPause, PendingResume, StoredPendingChange, StoredState } from './interfaces/grandpa'; @@ -200,9 +200,6 @@ export interface InterfaceRegistry { Phantom: Phantom; 'Option': Option; 'Vec': Vec; - SessionKeys: SessionKeys; - 'Option': Option; - 'Vec': Vec; StorageData: StorageData; 'Option': Option; 'Vec': Vec; diff --git a/packages/types/src/interfaces/runtime/definitions.ts b/packages/types/src/interfaces/runtime/definitions.ts index 7d334ffd56..4878393897 100644 --- a/packages/types/src/interfaces/runtime/definitions.ts +++ b/packages/types/src/interfaces/runtime/definitions.ts @@ -48,9 +48,6 @@ export default { Perbill: 'u32', Permill: 'u32', Phantom: 'Null', - SessionKeys: { - ed25519: 'AccountId' - }, StorageData: 'Bytes', KeyValue: '(StorageKey, StorageData)', ValidatorId: 'AccountId', diff --git a/packages/types/src/interfaces/runtime/types.ts b/packages/types/src/interfaces/runtime/types.ts index f35d8010dc..2bc21fa0a5 100644 --- a/packages/types/src/interfaces/runtime/types.ts +++ b/packages/types/src/interfaces/runtime/types.ts @@ -114,12 +114,6 @@ export type Seal = [ConsensusEngineId, Bytes] & Codec; /** [u64, Signature] & Codec */ export type SealV0 = [u64, Signature] & Codec; -/** Struct */ -export interface SessionKeys extends Struct { - /** AccountId */ - readonly ed25519: AccountId; -} - /** H512 */ export type Signature = H512; diff --git a/packages/types/src/interfaces/session/definitions.ts b/packages/types/src/interfaces/session/definitions.ts index c7ae5bcf46..d3c5638bb3 100644 --- a/packages/types/src/interfaces/session/definitions.ts +++ b/packages/types/src/interfaces/session/definitions.ts @@ -5,6 +5,10 @@ export default { types: { SessionIndex: 'u32', - Keys: 'SessionKeys' + // node/runtime/src/lib.rs, impl_opaque_keys + Keys: { + ed25519: 'AccountId', // Grandpa, aka GrandpaId + sr25519: 'AccountId' // Babe, aka BabeId + } } }; diff --git a/packages/types/src/interfaces/session/types.ts b/packages/types/src/interfaces/session/types.ts index bf3a17a031..bcde8dc43b 100644 --- a/packages/types/src/interfaces/session/types.ts +++ b/packages/types/src/interfaces/session/types.ts @@ -1,10 +1,16 @@ // Auto-generated via `yarn build:interfaces`, do not edit +import { Struct } from '../../codec'; import { u32 } from '../../primitive'; -import { SessionKeys } from '../runtime'; +import { AccountId } from '../runtime'; -/** SessionKeys */ -export type Keys = SessionKeys; +/** Struct */ +export interface Keys extends Struct { + /** AccountId */ + readonly ed25519: AccountId; + /** AccountId */ + readonly sr25519: AccountId; +} /** u32 */ export type SessionIndex = u32;