feat: Add decodeLightningInvoice to Keymaster#146
Merged
Conversation
Add BOLT11 invoice decoding so users can inspect Lightning invoices before paying. Includes Keymaster method, API endpoint, CLI command, and full test coverage using BOLT11 spec test vectors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 26 methods to bring the Python SDK in sync with the JS client: - Lightning: add, remove, balance, invoice, pay, check, decode - Nostr: add, remove, export_nsec, sign_event - Assets: create, list, clone, merge_data, transfer - Polls: send_poll, send_ballot, view_ballot, add/remove/list voters - Wallet: change_passphrase, export_encrypted_wallet - DID: update_did Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
packages/gatekeeper/src/drawbridge-client.ts:20
throwErrornow throws a genericErrorfor 404s (and a raw string for non-HTTP errors). This changes the error shape compared to the previous{ type, error }object and to the rest of the codebase where callers often rely on structured Archon errors with a.type(e.g.LightningUnavailableError.type). Consider throwingnew LightningUnavailableError('Server does not support Lightning')(from@didcid/common/errors) for the 404 case, and throwingerror(ornew Error(...)) instead oferror.messagefor the non-response case to keep errors consistently Error-like/typed.
function throwError(error: any): never {
if (error.response) {
if (error.response.status === 404) {
throw new Error('Lightning service unavailable: Server does not support Lightning');
}
throw error.response.data;
}
throw error.message;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Make decodeLightningInvoice consistently async (Promise<T> interface) - Fix Swagger path annotation: /api/v1/lightning/decode -> /lightning/decode - Regenerate OpenAPI spec with corrected path - Update lightning decode unit tests to await async method Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
decodeLightningInvoice()method to Keymaster class usinglight-bolt11-decoderfor local BOLT11 decodingPOST /api/v1/lightning/decodeAPI endpoint; KeymasterClient calls the API like all other methodslightning-decodeCLI commandno-throw-literallint issue in drawbridge-client.tsCloses #145
Python SDK methods added
add_lightning,remove_lightning,get_lightning_balance,create_lightning_invoice,pay_lightning_invoice,check_lightning_payment,decode_lightning_invoiceadd_nostr,remove_nostr,export_nsec,sign_nostr_eventcreate_asset,list_assets,clone_asset,merge_data,transfer_assetsend_poll,send_ballot,view_ballot,add_poll_voter,remove_poll_voter,list_poll_voterschange_passphrase,export_encrypted_walletupdate_didTest plan
tests/keymaster/lightning.test.ts)tests/keymaster/client.test.ts)keymaster lightning-decode <bolt11>decodes invoices correctly (verified on live invoice)🤖 Generated with Claude Code