@psf/bch-js 6.6.1 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utxo.js +9 -1
- package/test/integration/electrumx.js +3 -0
- package/test/unit/utxo-unit.js +2 -1
package/package.json
CHANGED
package/src/utxo.js
CHANGED
|
@@ -177,8 +177,15 @@ class UTXO {
|
|
|
177
177
|
// Hydrate the UTXOs with additional token data.
|
|
178
178
|
type1TokenUtxos = await this.hydrateTokenData(type1TokenUtxos)
|
|
179
179
|
|
|
180
|
+
// Collect BCH UTXOs above 1000 sats
|
|
181
|
+
const bchUtxos = utxos.filter(x => x.isSlp === false && x.value > 1000)
|
|
182
|
+
|
|
183
|
+
// Collect all BCH UTXOs at 1000 sats or smaller
|
|
184
|
+
// The prevents SLP tokens, BCMR, and other 'colored' UTXOs from being
|
|
185
|
+
// accidentally included into normal BCH transactions.
|
|
186
|
+
const infoUtxos = utxos.filter(x => x.isSlp === false && x.value <= 1000)
|
|
187
|
+
|
|
180
188
|
// Collect and hydrate any type1 baton UTXOs
|
|
181
|
-
const bchUtxos = utxos.filter(x => x.isSlp === false)
|
|
182
189
|
let type1BatonUtxos = utxos.filter(
|
|
183
190
|
x => x.isSlp === true && x.type === 'baton' && x.tokenType === 1
|
|
184
191
|
)
|
|
@@ -208,6 +215,7 @@ class UTXO {
|
|
|
208
215
|
const outObj = {
|
|
209
216
|
address: addr,
|
|
210
217
|
bchUtxos,
|
|
218
|
+
infoUtxos,
|
|
211
219
|
slpUtxos: {
|
|
212
220
|
type1: {
|
|
213
221
|
tokens: type1TokenUtxos,
|
|
@@ -371,6 +371,8 @@ describe('#ElectrumX', () => {
|
|
|
371
371
|
})
|
|
372
372
|
})
|
|
373
373
|
|
|
374
|
+
/*
|
|
375
|
+
CT 3/14/23 - This test is frequently failing in BVT due to 429 errors.
|
|
374
376
|
describe('#sortAllTxs', () => {
|
|
375
377
|
it('should GET transaction history for a single address', async () => {
|
|
376
378
|
// Add delay for this endpoint.
|
|
@@ -389,6 +391,7 @@ describe('#ElectrumX', () => {
|
|
|
389
391
|
assert.isAbove(sortedTransactions[0].height, sortedTransactions[1].height)
|
|
390
392
|
})
|
|
391
393
|
})
|
|
394
|
+
*/
|
|
392
395
|
})
|
|
393
396
|
|
|
394
397
|
function sleep (ms) {
|
package/test/unit/utxo-unit.js
CHANGED
|
@@ -142,7 +142,8 @@ describe('#utxo', () => {
|
|
|
142
142
|
assert.property(result.slpUtxos, 'nft')
|
|
143
143
|
assert.property(result, 'nullUtxos')
|
|
144
144
|
|
|
145
|
-
assert.equal(result.bchUtxos.length,
|
|
145
|
+
assert.equal(result.bchUtxos.length, 1)
|
|
146
|
+
assert.equal(result.infoUtxos.length, 3)
|
|
146
147
|
assert.equal(result.slpUtxos.type1.tokens.length, 1)
|
|
147
148
|
assert.equal(result.slpUtxos.type1.mintBatons.length, 1)
|
|
148
149
|
assert.equal(result.nullUtxos.length, 0)
|