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) {
|
super(appStore: _appStore) {
|
||||||
_useTorOnly = _settingsStore.exchangeStatus == ExchangeApiMode.torOnly;
|
_useTorOnly = _settingsStore.exchangeStatus == ExchangeApiMode.torOnly;
|
||||||
_setProviders();
|
_setProviders();
|
||||||
// Hash Bags: chains removed from the wallet are not offered as swap targets.
|
// Hash Bags: the swap picker is a curated allowlist — natives of chains
|
||||||
const removedChainCurrencies = [
|
// the wallet actually ships plus major stables. Everything else stays
|
||||||
CryptoCurrency.sol,
|
// defined in CryptoCurrency (raw ids back Hive-stored trade history) but
|
||||||
CryptoCurrency.trx,
|
// is hidden from the swap UI. LTC is receive-only; BNB stays deposit-only
|
||||||
CryptoCurrency.zec,
|
// (inherited upstream restriction).
|
||||||
CryptoCurrency.dcr,
|
const swapDepositAllowlist = [
|
||||||
CryptoCurrency.zano,
|
CryptoCurrency.wow,
|
||||||
CryptoCurrency.usdcsol,
|
CryptoCurrency.xmr,
|
||||||
CryptoCurrency.usdtSol,
|
CryptoCurrency.btc,
|
||||||
CryptoCurrency.usdcTrc20,
|
CryptoCurrency.bch,
|
||||||
CryptoCurrency.usdttrc20,
|
CryptoCurrency.doge,
|
||||||
];
|
CryptoCurrency.nano,
|
||||||
const excludeDepositCurrencies = [CryptoCurrency.btt, ...removedChainCurrencies];
|
CryptoCurrency.eth,
|
||||||
const excludeReceiveCurrencies = [
|
CryptoCurrency.baseEth,
|
||||||
CryptoCurrency.xlm,
|
CryptoCurrency.arbEth,
|
||||||
CryptoCurrency.xrp,
|
|
||||||
CryptoCurrency.bnb,
|
CryptoCurrency.bnb,
|
||||||
CryptoCurrency.btt,
|
CryptoCurrency.maticpoly,
|
||||||
...removedChainCurrencies,
|
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();
|
_initialPairBasedOnWallet();
|
||||||
|
|
||||||
@@ -199,11 +220,11 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
|||||||
}, delay: 300));
|
}, delay: 300));
|
||||||
|
|
||||||
receiveCurrencies = CryptoCurrency.all
|
receiveCurrencies = CryptoCurrency.all
|
||||||
.where((cryptoCurrency) => !excludeReceiveCurrencies.contains(cryptoCurrency))
|
.where(swapReceiveAllowlist.contains)
|
||||||
.toList()
|
.toList()
|
||||||
.asObservable();
|
.asObservable();
|
||||||
depositCurrencies = CryptoCurrency.all
|
depositCurrencies = CryptoCurrency.all
|
||||||
.where((cryptoCurrency) => !excludeDepositCurrencies.contains(cryptoCurrency))
|
.where(swapDepositAllowlist.contains)
|
||||||
.toList()
|
.toList()
|
||||||
.asObservable();
|
.asObservable();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user