Skip to content

Conversation

@davidkaplanbitgo
Copy link
Contributor

@davidkaplanbitgo davidkaplanbitgo commented Jan 15, 2026

Allow BOLT11 lightning invoice addresses to be used as recipients in OFC token transactions.
The implementation adds validation for invoice addresses with either an 'invoice' amount
or a non-zero bigint amount. Also adds comprehensive test coverage for the new functionality.

TICKET: BTC-2775

@davidkaplanbitgo davidkaplanbitgo marked this pull request as ready for review January 15, 2026 18:31
@davidkaplanbitgo davidkaplanbitgo requested review from a team as code owners January 15, 2026 18:31
girish131
girish131 previously approved these changes Jan 15, 2026
kaustubhbitgo
kaustubhbitgo previously approved these changes Jan 16, 2026
@kaustubhbitgo kaustubhbitgo requested review from KaustubhPatange and removed request for KaustubhPatange January 16, 2026 13:07
louib
louib previously approved these changes Jan 16, 2026
checkRecipient(recipient: ITransactionRecipient): void {
if (isBolt11Invoice(recipient.address)) {
// amount for bolt11 invoices is either 'invoice' or a non-zero bigint
if (recipient.amount === 'invoice') {
Copy link
Contributor

Choose a reason for hiding this comment

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

@davidkaplanbitgo this could be made into a constant, which would also provide a natural location to document the different amount values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Implement support for Bolt11 Lightning Network invoices in the OfcToken class,
allowing users to send to Lightning addresses. Added validation for Lightning
invoice addresses and proper amount handling.

- Created new lightning.ts module with isBolt11Invoice validation function
- Extended checkRecipient method in OfcToken class to handle Lightning invoices
- Added validation for Lightning invoice amounts and backing coins
- Added unit tests for the Lightning invoice validation

BTC-2775

TICKET: BTC-2775
@davidkaplanbitgo
Copy link
Contributor Author

Instead of adding the dependency for fully decoding the invoice on the SDK, we are just going to check that it "looks" like an invoice and we will verify the invoice on WP where bolt11 is already a dependency

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.

6 participants