Compare commits

..
6 Commits
Author SHA1 Message Date
Chris Troutner 5fe8e515ff Merge pull request #136 from Permissionless-Software-Foundation/ct-unstable
fix(decodeOpReturn): Adding debugging information
2021-03-26 16:30:50 -08:00
Chris Troutner f11297339b fix(decodeOpReturn): Adding debugging information 2021-03-26 17:27:57 -07:00
Chris Troutner 61d52c8ebe Merge pull request #135 from Permissionless-Software-Foundation/ct-unstable
fix(debugging): Adding additional debugging info to SLP utils
2021-03-26 12:53:35 -08:00
Chris Troutner d89bbe0bf6 fix(debugging): Adding additional debugging info to SLP utils 2021-03-26 13:51:29 -07:00
Chris Troutner 2a1c2500e6 Merge pull request #134 from Permissionless-Software-Foundation/ct-unstable
fix(slp): Adding more verbose error messages for SLP utility functions
2021-03-26 12:16:55 -08:00
Chris Troutner 8879a5170a fix(slp): Adding more verbose error messages for SLP utility functions 2021-03-26 13:11:40 -07:00
+23 -9
View File
@@ -932,6 +932,7 @@ class Utils {
*/
// Reimplementation of decodeOpReturn() using slp-parser.
async decodeOpReturn (txid, cache = null, usrObj = null) {
console.log(`Entering decodeOpReturn with txid ${txid}.`)
// The cache object is an in-memory cache (JS Object) that can be passed
// into this function. It helps if multiple vouts from the same TXID are
// being evaluated. In that case, it can significantly reduce the number
@@ -1013,18 +1014,20 @@ class Utils {
if (cache) cache[txid] = tokenData
console.log('Exiting decodeOpReturn()')
return tokenData
} catch (error) {
// Used for debugging
// console.log('decodeOpReturn error: ', error)
// console.log(`decodeOpReturn error.message: ${error.message}`)
// if (error.response && error.response.data) {
// console.log(
// `decodeOpReturn error.response.data: ${JSON.stringify(
// error.response.data
// )}`
// )
// }
console.log('decodeOpReturn error: ', error)
console.log(`decodeOpReturn error.message: ${error.message}`)
if (error.response && error.response.data) {
console.log(
`decodeOpReturn error.response.data: ${JSON.stringify(
error.response.data
)}`
)
}
throw error
}
}
@@ -1098,6 +1101,7 @@ class Utils {
* }
*/
async tokenUtxoDetails (utxos, usrObj = null) {
console.log('Entering tokenUtxoDetails()')
try {
// Throw error if input is not an array.
if (!Array.isArray(utxos)) throw new Error('Input must be an array.')
@@ -1156,8 +1160,11 @@ class Utils {
}
}
console.log('Exiting tokenUtxoDetails()')
return outAry
} catch (error) {
console.log('Error in tokenUtxoDetails()')
if (error.response && error.response.data) throw error.response.data
throw error
}
@@ -1282,6 +1289,7 @@ class Utils {
// If the usrObj has a utxoDelay property, then it will delay the loop for
// each UTXO by that many milliseconds.
async _hydrateUtxo (utxos, usrObj = null) {
console.log('Entering _hydrateUtxo()')
try {
const decodeOpReturnCache = {}
@@ -1501,8 +1509,10 @@ class Utils {
}
}
console.log('Exiting _hydrateUtxo()')
return outAry
} catch (error) {
console.log('Error in _hydrateUtxo()')
// console.log('_hydrateUtxo error: ', error)
throw error
}
@@ -1545,6 +1555,7 @@ class Utils {
* true
*/
async waterfallValidateTxid (txid, usrObj = null) {
console.log('Entering waterfallValidateTxid()')
try {
// console.log('txid: ', txid)
@@ -1634,10 +1645,13 @@ class Utils {
return isValid
}
console.log('Exiting waterfallValidateTxid()')
// If isValid is still null, return that value, signaling that the txid
// could not be validated.
return isValid
} catch (error) {
console.log('Error in waterfallValidateTxid()')
if (error.response && error.response.data) throw error.response.data
throw error
}