Skip to content

Commit ace0d3c

Browse files
fix(@desktop/wallet): Fix issues in Send Modal
1. The fees text always show "Fees on Mainnet" even though some other chain is selected 2. Time shows as ~5 instead 0f ~5s 3. Eth balance is repeated twice in token selector incase of Mainnet and Optimism fixes #18103
1 parent a816cd9 commit ace0d3c

File tree

9 files changed

+33
-16
lines changed

9 files changed

+33
-16
lines changed

src/app/modules/main/wallet_section/assets/controller.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ proc buildAllTokens*(self: Controller, addresses: seq[string]) =
3434

3535
proc init*(self: Controller) =
3636
let walletAddresses = self.walletAccountService.getWalletAddresses()
37-
self.buildAllTokens(walletAddresses)
3837
discard
3938

4039
proc getChainIds*(self: Controller): seq[int] =

src/app_service/service/network_connection/service.nim

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,17 @@ QtObject:
246246
self.events.emit(SIGNAL_CONNECTION_UPDATE, self.convertConnectionStatusToNetworkConnectionsArgs(COLLECTIBLES, self.connectionStatus[COLLECTIBLES]))
247247
discard collectibles_backend.refetchOwnedCollectibles()
248248

249+
proc checkIfConnected*(self: Service, website: string): bool =
250+
if self.connectionStatus.hasKey(website) and self.connectionStatus[website].completelyDown:
251+
return false
252+
return true
253+
249254
proc networkConnected*(self: Service, connected: bool) =
250255
if connected:
251-
self.walletService.reloadAccountTokens()
252-
self.tokenService.rebuildMarketData()
256+
if not self.checkIfConnected(BLOCKCHAINS):
257+
self.walletService.reloadAccountTokens()
258+
if not self.checkIfConnected(MARKET):
259+
self.tokenService.rebuildMarketData()
253260
discard collectibles_backend.refetchOwnedCollectibles()
254261
else:
255262
if(self.connectionStatus.hasKey(BLOCKCHAINS)):
@@ -258,8 +265,3 @@ QtObject:
258265
self.connectionStatus[MARKET] = newConnectionStatus()
259266
if(self.connectionStatus.hasKey(COLLECTIBLES)):
260267
self.connectionStatus[COLLECTIBLES] = newConnectionStatus()
261-
262-
proc checkIfConnected*(self: Service, website: string): bool =
263-
if self.connectionStatus.hasKey(website) and self.connectionStatus[website].completelyDown:
264-
return false
265-
return true

storybook/pages/SimpleTransactionsFeesPage.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ SplitView {
2424
fiatFees: qsTr("1.45 EUR")
2525
loading: loadingCheckbox.checked
2626
error: errorCheckbox.checked
27+
networkName: "Mainnet"
2728
}
2829
}
2930

