From c84f5becea80a3eb79b6a0d5fb052b9e0b839abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Wed, 6 Apr 2022 18:51:18 +0100 Subject: [PATCH] feat: enable USDT for cash-in only transactions --- lib/blockchain/install.js | 2 +- lib/new-admin/config/accounts.js | 6 +++--- lib/plugins.js | 1 + lib/plugins/common/ccxt.js | 4 ++-- lib/plugins/exchange/binanceus.js | 4 ++-- lib/plugins/exchange/bitstamp.js | 4 ++-- lib/plugins/exchange/cex.js | 4 ++-- lib/plugins/exchange/ftx.js | 4 ++-- lib/plugins/exchange/itbit.js | 4 ++-- lib/plugins/exchange/kraken.js | 4 ++-- new-lamassu-admin/src/pages/Blacklist/BlacklistModal.js | 1 + new-lamassu-admin/src/pages/Wallet/WizardSplash.js | 3 +++ new-lamassu-admin/src/pages/Wallet/helper.js | 2 +- 13 files changed, 24 insertions(+), 19 deletions(-) diff --git a/lib/blockchain/install.js b/lib/blockchain/install.js index 1191f20e..edab198e 100644 --- a/lib/blockchain/install.js +++ b/lib/blockchain/install.js @@ -143,7 +143,7 @@ function run () { _.filter(c => c.type !== 'erc-20'), _.map(c => { const checked = isInstalledSoftware(c) && isInstalledVolume(c) - const name = c.code === 'ethereum' ? 'Ethereum' : c.display + const name = c.code === 'ethereum' ? 'Ethereum and/or USDT' : c.display return { name, value: c.code, diff --git a/lib/new-admin/config/accounts.js b/lib/new-admin/config/accounts.js index 9ab0476c..b7a4c07e 100644 --- a/lib/new-admin/config/accounts.js +++ b/lib/new-admin/config/accounts.js @@ -3,7 +3,7 @@ const _ = require('lodash/fp') const { ALL } = require('../../plugins/common/ccxt') -const { BTC, BCH, DASH, ETH, LTC, ZEC, XMR } = COINS +const { BTC, BCH, DASH, ETH, LTC, USDT, ZEC, XMR } = COINS const { bitpay, coinbase, itbit, bitstamp, kraken, binanceus, cex, ftx } = ALL const TICKER = 'ticker' @@ -28,8 +28,8 @@ const ALL_ACCOUNTS = [ { code: 'mock-ticker', display: 'Mock (Caution!)', class: TICKER, cryptos: ALL_CRYPTOS, dev: true }, { code: 'bitcoind', display: 'bitcoind', class: WALLET, cryptos: [BTC] }, { code: 'no-layer2', display: 'No Layer 2', class: LAYER_2, cryptos: ALL_CRYPTOS }, - { code: 'infura', display: 'Infura', class: WALLET, cryptos: [ETH] }, - { code: 'geth', display: 'geth', class: WALLET, cryptos: [ETH] }, + { code: 'infura', display: 'Infura', class: WALLET, cryptos: [ETH, USDT] }, + { code: 'geth', display: 'geth', class: WALLET, cryptos: [ETH, USDT] }, { code: 'zcashd', display: 'zcashd', class: WALLET, cryptos: [ZEC] }, { code: 'litecoind', display: 'litecoind', class: WALLET, cryptos: [LTC] }, { code: 'dashd', display: 'dashd', class: WALLET, cryptos: [DASH] }, diff --git a/lib/plugins.js b/lib/plugins.js index 80bbcc9b..9f6688cd 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -219,6 +219,7 @@ function plugins (settings, deviceId) { return { cryptoCode, display: cryptoRec.display, + isCashInOnly: Boolean(cryptoRec.isCashinOnly), minimumTx: BN.max(minimumTx, cashInFee), cashInFee, cashInCommission, diff --git a/lib/plugins/common/ccxt.js b/lib/plugins/common/ccxt.js index 44038d13..322e8313 100644 --- a/lib/plugins/common/ccxt.js +++ b/lib/plugins/common/ccxt.js @@ -8,7 +8,7 @@ const binanceus = require('../exchange/binanceus') const cex = require('../exchange/cex') const ftx = require('../exchange/ftx') const bitpay = require('../ticker/bitpay') -const { BTC, BCH, DASH, ETH, LTC, ZEC } = COINS +const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT } = COINS const ALL = { cex: cex, @@ -19,7 +19,7 @@ const ALL = { itbit: itbit, bitpay: bitpay, coinbase: { - CRYPTO: [BTC, ETH, LTC, DASH, ZEC, BCH], + CRYPTO: [BTC, ETH, LTC, DASH, ZEC, BCH, USDT], FIAT: 'ALL_CURRENCIES' } } diff --git a/lib/plugins/exchange/binanceus.js b/lib/plugins/exchange/binanceus.js index fe2c96de..1804b1d7 100644 --- a/lib/plugins/exchange/binanceus.js +++ b/lib/plugins/exchange/binanceus.js @@ -4,8 +4,8 @@ const _ = require('lodash/fp') const { ORDER_TYPES } = require('./consts') const ORDER_TYPE = ORDER_TYPES.MARKET -const { BTC, BCH, DASH, ETH, LTC, ZEC } = COINS -const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH] +const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT } = COINS +const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH, USDT] const FIAT = ['USD'] const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey'] diff --git a/lib/plugins/exchange/bitstamp.js b/lib/plugins/exchange/bitstamp.js index 6d08e5bd..f325f447 100644 --- a/lib/plugins/exchange/bitstamp.js +++ b/lib/plugins/exchange/bitstamp.js @@ -4,8 +4,8 @@ const _ = require('lodash/fp') const { ORDER_TYPES } = require('./consts') const ORDER_TYPE = ORDER_TYPES.MARKET -const { BTC, ETH, LTC, BCH } = COINS -const CRYPTO = [BTC, ETH, LTC, BCH] +const { BTC, ETH, LTC, BCH, USDT } = COINS +const CRYPTO = [BTC, ETH, LTC, BCH, USDT] const FIAT = ['USD', 'EUR'] const AMOUNT_PRECISION = 8 const REQUIRED_CONFIG_FIELDS = ['key', 'secret', 'clientId'] diff --git a/lib/plugins/exchange/cex.js b/lib/plugins/exchange/cex.js index 8bb1863e..52f6ad71 100644 --- a/lib/plugins/exchange/cex.js +++ b/lib/plugins/exchange/cex.js @@ -4,8 +4,8 @@ const _ = require('lodash/fp') const { ORDER_TYPES } = require('./consts') const ORDER_TYPE = ORDER_TYPES.MARKET -const { BTC, BCH, DASH, ETH, LTC } = COINS -const CRYPTO = [BTC, ETH, LTC, DASH, BCH] +const { BTC, BCH, DASH, ETH, LTC, USDT } = COINS +const CRYPTO = [BTC, ETH, LTC, DASH, BCH, USDT] const FIAT = ['USD', 'EUR'] const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey'] diff --git a/lib/plugins/exchange/ftx.js b/lib/plugins/exchange/ftx.js index 2661c8c2..c085ef96 100644 --- a/lib/plugins/exchange/ftx.js +++ b/lib/plugins/exchange/ftx.js @@ -4,8 +4,8 @@ const _ = require('lodash/fp') const { ORDER_TYPES } = require('./consts') const ORDER_TYPE = ORDER_TYPES.MARKET -const { BTC, BCH, ETH, LTC } = COINS -const CRYPTO = [BTC, ETH, LTC, BCH] +const { BTC, BCH, ETH, LTC, USDT } = COINS +const CRYPTO = [BTC, ETH, LTC, BCH, USDT] const FIAT = ['USD'] const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey'] diff --git a/lib/plugins/exchange/itbit.js b/lib/plugins/exchange/itbit.js index 9b06be15..dcaa3d83 100644 --- a/lib/plugins/exchange/itbit.js +++ b/lib/plugins/exchange/itbit.js @@ -4,8 +4,8 @@ const { ORDER_TYPES } = require('./consts') const { COINS } = require('@lamassu/coins') const ORDER_TYPE = ORDER_TYPES.LIMIT -const { BTC, ETH } = COINS -const CRYPTO = [BTC, ETH] +const { BTC, ETH, USDT } = COINS +const CRYPTO = [BTC, ETH, USDT] const FIAT = ['USD'] const AMOUNT_PRECISION = 4 const REQUIRED_CONFIG_FIELDS = ['clientKey', 'clientSecret', 'userId', 'walletId'] diff --git a/lib/plugins/exchange/kraken.js b/lib/plugins/exchange/kraken.js index 031ab192..b3f226fe 100644 --- a/lib/plugins/exchange/kraken.js +++ b/lib/plugins/exchange/kraken.js @@ -4,8 +4,8 @@ const { ORDER_TYPES } = require('./consts') const { COINS } = require('@lamassu/coins') const ORDER_TYPE = ORDER_TYPES.MARKET -const { BTC, BCH, DASH, ETH, LTC, ZEC, XMR } = COINS -const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH, XMR] +const { BTC, BCH, DASH, ETH, LTC, ZEC, XMR, USDT } = COINS +const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH, XMR, USDT] const FIAT = ['USD', 'EUR'] const AMOUNT_PRECISION = 6 const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey'] diff --git a/new-lamassu-admin/src/pages/Blacklist/BlacklistModal.js b/new-lamassu-admin/src/pages/Blacklist/BlacklistModal.js index 1d6d2289..4c13881b 100644 --- a/new-lamassu-admin/src/pages/Blacklist/BlacklistModal.js +++ b/new-lamassu-admin/src/pages/Blacklist/BlacklistModal.js @@ -34,6 +34,7 @@ const BlackListModal = ({ DASH: 'XqQ7gU8eM76rEfey726cJpT2RGKyJyBrcn', ZEC: 't1KGyyv24eL354C9gjveBGEe8Xz9UoPKvHR', BCH: 'qrd6za97wm03lfyg82w0c9vqgc727rhemg5yd9k3dm', + USDT: '0x5754284f345afc66a98fbb0a0afe71e0f007b949', XMR: '888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H' } diff --git a/new-lamassu-admin/src/pages/Wallet/WizardSplash.js b/new-lamassu-admin/src/pages/Wallet/WizardSplash.js index c72d11d8..21f4b966 100644 --- a/new-lamassu-admin/src/pages/Wallet/WizardSplash.js +++ b/new-lamassu-admin/src/pages/Wallet/WizardSplash.js @@ -9,6 +9,7 @@ import { ReactComponent as DashLogo } from 'src/styling/logos/icon-dash-colour.s import { ReactComponent as EthereumLogo } from 'src/styling/logos/icon-ethereum-colour.svg' import { ReactComponent as LitecoinLogo } from 'src/styling/logos/icon-litecoin-colour.svg' import { ReactComponent as MoneroLogo } from 'src/styling/logos/icon-monero-colour.svg' +import { ReactComponent as TetherLogo } from 'src/styling/logos/icon-tether-colour.svg' import { ReactComponent as ZCashLogo } from 'src/styling/logos/icon-zcash-colour.svg' const styles = { @@ -51,6 +52,8 @@ const getLogo = code => { return LitecoinLogo case 'ZEC': return ZCashLogo + case 'USDT': + return TetherLogo case 'XMR': return MoneroLogo default: diff --git a/new-lamassu-admin/src/pages/Wallet/helper.js b/new-lamassu-admin/src/pages/Wallet/helper.js index 07cac93e..fd56ece5 100644 --- a/new-lamassu-admin/src/pages/Wallet/helper.js +++ b/new-lamassu-admin/src/pages/Wallet/helper.js @@ -187,7 +187,7 @@ const getAdvancedWalletElementsOverrides = ( const has0Conf = R.complement( /* NOTE: List of coins without 0conf settings. */ - R.pipe(R.prop('id'), R.flip(R.includes)(['ETH'])) + R.pipe(R.prop('id'), R.flip(R.includes)(['ETH', 'USDT'])) ) const getElements = (cryptoCurrencies, accounts, onChange, wizard = false) => {