How to use the @polkadot/types/codec.Vec.with function in @polkadot/types

To help you get started, we’ve selected a few @polkadot/types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github polkadot-js / api / packages / metadata / src / Metadata / v0 / toV1.ts View on Github external
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'));
}
github polkadot-js / api / packages / metadata / src / Metadata / v0 / toV1.ts View on Github external
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'));
}
github polkadot-js / api / packages / metadata / src / Metadata / v3 / toV4.ts View on Github external
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
      })
    )
github polkadot-js / api / packages / metadata / src / Metadata / v4 / toV5.ts View on Github external
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
      })
    )