aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.js1
-rw-r--r--routes/ecash.js11
2 files changed, 12 insertions, 0 deletions
diff --git a/index.js b/index.js
index 7b1517fe..6b47fce8 100644
--- a/index.js
+++ b/index.js
@@ -119,6 +119,7 @@ app.post("/hidepay", admin, users.hidepay);
app.post("/unlimit", admin, users.unlimit);
app.get("/cash/:id", ecash.get);
+app.post("/cash", ecash.save);
app.post("/claim", auth, ecash.claim);
app.post("/mint", auth, ecash.mint);
app.post("/melt", auth, ecash.melt);
diff --git a/routes/ecash.js b/routes/ecash.js
index 8ce841dd..d7a9fe7b 100644
--- a/routes/ecash.js
+++ b/routes/ecash.js
@@ -10,6 +10,17 @@ import store from "$lib/store";
let { ecash: type } = types;
export default {
+ async save({ body: { token } }, res) {
+ try {
+ let id = v4();
+ await s(`cash:${id}`, token);
+ res.send({ id });
+ } catch (e) {
+ console.log(e)
+ bail(res, e.message);
+ }
+ },
+
async get({ params: { id } }, res) {
try {
let token = await g(`cash:${id}`);