@psf/bch-js 7.1.4 → 7.1.6
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": "7.1.
|
|
3
|
+
"version": "7.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A JavaScript library for working with Bitcoin Cash and SLP Tokens",
|
|
6
6
|
"author": "Chris Troutner <chris.troutner@gmail.com>",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"slp-mdm": "0.0.7",
|
|
53
53
|
"slp-parser": "0.0.4",
|
|
54
54
|
"wif": "2.0.6",
|
|
55
|
-
"x402-bch-axios": "2.1.
|
|
55
|
+
"x402-bch-axios": "2.1.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"apidoc": "1.2.0",
|
package/src/psf-slp-indexer.js
CHANGED
|
@@ -66,7 +66,7 @@ class PsfSlpIndexer {
|
|
|
66
66
|
)
|
|
67
67
|
return response.data
|
|
68
68
|
} catch (error) {
|
|
69
|
-
if (error.response && error.response.data) throw error.response.data
|
|
69
|
+
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
|
70
70
|
else throw error
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -134,7 +134,7 @@ class PsfSlpIndexer {
|
|
|
134
134
|
}
|
|
135
135
|
throw new Error('Input address must be a string.')
|
|
136
136
|
} catch (error) {
|
|
137
|
-
if (error.response && error.response.data) throw error.response.data
|
|
137
|
+
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
|
138
138
|
else throw error
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -199,7 +199,7 @@ class PsfSlpIndexer {
|
|
|
199
199
|
}
|
|
200
200
|
throw new Error('Input tokenId must be a string.')
|
|
201
201
|
} catch (error) {
|
|
202
|
-
if (error.response && error.response.data) throw error.response.data
|
|
202
|
+
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
|
203
203
|
else throw error
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -427,7 +427,7 @@ class PsfSlpIndexer {
|
|
|
427
427
|
}
|
|
428
428
|
throw new Error('Input tokenId must be a string.')
|
|
429
429
|
} catch (error) {
|
|
430
|
-
if (error.response && error.response.data) throw error.response.data
|
|
430
|
+
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
|
431
431
|
else throw error
|
|
432
432
|
}
|
|
433
433
|
}
|
|
@@ -522,7 +522,7 @@ class PsfSlpIndexer {
|
|
|
522
522
|
throw new Error('Input tokenId must be a string.')
|
|
523
523
|
} catch (error) {
|
|
524
524
|
// console.log('error: ', error)
|
|
525
|
-
if (error.response && error.response.data) throw error.response.data
|
|
525
|
+
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
|
526
526
|
else throw error
|
|
527
527
|
}
|
|
528
528
|
}
|
|
@@ -43,14 +43,14 @@ describe('#PsfSlpIndexer', () => {
|
|
|
43
43
|
try {
|
|
44
44
|
// Stub the network call.
|
|
45
45
|
const testErr = new Error()
|
|
46
|
-
testErr.response = { data: {
|
|
46
|
+
testErr.response = { data: { error: 'Status 422' } }
|
|
47
47
|
sandbox.stub(axios, 'get').throws(testErr)
|
|
48
48
|
|
|
49
49
|
await bchjs.PsfSlpIndexer.status()
|
|
50
50
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
|
51
51
|
assert.equal(true, false, 'Unexpected result!')
|
|
52
52
|
} catch (err) {
|
|
53
|
-
assert.equal(err.
|
|
53
|
+
assert.equal(err.message, 'Status 422')
|
|
54
54
|
}
|
|
55
55
|
})
|
|
56
56
|
})
|
|
@@ -103,7 +103,7 @@ describe('#PsfSlpIndexer', () => {
|
|
|
103
103
|
try {
|
|
104
104
|
// Stub the network call.
|
|
105
105
|
const testErr = new Error()
|
|
106
|
-
testErr.response = { data: {
|
|
106
|
+
testErr.response = { data: { error: 'Status 422' } }
|
|
107
107
|
sandbox.stub(axios, 'post').throws(testErr)
|
|
108
108
|
|
|
109
109
|
const addr = 'bitcoincash:qzmd5vxgh9m22m6fgvm57yd6kjnjl9qnwywsf3583n'
|
|
@@ -112,7 +112,7 @@ describe('#PsfSlpIndexer', () => {
|
|
|
112
112
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
|
113
113
|
assert.equal(true, false, 'Unexpected result!')
|
|
114
114
|
} catch (err) {
|
|
115
|
-
assert.equal(err.
|
|
115
|
+
assert.equal(err.message, 'Status 422')
|
|
116
116
|
}
|
|
117
117
|
})
|
|
118
118
|
})
|
|
@@ -174,7 +174,7 @@ describe('#PsfSlpIndexer', () => {
|
|
|
174
174
|
try {
|
|
175
175
|
// Stub the network call.
|
|
176
176
|
const testErr = new Error()
|
|
177
|
-
testErr.response = { data: {
|
|
177
|
+
testErr.response = { data: { error: 'Status 422' } }
|
|
178
178
|
sandbox.stub(axios, 'post').throws(testErr)
|
|
179
179
|
|
|
180
180
|
const tokenId =
|
|
@@ -182,7 +182,7 @@ describe('#PsfSlpIndexer', () => {
|
|
|
182
182
|
await bchjs.PsfSlpIndexer.tokenStats(tokenId)
|
|
183
183
|
assert.equal(true, false, 'Unexpected result!')
|
|
184
184
|
} catch (err) {
|
|
185
|
-
assert.equal(err.
|
|
185
|
+
assert.equal(err.message, 'Status 422')
|
|
186
186
|
}
|
|
187
187
|
})
|
|
188
188
|
})
|
|
@@ -399,7 +399,7 @@ describe('#PsfSlpIndexer', () => {
|
|
|
399
399
|
try {
|
|
400
400
|
// Stub the network call.
|
|
401
401
|
const testErr = new Error()
|
|
402
|
-
testErr.response = { data: {
|
|
402
|
+
testErr.response = { data: { error: 'Status 422' } }
|
|
403
403
|
sandbox.stub(axios, 'post').throws(testErr)
|
|
404
404
|
|
|
405
405
|
const tokenId =
|
|
@@ -407,7 +407,7 @@ describe('#PsfSlpIndexer', () => {
|
|
|
407
407
|
await bchjs.PsfSlpIndexer.getTokenData(tokenId)
|
|
408
408
|
assert.equal(true, false, 'Unexpected result!')
|
|
409
409
|
} catch (err) {
|
|
410
|
-
assert.equal(err.
|
|
410
|
+
assert.equal(err.message, 'Status 422')
|
|
411
411
|
}
|
|
412
412
|
})
|
|
413
413
|
})
|