MCPcopy Create free account
hub / github.com/subquery/subql / parseChainTypes

Function parseChainTypes

packages/common-substrate/src/project/load.ts:15–34  ·  view source on GitHub ↗
(raw: unknown)

Source from the content-addressed store, hash-verified

13}
14
15export function parseChainTypes(raw: unknown): ChainTypes {
16 const chainTypes = plainToClass(ChainTypes, raw);
17 if (
18 !!chainTypes.types ||
19 !!chainTypes.typesChain ||
20 !!chainTypes.typesBundle ||
21 !!chainTypes.typesAlias ||
22 !!chainTypes.typesSpec
23 ) {
24 const errors = validateSync(chainTypes, {whitelist: true, forbidNonWhitelisted: true});
25 if (errors?.length) {
26 // TODO: print error details
27 const errorMsgs = errors.map((e) => e.toString()).join('\n');
28 throw new Error(`failed to parse chain types.\n${errorMsgs}`);
29 }
30 return chainTypes;
31 } else {
32 throw new Error(`chainTypes is not valid`);
33 }
34}

Callers 2

load.spec.tsFile · 0.90
getChainTypesFunction · 0.90

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected