commit 4021be1c119c4aa28ce792effd0ba8b1579bf1ed parent 1d8dd226e87bbe3fa0ad76580c1015355f854c5a Author: William Casarin <jb55@jb55.com> Date: Sun, 6 Mar 2022 12:01:25 -0800 support bolt12 invoices directly Signed-off-by: William Casarin <jb55@jb55.com> Diffstat:
M | lightninglink/Invoice.swift | | | 6 | ++++-- |
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lightninglink/Invoice.swift b/lightninglink/Invoice.swift @@ -28,11 +28,13 @@ public func parseInvoiceString(_ invoice: String) -> DecodeType? return .offer } - if !inv.starts(with: "lnbc") { + let is_bolt11 = inv.starts(with: "lnbc") + let is_bolt12 = inv.starts(with: "lni") + if !(is_bolt11 || is_bolt12) { return nil } - var ind = 4 + var ind = is_bolt11 ? 4 : 3 var num: String = "" var scale: Character = Character("p") var sep: Character