javascript-solid-server 0.0.131 → 0.0.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-solid-server",
3
- "version": "0.0.131",
3
+ "version": "0.0.132",
4
4
  "description": "A minimal, fast Solid server",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -507,7 +507,11 @@ export function createPayHandler(options = {}) {
507
507
 
508
508
  const didUri = pubkeyToDidNostr(pubkey);
509
509
  const ledger = await readLedger();
510
- const balance = getBalance(ledger, didUri);
510
+ if (body?.currency && (!payChains || !payChains.includes(body.currency))) {
511
+ return reply.code(400).send({ error: `Unsupported currency: ${body.currency}`, enabledChains: payChains || [] });
512
+ }
513
+ const currency = body?.currency || null;
514
+ const balance = getBalance(ledger, didUri, currency);
511
515
 
512
516
  // Calculate withdrawal amount
513
517
  let satCost, tokenAmount;
@@ -562,7 +566,7 @@ export function createPayHandler(options = {}) {
562
566
  }
563
567
 
564
568
  // Debit balance
565
- debit(ledger, didUri, satCost);
569
+ debit(ledger, didUri, satCost, currency);
566
570
  await writeLedger(ledger);
567
571
 
568
572
  return reply.send({
@@ -570,8 +574,8 @@ export function createPayHandler(options = {}) {
570
574
  ticker: payToken,
571
575
  cost: satCost,
572
576
  rate: payRate,
573
- balance: getBalance(ledger, didUri),
574
- unit: 'sat',
577
+ balance: getBalance(ledger, didUri, currency),
578
+ unit: currency || 'sat',
575
579
  txid: result.txid,
576
580
  proof: {
577
581
  state: result.state,