From cd3977c1c8fedecbb344f774024c91a66be054de Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 1 Oct 2020 00:17:09 -0700 Subject: add privkey column --- lib/buildtx.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/buildtx.js b/lib/buildtx.js index 0f63f641..876f6fff 100644 --- a/lib/buildtx.js +++ b/lib/buildtx.js @@ -20,10 +20,12 @@ module.exports = async ({ address, amount, feeRate, replaceable, user }) => { } }); + + const addresses = [...new Set(payments.map(p => p.address))]; const utxos = []; - for (let i = 0; i < payments.length; i++) { + for (let i = 0; i < addresses.length; i++) { try { - utxos.push(...(await axios.get(`${api}/address/${payments[i].address}/utxo`)).data); + utxos.push(...(await axios.get(`${api}/address/${addresses[i]}/utxo`)).data); } catch (e) { l.error("problem fetching utxos", e.message); } -- cgit v1.2.3