Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • SwapClientManager

Index

Constructors

constructor

Properties

Private config

config: Config

Private loggers

loggers: Loggers

raidenClient

raidenClient: RaidenClient

swapClients

swapClients: Map<string, SwapClient> = new Map<string, SwapClient>()

A map between currencies and all enabled swap clients

Private unitConverter

unitConverter: UnitConverter

Private Optional walletPassword

walletPassword: undefined | string

Static defaultMaxListeners

defaultMaxListeners: number

Methods

add

  • Adds a new swap client and currency association.

    Parameters

    • currency: Currency

      a currency that should be linked with a swap client.

    Returns void

    Nothing upon success, throws otherwise.

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

Private bind

  • bind(): void

close

  • close(): Promise<void>
  • Closes all swap client instances gracefully.

    Returns Promise<void>

    Nothing upon success, throws otherwise.

emit

  • emit(event: "lndUpdate", lndUpdate: LndUpdate): boolean
  • emit(event: "raidenUpdate", tokenAddresses: Map<string, string>, address?: undefined | string): boolean
  • emit(event: "htlcAccepted", swapClient: SwapClient, rHash: string, amount: number, currency: string): boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

genSeed

  • genSeed(): Promise<object>

get

  • Gets a swap client instance.

    Parameters

    • currency: string

      a currency that the swap client is linked to.

    Returns SwapClient | undefined

    swap client instance upon success, undefined otherwise.

getLndClientsInfo

  • getLndClientsInfo(): Promise<Map<string, object>>
  • Gets all lnd clients' info.

    Returns Promise<Map<string, object>>

    A promise that resolves to an object containing lnd clients' info, throws otherwise.

getLndClientsMap

getMaxListeners

  • getMaxListeners(): number
  • Returns number

init

  • init(models: Models, awaitingCreate?: boolean): Promise<void>
  • Starts all swap clients, binds event listeners and waits for the swap clients to initialize.

    Parameters

    • models: Models
    • Default value awaitingCreate: boolean = false

    Returns Promise<void>

    A promise that resolves upon successful initialization, rejects otherwise.

initWallets

  • initWallets(walletPassword: string, seedMnemonic: string[]): Promise<object>
  • Initializes wallets with seed and password.

    Parameters

    • walletPassword: string
    • seedMnemonic: string[]

    Returns Promise<object>

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: "lndUpdate", listener: function): this
  • on(event: "raidenUpdate", listener: function): this
  • on(event: "htlcAccepted", listener: function): this
  • Parameters

    • event: "lndUpdate"
    • listener: function

    Returns this

  • Parameters

    • event: "raidenUpdate"
    • listener: function
        • (tokenAddresses: Map<string, string>, address?: undefined | string): void
        • Parameters

          • tokenAddresses: Map<string, string>
          • Optional address: undefined | string

          Returns void

    Returns this

  • Parameters

    • event: "htlcAccepted"
    • listener: function
        • (swapClient: SwapClient, rHash: string, amount: number, currency: string): void
        • Parameters

          • swapClient: SwapClient
          • rHash: string
          • amount: number
          • currency: string

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

openChannel

  • openChannel(__namedParameters: object): Promise<void>
  • Opens a payment channel.

    Parameters

    • __namedParameters: object
      • amount: number
      • currency: string
      • peer: Peer

    Returns Promise<void>

    Nothing upon success, throws otherwise.

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

remove

  • remove(currency: string): void
  • Removes a new swap client and currency association.

    Parameters

    • currency: string

      a currency that should be unlinked from a swap client.

    Returns void

    Nothing upon success, throws otherwise.

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

unlockWallets

  • unlockWallets(walletPassword: string): Promise<string[]>
  • Unlocks wallets with a password.

    Parameters

    • walletPassword: string

    Returns Promise<string[]>

    an array of currencies for each lnd client that was unlocked

waitForLnd

  • waitForLnd(): Promise<void>
  • Checks to make sure all enabled lnd instances are available and waits up to a short time for them to become available in case they are not. Throws an error if any lnd clients remain unreachable.

    Returns Promise<void>

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc