Updated on 2026-08-14

This commit is contained in:
Tangem 2025-05-15 21:43:57 +07:00
parent edfaa5320d
commit 4cd56a1588
4 changed files with 15 additions and 20 deletions

View file

@ -393,7 +393,7 @@ class WalletConnectSdkHelper {
signature = signedHash,
hash = hashToSign,
publicKey = wallet.publicKey.blockchainKey.toDecompressedPublicKey(),
).asRSVLegacyEVM().toHexString()
).asRSVLegacyEVM().toHexString().formatHex()
}
}
is CompletionResult.Failure -> {

View file

@ -5,6 +5,7 @@ import com.tangem.blockchain.blockchains.ethereum.EthereumUtils.toKeccak
import com.tangem.blockchain.common.HEX_PREFIX
import com.tangem.blockchain.common.UnmarshalHelper
import com.tangem.blockchain.common.WalletManager
import com.tangem.blockchain.extensions.formatHex
import com.tangem.blockchain.extensions.isAscii
import com.tangem.common.extensions.hexToBytes
import com.tangem.common.extensions.toDecompressedPublicKey
@ -81,15 +82,12 @@ internal class WcEthMessageSignUseCase @AssistedInject constructor(
object LegacySdkHelper {
private const val ETH_MESSAGE_PREFIX = "\u0019Ethereum Signed Message:\n"
internal fun prepareToSendMessageData(
signedHash: ByteArray,
hashToSign: ByteArray,
walletManager: WalletManager,
): String = UnmarshalHelper.unmarshalSignatureExtended(
signature = signedHash,
hash = hashToSign,
publicKey = walletManager.wallet.publicKey.blockchainKey.toDecompressedPublicKey(),
).asRSVLegacyEVM().toHexString()
fun prepareToSendMessageData(signedHash: ByteArray, hashToSign: ByteArray, walletManager: WalletManager): String =
UnmarshalHelper.unmarshalSignatureExtended(
signature = signedHash,
hash = hashToSign,
publicKey = walletManager.wallet.publicKey.blockchainKey.toDecompressedPublicKey(),
).asRSVLegacyEVM().toHexString().formatHex()
fun createMessageData(message: String): ByteArray {
val messageData = try {

View file

@ -35,16 +35,6 @@ internal abstract class BaseWcSignUseCase<MiddleAction, SignModel> :
)
}
init {
analytics.send(
WcAnalyticEvents.SignatureRequestReceived(
session = context.session,
rawRequest = context.rawSdkRequest,
network = context.network,
),
)
}
override suspend fun onCancel(currentState: WcSignState<SignModel>) {
defaultReject()
}

View file

@ -39,6 +39,13 @@ internal class WcSignUseCaseDelegate<MiddleAction, SignModel>(
operator fun invoke(initModel: SignModel) = channelFlow {
val state = MutableStateFlow(WcSignState(initModel, WcSignStep.PreSign))
analytics.send(
WcAnalyticEvents.SignatureRequestReceived(
session = context.session,
rawRequest = context.rawSdkRequest,
network = context.network,
),
)
state
.onEach { newState -> channel.send(newState) }