Options
All
  • Public
  • Public/Protected
  • All
Menu

A class containing the available RPC methods for an unlocked, running instance of xud.

Hierarchy

  • EventEmitter
    • Service

Index

Constructors

constructor

Properties

disabled

disabled: boolean = false

Whether the service is disabled - in other words whether xud is locked.

Private logger

logger: Logger

Private nodekey

nodekey: NodeKey

Private orderBook

orderBook: OrderBook

Private pool

pool: Pool

shutdown

shutdown: () => void

Type declaration

    • (): void
    • Returns void

Private swapClientManager

swapClientManager: SwapClientManager

Private swaps

swaps: Swaps

Private version

version: string

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

addCurrency

  • addCurrency(args: { currency: string; decimalPlaces: number; swapClient: SwapClientType | number; tokenAddress?: undefined | string }): Promise<void>
  • Adds a currency.

    Parameters

    • args: { currency: string; decimalPlaces: number; swapClient: SwapClientType | number; tokenAddress?: undefined | string }
      • currency: string
      • decimalPlaces: number
      • swapClient: SwapClientType | number
      • Optional tokenAddress?: undefined | string

    Returns 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

addPair

  • addPair(args: { baseCurrency: string; quoteCurrency: string }): Promise<void>
  • Adds a trading pair.

    Parameters

    • args: { baseCurrency: string; quoteCurrency: string }
      • baseCurrency: string
      • quoteCurrency: string

    Returns Promise<void>

ban

  • ban(args: { nodeIdentifier: string }): Promise<void>

changePassword

  • changePassword(__namedParameters: { newPassword: string; oldPassword: string }): Promise<void>
  • Parameters

    • __namedParameters: { newPassword: string; oldPassword: string }
      • newPassword: string
      • oldPassword: string

    Returns Promise<void>

closeChannel

  • closeChannel(args: { amount: number; currency: string; destination: string; fee?: undefined | number; force: boolean; nodeIdentifier: string }): Promise<string[]>
  • Parameters

    • args: { amount: number; currency: string; destination: string; fee?: undefined | number; force: boolean; nodeIdentifier: string }
      • amount: number
      • currency: string
      • destination: string
      • Optional fee?: undefined | number
      • force: boolean
      • nodeIdentifier: string

    Returns Promise<string[]>

connect

  • connect(args: { nodeUri: string; retryConnecting: boolean }): Promise<void>
  • Connect to an XU node on a given node uri.

    Parameters

    • args: { nodeUri: string; retryConnecting: boolean }
      • nodeUri: string
      • retryConnecting: boolean

    Returns Promise<void>

depositConfirmed

  • depositConfirmed(hash: string): void
  • Notifies Connext client that a deposit has been confirmed.

    Parameters

    • hash: string

    Returns void

discoverNodes

  • discoverNodes(args: { nodeIdentifier: string }): Promise<number>
  • Discover nodes from a specific peer and apply new connections

    Parameters

    • args: { nodeIdentifier: string }
      • nodeIdentifier: string

    Returns Promise<number>

emit

  • emit(event: "logLevel", level: Level): boolean

eventNames

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

executeSwap

  • executeSwap(args: { orderId: string; pairId: string; peerPubKey: string; quantity: number }): Promise<{} & { amountReceived: number; amountSent: number; currencyReceived: string; currencySent: string; quantity: number }>
  • Parameters

    • args: { orderId: string; pairId: string; peerPubKey: string; quantity: number }
      • orderId: string
      • pairId: string
      • peerPubKey: string
      • quantity: number

    Returns Promise<{} & { amountReceived: number; amountSent: number; currencyReceived: string; currencySent: string; quantity: number }>

getBalance

  • getBalance(args: { currency: string }): Promise<Map<string, { channelBalance: number; inactiveChannelBalance: number; pendingChannelBalance: number; totalBalance: number; unconfirmedWalletBalance: number; walletBalance: number }>>
  • Gets the total balance for one or all currencies.

    Parameters

    • args: { currency: string }
      • currency: string

    Returns Promise<Map<string, { channelBalance: number; inactiveChannelBalance: number; pendingChannelBalance: number; totalBalance: number; unconfirmedWalletBalance: number; walletBalance: number }>>

getInfo

getMaxListeners

  • getMaxListeners(): number

getMnemonic

  • getMnemonic(): Promise<string[]>

getNodeInfo

  • getNodeInfo(args: { nodeIdentifier: string }): Promise<{ banned?: undefined | false | true; reputationScore: ReputationEvent }>
  • Gets information about a specified node.

    Parameters

    • args: { nodeIdentifier: string }
      • nodeIdentifier: string

    Returns Promise<{ banned?: undefined | false | true; reputationScore: ReputationEvent }>

listCurrencies

  • listCurrencies(): Map<string, Currency>

listOrders

  • Get a map between pair ids and its orders from the order book.

    Parameters

    • args: { includeAliases: boolean; limit: number; owner: Owner | number; pairId: string }
      • includeAliases: boolean
      • limit: number
      • owner: Owner | number
      • pairId: string

    Returns Map<string, ServiceOrderSidesArrays>

listPairs

  • listPairs(): string[]
  • Get the list of the order book's supported pairs.

    Returns string[]

    A list of supported trading pair tickers

