fix(wallet)_: Filter non-bridgeable assets in Bridge Modal

- Implemented a bridgeableGroupedAccountAssetsModel in WalletAssetsStore.qml to dynamically filter assets based on their bridgeability.

closes: #15697
This commit is contained in:
belalshehab 2024-07-31 01:26:30 +03:00 committed by Belal Shehab
parent 222b9c74f5
commit 5d4afba07f
2 changed files with 20 additions and 1 deletions

View File

@ -101,4 +101,21 @@ QtObject {
rightModel: _jointTokensBySymbolModel rightModel: _jointTokensBySymbolModel
joinRole: "tokensKey" joinRole: "tokensKey"
} }
// This is hard coded for now, and should be updated whenever Hop add new tokens for support
// This should be dynamically fetched somehow in the future
readonly property var tokensSupportedByHopBridge: ["USDC", "USDC.e", "USDT", "DAI", "HOP", "SNX", "sUSD", "rETH", "MAGIC"]
readonly property SortFilterProxyModel bridgeableGroupedAccountAssetsModel: SortFilterProxyModel {
objectName: "bridgeableGroupedAccountAssetsModel"
sourceModel: root.groupedAccountAssetsModel
filters: [
FastExpressionFilter {
expression: root.tokensSupportedByHopBridge.includes(model.symbol)
expectedRoles: ["symbol"]
}
]
}
} }

View File

@ -360,7 +360,9 @@ StatusDialog {
TokenSelectorViewAdaptor { TokenSelectorViewAdaptor {
id: assetsAdaptor id: assetsAdaptor
assetsModel: popup.store.walletAssetStore.groupedAccountAssetsModel assetsModel: d.isBridgeTx ?
popup.store.walletAssetStore.bridgeableGroupedAccountAssetsModel :
popup.store.walletAssetStore.groupedAccountAssetsModel
flatNetworksModel: popup.store.flatNetworksModel flatNetworksModel: popup.store.flatNetworksModel
currentCurrency: popup.store.currencyStore.currentCurrency currentCurrency: popup.store.currencyStore.currentCurrency