Skip to content

Commit 76bf7a0

Browse files
authored
Alias for Runtime{Call, Event} types (#5477)
* Alias for Runtime{Call, Event} types * CHANGELOG
1 parent 142390f commit 76bf7a0

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## master
4+
5+
Changes:
6+
7+
- Extract aliases for `*_runtime::Runtime{Call, Event}` from metadata
8+
9+
310
## 9.13.6 Feb 5, 2023
411

512
Contributed:

packages/types-augment/src/registry/interfaces.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/ty
5252
import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
5353
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
5454
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
55-
import type { AccountId, AccountId20, AccountId32, AccountId33, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, CrateVersion, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, SlotDuration, StorageData, StorageInfo, StorageProof, TransactionInfo, TransactionLongevity, TransactionPriority, TransactionStorageProof, TransactionTag, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier, WeightV0, WeightV1, WeightV2 } from '@polkadot/types/interfaces/runtime';
55+
import type { AccountId, AccountId20, AccountId32, AccountId33, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, CrateVersion, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeCall, RuntimeDbWeight, RuntimeEvent, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, SlotDuration, StorageData, StorageInfo, StorageProof, TransactionInfo, TransactionLongevity, TransactionPriority, TransactionStorageProof, TransactionTag, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier, WeightV0, WeightV1, WeightV2 } from '@polkadot/types/interfaces/runtime';
5656
import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDefArray, Si0TypeDefBitSequence, Si0TypeDefCompact, Si0TypeDefComposite, Si0TypeDefPhantom, Si0TypeDefPrimitive, Si0TypeDefSequence, Si0TypeDefTuple, Si0TypeDefVariant, Si0TypeParameter, Si0Variant, Si1Field, Si1LookupTypeId, Si1Path, Si1Type, Si1TypeDef, Si1TypeDefArray, Si1TypeDefBitSequence, Si1TypeDefCompact, Si1TypeDefComposite, Si1TypeDefPrimitive, Si1TypeDefSequence, Si1TypeDefTuple, Si1TypeDefVariant, Si1TypeParameter, Si1Variant, SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
5757
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
5858
import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session';
@@ -875,10 +875,12 @@ declare module '@polkadot/types/types/registry' {
875875
RoundSnapshot: RoundSnapshot;
876876
RoundState: RoundState;
877877
RpcMethods: RpcMethods;
878+
RuntimeCall: RuntimeCall;
878879
RuntimeDbWeight: RuntimeDbWeight;
879880
RuntimeDispatchInfo: RuntimeDispatchInfo;
880881
RuntimeDispatchInfoV1: RuntimeDispatchInfoV1;
881882
RuntimeDispatchInfoV2: RuntimeDispatchInfoV2;
883+
RuntimeEvent: RuntimeEvent;
882884
RuntimeVersion: RuntimeVersion;
883885
RuntimeVersionApi: RuntimeVersionApi;
884886
RuntimeVersionPartial: RuntimeVersionPartial;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ export default {
168168
Releases: {
169169
_enum: ['V1', 'V2', 'V3', 'V4', 'V5', 'V6', 'V7', 'V8', 'V9', 'V10']
170170
},
171+
RuntimeCall: 'Call',
172+
RuntimeEvent: 'Event',
171173
RuntimeDbWeight: {
172174
read: 'Weight',
173175
write: 'Weight'

packages/types/src/interfaces/runtime/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Bytes, Compact, DoNotConstruct, Enum, Int, Null, Option, Struct, U
66
import type { ITuple } from '@polkadot/types-codec/types';
77
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
88
import type { Signature } from '@polkadot/types/interfaces/extrinsics';
9-
import type { SystemOrigin } from '@polkadot/types/interfaces/system';
9+
import type { Event, SystemOrigin } from '@polkadot/types/interfaces/system';
1010

1111
/** @name AccountId */
1212
export interface AccountId extends AccountId32 {}
@@ -306,12 +306,18 @@ export interface Releases extends Enum {
306306
readonly type: 'V1' | 'V2' | 'V3' | 'V4' | 'V5' | 'V6' | 'V7' | 'V8' | 'V9' | 'V10';
307307
}
308308

309+
/** @name RuntimeCall */
310+
export interface RuntimeCall extends Call {}
311+
309312
/** @name RuntimeDbWeight */
310313
export interface RuntimeDbWeight extends Struct {
311314
readonly read: Weight;
312315
readonly write: Weight;
313316
}
314317

318+
/** @name RuntimeEvent */
319+
export interface RuntimeEvent extends Event {}
320+
315321
/** @name Seal */
316322
export interface Seal extends ITuple<[ConsensusEngineId, Bytes]> {}
317323

packages/types/src/metadata/PortableRegistry/PortableRegistry.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ const PATHS_ALIAS = splitNamespace([
6666
// shorten some well-known types
6767
'primitive_types::*',
6868
'sp_arithmetic::per_things::*',
69+
// runtime
70+
'*_runtime::RuntimeCall',
71+
'*_runtime::RuntimeEvent',
6972
// ink!
7073
'ink_env::types::*',
7174
'ink_primitives::types::*'

0 commit comments

Comments
 (0)