pub enum CurrencyAmount {
XRP(BigInt),
IssuedCurrency(IssuedCurrencyAmount),
}Variants§
XRP(BigInt)
IssuedCurrency(IssuedCurrencyAmount)
Implementations§
Source§impl CurrencyAmount
impl CurrencyAmount
Sourcepub fn xrp(drops: u64) -> Self
pub fn xrp(drops: u64) -> Self
Examples found in repository?
examples/account_submit_payment.rs (line 35)
13async fn main() {
14 // Generate testnet credentials.
15 let creds_one = testnet::get_testnet_credentials()
16 .await
17 .expect("error generating testnet credentials");
18 println!("Created account: {:?}", creds_one);
19
20 // Create a new XRPL client with the HTTP transport pointed at ripple testnet.
21 let xrpl = XRPL::new(
22 HTTP::builder()
23 .with_endpoint("https://s.altnet.rippletest.net:51234/")
24 .unwrap()
25 .build()
26 .unwrap(),
27 );
28
29 // Create wallet from secret
30 let mut wallet =
31 Wallet::from_secret(&creds_one.account.secret).unwrap();
32
33 // Create a payment transaction.
34 let mut payment = Payment::default();
35 payment.amount = CurrencyAmount::xrp(100000000);
36 payment.destination = "rp7pmm4rzTGmtZDuvrG1z9Xrm3KwHRipDw".to_owned(); // Set the destination to the second account.
37
38 // Convert the payment into a transaction.
39 let mut tx = payment.into_transaction();
40
41 let tx_blob = wallet.fill_and_sign(&mut tx, &xrpl).await.unwrap();
42
43 println!("Transaction: {:?}", tx);
44
45 // Create a sign_and_submit request.
46 let mut submit_req = SubmitRequest::default();
47 submit_req.tx_blob = tx_blob;
48
49 // Submit the transaction to the ledger.
50 let submit_res = xrpl
51 .submit(submit_req)
52 .await
53 .expect("failed to make submit request");
54 println!("Got response to submit request: {:?}", submit_res);
55
56 // Create an account info request to see the balance of account two.
57 let mut req = AccountInfoRequest::default();
58 // Set the account to the second set of testnet credentials.
59 req.account = "rp7pmm4rzTGmtZDuvrG1z9Xrm3KwHRipDw".to_owned();
60 // Fetch the account info for an address.
61 let account_info = xrpl
62 .account_info(req)
63 .await
64 .expect("failed to make account_info request");
65 // Print the account and balance
66 println!(
67 "Address {} has balance of {:?}",
68 account_info.account_data.account, account_info.account_data.balance
69 );
70}pub fn issued_currency(value: Decimal, currency: &str, issuer: &Address) -> Self
Trait Implementations§
Source§impl Clone for CurrencyAmount
impl Clone for CurrencyAmount
Source§fn clone(&self) -> CurrencyAmount
fn clone(&self) -> CurrencyAmount
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CurrencyAmount
impl Debug for CurrencyAmount
Source§impl Default for CurrencyAmount
impl Default for CurrencyAmount
Source§impl<'de> Deserialize<'de> for CurrencyAmount
impl<'de> Deserialize<'de> for CurrencyAmount
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CurrencyAmount
impl PartialEq for CurrencyAmount
Source§impl Serialize for CurrencyAmount
impl Serialize for CurrencyAmount
impl Eq for CurrencyAmount
impl StructuralPartialEq for CurrencyAmount
Auto Trait Implementations§
impl Freeze for CurrencyAmount
impl RefUnwindSafe for CurrencyAmount
impl Send for CurrencyAmount
impl Sync for CurrencyAmount
impl Unpin for CurrencyAmount
impl UnwindSafe for CurrencyAmount
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.