diff options
| author | Adam Soltys <[email protected]> | 2021-05-21 14:05:02 -0400 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-05-21 14:05:02 -0400 |
| commit | 3ce9c73b1d4a281fe1475206d49c4f436e0b992e (patch) | |
| tree | 8e8324d74761f164d9615a068a0f4f840506e642 /routes/liquid/fee.js | |
| parent | 37412d24f5c7b0c6d316ce240ef29cd4ccd2ca6d (diff) | |
| download | coinos-server-3ce9c73b1d4a281fe1475206d49c4f436e0b992e.tar.gz coinos-server-3ce9c73b1d4a281fe1475206d49c4f436e0b992e.zip | |
persist liquid conversion requests
Diffstat (limited to 'routes/liquid/fee.js')
| -rw-r--r-- | routes/liquid/fee.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/routes/liquid/fee.js b/routes/liquid/fee.js index debbdf55..2070873a 100644 --- a/routes/liquid/fee.js +++ b/routes/liquid/fee.js @@ -2,6 +2,12 @@ const buildTx = require("../../lib/buildliquidtx"); liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { let tx, fee; + let node = lq; + /* + if (asset === config.liquid.btcasset) { + node = rare; + } + */ if (user.account.pubkey) { let psbt = await buildTx({ @@ -25,7 +31,7 @@ liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { }); if (invoice) { - let { ismine } = await lq.getAddressInfo(address); + let { ismine } = await node.getAddressInfo(address); if (ismine) { emit(user.username, "to", invoice.user); return; @@ -33,7 +39,7 @@ liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { } if (config.liquid.walletpass) - await lq.walletPassphrase(config.liquid.walletpass, 300); + await node.walletPassphrase(config.liquid.walletpass, 300); amount = parseInt(amount); @@ -44,9 +50,9 @@ liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { let value = (amount / SATS).toFixed(8); if (feeRate) params.feeRate = (feeRate / SATS).toFixed(8); - let info = await lq.getAddressInfo(address); + let info = await node.getAddressInfo(address); - tx = await lq.createRawTransaction( + tx = await node.createRawTransaction( [], { [address]: (amount / SATS).toFixed(8) @@ -58,12 +64,12 @@ liquidTx = async ({ address, asset, amount, feeRate, replaceable, user }) => { } ); - tx = await lq.fundRawTransaction(tx, params); + tx = await node.fundRawTransaction(tx, params); - let blinded = await lq.blindRawTransaction(tx.hex); - let signed = await lq.signRawTransactionWithWallet(blinded); + let blinded = await node.blindRawTransaction(tx.hex); + let signed = await node.signRawTransactionWithWallet(blinded); - decoded = await lq.decodeRawTransaction(signed.hex); + decoded = await node.decodeRawTransaction(signed.hex); feeRate = Math.round((tx.fee * SATS * 1000) / decoded.vsize); l.info("estimated", asset, feeRate); |
