Subscribe to runtime updates (#1896)
* Subscribe to runtime updates * console.log -> l.log * Add l.warn to api augment * Expand logs with added & removed * Re-do everything when genesis has changed * augmentObject complexity * Dedup [string[], strings[]] * Update CHANGELOG
This commit is contained in:
@@ -19,12 +19,12 @@ export { default as Set } from './Set';
|
||||
export { default as Struct } from './Struct';
|
||||
// export { default as StructAny } from './StructAny';
|
||||
export { default as Tuple } from './Tuple';
|
||||
export { default as U8aFixed } from './U8aFixed';
|
||||
export { default as Vec } from './Vec';
|
||||
|
||||
// Convenience base classes, used as "anything of this type" bases
|
||||
export { default as Raw } from './Raw';
|
||||
export { default as UInt } from './UInt';
|
||||
export { default as U8aFixed } from './U8aFixed';
|
||||
|
||||
// Type management helper functions
|
||||
export * from './utils/encodeTypes';
|
||||
|
||||
@@ -33,14 +33,24 @@ export function getMetadataTypes (version: number): RegistryTypes {
|
||||
|
||||
// based on the chain and runtimeVersion, get the applicable types (ready for registration)
|
||||
/** @internal */
|
||||
export function getChainTypes (chainName: Text, { specName, specVersion }: RuntimeVersion, typesChain: Record<string, RegistryTypes> = {}, typesSpec: Record<string, RegistryTypes> = {}): RegistryTypes {
|
||||
export function getSpecTypes (chainName: Text | string, { specName, specVersion }: RuntimeVersion): RegistryTypes {
|
||||
const _chainName = chainName.toString();
|
||||
const _specName = specName.toString();
|
||||
const _specVersion = specVersion.toNumber();
|
||||
|
||||
return {
|
||||
...filterVersions(TYPES_SPEC[_specName], _specVersion),
|
||||
...filterVersions(TYPES_CHAIN[_chainName], _specVersion),
|
||||
...filterVersions(TYPES_CHAIN[_chainName], _specVersion)
|
||||
};
|
||||
}
|
||||
|
||||
// based on the spec and chain, get the specific user-defind types
|
||||
/** @internal */
|
||||
export function getUserTypes (chainName: Text | string, { specName }: RuntimeVersion, typesChain: Record<string, RegistryTypes> = {}, typesSpec: Record<string, RegistryTypes> = {}): RegistryTypes {
|
||||
const _chainName = chainName.toString();
|
||||
const _specName = specName.toString();
|
||||
|
||||
return {
|
||||
...(typesSpec[_specName] || {}),
|
||||
...(typesChain[_chainName] || {})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user