@psf/bch-js 6.2.5 → 6.2.8

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Version](https://img.shields.io/npm/v/@psf/bch-js)](https://www.npmjs.com/package/@psf/bch-js)
4
4
  [![Downloads/week](https://img.shields.io/npm/dw/@psf/bch-js)](https://npmjs.org/package/@psf/bch-js)
5
5
  [![License](https://img.shields.io/npm/l/@psf/bch-js)](https://github.com/Permissionless-Software-Foundation/bch-js/blob/master/LICENSE.md)
6
- [![js-standard-style](https://img.shields.io/badge/javascript-standard%20code%20style-green.svg?style=flat-square)](https://github.com/feross/standard)
6
+ [![js-standard-style](https://img.shields.io/badge/javascript-standard%20code%20style-green.svg?style=flat-square)](https://github.com/feross/standard) [![Join the chat at https://gitter.im/Permissionless-Software-Foundation/bch-js](https://badges.gitter.im/Permissionless-Software-Foundation/bch-js.svg)](https://gitter.im/Permissionless-Software-Foundation/bch-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7
7
 
8
8
  [bch-js](https://www.npmjs.com/package/@psf/bch-js) is a JavaScript npm library for creating web and mobile apps that can interact with the Bitcoin Cash (BCH) blockchains. It can be used for free, but requires an account on [FullStack.cash](https://fullstack.cash) for increased rate limits. Learn more from [this article](https://troutsblog.com/research/bitcoin-cash/how-to-bch-full-stack-developer) about Full Stack Bitcoin Cash development.
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@psf/bch-js",
3
- "version": "6.2.5",
3
+ "version": "6.2.8",
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
  }
package/src/util.js CHANGED
@@ -281,16 +281,17 @@ class Util {
281
281
 
282
282
  // Array of blocks.
283
283
  } else if (Array.isArray(address)) {
284
- const options = {
284
+ const options1 = {
285
285
  method: 'POST',
286
286
  url: `${this.restURL}util/validateAddress`,
287
287
  data: {
288
288
  addresses: address
289
- },
290
- headers: {
291
- authorization: `Token ${this.apiToken}`
292
289
  }
290
+ // headers: {
291
+ // authorization: `Token ${this.apiToken}`
292
+ // }
293
293
  }
294
+ const options = Object.assign({}, options1, this.axiosOptions)
294
295
  const response = await axios(options)
295
296
 
296
297
  return response.data
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 = {