From 0bf3188555a3dc7f6d62799f61e6b605c22968d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Tue, 13 Jun 2023 16:35:41 +0100 Subject: [PATCH] fix: ciphertrace blocking txs without being enabled fix: ciphertrace supported coins --- lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js | 11 ++++++++--- .../src/pages/Services/schemas/ciphertrace.js | 6 ++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js b/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js index 712376f9..d3922525 100644 --- a/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js +++ b/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js @@ -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 = { diff --git a/new-lamassu-admin/src/pages/Services/schemas/ciphertrace.js b/new-lamassu-admin/src/pages/Services/schemas/ciphertrace.js index b090d8da..d48c8e41 100644 --- a/new-lamassu-admin/src/pages/Services/schemas/ciphertrace.js +++ b/new-lamassu-admin/src/pages/Services/schemas/ciphertrace.js @@ -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 }