feat: fees update integration after calculating the initial route

This commit is contained in:
Sale Djenic 2024-08-30 11:16:40 +02:00 committed by saledjenic
parent c515a963e3
commit c4363be418
10 changed files with 41 additions and 5 deletions

View File

@ -125,6 +125,9 @@ proc suggestedRoutes*(self: Controller,
self.transactionService.suggestedRoutes(uuid, sendType, accountFrom, accountTo, token, amountIn, toToken, amountOut,
disabledFromChainIDs, disabledToChainIDs, lockedInAmounts, extraParamsTable)
proc stopSuggestedRoutesAsyncCalculation*(self: Controller) =
self.transactionService.stopSuggestedRoutesAsyncCalculation()
proc transfer*(self: Controller, from_addr: string, to_addr: string, assetKey: string, toAssetKey: string,
uuid: string, selectedRoutes: seq[TransactionPathDto], password: string, sendType: SendType,
usePassword: bool, doHashing: bool, tokenName: string, isOwnerToken: bool,

View File

@ -37,6 +37,9 @@ method suggestedRoutes*(self: AccessInterface,
extraParamsTable: Table[string, string] = initTable[string, string]()) {.base.} =
raise newException(ValueError, "No implementation available")
method stopUpdatesForSuggestedRoute*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method suggestedRoutesReady*(self: AccessInterface, uuid: string, suggestedRoutes: SuggestedRoutesDto, errCode: string, errDescription: string) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -109,7 +109,7 @@ proc convertSendToNetworkToNetworkItem(self: Module, network: SendToNetwork): Ne
proc convertNetworkDtoToNetworkRouteItem(self: Module, network: network_service_item.NetworkItem): NetworkRouteItem =
result = initNetworkRouteItem(
network.chainId,
network.chainId,
network.layer,
true,
false,
@ -220,7 +220,7 @@ method authenticateAndTransferWithPaths*(self: Module, fromAddr: string, toAddr:
# Temporary until transaction service rework is completed
let pathsV2 = rawPaths.toTransactionPathsDtoV2()
let pathsV1 = pathsV2.convertToOldRoute().addFirstSimpleBridgeTxFlag()
self.tmpSendTransactionDetails.paths = pathsV1
self.tmpSendTransactionDetails.slippagePercentage = slippagePercentage
self.authenticateAndTransfer(fromAddr, toAddr, assetKey, toAssetKey, uuid, sendType, selectedTokenName, selectedTokenIsOwnerToken)
@ -325,6 +325,9 @@ method suggestedRoutes*(self: Module,
extraParamsTable
)
method stopUpdatesForSuggestedRoute*(self: Module) =
self.controller.stopSuggestedRoutesAsyncCalculation()
method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int]) =
if addresses.len == 0:
return

View File

@ -236,6 +236,9 @@ QtObject:
extraParamsTable
)
proc stopUpdatesForSuggestedRoute*(self: View) {.slot.} =
self.delegate.stopUpdatesForSuggestedRoute()
proc updateRoutePreferredChains*(self: View, chainIds: string) {.slot.} =
self.toNetworksRouteModel.updateRoutePreferredChains(chainIds)
@ -325,7 +328,7 @@ QtObject:
proc transactionSendingComplete*(self: View, txHash: string, success: bool) {.signal.}
proc sendtransactionSendingCompleteSignal*(self: View, txHash: string, success: bool) =
self.transactionSendingComplete(txHash, success)
proc setSenderAccount*(self: View, address: string) {.slot.} =
self.setSelectedSenderAccountAddress(address)
self.delegate.notifySelectedSenderAccountChanged()

View File

@ -702,6 +702,12 @@ QtObject:
except CatchableError as e:
error "suggestedRoutes", exception=e.msg
proc stopSuggestedRoutesAsyncCalculation*(self: Service) =
try:
discard eth.stopSuggestedRoutesAsyncCalculation()
except CatchableError as e:
error "stopSuggestedRoutesAsyncCalculation", exception=e.msg
proc getEstimatedTime*(self: Service, chainId: int, maxFeePerGas: string): EstimatedTime =
try:
let response = backend.getTransactionEstimatedTime(chainId, maxFeePerGas).result.getInt

View File

@ -112,7 +112,10 @@ StatusDialog {
}
onOpened: payPanel.forceActiveFocus()
onClosed: root.swapAdaptor.reset()
onClosed: {
root.swapAdaptor.stopUpdatesForSuggestedRoute()
root.swapAdaptor.reset()
}
header: Item {
implicitHeight: selector.implicitHeight

View File

@ -334,6 +334,10 @@ QObject {
}
}
function stopUpdatesForSuggestedRoute() {
root.swapStore.stopUpdatesForSuggestedRoute()
}
function sendApproveTx() {
root.approvalPending = true
const accountAddress = root.swapFormData.selectedAccountAddress

View File

@ -41,6 +41,10 @@ QtObject {
tokenFrom, tokenTo, disabledFromChainIDs, disabledToChainIDs, sendType, lockedInAmounts)
}
function stopUpdatesForSuggestedRoute() {
root.walletSectionSendInst.stopUpdatesForSuggestedRoute()
}
function authenticateAndTransfer(uuid, accountFrom, accountTo,
tokenFrom, tokenTo, sendType, tokenName, tokenIsOwnerToken, paths, slippagePercentage) {
root.walletSectionSendInst.authenticateAndTransferWithParameters(uuid, accountFrom, accountTo,

View File

@ -278,7 +278,10 @@ StatusDialog {
}
}
onClosed: popup.store.resetStoredProperties()
onClosed: {
popup.store.stopUpdatesForSuggestedRoute()
popup.store.resetStoredProperties()
}
header: Item {
implicitHeight: accountSelector.implicitHeight

View File

@ -70,6 +70,10 @@ QtObject {
walletSectionSendInst.suggestedRoutes(valueIn.toFixed(), valueOut.toFixed(), extraParamsJson)
}
function stopUpdatesForSuggestedRoute() {
walletSectionSendInst.stopUpdatesForSuggestedRoute()
}
function resolveENS(value) {
mainModuleInst.resolveENS(value, "")
}