aboutsummaryrefslogtreecommitdiffstats
path: root/estimateLiquidFee.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-03-11 15:10:40 -0700
committerAdam Soltys <[email protected]>2020-03-11 15:10:40 -0700
commitc0888fab024cc9f7c99812bfabf9d7774312dbf7 (patch)
treecad95683af97432f6092a2c2bae10fbb7a588db5 /estimateLiquidFee.js
parentbf2b51f0c2ae9b8f0f330dde6411e45fc0da8a25 (diff)
downloadcoinos-server-c0888fab024cc9f7c99812bfabf9d7774312dbf7.tar.gz
coinos-server-c0888fab024cc9f7c99812bfabf9d7774312dbf7.zip
refactor
Diffstat (limited to 'estimateLiquidFee.js')
-rw-r--r--estimateLiquidFee.js33
1 files changed, 0 insertions, 33 deletions
diff --git a/estimateLiquidFee.js b/estimateLiquidFee.js
deleted file mode 100644
index fb9e54f0..00000000
--- a/estimateLiquidFee.js
+++ /dev/null
@@ -1,33 +0,0 @@
-const config = require("./config");
-const BitcoinCore = require("bitcoin-core");
-
-const l = require("pino")();
-const SATS = 100000000;
-
-const bc = new BitcoinCore(config.liquid);
-
-module.exports = (app, db, emit) => async (req, res) => {
- let { user } = req;
- let { address, amount, feeRate } = req.body;
- let tx, fee;
-
- try {
- amount = parseInt(amount);
-
- tx = await bc.createRawTransaction([], {
- [address]: (amount / SATS).toFixed(8)
- });
-
- let params = {
- subtractFeeFromOutputs: amount === user.balance ? [0] : []
- }
-
- if (feeRate) params["feeRate"] = (parseInt(feeRate) / SATS * 1000).toFixed(8);
-
- tx = await bc.fundRawTransaction(tx, params);
- res.send({ tx });
- } catch (e) {
- l.error(e);
- return res.status(500).send(e.message);
- }
-};