Merge pull request #1554 from chaotixkilla/fix-ciphertrace-check-flow

[LAM-561] Fix ciphertrace blocking txs without being enabled
This commit is contained in:
Rafael Taranto 2023-06-14 15:50:18 +01:00 committed by GitHub
commit ff59288593
2 changed files with 12 additions and 5 deletions

View file

@ -1,10 +1,11 @@
const coins = require('@lamassu/coins')
const axios = require('axios')
const _ = require('lodash/fp')
const logger = require('../../../logger')
const NAME = 'CipherTrace'
const SUPPORTED_COINS = ['BTC', 'ETH', 'BCH', 'LTC', 'BNB', 'RSK']
const SUPPORTED_COINS = ['BTC', 'ETH', 'BCH', 'LTC']
function getClient (account) {
if (_.isNil(account) || !account.enabled) return null
@ -128,11 +129,15 @@ function getInputAddresses (account, cryptoCode, txHashes) {
}
function isWalletScoringEnabled (account, cryptoCode) {
if (!SUPPORTED_COINS.includes(cryptoCode)) {
const isAccountEnabled = !_.isNil(account) && account.enabled
if (!isAccountEnabled) return Promise.resolve(false)
if (!SUPPORTED_COINS.includes(cryptoCode) && !coins.utils.isErc20Token(cryptoCode)) {
return Promise.reject(new Error('Unsupported crypto: ' + cryptoCode))
}
return Promise.resolve(!_.isNil(account) && account.enabled)
return Promise.resolve(true)
}
module.exports = {

View file

@ -29,8 +29,10 @@ export default {
settings: {
enabled: true,
disabledMessage: 'This plugin is disabled',
label: 'Enabled',
requirement: null
label:
'Enabled (Supported coins: BTC, ETH, BCH, LTC and all active ERC-20 tokens)',
requirement: null,
rightSideLabel: true
},
face: true
}