Skip to content

Conversation

@npslaney
Copy link
Contributor

@npslaney npslaney commented Jan 8, 2026

Introduce a new PAYOUT_ADDRESS env var that simplifies payout configuration
by accepting multiple formats: LNURL, Lightning Address, Bolt12 Offer, and
BIP-353. The address type is automatically detected based on format.

Add a new unified payout handler that mdk.com can call without needing
to specify the payment type. The handler reads PAYOUT_ADDRESS, detects
the address type, and routes to the appropriate payment method.

Legacy WITHDRAWAL_BOLT_11, WITHDRAWAL_BOLT_12, and WITHDRAWAL_LNURL env
vars are maintained for backwards compatibility but now emit deprecation
warnings encouraging migration to PAYOUT_ADDRESS.

Changes:

  • Add payout-address.ts module with address type detection
  • Add unified payout handler (handlers/payout.ts)
  • Register payout route in route.ts
  • Update pay_bolt_11, pay_bolt_12, and pay_ln_url handlers
  • Export payout-address utilities from @moneydevkit/core
  • Update .env.example with new variable and deprecation notes
  • Add comprehensive tests for address detection and payout handler

Linear Issue: MDK-405

Open in Cursor Open in Web

Introduces PAYOUT_ADDRESS for simplified payout configuration, supporting
multiple formats (LNURL, Lightning Address, Bolt12, BIP-353). Legacy
withdrawal variables are deprecated.

Co-authored-by: nick <[email protected]>
@cursor
Copy link

cursor bot commented Jan 8, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@npslaney
Copy link
Contributor Author

npslaney commented Jan 8, 2026

@martinsaposnic does it make sense to simplify the send action on lightning-js to just handle any sort of address?

@npslaney npslaney marked this pull request as ready for review January 8, 2026 19:46
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbdc99b046

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbdc99b046

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

case 'lightning_address':
case 'bip353':
// LNURL, Lightning Address, and BIP-353 all use the same payment method
await node.payLNUrl(address, amount)
Copy link
Contributor

@amackillop amackillop Jan 14, 2026

Choose a reason for hiding this comment

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

Don't we need to parse the payment instructions at the bip353 address to figure out what to use? Is it common for people to put an lnurl address behind bip-353? Thought sticking a Bolt12 offer at the bip-353 address would be the most common case (onchain aside)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is leveraging the fact that payLNUrl is actually just doing bitcoin-payment-instructions and handles it for you

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Confusing method name

break

case 'lnurl':
case 'lightning_address':
Copy link
Contributor

Choose a reason for hiding this comment

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

For lightning_address as it is implemented now I think the payment type is still ambiguous. I think we have to try fetching an invoice first from an LNURL server then fallback to fetching payment instructions from a DNS server. could also it it the other way around but LNUrl is more common right now.

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.

4 participants