Updated on 2026-08-14

This commit is contained in:
Tangem 2021-12-07 19:12:50 +03:00
commit 5eceb469b5
4 changed files with 20 additions and 10 deletions

View file

@ -10,6 +10,7 @@ import com.tangem.blockchain.extensions.*
import com.tangem.common.CompletionResult
import com.tangem.common.core.TangemSdkError
import com.tangem.common.extensions.hexToBytes
import com.tangem.crypto.CryptoUtils
import com.tangem.operations.sign.SignHashCommand
import com.tangem.tap.common.analytics.FirebaseAnalyticsHandler
import com.tangem.tap.common.extensions.toFormattedString
@ -216,7 +217,7 @@ class WalletConnectSdkHelper {
is CompletionResult.Success -> {
val hash = result.data.signature
return EthereumUtils.prepareSignedMessageData(
hash, hashToSign, publicKey
hash, hashToSign, CryptoUtils.decompressPublicKey(wallet.walletPublicKey)
)
}
is CompletionResult.Failure -> {

View file

@ -164,22 +164,28 @@ class WalletConnectMiddleware {
val card = scanResponse.card
val factory = store.state.globalState.tapWalletManager.walletManagerFactory
val wcBlockchain = if (scanResponse.card.isTestCard) {
Blockchain.EthereumTestnet
} else {
Blockchain.Ethereum
}
return if (store.state.globalState.scanResponse?.card?.cardId == card.cardId) {
store.state.walletState.getWalletManager(Blockchain.Ethereum)
?: factory.makeWalletManagerForApp(scanResponse, Blockchain.Ethereum)
store.state.walletState.getWalletManager(wcBlockchain)
?: factory.makeWalletManagerForApp(scanResponse, wcBlockchain)
?.also { walletManager ->
store.dispatch(WalletAction.MultiWallet.AddWalletManagers(walletManager))
store.dispatch(WalletAction.MultiWallet.AddBlockchain(walletManager.wallet.blockchain))
}
} else {
if (currenciesRepository.loadCardCurrencies(card.cardId)?.blockchains?.contains(
Blockchain.Ethereum) == true
wcBlockchain) == true
) {
factory.makeWalletManagerForApp(scanResponse, Blockchain.Ethereum)
factory.makeWalletManagerForApp(scanResponse, wcBlockchain)
} else {
factory.makeWalletManagerForApp(scanResponse, Blockchain.Ethereum)
factory.makeWalletManagerForApp(scanResponse, wcBlockchain)
?.also {
currenciesRepository.saveAddedBlockchain(card.cardId, Blockchain.Ethereum)
currenciesRepository.saveAddedBlockchain(card.cardId, wcBlockchain)
}
}
}

View file

@ -39,7 +39,10 @@ class BackupReducer {
): BackupState {
return when (action) {
BackupAction.IntroduceBackup -> BackupState(backupStep = BackupStep.InitBackup)
BackupAction.IntroduceBackup -> BackupState(
backupStep = BackupStep.InitBackup,
canSkipBackup = state.canSkipBackup
)
BackupAction.StartBackup -> state.copy(backupStep = BackupStep.ScanOriginCard)