Options
All
  • Public
  • Public/Protected
  • All
Menu

A base class to represent an external swap client such as lnd or Raiden.

Hierarchy

Index

Constructors

constructor

Properties

Abstract finalLock

finalLock: number

The number of blocks of lock time to expect on the final hop of an incoming swap payment.

logger

logger: Logger

Protected Optional reconnectionTimer

reconnectionTimer: NodeJS.Timer

Protected status

status: ClientStatus = ClientStatus.NotInitialized

Abstract type

Private Optional updateCapacityTimer

updateCapacityTimer: NodeJS.Timer

Static Private CAPACITY_REFRESH_INTERVAL

CAPACITY_REFRESH_INTERVAL: number = 3000

Time in milliseconds between updating the maximum outbound capacity.

Static Private INITIALIZATION_TIME_LIMIT

INITIALIZATION_TIME_LIMIT: number = 5000

The maximum amount of time we will wait for the connection to be verified during initialization.

Static RECONNECT_TIME_LIMIT

RECONNECT_TIME_LIMIT: 5000 = 5000

Time in milliseconds between attempts to recheck connectivity to the client.

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

minutesPerBlock

  • get minutesPerBlock(): number

Methods

Abstract addInvoice

  • addInvoice(rHash: string, units: number, expiry?: undefined | number): Promise<void>
  • Parameters

    • rHash: string
    • units: number

      the amount of the invoice denominated in the smallest units supported by its currency

    • Optional expiry: undefined | number

    Returns Promise<void>

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

Abstract channelBalance

  • channelBalance(currency?: undefined | string): Promise<ChannelBalance>
  • Returns the total balance available across all channels and updates the maximum outbound capacity.

    Parameters

    • Optional currency: undefined | string

      the currency whose balance to query for, otherwise all/any currencies supported by this client are included in the balance.

    Returns Promise<ChannelBalance>

close

  • close(): Promise<void>
  • Ends all connections, subscriptions, and timers for for this client.

    Returns Promise<void>

Protected Abstract disconnect

  • disconnect(): Promise<void>

emit

  • emit(event: "connectionVerified", swapClientInfo: SwapClientInfo): boolean

eventNames

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

Abstract getHeight

  • getHeight(): Promise<number>
  • Gets the block height of the chain backing this swap client.

    Returns Promise<number>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

Abstract getRoute

  • getRoute(units: number, destination: string, currency: string, finalCltvDelta?: undefined | number): Promise<Route | undefined>
  • Gets routes for the given currency, amount, and swap identifier.

    Parameters

    • units: number

      the capacity the route must support denominated in the smallest units supported by its currency

    • destination: string

      the identifier for the receiving node

    • currency: string
    • Optional finalCltvDelta: undefined | number

    Returns Promise<Route | undefined>

    routes

isConnected

  • isConnected(): boolean

isDisabled

  • isDisabled(): boolean

isDisconnected

  • isDisconnected(): boolean

isNotInitialized

  • isNotInitialized(): boolean

isWaitingUnlock

  • isWaitingUnlock(): boolean

listenerCount

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

    • type: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

Abstract lookupPayment

  • lookupPayment(rHash: string, currency?: undefined | string, destination?: undefined | string): Promise<PaymentStatus>
  • Checks to see whether we've made a payment using a given rHash.

    Parameters

    • rHash: string
    • Optional currency: undefined | string
    • Optional destination: undefined | string

    Returns Promise<PaymentStatus>

    the preimage for the payment, or undefined if no payment was made

Abstract maximumOutboundCapacity

  • maximumOutboundCapacity(currency?: undefined | string): number

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: "connectionVerified", listener: function): 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

Abstract openChannel

  • openChannel(__namedParameters: object): Promise<void>
  • Opens a payment channel given peerIdentifier, amount optional currency and optional lndUris.

    Parameters

    • __namedParameters: object
      • currency: undefined | string
      • lndUris: undefined | string[]
      • peerIdentifier: string
      • units: number

    Returns Promise<void>

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[]

removeAllListeners

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

    • Optional event: string | symbol

    Returns this

Abstract removeInvoice

  • removeInvoice(rHash: string): Promise<void>

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

Abstract sendPayment

  • sendPayment(deal: SwapDeal): Promise<string>
  • Sends payment according to the terms of a swap deal.

    Parameters

    Returns Promise<string>

    the preimage for the swap

Abstract sendSmallestAmount

  • sendSmallestAmount(rHash: string, destination: string, currency: string): Promise<string>
  • Sends the smallest amount supported by the client to the given destination. Throws an error if the payment fails.

    Parameters

    • rHash: string
    • destination: string
    • currency: string

    Returns Promise<string>

    the preimage for the payment hash

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Protected setStatus

Private setTimers

  • setTimers(): Promise<void>

Abstract settleInvoice

  • settleInvoice(rHash: string, rPreimage: string): Promise<void>

Protected Abstract updateCapacity

  • updateCapacity(): Promise<void>

Protected Abstract verifyConnection

  • verifyConnection(): Promise<void>

verifyConnectionWithTimeout

  • verifyConnectionWithTimeout(): 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