storybook/qmlTests/tests/tst_SimpleTransactionsFees.qml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Item {
4141

4242
compare(background.color, Theme.palette.indirectColor1)
4343
compare(gasIcon.asset.name, "gas")
44-
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
44+
compare(infoText.text, qsTr("Est %1 transaction fee").arg(controlUnderTest.networkName))
4545
compare(cryptoFeesText.text, "XXXXXXXXXX")
4646
verify(cryptoFeesText.loading)
4747
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
@@ -65,10 +65,11 @@ Item {
6565

6666
controlUnderTest.cryptoFees = "0.0007 ETH"
6767
controlUnderTest.fiatFees = "1.45 EUR"
68+
controlUnderTest.networkName = "Mainnet"
6869

6970
compare(background.color, Theme.palette.indirectColor1)
7071
compare(gasIcon.asset.name, "gas")
71-
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
72+
compare(infoText.text, qsTr("Est %1 transaction fee").arg(controlUnderTest.networkName))
7273
compare(cryptoFeesText.text,"0.0007 ETH")
7374
verify(!cryptoFeesText.loading)
7475
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
@@ -94,7 +95,7 @@ Item {
9495

9596
compare(background.color, Theme.palette.indirectColor1)
9697
compare(gasIcon.asset.name, "gas")
97-
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
98+
compare(infoText.text, qsTr("Est %1 transaction fee").arg(controlUnderTest.networkName))
9899
compare(cryptoFeesText.text,"XXXXXXXXXX")
99100
verify(cryptoFeesText.loading)
100101
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
@@ -104,10 +105,11 @@ Item {
104105

105106
controlUnderTest.cryptoFees = "0.0007 ETH"
106107
controlUnderTest.fiatFees = "1.45 EUR"
108+
controlUnderTest.networkName = "Optimism"
107109

108110
compare(background.color, Theme.palette.indirectColor1)
109111
compare(gasIcon.asset.name, "gas")
110-
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
112+
compare(infoText.text, qsTr("Est %1 transaction fee").arg(controlUnderTest.networkName))
111113
compare(cryptoFeesText.text,"0.0007 ETH")
112114
verify(cryptoFeesText.loading)
113115
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
@@ -132,10 +134,11 @@ Item {
132134
controlUnderTest.error = true
133135
controlUnderTest.cryptoFees = "0.0007 ETH"
134136
controlUnderTest.fiatFees = "1.45 EUR"
137+
controlUnderTest.networkName = "Mainnet"
135138

136139
compare(background.color, Theme.palette.indirectColor1)
137140
compare(gasIcon.asset.name, "gas")
138-
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
141+
compare(infoText.text, qsTr("Est %1 transaction fee").arg(controlUnderTest.networkName))
139142
compare(cryptoFeesText.text,"0.0007 ETH")
140143
verify(!cryptoFeesText.loading)
141144
compare(cryptoFeesText.customColor, Theme.palette.dangerColor1)

storybook/src/Models/TokensBySymbolModel.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ListModel {
4747
symbol: "STT",
4848
sources: ";" + status + ";",
4949
addressPerChain: [
50+
{ chainId: 1, address: "0x3d6afaa395c31fcd391fe3d562e75fe9e8ec7e6a"},
5051
{chainId: 5, address: "0x3d6afaa395c31fcd391fe3d562e75fe9e8ec7e6a"},
5152
{ chainId: 11155420, address: "0x3d6afaa395c31fcd391fe3d562e75fe9e8ec7e6a"},
5253
{ chainId: 421614, address: "0x3d6afaa395c31fcd391fe3d562e75fe9e8ec7e6a"},
@@ -140,6 +141,7 @@ ListModel {
140141
communityId: "",
141142
sources: ";" + uniswap + ";" + status + ";",
142143
addressPerChain: [
144+
{ chainId: 1, address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"},
143145
{ chainId: 11155111, address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"},
144146
{ chainId: 11155420, address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"},
145147
],

ui/app/AppLayouts/Wallet/WalletUtils.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ QtObject {
9191
if (estimatedTime >= 60) {
9292
return qsTr(">60s")
9393
}
94-
return qsTr("~%1").arg(estimatedTime)
94+
return qsTr("~%1s").arg(estimatedTime)
9595
}
9696

9797
function getRouterErrorBasedOnCode(code) {

ui/app/AppLayouts/Wallet/panels/SimpleTransactionsFees.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Control {
1818
property bool loading
1919
/** property to set error state in the fees component **/
2020
property bool error
21+
property string networkName
2122

2223
QtObject {
2324
id: d
@@ -63,7 +64,7 @@ Control {
6364
lineHeightMode: Text.FixedHeight
6465
lineHeight: 22
6566

66-
text: qsTr("Est Mainnet transaction fee")
67+
text: qsTr("Est %1 transaction fee").arg(root.networkName)
6768
}
6869
StatusTextWithLoadingState {
6970
id: cryptoFeesText

ui/app/AppLayouts/Wallet/popups/simpleSend/SimpleSendModal.qml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,13 @@ StatusDialog {
455455
}
456456

457457
readonly property string nativeTokenSymbol: Utils.getNativeTokenSymbol(root.selectedChainId)
458+
459+
460+
readonly property var selectedNetworkEntry: ModelEntry {
461+
sourceModel: root.networksModel
462+
key: "chainId"
463+
value: root.selectedChainId
464+
}
458465
}
459466

460467
width: 556
@@ -752,6 +759,8 @@ StatusDialog {
752759
fiatFees: root.estimatedFiatFees
753760
loading: root.routesLoading && root.allValuesFilledCorrectly
754761
error: d.errNotEnoughEth
762+
networkName: !!d.selectedNetworkEntry.item && d.selectedNetworkEntry.available ?
763+
d.selectedNetworkEntry.item.chainName: ""
755764
}
756765
visible: root.allValuesFilledCorrectly
757766
}

0 commit comments

Comments
 (0)