aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-03 14:34:08 -0700
committerAdam Soltys <[email protected]>2024-09-03 14:34:08 -0700
commit581dc3b5b16e3dd1823bbf95357e5e8c49b0c5e0 (patch)
treea8eb0c0b44800acc8b0898cd254de69750783562 /routes
parent48f9e8b0de151edcf49903277d714d939f0b3d8f (diff)
downloadcoinos-server-581dc3b5b16e3dd1823bbf95357e5e8c49b0c5e0.tar.gz
coinos-server-581dc3b5b16e3dd1823bbf95357e5e8c49b0c5e0.zip
support multiple token versions
Diffstat (limited to 'routes')
-rw-r--r--routes/ecash.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/routes/ecash.ts b/routes/ecash.ts
index 1f9e48ea..af7f842d 100644
--- a/routes/ecash.ts
+++ b/routes/ecash.ts
@@ -1,5 +1,5 @@
import { g, s, db } from "$lib/db";
-import { claim, mint, check } from "$lib/ecash";
+import { get, claim, mint, check } from "$lib/ecash";
import { bail, fail } from "$lib/utils";
import { debit, credit, types } from "$lib/payments";
import { v4 } from "uuid";
@@ -25,10 +25,10 @@ export default {
async get(req, res) {
let {
- params: { id },
+ params: { id, version },
} = req;
try {
- let token = await g(`cash:${id}`);
+ let token = await get(id, version);
let status = await check(token);
res.send({ token, status });
} catch (e) {
@@ -76,7 +76,8 @@ export default {
let id = v4();
let hash = v4();
- let p = await debit({ hash, amount, user, type });
+ let memo, rate;
+ let p = await debit({ hash, amount, user, type, memo, rate });
let token = await mint(amount);
p.memo = token;
await s(`payment:${p.id}`, p);