Options
All
  • Public
  • Public/Protected
  • All
Menu

@fluencelabs/fluence

Index

Type aliases

AvmLoglevel

AvmLoglevel: LogLevel

Enum representing the log level used in Aqua VM. Possible values: 'info', 'trace', 'debug', 'info', 'warn', 'error', 'off';

PeerIdB58

PeerIdB58: string

Peer ID's id as a base58 string (multihash/CIDv0).

Variables

Const Fluence

Fluence: { getPeer: () => FluencePeer; getStatus: () => PeerStatus; registerMarineService: (wasm: SharedArrayBuffer | Buffer, serviceId: string) => Promise<void>; removeMarineService: (serviceId: string) => void; start: (config?: PeerConfig) => Promise<void>; stop: () => Promise<void> } = ...

Public interface to Fluence JS

Type declaration

  • getPeer: () => FluencePeer
  • getStatus: () => PeerStatus
  • registerMarineService: (wasm: SharedArrayBuffer | Buffer, serviceId: string) => Promise<void>
      • (wasm: SharedArrayBuffer | Buffer, serviceId: string): Promise<void>
      • Registers marine service within the default Fluence peer from wasm file. Following helper functions can be used to load wasm files:

        • loadWasmFromFileSystem
        • loadWasmFromNpmPackage
        • loadWasmFromServer

        Parameters

        • wasm: SharedArrayBuffer | Buffer

          buffer with the wasm file for service

        • serviceId: string

          the service id by which the service can be accessed in aqua

        Returns Promise<void>

  • removeMarineService: (serviceId: string) => void
      • (serviceId: string): void
      • Removes the specified marine service from the default Fluence peer

        Parameters

        • serviceId: string

          the service id to remove

        Returns void

  • start: (config?: PeerConfig) => Promise<void>
      • Initializes the default peer: starts the Aqua VM, initializes the default call service handlers and (optionally) connect to the Fluence network

        Parameters

        • Optional config: PeerConfig

          object specifying peer configuration

        Returns Promise<void>

  • stop: () => Promise<void>
      • (): Promise<void>
      • Un-initializes the default peer: stops all the underlying workflows, stops the Aqua VM and disconnects from the Fluence network

        Returns Promise<void>

Functions

Const loadWasmFromFileSystem

  • loadWasmFromFileSystem(filePath: string): Promise<SharedArrayBuffer>
  • Load wasm file from the file system. Only works in nodejs environment. The functions returns SharedArrayBuffer compatible with FluenceAppService methods.

    Parameters

    • filePath: string

      path to the wasm file

    Returns Promise<SharedArrayBuffer>

    SharedArrayBuffer with the wasm file

Const loadWasmFromNpmPackage

  • loadWasmFromNpmPackage(source: { file: string; package: string }): Promise<SharedArrayBuffer>
  • Load wasm file from npm package. Only works in nodejs environment. The function returns SharedArrayBuffer compatible with FluenceAppService methods.

    Parameters

    • source: { file: string; package: string }

      object specifying the source of the file. Consist two fields: package name and file path.

      • file: string
      • package: string

    Returns Promise<SharedArrayBuffer>

    SharedArrayBuffer with the wasm file

Const loadWasmFromServer

  • loadWasmFromServer(filePath: string): Promise<SharedArrayBuffer | Buffer>
  • Load wasm file from the server. Only works in browsers. The function will try load file into SharedArrayBuffer if the site is cross-origin isolated. Otherwise the return value fallbacks to Buffer which is less performant but is still compatible with FluenceAppService methods. We strongly recommend to set-up cross-origin headers. For more details see: See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements Filename is relative to current origin.

    Parameters

    • filePath: string

      path to the wasm file relative to current origin

    Returns Promise<SharedArrayBuffer | Buffer>

    Either SharedArrayBuffer or Buffer with the wasm file

Const setLogLevel

  • setLogLevel(level: LogLevelDesc): void

Generated using TypeDoc