Class BroadcastClient

Client that can rely on multiple different servers.

Deprecated

since version 2.2.0. Will be deleted in version 3.0.0.

Currently this implementation does not provide better reliability. To get better reliability, implement reconnect/error handling logic and choose a reliable endpoint.

If you need the ability to fall-back to different endpoints, consider using xrpl-client

Hierarchy

Constructor

Abstraction

getBalances: ((this, address, options?) => Promise<{
    currency: string;
    issuer?: string;
    value: string;
}[]>) = getBalances

Type declaration

    • (this, address, options?): Promise<{
          currency: string;
          issuer?: string;
          value: string;
      }[]>
    • Parameters

      • this: Client
      • address: string
      • options: {
            ledger_hash?: string;
            ledger_index?: LedgerIndex;
            limit?: number;
            peer?: string;
        } = {}
        • Optional ledger_hash?: string
        • Optional ledger_index?: LedgerIndex
        • Optional limit?: number
        • Optional peer?: string

      Returns Promise<{
          currency: string;
          issuer?: string;
          value: string;
      }[]>

getLedgerIndex: ((this) => Promise<number>) = getLedgerIndex

Type declaration

    • (this): Promise<number>
    • Parameters

      Returns Promise<number>

getOrderbook: ((this, currency1, currency2, options?) => Promise<{
    buy: BookOffer[];
    sell: BookOffer[];
}>) = getOrderbook

Type declaration

    • (this, currency1, currency2, options?): Promise<{
          buy: BookOffer[];
          sell: BookOffer[];
      }>
    • Parameters

      • this: Client
      • currency1: BookOfferCurrency
      • currency2: BookOfferCurrency
      • options: {
            ledger_hash?: null | string;
            ledger_index?: LedgerIndex;
            limit?: number;
            taker?: null | string;
        } = {}
        • Optional ledger_hash?: null | string
        • Optional ledger_index?: LedgerIndex
        • Optional limit?: number
        • Optional taker?: null | string

      Returns Promise<{
          buy: BookOffer[];
          sell: BookOffer[];
      }>

getXrpBalance: ((this, address, options?) => Promise<string>) = getXrpBalance

Type declaration

    • (this, address, options?): Promise<string>
    • Parameters

      • this: Client
      • address: string
      • options: {
            ledger_hash?: string;
            ledger_index?: LedgerIndex;
        } = {}
        • Optional ledger_hash?: string
        • Optional ledger_index?: LedgerIndex

      Returns Promise<string>

Core

autofill: (<T>(this, transaction, signersCount?) => Promise<T>) = autofill

Type declaration

    • <T>(this, transaction, signersCount?): Promise<T>
    • Type Parameters

      Parameters

      • this: Client
      • transaction: T
      • Optional signersCount: number

      Returns Promise<T>

submit: ((this, transaction, opts?) => Promise<SubmitResponse>) = submit

Type declaration

    • (this, transaction, opts?): Promise<SubmitResponse>
    • Parameters

      • this: Client
      • transaction: string | Transaction
      • Optional opts: {
            autofill?: boolean;
            failHard?: boolean;
            wallet?: Wallet;
        }
        • Optional autofill?: boolean
        • Optional failHard?: boolean
        • Optional wallet?: Wallet

      Returns Promise<SubmitResponse>

submitAndWait: (<T>(this, transaction, opts?) => Promise<TxResponse<T>>) = submitAndWait

Type declaration

    • <T>(this, transaction, opts?): Promise<TxResponse<T>>
    • Type Parameters

      Parameters

      • this: Client
      • transaction: string | T
      • Optional opts: {
            autofill?: boolean;
            failHard?: boolean;
            wallet?: Wallet;
        }
        • Optional autofill?: boolean
        • Optional failHard?: boolean
        • Optional wallet?: Wallet

      Returns Promise<TxResponse<T>>

Faucet

fundWallet: ((this, wallet?, options?) => Promise<{
    balance: number;
    wallet: Wallet;
}>) = fundWallet

Type declaration

    • (this, wallet?, options?): Promise<{
          balance: number;
          wallet: Wallet;
      }>
    • Parameters

      • this: Client
      • Optional wallet: null | Wallet
      • Optional options: {
            amount?: string;
            faucetHost?: string;
            faucetPath?: string;
            usageContext?: string;
        }
        • Optional amount?: string
        • Optional faucetHost?: string
        • Optional faucetPath?: string
        • Optional usageContext?: string

      Returns Promise<{
          balance: number;
          wallet: Wallet;
      }>

Fee

feeCushion: number

Factor to multiply estimated fee by to provide a cushion in case the required fee rises during submission of a transaction. Defaults to 1.2.

maxFeeXRP: string

Maximum transaction cost to allow, in decimal XRP. Must be a string-encoded number. Defaults to '2'.

