@psf/bch-js 6.5.6 → 6.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@psf/bch-js",
3
- "version": "6.5.6",
3
+ "version": "6.6.0",
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": [
package/src/electrumx.js CHANGED
@@ -289,12 +289,12 @@ class ElectrumX {
289
289
  * }
290
290
  *
291
291
  */
292
- async transactions (address, usrObj = null) {
292
+ async transactions (address, usrObj = null, allTxs = false) {
293
293
  try {
294
294
  // Handle single address.
295
295
  if (typeof address === 'string') {
296
296
  const response = await axios.get(
297
- `${this.restURL}electrumx/transactions/${address}`,
297
+ `${this.restURL}electrumx/transactions/${address}/${allTxs}`,
298
298
  this.axiosOptions
299
299
  )
300
300
  return response.data
@@ -305,7 +305,8 @@ class ElectrumX {
305
305
  `${this.restURL}electrumx/transactions`,
306
306
  {
307
307
  addresses: address,
308
- usrObj // pass user data when making an internal call.
308
+ usrObj, // pass user data when making an internal call.
309
+ allTxs
309
310
  },
310
311
  this.axiosOptions
311
312
  )
@@ -315,6 +316,7 @@ class ElectrumX {
315
316
 
316
317
  throw new Error('Input address must be a string or array of strings.')
317
318
  } catch (error) {
319
+ // console.log('Error in transactions(): ', error)
318
320
  if (error.response && error.response.data) throw error.response.data
319
321
  else throw error
320
322
  }
@@ -514,7 +514,7 @@ class PsfSlpIndexer {
514
514
  * }
515
515
  *
516
516
  */
517
- async getTokenData2 (tokenId) {
517
+ async getTokenData2 (tokenId, updateCache = false) {
518
518
  try {
519
519
  const url = `${this.restURL}psf/slp/token/data2`
520
520
  // console.log(`url: ${url}`)
@@ -524,7 +524,7 @@ class PsfSlpIndexer {
524
524
  const response = await axios.post(
525
525
  // 'https://bchn.fullstack.cash/v5/psf/slp/token/data/',
526
526
  url,
527
- { tokenId },
527
+ { tokenId, updateCache },
528
528
  this.axiosOptions
529
529
  )
530
530
  return response.data
@@ -318,7 +318,9 @@ describe('#blockchain', () => {
318
318
  it('should get info about the blockchain', async () => {
319
319
  const result = await bchjs.Blockchain.getBlockchainInfo()
320
320
 
321
- console.log(`blockchain info: ${JSON.stringify(result, null, 2)}`)
321
+ // console.log(`blockchain info: ${JSON.stringify(result, null, 2)}`)
322
+
323
+ assert.property(result, 'blocks')
322
324
  })
323
325
  })
324
326
  })
@@ -15,7 +15,7 @@ describe('#control', () => {
15
15
  describe('#getNetworkInfo', () => {
16
16
  it('should get info on the full node', async () => {
17
17
  const result = await bchjs.Control.getNetworkInfo()
18
- console.log(`result: ${JSON.stringify(result, null, 2)}`)
18
+ // console.log(`result: ${JSON.stringify(result, null, 2)}`)
19
19
 
20
20
  assert.property(result, 'version')
21
21
  })
@@ -204,7 +204,9 @@ describe('#rawtransaction', () => {
204
204
  const result = await bchjs.RawTransactions.decodeScript(hex)
205
205
  // console.log(`result ${JSON.stringify(result, null, 2)}`)
206
206
 
207
- assert.hasAllKeys(result, ['asm', 'type', 'p2sh'])
207
+ assert.property(result, 'asm')
208
+ assert.property(result, 'type')
209
+ assert.property(result, 'p2sh')
208
210
  })
209
211
 
210
212
  // CT 2/20/19 - Waiting for this PR to be merged complete the test: