Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function toV1Calls (registry: Registry, { module: { call: { functions } } }: RuntimeModuleMetadataV0): Option {
return functions.length
? new Option(registry, Vec.with('FunctionMetadataV1'), functions)
: new Option(registry, Vec.with('FunctionMetadataV1'));
}
function toV1Events (registry: Registry, metadataV0: MetadataV0, prefix: Text): Option {
const events = metadataV0.outerEvent.events.find((event): boolean => event[0].eq(prefix));
return events
? new Option(registry, Vec.with('EventMetadataV1'), events[1])
: new Option(registry, Vec.with('EventMetadataV1'));
}
modules: modules.map(({ calls, events, name, prefix, storage }): ModuleMetadataV4 =>
new ModuleMetadataV4(registry, {
calls,
events,
name,
prefix,
storage: storage.isSome
? new Option(
registry,
Vec.with(StorageFunctionMetadata),
storage.unwrap().map((v): StorageFunctionMetadata => toV4StorageFunction(registry, v))
)
: undefined
})
)
modules: modules.map(({ calls, events, name, prefix, storage }): ModuleMetadataV5 =>
new ModuleMetadataV5(registry, {
name,
prefix,
storage: storage.isSome
? new Option(
registry,
Vec.with(StorageFunctionMetadata),
storage.unwrap().map((v): StorageFunctionMetadata => toV5StorageFunction(registry, v))
)
: undefined,
calls,
events
})
)