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 <aleksandardjenic@status.im>
This commit is contained in:
Jonathan Rainville 2024-12-06 14:22:00 -05:00 committed by GitHub
parent 007f75ad4c
commit a290c3c5b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 5 deletions

View File

@ -243,7 +243,6 @@ proc signOnKeycard(self: Module) =
break
if self.tmpSendTransactionDetails.txHashBeingProcessed.len == 0:
self.sendSignedTransactions()
self.clearTmpData()
proc getRSVFromSignature(self: Module, signature: string): (string, string, string) =
let finalSignature = singletonInstance.utils.removeHexPrefix(signature)
@ -270,7 +269,9 @@ method prepareSignaturesForTransactions*(self:Module, txForSigning: RouterTransa
self.tmpSendTransactionDetails.resolvedSignatures[h] = ("", "", "")
self.signOnKeycard()
else:
let finalPassword = hashPassword(self.tmpSendTransactionDetails.password)
var finalPassword = self.tmpSendTransactionDetails.password
if not singletonInstance.userProfile.getIsKeycardUser():
finalPassword = hashPassword(self.tmpSendTransactionDetails.password)
for h in txForSigning.signingDetails.hashes:
self.tmpSendTransactionDetails.resolvedSignatures[h] = ("", "", "")
var
@ -299,6 +300,8 @@ method onTransactionSigned*(self: Module, keycardFlowType: string, keycardEvent:
method transactionWasSent*(self: Module, uuid: string, chainId: int = 0, approvalTx: bool = false, txHash: string = "", error: string = "") =
self.tmpKeepPinPass = approvalTx # need to automate the swap flow with approval
defer:
self.clearTmpData(self.tmpKeepPinPass)
if txHash.len == 0:
self.view.sendTransactionSentSignal(uuid = self.tmpSendTransactionDetails.uuid, chainId = 0, approvalTx = false, txHash = "", error)
return
@ -408,5 +411,4 @@ method splitAndFormatAddressPrefix*(self: Module, text : string, updateInStore:
return editedText
method transactionSendingComplete*(self: Module, txHash: string, status: string) =
self.clearTmpData(self.tmpKeepPinPass)
self.view.sendtransactionSendingCompleteSignal(txHash, status)

View File

@ -90,7 +90,7 @@ proc prepareTokensTask(argEncoded: string) {.gcsafe, nimcall.} =
"storeResult": false
}
try:
let response = backend.fetchOrGetCachedWalletBalances(arg.accounts)
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
output["result"] = response.result
output["storeResult"] = %* arg.storeResult
except Exception as e:

View File

@ -132,6 +132,7 @@ rpc(getWalletToken, "wallet"):
rpc(fetchOrGetCachedWalletBalances, "wallet"):
accounts: seq[string]
forceRefresh: bool
rpc(fetchMarketValues, "wallet"):
symbols: seq[string]

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 233f2f9a2afaf81e459f0025e390a6e58964ea5c
Subproject commit 0fa1a0833b1939ba9f119907a6efd3d5bd7c021d