mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
exchange: curate the swap picker to an explicit allowlist
Deposit side: natives of shipped chains (WOW, XMR, BTC, BCH, DOGE, XNO, ETH, ETH-Base, ETH-Arb, BNB, POL) plus major stables (USDT/USDC variants, DAI). Receive side: same minus BNB (inherited upstream restriction) plus LTC as a receive-only target. ZEC, DASH, SOL, AVAX, Zano, Haven, ADA, EOS, XLM, XRP, TRX, TON and the rest disappear from the swap UI; their CryptoCurrency entries stay defined because the raw ids back Hive-stored trade history.
This commit is contained in:
@@ -112,25 +112,46 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
||||
super(appStore: _appStore) {
|
||||
_useTorOnly = _settingsStore.exchangeStatus == ExchangeApiMode.torOnly;
|
||||
_setProviders();
|
||||
// Hash Bags: chains removed from the wallet are not offered as swap targets.
|
||||
const removedChainCurrencies = [
|
||||
CryptoCurrency.sol,
|
||||
CryptoCurrency.trx,
|
||||
CryptoCurrency.zec,
|
||||
CryptoCurrency.dcr,
|
||||
CryptoCurrency.zano,
|
||||
CryptoCurrency.usdcsol,
|
||||
CryptoCurrency.usdtSol,
|
||||
CryptoCurrency.usdcTrc20,
|
||||
CryptoCurrency.usdttrc20,
|
||||
];
|
||||
const excludeDepositCurrencies = [CryptoCurrency.btt, ...removedChainCurrencies];
|
||||
const excludeReceiveCurrencies = [
|
||||
CryptoCurrency.xlm,
|
||||
CryptoCurrency.xrp,
|
||||
// Hash Bags: the swap picker is a curated allowlist — natives of chains
|
||||
// the wallet actually ships plus major stables. Everything else stays
|
||||
// defined in CryptoCurrency (raw ids back Hive-stored trade history) but
|
||||
// is hidden from the swap UI. LTC is receive-only; BNB stays deposit-only
|
||||
// (inherited upstream restriction).
|
||||
const swapDepositAllowlist = [
|
||||
CryptoCurrency.wow,
|
||||
CryptoCurrency.xmr,
|
||||
CryptoCurrency.btc,
|
||||
CryptoCurrency.bch,
|
||||
CryptoCurrency.doge,
|
||||
CryptoCurrency.nano,
|
||||
CryptoCurrency.eth,
|
||||
CryptoCurrency.baseEth,
|
||||
CryptoCurrency.arbEth,
|
||||
CryptoCurrency.bnb,
|
||||
CryptoCurrency.btt,
|
||||
...removedChainCurrencies,
|
||||
CryptoCurrency.maticpoly,
|
||||
CryptoCurrency.usdterc20,
|
||||
CryptoCurrency.usdtbsc,
|
||||
CryptoCurrency.usdc,
|
||||
CryptoCurrency.usdcpoly,
|
||||
CryptoCurrency.dai,
|
||||
];
|
||||
const swapReceiveAllowlist = [
|
||||
CryptoCurrency.wow,
|
||||
CryptoCurrency.xmr,
|
||||
CryptoCurrency.btc,
|
||||
CryptoCurrency.bch,
|
||||
CryptoCurrency.doge,
|
||||
CryptoCurrency.nano,
|
||||
CryptoCurrency.eth,
|
||||
CryptoCurrency.baseEth,
|
||||
CryptoCurrency.arbEth,
|
||||
CryptoCurrency.maticpoly,
|
||||
CryptoCurrency.usdterc20,
|
||||
CryptoCurrency.usdtbsc,
|
||||
CryptoCurrency.usdc,
|
||||
CryptoCurrency.usdcpoly,
|
||||
CryptoCurrency.dai,
|
||||
CryptoCurrency.ltc,
|
||||
];
|
||||
_initialPairBasedOnWallet();
|
||||
|
||||
@@ -199,11 +220,11 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
||||
}, delay: 300));
|
||||
|
||||
receiveCurrencies = CryptoCurrency.all
|
||||
.where((cryptoCurrency) => !excludeReceiveCurrencies.contains(cryptoCurrency))
|
||||
.where(swapReceiveAllowlist.contains)
|
||||
.toList()
|
||||
.asObservable();
|
||||
depositCurrencies = CryptoCurrency.all
|
||||
.where((cryptoCurrency) => !excludeDepositCurrencies.contains(cryptoCurrency))
|
||||
.where(swapDepositAllowlist.contains)
|
||||
.toList()
|
||||
.asObservable();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user