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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ MVP:
- Wallet init, seed verify
- cmd line args
- arg for DB file
- when polling for RecLN, use original mint, not current (save the mint with the req)

Non-MVP:
- send EC from multiple mints, select automatically (feature on which level?)
Expand Down
26 changes: 26 additions & 0 deletions parakesh-common/src/pk_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,32 @@ impl PKApp {
Err("No selected mint!".to_owned())
}
}

pub fn get_recommended_mint_list() -> Vec<(String, String)> {
return vec![
(
"https://mint.minibits.cash/Bitcoin".to_owned(),
"MiniBits".to_owned(),
),
("https://21mint.me".to_owned(), "21mint".to_owned()),
(
"https://mint.lnwallet.app".to_owned(),
"LNWallet".to_owned(),
),
(
"https://testnut.cashu.space".to_owned(),
"Test (cashu.space)".to_owned(),
),
(
"https://fake.thesimplekid.dev".to_owned(),
"Test (simplekid".to_owned(),
),
(
"https://cashu.mutinynet.com".to_owned(),
"Test, on MutinyNet)".to_owned(),
),
];
}
}

impl MintFromLnIntermediaryResult {
Expand Down
3 changes: 3 additions & 0 deletions parakesh-common/src/pk_app_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,4 +489,7 @@ impl PKAppAsync {
pub fn send_ec(&mut self, amount_sats: u64) -> Result<(), String> {
self.send_to_incoming(AppRequest::SendEC(amount_sats))
}
pub fn get_recommended_mint_list() -> Vec<(String, String)> {
PKApp::get_recommended_mint_list()
}
}
77 changes: 53 additions & 24 deletions parakesh-ui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub(crate) struct IcedApp {
balance: Option<BalanceInfo>,
mints_info: Vec<MintInfo>,
main_tab: UiMainTab,
reccomended_mints: Vec<(String, String)>,

amount_input: String,
invoice_input: String,
Expand Down Expand Up @@ -261,33 +262,47 @@ impl IcedApp {
.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![
text(mi.url.to_string())
.font(MyFonts::bold_if(mi.url.to_string() == selected_mint))
.size(15)
.width(300),
text(format!(" {}", mi.balance))
.font(MyFonts::bold_if(mi.url.to_string() == selected_mint))
.size(15),
])
.on_press(Message::SelectMint(mi.url.to_string()))
.into()
}));
column![
row![text("Mints:").size(20)],
row![text("Selected: ").size(15), text(selected_mint).size(15),],
row![text("List (click to select)").size(15),],
mints_ui,
let mut contents = Vec::new();
if self.mints_info.len() == 0 {
contents.push(row![text("No Mint added").size(20)]);
contents.push(row![text("Add a mint").size(20)]);
} else {
contents.push(row![text("Mints:").size(20)]);
contents.push(row![
text("Selected: ").size(15),
text(selected_mint.clone()).size(15),
]);
if self.mints_info.len() > 1 {
let mints_ui: Column<'_, Message, Theme, Renderer> =
Column::with_children(self.mints_info.iter().map(|mi| {
mouse_area(row![
text(mi.url.to_string())
.font(MyFonts::bold_if(mi.url.to_string() == selected_mint))
.size(15)
.width(300),
text(format!(" {}", mi.balance))
.font(MyFonts::bold_if(mi.url.to_string() == selected_mint))
.size(15),
])
.on_press(Message::SelectMint(mi.url.to_string()))
.into()
}));
contents.push(row![text("List (click to select)").size(15),]);
contents.push(row![mints_ui]);
}
}
// Add mint is common
contents.push(
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),
.width(400),
]
.spacing(10),
);
contents.push(
row![text(match &self.add_mint_state {
AddMintState::NotRequested => "-".to_owned(),
AddMintState::Requested => "Add in progress...".to_owned(),
Expand All @@ -296,9 +311,22 @@ impl IcedApp {
})
.size(15),]
.spacing(10),
]
.spacing(10)
.into()
);
contents.push(row![text(
"You can also select a mint for addition from this list:"
)
.size(15)]);
let recommended_mints_ui: Column<'_, Message, Theme, Renderer> =
Column::with_children(self.reccomended_mints.iter().map(|(url, info)| {
mouse_area(row![text(format!("{} - {}", info, url)).size(15),])
.on_press(Message::AddMintInput(url.clone()))
.into()
}));
contents.push(row![recommended_mints_ui]);

Column::with_children(contents.into_iter().map(|e| e.into()))
.spacing(10)
.into()
}

fn view_settings(&self) -> Element<Message> {
Expand Down Expand Up @@ -383,7 +411,8 @@ impl IcedApp {
wallet_info: None,
balance: None,
mints_info: Vec::new(),
main_tab: UiMainTab::RecLN,
reccomended_mints: PKAppAsync::get_recommended_mint_list(),
main_tab: UiMainTab::Mints,
amount_input: "0".to_owned(),
invoice_input: "".to_owned(),
token_input: "".to_owned(),
Expand Down