feat: fetch --dry-run previews the price without paying#56
Draft
reneaaron wants to merge 1 commit into
Draft
Conversation
Per payments-skill#28 review: prices listed by 402index.io can be missing, stale, or dynamic - the 402 challenge is the authoritative price at request time, but checking it previously meant hand-crafting a curl. --dry-run sends the request unpaid (no wallet needed) and reports the challenge: price in sats when a lightning invoice is offered (L402/MPP WWW-Authenticate, or a lightning-native x402 Payment-Required header), the raw challenge otherwise. Payment flags are rejected alongside it since a dry run never pays. Use case: comparing prices between providers before paying. Verified live against all three challenge shapes: native L402 (10 sats), bridged x402 via l402.space (19 sats), lightning-native x402 (15 sats).
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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.
What
Adds
fetch --dry-run: sends the request unpaid and reports the 402 challenge instead of settling it. Needs no wallet.WWW-Authenticate(L402 ... invoice=/ MPPPayment ... invoice=) or a lightning-native x402's base64Payment-Requiredheader.payment_required: false.--max-amount/--currency/--unit/--network/--credentials) are rejected alongside--dry-runsince a dry run never pays.Why
From the review discussion on getAlby/payments-skill#28: prices listed on 402index.io can be missing, stale, or dynamic — the 402 challenge is the authoritative price at request time, but checking it previously meant hand-crafting a curl. Use case: comparing prices between two providers before paying.
Per that discussion this is deliberately not documented in the skill for now — the
--max-amountdefault already guards automated flows.Test
yarn testgreen (111 pass, 2 skipped); 5 new unit tests cover L402, MPP, base64-x402 extraction, no-lightning-challenge fallback, and free endpoints (using a real BOLT-11 so decoding is exercised).