Options
All
  • Public
  • Public/Protected
  • All
Menu

A class that's responsible for recovering swap deals that were interrupted due to a system or xud crash, ensuring that we do not lose funds on a partially completed swap.

Hierarchy

  • EventEmitter
    • SwapRecovery

Index

Constructors

constructor

Properties

Private logger

logger: Logger

Private pendingSwaps

pendingSwaps: Map<string, SwapDealInstance> = new Map()

A map of payment hashes to swaps where we have a pending outgoing payment but don't know the preimage.

Private Optional pendingSwapsTimer

pendingSwapsTimer: NodeJS.Timeout

Private swapClientManager

swapClientManager: SwapClientManager

Static Readonly PENDING_SWAP_RECHECK_INTERVAL

PENDING_SWAP_RECHECK_INTERVAL: 300000 = 300000

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: keyof symbol

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

beginTimer

  • beginTimer(): void

Private checkPaymentStatus

  • Checks the status of the outgoing payment for a swap where we have begun sending a payment and handles the resolution of the swap once a final status for the payment is determined.

    Parameters

    Returns Promise<void>

Private checkPendingSwaps

  • checkPendingSwaps(): void

Private claimPayment

  • Claims the incoming payment for a deal where the outgoing payment has already gone through and where we already know the preimage.

    Parameters

    Returns Promise<void>

emit

eventNames

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

Private failDeal

getMaxListeners

  • getMaxListeners(): number

getPendingSwapHashes

  • getPendingSwapHashes(): string[]

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: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: "recovered", listener: (recoveredSwap: SwapDealInstance) => void): this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

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

    • event: string | symbol

    Returns Function[]

recoverDeal

  • Attempts to recover a swap deal from whichever state it was left in including canceling or settling any related invoices & payments.

    Parameters

    Returns Promise<void>

removeAllListeners

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

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

stopTimer

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