Skip to content

Commit

Permalink
feat: fees update integration after calculating the initial route
Browse files Browse the repository at this point in the history
  • Loading branch information
saledjenic authored and Khushboo-dev-cpp committed Sep 9, 2024
1 parent 23e76d4 commit 769f706
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/core/signals/remote_signals/wallet.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import json, options, chronicles
import json, options, chronicles, Tables

import base
import signal_type
Expand All @@ -24,6 +24,7 @@ type WalletSignal* = ref object of Signal
bestRoute*: seq[TransactionPathDtoV2]
error*: string
errorCode*: string
updatedPrices*: Table[string, float64]

proc fromEvent*(T: type WalletSignal, signalType: SignalType, jsonSignal: JsonNode): WalletSignal =
result = WalletSignal()
Expand Down Expand Up @@ -67,6 +68,10 @@ proc fromEvent*(T: type WalletSignal, signalType: SignalType, jsonSignal: JsonNo
result.error = errorResponseJsonNode["details"].getStr
if errorResponseJsonNode.contains("code"):
result.errorCode = errorResponseJsonNode["code"].getStr
result.updatedPrices = initTable[string, float64]()
if event.contains("UpdatedPrices"):
for tokenSymbol, price in event["UpdatedPrices"].pairs():
result.updatedPrices[tokenSymbol] = price.getFloat
except:
error "Error parsing best route"
return
5 changes: 5 additions & 0 deletions src/app_service/service/token/service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -565,3 +565,8 @@ QtObject:
self.fetchTokenPreferences()
except Exception as e:
error "error: ", procName="updateTokenPreferences", errName=e.name, errDesription=e.msg

proc updateTokenPrices*(self: Service, updatedPrices: Table[string, float64]) =
for tokenSymbol, price in updatedPrices:
self.tokenPriceTable[tokenSymbol] = price
self.events.emit(SIGNAL_TOKENS_PRICES_UPDATED, Args())
1 change: 1 addition & 0 deletions src/app_service/service/transaction/service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ QtObject:

self.events.on(SignalType.WalletSuggestedRoutes.event) do(e:Args):
var data = WalletSignal(e)
self.tokenService.updateTokenPrices(data.updatedPrices)
self.suggestedRoutesReady(data.uuid, data.bestRoute, data.bestRouteRaw, data.errorCode, data.error)

self.events.on(PendingTransactionTypeDto.WalletTransfer.event) do(e: Args):
Expand Down
2 changes: 2 additions & 0 deletions ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ StatusDialog {
swapSide: SwapInputPanel.SwapSide.Pay
swapExchangeButtonWidth: swapExchangeButton.width

bottomTextLoading: root.swapAdaptor.swapProposalLoading

onSelectedHoldingIdChanged: root.swapInputParamsForm.fromTokensKey = selectedHoldingId

onRawValueChanged: {
Expand Down
2 changes: 1 addition & 1 deletion vendor/status-go
Submodule status-go updated 42 files
+13 −0 .codecov.yml
+4 −0 Makefile
+11 −1 _assets/ci/Jenkinsfile.tests
+11 −0 _assets/scripts/run_unit_tests.sh
+8 −256 cmd/node-canary/main.go
+5 −22 eth-node/bridge/geth/waku.go
+6 −21 eth-node/bridge/geth/wakuv2.go
+4 −12 eth-node/types/waku.go
+0 −10 eth-node/types/whisper.go
+1 −0 nix/overlay.nix
+42 −0 nix/pkgs/codecov-cli/default.nix
+1 −1 nix/shell.nix
+1 −0 protocol/common/raw_message.go
+1 −0 protocol/communities/manager.go
+26 −7 protocol/messenger.go
+18 −2 protocol/messenger_communities.go
+4 −4 protocol/messenger_config_test.go
+16 −15 protocol/messenger_mailserver.go
+116 −404 protocol/messenger_mailserver_cycle.go
+22 −13 protocol/messenger_mailserver_processMailserverBatch_test.go
+4 −8 protocol/messenger_storenode_comunity_test.go
+5 −6 protocol/storenodes/models.go
+2 −2 protocol/storenodes/storenodes.go
+3 −4 protocol/storenodes/storenodes_test.go
+10 −72 protocol/transport/transport.go
+5 −5 services/mailservers/api_test.go
+56 −31 services/mailservers/database.go
+107 −161 services/mailservers/fleet.go
+0 −152 services/mailservers/tcp_ping.go
+0 −103 services/wakuext/api.go
+0 −234 services/wakuext/api_test.go
+5 −6 services/wallet/responses/router_suggested_routes.go
+11 −15 services/wallet/router/router.go
+3 −0 services/wallet/router/router_updates.go
+5 −3 services/wallet/router/sendtype/send_type.go
+18 −13 signal/events_shhext.go
+0 −1 waku/common/protocol.go
+0 −4 waku/v0/peer.go
+0 −8 waku/v1/peer.go
+0 −68 waku/waku.go
+0 −122 waku/waku_version_test.go
+14 −0 wakuv2/waku.go

0 comments on commit 769f706

Please sign in to comment.