Skip to content

Commit a290c3c

Browse files
Cherry-picks from Sale's PRs (#16915)
* fix(swap): after approving spending cap with a keycard the swap transaction fails fixes: #16867 * fix(wallet): cannot sing tx sent from imported key pair if the profile is migrated to keycard fixes: #16901 * chore(wallet): added param to fetchOrGetCachedWalletBalances call to align with statusgo change --------- Co-authored-by: Sale Djenic <[email protected]>
1 parent 007f75a commit a290c3c

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

src/app/modules/main/wallet_section/send/module.nim

+5-3
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ proc signOnKeycard(self: Module) =
243243
break
244244
if self.tmpSendTransactionDetails.txHashBeingProcessed.len == 0:
245245
self.sendSignedTransactions()
246-
self.clearTmpData()
247246

248247
proc getRSVFromSignature(self: Module, signature: string): (string, string, string) =
249248
let finalSignature = singletonInstance.utils.removeHexPrefix(signature)
@@ -270,7 +269,9 @@ method prepareSignaturesForTransactions*(self:Module, txForSigning: RouterTransa
270269
self.tmpSendTransactionDetails.resolvedSignatures[h] = ("", "", "")
271270
self.signOnKeycard()
272271
else:
273-
let finalPassword = hashPassword(self.tmpSendTransactionDetails.password)
272+
var finalPassword = self.tmpSendTransactionDetails.password
273+
if not singletonInstance.userProfile.getIsKeycardUser():
274+
finalPassword = hashPassword(self.tmpSendTransactionDetails.password)
274275
for h in txForSigning.signingDetails.hashes:
275276
self.tmpSendTransactionDetails.resolvedSignatures[h] = ("", "", "")
276277
var
@@ -299,6 +300,8 @@ method onTransactionSigned*(self: Module, keycardFlowType: string, keycardEvent:
299300

300301
method transactionWasSent*(self: Module, uuid: string, chainId: int = 0, approvalTx: bool = false, txHash: string = "", error: string = "") =
301302
self.tmpKeepPinPass = approvalTx # need to automate the swap flow with approval
303+
defer:
304+
self.clearTmpData(self.tmpKeepPinPass)
302305
if txHash.len == 0:
303306
self.view.sendTransactionSentSignal(uuid = self.tmpSendTransactionDetails.uuid, chainId = 0, approvalTx = false, txHash = "", error)
304307
return
@@ -408,5 +411,4 @@ method splitAndFormatAddressPrefix*(self: Module, text : string, updateInStore:
408411
return editedText
409412

410413
method transactionSendingComplete*(self: Module, txHash: string, status: string) =
411-
self.clearTmpData(self.tmpKeepPinPass)
412414
self.view.sendtransactionSendingCompleteSignal(txHash, status)

src/app_service/service/wallet_account/async_tasks.nim

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ proc prepareTokensTask(argEncoded: string) {.gcsafe, nimcall.} =
9090
"storeResult": false
9191
}
9292
try:
93-
let response = backend.fetchOrGetCachedWalletBalances(arg.accounts)
93+
let response = backend.fetchOrGetCachedWalletBalances(arg.accounts, false) # TODO: think should we need to use arg.storeResult or not and if yes, is it everywhere set proprely
9494
output["result"] = response.result
9595
output["storeResult"] = %* arg.storeResult
9696
except Exception as e:

src/backend/backend.nim

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ rpc(getWalletToken, "wallet"):
132132

133133
rpc(fetchOrGetCachedWalletBalances, "wallet"):
134134
accounts: seq[string]
135+
forceRefresh: bool
135136

136137
rpc(fetchMarketValues, "wallet"):
137138
symbols: seq[string]

0 commit comments

Comments
 (0)