pub struct XRPL<T: Transport> { /* private fields */ }Expand description
A client that exposes methods for interacting with the XRP Ledger.
Examples
use std::convert::TryInto;
use xrpl_rs::{XRPL, transports::HTTP, types::account::AccountInfoRequest, types::CurrencyAmount};
use tokio_test::block_on;
// Create a new XRPL client with the HTTP transport.
let xrpl = XRPL::new(
HTTP::builder()
.with_endpoint("http://s1.ripple.com:51234/")
.unwrap()
.build()
.unwrap());
// Create a request
let mut req = AccountInfoRequest::default();
req.account = "rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn".to_owned();
// Fetch the account info for an address.
let account_info = block_on(async {
xrpl
.account_info(req)
.await
.unwrap()
});
assert_eq!(account_info.account_data.balance, CurrencyAmount::xrp(9977));Implementations
sourceimpl<T: Transport> XRPL<T>
impl<T: Transport> XRPL<T>
pub fn new(transport: T) -> Self
sourcepub async fn account_channels(
&self,
params: AccountChannelsRequest
) -> Result<AccountChannelsResponse, Error>
pub async fn account_channels(
&self,
params: AccountChannelsRequest
) -> Result<AccountChannelsResponse, Error>
The account_channels method returns information about an account’s Payment Channels. This includes only channels where the specified account is the channel’s source, not the destination. (A channel’s “source” and “owner” are the same.) All information retrieved is relative to a particular version of the ledger.
sourcepub async fn account_currencies(
&self,
params: AccountCurrenciesRequest
) -> Result<AccountCurrenciesResponse, Error>
pub async fn account_currencies(
&self,
params: AccountCurrenciesRequest
) -> Result<AccountCurrenciesResponse, Error>
The account_currencies command retrieves a list of currencies that an account can send or receive, based on its trust lines. (This is not a thoroughly confirmed list, but it can be used to populate user interfaces.)
sourcepub async fn account_info(
&self,
params: AccountInfoRequest
) -> Result<AccountInfoResponse, Error>
pub async fn account_info(
&self,
params: AccountInfoRequest
) -> Result<AccountInfoResponse, Error>
The account_info command retrieves information about an account, its activity, and its XRP balance. All information retrieved is relative to a particular version of the ledger.
sourcepub async fn account_lines(
&self,
params: AccountLinesRequest
) -> Result<AccountLinesResponse, Error>
pub async fn account_lines(
&self,
params: AccountLinesRequest
) -> Result<AccountLinesResponse, Error>
The account_lines method returns information about an account’s trust lines, including balances in all non-XRP currencies and assets. All information retrieved is relative to a particular version of the ledger.
sourcepub async fn account_offers(
&self,
params: AccountOfferRequest
) -> Result<AccountOfferResponse, Error>
pub async fn account_offers(
&self,
params: AccountOfferRequest
) -> Result<AccountOfferResponse, Error>
The account_offers method retrieves a list of offers made by a given account that are outstanding as of a particular ledger version.
sourcepub async fn transaction_entry(
&self,
params: TransactionEntryRequest
) -> Result<TransactionEntryResponse, Error>
pub async fn transaction_entry(
&self,
params: TransactionEntryRequest
) -> Result<TransactionEntryResponse, Error>
The transaction_entry method retrieves information on a single transaction from a specific ledger version. (The tx method, by contrast, searches all ledgers for the specified transaction. We recommend using that method instead.)
sourcepub async fn submit(
&self,
params: SubmitRequest
) -> Result<SubmitResponse, Error>
pub async fn submit(
&self,
params: SubmitRequest
) -> Result<SubmitResponse, Error>
The submit method applies a transaction and sends it to the network to be confirmed and included in future ledgers.
sourcepub async fn sign_and_submit(
&self,
params: SignAndSubmitRequest
) -> Result<SubmitResponse, Error>
pub async fn sign_and_submit(
&self,
params: SignAndSubmitRequest
) -> Result<SubmitResponse, Error>
The sign_and_submit method applies a transaction and sends it to the network to be confirmed and included in future ledgers.
sourcepub async fn fee(&self, params: FeeRequest) -> Result<FeeResponse, Error>
pub async fn fee(&self, params: FeeRequest) -> Result<FeeResponse, Error>
The fee command reports the current state of the open-ledger requirements for the transaction cost. This requires the FeeEscalation amendment to be enabled. New in: rippled 0.31.0.
sourcepub async fn ledger(
&self,
params: LedgerRequest
) -> Result<LedgerResponse, Error>
pub async fn ledger(
&self,
params: LedgerRequest
) -> Result<LedgerResponse, Error>
Retrieve information about the public ledger.
sourcepub async fn channel_verify(
&self,
params: ChannelVerifyRequest
) -> Result<ChannelVerifyResponse, Error>
pub async fn channel_verify(
&self,
params: ChannelVerifyRequest
) -> Result<ChannelVerifyResponse, Error>
The channel_verify method checks the validity of a signature that can be used to redeem a specific amount of XRP from a payment channel.
sourceimpl<T: DuplexTransport> XRPL<T>
impl<T: DuplexTransport> XRPL<T>
pub async fn subscribe<R: DeserializeOwned>(
&self,
request: SubscribeRequest
) -> Result<Pin<Box<dyn Stream<Item = Result<R, TransportError>>>>, TransportError>
Auto Trait Implementations
impl<T> RefUnwindSafe for XRPL<T> where
T: RefUnwindSafe,
impl<T> Send for XRPL<T> where
T: Send,
impl<T> Sync for XRPL<T> where
T: Sync,
impl<T> Unpin for XRPL<T> where
T: Unpin,
impl<T> UnwindSafe for XRPL<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more