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

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

closes: #15697

Co-authored-by: belalshehab <belal@status.im>
This commit is contained in:
Belal Shehab 2024-07-31 20:29:52 +03:00 committed by GitHub
parent 9cf9fa0470
commit 8343fe3076
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View File

@ -101,4 +101,21 @@ QtObject {
rightModel: _jointTokensBySymbolModel
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

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