feat: Monero invoice/receipt frames, wallet RPC, /pay /tip
All checks were successful
ci / test (push) Successful in 2m50s

Signed inv/rcp codecs keyed by identity, payments table with unverified
incoming receipts, optional JSON-RPC sidecar (loopback/.onion HTTP only),
and TUI /pay /tip. OnionWire still holds no spend keys.
This commit is contained in:
Sirius DevOps 2026-09-10 14:37:43 -04:00
commit 1a9b54d138
No known key found for this signature in database
11 changed files with 1318 additions and 14 deletions

View file

@ -59,13 +59,15 @@ OnionWire keys\n\
1 / 2 / 3 focus roster / chat / composer\n\
j k or Up Down move or scroll focused pane\n\
g / G jump to top / bottom\n\
Enter /wipe /wipe-all /profile /who\n\
Enter /wipe /wipe-all /profile /who /pay /tip\n\
Esc close overlay, go back, clear composer\n\
F2 share QR\n\
F3 paste a friend QR\n\
F4 rotate onion locator\n\
F5 selected friend's profile (/who)\n\
/profile edit name, bio, Monero address\n\
/pay <xmr> [memo] invoice to receive\n\
/tip <xmr> [memo] pay selected friend\n\
? this help\n\
Ctrl-Q quit\n\
\n\
@ -141,11 +143,13 @@ pub enum WipeKind {
All,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SlashCmd {
Wipe(WipeKind),
Profile,
Who,
Pay { atomic: String, memo: String },
Tip { atomic: String, memo: String },
}
#[derive(Debug, Clone, PartialEq, Eq)]
@ -239,13 +243,37 @@ pub enum AppExit {
}
pub fn parse_cmd(raw: &str) -> Option<SlashCmd> {
match raw.trim() {
"/wipe" => Some(SlashCmd::Wipe(WipeKind::Messages)),
"/wipe-all" => Some(SlashCmd::Wipe(WipeKind::All)),
"/profile" => Some(SlashCmd::Profile),
"/who" => Some(SlashCmd::Who),
_ => None,
let s = raw.trim();
match s {
"/wipe" => return Some(SlashCmd::Wipe(WipeKind::Messages)),
"/wipe-all" => return Some(SlashCmd::Wipe(WipeKind::All)),
"/profile" => return Some(SlashCmd::Profile),
"/who" => return Some(SlashCmd::Who),
_ => {}
}
if let Some(rest) = s.strip_prefix("/pay")
&& (rest.is_empty() || rest.starts_with(char::is_whitespace))
{
return parse_amount_cmd(rest).map(|(atomic, memo)| SlashCmd::Pay { atomic, memo });
}
if let Some(rest) = s.strip_prefix("/tip")
&& (rest.is_empty() || rest.starts_with(char::is_whitespace))
{
return parse_amount_cmd(rest).map(|(atomic, memo)| SlashCmd::Tip { atomic, memo });
}
None
}
fn parse_amount_cmd(rest: &str) -> Option<(String, String)> {
let rest = rest.trim();
if rest.is_empty() {
return None;
}
let mut parts = rest.splitn(2, char::is_whitespace);
let amount = parts.next()?.trim();
let memo = parts.next().unwrap_or("").trim().to_string();
let atomic = crate::pay::xmr_to_atomic(amount).ok()?;
Some((atomic, memo))
}
pub fn parse_slash(raw: &str) -> Option<WipeKind> {
@ -465,6 +493,8 @@ impl App {
let mut wipe_confirm = None;
let mut profile_save = None;
let mut open_profile = false;
let mut pay_cmd = None;
let mut tip_cmd = None;
match &mut self.screen {
Screen::Main => match key.code {
KeyCode::Tab => self.focus = self.focus.next(),
@ -507,6 +537,14 @@ impl App {
self.composer.clear();
self.who_open = true;
}
Some(SlashCmd::Pay { atomic, memo }) => {
self.composer.clear();
pay_cmd = Some((atomic, memo));
}
Some(SlashCmd::Tip { atomic, memo }) => {
self.composer.clear();
tip_cmd = Some((atomic, memo));
}
None => {}
},
KeyCode::Char(c) if !key.modifiers.contains(KeyModifiers::CONTROL) => {
@ -591,6 +629,12 @@ impl App {
if let Some(draft) = profile_save {
self.save_profile(draft)?;
}
if let Some((atomic, memo)) = pay_cmd {
self.send_pay(&atomic, &memo)?;
}
if let Some((atomic, memo)) = tip_cmd {
self.send_tip(&atomic, &memo)?;
}
Ok(None)
}
@ -768,6 +812,32 @@ impl App {
Ok(())
}
fn send_pay(&mut self, atomic: &str, memo: &str) -> Result<(), String> {
let Some(friend) = self.friends.get(self.selected) else {
self.status_note = Some("no friend selected".into());
return Ok(());
};
let pk = friend.pubkey.clone();
match self.rt.block_on(self.node.pay_invoice(&pk, atomic, memo)) {
Ok(()) => self.status_note = Some("invoice sent".into()),
Err(e) => self.status_note = Some(e),
}
Ok(())
}
fn send_tip(&mut self, atomic: &str, memo: &str) -> Result<(), String> {
let Some(friend) = self.friends.get(self.selected) else {
self.status_note = Some("no friend selected".into());
return Ok(());
};
let pk = friend.pubkey.clone();
match self.rt.block_on(self.node.tip(&pk, atomic, memo)) {
Ok(()) => self.status_note = Some("tip sent".into()),
Err(e) => self.status_note = Some(e),
}
Ok(())
}
fn who_body(&self) -> String {
let Some(friend) = self.friends.get(self.selected) else {
return "no friend selected\n\nEsc closes".into();
@ -894,7 +964,7 @@ impl App {
f.render_widget(chat, panes[1]);
let cmd = if self.composer.is_empty() {
"/wipe /wipe-all /profile /who".to_string()
"/wipe /wipe-all /profile /who /pay /tip".to_string()
} else {
self.composer.clone()
};