Updated on 2026-08-14

This commit is contained in:
Tangem 2021-12-08 23:34:30 +03:00
parent 2adb00d3bd
commit c80dcd69cc
2 changed files with 7 additions and 5 deletions

View file

@ -96,7 +96,8 @@ class WalletConnectManager {
val activeData = sessions[session] ?: return
removeSimilarSessions(activeData)
val accounts = listOf(Blockchain.Ethereum.makeAddresses(activeData.wallet.walletPublicKey).first().value)
val key = activeData.wallet.derivedPublicKey ?: activeData.wallet.walletPublicKey
val accounts = listOf(Blockchain.Ethereum.makeAddresses(key).first().value)
val approved = activeData.client.approveSession(
accounts = accounts,
chainId = activeData.wallet.chainId

View file

@ -154,7 +154,8 @@ class WalletConnectSdkHelper {
val command = SignHashCommand(
hash = dataToSign.hash,
walletPublicKey = data.walletManager.wallet.publicKey.seedKey
walletPublicKey = data.walletManager.wallet.publicKey.seedKey,
derivationPath = data.walletManager.wallet.publicKey.derivationPath
)
val result = tangemSdkManager.runTaskAsync(command, initialMessage = Message())
return when (result) {
@ -211,13 +212,13 @@ class WalletConnectSdkHelper {
}
suspend fun signPersonalMessage(hashToSign: ByteArray, wallet: WalletForSession): String? {
val publicKey = wallet.walletPublicKey
val command = SignHashCommand(hashToSign, publicKey)
val key = wallet.derivedPublicKey ?: wallet.walletPublicKey
val command = SignHashCommand(hashToSign, wallet.walletPublicKey, wallet.derivationPath)
return when (val result = tangemSdkManager.runTaskAsync(command, wallet.cardId)) {
is CompletionResult.Success -> {
val hash = result.data.signature
return EthereumUtils.prepareSignedMessageData(
hash, hashToSign, CryptoUtils.decompressPublicKey(wallet.walletPublicKey)
hash, hashToSign, CryptoUtils.decompressPublicKey(key)
)
}
is CompletionResult.Failure -> {