Options
All
  • Public
  • Public/Protected
  • All
Menu

A class representing a client to interact with raiden.

Hierarchy

Index

Constructors

constructor

  • new RaidenClient(__namedParameters: { config: { disable: boolean; host: string; keystorepath: string; port: number }; currencyInstances: CurrencyInstance[]; directChannelChecks: boolean; logger: Logger; unitConverter: UnitConverter }): RaidenClient

Properties

Optional address

address: undefined | string

Private directChannelChecks

directChannelChecks: boolean

Protected disable

disable: boolean

Readonly finalLock

finalLock: 100 = 100

Private host

host: string

logger

logger: Logger

Private maxChannelInboundAmounts

maxChannelInboundAmounts: Map<string, number> = new Map<string, number>()

Private maxChannelOutboundAmounts

maxChannelOutboundAmounts: Map<string, number> = new Map<string, number>()

Private port

port: number

Protected Optional reconnectionTimer

reconnectionTimer: NodeJS.Timer

Protected status

status: ClientStatus = ClientStatus.NotInitialized

tokenAddresses

tokenAddresses: Map<string, string> = new Map<string, string>()

A map of currency symbols to token addresses.

Private totalOutboundAmounts

totalOutboundAmounts: Map<string, number> = new Map<string, number>()

Readonly type

type: Raiden = SwapClientType.Raiden

Private unitConverter

unitConverter: UnitConverter

Static Readonly RECONNECT_INTERVAL

RECONNECT_INTERVAL: 5000 = 5000

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

Accessors

label

  • get label(): string

minutesPerBlock

  • get minutesPerBlock(): number

Methods

addInvoice

  • addInvoice(): Promise<void>

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

canRouteToNode

  • canRouteToNode(destination: string, currency: string): Promise<boolean>

channelBalance

  • channelBalance(currency?: undefined | string): Promise<ChannelBalance>

close

  • close(): void

closeChannel

  • closeChannel(): Promise<void>

closeChannelRequest

  • closeChannelRequest(channel_address: string): Promise<void>

deposit

  • deposit(): Promise<string>

depositToChannel

  • depositToChannel(channel_address: string, balance: number): Promise<void>
  • Deposits more of a token to an existing channel.

    Parameters

    • channel_address: string

      the address of the channel to deposit to

    • balance: number

      the amount to deposit to the channel

    Returns Promise<void>

Protected disconnect

  • disconnect(): void

emit

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

eventNames

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

Private getAddress

  • getAddress(): Promise<string>

getChannel

  • getChannel(token_address: string, channel_address: string): Promise<Channel>
  • Gets info about a given raiden payment channel.

    Parameters

    • token_address: string

      the token address for the network to which the channel belongs

    • channel_address: string

      the address of the channel to query

    Returns Promise<Channel>

getChannels

  • getChannels(token_address?: undefined | string): Promise<Channel[]>
  • Gets info about all non-settled channels.

    Parameters

    • Optional token_address: undefined | string

      an optional parameter to specify channels belonging to the specified token network

    Returns Promise<Channel[]>

getHeight

  • getHeight(): Promise<number>

getMaxListeners

  • getMaxListeners(): number

Private getPaymentEvents

  • getPaymentEvents(currency?: undefined | string, destination?: undefined | string): Promise<{ amount?: undefined | number; event: string; identifier: number; initiator?: undefined | string; log_time: string; payment_network_address: string; reason?: undefined | string; route?: string[]; secret?: undefined | string; target?: undefined | string; token_network_address: string }[]>
  • Parameters

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

    Returns Promise<{ amount?: undefined | number; event: string; identifier: number; initiator?: undefined | string; log_time: string; payment_network_address: string; reason?: undefined | string; route?: string[]; secret?: undefined | string; target?: undefined | string; token_network_address: string }[]>

Private getPendingTransfers

  • getPendingTransfers(currency?: undefined | string, destination?: undefined | string): Promise<{ initiator: string; locked_amount: string; payment_identifier: string; role: string; target: string; token_address: string; transferred_amount: string }[]>
  • Parameters

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

    Returns Promise<{ initiator: string; locked_amount: string; payment_identifier: string; role: string; target: string; token_address: string; transferred_amount: string }[]>

getRaidenInfo

getRoute

  • getRoute(units: number, destination: string, currency: string): Promise<undefined | { getTotalTimeLock: any }>

getVersion

init

  • init(): Promise<void>

initSpecific

  • initSpecific(): Promise<void>

isConnected

  • isConnected(): boolean

isDisabled

  • isDisabled(): boolean

isDisconnected

  • isDisconnected(): boolean

isMisconfigured

  • isMisconfigured(): boolean

isNotInitialized

  • isNotInitialized(): boolean

isOperational

  • isOperational(): boolean

isOutOfSync

  • isOutOfSync(): 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[]

lookupPayment

  • lookupPayment(rHash: string, currency?: undefined | string, destination?: undefined | string): Promise<{ state: PaymentState } | { preimage: undefined | string; state: PaymentState }>

maxChannelInboundAmount

  • maxChannelInboundAmount(currency: string): number

maxChannelOutboundAmount

  • maxChannelOutboundAmount(currency: string): number

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: "connectionVerified", listener: (swapClientInfo: SwapClientInfo) => void): this

once

  • once(event: "initialized", listener: () => void): this

openChannel

  • openChannel(__namedParameters: { currency: string; peerIdentifier: string; units: number }): Promise<void>

Private openChannelRequest

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

removeAllListeners

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

    • Optional event: string | symbol

    Returns this

removeInvoice

  • removeInvoice(): Promise<void>

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

Private sanitizeTokenPaymentResponse

sendPayment

  • sendPayment(deal: SwapDeal): Promise<string>

Private sendRequest

  • sendRequest(endpoint: string, method: string, payload?: undefined | object): Promise<IncomingMessage>
  • Sends a request to the Raiden REST API.

    Parameters

    • endpoint: string

      the URL endpoint

    • method: string

      an HTTP request method

    • Optional payload: undefined | object

      the request payload

    Returns Promise<IncomingMessage>

sendSmallestAmount

  • sendSmallestAmount(rHash: string, destination: string, currency: string): Promise<string>

Protected setConnected

  • setConnected(newIdentifier?: undefined | string, newUris?: string[]): Promise<void>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Protected setStatus

Private setTokenAddresses

settleInvoice

  • settleInvoice(): Promise<void>

Private tokenPayment

totalOutboundAmount

  • totalOutboundAmount(currency: string): number

tradingLimits

  • tradingLimits(currency?: undefined | string): Promise<TradingLimits>

Protected updateCapacity

  • updateCapacity(): Promise<void>

Protected verifyConnection

  • verifyConnection(): Promise<void>

verifyConnectionWithTimeout

  • verifyConnectionWithTimeout(): Promise<void>

walletBalance

  • walletBalance(_currency?: undefined | string): Promise<WalletBalance>

Static Private getIdentifier

  • getIdentifier(rHash: string): number
  • Derives an integer identifier using the first 4 bytes of a provided payment hash in hex.

    Parameters

    • rHash: string

      a payment hash in hex

    Returns number

Generated using TypeDoc