#lightning #bitcoin #lnurl

lnurl-rs

A basic LNURL implementation in Rust

19 releases

0.4.1 Jan 27, 2024
0.4.0 Dec 16, 2023
0.3.2 Jan 25, 2024
0.3.1 Nov 22, 2023
0.2.0 Mar 14, 2023

#2188 in Magic Beans

Download history 167/week @ 2023-10-29 382/week @ 2023-11-05 193/week @ 2023-11-12 278/week @ 2023-11-19 335/week @ 2023-11-26 296/week @ 2023-12-03 288/week @ 2023-12-10 286/week @ 2023-12-17 202/week @ 2023-12-24 348/week @ 2023-12-31 291/week @ 2024-01-07 284/week @ 2024-01-14 480/week @ 2024-01-21 440/week @ 2024-01-28 631/week @ 2024-02-04 551/week @ 2024-02-11

2,109 downloads per month
Used in 8 crates

MIT license

53KB
1K SLoC

lnurl-rs

MIT licensed lnurl-rs on crates.io lnurl-s on docs.rs

A rust implementation of LNURL. Supports plaintext, TLS and Onion servers. Blocking or async. WASM enabled.

Supported

  • lnurl-auth
  • lnurl-pay
  • lightning-address
  • lnurl-withdraw
  • lnurl-channel

Examples

Lnurl Pay

let ln_addr = LightningAddress::from_str("ben@zaps.benthecarman.com").unwrap();
let async_client = Builder::default().build_async().unwrap();

let res = async_client.make_request(url).await.unwrap();

if let LnUrlPayResponse(pay) = res {
    let msats = 1_000_000;
    let pay_result = async_client.get_invoice(&pay, msats, None).await.unwrap();

    let invoice = Bolt11Invoice::from_str(&pay_result.invoice()).unwrap();

    assert_eq!(invoice.amount_milli_satoshis(), Some(msats));
} else {
    panic!("Wrong response type");
}

Dependencies

~10–26MB
~370K SLoC