Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ Simple, reference implementation Cashu wallet, in Rust, with UI, based on CDK.

## TODO

Minor:
- No mint list, selected mint if only one mint

Proto:
- UI: Show Mints in dialog
- Add mint!

MVP:
- mint onboarding: guide to adding mint, propose mints, links to pink
- Wallet init, seed verify
- cmd line args
- arg for DB file
Expand All @@ -28,10 +31,13 @@ Non-MVP:
- pending operations, show, check
- app: collect logs, provide
- claim pending
- mint list, with recommendations, etc.
- Parse and show info from entered LN invoice & cashu tokens
- list proofs
- re-mint, change denoms
- burn spent tokens
- send LN from multiple mints (MPP)
- read QR codes

CDK:
- melt_quote_status vs. mint_quote_state
Expand Down
3 changes: 3 additions & 0 deletions parakesh-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[package]
name = "parakesh-common"
version = "0.1.1"
description = "Common parts for ParaKesh Cashu wallet"
license = "MIT"
edition = "2021"


[dependencies]
cdk = "0.8.1"
cdk-common = "0.8.1"
Expand Down
2 changes: 2 additions & 0 deletions parakesh-console-sync/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "parakesh-console-sync"
version = "0.1.1"
description = "Simple Cashu wallet, console UI, built on CDK, simple async/await invocations"
license = "MIT"
edition = "2021"

[dependencies]
Expand Down
2 changes: 2 additions & 0 deletions parakesh-ui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "parakesh-ui"
version = "0.1.1"
description = "Simple Cashu wallet with UI (iced-based), built on CDK"
license = "MIT"
edition = "2021"

[dependencies]
Expand Down
2 changes: 2 additions & 0 deletions parakesh-ui/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub(crate) enum Message {
AmountInput(String),
InvoiceInput(String),
TokenInput(String),
AddMintInput(String),
ReceiveLN(u64),
ReceiveLNOK,
ReceiveEC(String),
Expand All @@ -40,6 +41,7 @@ pub(crate) enum Message {
SendEC(u64),
SendECOK,
SelectMint(String),
AddMint(String),
WidgetMessage((String, WidgetMessage)),
CopyToClipboard(String),
}
Expand Down
49 changes: 42 additions & 7 deletions parakesh-ui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ use iced::futures::{SinkExt, StreamExt};
use iced::widget::{button, column, mouse_area, row, scrollable, text, text_input, Column};
use iced::{Element, Renderer, Task, Theme};

#[derive(Default)]
enum AddMintState {
#[default]
NotRequested,
Requested,
Completed(Result<(), String>),
}

#[derive(Default)]
enum RecLNState {
#[default]
Expand Down Expand Up @@ -53,7 +61,9 @@ pub(crate) struct IcedApp {
amount_input: String,
invoice_input: String,
token_input: String,
add_mint_input: String,

add_mint_state: AddMintState,
rec_ln_state: RecLNState,
rec_ec_state: RecECState,
send_ln_state: SendLNState,
Expand Down Expand Up @@ -250,6 +260,7 @@ impl IcedApp {
.as_ref()
.map(|wi| wi.selected_mint_url.to_string())
.unwrap_or("?".to_owned());

let mints_ui: Column<'_, Message, Theme, Renderer> =
Column::with_children(self.mints_info.iter().map(|mi| {
mouse_area(row![
Expand All @@ -266,11 +277,25 @@ impl IcedApp {
}));
column![
row![text("Mints:").size(20)],
row![
text("Selected mint: ").size(15),
text(selected_mint).size(15),
],
row![text("Selected: ").size(15), text(selected_mint).size(15),],
row![text("List (click to select)").size(15),],
mints_ui,
row![
button("Add Mint:").on_press(Message::AddMint(self.add_mint_input.clone())),
text_input("(mint url)", &self.add_mint_input)
.on_input(Message::AddMintInput)
.size(20)
.width(200),
]
.spacing(10),
row![text(match &self.add_mint_state {
AddMintState::NotRequested => "-".to_owned(),
AddMintState::Requested => "Add in progress...".to_owned(),
AddMintState::Completed(Ok(_)) => "Mint added".to_owned(),
AddMintState::Completed(Err(e)) => format!("Error adding mint, {}", e),
})
.size(15),]
.spacing(10),
]
.spacing(10)
.into()
Expand Down Expand Up @@ -323,14 +348,14 @@ impl IcedApp {
let header = self.view_header();

let tab_header: Element<Message> = row![
button("Mints").on_press(Message::Tab(UiMainTab::Mints)),
button("Receive LN").on_press(Message::Tab(UiMainTab::RecLN)),
button("Receive EC").on_press(Message::Tab(UiMainTab::RecEC)),
button("Send LN").on_press(Message::Tab(UiMainTab::SendLN)),
button("Send EC").on_press(Message::Tab(UiMainTab::SendEC)),
button("Mints").on_press(Message::Tab(UiMainTab::Mints)),
button("Settings").on_press(Message::Tab(UiMainTab::Settings)),
text("|").size(20),
button("Refresh").on_press(Message::RefreshInfo),
button("(Refresh)").on_press(Message::RefreshInfo),
]
.spacing(10)
.into();
Expand Down Expand Up @@ -362,7 +387,9 @@ impl IcedApp {
amount_input: "0".to_owned(),
invoice_input: "".to_owned(),
token_input: "".to_owned(),
add_mint_input: "".to_owned(),

add_mint_state: AddMintState::NotRequested,
rec_ln_state: RecLNState::NotRequested,
rec_ec_state: RecECState::NotRequested,
send_ln_state: SendLNState::NotRequested,
Expand Down Expand Up @@ -432,7 +459,8 @@ impl IcedApp {
self.wallet_info = Some(wallet_info.clone());
}
}
AppEvent::MintAdded(_res) => {
AppEvent::MintAdded(res) => {
self.add_mint_state = AddMintState::Completed(res);
self.refresh_info();
}
AppEvent::MintSelectedByUrl(_res) => {
Expand Down Expand Up @@ -480,6 +508,10 @@ impl IcedApp {
Message::SelectMint(url) => {
let _res = self.app.select_mint(url);
}
Message::AddMint(url) => {
self.add_mint_state = AddMintState::Requested;
let _res = self.app.add_mint(url);
}
Message::AmountInput(amount_str) => {
if let Ok(amnt) = amount_str.parse::<f64>() {
self.amount_input = (amnt as u64).to_string();
Expand All @@ -491,6 +523,9 @@ impl IcedApp {
Message::TokenInput(token) => {
self.token_input = token;
}
Message::AddMintInput(mint_url) => {
self.add_mint_input = mint_url;
}
Message::ReceiveLN(amount) => {
self.rec_ln_state = RecLNState::Requested(amount);
let _res = self.app.mint_from_ln(amount);
Expand Down
2 changes: 2 additions & 0 deletions parakesh/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "parakesh"
version = "0.1.1"
description = "Simple Cashu wallet, console UI, based on CDK, event-based invocations"
license = "MIT"
edition = "2021"

[dependencies]
Expand Down