use default zap amount for zap
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -82,16 +82,24 @@ fn execute_note_action(
|
|||||||
let sender = cur_acc.key.pubkey;
|
let sender = cur_acc.key.pubkey;
|
||||||
|
|
||||||
match zap_action {
|
match zap_action {
|
||||||
ZapAction::Send(target) => {
|
ZapAction::Send(target) => 'a: {
|
||||||
if get_wallet_for_mut(accounts, global_wallet, sender.bytes()).is_some() {
|
let Some(wallet) = get_wallet_for_mut(accounts, global_wallet, sender.bytes())
|
||||||
send_zap(&sender, zaps, pool, target)
|
else {
|
||||||
} else {
|
|
||||||
zaps.send_error(
|
zaps.send_error(
|
||||||
sender.bytes(),
|
sender.bytes(),
|
||||||
ZapTarget::Note((&target.target).into()),
|
ZapTarget::Note((&target.target).into()),
|
||||||
ZappingError::SenderNoWallet,
|
ZappingError::SenderNoWallet,
|
||||||
);
|
);
|
||||||
}
|
break 'a;
|
||||||
|
};
|
||||||
|
|
||||||
|
send_zap(
|
||||||
|
&sender,
|
||||||
|
zaps,
|
||||||
|
pool,
|
||||||
|
target,
|
||||||
|
wallet.default_zap.get_default_zap_msats(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ZapAction::ClearError(target) => clear_zap_error(&sender, zaps, target),
|
ZapAction::ClearError(target) => clear_zap_error(&sender, zaps, target),
|
||||||
}
|
}
|
||||||
@@ -146,10 +154,16 @@ pub fn execute_and_process_note_action(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_zap(sender: &Pubkey, zaps: &mut Zaps, pool: &RelayPool, target_amount: &ZapTargetAmount) {
|
fn send_zap(
|
||||||
|
sender: &Pubkey,
|
||||||
|
zaps: &mut Zaps,
|
||||||
|
pool: &RelayPool,
|
||||||
|
target_amount: &ZapTargetAmount,
|
||||||
|
default_msats: u64,
|
||||||
|
) {
|
||||||
let zap_target = ZapTarget::Note((&target_amount.target).into());
|
let zap_target = ZapTarget::Note((&target_amount.target).into());
|
||||||
|
|
||||||
let msats = target_amount.specified_msats.unwrap_or(10_000);
|
let msats = target_amount.specified_msats.unwrap_or(default_msats);
|
||||||
|
|
||||||
let sender_relays: Vec<String> = pool.relays.iter().map(|r| r.url().to_string()).collect();
|
let sender_relays: Vec<String> = pool.relays.iter().map(|r| r.url().to_string()).collect();
|
||||||
zaps.send_zap(sender.bytes(), sender_relays, zap_target, msats);
|
zaps.send_zap(sender.bytes(), sender_relays, zap_target, msats);
|
||||||
|
|||||||
Reference in New Issue
Block a user