diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/feeliquidtx.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/feeliquidtx.js b/lib/feeliquidtx.js new file mode 100644 index 00000000..d32623ab --- /dev/null +++ b/lib/feeliquidtx.js @@ -0,0 +1,13 @@ +module.exports = async (txid) => { + const tx = await lq.getRawTransaction(txid); + const transaction = await lq.decodeRawTransaction(tx); + let valueOut = 0; + + transaction.vout.forEach(o => { + if (o.scriptPubKey.type === 'fee') { + valueOut = o.value; + } + }); + + return toSats(valueOut); +} |
