Skip to content

feat(x402): recognize lnbtc lightning network instead of bip122 - #67

Merged
rolznz merged 4 commits into
masterfrom
feat/x402-lnbtc
Nov 2, 2026
Merged

rolznz merged 4 commits into
masterfrom
feat/x402-lnbtc

Conversation

@reneaaron

@reneaaron reneaaron commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Follow-up to getAlby/js-lightning-tools#337, which switches fetch402 to the x402 exact scheme on Bitcoin Lightning (lnbtc) and drops the old Alby x402 format.

  • discover: the CAIP-2 rail alias for lightning is now lnbtc:000000000019d6689c085ae165831e93 instead of bip122:.... Services listed on bip122: are no longer treated as lightning-native, which matches what fetch can pay.
  • fetch --dry-run: only reads extra.invoice from exact/lnbtc entries in the Payment-Required header. It previously matched any bolt11 string, so it could quote a price for an old-format challenge that fetch would refuse to pay.
  • Updated the test fixtures to the new shape and added a test showing old-format challenges are ignored.

Before merging

  • Bumped @getalby/lightning-tools to ^10.0.0 (released with js-lightning-tools#337).

Testing

  • yarn test: 133 passed. 1 unrelated failure: request-invoice-from-lightning-address uses nwc1779952113427@getalby.com, whose lnurlp endpoint now returns 404.

Match the x402 `exact` lightning spec (network lnbtc:...) in discover's
rail aliases and in fetch --dry-run's invoice extraction, which now only
reads extra.invoice from exact/lnbtc entries - the same ones fetch pays.
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@rolznz rolznz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tACK

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rolznz
rolznz marked this pull request as ready for review November 2, 2026 06:51
@rolznz
rolznz merged commit d86a997 into master Nov 2, 2026
2 checks passed
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