UNPKG

4.66 kBTypeScriptView Raw
1/// <reference types="bn.js" />
2import type { Observable } from 'rxjs';
3import type { BitVec, Bool, bool, Bytes, I8, i8, I16, i16, I32, i32, I64, i64, I128, i128, I256, i256, Json, Null, OptionBool, Raw, Text, Type, U8, u8, U16, u16, U32, u32, U64, u64, U128, u128, U256, u256, USize, usize } from '@polkadot/types-codec';
4import type { RegistryTypes } from '@polkadot/types-codec/types';
5import type { BN } from '@polkadot/util';
6import type { GenericExtrinsic, GenericExtrinsicEra, GenericExtrinsicPayload, GenericSignerPayload } from '../extrinsic';
7import type { ExtDef } from '../extrinsic/signedExtensions/types';
8import type { GenericCall } from '../generic';
9import type { HeaderPartial } from '../interfaces/runtime';
10import type { RuntimeVersionPartial } from '../interfaces/state';
11import type { Metadata, PortableRegistry } from '../metadata';
12import type { Data, StorageKey } from '../primitive';
13import type { DefinitionRpc, DefinitionRpcSub } from './definitions';
14export type { Registry, RegistryError, RegistryTypes } from '@polkadot/types-codec/types';
15export interface InterfaceTypes {
16 BitVec: BitVec;
17 Bool: Bool;
18 Bytes: Bytes;
19 I128: I128;
20 I16: I16;
21 I256: I256;
22 I32: I32;
23 I64: I64;
24 I8: I8;
25 Json: Json;
26 Null: Null;
27 OptionBool: OptionBool;
28 Raw: Raw;
29 Text: Text;
30 Type: Type;
31 U128: U128;
32 U16: U16;
33 U256: U256;
34 U32: U32;
35 U64: U64;
36 U8: U8;
37 USize: USize;
38 bool: bool;
39 i128: i128;
40 i16: i16;
41 i256: i256;
42 i32: i32;
43 i64: i64;
44 i8: i8;
45 u128: u128;
46 u16: u16;
47 u256: u256;
48 u32: u32;
49 u64: u64;
50 u8: u8;
51 usize: usize;
52 Extrinsic: GenericExtrinsic;
53 ExtrinsicEra: GenericExtrinsicEra;
54 ExtrinsicPayload: GenericExtrinsicPayload;
55 SignerPayload: GenericSignerPayload;
56 Call: GenericCall;
57 Data: Data;
58 StorageKey: StorageKey;
59 Metadata: Metadata;
60 PortableRegistry: PortableRegistry;
61 HeaderPartial: HeaderPartial;
62 RuntimeVersionPartial: RuntimeVersionPartial;
63}
64export declare type CodecHasher = (data: Uint8Array) => Uint8Array;
65export interface ChainUpgradeVersion {
66 blockNumber: BN;
67 specVersion: BN;
68}
69export interface ChainUpgrades {
70 genesisHash: Uint8Array;
71 network: string;
72 versions: ChainUpgradeVersion[];
73}
74export interface OverrideVersionedType {
75 minmax: [number | undefined | null, number | undefined | null] | [number?, number?] | (number | undefined | null)[];
76 types: RegistryTypes;
77}
78export declare type OverrideModuleType = Record<string, string>;
79export declare type DeriveCustom = Record<string, Record<string, (instanceId: string, api: any) => (...args: any[]) => Observable<any>>>;
80export declare type AliasDefinition = Record<string, OverrideModuleType>;
81export interface OverrideBundleDefinition {
82 alias?: AliasDefinition;
83 derives?: DeriveCustom;
84 hasher?: (data: Uint8Array) => Uint8Array;
85 instances?: Record<string, string[]>;
86 rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
87 signedExtensions?: ExtDef;
88 types?: OverrideVersionedType[];
89}
90export interface OverrideBundleType {
91 chain?: Record<string, OverrideBundleDefinition>;
92 spec?: Record<string, OverrideBundleDefinition>;
93}
94export interface RegisteredTypes {
95 /**
96 * @description Specify the actual hasher override to use in the API. This generally should be done via the typesBundle
97 */
98 hasher?: (data: Uint8Array) => Uint8Array;
99 /**
100 * @description Additional types used by runtime modules. This is necessary if the runtime modules
101 * uses types not available in the base Substrate runtime.
102 */
103 types?: RegistryTypes;
104 /**
105 * @description Alias an types, as received via the metadata, to a JS-specific type to avoid conflicts. For instance, you can rename the `Proposal` in the `treasury` module to `TreasuryProposal` as to not have conflicts with the one for democracy.
106 */
107 typesAlias?: AliasDefinition;
108 /**
109 * @description A bundle of types related to chain & spec that is injected based on what the chain contains
110 */
111 typesBundle?: OverrideBundleType;
112 /**
113 * @description Additional types that are injected based on the chain we are connecting to. There are keyed by the chain, i.e. `{ 'Kusama CC1': { ... } }`
114 */
115 typesChain?: Record<string, RegistryTypes>;
116 /**
117 * @description Additional types that are injected based on the type of node we are connecting to, as set via specName in the runtime version. There are keyed by the node, i.e. `{ 'edgeware': { ... } }`
118 */
119 typesSpec?: Record<string, RegistryTypes>;
120}