Skip to content

add invoice decode api#8

Merged
elsirion merged 1 commit intoelsirion:masterfrom
witsand:2026-01-21-invoice-decoding-api
Jan 23, 2026
Merged

add invoice decode api#8
elsirion merged 1 commit intoelsirion:masterfrom
witsand:2026-01-21-invoice-decoding-api

Conversation

@witsand
Copy link
Contributor

@witsand witsand commented Jan 21, 2026

Add a api call to decode lighting invoices.

Example test:
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"invoice": "lnbc100n1p5hps3vdq823jhxaqpp5lk5rnj5xhkddx5m78zmertl6rvynrnlr360mxww7yqw0m82njcqssp5nvqmdewu7vp5rjrj6wvg24evr5cnuhgph7etal6szhsqayem0g2q9qrsgqcqpjnp4qtkcq6yu43wqkpus8pnr2l4p3zzuyj24xgt0567e40v477fkds8rkxqyz5vqrzjqffujl0u5peq0z0k3nn2m0kp7zlp3v4ecyra8s9q80lh30uqyam7yqqqqqqqqqqqqsqqqqqqqqqqqqqqrcrt5ylj4cy94yey6007hmstu2tg7n502kchkrrdypu8rmfmm2zaznt8ypq2p75gpchklf4u7wr7gusuza90kwjxhgn2x7uang5we7r2gqz32pae"}' http://localhost:3000/invoice/decode

Output:
{"amount_msats":10000,"description":"Test","payee_pubkey":"02ed80689cac5c0b07903866357ea18885c249553216fa6bd9abd95f79366c0e3b","payment_hash":"fda839ca86bd9ad3537e38b791affa1b0931cfe38e9fb339de201cfd9d539601","expiry_seconds":86400,"timestamp":1768997420,"currency":"bc"}

Copy link
Owner

@elsirion elsirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to merge and I fix it up later, but if you want we can do the usual workflow of amending the commit with the requested changes, force pushing and another round of review :)

@witsand witsand force-pushed the 2026-01-21-invoice-decoding-api branch 2 times, most recently from 0b883b4 to 8ba2509 Compare January 22, 2026 13:45
Copy link
Owner

@elsirion elsirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit, otherwise ready to merge.

.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_secs(),
currency: invoice.currency().to_string(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: looking at the code I see that this is about the network (mainnet, testnet, signet, …), I think network would be the less confusing name without any fiat shitcoin association 😆

@witsand witsand force-pushed the 2026-01-21-invoice-decoding-api branch from 8ba2509 to 12c4d85 Compare January 23, 2026 10:13
@elsirion elsirion merged commit d8d7b8b into elsirion:master Jan 23, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants