aboutsummaryrefslogtreecommitdiffstats
path: root/routes/liquid/send.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-05-21 13:54:56 -0700
committerAdam Soltys <[email protected]>2020-05-21 13:54:56 -0700
commit3f4ef5ab89019353f1e989194c73c8a1528f96e2 (patch)
tree9dda50d55069527d5d1692209dfeb0f5c5217625 /routes/liquid/send.js
parent388c1b518f0f237d777ec010f294ee580024c22d (diff)
downloadcoinos-server-3f4ef5ab89019353f1e989194c73c8a1528f96e2.tar.gz
coinos-server-3f4ef5ab89019353f1e989194c73c8a1528f96e2.zip
fix liquid send
Diffstat (limited to 'routes/liquid/send.js')
-rw-r--r--routes/liquid/send.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/routes/liquid/send.js b/routes/liquid/send.js
index aa2763d1..89e9d8b7 100644
--- a/routes/liquid/send.js
+++ b/routes/liquid/send.js
@@ -11,18 +11,20 @@ module.exports = async (req, res) => {
(await lq.getAddressInfo(address)).ismine &&
(!Object.keys(addresses).includes(address) || address === user.liquid);
- tx = await lq.decodePsbt(psbt);
+ let decoded = await lq.decodePsbt(psbt);
let totals = {};
let change = {};
let fee = 0;
+
+ let { tx: { vout } } = decoded;
- for (let i = 0; i < tx.vout.length; i++) {
+ for (let i = 0; i < vout.length; i++) {
let {
asset,
value,
scriptPubKey: { type, addresses }
- } = tx.vout[i];
+ } = vout[i];
if (type === "fee") fee = toSats(value);
else {
@@ -97,9 +99,10 @@ module.exports = async (req, res) => {
if (config.liquid.walletpass)
await lq.walletPassphrase(config.liquid.walletpass, 300);
- hex = await lq.blindRawTransaction(hex);
- rawtx = (await lq.signRawTransactionWithWallet(hex)).hex;
- let txid = await lq.sendRawTransaction(rawtx);
+ let blinded = await lq.blindPsbt(psbt);
+ let signed = await lq.walletSignPsbt(blinded);
+ let finalized = await lq.finalizePsbt(signed.psbt);
+ let txid = await lq.sendRawTransaction(finalized.hex);
let main;
for (let i = 0; i < assets.length; i++) {