aboutsummaryrefslogtreecommitdiffstats
path: root/routes/bitcoin/fee.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-08 16:29:14 -0700
committerAdam Soltys <[email protected]>2022-09-08 16:29:14 -0700
commitbe27adba90c2c52ccbfac5885d70e5b37753fc58 (patch)
tree3ea8a2e1700112782d3bd16517fff4a875d38756 /routes/bitcoin/fee.js
parentd89458ebef267c7dc2290100ecb05b7d0891c224 (diff)
parentc60ad34877c44760263a9e93e99aa425ad0fdd99 (diff)
downloadcoinos-server-be27adba90c2c52ccbfac5885d70e5b37753fc58.tar.gz
coinos-server-be27adba90c2c52ccbfac5885d70e5b37753fc58.zip
Merge branch 'prod'
Diffstat (limited to 'routes/bitcoin/fee.js')
-rw-r--r--routes/bitcoin/fee.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/routes/bitcoin/fee.js b/routes/bitcoin/fee.js
index af622ca5..fb67c08e 100644
--- a/routes/bitcoin/fee.js
+++ b/routes/bitcoin/fee.js
@@ -1,5 +1,10 @@
+import config from "$config";
+import db from "$db";
+import bc from "$lib/bitcoin";
+import { err } from "$lib/logging";
import { emit } from "$lib/sockets";
import buildTx from "$lib/buildtx";
+import { SATS } from "$lib/utils";
export default async (req, res) => {
let { user } = req;
@@ -57,7 +62,7 @@ export default async (req, res) => {
await bc.walletPassphrase(config.bitcoin.walletpass, 300);
let signed = await bc.signRawTransactionWithWallet(tx.hex);
- decoded = await bc.decodeRawTransaction(signed.hex);
+ let decoded = await bc.decodeRawTransaction(signed.hex);
feeRate = Math.round((tx.fee * SATS * 1000) / decoded.vsize);
res.send({ feeRate, tx });