XRPL JavaScript API Reference

website·Indexed 39 days ago

https://js.xrpl.org

Technical documentation for the XRPL JavaScript library, detailing LedgerEntry interfaces, enumerations, and variables. Includes specifications for AccountRoot, AMM, NFToken, MPToken, Escrow, and other ledger object types.

Tokens
276.2K
Snippets
1.1K
Records
1.9K
Agent score
64%

What's inside XRPL

  1. Overview of the Wallet class

    The Wallet class is a utility for deriving a wallet composed of a keypair (publicKey and privateKey). Wallets can be derived from a seed, mnemonic, or entropy (an array of random numbers). It allows developers to sign and verify transactions offline.
  2. Overview of xrpl.js

    xrpl.js is the recommended JavaScript/TypeScript library for integrating applications with the XRP Ledger. It supports advanced functionality including IOUs, payment paths, the decentralized exchange (DEX), account settings, payment channels, escrows, and multi-signing. It is compatible with Node.js (v20+) and web browsers (Chrome).
  3. Overview of xrpl.js

    xrpl.js is a JavaScript/TypeScript library designed for interacting with the XRP Ledger. It is the recommended library for implementing advanced functionality such as IOUs, payment paths, decentralized exchange (DEX), account settings, payment channels, escrows, and multi-signing. It is compatible with Node.js (v20+) and web browsers (Chrome).
  4. Overview of the Wallet class

    The Wallet class is a utility for deriving and managing a wallet composed of a keypair (publicKey and privateKey). Wallets can be derived from a seed, mnemonic, or entropy (an array of random numbers). It allows developers to sign and verify transactions offline before submitting them to the XRP Ledger.
  5. Overview of xrpl.js features

    xrpl.js is the recommended JavaScript/TypeScript library for integrating applications with the XRP Ledger. It supports advanced functionality including IOUs, payment paths, decentralized exchange (DEX), account settings, payment channels, escrows, and multi-signing. Key capabilities include:

    • Managing keys and creating test credentials via Wallet and Client.fundWallet().
    • Submitting transactions using Client.submit().
    • Observing the ledger via Client.request() using public API methods.
    • Subscribing to ledger changes (e.g., transactions).
    • Parsing ledger data using utilities like xrpToDrops and rippleTimeToISOTime.

    The library is compatible with Node.js (v20+) and web browsers (Chrome).

  6. Overview of xrpl.js

    xrpl.js is the recommended JavaScript/TypeScript library for integrating applications with the XRP Ledger. It supports advanced functionality including IOUs, payment paths, decentralized exchange (DEX), account settings, payment channels, escrows, and multi-signing. It is compatible with Node.js (v20+) and web browsers (Chrome).
  7. Use the XChainCommit interface for cross-chain transfers

    The XChainCommit transaction is the second step in a cross-chain transfer. It is used to either put assets into trust on a locking chain (so they can be wrapped on an issuing chain) or burn wrapped assets on an issuing chain (so they can be returned to the locking chain).
  8. Understand the AccountOffersResponse interface structure

    The AccountOffersResponse interface is the expected response when making an AccountOffersRequest. It extends BaseResponse and contains a result object providing details about the offers made by a specific account.
    interface AccountOffersResponse {
      api_version?: number;
      forwarded?: boolean;
      id: string | number;
      result: {
        account: string;
        ledger_current_index?: number;
        ledger_hash?: string;
        ledger_index?: number;
        marker?: unknown;
        offers?: AccountOffer[];
      };
      status?: string;
      type: string;
      warning?: "load";
      warnings?: ResponseWarning[];
    }
  9. Request information about a Vault instance using VaultInfoRequest

    The VaultInfoRequest interface is used to call the vault_info method to retrieve details about a Vault instance. It returns a VaultInfoResponse. The request requires the command field to be set to "vault_info" and can be filtered by the vault's object ID, the owner's account ID, or a specific sequence number.
    interface VaultInfoRequest {
      command: "vault_info";
      vault_id?: string; // The object ID of the Vault
      owner?: string;    // ID of the Vault Owner account
      seq?: number;       // Sequence number of the vault entry
      api_version?: number; // API version to use (defaults to 1)
      id?: string | number; // Unique request identifier for matching responses
    }
  10. Understand RipplePathFindResponse result properties

    The result object in a RipplePathFindResponse provides the following details about the path-finding operation:

    • alternatives: An array of RipplePathFindPathOption objects. If this array is empty, no paths exist between the source and destination accounts.
    • destination_account: The unique address of the account that would receive the payment.
    • destination_amount: The amount to be received at the destination.
    • destination_currencies: An array of currency codes (3-letter codes like "USD" or 40-character hex strings) accepted by the destination.
    • source_account: The address of the account initiating the path search.
    • validated: A boolean indicating if the result is validated.
    • ledger_current_index: (Optional) The ledger index used for the search.
    • full_reply: (Optional) Boolean indicating if a full reply was returned.
    • id: (Optional) The request ID.
  11. Understand the NoRippleCheckResponse interface

    The NoRippleCheckResponse interface is the expected response when making a NoRippleCheckRequest. It provides information about an account's Ripple settings and suggests transactions to fix any identified problems.
    interface NoRippleCheckResponse {
      api_version?: number;
      forwarded?: boolean;
      id: string | number;
      result: {
        ledger_current_index: number;
        problems: string[];
        transactions: (Transaction & ResponseOnlyTxInfo)[];
      };
      status?: string;
      type: string;
      warning?: "load";
      warnings?: ResponseWarning[];
    }
  12. Understand GatewayBalancesResponse result properties

    The result object within a GatewayBalancesResponse provides detailed information about the gateway balances:

    • account: The address of the account that issued the balances.
    • assets: Total amounts held that are issued by others. In recommended configurations, the issuing address should have none.
    • balances: Amounts issued to the hotwallet addresses from the request. Keys are addresses and values are arrays of GatewayBalance objects.
    • obligations: Total amounts issued to addresses not excluded, mapped as currencies to their total issued value.
    • ledger_index: The ledger index of the current in-progress ledger version used to retrieve the information.
    • ledger_current_index: The ledger index of the ledger version used to generate the response.
    • ledger_hash: The identifying hash of the ledger version used to generate the response.