Introduce instances, apply to balance derives (multi-result) (#3094)

* Introducce instances, apply to balance derives (multi-result)

* Nonce extraction

* Optimize
This commit is contained in:
Jaco Greeff
2021-01-22 22:24:10 +01:00
committed by GitHub
parent c9deb0d88f
commit 1f55f38bd2
7 changed files with 80 additions and 39 deletions
+6 -2
View File
@@ -268,8 +268,12 @@ export class TypeRegistry implements Registry {
: undefined;
}
public getDefinition (name: string): string | undefined {
return this.#definitions.get(name);
public getDefinition (typeName: string): string | undefined {
return this.#definitions.get(typeName);
}
public getModuleInstances (specName: string, moduleName: string): string[] | undefined {
return this.#knownTypes?.typesBundle?.spec?.[specName]?.instances?.[moduleName];
}
public getOrThrow <T extends Codec = Codec> (name: string, msg?: string): Constructor<T> {
+3 -1
View File
@@ -47,6 +47,7 @@ export type DeriveCustom = Record<string, Record<string, (instanceId: string, ap
export interface OverrideBundleDefinition {
alias?: Record<string, OverrideModuleType>;
derives?: DeriveCustom;
instances?: Record<string, string[]>;
rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
types?: OverrideVersionedType[];
}
@@ -98,7 +99,8 @@ export interface Registry {
get <T extends Codec = Codec> (name: string, withUnknown?: boolean): Constructor<T> | undefined;
getChainProperties (): ChainProperties | undefined;
getClassName (clazz: Constructor): string | undefined;
getDefinition (name: string): string | undefined;
getDefinition (typeName: string): string | undefined;
getModuleInstances (specName: string, moduleName: string): string[] | undefined;
getOrThrow <T extends Codec = Codec> (name: string, msg?: string): Constructor<T>;
getOrUnknown <T extends Codec = Codec> (name: string): Constructor<T>;
setKnownTypes (types: RegisteredTypes): void;