Network

  • get url(): string
  • Get the url that the client is connected to.

    Returns string

    The URL of the server this client is connected to.

  • Tells the Client instance to connect to its rippled server.

    Returns Promise<void>

    A promise that resolves with a void value when a connection is established.

    Example

    Client.connect() establishes a connection between a Client object and the server.

    const { Client } = require('xrpl')
    const client = new Client('wss://s.altnet.rippletest.net:51233')
    await client.connect()
    // do something with the client
    await client.disconnect()

    If you open a client connection, be sure to close it with await client.disconnect() before exiting your application.

  • Disconnects the XRPL client from the server and cancels all pending requests and subscriptions. Call when you want to disconnect the client from the server, such as when you're finished using the client or when you need to switch to a different server.

    Returns Promise<void>

    A promise that resolves with a void value when a connection is destroyed.

    Example

    To use the disconnect() method, you first need to create a new Client object and connect it to a server:

    const { Client } = require('xrpl')
    const client = new Client('wss://s.altnet.rippletest.net:51233')
    await client.connect()
    // do something with the client
    await client.disconnect()
  • Parameters

    Returns Promise<AccountChannelsResponse[]>

  • Makes multiple paged requests to the client to return a given number of resources. Multiple paged requests will be made until the limit number of resources is reached (if no limit is provided, a single request will be made).

    If the command is unknown, an additional collect property is required to know which response key contains the array of resources.

    NOTE: This command is used by existing methods and is not recommended for general use. Instead, use rippled's built-in pagination and make multiple requests as needed.

    Parameters

    Returns Promise<AccountLinesResponse[]>

    The array of all responses.

    Throws

    ValidationError if there is no collection key (either from a known command or for the unknown command).

  • Makes multiple paged requests to the client to return a given number of resources. Multiple paged requests will be made until the limit number of resources is reached (if no limit is provided, a single request will be made).

    If the command is unknown, an additional collect property is required to know which response key contains the array of resources.

    NOTE: This command is used by existing methods and is not recommended for general use. Instead, use rippled's built-in pagination and make multiple requests as needed.

    Parameters

    Returns Promise<AccountObjectsResponse[]>

    The array of all responses.

    Throws

    ValidationError if there is no collection key (either from a known command or for the unknown command).

  • Makes multiple paged requests to the client to return a given number of resources. Multiple paged requests will be made until the limit number of resources is reached (if no limit is provided, a single request will be made).

    If the command is unknown, an additional collect property is required to know which response key contains the array of resources.

    NOTE: This command is used by existing methods and is not recommended for general use. Instead, use rippled's built-in pagination and make multiple requests as needed.

    Parameters

    Returns Promise<AccountOffersResponse[]>

    The array of all responses.

    Throws

    ValidationError if there is no collection key (either from a known command or for the unknown command).

  • Makes multiple paged requests to the client to return a given number of resources. Multiple paged requests will be made until the limit number of resources is reached (if no limit is provided, a single request will be made).

    If the command is unknown, an additional collect property is required to know which response key contains the array of resources.

    NOTE: This command is used by existing methods and is not recommended for general use. Instead, use rippled's built-in pagination and make multiple requests as needed.

    Parameters

    Returns Promise<AccountTxResponse[]>

    The array of all responses.

    Throws

    ValidationError if there is no collection key (either from a known command or for the unknown command).

  • Makes multiple paged requests to the client to return a given number of resources. Multiple paged requests will be made until the limit number of resources is reached (if no limit is provided, a single request will be made).

    If the command is unknown, an additional collect property is required to know which response key contains the array of resources.

    NOTE: This command is used by existing methods and is not recommended for general use. Instead, use rippled's built-in pagination and make multiple requests as needed.

    Parameters

    Returns Promise<BookOffersResponse[]>

    The array of all responses.

    Throws

    ValidationError if there is no collection key (either from a known command or for the unknown command).

  • Makes multiple paged requests to the client to return a given number of resources. Multiple paged requests will be made until the limit number of resources is reached (if no limit is provided, a single request will be made).

    If the command is unknown, an additional collect property is required to know which response key contains the array of resources.

    NOTE: This command is used by existing methods and is not recommended for general use. Instead, use rippled's built-in pagination and make multiple requests as needed.

    Parameters

    Returns Promise<LedgerDataResponse[]>

    The array of all responses.

    Throws

    ValidationError if there is no collection key (either from a known command or for the unknown command).

Other

buildVersion: undefined | string

Rippled Version used by the server this client is connected to

clients: Client[]
connection: Connection
networkID: undefined | number

Network ID of the server this client is connected to

prepareTransaction: (<T>(this, transaction, signersCount?) => Promise<T>) = autofill

Type declaration

    • <T>(this, transaction, signersCount?): Promise<T>
    • Type Parameters

      Parameters

      • this: Client
      • transaction: T
      • Optional signersCount: number

      Returns Promise<T>

      Deprecated

      Use autofill instead, provided for users familiar with v1

captureRejectionSymbol: typeof captureRejectionSymbol
captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

defaultMaxListeners: number
errorMonitor: typeof errorMonitor

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.

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns BroadcastClient

  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • Returns (string | symbol)[]

  • Returns number

  • Parameters

    • event: string | symbol

    Returns number

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns BroadcastClient

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns BroadcastClient

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns BroadcastClient

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns BroadcastClient

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns BroadcastClient

  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

    Deprecated

    since v4.0.0

  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>

Generated using TypeDoc