@psf/bch-js 6.5.0 → 6.5.2

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.0",
3
+ "version": "6.5.2",
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": [
@@ -449,6 +449,18 @@ class PsfSlpIndexer {
449
449
  * @apiGroup PSF SLP
450
450
  * @apiDescription Get token icon and other media associated with a token.
451
451
  *
452
+ * Get the icon for a token, given it's token ID.
453
+ * This function expects a string input of a token ID property.
454
+ * This function returns an object with a tokenIcon property that contains
455
+ * the URL to the icon.
456
+ *
457
+ * The output object always have these properties:
458
+ * - tokenIcon: A url to the token icon, if it exists.
459
+ * - tokenStats: Data about the token from psf-slp-indexer.
460
+ * - optimizedTokenIcon: An alternative, potentially more optimal, url to the token icon, if it exists.
461
+ * - iconRepoCompatible: true if the token icon is available via token.bch.sx
462
+ * - ps002Compatible: true if the token icon is compatible with PS007 specification.
463
+ *
452
464
  * @apiExample Example usage:
453
465
  * (async () => {
454
466
  * try {
@@ -520,7 +532,7 @@ class PsfSlpIndexer {
520
532
 
521
533
  throw new Error('Input tokenId must be a string.')
522
534
  } catch (error) {
523
- console.log('error: ', error)
535
+ // console.log('error: ', error)
524
536
  if (error.response && error.response.data) throw error.response.data
525
537
  else throw error
526
538
  }
@@ -156,26 +156,28 @@ describe('#psf-slp-indexer', () => {
156
156
  })
157
157
  })
158
158
 
159
- describe('#getTokenData2', () => {
160
- it('should get token data', async () => {
161
- const tokenId =
162
- 'd9aafa7acb514c597caf440ae268b5e4e955f2687e05f044cdf8fd9550d9a27b'
163
-
164
- // bchjs.PsfSlpIndexer.restURL = 'http://localhost:3000/v5/'
165
- const result = await bchjs.PsfSlpIndexer.getTokenData2(tokenId)
166
- console.log('result: ', result)
167
-
168
- assert.property(result, 'tokenStats')
169
- assert.property(result, 'mutableData')
170
- assert.property(result, 'immutableData')
171
- assert.property(result, 'tokenIcon')
172
- assert.property(result, 'fullSizedUrl')
173
- assert.property(result, 'optimizedTokenIcon')
174
- assert.property(result, 'optimizedFullSizedUrl')
175
- assert.property(result, 'iconRepoCompatible')
176
- assert.property(result, 'ps002Compatible')
177
- })
178
- })
159
+ // This test is commented out because it can not succeed in the BVT without
160
+ // tripping rate limits.
161
+ // describe('#getTokenData2', () => {
162
+ // it('should get token data', async () => {
163
+ // const tokenId =
164
+ // 'd9aafa7acb514c597caf440ae268b5e4e955f2687e05f044cdf8fd9550d9a27b'
165
+ //
166
+ // // bchjs.PsfSlpIndexer.restURL = 'http://localhost:3000/v5/'
167
+ // const result = await bchjs.PsfSlpIndexer.getTokenData2(tokenId)
168
+ // // console.log('result: ', result)
169
+ //
170
+ // assert.property(result, 'tokenStats')
171
+ // assert.property(result, 'mutableData')
172
+ // assert.property(result, 'immutableData')
173
+ // assert.property(result, 'tokenIcon')
174
+ // assert.property(result, 'fullSizedUrl')
175
+ // assert.property(result, 'optimizedTokenIcon')
176
+ // assert.property(result, 'optimizedFullSizedUrl')
177
+ // assert.property(result, 'iconRepoCompatible')
178
+ // assert.property(result, 'ps002Compatible')
179
+ // })
180
+ // })
179
181
  })
180
182
 
181
183
  // Promise-based sleep function