extend ZapAction
going to need amounts for configurable zaps Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -66,7 +66,9 @@ pub use user_account::UserAccount;
|
||||
pub use wallet::{
|
||||
get_wallet_for_mut, GlobalWallet, Wallet, WalletError, WalletState, WalletType, WalletUIState,
|
||||
};
|
||||
pub use zaps::{AnyZapState, NoteZapTarget, NoteZapTargetOwned, ZapTarget, ZappingError};
|
||||
pub use zaps::{
|
||||
AnyZapState, NoteZapTarget, NoteZapTargetOwned, ZapTarget, ZapTargetOwned, ZappingError,
|
||||
};
|
||||
|
||||
// export libs
|
||||
pub use enostr;
|
||||
|
||||
@@ -28,6 +28,12 @@ pub enum NoteAction {
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub enum ZapAction {
|
||||
Send(NoteZapTargetOwned),
|
||||
Send(ZapTargetAmount),
|
||||
ClearError(NoteZapTargetOwned),
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub struct ZapTargetAmount {
|
||||
pub target: NoteZapTargetOwned,
|
||||
pub specified_msats: Option<u64>, // if None use default amount
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
mod action;
|
||||
mod context;
|
||||
|
||||
pub use action::{NoteAction, ZapAction};
|
||||
pub use action::{NoteAction, ZapAction, ZapTargetAmount};
|
||||
pub use context::{BroadcastContext, ContextSelection, NoteContextSelection};
|
||||
|
||||
use crate::{notecache::NoteCache, zaps::Zaps, Images};
|
||||
|
||||
@@ -606,6 +606,17 @@ impl From<&ZapTarget<'_>> for ZapTargetOwned {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a ZapTargetOwned> for ZapTarget<'a> {
|
||||
fn from(value: &'a ZapTargetOwned) -> Self {
|
||||
match value {
|
||||
ZapTargetOwned::Profile(pubkey) => ZapTarget::Profile(pubkey.bytes()),
|
||||
ZapTargetOwned::Note(note_zap_target_owned) => {
|
||||
ZapTarget::Note(note_zap_target_owned.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ZapKey<'_>> for ZapKeyOwned {
|
||||
fn from(value: &ZapKey) -> Self {
|
||||
Self {
|
||||
|
||||
Reference in New Issue
Block a user