-
Notifications
You must be signed in to change notification settings - Fork 28
Cashu bolt12 send and receive with sending to bip353 #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some preliminary review
pub fn payment_hash(&self) -> [u8; 32] { | ||
FromHex::from_hex(&self.payment_hash).expect("invalid payment hash") | ||
FromHex::from_hex(self.payment_hash.as_ref().expect("missing payment hash")) | ||
.expect("invalid payment hash") | ||
} | ||
|
||
pub fn bolt11(&self) -> Bolt11Invoice { | ||
Bolt11Invoice::from_str(&self.bolt11).expect("invalid bolt11") | ||
Bolt11Invoice::from_str(self.bolt11.as_ref().expect("missing bolt11")) | ||
.expect("invalid bolt11") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should make these optional
pub fn payment_hash(&self) -> [u8; 32] { | ||
FromHex::from_hex(&self.payment_hash).expect("invalid payment hash") | ||
FromHex::from_hex(self.payment_hash.as_ref().expect("missing payment hash")) | ||
.expect("invalid payment hash") | ||
} | ||
|
||
pub fn bolt11(&self) -> Bolt11Invoice { | ||
Bolt11Invoice::from_str(&self.bolt11).expect("invalid bolt11") | ||
Bolt11Invoice::from_str(self.bolt11.as_ref().expect("missing bolt11")) | ||
.expect("invalid bolt11") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should make these optional
} | ||
|
||
// sort by timestamp so that the most recent items are at the top |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should keep this comment
ReceiveBolt12 { | ||
mint: MintIdentifier, | ||
amount: Option<Amount>, | ||
// NOTE: The following block was accidentally duplicated during merge. Removing to fix mismatched delimiters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
|
||
// Use CDK's BIP-353 melt flow to get a quote | ||
let quote = client | ||
.melt_bip353_quote(&address, cdk::Amount::from(amount_msats)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be a problem, i am guessing this won't be over tor
let bolt12_enabled = harbor | ||
.active_mint | ||
.as_ref() | ||
.is_some_and(|a| a.mint_url().is_some()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not every mint supports this, we need a flag for if they do or not
|
||
let dest_input = h_input(InputArgs { | ||
label: "Destination", | ||
placeholder: "lnbc1...", | ||
placeholder: "lnbc1... or lno... or ₿[email protected] or bc1...", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont really like this, can we keep the old string
@@ -608,6 +612,60 @@ impl HarborWallet { | |||
self.send_from_ui(UICoreMsg::SendLightning { mint, invoice }); | |||
self.current_send_id = Some(id); | |||
task | |||
} else if invoice_str.starts_with("lno") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be parsing this so we can tell if it needs an amount or anything. Otherwise will require us talking to the mint which can be very slow
No description provided.