method to get current default zap amount
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use tokenator::{ParseError, TokenParser, TokenSerializable};
|
||||
|
||||
use crate::get_current_wallet;
|
||||
|
||||
const DEFAULT_ZAP_MSATS: u64 = 10_000;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
@@ -102,3 +104,12 @@ fn msats_to_sats_string(msats: u64) -> String {
|
||||
pub enum DefaultZapError {
|
||||
InvalidUserInput,
|
||||
}
|
||||
|
||||
pub fn get_current_default_msats<'a>(
|
||||
accounts: &'a mut crate::Accounts,
|
||||
global_wallet: &'a mut crate::GlobalWallet,
|
||||
) -> u64 {
|
||||
get_current_wallet(accounts, global_wallet)
|
||||
.map(|w| w.default_zap.get_default_zap_msats())
|
||||
.unwrap_or_else(|| crate::zaps::default_zap::DEFAULT_ZAP_MSATS)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user