aboutsummaryrefslogtreecommitdiffstats
path: root/routes/ecash.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-04 23:13:33 -0800
committerAdam Soltys <[email protected]>2026-02-06 09:00:09 -0800
commit1ebc40afc14a75d7fe157b2c6c20ffea9dedb5eb (patch)
tree960318969072afa63536e9429c27fa40ca2919d3 /routes/ecash.ts
parentc0481268da25eed1f25281508b5c4777d26c2b03 (diff)
downloadcoinos-server-1ebc40afc14a75d7fe157b2c6c20ffea9dedb5eb.tar.gz
coinos-server-1ebc40afc14a75d7fe157b2c6c20ffea9dedb5eb.zip
tigerbeetle
Diffstat (limited to 'routes/ecash.ts')
-rw-r--r--routes/ecash.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/routes/ecash.ts b/routes/ecash.ts
index b7ce050e..57cc49c1 100644
--- a/routes/ecash.ts
+++ b/routes/ecash.ts
@@ -3,6 +3,7 @@ import { check, claim, get, mint } from "$lib/ecash";
import { err, l } from "$lib/logging";
import { credit, debit } from "$lib/payments";
import { emit } from "$lib/sockets";
+import { tbDebit } from "$lib/tb";
import { bail, fail, getInvoice } from "$lib/utils";
import { getEncodedToken } from "@cashu/cashu-ts";
import { v4 } from "uuid";
@@ -103,15 +104,16 @@ export default {
const { lightning: type } = PaymentType;
if (user.username !== "mint") fail("unauthorized");
const { id: uid, currency } = user;
- const ourfee = await db.debit(
- `balance:${uid}`,
- `credit:${type}:${uid}`,
- "Insufficient funds",
+ const ourfee = await tbDebit(
+ uid,
+ uid,
+ type,
amount || 0,
0,
0,
0,
- 0
+ 0,
+ "Insufficient funds",
);
const rates = await g("rates");