From b397381c7d8c0e423ea05a70510d8be5679429b5 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Tue, 13 Oct 2020 21:49:22 -0700 Subject: [PATCH] fix(hydrateUtxos): Improving documentation --- src/slp/utils.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/slp/utils.js b/src/slp/utils.js index 6b04e98..6889526 100644 --- a/src/slp/utils.js +++ b/src/slp/utils.js @@ -1259,6 +1259,48 @@ class Utils { * ] * } * + * (async () => { + * try { + * const utxos = [ + * { + * utxos: [ + * { + * txid: "d56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56", + * vout: 3, + * value: "6816", + * height: 606848, + * confirmations: 13, + * satoshis: 6816 + * } + * ] + * } + * ] + * + * const utxoInfo = await bchjs.SLP.Utils.hydrateUtxos(utxos) + * + * console.log(`${JSON.stringify(utxoInfo, null, 2)}`) + * } catch (error) { + * console.error(error) + * } + * })() + * + * // returns + * { + * "slpUtxos": [ + * { + * "utxos": [ + * { + * "txid": "d56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56", + * "vout": 3, + * "value": "6816", + * "height": 606848, + * "confirmations": 13, + * "satoshis": 6816, + * "isValid": false + * } + * ] + * } + * ] */ // Same as tokenUtxoDetails(), but reduces API calls by having bch-api server // do the heavy lifting.