@psf/bch-js 6.2.6 → 6.2.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@psf/bch-js",
3
- "version": "6.2.6",
3
+ "version": "6.2.9",
4
4
  "description": "A JavaScript library for working with Bitcoin Cash, eCash, and SLP Tokens",
5
5
  "author": "Chris Troutner <chris.troutner@gmail.com>",
6
6
  "contributors": [
@@ -379,7 +379,7 @@ class TokenType1 {
379
379
  // Loop through the tokenUtxos array and find the minting baton.
380
380
  let mintBatonUtxo
381
381
  for (let i = 0; i < tokenUtxos.length; i++) {
382
- if (tokenUtxos[i].utxoType === 'minting-baton') {
382
+ if (tokenUtxos[i].utxoType === 'minting-baton' || tokenUtxos[i].type === 'baton') {
383
383
  mintBatonUtxo = tokenUtxos[i]
384
384
  }
385
385
  }
@@ -395,7 +395,7 @@ class TokenType1 {
395
395
  if (!tokenId) {
396
396
  throw new Error('tokenId property not found in mint-baton UTXO.')
397
397
  }
398
- if (!decimals) {
398
+ if (!decimals && decimals !== 0) {
399
399
  throw new Error('decimals property not found in mint-baton UTXO.')
400
400
  }
401
401
 
package/src/utxo.js CHANGED
@@ -157,10 +157,14 @@ class UTXO {
157
157
  // Hydrate the UTXOs with additional token data.
158
158
  type1TokenUtxos = await this.hydrateTokenData(type1TokenUtxos)
159
159
 
160
+ // Collect and hydrate any baton UTXOs
160
161
  const bchUtxos = utxos.filter(x => x.isSlp === false)
161
- const type1BatonUtxos = utxos.filter(
162
+ let type1BatonUtxos = utxos.filter(
162
163
  x => x.isSlp === true && x.type === 'baton'
163
164
  )
165
+ type1BatonUtxos = await this.hydrateTokenData(type1BatonUtxos)
166
+
167
+ // Isolate any UTXOs that are marked null by the SLP indexer.
164
168
  const nullUtxos = utxos.filter(x => x.isSlp === null)
165
169
 
166
170
  const outObj = {