FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

402 middleware: fall back to chain-specific balances by melvincarvalho · Pull Request #204 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub

Repository navigation

402 middleware: fall back to chain-specific balances - #204

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-203-402-chain-balance
Mar 12, 2026
Merged

melvincarvalho merged 1 commit into
gh-pagesfrom
issue-203-402-chain-balance

Conversation

Copy link
Copy Markdown
Contributor

Summary

  • 402 paywall now tries chain-specific balances when generic sat is insufficient
  • Clients can specify X-Pay-Currency: tbtc4 header for explicit chain preference
  • Without the header, auto-tries each enabled chain balance
  • 402 response now includes available chain balances so clients know what they have

Behavior

Scenario Before After
sat balance sufficient 200 200 (unchanged)
sat=0, tbtc4=1000 402 200 (debits tbtc4)
sat=0, tbtc4=0 402 402 (with chain balances in response)
X-Pay-Currency: tbtc4 header ignored uses tbtc4 explicitly

Fixes #203

When generic sat balance is insufficient, the 402 handler now:
1. Checks X-Pay-Currency header for explicit chain preference
2. Falls back to trying each enabled chain balance
3. Returns available chain balances in 402 response

Fixes #203
melvincarvalho merged commit 23d6d82 into gh-pages Mar 12, 2026
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

402 middleware should accept chain-specific balances

1 participant


Back | FazBrowse Home | New Git URL