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

Allow buy endpoint to accept chain-specific balances by melvincarvalho · Pull Request #202 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub

Repository navigation

Allow buy endpoint to accept chain-specific balances - #202

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

melvincarvalho merged 1 commit into
gh-pagesfrom
issue-201-buy-chain-balance

Conversation

Copy link
Copy Markdown
Contributor

Summary

  • POST /pay/.buy now accepts an optional currency field to pay from chain-specific balances
  • Without this fix, users with only chain deposits (e.g. tbtc4) cannot buy tokens since .buy only checked generic sat balance

Example

POST /pay/.buy
{ "amount": 100, "currency": "tbtc4" }

Changes

  • Parse body.currency and validate it's an enabled chain
  • Pass currency to getBalance() and debit() (both already support it)
  • Response includes the actual unit used

Fixes #201

POST /pay/.buy now accepts an optional `currency` field (e.g. "tbtc4")
to pay from a chain-specific balance instead of generic sat balance.
Without this, users with only chain deposits cannot buy tokens.

Fixes #201
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.

Buy endpoint should accept chain-specific balances

1 participant


Back | FazBrowse Home | New Git URL