aboutsummaryrefslogtreecommitdiffstats
path: root/routes/liquid/send.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-08 16:45:32 -0700
committerAdam Soltys <[email protected]>2022-09-08 16:45:36 -0700
commitf877da1a78a744b4082c7e2c4994da37ed4c79d4 (patch)
treeb627342bc043083abb451f2908155983bb164ad7 /routes/liquid/send.js
parentc60ad34877c44760263a9e93e99aa425ad0fdd99 (diff)
downloadcoinos-server-f877da1a78a744b4082c7e2c4994da37ed4c79d4.tar.gz
coinos-server-f877da1a78a744b4082c7e2c4994da37ed4c79d4.zip
missing imports
Diffstat (limited to 'routes/liquid/send.js')
-rw-r--r--routes/liquid/send.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/routes/liquid/send.js b/routes/liquid/send.js
index 8c94d976..2fa7a22a 100644
--- a/routes/liquid/send.js
+++ b/routes/liquid/send.js
@@ -5,8 +5,8 @@ import { emit } from "$lib/sockets";
import store from "$lib/store";
import config from "$config";
import { l, warn, err } from "$lib/logging";
-// import { liquidTx } from "$routes/liquid/fee";
-// import { Transaction } from 'liquidjs-lib';
+import { liquidTx } from "$routes/liquid/fee";
+import { Transaction } from 'liquidjs-lib';
import {
computeConversionFee,
@@ -229,7 +229,7 @@ export const sendLiquid = async ({ asset, amount, user, address, memo, tx, limit
let txid = Transaction.fromHex(signed.hex).getId();
for (let i = 0; i < payments.length; i++) {
- p = payments[i];
+ let p = payments[i];
if (p) {
let { account } = p;
p.hash = txid;
@@ -255,6 +255,7 @@ export const sendLiquid = async ({ asset, amount, user, address, memo, tx, limit
return main;
} catch (e) {
err("problem sending liquid", e.message);
+ return e;
}
};
@@ -262,8 +263,11 @@ export default async (req, res) => {
let { user } = req;
try {
- res.send(await sendLiquid({ ...req.body, user }));
+ let result = await sendLiquid({ ...req.body, user })
+ if (result instanceof Error) throw result;
+ res.send(result);
} catch (e) {
+ console.log(e)
err("problem sending liquid", user.username, e.message);
return res.code(500).send(e);
}