Skip to main content

queries

Overview

The queries package contains mainly request and response types for the XRPL methods. This package is used by the package clients rpc and websocket to send client queries to the ledger.

info

As a developer, you may be interested in calling the queries using the websocket or rpc clients. Both clients expose methods to call each query exposed by the queries package.

Queries are grouped by different categories or packages:

  • account: Methods to work with account info.
  • channel: Methods to work with channels.
  • ledger: Methods to retrieve ledger info.
  • transaction: Submit and query ledger transactions.
  • path: Methods to use paths and order books.
  • nft: Methods to work with NFTs.
  • oracle: Methods to work with oracles.
  • clio: Methods to use the Clio API, not rippled.
  • server: Methods to retrieve information about the current state of the rippled server.
  • utility: Perform convenient tasks, such as ping and random number generation.

API version

By default, all queries are meant to be used with the latest XRPL API version (currently v2). If you want to use a specific version, you will need to import the specific version queries package from each subpackage.

For example, if you want to use the XRPL API version v1 queries of the account subpackage, you will need to import it this way:

import accountv1 "github.com/Peersyst/xrpl-go/xrpl/queries/account/v1"

Categories

account

The account package contains methods to interact with XRPL accounts. These methods allow you to:

  • Retrieve account information like balances, settings, and objects.
  • Get account transaction history.
  • Query account channels and escrows.
  • Check account offers and payment channels.

The available methods correspond to the Account Methods in the XRPL API.

The account subpackage provides the following queries requests:

RequestMethod nameV1 support
ChannelRequestaccount_channels
CurrenciesRequestaccount_currencies
GatewayBalancesRequestgateway_balances
InfoRequestaccount_info
LinesRequestaccount_lines
NFTsRequestaccount_nfts
NoRippleCheckRequestnoripple_check
ObjectsRequestaccount_objects
OffersRequestaccount_offers
TransactionsRequestaccount_tx

Usage

To use the account package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/account"

channel

The channel package contains methods to interact with XRPL channels. These methods allow you to:

  • Verify the channel's state.

The available methods correspond to the Payment Channel Methods in the XRPL API.

The channel subpackage provides the following queries requests:

RequestMethod nameV1 support
VerifyRequestchannel_verify

Usage

To use the channel package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/channel"

ledger

The ledger package contains methods to interact with XRPL ledgers. These methods allow you to:

  • Retrieve specific, current or closed ledger information.

The available methods correspond to the Ledger Methods in the XRPL API.

The ledger subpackage provides the following queries requests:

RequestMethod nameV1 support
Requestledger
ClosedRequestledger_closed
CurrentRequestledger_current
DataRequestledger_data

Usage

To use the ledger package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/ledger"

transaction

The transaction package contains methods to interact with XRPL transactions. These methods allow you to:

  • Submit ledger transactions.
  • Query ledger transactions.

The available methods correspond to the Transaction Methods in the XRPL API.

The transaction subpackage provides the following queries requests:

RequestMethod nameV1 support
SubmitRequestsubmit
SubmitMultisignedRequestsubmit_multisigned
EntryRequesttransaction_entry
TxRequesttx

Usage

To use the transaction package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/transaction"

path, nft and oracle

The path, nft and oracle packages contain methods to interact with XRPL paths, NFTs and oracles. These methods allow you to:

  • Retrieve paths and order books.
  • Get NFTs buy and sell offers.

The available methods correspond to the Path and Order Book Methods in the XRPL API.

The path subpackage provides the following queries requests:

RequestMethod nameV1 support
BookOffersRequestbook_offers
DepositAuthorizedRequestdeposit_authorized
FindCreateRequest, FindCloseRequest, FindStatusRequestpath_find
RipplePathFindRequestripple_path_find

The nft subpackage provides the following queries requests:

RequestMethod nameV1 support
NFTokenBuyOffersRequestnft_buy_offers
NFTokenSellOffersRequestnft_sell_offers

The oracle subpackage provides the following queries requests:

RequestMethod nameV1 support
GetAggregatePriceRequestget_aggregate_price

Usage

To use the path package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/path"

To use the oracle package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/oracle"

To use the nft package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/nft"

clio

The clio package contains methods to interact with the Clio API, not rippled. These methods allow you to:

  • Retrieve NFT history.
  • Retrieve NFts information.

The available methods correspond to the Clio Methods in the XRPL API.

The clio subpackage provides the following queries requests:

RequestMethod nameV1 support
NFTHistoryRequestnft_history
NFTInfoRequestnft_info
NFTsByIssuerRequestnfts_by_issuer

Usage

To use the clio package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/clio"

server

The server package contains methods to interact with the rippled server. These methods allow you to:

  • Retrieve server information.
  • Get fee information.
  • Get the manifest.

The available methods correspond to the Server Info Methods in the XRPL API.

The server subpackage provides the following queries requests:

RequestMethod nameV1 support
FeatureAllRequestfeature_all
FeatureOneRequestfeature
FeeRequestfee
ManifestRequestmanifest
InfoRequestserver_info
StateRequestserver_state

Usage

To use the server package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/server"

utility

The utility package contains methods to interact with the XRPL utility. These methods allow you to:

  • Retrieve a random number.
  • Ping the server.

The available methods correspond to the Utility Methods in the XRPL API.

The utility subpackage provides the following queries requests:

RequestMethod nameV1 support
RandomRequestrandom
PingRequestping

Usage

To use the utility package, you need to import it in your project:

import "github.com/Peersyst/xrpl-go/xrpl/queries/utility"