Class Client

Client for interacting with rippled servers.

Hierarchy

Constructor

Abstraction

getBalances: ((this: Client, address: string, options?: {
    ledger_hash?: string;
    ledger_index?: LedgerIndex;
    limit?: number;
    peer?: string;
}) => Promise<{
    currency: string;
    issuer?: string;
    value: string;
}[]>) = getBalances

Type declaration

    • (this: Client, address: string, options?: {
          ledger_hash?: string;
          ledger_index?: LedgerIndex;
          limit?: number;
          peer?: string;
      }): 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: Client) => Promise<number>) = getLedgerIndex

Type declaration

    • (this: Client): Promise<number>
    • Parameters

      Returns Promise<number>

getOrderbook: ((this: Client, takerPays: TakerAmount, takerGets: TakerAmount, options?: {
    ledger_hash?: null | string;
    ledger_index?: LedgerIndex;
    limit?: number;
    taker?: null | string;
}) => Promise<{
    buy: BookOffer[];
    sell: BookOffer[];
}>) = getOrderbook

Type declaration

    • (this: Client, takerPays: TakerAmount, takerGets: TakerAmount, options?: {
          ledger_hash?: null | string;
          ledger_index?: LedgerIndex;
          limit?: number;
          taker?: null | string;
      }): Promise<{
          buy: BookOffer[];
          sell: BookOffer[];
      }>
    • Parameters

      • this: Client
      • takerPays: TakerAmount
      • takerGets: TakerAmount
      • 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: Client, address: string, options?: {
    ledger_hash?: string;
    ledger_index?: LedgerIndex;
}) => Promise<string>) = getXrpBalance

Type declaration

    • (this: Client, address: string, options?: {
          ledger_hash?: string;
          ledger_index?: LedgerIndex;
      }): 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: Client, transaction: T, signersCount?: number) => Promise<T>) = autofill

Type declaration

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

      Parameters

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

      Returns Promise<T>

submit: ((this: Client, transaction: string | Transaction, opts?: {
    autofill?: boolean;
    failHard?: boolean;
    wallet?: Wallet;
}) => Promise<SubmitResponse>) = submit

Type declaration

    • (this: Client, transaction: string | Transaction, opts?: {
          autofill?: boolean;
          failHard?: boolean;
          wallet?: Wallet;
      }): 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: ((this: Client, transaction: string | Transaction, opts?: {
    autofill?: boolean;
    failHard?: boolean;
    wallet?: Wallet;
}) => Promise<TxResponse>) = submitAndWait

Type declaration

    • (this: Client, transaction: string | Transaction, opts?: {
          autofill?: boolean;
          failHard?: boolean;
          wallet?: Wallet;
      }): Promise<TxResponse>
    • 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<TxResponse>

Faucet

fundWallet: ((this: Client, wallet?: null | Wallet, options?: {
    amount?: string;
    faucetHost?: string;
    faucetPath?: string;
}) => Promise<{
    balance: number;
    wallet: Wallet;
}>) = fundWallet

Type declaration

    • (this: Client, wallet?: null | Wallet, options?: {
          amount?: string;
          faucetHost?: string;
          faucetPath?: string;
      }): Promise<{
          balance: number;
          wallet: Wallet;
      }>
    • Parameters

      • this: Client
      • Optional wallet: null | Wallet
      • Optional options: {
            amount?: string;
            faucetHost?: string;
            faucetPath?: string;
        }
        • Optional amount?: string
        • Optional faucetHost?: string
        • Optional faucetPath?: 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

    The URL of the server this client is connected to.

    Returns string

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

    Returns

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

    Returns Promise<void>

  • Tells the Client instance to disconnect from it's rippled server.

    Returns

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

    Returns Promise<void>

  • Checks if the Client instance is connected to its rippled server.

    Returns

    Whether the client instance is connected.

    Returns boolean

  • 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.

    Returns

    The array of all responses.

    Throws

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

    Parameters

    Returns Promise<AccountLinesResponse[]>

  • 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.

    Returns

    The array of all responses.

    Throws

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

    Parameters

    Returns Promise<AccountObjectsResponse[]>

  • 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.

    Returns

    The array of all responses.

    Throws

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

    Parameters

    Returns Promise<AccountOffersResponse[]>

  • 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.

    Returns

    The array of all responses.

    Throws

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

    Parameters

    Returns Promise<AccountTxResponse[]>

  • 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.

    Returns

    The array of all responses.

    Throws

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

    Parameters

    Returns Promise<BookOffersResponse[]>

  • 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.

    Returns

    The array of all responses.

    Throws

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

    Parameters

    Returns Promise<LedgerDataResponse[]>

Other

connection: Connection
prepareTransaction: (<T>(this: Client, transaction: T, signersCount?: number) => Promise<T>) = autofill

Type declaration

    • <T>(this: Client, transaction: T, signersCount?: number): Promise<T>
    • Deprecated

      Use autofill instead, provided for users familiar with v1

      Type Parameters

      Parameters

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

      Returns Promise<T>

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

          • Rest ...args: any[]

          Returns void

    Returns Client

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

          • Rest ...args: any[]

          Returns void

    Returns Client

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Client

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Client

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Client

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

    • Optional event: string | symbol

    Returns Client

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Client

  • Parameters

    • n: number

    Returns Client

  • Deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

  • 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