diff --git a/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js b/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js index 74d9a9c8..712376f9 100644 --- a/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js +++ b/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js @@ -28,18 +28,18 @@ 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}`) + logger.info(`** 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 }) .then(res => ({ address, score: res.data.risk, isValid: res.data.risk < threshold })) .then(result => { - console.log('** DEBUG ** rateWallet RETURN:', result) + logger.info(`** DEBUG ** rateWallet RETURN: ${result}`) return result }) .catch(err => { - console.log(`** DEBUG ** rateWallet ERROR: ${err.message}`) + logger.error(`** DEBUG ** rateWallet ERROR: ${err.message}`) throw err }) } @@ -54,7 +54,8 @@ function isValidWalletScore (account, score) { function getAddressTransactionsHashes (receivingAddress, cryptoCode, client, wallet) { 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`) + + logger.info(`** 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 @@ -64,8 +65,8 @@ function getAddressTransactionsHashes (receivingAddress, cryptoCode, client, wal _.map(_.get(['txHash'])) )) .catch(err => { - console.log(`** DEBUG ** getTransactionHash ERROR: ${err}`) - console.log(`** DEBUG ** Fetching transactions hashes via wallet node...`) + logger.error(`** DEBUG ** getTransactionHash ERROR: ${err}`) + logger.error(`** DEBUG ** Fetching transactions hashes via wallet node...`) return wallet.getTxHashesByAddress(cryptoCode, receivingAddress) }) } @@ -78,11 +79,11 @@ function getTransactionHash (account, cryptoCode, receivingAddress, wallet) { if (_.size(txHashes) > 1) { logger.warn('An address generated by this wallet was used in more than one transaction') } - console.log('** DEBUG ** getTransactionHash RETURN: ', _.join(', ', txHashes)) + logger.info('** DEBUG ** getTransactionHash RETURN: ', _.join(', ', txHashes)) return txHashes }) .catch(err => { - console.log('** DEBUG ** getTransactionHash from wallet node ERROR: ', err) + logger.error('** DEBUG ** getTransactionHash from wallet node ERROR: ', err) throw err }) } @@ -116,12 +117,12 @@ function getInputAddresses (account, cryptoCode, txHashes) { const transactionInputs = _.flatMap(it => it.inputs, data.transactions) const inputAddresses = _.map(it => it.address, transactionInputs) - console.log(`** DEBUG ** getInputAddresses RETURN: ${inputAddresses}`) + logger.info(`** DEBUG ** getInputAddresses RETURN: ${inputAddresses}`) return inputAddresses }) .catch(err => { - console.log(`** DEBUG ** getInputAddresses ERROR: ${err.message}`) + logger.error(`** DEBUG ** getInputAddresses ERROR: ${err.message}`) throw err }) }