feat: ciphertrace debug logs
This commit is contained in:
parent
e94f1ff223
commit
dc10537044
2 changed files with 15 additions and 0 deletions
|
|
@ -124,12 +124,21 @@ function getWalletScore (tx, pi) {
|
|||
if (_.includes(tx.status, statuses) && _.isNil(tx.walletScore)) {
|
||||
// Transaction shows up on the blockchain, we can request the sender address
|
||||
return pi.getTransactionHash(tx)
|
||||
.catch(err => {
|
||||
console.log(`** DEBUG ** getTransactionHash ERROR: ${err}`)
|
||||
})
|
||||
.then(txHashes => pi.getInputAddresses(tx, txHashes))
|
||||
.catch(err => {
|
||||
console.log(`** DEBUG ** getInputAddresses ERROR: ${err.message}`)
|
||||
})
|
||||
.then(addresses => {
|
||||
const addressesPromise = []
|
||||
_.forEach(it => addressesPromise.push(pi.rateWallet(tx.cryptoCode, it)), addresses)
|
||||
return Promise.all(addressesPromise)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(`** DEBUG ** rateWallet ERROR: ${err.message}`)
|
||||
})
|
||||
.then(scores => {
|
||||
if (_.isNil(scores) || _.isEmpty(scores)) return tx
|
||||
const highestScore = _.maxBy(it => it.score, scores)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ function rateWallet (account, cryptoCode, address) {
|
|||
const { apiVersion, authHeader } = client
|
||||
const threshold = account.scoreThreshold
|
||||
|
||||
console.log(`** DEBUG ** rateWallet ENDPOINT: https://rest.ciphertrace.com/aml/${apiVersion}/${_.toLower(cryptoCode)}/risk?address=${address}`)
|
||||
|
||||
return axios.get(`https://rest.ciphertrace.com/aml/${apiVersion}/${_.toLower(cryptoCode)}/risk?address=${address}`, {
|
||||
headers: authHeader
|
||||
})
|
||||
|
|
@ -48,6 +50,8 @@ function getTransactionHash (account, cryptoCode, receivingAddress) {
|
|||
|
||||
const { apiVersion, authHeader } = client
|
||||
|
||||
console.log(`** DEBUG ** getTransactionHash ENDPOINT: https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`)
|
||||
|
||||
return axios.get(`https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`, {
|
||||
headers: authHeader
|
||||
})
|
||||
|
|
@ -66,6 +70,8 @@ function getInputAddresses (account, cryptoCode, txHashes) {
|
|||
|
||||
const { apiVersion, authHeader } = client
|
||||
|
||||
console.log(`** DEBUG ** getInputAddresses ENDPOINT: https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}tx?txhashes=${txHashes}`)
|
||||
|
||||
return axios.get(`https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}tx?txhashes=${txHashes}`, {
|
||||
headers: authHeader
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue