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.
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, notrippled
.server
: Methods to retrieve information about the current state of therippled
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:
Request | Method name | V1 support |
---|---|---|
ChannelRequest | account_channels | ✅ |
CurrenciesRequest | account_currencies | ✅ |
GatewayBalancesRequest | gateway_balances | ✅ |
InfoRequest | account_info | ✅ |
LinesRequest | account_lines | ✅ |
NFTsRequest | account_nfts | ✅ |
NoRippleCheckRequest | noripple_check | ✅ |
ObjectsRequest | account_objects | ✅ |
OffersRequest | account_offers | ✅ |
TransactionsRequest | account_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:
Request | Method name | V1 support |
---|---|---|
VerifyRequest | channel_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:
Request | Method name | V1 support |
---|---|---|
Request | ledger | ✅ |
ClosedRequest | ledger_closed | ✅ |
CurrentRequest | ledger_current | ✅ |
DataRequest | ledger_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:
Request | Method name | V1 support |
---|---|---|
SubmitRequest | submit | ✅ |
SubmitMultisignedRequest | submit_multisigned | ✅ |
EntryRequest | transaction_entry | ✅ |
TxRequest | tx | ✅ |
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:
Request | Method name | V1 support |
---|---|---|
BookOffersRequest | book_offers | ✅ |
DepositAuthorizedRequest | deposit_authorized | ✅ |
FindCreateRequest , FindCloseRequest , FindStatusRequest | path_find | ✅ |
RipplePathFindRequest | ripple_path_find | ✅ |
The nft
subpackage provides the following queries requests:
Request | Method name | V1 support |
---|---|---|
NFTokenBuyOffersRequest | nft_buy_offers | ✅ |
NFTokenSellOffersRequest | nft_sell_offers | ✅ |
The oracle
subpackage provides the following queries requests:
Request | Method name | V1 support |
---|---|---|
GetAggregatePriceRequest | get_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:
Request | Method name | V1 support |
---|---|---|
NFTHistoryRequest | nft_history | ✅ |
NFTInfoRequest | nft_info | ✅ |
NFTsByIssuerRequest | nfts_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:
Request | Method name | V1 support |
---|---|---|
FeatureAllRequest | feature_all | ✅ |
FeatureOneRequest | feature | ✅ |
FeeRequest | fee | ✅ |
ManifestRequest | manifest | ✅ |
InfoRequest | server_info | ✅ |
StateRequest | server_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:
Request | Method name | V1 support |
---|---|---|
RandomRequest | random | ✅ |
PingRequest | ping | ✅ |
Usage
To use the utility
package, you need to import it in your project:
import "github.com/Peersyst/xrpl-go/xrpl/queries/utility"