ClassOf does not require <T> (#1190)
* Add InterfaceRegistry * Update srml script * Add compact * Add correct imports * Auto-generate InterfaceRegistry * Regenerate * Simplify code * add comment * Fix lint * Rename var * Compact encodable abtstactInt * Fix abstract isChildClass
This commit is contained in:
committed by
Jaco Greeff
parent
39323a8896
commit
83515fc0a2
@@ -11,7 +11,7 @@ import { HeaderExtended } from '@polkadot/api-derive';
|
||||
import { ConstantCodec } from '@polkadot/api-metadata/consts/types';
|
||||
import testKeyring from '@polkadot/keyring/testingPairs';
|
||||
import { IExtrinsic, IMethod } from '@polkadot/types/types';
|
||||
import { Header } from '@polkadot/types';
|
||||
import { createType, Header } from '@polkadot/types';
|
||||
|
||||
import { SubmittableResult } from './';
|
||||
|
||||
@@ -92,4 +92,11 @@ export default async function test (): Promise<void> {
|
||||
|
||||
unsub2();
|
||||
});
|
||||
|
||||
// check correct types with `createType`
|
||||
const balance = createType('Balance', 2);
|
||||
const overridden = createType<Index>('Gas', 2);
|
||||
const gas = createType('Gas', 2);
|
||||
const vec = createType('Vec<u32>', 2);
|
||||
console.log(balance, overridden, gas, vec);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,12 @@ import { DEFAULT_BITLENGTH } from '@polkadot/util/compact/defaults';
|
||||
|
||||
import Moment from '../primitive/Moment';
|
||||
import { AnyNumber, Constructor } from '../types';
|
||||
import { UIntBitLength } from './AbstractInt';
|
||||
import AbstractInt, { UIntBitLength } from './AbstractInt';
|
||||
import Base from './Base';
|
||||
import UInt from './UInt';
|
||||
|
||||
// List of codec types that are compact-encodable
|
||||
export const COMPACT_ENCODABLE = [AbstractInt, Moment];
|
||||
export type CompactEncodable = AbstractInt | Moment; // FIXME is there a way to do it not-manually from the array?
|
||||
|
||||
/**
|
||||
* @name Compact
|
||||
@@ -20,12 +23,12 @@ import UInt from './UInt';
|
||||
* used by other types to add length-prefixed encoding, or in the case of wrapped types, taking
|
||||
* a number and making the compact representation thereof
|
||||
*/
|
||||
export default class Compact<T extends UInt | Moment> extends Base<T> {
|
||||
export default class Compact<T extends CompactEncodable> extends Base<T> {
|
||||
public constructor (Type: Constructor<T>, value: Compact<T> | AnyNumber = 0) {
|
||||
super(Compact.decodeCompact<T>(Type, value));
|
||||
}
|
||||
|
||||
public static with<T extends UInt | Moment> (Type: Constructor<T>): Constructor<Compact<T>> {
|
||||
public static with<T extends CompactEncodable> (Type: Constructor<T>): Constructor<Compact<T>> {
|
||||
return class extends Compact<T> {
|
||||
public constructor (value?: any) {
|
||||
super(Type, value);
|
||||
@@ -50,7 +53,7 @@ export default class Compact<T extends UInt | Moment> extends Base<T> {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static decodeCompact<T extends UInt | Moment> (Type: Constructor<T>, value: Compact<T> | AnyNumber): Moment | UInt {
|
||||
public static decodeCompact<T extends CompactEncodable> (Type: Constructor<T>, value: Compact<T> | AnyNumber): CompactEncodable {
|
||||
if (value instanceof Compact) {
|
||||
return new Type(value.raw);
|
||||
} else if (isString(value)) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import memoizee from 'memoizee';
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import { InterfaceRegistry } from '../interfaceRegistry';
|
||||
import { Codec, Constructor } from '../types';
|
||||
import Null from '../primitive/Null';
|
||||
import StorageData from '../primitive/StorageData';
|
||||
@@ -203,9 +204,11 @@ export function getTypeDef (_type: Text | string, name?: string): TypeDef {
|
||||
}
|
||||
|
||||
// Memoized helper of the `createClass` function below
|
||||
const memoizedCreateClass = memoizee(<T extends Codec = Codec>(type: Text | string): Constructor<T> => {
|
||||
const memoizedCreateClass = memoizee(<T extends Codec = Codec, K extends Text | string = Text | string>(
|
||||
type: K
|
||||
): Constructor<K extends keyof InterfaceRegistry ? InterfaceRegistry[K] : T> => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
return getTypeClass<T>(
|
||||
return getTypeClass<K extends keyof InterfaceRegistry ? InterfaceRegistry[K] : T>(
|
||||
getTypeDef(type)
|
||||
);
|
||||
}, {
|
||||
@@ -216,7 +219,9 @@ const memoizedCreateClass = memoizee(<T extends Codec = Codec>(type: Text | stri
|
||||
normalizer: JSON.stringify
|
||||
});
|
||||
|
||||
export function createClass<T extends Codec = Codec> (type: Text | string): Constructor<T> {
|
||||
export function createClass<T extends Codec = Codec, K extends Text | string = Text | string> (
|
||||
type: K
|
||||
): Constructor<K extends keyof InterfaceRegistry ? InterfaceRegistry[K] : T> {
|
||||
return memoizedCreateClass(type);
|
||||
}
|
||||
|
||||
@@ -318,11 +323,11 @@ export function getTypeClass<T extends Codec = Codec> (value: TypeDef, Fallback?
|
||||
}
|
||||
|
||||
// alias for createClass
|
||||
export function ClassOf<T extends Codec = Codec> (name: string): Constructor<T> {
|
||||
export function ClassOf<T extends Codec = Codec, K extends Text | string = Text | string> (name: string): Constructor<T> {
|
||||
return createClass<T>(name);
|
||||
}
|
||||
|
||||
function initType<T extends Codec = Codec> (Type: Constructor<T>, value?: any, isPedantic?: boolean): T {
|
||||
function initType<T extends Codec = Codec, K extends Text | string = Text | string> (Type: Constructor<T>, value?: any, isPedantic?: boolean): T {
|
||||
try {
|
||||
const created = new Type(value);
|
||||
|
||||
@@ -353,11 +358,13 @@ function initType<T extends Codec = Codec> (Type: Constructor<T>, value?: any, i
|
||||
}
|
||||
}
|
||||
|
||||
export default function createType<T extends Codec = Codec> (type: Text | string, value?: any, isPedantic?: boolean): T {
|
||||
// l.debug(() => ['createType', { type, value }]);
|
||||
|
||||
export default function createType<T extends Codec = Codec, K extends Text | string = Text | string> (
|
||||
type: K,
|
||||
value?: any,
|
||||
isPedantic?: boolean
|
||||
): K extends keyof InterfaceRegistry ? InterfaceRegistry[K] : T {
|
||||
try {
|
||||
return initType(createClass<T>(type), value, isPedantic);
|
||||
return initType(createClass<T, K>(type), value, isPedantic);
|
||||
} catch (error) {
|
||||
throw new Error(`createType(${type}):: ${error.message}`);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Compact, Option, Vector } from './codec';
|
||||
import { AccountId, AccountIndex, Address, Bool, Bytes, Data, Event, EventIndex, EventRecord, EventRecord0to76, Extrinsic, ExtrinsicEra, Fixed64, H160, H256, H512, I128, I16, I256, I32, I64, I8, ImmortalEra, KeyValue, Method, Moment, MomentOf, MortalEra, Null, Origin, Phantom, SignaturePayload, StorageData, StorageHasher, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, Vote, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from './primitive';
|
||||
|
||||
export interface InterfaceRegistry {
|
||||
AccountId: AccountId;
|
||||
'Option<AccountId>': Option<AccountId>;
|
||||
'Vec<AccountId>': Vector<AccountId>;
|
||||
AccountIndex: AccountIndex;
|
||||
'Compact<AccountIndex>': Compact<AccountIndex>;
|
||||
'Option<AccountIndex>': Option<AccountIndex>;
|
||||
'Vec<AccountIndex>': Vector<AccountIndex>;
|
||||
Address: Address;
|
||||
'Option<Address>': Option<Address>;
|
||||
'Vec<Address>': Vector<Address>;
|
||||
Event: Event;
|
||||
'Option<Event>': Option<Event>;
|
||||
'Vec<Event>': Vector<Event>;
|
||||
EventIndex: EventIndex;
|
||||
'Compact<EventIndex>': Compact<EventIndex>;
|
||||
'Option<EventIndex>': Option<EventIndex>;
|
||||
'Vec<EventIndex>': Vector<EventIndex>;
|
||||
EventRecord: EventRecord;
|
||||
'Option<EventRecord>': Option<EventRecord>;
|
||||
'Vec<EventRecord>': Vector<EventRecord>;
|
||||
EventRecord0to76: EventRecord0to76;
|
||||
'Option<EventRecord0to76>': Option<EventRecord0to76>;
|
||||
'Vec<EventRecord0to76>': Vector<EventRecord0to76>;
|
||||
Bool: Bool;
|
||||
'Option<Bool>': Option<Bool>;
|
||||
'Vec<Bool>': Vector<Bool>;
|
||||
bool: bool;
|
||||
'Option<bool>': Option<bool>;
|
||||
'Vec<bool>': Vector<bool>;
|
||||
Bytes: Bytes;
|
||||
'Option<Bytes>': Option<Bytes>;
|
||||
'Vec<Bytes>': Vector<Bytes>;
|
||||
Data: Data;
|
||||
'Option<Data>': Option<Data>;
|
||||
'Vec<Data>': Vector<Data>;
|
||||
H160: H160;
|
||||
'Option<H160>': Option<H160>;
|
||||
'Vec<H160>': Vector<H160>;
|
||||
H256: H256;
|
||||
'Option<H256>': Option<H256>;
|
||||
'Vec<H256>': Vector<H256>;
|
||||
H512: H512;
|
||||
'Option<H512>': Option<H512>;
|
||||
'Vec<H512>': Vector<H512>;
|
||||
I8: I8;
|
||||
'Compact<I8>': Compact<I8>;
|
||||
'Option<I8>': Option<I8>;
|
||||
'Vec<I8>': Vector<I8>;
|
||||
i8: i8;
|
||||
'Compact<i8>': Compact<i8>;
|
||||
'Option<i8>': Option<i8>;
|
||||
'Vec<i8>': Vector<i8>;
|
||||
I16: I16;
|
||||
'Compact<I16>': Compact<I16>;
|
||||
'Option<I16>': Option<I16>;
|
||||
'Vec<I16>': Vector<I16>;
|
||||
i16: i16;
|
||||
'Compact<i16>': Compact<i16>;
|
||||
'Option<i16>': Option<i16>;
|
||||
'Vec<i16>': Vector<i16>;
|
||||
I32: I32;
|
||||
'Compact<I32>': Compact<I32>;
|
||||
'Option<I32>': Option<I32>;
|
||||
'Vec<I32>': Vector<I32>;
|
||||
i32: i32;
|
||||
'Compact<i32>': Compact<i32>;
|
||||
'Option<i32>': Option<i32>;
|
||||
'Vec<i32>': Vector<i32>;
|
||||
I64: I64;
|
||||
'Compact<I64>': Compact<I64>;
|
||||
'Option<I64>': Option<I64>;
|
||||
'Vec<I64>': Vector<I64>;
|
||||
i64: i64;
|
||||
'Compact<i64>': Compact<i64>;
|
||||
'Option<i64>': Option<i64>;
|
||||
'Vec<i64>': Vector<i64>;
|
||||
Fixed64: Fixed64;
|
||||
'Compact<Fixed64>': Compact<Fixed64>;
|
||||
'Option<Fixed64>': Option<Fixed64>;
|
||||
'Vec<Fixed64>': Vector<Fixed64>;
|
||||
I128: I128;
|
||||
'Compact<I128>': Compact<I128>;
|
||||
'Option<I128>': Option<I128>;
|
||||
'Vec<I128>': Vector<I128>;
|
||||
i128: i128;
|
||||
'Compact<i128>': Compact<i128>;
|
||||
'Option<i128>': Option<i128>;
|
||||
'Vec<i128>': Vector<i128>;
|
||||
I256: I256;
|
||||
'Compact<I256>': Compact<I256>;
|
||||
'Option<I256>': Option<I256>;
|
||||
'Vec<I256>': Vector<I256>;
|
||||
i256: i256;
|
||||
'Compact<i256>': Compact<i256>;
|
||||
'Option<i256>': Option<i256>;
|
||||
'Vec<i256>': Vector<i256>;
|
||||
KeyValue: KeyValue;
|
||||
'Option<KeyValue>': Option<KeyValue>;
|
||||
'Vec<KeyValue>': Vector<KeyValue>;
|
||||
Method: Method;
|
||||
'Option<Method>': Option<Method>;
|
||||
'Vec<Method>': Vector<Method>;
|
||||
Moment: Moment;
|
||||
'Option<Moment>': Option<Moment>;
|
||||
'Vec<Moment>': Vector<Moment>;
|
||||
MomentOf: MomentOf;
|
||||
'Compact<MomentOf>': Compact<MomentOf>;
|
||||
'Option<MomentOf>': Option<MomentOf>;
|
||||
'Vec<MomentOf>': Vector<MomentOf>;
|
||||
Null: Null;
|
||||
'Option<Null>': Option<Null>;
|
||||
'Vec<Null>': Vector<Null>;
|
||||
Phantom: Phantom;
|
||||
'Option<Phantom>': Option<Phantom>;
|
||||
'Vec<Phantom>': Vector<Phantom>;
|
||||
Origin: Origin;
|
||||
'Option<Origin>': Option<Origin>;
|
||||
'Vec<Origin>': Vector<Origin>;
|
||||
StorageData: StorageData;
|
||||
'Option<StorageData>': Option<StorageData>;
|
||||
'Vec<StorageData>': Vector<StorageData>;
|
||||
StorageHasher: StorageHasher;
|
||||
'Option<StorageHasher>': Option<StorageHasher>;
|
||||
'Vec<StorageHasher>': Vector<StorageHasher>;
|
||||
StorageKey: StorageKey;
|
||||
'Option<StorageKey>': Option<StorageKey>;
|
||||
'Vec<StorageKey>': Vector<StorageKey>;
|
||||
Text: Text;
|
||||
'Option<Text>': Option<Text>;
|
||||
'Vec<Text>': Vector<Text>;
|
||||
Type: Type;
|
||||
'Option<Type>': Option<Type>;
|
||||
'Vec<Type>': Vector<Type>;
|
||||
U8: U8;
|
||||
'Compact<U8>': Compact<U8>;
|
||||
'Option<U8>': Option<U8>;
|
||||
'Vec<U8>': Vector<U8>;
|
||||
u8: u8;
|
||||
'Compact<u8>': Compact<u8>;
|
||||
'Option<u8>': Option<u8>;
|
||||
'Vec<u8>': Vector<u8>;
|
||||
U16: U16;
|
||||
'Compact<U16>': Compact<U16>;
|
||||
'Option<U16>': Option<U16>;
|
||||
'Vec<U16>': Vector<U16>;
|
||||
u16: u16;
|
||||
'Compact<u16>': Compact<u16>;
|
||||
'Option<u16>': Option<u16>;
|
||||
'Vec<u16>': Vector<u16>;
|
||||
U32: U32;
|
||||
'Compact<U32>': Compact<U32>;
|
||||
'Option<U32>': Option<U32>;
|
||||
'Vec<U32>': Vector<U32>;
|
||||
u32: u32;
|
||||
'Compact<u32>': Compact<u32>;
|
||||
'Option<u32>': Option<u32>;
|
||||
'Vec<u32>': Vector<u32>;
|
||||
U64: U64;
|
||||
'Compact<U64>': Compact<U64>;
|
||||
'Option<U64>': Option<U64>;
|
||||
'Vec<U64>': Vector<U64>;
|
||||
u64: u64;
|
||||
'Compact<u64>': Compact<u64>;
|
||||
'Option<u64>': Option<u64>;
|
||||
'Vec<u64>': Vector<u64>;
|
||||
U128: U128;
|
||||
'Compact<U128>': Compact<U128>;
|
||||
'Option<U128>': Option<U128>;
|
||||
'Vec<U128>': Vector<U128>;
|
||||
u128: u128;
|
||||
'Compact<u128>': Compact<u128>;
|
||||
'Option<u128>': Option<u128>;
|
||||
'Vec<u128>': Vector<u128>;
|
||||
U256: U256;
|
||||
'Compact<U256>': Compact<U256>;
|
||||
'Option<U256>': Option<U256>;
|
||||
'Vec<U256>': Vector<U256>;
|
||||
u256: u256;
|
||||
'Compact<u256>': Compact<u256>;
|
||||
'Option<u256>': Option<u256>;
|
||||
'Vec<u256>': Vector<u256>;
|
||||
USize: USize;
|
||||
'Compact<USize>': Compact<USize>;
|
||||
'Option<USize>': Option<USize>;
|
||||
'Vec<USize>': Vector<USize>;
|
||||
usize: usize;
|
||||
'Compact<usize>': Compact<usize>;
|
||||
'Option<usize>': Option<usize>;
|
||||
'Vec<usize>': Vector<usize>;
|
||||
Vote: Vote;
|
||||
'Option<Vote>': Option<Vote>;
|
||||
'Vec<Vote>': Vector<Vote>;
|
||||
Extrinsic: Extrinsic;
|
||||
'Option<Extrinsic>': Option<Extrinsic>;
|
||||
'Vec<Extrinsic>': Vector<Extrinsic>;
|
||||
ExtrinsicEra: ExtrinsicEra;
|
||||
'Option<ExtrinsicEra>': Option<ExtrinsicEra>;
|
||||
'Vec<ExtrinsicEra>': Vector<ExtrinsicEra>;
|
||||
MortalEra: MortalEra;
|
||||
'Option<MortalEra>': Option<MortalEra>;
|
||||
'Vec<MortalEra>': Vector<MortalEra>;
|
||||
ImmortalEra: ImmortalEra;
|
||||
'Option<ImmortalEra>': Option<ImmortalEra>;
|
||||
'Vec<ImmortalEra>': Vector<ImmortalEra>;
|
||||
SignaturePayload: SignaturePayload;
|
||||
'Option<SignaturePayload>': Option<SignaturePayload>;
|
||||
'Vec<SignaturePayload>': Vector<SignaturePayload>;
|
||||
}
|
||||
@@ -7,8 +7,10 @@ import { isString, stringCamelCase, stringUpperFirst } from '@polkadot/util';
|
||||
|
||||
import { getTypeDef, TypeDef, TypeDefInfo, TypeDefExtVecFixed } from '../codec/createType';
|
||||
import * as codecClasses from '../codec';
|
||||
import { COMPACT_ENCODABLE } from '../codec/Compact';
|
||||
import * as primitiveClasses from '../primitive';
|
||||
import * as definitions from '../srml/definitions';
|
||||
import { Constructor } from '../types';
|
||||
|
||||
// these map all the codec and primitive types for import, see the TypeImports below. If
|
||||
// we have an unseen type, it is `undefined`/`false`, if we need to import it, it is `true`
|
||||
@@ -53,6 +55,19 @@ function setImports ({ codecTypes, localTypes, ownTypes, primitiveTypes }: TypeI
|
||||
});
|
||||
}
|
||||
|
||||
// See if a class is child of another class
|
||||
// FIMXE This could go in util some day
|
||||
function isChildClass (Parent: Constructor<any>, Child: Constructor<any>): boolean {
|
||||
// https://stackoverflow.com/questions/30993434/check-if-a-constructor-inherits-another-in-es6/30993664
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
return Parent.isPrototypeOf(Child);
|
||||
}
|
||||
|
||||
function isCompactEncodable (Child: Constructor<any>): boolean {
|
||||
// @ts-ignore AbstractInt is abstract, we shouldn't isChildClass it here, but it works
|
||||
return Object.values(COMPACT_ENCODABLE).some((CompactEncodable): boolean => isChildClass(CompactEncodable, Child));
|
||||
}
|
||||
|
||||
// helper to generate a `export interface<Name> extends <Base> {<Body>}
|
||||
function createInterface (name: string = '', base: string, body: string = ''): string {
|
||||
return `export interface ${name} extends ${base} {${body.length ? '\n' : ''}${body}}`;
|
||||
@@ -221,16 +236,44 @@ function tsVector ({ ext, info, name: vectorName, sub }: TypeDef, imports: TypeI
|
||||
}
|
||||
|
||||
// creates the import lines
|
||||
function createImportCode (header: string, checks: { file: string; types: string[]}[]): string {
|
||||
function createImportCode (header: string, checks: { file: string; types: string[] }[]): string {
|
||||
return checks.reduce((result, { file, types }): string => {
|
||||
if (types.length) {
|
||||
result += `import { ${types.sort().join(', ')} } from '../${file}';\n`;
|
||||
result += `import { ${types.sort().join(', ')} } from '${file}';\n`;
|
||||
}
|
||||
|
||||
return result;
|
||||
}, header) + '\n';
|
||||
}
|
||||
|
||||
// From `T`, generate `Compact<T>, Option<T>, Vec<T>`
|
||||
function getDerivedTypes (type: string, primitiveName: string, imports: TypeImports, indent: number = 2): string {
|
||||
// `primitiveName` represents the actual primitive type our type is mapped to
|
||||
const isCompact = isCompactEncodable((primitiveClasses as any)[primitiveName]);
|
||||
setImports(imports, ['Option', 'Vector', isCompact ? 'Compact' : '']);
|
||||
|
||||
return [
|
||||
`${type}: ${type};`,
|
||||
isCompact ? `'Compact<${type}>': Compact<${type}>;` : undefined,
|
||||
`'Option<${type}>': Option<${type}>;`,
|
||||
`'Vec<${type}>': Vector<${type}>;`
|
||||
]
|
||||
.filter((x): boolean => !!x)
|
||||
.map((line): string => `${' '.repeat(indent)}${line}`) // Add indentation
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
// Do module augmentation on srml types to populate InterfaceRegistry
|
||||
function interfaceRegistry (types: Record<string, any>, imports: TypeImports): string {
|
||||
return `
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
${Object.keys(types).map((type): string => getDerivedTypes(type, types[type], imports, 4)).join('\n')}
|
||||
}
|
||||
}`;
|
||||
}
|
||||
|
||||
function generateTsDef (srmlName: string, { types }: { types: Record<string, any> }): void {
|
||||
// handlers are defined externally to use - this means that when we do a
|
||||
// `generators[typedef.info](...)` TS will show any unhandled types. Rather
|
||||
@@ -265,26 +308,27 @@ function generateTsDef (srmlName: string, { types }: { types: Record<string, any
|
||||
});
|
||||
|
||||
const sortedDefs = interfaces.sort((a, b): number => a[0].localeCompare(b[0])).map(([, definition]): string => definition).join('\n\n');
|
||||
const interfaceReg = interfaceRegistry(types, { codecTypes, localTypes, ownTypes, primitiveTypes });
|
||||
const header = createImportCode(HEADER, [
|
||||
{
|
||||
file: '../types',
|
||||
file: '../../types',
|
||||
types: codecTypes['Tuple'] ? ['Codec'] : []
|
||||
},
|
||||
{
|
||||
file: '../codec',
|
||||
file: '../../codec',
|
||||
types: Object.keys(codecTypes).filter((name): boolean => name !== 'Tuple')
|
||||
},
|
||||
{
|
||||
file: '../primitive',
|
||||
file: '../../primitive',
|
||||
types: Object.keys(primitiveTypes)
|
||||
},
|
||||
...Object.keys(localTypes).map((moduleName): { file: string; types: string[] } => ({
|
||||
file: `${moduleName}/types`,
|
||||
file: `../${moduleName}/types`,
|
||||
types: Object.keys(localTypes[moduleName])
|
||||
}))
|
||||
]);
|
||||
|
||||
fs.writeFileSync(`packages/types/src/srml/${srmlName}/types.ts`, header.concat(sortedDefs).concat(FOOTER), { flag: 'w' });
|
||||
fs.writeFileSync(`packages/types/src/srml/${srmlName}/types.ts`, header.concat(sortedDefs).concat(interfaceReg).concat(FOOTER), { flag: 'w' });
|
||||
}
|
||||
|
||||
Object.entries(definitions).forEach(([srmlName, obj]): void => {
|
||||
@@ -296,3 +340,46 @@ Object.entries(definitions).forEach(([srmlName, obj]): void => {
|
||||
console.log(`Writing srml/types.ts`);
|
||||
|
||||
fs.writeFileSync(`packages/types/src/srml/types.ts`, HEADER.concat(Object.keys(definitions).map((moduleName): string => `export * from './${moduleName}/types';`).join('\n')).concat(FOOTER), { flag: 'w' });
|
||||
|
||||
function generateInterfaceRegistry (): void {
|
||||
const codecTypes: TypeExist = {};
|
||||
const localTypes: LocalExist = {};
|
||||
const ownTypes: string[] = [];
|
||||
const primitiveTypes: TypeExist = {};
|
||||
const substrateTypes: TypeExist = {};
|
||||
|
||||
const imports = { codecTypes, localTypes, ownTypes, primitiveTypes, substrateTypes };
|
||||
|
||||
const body = Object.keys(primitiveClasses).reduce((accumulator, primitiveName): string => {
|
||||
setImports(imports, [primitiveName]);
|
||||
|
||||
return [
|
||||
accumulator,
|
||||
getDerivedTypes(primitiveName, primitiveName, imports)
|
||||
].join('\n');
|
||||
}, '');
|
||||
|
||||
const header = createImportCode(HEADER, [
|
||||
{
|
||||
file: './codec',
|
||||
types: Object.keys(codecTypes).filter((name): boolean => name !== 'Tuple')
|
||||
},
|
||||
{
|
||||
file: './primitive',
|
||||
types: Object.keys(primitiveTypes)
|
||||
}
|
||||
]);
|
||||
|
||||
const interfaceStart = 'export interface InterfaceRegistry {';
|
||||
const interfaceEnd = '\n}';
|
||||
|
||||
fs.writeFileSync(
|
||||
`packages/types/src/interfaceRegistry.ts`,
|
||||
header.concat(interfaceStart).concat(body).concat(interfaceEnd).concat(FOOTER)
|
||||
, { flag: 'w' }
|
||||
);
|
||||
}
|
||||
|
||||
console.log(`Writing interfaceRegistry.ts`);
|
||||
|
||||
generateInterfaceRegistry();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Enum, Option } from '../../codec';
|
||||
import { Enum, Option, Vector } from '../../codec';
|
||||
import { AccountId } from '../../primitive';
|
||||
import { BlockNumber, Hash } from '../runtime/types';
|
||||
|
||||
@@ -23,3 +23,17 @@ export interface UncleEntryItem extends Enum {
|
||||
readonly isUncle: boolean;
|
||||
readonly asUncle: Uncle;
|
||||
}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
InclusionHeight: InclusionHeight;
|
||||
'Option<InclusionHeight>': Option<InclusionHeight>;
|
||||
'Vec<InclusionHeight>': Vector<InclusionHeight>;
|
||||
Uncle: Uncle;
|
||||
'Option<Uncle>': Option<Uncle>;
|
||||
'Vec<Uncle>': Vector<Uncle>;
|
||||
UncleEntryItem: UncleEntryItem;
|
||||
'Option<UncleEntryItem>': Option<UncleEntryItem>;
|
||||
'Vec<UncleEntryItem>': Vector<UncleEntryItem>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Compact, Option, Vector } from '../../codec';
|
||||
import { u64 } from '../../primitive';
|
||||
|
||||
export interface BabeWeight extends u64 {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
BabeWeight: BabeWeight;
|
||||
'Compact<BabeWeight>': Compact<BabeWeight>;
|
||||
'Option<BabeWeight>': Option<BabeWeight>;
|
||||
'Vec<BabeWeight>': Vector<BabeWeight>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Set, Struct } from '../../codec';
|
||||
import { Option, Set, Struct, Vector } from '../../codec';
|
||||
import { Balance, BlockNumber, LockIdentifier } from '../runtime/types';
|
||||
|
||||
export interface BalanceLock extends Struct {
|
||||
@@ -22,3 +22,17 @@ export interface WithdrawReasons extends Set {
|
||||
readonly isReserve: boolean;
|
||||
readonly isFee: boolean;
|
||||
}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
VestingSchedule: VestingSchedule;
|
||||
'Option<VestingSchedule>': Option<VestingSchedule>;
|
||||
'Vec<VestingSchedule>': Vector<VestingSchedule>;
|
||||
WithdrawReasons: WithdrawReasons;
|
||||
'Option<WithdrawReasons>': Option<WithdrawReasons>;
|
||||
'Vec<WithdrawReasons>': Vector<WithdrawReasons>;
|
||||
BalanceLock: BalanceLock;
|
||||
'Option<BalanceLock>': Option<BalanceLock>;
|
||||
'Vec<BalanceLock>': Vector<BalanceLock>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Struct, Vector } from '../../codec';
|
||||
import { Compact, Option, Struct, Vector } from '../../codec';
|
||||
import { AccountId, u32, u64 } from '../../primitive';
|
||||
|
||||
export interface MemberCount extends u64 {}
|
||||
@@ -14,3 +14,19 @@ export interface Votes extends Struct {
|
||||
readonly ayes: Vector<AccountId>;
|
||||
readonly nays: Vector<AccountId>;
|
||||
}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
MemberCount: MemberCount;
|
||||
'Compact<MemberCount>': Compact<MemberCount>;
|
||||
'Option<MemberCount>': Option<MemberCount>;
|
||||
'Vec<MemberCount>': Vector<MemberCount>;
|
||||
ProposalIndex: ProposalIndex;
|
||||
'Compact<ProposalIndex>': Compact<ProposalIndex>;
|
||||
'Option<ProposalIndex>': Option<ProposalIndex>;
|
||||
'Vec<ProposalIndex>': Vector<ProposalIndex>;
|
||||
Votes: Votes;
|
||||
'Option<Votes>': Option<Votes>;
|
||||
'Vec<Votes>': Vector<Votes>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Option, Vector } from '../../codec';
|
||||
import { AccountId } from '../../primitive';
|
||||
|
||||
export interface AuthorityId extends AccountId {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
AuthorityId: AuthorityId;
|
||||
'Option<AuthorityId>': Option<AuthorityId>;
|
||||
'Vec<AuthorityId>': Vector<AuthorityId>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,3 +66,42 @@ export interface SeedOf extends Hash {}
|
||||
export interface TombstoneContractInfo extends Hash {}
|
||||
|
||||
export interface TrieId extends Bytes {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
CodeHash: CodeHash;
|
||||
'Option<CodeHash>': Option<CodeHash>;
|
||||
'Vec<CodeHash>': Vector<CodeHash>;
|
||||
TrieId: TrieId;
|
||||
'Option<TrieId>': Option<TrieId>;
|
||||
'Vec<TrieId>': Vector<TrieId>;
|
||||
AliveContractInfo: AliveContractInfo;
|
||||
'Option<AliveContractInfo>': Option<AliveContractInfo>;
|
||||
'Vec<AliveContractInfo>': Vector<AliveContractInfo>;
|
||||
TombstoneContractInfo: TombstoneContractInfo;
|
||||
'Option<TombstoneContractInfo>': Option<TombstoneContractInfo>;
|
||||
'Vec<TombstoneContractInfo>': Vector<TombstoneContractInfo>;
|
||||
ContractInfo: ContractInfo;
|
||||
'Option<ContractInfo>': Option<ContractInfo>;
|
||||
'Vec<ContractInfo>': Vector<ContractInfo>;
|
||||
ContractStorageKey: ContractStorageKey;
|
||||
'Option<ContractStorageKey>': Option<ContractStorageKey>;
|
||||
'Vec<ContractStorageKey>': Vector<ContractStorageKey>;
|
||||
Gas: Gas;
|
||||
'Compact<Gas>': Compact<Gas>;
|
||||
'Option<Gas>': Option<Gas>;
|
||||
'Vec<Gas>': Vector<Gas>;
|
||||
PrefabWasmModuleReserved: PrefabWasmModuleReserved;
|
||||
'Option<PrefabWasmModuleReserved>': Option<PrefabWasmModuleReserved>;
|
||||
'Vec<PrefabWasmModuleReserved>': Vector<PrefabWasmModuleReserved>;
|
||||
PrefabWasmModule: PrefabWasmModule;
|
||||
'Option<PrefabWasmModule>': Option<PrefabWasmModule>;
|
||||
'Vec<PrefabWasmModule>': Vector<PrefabWasmModule>;
|
||||
Schedule: Schedule;
|
||||
'Option<Schedule>': Option<Schedule>;
|
||||
'Vec<Schedule>': Vector<Schedule>;
|
||||
SeedOf: SeedOf;
|
||||
'Option<SeedOf>': Option<SeedOf>;
|
||||
'Vec<SeedOf>': Vector<SeedOf>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Enum, Struct } from '../../codec';
|
||||
import { Compact, Enum, Option, Struct, Vector } from '../../codec';
|
||||
import { Method, u32 } from '../../primitive';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { VoteThreshold } from '../elections/types';
|
||||
@@ -45,3 +45,25 @@ export interface ReferendumInfo extends Struct {
|
||||
readonly threshold: VoteThreshold;
|
||||
readonly delay: BlockNumber;
|
||||
}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
Conviction: Conviction;
|
||||
'Option<Conviction>': Option<Conviction>;
|
||||
'Vec<Conviction>': Vector<Conviction>;
|
||||
PropIndex: PropIndex;
|
||||
'Compact<PropIndex>': Compact<PropIndex>;
|
||||
'Option<PropIndex>': Option<PropIndex>;
|
||||
'Vec<PropIndex>': Vector<PropIndex>;
|
||||
Proposal: Proposal;
|
||||
'Option<Proposal>': Option<Proposal>;
|
||||
'Vec<Proposal>': Vector<Proposal>;
|
||||
ReferendumIndex: ReferendumIndex;
|
||||
'Compact<ReferendumIndex>': Compact<ReferendumIndex>;
|
||||
'Option<ReferendumIndex>': Option<ReferendumIndex>;
|
||||
'Vec<ReferendumIndex>': Vector<ReferendumIndex>;
|
||||
ReferendumInfo: ReferendumInfo;
|
||||
'Option<ReferendumInfo>': Option<ReferendumInfo>;
|
||||
'Vec<ReferendumInfo>': Vector<ReferendumInfo>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Enum, Struct } from '../../codec';
|
||||
import { Compact, Enum, Option, Struct, Vector } from '../../codec';
|
||||
import { AccountId, Bytes, Null, i8, u32, u64 } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
|
||||
@@ -36,3 +36,34 @@ export interface NewAccountOutcome extends Enum {
|
||||
export interface OpaqueKey extends Bytes {}
|
||||
|
||||
export interface SessionKey extends AccountId {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
NewAccountOutcome: NewAccountOutcome;
|
||||
'Option<NewAccountOutcome>': Option<NewAccountOutcome>;
|
||||
'Vec<NewAccountOutcome>': Vector<NewAccountOutcome>;
|
||||
Amount: Amount;
|
||||
'Option<Amount>': Option<Amount>;
|
||||
'Vec<Amount>': Vector<Amount>;
|
||||
AssetOf: AssetOf;
|
||||
'Compact<AssetOf>': Compact<AssetOf>;
|
||||
'Option<AssetOf>': Option<AssetOf>;
|
||||
'Vec<AssetOf>': Vector<AssetOf>;
|
||||
AccountInfo: AccountInfo;
|
||||
'Option<AccountInfo>': Option<AccountInfo>;
|
||||
'Vec<AccountInfo>': Vector<AccountInfo>;
|
||||
LockPeriods: LockPeriods;
|
||||
'Compact<LockPeriods>': Compact<LockPeriods>;
|
||||
'Option<LockPeriods>': Option<LockPeriods>;
|
||||
'Vec<LockPeriods>': Vector<LockPeriods>;
|
||||
InherentOfflineReport: InherentOfflineReport;
|
||||
'Option<InherentOfflineReport>': Option<InherentOfflineReport>;
|
||||
'Vec<InherentOfflineReport>': Vector<InherentOfflineReport>;
|
||||
SessionKey: SessionKey;
|
||||
'Option<SessionKey>': Option<SessionKey>;
|
||||
'Vec<SessionKey>': Vector<SessionKey>;
|
||||
OpaqueKey: OpaqueKey;
|
||||
'Option<OpaqueKey>': Option<OpaqueKey>;
|
||||
'Vec<OpaqueKey>': Vector<OpaqueKey>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Enum, Struct } from '../../codec';
|
||||
import { Compact, Enum, Option, Struct, Vector } from '../../codec';
|
||||
import { u32 } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
|
||||
@@ -32,3 +32,26 @@ export interface VoteThreshold extends Enum {
|
||||
*/
|
||||
readonly isSimpleMajority: boolean;
|
||||
}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
ApprovalFlag: ApprovalFlag;
|
||||
'Compact<ApprovalFlag>': Compact<ApprovalFlag>;
|
||||
'Option<ApprovalFlag>': Option<ApprovalFlag>;
|
||||
'Vec<ApprovalFlag>': Vector<ApprovalFlag>;
|
||||
SetIndex: SetIndex;
|
||||
'Compact<SetIndex>': Compact<SetIndex>;
|
||||
'Option<SetIndex>': Option<SetIndex>;
|
||||
'Vec<SetIndex>': Vector<SetIndex>;
|
||||
VoteIndex: VoteIndex;
|
||||
'Compact<VoteIndex>': Compact<VoteIndex>;
|
||||
'Option<VoteIndex>': Option<VoteIndex>;
|
||||
'Vec<VoteIndex>': Vector<VoteIndex>;
|
||||
VoterInfo: VoterInfo;
|
||||
'Option<VoterInfo>': Option<VoterInfo>;
|
||||
'Vec<VoterInfo>': Vector<VoterInfo>;
|
||||
VoteThreshold: VoteThreshold;
|
||||
'Option<VoteThreshold>': Option<VoteThreshold>;
|
||||
'Vec<VoteThreshold>': Vector<VoteThreshold>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Enum, Struct, Vector } from '../../codec';
|
||||
import { Compact, Enum, Option, Struct, Vector } from '../../codec';
|
||||
import { u64 } from '../../primitive';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { AuthorityId } from '../consensus/types';
|
||||
@@ -48,3 +48,27 @@ export interface StoredState extends Enum {
|
||||
readonly isPendingResume: boolean;
|
||||
readonly asPendingResume: PendingResume;
|
||||
}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
AuthorityWeight: AuthorityWeight;
|
||||
'Compact<AuthorityWeight>': Compact<AuthorityWeight>;
|
||||
'Option<AuthorityWeight>': Option<AuthorityWeight>;
|
||||
'Vec<AuthorityWeight>': Vector<AuthorityWeight>;
|
||||
NextAuthority: NextAuthority;
|
||||
'Option<NextAuthority>': Option<NextAuthority>;
|
||||
'Vec<NextAuthority>': Vector<NextAuthority>;
|
||||
PendingPause: PendingPause;
|
||||
'Option<PendingPause>': Option<PendingPause>;
|
||||
'Vec<PendingPause>': Vector<PendingPause>;
|
||||
PendingResume: PendingResume;
|
||||
'Option<PendingResume>': Option<PendingResume>;
|
||||
'Vec<PendingResume>': Vector<PendingResume>;
|
||||
StoredPendingChange: StoredPendingChange;
|
||||
'Option<StoredPendingChange>': Option<StoredPendingChange>;
|
||||
'Vec<StoredPendingChange>': Vector<StoredPendingChange>;
|
||||
StoredState: StoredState;
|
||||
'Option<StoredState>': Option<StoredState>;
|
||||
'Vec<StoredState>': Vector<StoredState>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Struct, Vector } from '../../codec';
|
||||
import { Option, Struct, Vector } from '../../codec';
|
||||
import { Bytes } from '../../primitive';
|
||||
import { BlockNumber } from '../runtime/types';
|
||||
import { AuthorityId } from '../consensus/types';
|
||||
@@ -22,3 +22,20 @@ export interface OpaqueNetworkState extends Struct {
|
||||
}
|
||||
|
||||
export interface OpaquePeerId extends Bytes {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
OpaqueMultiaddr: OpaqueMultiaddr;
|
||||
'Option<OpaqueMultiaddr>': Option<OpaqueMultiaddr>;
|
||||
'Vec<OpaqueMultiaddr>': Vector<OpaqueMultiaddr>;
|
||||
OpaquePeerId: OpaquePeerId;
|
||||
'Option<OpaquePeerId>': Option<OpaquePeerId>;
|
||||
'Vec<OpaquePeerId>': Vector<OpaquePeerId>;
|
||||
OpaqueNetworkState: OpaqueNetworkState;
|
||||
'Option<OpaqueNetworkState>': Option<OpaqueNetworkState>;
|
||||
'Vec<OpaqueNetworkState>': Vector<OpaqueNetworkState>;
|
||||
Heartbeat: Heartbeat;
|
||||
'Option<Heartbeat>': Option<Heartbeat>;
|
||||
'Vec<Heartbeat>': Vector<Heartbeat>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { Enum, Struct, Vector } from '../../codec';
|
||||
import { Compact, Enum, Option, Struct, Vector } from '../../codec';
|
||||
import { AccountId, Bytes, u32, u64 } from '../../primitive';
|
||||
import { BalanceOf, BlockNumber, Hash, Signature } from '../runtime/types';
|
||||
|
||||
@@ -175,3 +175,87 @@ export interface WinningData extends Vector<WinningDataEntry> {}
|
||||
|
||||
type _WinningDataEntry = [AccountId, ParaIdOf, BalanceOf];
|
||||
export interface WinningDataEntry extends Codec, _WinningDataEntry {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
AuctionIndex: AuctionIndex;
|
||||
'Compact<AuctionIndex>': Compact<AuctionIndex>;
|
||||
'Option<AuctionIndex>': Option<AuctionIndex>;
|
||||
'Vec<AuctionIndex>': Vector<AuctionIndex>;
|
||||
CollatorSignature: CollatorSignature;
|
||||
'Option<CollatorSignature>': Option<CollatorSignature>;
|
||||
'Vec<CollatorSignature>': Vector<CollatorSignature>;
|
||||
ValidityAttestation: ValidityAttestation;
|
||||
'Option<ValidityAttestation>': Option<ValidityAttestation>;
|
||||
'Vec<ValidityAttestation>': Vector<ValidityAttestation>;
|
||||
ParaId: ParaId;
|
||||
'Compact<ParaId>': Compact<ParaId>;
|
||||
'Option<ParaId>': Option<ParaId>;
|
||||
'Vec<ParaId>': Vector<ParaId>;
|
||||
ParaIdOf: ParaIdOf;
|
||||
'Option<ParaIdOf>': Option<ParaIdOf>;
|
||||
'Vec<ParaIdOf>': Vector<ParaIdOf>;
|
||||
ValidatorIndex: ValidatorIndex;
|
||||
'Compact<ValidatorIndex>': Compact<ValidatorIndex>;
|
||||
'Option<ValidatorIndex>': Option<ValidatorIndex>;
|
||||
'Vec<ValidatorIndex>': Vector<ValidatorIndex>;
|
||||
ValidityVote: ValidityVote;
|
||||
'Option<ValidityVote>': Option<ValidityVote>;
|
||||
'Vec<ValidityVote>': Vector<ValidityVote>;
|
||||
BalanceUpload: BalanceUpload;
|
||||
'Option<BalanceUpload>': Option<BalanceUpload>;
|
||||
'Vec<BalanceUpload>': Vector<BalanceUpload>;
|
||||
EgressQueueRoot: EgressQueueRoot;
|
||||
'Option<EgressQueueRoot>': Option<EgressQueueRoot>;
|
||||
'Vec<EgressQueueRoot>': Vector<EgressQueueRoot>;
|
||||
HeadData: HeadData;
|
||||
'Option<HeadData>': Option<HeadData>;
|
||||
'Vec<HeadData>': Vector<HeadData>;
|
||||
CandidateReceipt: CandidateReceipt;
|
||||
'Option<CandidateReceipt>': Option<CandidateReceipt>;
|
||||
'Vec<CandidateReceipt>': Vector<CandidateReceipt>;
|
||||
AttestedCandidate: AttestedCandidate;
|
||||
'Option<AttestedCandidate>': Option<AttestedCandidate>;
|
||||
'Vec<AttestedCandidate>': Vector<AttestedCandidate>;
|
||||
SubId: SubId;
|
||||
'Compact<SubId>': Compact<SubId>;
|
||||
'Option<SubId>': Option<SubId>;
|
||||
'Vec<SubId>': Vector<SubId>;
|
||||
NewBidder: NewBidder;
|
||||
'Option<NewBidder>': Option<NewBidder>;
|
||||
'Vec<NewBidder>': Vector<NewBidder>;
|
||||
Bidder: Bidder;
|
||||
'Option<Bidder>': Option<Bidder>;
|
||||
'Vec<Bidder>': Vector<Bidder>;
|
||||
IncomingParachainDeploy: IncomingParachainDeploy;
|
||||
'Option<IncomingParachainDeploy>': Option<IncomingParachainDeploy>;
|
||||
'Vec<IncomingParachainDeploy>': Vector<IncomingParachainDeploy>;
|
||||
IncomingParachainFixed: IncomingParachainFixed;
|
||||
'Option<IncomingParachainFixed>': Option<IncomingParachainFixed>;
|
||||
'Vec<IncomingParachainFixed>': Vector<IncomingParachainFixed>;
|
||||
IncomingParachain: IncomingParachain;
|
||||
'Option<IncomingParachain>': Option<IncomingParachain>;
|
||||
'Vec<IncomingParachain>': Vector<IncomingParachain>;
|
||||
LeasePeriod: LeasePeriod;
|
||||
'Option<LeasePeriod>': Option<LeasePeriod>;
|
||||
'Vec<LeasePeriod>': Vector<LeasePeriod>;
|
||||
LeasePeriodOf: LeasePeriodOf;
|
||||
'Option<LeasePeriodOf>': Option<LeasePeriodOf>;
|
||||
'Vec<LeasePeriodOf>': Vector<LeasePeriodOf>;
|
||||
ParachainDispatchOrigin: ParachainDispatchOrigin;
|
||||
'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>;
|
||||
'Vec<ParachainDispatchOrigin>': Vector<ParachainDispatchOrigin>;
|
||||
SlotRange: SlotRange;
|
||||
'Option<SlotRange>': Option<SlotRange>;
|
||||
'Vec<SlotRange>': Vector<SlotRange>;
|
||||
UpwardMessage: UpwardMessage;
|
||||
'Option<UpwardMessage>': Option<UpwardMessage>;
|
||||
'Vec<UpwardMessage>': Vector<UpwardMessage>;
|
||||
WinningDataEntry: WinningDataEntry;
|
||||
'Option<WinningDataEntry>': Option<WinningDataEntry>;
|
||||
'Vec<WinningDataEntry>': Vector<WinningDataEntry>;
|
||||
WinningData: WinningData;
|
||||
'Option<WinningData>': Option<WinningData>;
|
||||
'Vec<WinningData>': Vector<WinningData>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Struct, Vector } from '../../codec';
|
||||
import { Compact, Option, Struct, Vector } from '../../codec';
|
||||
import { AccountId, Bytes, Fixed64, H256, H512, u128, u32, u64, u8 } from '../../primitive';
|
||||
|
||||
export interface AccountIdOf extends AccountId {}
|
||||
@@ -41,3 +41,70 @@ export interface ValidatorId extends AccountId {}
|
||||
export interface Weight extends u32 {}
|
||||
|
||||
export interface WeightMultiplier extends Fixed64 {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
AccountIdOf: AccountIdOf;
|
||||
'Option<AccountIdOf>': Option<AccountIdOf>;
|
||||
'Vec<AccountIdOf>': Vector<AccountIdOf>;
|
||||
Balance: Balance;
|
||||
'Compact<Balance>': Compact<Balance>;
|
||||
'Option<Balance>': Option<Balance>;
|
||||
'Vec<Balance>': Vector<Balance>;
|
||||
BalanceOf: BalanceOf;
|
||||
'Option<BalanceOf>': Option<BalanceOf>;
|
||||
'Vec<BalanceOf>': Vector<BalanceOf>;
|
||||
BlockNumber: BlockNumber;
|
||||
'Compact<BlockNumber>': Compact<BlockNumber>;
|
||||
'Option<BlockNumber>': Option<BlockNumber>;
|
||||
'Vec<BlockNumber>': Vector<BlockNumber>;
|
||||
Hash: Hash;
|
||||
'Option<Hash>': Option<Hash>;
|
||||
'Vec<Hash>': Vector<Hash>;
|
||||
Justification: Justification;
|
||||
'Option<Justification>': Option<Justification>;
|
||||
'Vec<Justification>': Vector<Justification>;
|
||||
KeyTypeId: KeyTypeId;
|
||||
'Compact<KeyTypeId>': Compact<KeyTypeId>;
|
||||
'Option<KeyTypeId>': Option<KeyTypeId>;
|
||||
'Vec<KeyTypeId>': Vector<KeyTypeId>;
|
||||
LockIdentifier: LockIdentifier;
|
||||
'Option<LockIdentifier>': Option<LockIdentifier>;
|
||||
'Vec<LockIdentifier>': Vector<LockIdentifier>;
|
||||
Index: Index;
|
||||
'Compact<Index>': Compact<Index>;
|
||||
'Option<Index>': Option<Index>;
|
||||
'Vec<Index>': Vector<Index>;
|
||||
Perbill: Perbill;
|
||||
'Compact<Perbill>': Compact<Perbill>;
|
||||
'Option<Perbill>': Option<Perbill>;
|
||||
'Vec<Perbill>': Vector<Perbill>;
|
||||
Permill: Permill;
|
||||
'Compact<Permill>': Compact<Permill>;
|
||||
'Option<Permill>': Option<Permill>;
|
||||
'Vec<Permill>': Vector<Permill>;
|
||||
SessionKeys: SessionKeys;
|
||||
'Option<SessionKeys>': Option<SessionKeys>;
|
||||
'Vec<SessionKeys>': Vector<SessionKeys>;
|
||||
Signature: Signature;
|
||||
'Option<Signature>': Option<Signature>;
|
||||
'Vec<Signature>': Vector<Signature>;
|
||||
Ed25519Signature: Ed25519Signature;
|
||||
'Option<Ed25519Signature>': Option<Ed25519Signature>;
|
||||
'Vec<Ed25519Signature>': Vector<Ed25519Signature>;
|
||||
Sr25519Signature: Sr25519Signature;
|
||||
'Option<Sr25519Signature>': Option<Sr25519Signature>;
|
||||
'Vec<Sr25519Signature>': Vector<Sr25519Signature>;
|
||||
ValidatorId: ValidatorId;
|
||||
'Option<ValidatorId>': Option<ValidatorId>;
|
||||
'Vec<ValidatorId>': Vector<ValidatorId>;
|
||||
Weight: Weight;
|
||||
'Compact<Weight>': Compact<Weight>;
|
||||
'Option<Weight>': Option<Weight>;
|
||||
'Vec<Weight>': Vector<Weight>;
|
||||
WeightMultiplier: WeightMultiplier;
|
||||
'Compact<WeightMultiplier>': Compact<WeightMultiplier>;
|
||||
'Option<WeightMultiplier>': Option<WeightMultiplier>;
|
||||
'Vec<WeightMultiplier>': Vector<WeightMultiplier>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Compact, Option, Vector } from '../../codec';
|
||||
import { u32 } from '../../primitive';
|
||||
import { SessionKeys } from '../runtime/types';
|
||||
|
||||
export interface Keys extends SessionKeys {}
|
||||
|
||||
export interface SessionIndex extends u32 {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
SessionIndex: SessionIndex;
|
||||
'Compact<SessionIndex>': Compact<SessionIndex>;
|
||||
'Option<SessionIndex>': Option<SessionIndex>;
|
||||
'Vec<SessionIndex>': Vector<SessionIndex>;
|
||||
Keys: Keys;
|
||||
'Option<Keys>': Option<Keys>;
|
||||
'Vec<Keys>': Vector<Keys>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Compact, Enum, Struct, Vector } from '../../codec';
|
||||
import { Compact, Enum, Option, Struct, Vector } from '../../codec';
|
||||
import { AccountId, u32 } from '../../primitive';
|
||||
import { Balance, BlockNumber } from '../runtime/types';
|
||||
|
||||
@@ -54,3 +54,33 @@ export interface ValidatorPrefs extends Struct {
|
||||
readonly unstakeThreshold: Compact<u32>;
|
||||
readonly validatorPayment: Compact<Balance>;
|
||||
}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
EraIndex: EraIndex;
|
||||
'Compact<EraIndex>': Compact<EraIndex>;
|
||||
'Option<EraIndex>': Option<EraIndex>;
|
||||
'Vec<EraIndex>': Vector<EraIndex>;
|
||||
EraRewards: EraRewards;
|
||||
'Option<EraRewards>': Option<EraRewards>;
|
||||
'Vec<EraRewards>': Vector<EraRewards>;
|
||||
IndividualExposure: IndividualExposure;
|
||||
'Option<IndividualExposure>': Option<IndividualExposure>;
|
||||
'Vec<IndividualExposure>': Vector<IndividualExposure>;
|
||||
Exposure: Exposure;
|
||||
'Option<Exposure>': Option<Exposure>;
|
||||
'Vec<Exposure>': Vector<Exposure>;
|
||||
RewardDestination: RewardDestination;
|
||||
'Option<RewardDestination>': Option<RewardDestination>;
|
||||
'Vec<RewardDestination>': Vector<RewardDestination>;
|
||||
UnlockChunk: UnlockChunk;
|
||||
'Option<UnlockChunk>': Option<UnlockChunk>;
|
||||
'Vec<UnlockChunk>': Vector<UnlockChunk>;
|
||||
StakingLedger: StakingLedger;
|
||||
'Option<StakingLedger>': Option<StakingLedger>;
|
||||
'Vec<StakingLedger>': Vector<StakingLedger>;
|
||||
ValidatorPrefs: ValidatorPrefs;
|
||||
'Option<ValidatorPrefs>': Option<ValidatorPrefs>;
|
||||
'Vec<ValidatorPrefs>': Vector<ValidatorPrefs>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Option, Vector } from '../../codec';
|
||||
import { Bytes } from '../../primitive';
|
||||
|
||||
export interface Key extends Bytes {}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
Key: Key;
|
||||
'Option<Key>': Option<Key>;
|
||||
'Vec<Key>': Vector<Key>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
// Auto-generated via `yarn build:srmlTs`, do not edit
|
||||
|
||||
import { Struct } from '../../codec';
|
||||
import { Option, Struct, Vector } from '../../codec';
|
||||
import { AccountId } from '../../primitive';
|
||||
import { Balance } from '../runtime/types';
|
||||
|
||||
@@ -11,3 +11,11 @@ export interface TreasuryProposal extends Struct {
|
||||
readonly beneficiary: AccountId;
|
||||
readonly bond: Balance;
|
||||
}
|
||||
|
||||
declare module '@polkadot/types/interfaceRegistry' {
|
||||
export interface InterfaceRegistry {
|
||||
TreasuryProposal: TreasuryProposal;
|
||||
'Option<TreasuryProposal>': Option<TreasuryProposal>;
|
||||
'Vec<TreasuryProposal>': Vector<TreasuryProposal>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user