Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/useBCH.js
| Show First 20 Lines • Show All 374 Lines • ▼ Show 20 Lines | const getSlpBalancesAndUtxos = hydratedUtxoDetails => { | ||||
| console.log( | console.log( | ||||
| `${nullUtxos.length} null utxos found, ignoring results`, | `${nullUtxos.length} null utxos found, ignoring results`, | ||||
| ); | ); | ||||
| throw new Error('Null utxos found, ignoring results'); | throw new Error('Null utxos found, ignoring results'); | ||||
| } | } | ||||
| // Prevent app from treating slpUtxos as nonSlpUtxos | // Prevent app from treating slpUtxos as nonSlpUtxos | ||||
| // Must enforce === false as api will occasionally return utxo.isValid === null | // Must enforce === false as api will occasionally return utxo.isValid === null | ||||
| // Do not classify utxos with 546 satoshis as nonSlpUtxos as a precaution | |||||
| // Do not classify any utxos that include token information as nonSlpUtxos | // Do not classify any utxos that include token information as nonSlpUtxos | ||||
| const nonSlpUtxos = hydratedUtxos.filter( | const nonSlpUtxos = hydratedUtxos.filter( | ||||
| utxo => | utxo => utxo.isValid === false && !utxo.tokenName, | ||||
| utxo.isValid === false && utxo.value !== 546 && !utxo.tokenName, | |||||
| ); | ); | ||||
| // To be included in slpUtxos, the utxo must | // To be included in slpUtxos, the utxo must | ||||
| // have utxo.isValid = true | // have utxo.isValid = true | ||||
| // If utxo has a utxo.tokenQty field, i.e. not a minting baton, then utxo.tokenQty !== '0' | // If utxo has a utxo.tokenQty field, i.e. not a minting baton, then utxo.tokenQty !== '0' | ||||
| const slpUtxos = hydratedUtxos.filter( | const slpUtxos = hydratedUtxos.filter( | ||||
| utxo => utxo.isValid && !(utxo.tokenQty === '0'), | utxo => utxo.isValid && !(utxo.tokenQty === '0'), | ||||
| ); | ); | ||||
| ▲ Show 20 Lines • Show All 613 Lines • Show Last 20 Lines | |||||