Merge pull request #250 from Permissionless-Software-Foundation/ct-unstable

fix(getTokenData2): Adding api documentation
This commit is contained in:
Chris Troutner
2022-10-06 20:43:14 -07:00
committed by GitHub
2 changed files with 14 additions and 2 deletions
+13 -1
View File
@@ -449,6 +449,18 @@ class PsfSlpIndexer {
* @apiGroup PSF SLP
* @apiDescription Get token icon and other media associated with a token.
*
* Get the icon for a token, given it's token ID.
* This function expects a string input of a token ID property.
* This function returns an object with a tokenIcon property that contains
* the URL to the icon.
*
* The output object always have these properties:
* - tokenIcon: A url to the token icon, if it exists.
* - tokenStats: Data about the token from psf-slp-indexer.
* - optimizedTokenIcon: An alternative, potentially more optimal, url to the token icon, if it exists.
* - iconRepoCompatible: true if the token icon is available via token.bch.sx
* - ps002Compatible: true if the token icon is compatible with PS007 specification.
*
* @apiExample Example usage:
* (async () => {
* try {
@@ -520,7 +532,7 @@ class PsfSlpIndexer {
throw new Error('Input tokenId must be a string.')
} catch (error) {
console.log('error: ', error)
// console.log('error: ', error)
if (error.response && error.response.data) throw error.response.data
else throw error
}
@@ -163,7 +163,7 @@ describe('#psf-slp-indexer', () => {
// bchjs.PsfSlpIndexer.restURL = 'http://localhost:3000/v5/'
const result = await bchjs.PsfSlpIndexer.getTokenData2(tokenId)
console.log('result: ', result)
// console.log('result: ', result)
assert.property(result, 'tokenStats')
assert.property(result, 'mutableData')