Updated on 2026-08-14

This commit is contained in:
Tangem 2021-12-07 16:28:46 +03:00
parent 8b36ed7a9b
commit 9c5d35adbe
2 changed files with 14 additions and 7 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)
}
}
}