Lazily create registry types (also solves resolution order) (#1291)

* Lazily create registry types (also solves resolution order)

* Typo in comment

* Alphabetical definitions (ordering detected)

* Make fallback & SessionKeys work as expected

* Cleanup registration, user-types takes priority

* typo

* Api constructors only take options

* Cleanup typos

* Don't create classes while validating metadata

* Adjust badges... well, waiting for CI, so...

* typo
This commit is contained in:
Jaco Greeff
2019-08-10 14:24:04 +02:00
committed by GitHub
parent 62ba9f9b95
commit b595428372
49 changed files with 447 additions and 443 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ const testFunction = (api: ApiRx): any => {
describe('derive', (): void => {
describe('builtin', (): void => {
const api = new ApiRx(new MockProvider());
const api = new ApiRx({ provider: new MockProvider() });
beforeAll((done): void => {
api.isReady.subscribe((): void => done());
+16 -26
View File
@@ -3,7 +3,6 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { RpcInterface } from '@polkadot/rpc-core/jsonrpc.types';
import { ProviderInterface } from '@polkadot/rpc-provider/types';
import { Hash, RuntimeVersion, SignedBlock } from '@polkadot/types/interfaces';
import { AnyFunction, CallFunction, Codec, CodecArg, ModulesWithCalls, RegistryTypes } from '@polkadot/types/types';
import { ApiInterfaceRx, ApiInterfaceEvents, ApiOptions, ApiTypes, DecorateMethodOptions, DecoratedRpc, DecoratedRpcSection, QueryableModuleStorage, QueryableStorage, QueryableStorageEntry, QueryableStorageMulti, QueryableStorageMultiArg, QueryableStorageMultiArgs, SignerPayloadRawBase, SubmittableExtrinsicFunction, SubmittableExtrinsics, SubmittableModuleExtrinsics, Signer } from './types';
@@ -22,9 +21,8 @@ import { WsProvider } from '@polkadot/rpc-provider';
import { getTypeRegistry, GenericCall, GenericEvent, Metadata, Null, u64 } from '@polkadot/types';
import Linkage, { LinkageResult } from '@polkadot/types/codec/Linkage';
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/primitive/Extrinsic/constants';
import * as interfacesTypes from '@polkadot/types/interfaces/definitions';
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { assert, compactStripLength, isFunction, isObject, isString, isUndefined, logger, u8aToHex, u8aToU8a } from '@polkadot/util';
import { assert, compactStripLength, isString, isUndefined, logger, u8aToHex, u8aToU8a } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import createSubmittable, { SubmittableExtrinsic } from './SubmittableExtrinsic';
@@ -117,14 +115,18 @@ export default abstract class ApiBase<ApiType> {
* });
* ```
*/
public constructor (provider: ApiOptions | ProviderInterface = {}, type: ApiTypes) {
const options = isObject(provider) && isFunction((provider as ProviderInterface).send)
? { provider } as unknown as ApiOptions
: provider as ApiOptions;
public constructor (options: ApiOptions = {}, type: ApiTypes) {
const thisProvider = options.source
? options.source._rpcCore.provider.clone()
: (options.provider || new WsProvider());
// We only register the types (global) if this is not a cloned instance.
// Do right up-front, so we get in the user types before we are actually
// doing anything on-chain, this ensures we have the overrides in-place
if (!options.source && options.types) {
this.registerTypes(options.types);
}
this._options = options;
this._type = type;
this._eventemitter = new EventEmitter();
@@ -139,17 +141,6 @@ export default abstract class ApiBase<ApiType> {
this._rx.queryMulti = this.decorateMulti(rxDecorateMethod);
this._rx.signer = options.signer;
// we only re-register the types (global) if this is not a cloned instance
if (!options.source) {
// first register the definitions we have, i.e. those where there are no type classes
Object.values(interfacesTypes).forEach(({ types }): void =>
this.registerTypes(types)
);
// next register all the user types
this.registerTypes(options.types);
}
this.init();
}
@@ -538,6 +529,13 @@ export default abstract class ApiBase<ApiType> {
this._rpcCore.chain.getRuntimeVersion().toPromise()
]);
// NOTE The SessionKeys definition for Polkadot and Substrate (OpaqueKeys
// implementation) are different. Detect Polkadot and inject the `Keys`
// definition as applicable. (3 keys in substrate vs 4 in Polkadot).
if (this._runtimeVersion.specName.eq('polkadot')) {
getTypeRegistry().register({ Keys: 'SessionKeysPolkadot' });
}
const metadataKey = `${this._genesisHash}-${(this._runtimeVersion as RuntimeVersion).specVersion}`;
if (metadataKey in metadata) {
@@ -574,14 +572,6 @@ export default abstract class ApiBase<ApiType> {
this._query = this.decorateStorage(storage, this.decorateMethod);
this._consts = constants;
// NOTE The SessionKeys definition for Polkadot and Substrate (OpaqueKeys
// implementation) are different. Detect Polkadot and inject the `Keys`
// definition as applicable. (3 keys in substrate vs 4 in Polkadot). If
// we have reflected metadata, this override becomes unneeded
if (this._query.parachains) {
getTypeRegistry().register({ Keys: 'SessionKeysPolkadot' });
}
this._rx.extrinsicType = this._extrinsicType;
this._rx.genesisHash = this._genesisHash;
this._rx.runtimeVersion = this._runtimeVersion;
+3 -4
View File
@@ -2,7 +2,6 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { ProviderInterface } from '@polkadot/rpc-provider/types';
import { AnyFunction, Callback, Codec } from '@polkadot/types/types';
import { ApiOptions, DecorateMethodOptions, ObsInnerType, StorageEntryPromiseOverloads, UnsubscribePromise } from '../types';
@@ -55,7 +54,7 @@ import Combinator, { CombinatorCallback, CombinatorFunction } from './Combinator
* const provider = new WsProvider('wss://example.com:9944')
*
* // initialise via isReady & new with specific provider
* const api = await new ApiPromise(provider).isReady;
* const api = await new ApiPromise({ provider }).isReady;
*
* // retrieve the block target time
* const blockPeriod = await api.query.timestamp.blockPeriod().toNumber();
@@ -120,7 +119,7 @@ export default class ApiPromise extends ApiBase<'promise'> {
* });
* ```
*/
public static create (options: ApiOptions | ProviderInterface = {}): Promise<ApiPromise> {
public static create (options?: ApiOptions): Promise<ApiPromise> {
return new ApiPromise(options).isReady;
}
@@ -143,7 +142,7 @@ export default class ApiPromise extends ApiBase<'promise'> {
* });
* ```
*/
public constructor (options?: ApiOptions | ProviderInterface) {
public constructor (options?: ApiOptions) {
super(options, 'promise');
this._isReadyPromise = new Promise((resolve): void => {
+4 -5
View File
@@ -2,7 +2,6 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { ProviderInterface } from '@polkadot/rpc-provider/types';
import { AnyFunction } from '@polkadot/types/types';
import { ApiOptions } from '../types';
@@ -55,7 +54,7 @@ import ApiBase from '../Base';
* const provider = new WsProvider('wss://example.com:9944')
*
* // initialise via isReady & new with specific provider
* new ApiRx(provider)
* new ApiRx({ provider })
* .isReady
* .pipe(
* switchMap((api) =>
@@ -135,7 +134,7 @@ export default class ApiRx extends ApiBase<'rxjs'> {
* });
* ```
*/
public static create (options?: ApiOptions | ProviderInterface): Observable<ApiRx> {
public static create (options?: ApiOptions): Observable<ApiRx> {
return new ApiRx(options).isReady;
}
@@ -161,8 +160,8 @@ export default class ApiRx extends ApiBase<'rxjs'> {
* });
* ```
*/
public constructor (provider?: ApiOptions | ProviderInterface) {
super(provider, 'rxjs');
public constructor (options?: ApiOptions) {
super(options, 'rxjs');
this._isReadyRx = from(
// convinced you can observable from an event, however my mind groks this form better
@@ -21,7 +21,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -13,7 +13,7 @@ describeE2E()('Derive Promise e2e', (wsUrl: string): void => {
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
+1 -1
View File
@@ -31,7 +31,7 @@ describeE2E({
});
beforeEach(async (done): Promise<void> => {
api = await ApiRx.create(new WsProvider(wsUrl)).toPromise();
api = await ApiRx.create({ provider: new WsProvider(wsUrl) }).toPromise();
done();
});
@@ -15,7 +15,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -16,7 +16,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -19,7 +19,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -37,7 +37,7 @@ describeE2E({
let CREATION_FEE: number;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
CREATION_FEE = 123456789123456;
done();
@@ -26,7 +26,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -25,7 +25,7 @@ describeE2E({
const keyring = testingPairs({ type: 'ed25519' });
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -16,7 +16,7 @@ describeE2E()('Promise e2e queries', (wsUrl: string): void => {
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -37,7 +37,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -43,7 +43,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -37,7 +37,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
+1 -1
View File
@@ -40,7 +40,7 @@ describeE2E({
let api: ApiPromise;
beforeEach(async (done): Promise<void> => {
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
done();
});
@@ -21,7 +21,7 @@ describeE2E({
let api: ApiRx;
beforeEach(async (done): Promise<void> => {
api = await ApiRx.create(new WsProvider(wsUrl)).toPromise();
api = await ApiRx.create({ provider: new WsProvider(wsUrl) }).toPromise();
done();
});
+1 -1
View File
@@ -15,7 +15,7 @@ describeE2E()('Rx e2e queries', (wsUrl: string): void => {
let api: ApiRx;
beforeEach(async (done): Promise<void> => {
api = await ApiRx.create(new WsProvider(wsUrl)).toPromise();
api = await ApiRx.create({ provider: new WsProvider(wsUrl) }).toPromise();
done();
});
+1 -1
View File
@@ -21,7 +21,7 @@ describeE2E()('Rx e2e transactions', (wsUrl: string): void => {
let api: ApiRx;
beforeEach(async (done): Promise<void> => {
api = await ApiRx.create(new WsProvider(wsUrl)).toPromise();
api = await ApiRx.create({ provider: new WsProvider(wsUrl) }).toPromise();
done();
});
@@ -46,7 +46,7 @@ describeE2E({
beforeAll(async (done): Promise<() => void> => {
abi = new Abi(incrementerAbi);
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
return (
api.tx.contracts
.putCode(MAX_GAS, `0x${incrementerCode}`)
@@ -73,7 +73,7 @@ describeE2E({
describe('e2e state child methods', (): void => {
beforeAll(async (done): Promise<() => void> => {
abi = new Abi(incrementerAbi);
api = await ApiPromise.create(new WsProvider(wsUrl));
api = await ApiPromise.create({ provider: new WsProvider(wsUrl) });
// An instance of a contract can only be deployed once by one specific account.
// That's why we need a random starting point for our incrementer contract to be
// able to run this test multiple times without the need of pruning the database
@@ -4,8 +4,6 @@
import { TypeDef, TypeDefInfo, TypeDefExtVecFixed } from '../../codec/types';
import { isUndefined } from '@polkadot/util';
import { getTypeDef } from '../../codec/createType';
import flattenUniq from './flattenUniq';
import { getTypeRegistry } from '../../codec';
@@ -40,7 +38,7 @@ export default function validateTypes (types: string[], throwError: boolean): vo
const typeRegistry = getTypeRegistry();
const missing = flattenUniq(extractTypes(types)).filter((type): boolean =>
isUndefined(typeRegistry.get(type))
!typeRegistry.hasType(type)
);
if (missing.length !== 0) {
@@ -2,6 +2,8 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import '../injector';
import { TypeRegistry } from './typeRegistry';
import Struct from '../codec/Struct';
import Text from '../primitive/Text';
@@ -42,7 +44,10 @@ describe('TypeRegistry', (): void => {
registry.register({
U32Renamed: 'u32'
});
expect(registry.get('U32Renamed')).toBe(U32);
const Type = registry.getOrThrow('U32Renamed');
expect(new Type() instanceof U32).toBe(true);
});
it('can create structs via definition', (): void => {
+3 -5
View File
@@ -22,7 +22,7 @@ import U8aFixed, { BitLength as U8aFixedBitLength } from './U8aFixed';
import UInt from './UInt';
import Vec from './Vec';
import VecFixed from './VecFixed';
import getRegistry from './typeRegistry';
import getTypeRegistry from './typeRegistry';
// Type which says: if `K` is in the InterfaceRegistry, then return InterfaceRegistry[K], else fallback to T
type FromReg<T extends Codec, K extends string> = K extends keyof InterfaceRegistry ? InterfaceRegistry[K] : T
@@ -181,9 +181,7 @@ const memoizedCreateClass = memoizee(<T extends Codec = Codec, K extends string
type: K
): Constructor<FromReg<T, K>> => {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return getTypeClass<FromReg<T, K>>(
getTypeDef(type)
);
return getTypeClass<FromReg<T, K>>(getTypeDef(type));
}, { length: 1 });
export function createClass<T extends Codec = Codec, K extends string = string> (
@@ -216,7 +214,7 @@ export function getTypeClassMap (defs: TypeDef[]): { [index: string]: Constructo
// Returns the type Class for construction
export function getTypeClass<T extends Codec = Codec> (value: TypeDef, Fallback?: Constructor<T>): Constructor<T> {
const Type = getRegistry().get<T>(value.type);
const Type = getTypeRegistry().get<T>(value.type);
if (Type) {
return Type;
+51 -21
View File
@@ -2,15 +2,18 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Codec, Constructor, RegistryTypes } from '../types';
import { isFunction, isString, isUndefined } from '@polkadot/util';
import { Codec, Constructor, RegistryTypes } from '../types';
import { createClass } from './createType';
export class TypeRegistry {
public static readonly defaultRegistry: TypeRegistry = new TypeRegistry();
private _registry: Map<string, Constructor> = new Map();
private _classes: Map<string, Constructor> = new Map();
private _definitions: Map<string, string> = new Map();
public register (type: Constructor | RegistryTypes): void;
@@ -23,12 +26,12 @@ export class TypeRegistry {
const name = arg1;
const type = arg2!;
this._registry.set(name, type);
this._classes.set(name, type);
} else if (isFunction(arg1)) {
const name = arg1.name;
const type = arg1;
this._registry.set(name, type);
this._classes.set(name, type);
} else {
this.registerObject(arg1);
}
@@ -37,20 +40,53 @@ export class TypeRegistry {
private registerObject (obj: RegistryTypes, overwrite: boolean = true): void {
Object.entries(obj).forEach(([name, type]): void => {
if (overwrite || !this.get(name)) {
if (isString(type)) {
this._registry.set(name, createClass(type));
} else if (isFunction(type)) {
if (isFunction(type)) {
// This _looks_ a bit funny, but `typeof Clazz === 'function'
this._registry.set(name, type);
this._classes.set(name, type);
} else {
this._registry.set(name, createClass(JSON.stringify(type)));
// when registering, remove the old value
if (this._classes.has(name)) {
this._classes.delete(name);
}
// We only create types on-demand, so just register the definition
this._definitions.set(name, (
isString(type)
? type
: JSON.stringify(type)
));
}
}
});
}
public get <T extends Codec = Codec> (name: string): Constructor<T> | undefined {
return this._registry.get(name) as unknown as Constructor<T>;
let Type = this._classes.get(name);
// we have not already created the type, attempt it
if (!Type) {
const definition = this._definitions.get(name);
// we have a definition, so create the class now (lazily)
if (definition) {
const BaseType = createClass(definition);
// NOTE If we didn't extend here, we would have strange artifacts. An example is
// Balance, with this, new Balance() instanceof u128 is true, but Balance !== u128
Type = class extends BaseType {
// ensure we carry through any fallbacks identified - since they are now lower
public static Fallback = BaseType.Fallback;
};
this._classes.set(name, Type);
}
}
return Type as Constructor<T>;
}
public getDefinition (name: string): string | undefined {
return this._definitions.get(name);
}
public getOrThrow <T extends Codec = Codec> (name: string, msg?: string): Constructor<T> {
@@ -62,18 +98,12 @@ export class TypeRegistry {
return type;
}
}
let defaultRegistry: TypeRegistry;
public hasType (name: string): boolean {
return this._classes.has(name) || this._definitions.has(name);
}
}
export default function getDefaultRegistry (): TypeRegistry {
if (!defaultRegistry) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const defaultTypes = require('../index.types');
defaultRegistry = new TypeRegistry();
defaultRegistry.register({ ...defaultTypes });
}
return defaultRegistry;
return TypeRegistry.defaultRegistry;
}
-3
View File
@@ -2,9 +2,6 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// NOTE When adding any types here, we need to update the coumentation links as
// well - <root>/docs/SUMMARY.md as well as ../README.md
/**
* @summary Type definitions that are used in the system
*/
+11 -4
View File
@@ -5,19 +5,26 @@
import { ClassOf } from './codec/createType';
import getTypeRegistry from './codec/typeRegistry';
import * as definitions from './interfaces/definitions';
import * as baseTypes from './index.types';
/**
* @description A utility method that injects all the srml definitions into the type registry
*/
export function injectDefinitions (): void {
export function injectTypes (): void {
const registry = getTypeRegistry();
// since these are classes, the are active immediately
registry.register({ ...baseTypes });
// since these are definitions, they would only get created when needed
Object.values(definitions).forEach(({ types }): void =>
registry.register(types)
);
// Here we setup the fallbacks
ClassOf('EventRecord').Fallback = ClassOf('EventRecord0to76');
// FIXME Register the fallbacks. The issue with this atm is that it forcibly
// creates the actual classes here, which is something we don't really want,
// we want it do be done on-demand, not up-front.
ClassOf('Vec<EventRecord>').Fallback = ClassOf('Vec<EventRecord0to76>');
}
injectDefinitions();
injectTypes();
+192 -192
View File
@@ -4,27 +4,27 @@
import { Compact, Option, Vec } from './codec';
import { Bytes, Data, Fixed64, H160, H256, H512, Null, StorageData, 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, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, Consensus, ConsensusEngineId, Digest, DigestItem, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, Origin, Perbill, Permill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from './interfaces/runtime';
import { AuthorityId } from './interfaces/consensus';
import { Keys, SessionIndex, SessionKeysPolkadot, SessionKeysSubstrate } from './interfaces/session';
import { AuthorityWeight, NextAuthority, PendingPause, PendingResume, StoredPendingChange, StoredState } from './interfaces/grandpa';
import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from './interfaces/elections';
import { RawAuraBorosPreDigest } from './interfaces/abrs';
import { InclusionHeight, Uncle, UncleEntryItem } from './interfaces/authorship';
import { RawAuraPreDigest } from './interfaces/aura';
import { BabeWeight, RawBabePreDigest, SlotNumber } from './interfaces/babe';
import { RawAuraBorosPreDigest } from './interfaces/abrs';
import { BalanceLock, VestingSchedule, WithdrawReasons } from './interfaces/balances';
import { MemberCount, ProposalIndex, Votes } from './interfaces/collective';
import { AuthorityId } from './interfaces/consensus';
import { AliveContractInfo, CodeHash, ContractInfo, ContractStorageKey, Gas, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, SeedOf, TombstoneContractInfo, TrieId } from './interfaces/contracts';
import { Conviction, PropIndex, Proposal, ReferendumIndex, ReferendumInfo } from './interfaces/democracy';
import { AccountInfo, Amount, AssetOf, InherentOfflineReport, LockPeriods, NewAccountOutcome, OpaqueKey, SessionKey } from './interfaces/deprecated';
import { ApprovalFlag, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from './interfaces/elections';
import { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from './interfaces/genericAsset';
import { AuthorityWeight, NextAuthority, PendingPause, PendingResume, StoredPendingChange, StoredState } from './interfaces/grandpa';
import { AuthIndex, AuthoritySignature, Heartbeat, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from './interfaces/imOnline';
import { Keys, SessionIndex, SessionKeysPolkadot, SessionKeysSubstrate } from './interfaces/session';
import { EraIndex, EraRewards, Exposure, IndividualExposure, MomentOf, RewardDestination, StakingLedger, UnlockChunk, ValidatorPrefs } from './interfaces/staking';
import { DigestOf, Event, EventId, EventIndex, EventRecord, EventRecord0to76, Key, Phase } from './interfaces/system';
import { TreasuryProposal } from './interfaces/treasury';
import { BlockAttestations, IncludedBlocks, MoreAttestations } from './interfaces/attestations';
import { EcdsaSignature, EthereumAddress } from './interfaces/claims';
import { AttestedCandidate, AuctionIndex, BalanceUpload, Bidder, CandidateReceipt, CollatorSignature, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParachainDispatchOrigin, SlotRange, SubId, UpwardMessage, ValidatorIndex, ValidityAttestation, ValidityVote, WinningData, WinningDataEntry } from './interfaces/parachains';
import { BlockAttestations, IncludedBlocks, MoreAttestations } from './interfaces/attestations';
import { ApiId, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, KeyValueOption, NetworkState, PeerInfo, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from './interfaces/rpc';
export interface InterfaceRegistry {
@@ -137,17 +137,51 @@ export interface InterfaceRegistry {
BalanceOf: BalanceOf;
'Option<BalanceOf>': Option<BalanceOf>;
'Vec<BalanceOf>': Vec<BalanceOf>;
Block: Block;
'Option<Block>': Option<Block>;
'Vec<Block>': Vec<Block>;
BlockNumber: BlockNumber;
'Compact<BlockNumber>': Compact<BlockNumber>;
'Option<BlockNumber>': Option<BlockNumber>;
'Vec<BlockNumber>': Vec<BlockNumber>;
Call: Call;
'Option<Call>': Option<Call>;
'Vec<Call>': Vec<Call>;
ConsensusEngineId: ConsensusEngineId;
'Compact<ConsensusEngineId>': Compact<ConsensusEngineId>;
'Option<ConsensusEngineId>': Option<ConsensusEngineId>;
'Vec<ConsensusEngineId>': Vec<ConsensusEngineId>;
Digest: Digest;
'Option<Digest>': Option<Digest>;
'Vec<Digest>': Vec<Digest>;
DigestItem: DigestItem;
'Option<DigestItem>': Option<DigestItem>;
'Vec<DigestItem>': Vec<DigestItem>;
Extrinsic: Extrinsic;
'Option<Extrinsic>': Option<Extrinsic>;
'Vec<Extrinsic>': Vec<Extrinsic>;
ExtrinsicEra: ExtrinsicEra;
'Option<ExtrinsicEra>': Option<ExtrinsicEra>;
'Vec<ExtrinsicEra>': Vec<ExtrinsicEra>;
ExtrinsicPayload: ExtrinsicPayload;
'Option<ExtrinsicPayload>': Option<ExtrinsicPayload>;
'Vec<ExtrinsicPayload>': Vec<ExtrinsicPayload>;
Hash: Hash;
'Option<Hash>': Option<Hash>;
'Vec<Hash>': Vec<Hash>;
Header: Header;
'Option<Header>': Option<Header>;
'Vec<Header>': Vec<Header>;
Index: Index;
'Compact<Index>': Compact<Index>;
'Option<Index>': Option<Index>;
'Vec<Index>': Vec<Index>;
Justification: Justification;
'Option<Justification>': Option<Justification>;
'Vec<Justification>': Vec<Justification>;
KeyValue: KeyValue;
'Option<KeyValue>': Option<KeyValue>;
'Vec<KeyValue>': Vec<KeyValue>;
KeyTypeId: KeyTypeId;
'Compact<KeyTypeId>': Compact<KeyTypeId>;
'Option<KeyTypeId>': Option<KeyTypeId>;
@@ -159,6 +193,9 @@ export interface InterfaceRegistry {
'Compact<Moment>': Compact<Moment>;
'Option<Moment>': Option<Moment>;
'Vec<Moment>': Vec<Moment>;
Origin: Origin;
'Option<Origin>': Option<Origin>;
'Vec<Origin>': Vec<Origin>;
Perbill: Perbill;
'Compact<Perbill>': Compact<Perbill>;
'Option<Perbill>': Option<Perbill>;
@@ -173,6 +210,12 @@ export interface InterfaceRegistry {
PhantomData: PhantomData;
'Option<PhantomData>': Option<PhantomData>;
'Vec<PhantomData>': Vec<PhantomData>;
Signature: Signature;
'Option<Signature>': Option<Signature>;
'Vec<Signature>': Vec<Signature>;
SignedBlock: SignedBlock;
'Option<SignedBlock>': Option<SignedBlock>;
'Vec<SignedBlock>': Vec<SignedBlock>;
ValidatorId: ValidatorId;
'Option<ValidatorId>': Option<ValidatorId>;
'Vec<ValidatorId>': Vec<ValidatorId>;
@@ -183,43 +226,18 @@ export interface InterfaceRegistry {
WeightMultiplier: WeightMultiplier;
'Option<WeightMultiplier>': Option<WeightMultiplier>;
'Vec<WeightMultiplier>': Vec<WeightMultiplier>;
KeyValue: KeyValue;
'Option<KeyValue>': Option<KeyValue>;
'Vec<KeyValue>': Vec<KeyValue>;
Signature: Signature;
'Option<Signature>': Option<Signature>;
'Vec<Signature>': Vec<Signature>;
Ed25519Signature: Ed25519Signature;
'Option<Ed25519Signature>': Option<Ed25519Signature>;
'Vec<Ed25519Signature>': Vec<Ed25519Signature>;
Sr25519Signature: Sr25519Signature;
'Option<Sr25519Signature>': Option<Sr25519Signature>;
'Vec<Sr25519Signature>': Vec<Sr25519Signature>;
Call: Call;
'Option<Call>': Option<Call>;
'Vec<Call>': Vec<Call>;
Origin: Origin;
'Option<Origin>': Option<Origin>;
'Vec<Origin>': Vec<Origin>;
ImmortalEra: ImmortalEra;
'Option<ImmortalEra>': Option<ImmortalEra>;
'Vec<ImmortalEra>': Vec<ImmortalEra>;
MortalEra: MortalEra;
'Option<MortalEra>': Option<MortalEra>;
'Vec<MortalEra>': Vec<MortalEra>;
ExtrinsicEra: ExtrinsicEra;
'Option<ExtrinsicEra>': Option<ExtrinsicEra>;
'Vec<ExtrinsicEra>': Vec<ExtrinsicEra>;
ExtrinsicPayload: ExtrinsicPayload;
'Option<ExtrinsicPayload>': Option<ExtrinsicPayload>;
'Vec<ExtrinsicPayload>': Vec<ExtrinsicPayload>;
Extrinsic: Extrinsic;
'Option<Extrinsic>': Option<Extrinsic>;
'Vec<Extrinsic>': Vec<Extrinsic>;
ConsensusEngineId: ConsensusEngineId;
'Compact<ConsensusEngineId>': Compact<ConsensusEngineId>;
'Option<ConsensusEngineId>': Option<ConsensusEngineId>;
'Vec<ConsensusEngineId>': Vec<ConsensusEngineId>;
PreRuntime: PreRuntime;
'Option<PreRuntime>': Option<PreRuntime>;
'Vec<PreRuntime>': Vec<PreRuntime>;
@@ -232,80 +250,9 @@ export interface InterfaceRegistry {
Consensus: Consensus;
'Option<Consensus>': Option<Consensus>;
'Vec<Consensus>': Vec<Consensus>;
DigestItem: DigestItem;
'Option<DigestItem>': Option<DigestItem>;
'Vec<DigestItem>': Vec<DigestItem>;
Digest: Digest;
'Option<Digest>': Option<Digest>;
'Vec<Digest>': Vec<Digest>;
Header: Header;
'Option<Header>': Option<Header>;
'Vec<Header>': Vec<Header>;
Justification: Justification;
'Option<Justification>': Option<Justification>;
'Vec<Justification>': Vec<Justification>;
Block: Block;
'Option<Block>': Option<Block>;
'Vec<Block>': Vec<Block>;
SignedBlock: SignedBlock;
'Option<SignedBlock>': Option<SignedBlock>;
'Vec<SignedBlock>': Vec<SignedBlock>;
AuthorityId: AuthorityId;
'Option<AuthorityId>': Option<AuthorityId>;
'Vec<AuthorityId>': Vec<AuthorityId>;
SessionIndex: SessionIndex;
'Compact<SessionIndex>': Compact<SessionIndex>;
'Option<SessionIndex>': Option<SessionIndex>;
'Vec<SessionIndex>': Vec<SessionIndex>;
SessionKeysSubstrate: SessionKeysSubstrate;
'Option<SessionKeysSubstrate>': Option<SessionKeysSubstrate>;
'Vec<SessionKeysSubstrate>': Vec<SessionKeysSubstrate>;
SessionKeysPolkadot: SessionKeysPolkadot;
'Option<SessionKeysPolkadot>': Option<SessionKeysPolkadot>;
'Vec<SessionKeysPolkadot>': Vec<SessionKeysPolkadot>;
Keys: Keys;
'Option<Keys>': Option<Keys>;
'Vec<Keys>': Vec<Keys>;
AuthorityWeight: AuthorityWeight;
'Compact<AuthorityWeight>': Compact<AuthorityWeight>;
'Option<AuthorityWeight>': Option<AuthorityWeight>;
'Vec<AuthorityWeight>': Vec<AuthorityWeight>;
NextAuthority: NextAuthority;
'Option<NextAuthority>': Option<NextAuthority>;
'Vec<NextAuthority>': Vec<NextAuthority>;
PendingPause: PendingPause;
'Option<PendingPause>': Option<PendingPause>;
'Vec<PendingPause>': Vec<PendingPause>;
PendingResume: PendingResume;
'Option<PendingResume>': Option<PendingResume>;
'Vec<PendingResume>': Vec<PendingResume>;
StoredPendingChange: StoredPendingChange;
'Option<StoredPendingChange>': Option<StoredPendingChange>;
'Vec<StoredPendingChange>': Vec<StoredPendingChange>;
StoredState: StoredState;
'Option<StoredState>': Option<StoredState>;
'Vec<StoredState>': Vec<StoredState>;
ApprovalFlag: ApprovalFlag;
'Compact<ApprovalFlag>': Compact<ApprovalFlag>;
'Option<ApprovalFlag>': Option<ApprovalFlag>;
'Vec<ApprovalFlag>': Vec<ApprovalFlag>;
SetIndex: SetIndex;
'Compact<SetIndex>': Compact<SetIndex>;
'Option<SetIndex>': Option<SetIndex>;
'Vec<SetIndex>': Vec<SetIndex>;
Vote: Vote;
'Option<Vote>': Option<Vote>;
'Vec<Vote>': Vec<Vote>;
VoteIndex: VoteIndex;
'Compact<VoteIndex>': Compact<VoteIndex>;
'Option<VoteIndex>': Option<VoteIndex>;
'Vec<VoteIndex>': Vec<VoteIndex>;
VoterInfo: VoterInfo;
'Option<VoterInfo>': Option<VoterInfo>;
'Vec<VoterInfo>': Vec<VoterInfo>;
VoteThreshold: VoteThreshold;
'Option<VoteThreshold>': Option<VoteThreshold>;
'Vec<VoteThreshold>': Vec<VoteThreshold>;
RawAuraBorosPreDigest: RawAuraBorosPreDigest;
'Option<RawAuraBorosPreDigest>': Option<RawAuraBorosPreDigest>;
'Vec<RawAuraBorosPreDigest>': Vec<RawAuraBorosPreDigest>;
InclusionHeight: InclusionHeight;
'Option<InclusionHeight>': Option<InclusionHeight>;
'Vec<InclusionHeight>': Vec<InclusionHeight>;
@@ -322,25 +269,22 @@ export interface InterfaceRegistry {
'Compact<BabeWeight>': Compact<BabeWeight>;
'Option<BabeWeight>': Option<BabeWeight>;
'Vec<BabeWeight>': Vec<BabeWeight>;
RawBabePreDigest: RawBabePreDigest;
'Option<RawBabePreDigest>': Option<RawBabePreDigest>;
'Vec<RawBabePreDigest>': Vec<RawBabePreDigest>;
SlotNumber: SlotNumber;
'Compact<SlotNumber>': Compact<SlotNumber>;
'Option<SlotNumber>': Option<SlotNumber>;
'Vec<SlotNumber>': Vec<SlotNumber>;
RawBabePreDigest: RawBabePreDigest;
'Option<RawBabePreDigest>': Option<RawBabePreDigest>;
'Vec<RawBabePreDigest>': Vec<RawBabePreDigest>;
RawAuraBorosPreDigest: RawAuraBorosPreDigest;
'Option<RawAuraBorosPreDigest>': Option<RawAuraBorosPreDigest>;
'Vec<RawAuraBorosPreDigest>': Vec<RawAuraBorosPreDigest>;
BalanceLock: BalanceLock;
'Option<BalanceLock>': Option<BalanceLock>;
'Vec<BalanceLock>': Vec<BalanceLock>;
VestingSchedule: VestingSchedule;
'Option<VestingSchedule>': Option<VestingSchedule>;
'Vec<VestingSchedule>': Vec<VestingSchedule>;
WithdrawReasons: WithdrawReasons;
'Option<WithdrawReasons>': Option<WithdrawReasons>;
'Vec<WithdrawReasons>': Vec<WithdrawReasons>;
BalanceLock: BalanceLock;
'Option<BalanceLock>': Option<BalanceLock>;
'Vec<BalanceLock>': Vec<BalanceLock>;
MemberCount: MemberCount;
'Compact<MemberCount>': Compact<MemberCount>;
'Option<MemberCount>': Option<MemberCount>;
@@ -352,18 +296,15 @@ export interface InterfaceRegistry {
Votes: Votes;
'Option<Votes>': Option<Votes>;
'Vec<Votes>': Vec<Votes>;
CodeHash: CodeHash;
'Option<CodeHash>': Option<CodeHash>;
'Vec<CodeHash>': Vec<CodeHash>;
TrieId: TrieId;
'Option<TrieId>': Option<TrieId>;
'Vec<TrieId>': Vec<TrieId>;
AuthorityId: AuthorityId;
'Option<AuthorityId>': Option<AuthorityId>;
'Vec<AuthorityId>': Vec<AuthorityId>;
AliveContractInfo: AliveContractInfo;
'Option<AliveContractInfo>': Option<AliveContractInfo>;
'Vec<AliveContractInfo>': Vec<AliveContractInfo>;
TombstoneContractInfo: TombstoneContractInfo;
'Option<TombstoneContractInfo>': Option<TombstoneContractInfo>;
'Vec<TombstoneContractInfo>': Vec<TombstoneContractInfo>;
CodeHash: CodeHash;
'Option<CodeHash>': Option<CodeHash>;
'Vec<CodeHash>': Vec<CodeHash>;
ContractInfo: ContractInfo;
'Option<ContractInfo>': Option<ContractInfo>;
'Vec<ContractInfo>': Vec<ContractInfo>;
@@ -374,18 +315,24 @@ export interface InterfaceRegistry {
'Compact<Gas>': Compact<Gas>;
'Option<Gas>': Option<Gas>;
'Vec<Gas>': Vec<Gas>;
PrefabWasmModuleReserved: PrefabWasmModuleReserved;
'Option<PrefabWasmModuleReserved>': Option<PrefabWasmModuleReserved>;
'Vec<PrefabWasmModuleReserved>': Vec<PrefabWasmModuleReserved>;
PrefabWasmModule: PrefabWasmModule;
'Option<PrefabWasmModule>': Option<PrefabWasmModule>;
'Vec<PrefabWasmModule>': Vec<PrefabWasmModule>;
PrefabWasmModuleReserved: PrefabWasmModuleReserved;
'Option<PrefabWasmModuleReserved>': Option<PrefabWasmModuleReserved>;
'Vec<PrefabWasmModuleReserved>': Vec<PrefabWasmModuleReserved>;
Schedule: Schedule;
'Option<Schedule>': Option<Schedule>;
'Vec<Schedule>': Vec<Schedule>;
SeedOf: SeedOf;
'Option<SeedOf>': Option<SeedOf>;
'Vec<SeedOf>': Vec<SeedOf>;
TombstoneContractInfo: TombstoneContractInfo;
'Option<TombstoneContractInfo>': Option<TombstoneContractInfo>;
'Vec<TombstoneContractInfo>': Vec<TombstoneContractInfo>;
TrieId: TrieId;
'Option<TrieId>': Option<TrieId>;
'Vec<TrieId>': Vec<TrieId>;
Conviction: Conviction;
'Option<Conviction>': Option<Conviction>;
'Vec<Conviction>': Vec<Conviction>;
@@ -428,6 +375,30 @@ export interface InterfaceRegistry {
OpaqueKey: OpaqueKey;
'Option<OpaqueKey>': Option<OpaqueKey>;
'Vec<OpaqueKey>': Vec<OpaqueKey>;
ApprovalFlag: ApprovalFlag;
'Compact<ApprovalFlag>': Compact<ApprovalFlag>;
'Option<ApprovalFlag>': Option<ApprovalFlag>;
'Vec<ApprovalFlag>': Vec<ApprovalFlag>;
SetIndex: SetIndex;
'Compact<SetIndex>': Compact<SetIndex>;
'Option<SetIndex>': Option<SetIndex>;
'Vec<SetIndex>': Vec<SetIndex>;
Vote: Vote;
'Option<Vote>': Option<Vote>;
'Vec<Vote>': Vec<Vote>;
VoteIndex: VoteIndex;
'Compact<VoteIndex>': Compact<VoteIndex>;
'Option<VoteIndex>': Option<VoteIndex>;
'Vec<VoteIndex>': Vec<VoteIndex>;
VoterInfo: VoterInfo;
'Option<VoterInfo>': Option<VoterInfo>;
'Vec<VoterInfo>': Vec<VoterInfo>;
VoteThreshold: VoteThreshold;
'Option<VoteThreshold>': Option<VoteThreshold>;
'Vec<VoteThreshold>': Vec<VoteThreshold>;
AssetOptions: AssetOptions;
'Option<AssetOptions>': Option<AssetOptions>;
'Vec<AssetOptions>': Vec<AssetOptions>;
Owner: Owner;
'Option<Owner>': Option<Owner>;
'Vec<Owner>': Vec<Owner>;
@@ -440,9 +411,25 @@ export interface InterfaceRegistry {
PermissionLatest: PermissionLatest;
'Option<PermissionLatest>': Option<PermissionLatest>;
'Vec<PermissionLatest>': Vec<PermissionLatest>;
AssetOptions: AssetOptions;
'Option<AssetOptions>': Option<AssetOptions>;
'Vec<AssetOptions>': Vec<AssetOptions>;
AuthorityWeight: AuthorityWeight;
'Compact<AuthorityWeight>': Compact<AuthorityWeight>;
'Option<AuthorityWeight>': Option<AuthorityWeight>;
'Vec<AuthorityWeight>': Vec<AuthorityWeight>;
NextAuthority: NextAuthority;
'Option<NextAuthority>': Option<NextAuthority>;
'Vec<NextAuthority>': Vec<NextAuthority>;
PendingPause: PendingPause;
'Option<PendingPause>': Option<PendingPause>;
'Vec<PendingPause>': Vec<PendingPause>;
PendingResume: PendingResume;
'Option<PendingResume>': Option<PendingResume>;
'Vec<PendingResume>': Vec<PendingResume>;
StoredPendingChange: StoredPendingChange;
'Option<StoredPendingChange>': Option<StoredPendingChange>;
'Vec<StoredPendingChange>': Vec<StoredPendingChange>;
StoredState: StoredState;
'Option<StoredState>': Option<StoredState>;
'Vec<StoredState>': Vec<StoredState>;
AuthIndex: AuthIndex;
'Compact<AuthIndex>': Compact<AuthIndex>;
'Option<AuthIndex>': Option<AuthIndex>;
@@ -450,6 +437,9 @@ export interface InterfaceRegistry {
AuthoritySignature: AuthoritySignature;
'Option<AuthoritySignature>': Option<AuthoritySignature>;
'Vec<AuthoritySignature>': Vec<AuthoritySignature>;
Heartbeat: Heartbeat;
'Option<Heartbeat>': Option<Heartbeat>;
'Vec<Heartbeat>': Vec<Heartbeat>;
OpaqueMultiaddr: OpaqueMultiaddr;
'Option<OpaqueMultiaddr>': Option<OpaqueMultiaddr>;
'Vec<OpaqueMultiaddr>': Vec<OpaqueMultiaddr>;
@@ -459,9 +449,19 @@ export interface InterfaceRegistry {
OpaqueNetworkState: OpaqueNetworkState;
'Option<OpaqueNetworkState>': Option<OpaqueNetworkState>;
'Vec<OpaqueNetworkState>': Vec<OpaqueNetworkState>;
Heartbeat: Heartbeat;
'Option<Heartbeat>': Option<Heartbeat>;
'Vec<Heartbeat>': Vec<Heartbeat>;
SessionIndex: SessionIndex;
'Compact<SessionIndex>': Compact<SessionIndex>;
'Option<SessionIndex>': Option<SessionIndex>;
'Vec<SessionIndex>': Vec<SessionIndex>;
Keys: Keys;
'Option<Keys>': Option<Keys>;
'Vec<Keys>': Vec<Keys>;
SessionKeysSubstrate: SessionKeysSubstrate;
'Option<SessionKeysSubstrate>': Option<SessionKeysSubstrate>;
'Vec<SessionKeysSubstrate>': Vec<SessionKeysSubstrate>;
SessionKeysPolkadot: SessionKeysPolkadot;
'Option<SessionKeysPolkadot>': Option<SessionKeysPolkadot>;
'Vec<SessionKeysPolkadot>': Vec<SessionKeysPolkadot>;
EraIndex: EraIndex;
'Compact<EraIndex>': Compact<EraIndex>;
'Option<EraIndex>': Option<EraIndex>;
@@ -469,30 +469,33 @@ export interface InterfaceRegistry {
EraRewards: EraRewards;
'Option<EraRewards>': Option<EraRewards>;
'Vec<EraRewards>': Vec<EraRewards>;
IndividualExposure: IndividualExposure;
'Option<IndividualExposure>': Option<IndividualExposure>;
'Vec<IndividualExposure>': Vec<IndividualExposure>;
Exposure: Exposure;
'Option<Exposure>': Option<Exposure>;
'Vec<Exposure>': Vec<Exposure>;
IndividualExposure: IndividualExposure;
'Option<IndividualExposure>': Option<IndividualExposure>;
'Vec<IndividualExposure>': Vec<IndividualExposure>;
MomentOf: MomentOf;
'Option<MomentOf>': Option<MomentOf>;
'Vec<MomentOf>': Vec<MomentOf>;
RewardDestination: RewardDestination;
'Option<RewardDestination>': Option<RewardDestination>;
'Vec<RewardDestination>': Vec<RewardDestination>;
UnlockChunk: UnlockChunk;
'Option<UnlockChunk>': Option<UnlockChunk>;
'Vec<UnlockChunk>': Vec<UnlockChunk>;
StakingLedger: StakingLedger;
'Option<StakingLedger>': Option<StakingLedger>;
'Vec<StakingLedger>': Vec<StakingLedger>;
UnlockChunk: UnlockChunk;
'Option<UnlockChunk>': Option<UnlockChunk>;
'Vec<UnlockChunk>': Vec<UnlockChunk>;
ValidatorPrefs: ValidatorPrefs;
'Option<ValidatorPrefs>': Option<ValidatorPrefs>;
'Vec<ValidatorPrefs>': Vec<ValidatorPrefs>;
DigestOf: DigestOf;
'Option<DigestOf>': Option<DigestOf>;
'Vec<DigestOf>': Vec<DigestOf>;
Event: Event;
'Option<Event>': Option<Event>;
'Vec<Event>': Vec<Event>;
EventId: EventId;
'Option<EventId>': Option<EventId>;
'Vec<EventId>': Vec<EventId>;
@@ -500,79 +503,61 @@ export interface InterfaceRegistry {
'Compact<EventIndex>': Compact<EventIndex>;
'Option<EventIndex>': Option<EventIndex>;
'Vec<EventIndex>': Vec<EventIndex>;
EventRecord: EventRecord;
'Option<EventRecord>': Option<EventRecord>;
'Vec<EventRecord>': Vec<EventRecord>;
EventRecord0to76: EventRecord0to76;
'Option<EventRecord0to76>': Option<EventRecord0to76>;
'Vec<EventRecord0to76>': Vec<EventRecord0to76>;
Key: Key;
'Option<Key>': Option<Key>;
'Vec<Key>': Vec<Key>;
Phase: Phase;
'Option<Phase>': Option<Phase>;
'Vec<Phase>': Vec<Phase>;
Event: Event;
'Option<Event>': Option<Event>;
'Vec<Event>': Vec<Event>;
EventRecord0to76: EventRecord0to76;
'Option<EventRecord0to76>': Option<EventRecord0to76>;
'Vec<EventRecord0to76>': Vec<EventRecord0to76>;
EventRecord: EventRecord;
'Option<EventRecord>': Option<EventRecord>;
'Vec<EventRecord>': Vec<EventRecord>;
TreasuryProposal: TreasuryProposal;
'Option<TreasuryProposal>': Option<TreasuryProposal>;
'Vec<TreasuryProposal>': Vec<TreasuryProposal>;
BlockAttestations: BlockAttestations;
'Option<BlockAttestations>': Option<BlockAttestations>;
'Vec<BlockAttestations>': Vec<BlockAttestations>;
IncludedBlocks: IncludedBlocks;
'Option<IncludedBlocks>': Option<IncludedBlocks>;
'Vec<IncludedBlocks>': Vec<IncludedBlocks>;
MoreAttestations: MoreAttestations;
'Option<MoreAttestations>': Option<MoreAttestations>;
'Vec<MoreAttestations>': Vec<MoreAttestations>;
EcdsaSignature: EcdsaSignature;
'Option<EcdsaSignature>': Option<EcdsaSignature>;
'Vec<EcdsaSignature>': Vec<EcdsaSignature>;
EthereumAddress: EthereumAddress;
'Option<EthereumAddress>': Option<EthereumAddress>;
'Vec<EthereumAddress>': Vec<EthereumAddress>;
AttestedCandidate: AttestedCandidate;
'Option<AttestedCandidate>': Option<AttestedCandidate>;
'Vec<AttestedCandidate>': Vec<AttestedCandidate>;
AuctionIndex: AuctionIndex;
'Compact<AuctionIndex>': Compact<AuctionIndex>;
'Option<AuctionIndex>': Option<AuctionIndex>;
'Vec<AuctionIndex>': Vec<AuctionIndex>;
CollatorSignature: CollatorSignature;
'Option<CollatorSignature>': Option<CollatorSignature>;
'Vec<CollatorSignature>': Vec<CollatorSignature>;
ValidityAttestation: ValidityAttestation;
'Option<ValidityAttestation>': Option<ValidityAttestation>;
'Vec<ValidityAttestation>': Vec<ValidityAttestation>;
ParaId: ParaId;
'Compact<ParaId>': Compact<ParaId>;
'Option<ParaId>': Option<ParaId>;
'Vec<ParaId>': Vec<ParaId>;
ParaIdOf: ParaIdOf;
'Option<ParaIdOf>': Option<ParaIdOf>;
'Vec<ParaIdOf>': Vec<ParaIdOf>;
ValidatorIndex: ValidatorIndex;
'Compact<ValidatorIndex>': Compact<ValidatorIndex>;
'Option<ValidatorIndex>': Option<ValidatorIndex>;
'Vec<ValidatorIndex>': Vec<ValidatorIndex>;
ValidityVote: ValidityVote;
'Option<ValidityVote>': Option<ValidityVote>;
'Vec<ValidityVote>': Vec<ValidityVote>;
BalanceUpload: BalanceUpload;
'Option<BalanceUpload>': Option<BalanceUpload>;
'Vec<BalanceUpload>': Vec<BalanceUpload>;
Bidder: Bidder;
'Option<Bidder>': Option<Bidder>;
'Vec<Bidder>': Vec<Bidder>;
CandidateReceipt: CandidateReceipt;
'Option<CandidateReceipt>': Option<CandidateReceipt>;
'Vec<CandidateReceipt>': Vec<CandidateReceipt>;
CollatorSignature: CollatorSignature;
'Option<CollatorSignature>': Option<CollatorSignature>;
'Vec<CollatorSignature>': Vec<CollatorSignature>;
EgressQueueRoot: EgressQueueRoot;
'Option<EgressQueueRoot>': Option<EgressQueueRoot>;
'Vec<EgressQueueRoot>': Vec<EgressQueueRoot>;
HeadData: HeadData;
'Option<HeadData>': Option<HeadData>;
'Vec<HeadData>': Vec<HeadData>;
CandidateReceipt: CandidateReceipt;
'Option<CandidateReceipt>': Option<CandidateReceipt>;
'Vec<CandidateReceipt>': Vec<CandidateReceipt>;
AttestedCandidate: AttestedCandidate;
'Option<AttestedCandidate>': Option<AttestedCandidate>;
'Vec<AttestedCandidate>': Vec<AttestedCandidate>;
SubId: SubId;
'Compact<SubId>': Compact<SubId>;
'Option<SubId>': Option<SubId>;
'Vec<SubId>': Vec<SubId>;
NewBidder: NewBidder;
'Option<NewBidder>': Option<NewBidder>;
'Vec<NewBidder>': Vec<NewBidder>;
Bidder: Bidder;
'Option<Bidder>': Option<Bidder>;
'Vec<Bidder>': Vec<Bidder>;
IncomingParachainDeploy: IncomingParachainDeploy;
'Option<IncomingParachainDeploy>': Option<IncomingParachainDeploy>;
'Vec<IncomingParachainDeploy>': Vec<IncomingParachainDeploy>;
@@ -588,30 +573,45 @@ export interface InterfaceRegistry {
LeasePeriodOf: LeasePeriodOf;
'Option<LeasePeriodOf>': Option<LeasePeriodOf>;
'Vec<LeasePeriodOf>': Vec<LeasePeriodOf>;
NewBidder: NewBidder;
'Option<NewBidder>': Option<NewBidder>;
'Vec<NewBidder>': Vec<NewBidder>;
ParaId: ParaId;
'Compact<ParaId>': Compact<ParaId>;
'Option<ParaId>': Option<ParaId>;
'Vec<ParaId>': Vec<ParaId>;
ParaIdOf: ParaIdOf;
'Option<ParaIdOf>': Option<ParaIdOf>;
'Vec<ParaIdOf>': Vec<ParaIdOf>;
ParachainDispatchOrigin: ParachainDispatchOrigin;
'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>;
'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>;
SlotRange: SlotRange;
'Option<SlotRange>': Option<SlotRange>;
'Vec<SlotRange>': Vec<SlotRange>;
SubId: SubId;
'Compact<SubId>': Compact<SubId>;
'Option<SubId>': Option<SubId>;
'Vec<SubId>': Vec<SubId>;
UpwardMessage: UpwardMessage;
'Option<UpwardMessage>': Option<UpwardMessage>;
'Vec<UpwardMessage>': Vec<UpwardMessage>;
ValidityAttestation: ValidityAttestation;
'Option<ValidityAttestation>': Option<ValidityAttestation>;
'Vec<ValidityAttestation>': Vec<ValidityAttestation>;
ValidatorIndex: ValidatorIndex;
'Compact<ValidatorIndex>': Compact<ValidatorIndex>;
'Option<ValidatorIndex>': Option<ValidatorIndex>;
'Vec<ValidatorIndex>': Vec<ValidatorIndex>;
ValidityVote: ValidityVote;
'Option<ValidityVote>': Option<ValidityVote>;
'Vec<ValidityVote>': Vec<ValidityVote>;
WinningDataEntry: WinningDataEntry;
'Option<WinningDataEntry>': Option<WinningDataEntry>;
'Vec<WinningDataEntry>': Vec<WinningDataEntry>;
WinningData: WinningData;
'Option<WinningData>': Option<WinningData>;
'Vec<WinningData>': Vec<WinningData>;
BlockAttestations: BlockAttestations;
'Option<BlockAttestations>': Option<BlockAttestations>;
'Vec<BlockAttestations>': Vec<BlockAttestations>;
IncludedBlocks: IncludedBlocks;
'Option<IncludedBlocks>': Option<IncludedBlocks>;
'Vec<IncludedBlocks>': Vec<IncludedBlocks>;
MoreAttestations: MoreAttestations;
'Option<MoreAttestations>': Option<MoreAttestations>;
'Vec<MoreAttestations>': Vec<MoreAttestations>;
ApiId: ApiId;
'Option<ApiId>': Option<ApiId>;
'Vec<ApiId>': Vec<ApiId>;
@@ -5,12 +5,12 @@
export default {
types: {
BabeWeight: 'u64',
SlotNumber: 'u64',
RawBabePreDigest: {
slotNumber: 'SlotNumber',
authorityIndex: 'u32', // AuthorityIndex (also in aura, not same size there)
vrfOutput: 'H256', // should be '[u8; 32]' (generator support lacking here)
vrfProof: 'H256' // should be '[u8; 32]'
}
},
SlotNumber: 'u64'
}
};
@@ -4,6 +4,12 @@
export default {
types: {
BalanceLock: {
id: 'LockIdentifier',
amount: 'Balance',
until: 'BlockNumber',
reasons: 'WithdrawReasons'
},
VestingSchedule: {
offset: 'Balance',
perBlock: 'Balance',
@@ -16,12 +22,6 @@ export default {
Reserve: 0b00000100,
Fee: 0b00001000
}
},
BalanceLock: {
id: 'LockIdentifier',
amount: 'Balance',
until: 'BlockNumber',
reasons: 'WithdrawReasons'
}
}
};
@@ -4,7 +4,7 @@
export default {
types: {
EcdsaSignature: '[u8; 65]',
EcdsaSignature: '(H256, H256, i8)',
EthereumAddress: 'H160'
}
};
@@ -2,10 +2,10 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Codec } from '../../types';
import { H160 } from '../../primitive';
import { H160, H256, i8 } from '../../primitive';
/** Uint8Array & Codec */
export type EcdsaSignature = Uint8Array & Codec;
/** [H256, H256, i8] & Codec */
export type EcdsaSignature = [H256, H256, i8] & Codec;
/** H160 */
export type EthereumAddress = H160;
@@ -4,8 +4,6 @@
export default {
types: {
CodeHash: 'Hash',
TrieId: 'Bytes',
AliveContractInfo: {
trieId: 'TrieId',
storageSize: 'u32',
@@ -14,7 +12,7 @@ export default {
deductBlock: 'BlockNumber',
lastWrite: 'Option<BlockNumber>'
},
TombstoneContractInfo: 'Hash',
CodeHash: 'Hash',
ContractInfo: {
_enum: {
Alive: 'AliveContractInfo',
@@ -23,7 +21,6 @@ export default {
},
ContractStorageKey: '[u8; 32]',
Gas: 'u64',
PrefabWasmModuleReserved: 'Option<Null>',
PrefabWasmModule: {
scheduleVersion: 'Compact<u32>',
initial: 'Compact<u32>',
@@ -31,6 +28,7 @@ export default {
_reserved: 'PrefabWasmModuleReserved',
code: 'Bytes'
},
PrefabWasmModuleReserved: 'Option<Null>',
Schedule: {
version: 'u32',
putCodePerByteCost: 'Gas',
@@ -48,6 +46,8 @@ export default {
enablePrintln: 'bool',
maxSubjectLen: 'u32'
},
SeedOf: 'Hash'
SeedOf: 'Hash',
TombstoneContractInfo: 'Hash',
TrieId: 'Bytes'
}
};
+8 -22
View File
@@ -2,47 +2,33 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// NOTE The order here is NOT alphabetical, rather it is setup so that lower
// layers can re-use types from higher layers as this is being injected. The
// injection order is critical.
// runtime before everything else, these are base definitions
// technically runtime can go below, but since it is the base, do it first
export { default as runtime } from './runtime/definitions';
// consensus before grandpa, imOnline
export { default as consensus } from './consensus/definitions';
// session before imOnline
export { default as session } from './session/definitions';
// grandpa before parachains
export { default as grandpa } from './grandpa/definitions';
// elections before democracy
export { default as elections } from './elections/definitions';
// authoring, abra uses babe & aura
// substrate types
export { default as abrs } from './abrs/definitions';
export { default as authorship } from './authorship/definitions';
export { default as aura } from './aura/definitions';
export { default as babe } from './babe/definitions';
export { default as abrs } from './abrs/definitions';
// remaining, alphabetical odering
export { default as balances } from './balances/definitions';
export { default as collective } from './collective/definitions';
export { default as consensus } from './consensus/definitions';
export { default as contracts } from './contracts/definitions';
export { default as democracy } from './democracy/definitions';
export { default as deprecated } from './deprecated/definitions';
export { default as elections } from './elections/definitions';
export { default as genericAsset } from './genericAsset/definitions';
export { default as grandpa } from './grandpa/definitions';
export { default as imOnline } from './imOnline/definitions';
export { default as session } from './session/definitions';
export { default as staking } from './staking/definitions';
export { default as system } from './system/definitions';
export { default as treasury } from './treasury/definitions';
// polkadot-specific types
export { default as attestations } from './attestations/definitions';
export { default as claims } from './claims/definitions';
export { default as parachains } from './parachains/definitions';
export { default as attestations } from './attestations/definitions';
// pull in rpc last, assuming that is uses info from above
export { default as rpc } from './rpc/definitions';
@@ -4,6 +4,10 @@
export default {
types: {
AssetOptions: {
initalIssuance: 'Balance',
permissions: 'PermissionLatest'
},
Owner: {
_enum: {
None: 'Null',
@@ -20,10 +24,6 @@ export default {
V1: 'PermissionsV1'
}
},
PermissionLatest: 'PermissionsV1',
AssetOptions: {
initalIssuance: 'Balance',
permissions: 'PermissionLatest'
}
PermissionLatest: 'PermissionsV1'
}
};
@@ -6,6 +6,12 @@ export default {
types: {
AuthIndex: 'u32',
AuthoritySignature: 'Signature',
Heartbeat: {
blockNumber: 'BlockNumber',
networkState: 'OpaqueNetworkState',
sessionIndex: 'SessionIndex',
authorityId: 'AuthorityId'
},
OpaqueMultiaddr: 'Bytes',
OpaquePeerId: 'Bytes',
OpaqueNetworkState: {
@@ -13,12 +19,6 @@ export default {
peerId: 'OpaquePeerId',
/// List of addresses the node knows it can be reached as.
externalAddresses: 'Vec<OpaqueMultiaddr>'
},
Heartbeat: {
blockNumber: 'BlockNumber',
networkState: 'OpaqueNetworkState',
sessionIndex: 'SessionIndex',
authorityId: 'AuthorityId'
}
}
};
@@ -4,24 +4,18 @@
export default {
types: {
AttestedCandidate: {
candidate: 'CandidateReceipt',
validityVotes: 'Vec<ValidityVote>'
},
AuctionIndex: 'u32',
CollatorSignature: 'Signature',
ValidityAttestation: {
BalanceUpload: '(AccountId, u64)',
Bidder: {
_enum: {
// This Null is not in the original, however indexes start at 1, so add a
// placeholder in the first position (which is basically non-valid)
None: 'Null',
Implicit: 'CollatorSignature', // 1
Explicit: 'CollatorSignature' // 2
New: 'NewBidder',
Existing: 'ParaId'
}
},
ParaId: 'u32',
ParaIdOf: 'ParaId',
ValidatorIndex: 'u32',
ValidityVote: '(ValidatorIndex, ValidityAttestation)',
BalanceUpload: '(AccountId, u64)',
EgressQueueRoot: '(ParaId, Hash)',
HeadData: 'Bytes',
CandidateReceipt: {
parachainIndex: 'ParaId',
collator: 'AccountId',
@@ -32,21 +26,9 @@ export default {
fees: 'u64',
blockDataHash: 'Hash'
},
AttestedCandidate: {
candidate: 'CandidateReceipt',
validityVotes: 'Vec<ValidityVote>'
},
SubId: 'u32',
NewBidder: {
who: 'AccountId',
sub: 'SubId'
},
Bidder: {
_enum: {
New: 'NewBidder',
Existing: 'ParaId'
}
},
CollatorSignature: 'Signature',
EgressQueueRoot: '(ParaId, Hash)',
HeadData: 'Bytes',
IncomingParachainDeploy: {
code: 'Bytes',
initialHeadData: 'Bytes'
@@ -64,6 +46,12 @@ export default {
},
LeasePeriod: 'BlockNumber',
LeasePeriodOf: 'LeasePeriod',
NewBidder: {
who: 'AccountId',
sub: 'SubId'
},
ParaId: 'u32',
ParaIdOf: 'ParaId',
ParachainDispatchOrigin: {
_enum: [
'Signed',
@@ -84,10 +72,22 @@ export default {
'ThreeThree' // 9
]
},
SubId: 'u32',
UpwardMessage: {
origin: 'ParachainDispatchOrigin',
data: 'Bytes'
},
ValidityAttestation: {
_enum: {
// This Null is not in the original, however indexes start at 1, so add a
// placeholder in the first position (which is basically non-valid)
None: 'Null',
Implicit: 'CollatorSignature', // 1
Explicit: 'CollatorSignature' // 2
}
},
ValidatorIndex: 'u32',
ValidityVote: '(ValidatorIndex, ValidityAttestation)',
WinningDataEntry: '(AccountId, ParaIdOf, BalanceOf)',
WinningData: '[WinningDataEntry; 10]'
}
@@ -11,47 +11,16 @@ export default {
AssetId: 'u32',
Balance: 'u128',
BalanceOf: 'Balance',
Block: 'GenericBlock',
BlockNumber: 'u64',
Hash: 'H256',
Index: 'u64',
KeyTypeId: 'u32',
LockIdentifier: '[u8; 8]',
Moment: 'u64',
Perbill: 'u32',
Permill: 'u32',
Phantom: 'Null',
PhantomData: 'Null',
ValidatorId: 'AccountId',
Weight: 'u32',
WeightMultiplier: 'Fixed64',
// storage helpers
KeyValue: '(StorageKey, StorageData)',
// signatures (used in block & extrinsics)
Signature: 'H512',
Ed25519Signature: 'Signature',
Sr25519Signature: 'Signature',
// extrinsic definition
Call: 'GenericCall',
Origin: 'GenericOrigin',
ImmortalEra: 'GenericImmortalEra',
MortalEra: 'GenericMortalEra',
ConsensusEngineId: 'GenericConsensusEngineId',
Digest: 'GenericDigest',
DigestItem: 'GenericDigestItem',
Extrinsic: 'GenericExtrinsic',
ExtrinsicEra: 'GenericExtrinsicEra',
ExtrinsicPayload: 'GenericExtrinsicPayload',
Extrinsic: 'GenericExtrinsic',
// block definition
// :: digest
ConsensusEngineId: 'GenericConsensusEngineId',
PreRuntime: '(ConsensusEngineId, Bytes)',
SealV0: '(u64, Signature)',
Seal: '(ConsensusEngineId, Bytes)',
Consensus: '(ConsensusEngineId, Bytes)',
DigestItem: 'GenericDigestItem',
Digest: 'GenericDigest',
// :: parts
Hash: 'H256',
Header: {
parentHash: 'Hash',
number: 'Compact<BlockNumber>',
@@ -59,12 +28,38 @@ export default {
extrinsicsRoot: 'Hash',
digest: 'Digest'
},
Index: 'u64',
Justification: 'Bytes',
// :: definitions
Block: 'GenericBlock',
KeyValue: '(StorageKey, StorageData)',
KeyTypeId: 'u32',
LockIdentifier: '[u8; 8]',
Moment: 'u64',
Origin: 'GenericOrigin',
Perbill: 'u32',
Permill: 'u32',
Phantom: 'Null',
PhantomData: 'Null',
Signature: 'H512',
SignedBlock: {
block: 'Block',
justification: 'Justification'
}
},
ValidatorId: 'AccountId',
Weight: 'u32',
WeightMultiplier: 'Fixed64',
// signatures (used in block & extrinsics)
Ed25519Signature: 'Signature',
Sr25519Signature: 'Signature',
// extrinsic definition
ImmortalEra: 'GenericImmortalEra',
MortalEra: 'GenericMortalEra',
// :: digest
PreRuntime: '(ConsensusEngineId, Bytes)',
SealV0: '(u64, Signature)',
Seal: '(ConsensusEngineId, Bytes)',
Consensus: '(ConsensusEngineId, Bytes)'
}
};
@@ -11,10 +11,10 @@ export default {
// impl_opaque_keys! {
// pub struct SessionKeys {
// Here we revert to tuples to keep the interfaces "opaque", as per the use
Keys: 'SessionKeysSubstrate',
// For substrate: Grandpa, Babe, ImOnline
SessionKeysSubstrate: '(AccountId, AccountId, AccountId)',
// For polkadot: Grandpa, Babe, ImOnline, Parachains
SessionKeysPolkadot: '(AccountId, AccountId, AccountId, AccountId)',
Keys: 'SessionKeysSubstrate'
SessionKeysPolkadot: '(AccountId, AccountId, AccountId, AccountId)'
}
};
@@ -9,15 +9,15 @@ export default {
total: 'u32',
rewards: 'Vec<u32>'
},
IndividualExposure: {
who: 'AccountId',
value: 'Compact<Balance>'
},
Exposure: {
total: 'Compact<Balance>',
own: 'Compact<Balance>',
others: 'Vec<IndividualExposure>'
},
IndividualExposure: {
who: 'AccountId',
value: 'Compact<Balance>'
},
MomentOf: 'Moment',
RewardDestination: {
_enum: [
@@ -26,16 +26,16 @@ export default {
'Controller'
]
},
UnlockChunk: {
value: 'Compact<Balance>',
era: 'Compact<BlockNumber>'
},
StakingLedger: {
stash: 'AccountId',
total: 'Compact<Balance>',
active: 'Compact<Balance>',
unlocking: 'Vec<UnlockChunk>'
},
UnlockChunk: {
value: 'Compact<Balance>',
era: 'Compact<BlockNumber>'
},
ValidatorPrefs: {
unstakeThreshold: 'Compact<u32>',
validatorPayment: 'Compact<Balance>'
@@ -5,25 +5,24 @@
export default {
types: {
DigestOf: 'Digest',
Event: 'GenericEvent',
EventId: '[u8; 2]',
EventIndex: 'u32',
EventRecord: {
phase: 'Phase',
event: 'Event',
topics: 'Vec<Hash>'
},
EventRecord0to76: {
phase: 'Phase',
event: 'Event'
},
Key: 'Bytes',
Phase: {
_enum: {
ApplyExtrinsic: 'u32',
Finalization: 'Null'
}
},
Event: 'GenericEvent',
EventRecord0to76: {
phase: 'Phase',
event: 'Event'
},
// Fallback in injectDefinitions
EventRecord: {
phase: 'Phase',
event: 'Event',
topics: 'Vec<Hash>'
}
}
};
+6 -6
View File
@@ -2,25 +2,25 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
export * from './runtime/types';
export * from './consensus/types';
export * from './session/types';
export * from './grandpa/types';
export * from './elections/types';
export * from './abrs/types';
export * from './authorship/types';
export * from './aura/types';
export * from './babe/types';
export * from './abrs/types';
export * from './balances/types';
export * from './collective/types';
export * from './consensus/types';
export * from './contracts/types';
export * from './democracy/types';
export * from './deprecated/types';
export * from './elections/types';
export * from './genericAsset/types';
export * from './grandpa/types';
export * from './imOnline/types';
export * from './session/types';
export * from './staking/types';
export * from './system/types';
export * from './treasury/types';
export * from './attestations/types';
export * from './claims/types';
export * from './parachains/types';
export * from './attestations/types';
export * from './rpc/types';