From 2232ff9ace1357f0df08ea7a1428c8292759077a Mon Sep 17 00:00:00 2001 From: DanGould Date: Sun, 1 Dec 2024 16:47:34 -0500 Subject: [PATCH] Clarify amount fn units --- src/uri.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uri.rs b/src/uri.rs index c23939d..e5075c7 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -32,9 +32,9 @@ impl Uri { pub fn address(&self) -> String { self.clone().0.address.to_string() } - ///Gets the amount in satoshis. - pub fn amount(&self) -> Option { - self.0.amount.map(|x| x.to_btc()) + /// Gets the amount in satoshis. + pub fn amount_sats(&self) -> Option { + self.0.amount.map(|x| x.to_sat()) } #[cfg(not(feature = "uniffi"))] pub fn check_pj_supported(&self) -> Result { @@ -160,8 +160,8 @@ impl PjUriBuilder { ) .into()) } - /// Accepts the amount you want to receive in sats and sets it in btc . - pub fn amount(&self, amount: u64) -> Arc { + /// Accepts the amount you want to receive in sats. + pub fn amount_sats(&self, amount: u64) -> Arc { let amount = payjoin::bitcoin::Amount::from_sat(amount); Arc::new(self.0.clone().amount(amount).into()) } @@ -204,8 +204,8 @@ impl PjUriBuilder { ) .into()) } - /// Accepts the amount you want to receive in sats and sets it in btc . - pub fn amount(&self, sats: u64) -> Self { + /// Accepts the amount you want to receive in sats. + pub fn amount_sats(&self, sats: u64) -> Self { let amount = payjoin::bitcoin::Amount::from_sat(sats); self.0.clone().amount(amount).into() } @@ -252,7 +252,7 @@ mod tests { ) .unwrap(); let uri = builder - .amount(amount.to_sat()) + .amount_sats(amount.to_sat()) .message("message".to_string()) .pjos(true) .label("label".to_string())