listPeers

  • listPeers(): { address: string; alias?: undefined | string; connextIdentifier?: undefined | string; inbound: boolean; lndPubKeys?: undefined | {}; nodePubKey?: undefined | string; pairs?: string[]; secondsConnected: number; xudVersion?: undefined | string }[]
  • Get information about currently connected peers.

    Returns { address: string; alias?: undefined | string; connextIdentifier?: undefined | string; inbound: boolean; lndPubKeys?: undefined | {}; nodePubKey?: undefined | string; pairs?: string[]; secondsConnected: number; xudVersion?: undefined | string }[]

    A list of connected peers with key information for each peer

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: "logLevel", listener: (level: Level) => 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

openChannel

  • openChannel(args: { amount: number; currency: string; fee?: undefined | number; nodeIdentifier: string; pushAmount?: undefined | number }): Promise<string>
  • Parameters

    • args: { amount: number; currency: string; fee?: undefined | number; nodeIdentifier: string; pushAmount?: undefined | number }
      • amount: number
      • currency: string
      • Optional fee?: undefined | number
      • nodeIdentifier: string
      • Optional pushAmount?: undefined | number

    Returns Promise<string>

placeOrder

  • placeOrder(args: { immediateOrCancel: boolean; orderId: string; pairId: string; price: number; quantity: number; replaceOrderId: string; side: number }, callback?: undefined | ((e: ServicePlaceOrderEvent) => void)): Promise<{ internalMatches: OwnOrder[]; remainingOrder?: OwnOrder; swapFailures: SwapFailure[]; swapSuccesses: SwapSuccess[] }>
  • Add an order to the order book. If price is zero or unspecified a market order will get added.

    Parameters

    • args: { immediateOrCancel: boolean; orderId: string; pairId: string; price: number; quantity: number; replaceOrderId: string; side: number }
      • immediateOrCancel: boolean
      • orderId: string
      • pairId: string
      • price: number
      • quantity: number
      • replaceOrderId: string
      • side: number
    • Optional callback: undefined | ((e: ServicePlaceOrderEvent) => void)

    Returns Promise<{ internalMatches: OwnOrder[]; remainingOrder?: OwnOrder; swapFailures: SwapFailure[]; swapSuccesses: SwapSuccess[] }>

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

providePreimage

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

removeAllOrders

  • removeAllOrders(): Promise<{ onHoldOrderLocalIds: string[]; removedOrderLocalIds: string[] }>

removeCurrency

  • removeCurrency(args: { currency: string }): Promise<void>
  • Removes a currency.

    Parameters

    • args: { currency: string }
      • currency: string

    Returns 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

removeOrder

  • removeOrder(args: { orderId: string; quantity?: undefined | number }): { onHoldQuantity: number; pairId: string; remainingQuantity: number; removedQuantity: number }
  • Parameters

    • args: { orderId: string; quantity?: undefined | number }
      • orderId: string
      • Optional quantity?: undefined | number

    Returns { onHoldQuantity: number; pairId: string; remainingQuantity: number; removedQuantity: number }

    • onHoldQuantity: number
    • pairId: string
    • remainingQuantity: number
    • removedQuantity: number

removePair

  • removePair(args: { pairId: string }): Promise<void>
  • Removes a trading pair.

    Parameters

    • args: { pairId: string }
      • pairId: string

    Returns Promise<void>

resolveHash

setLogLevel

  • setLogLevel(args: { logLevel: number }): Promise<void>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

subscribeOrders

  • subscribeOrders(args: { existing: boolean }, callback: (order?: ServiceOrder, orderRemoval?: OrderPortion) => void, cancelled$: Observable<void>): void

subscribeSwapFailures

  • subscribeSwapFailures(args: { includeTaker: boolean }, callback: (swapFailure: SwapFailure) => void, cancelled$: Observable<void>): Promise<void>

subscribeSwaps

  • subscribeSwaps(args: { includeTaker: boolean }, callback: (swapSuccess: SwapSuccess) => void, cancelled$: Observable<void>): Promise<void>

subscribeSwapsAccepted

  • subscribeSwapsAccepted(_args: {}, callback: (swapAccepted: SwapAccepted) => void, cancelled$: Observable<void>): Promise<void>

Private toServiceOrder

tradeHistory

  • tradeHistory(args: { limit: number }): Promise<ServiceTrade[]>

tradingLimits

  • tradingLimits(args: { currency: string }): Promise<Map<string, { maxBuy: number; maxSell: number; reservedBuy: number; reservedSell: number }>>
  • Gets the trading limits (max outbound and inbound capacities for a distinct channel) for one or all currencies.

    Parameters

    • args: { currency: string }
      • currency: string

    Returns Promise<Map<string, { maxBuy: number; maxSell: number; reservedBuy: number; reservedSell: number }>>

transferReceived

unban

  • unban(args: { nodeIdentifier: string; reconnect: boolean }): Promise<void>
  • Parameters

    • args: { nodeIdentifier: string; reconnect: boolean }
      • nodeIdentifier: string
      • reconnect: boolean

    Returns Promise<void>

walletDeposit

  • walletDeposit(args: { currency: string }): Promise<string>

walletWithdraw

  • walletWithdraw(args: { all: boolean; amount: number; currency: string; destination: string; fee: number }): Promise<string>
  • Parameters

    • args: { all: boolean; amount: number; currency: string; destination: string; fee: number }
      • all: boolean
      • amount: number
      • currency: string
      • destination: string
      • fee: number

    Returns Promise<string>

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