feat: add support for cashu wallet (nip60 & nip61) (#71)

Reviewed-on: #71
This commit was merged in pull request #71.
This commit is contained in:
2026-11-09 01:12:27 +00:00
parent c1757bbcae
commit 98a12e438a
20 changed files with 4732 additions and 15 deletions
+32
View File
@@ -61,6 +61,7 @@ enum Command {
ShowContactList,
ShowInbox,
ShowBrowse,
ShowWallet,
NewChat,
NewGroup,
JoinGroup,
@@ -196,6 +197,30 @@ impl Workspace {
}),
);
#[cfg(not(target_arch = "wasm32"))]
{
let wallet = ::nip60::WalletRegistry::global(cx);
subscriptions.push(cx.subscribe_in(
&wallet,
window,
|_this, _wallet, event, window, cx| match event {
::nip60::WalletEvent::Error(error) => {
window.push_notification(Notification::error(error.clone()), cx);
}
::nip60::WalletEvent::TokenCreated(_) => {
window.push_notification(
Notification::new()
.message("Cashu token created, copy it from the wallet panel")
.with_type(NotificationType::Success),
cx,
);
}
::nip60::WalletEvent::Updated => {}
},
));
}
App::on_action(cx, {
let workspace = workspace.clone();
move |action, cx| {
@@ -307,6 +332,13 @@ impl Workspace {
let panel = browse::init(self.dock.downgrade(), window, cx);
self.add_panel_to_dock(panel, DockPlacement::Center, window, cx);
}
Command::ShowWallet => {
#[cfg(not(target_arch = "wasm32"))]
{
let panel = nip60_ui::wallet::init(window, cx);
self.add_panel_to_dock(panel, DockPlacement::Center, window, cx);
}
}
Command::NewChat => {
new_chat::open(self.dock.downgrade(), window, cx);
}