diff --git a/build.gradle.kts b/build.gradle.kts index 89abfba13..dc9e32bb7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,8 +5,6 @@ import org.apache.http.entity.StringEntity import org.apache.http.impl.client.HttpClients import org.apache.http.util.EntityUtils import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.sonarqube.gradle.SonarExtension -import java.net.URL import java.util.Base64 import javax.xml.parsers.DocumentBuilderFactory diff --git a/product/walletkit/build.gradle.kts b/product/walletkit/build.gradle.kts index 3fdb3d1b1..903a70164 100644 --- a/product/walletkit/build.gradle.kts +++ b/product/walletkit/build.gradle.kts @@ -65,7 +65,7 @@ android { dependencies { implementation("net.java.dev.jna:jna:5.15.0@aar") - implementation("com.github.reown-com:yttrium:0.4.11") + implementation("com.github.reown-com:yttrium:0.5.2") implementation(platform(libs.firebase.bom)) implementation(libs.firebase.messaging) diff --git a/product/walletkit/src/androidTest/kotlin/com/reown/walletkit/GetTransactionDetailsUseCaseTest.kt b/product/walletkit/src/androidTest/kotlin/com/reown/walletkit/GetCallDetailsUseCaseTest.kt similarity index 99% rename from product/walletkit/src/androidTest/kotlin/com/reown/walletkit/GetTransactionDetailsUseCaseTest.kt rename to product/walletkit/src/androidTest/kotlin/com/reown/walletkit/GetCallDetailsUseCaseTest.kt index a4f7be69d..425afe0ac 100644 --- a/product/walletkit/src/androidTest/kotlin/com/reown/walletkit/GetTransactionDetailsUseCaseTest.kt +++ b/product/walletkit/src/androidTest/kotlin/com/reown/walletkit/GetCallDetailsUseCaseTest.kt @@ -21,7 +21,7 @@ import kotlin.coroutines.resume import kotlin.coroutines.suspendCoroutine @ExperimentalCoroutinesApi -class GetTransactionDetailsUseCaseTest { +class GetCallDetailsUseCaseTest { private val chainAbstractionClient: ChainAbstractionClient = mockk() private val getTransactionDetailsUseCase = GetTransactionDetailsUseCase(chainAbstractionClient) diff --git a/product/walletkit/src/androidTest/kotlin/com/reown/walletkit/PrepareFulfilmentUseCaseTests.kt b/product/walletkit/src/androidTest/kotlin/com/reown/walletkit/PrepareFulfilmentUseCaseTests.kt index 7fe8f106c..1d61631ad 100644 --- a/product/walletkit/src/androidTest/kotlin/com/reown/walletkit/PrepareFulfilmentUseCaseTests.kt +++ b/product/walletkit/src/androidTest/kotlin/com/reown/walletkit/PrepareFulfilmentUseCaseTests.kt @@ -14,10 +14,10 @@ import uniffi.yttrium.FundingMetadata import uniffi.yttrium.InitialTransactionMetadata import uniffi.yttrium.Metadata import uniffi.yttrium.PrepareResponse -import uniffi.yttrium.RouteResponseAvailable -import uniffi.yttrium.RouteResponseError -import uniffi.yttrium.RouteResponseNotRequired -import uniffi.yttrium.RouteResponseSuccess +import uniffi.yttrium.PrepareResponseAvailable +import uniffi.yttrium.PrepareResponseError +import uniffi.yttrium.PrepareResponseNotRequired +import uniffi.yttrium.PrepareResponseSuccess import uniffi.yttrium.Transaction import kotlin.coroutines.resume import kotlin.coroutines.suspendCoroutine @@ -29,8 +29,8 @@ class PrepareChainAbstractionUseCaseTest { @Test fun shouldCallOnSuccessWithAvailableResult() = runTest { val successResult = PrepareResponse.Success( - RouteResponseSuccess.Available( - RouteResponseAvailable( + PrepareResponseSuccess.Available( + PrepareResponseAvailable( orchestrationId = "123", initialTransaction = transaction, metadata = Metadata( @@ -42,7 +42,7 @@ class PrepareChainAbstractionUseCaseTest { ) ) ) - coEvery { chainAbstractionClient.prepare(any()) } returns successResult + coEvery { chainAbstractionClient.prepare(any(), any(), any()) } returns successResult val result = async { suspendCoroutine { continuation -> @@ -63,8 +63,8 @@ class PrepareChainAbstractionUseCaseTest { @Test fun shouldCallOnSuccessWithNotRequiredResult() = runTest { - val successResult = PrepareResponse.Success(RouteResponseSuccess.NotRequired(RouteResponseNotRequired(initialTransaction = transaction, transactions = emptyList()))) - coEvery { chainAbstractionClient.prepare(any()) } returns successResult + val successResult = PrepareResponse.Success(PrepareResponseSuccess.NotRequired(PrepareResponseNotRequired(initialTransaction = transaction, transactions = emptyList()))) + coEvery { chainAbstractionClient.prepare(any(), any(), any()) } returns successResult val result = async { suspendCoroutine { continuation -> @@ -85,9 +85,9 @@ class PrepareChainAbstractionUseCaseTest { @Test fun shouldCallOnErrorWithNoRoutesAvailableError() = runTest { - val errorResult = PrepareResponse.Error(RouteResponseError(BridgingError.NO_ROUTES_AVAILABLE)) + val errorResult = PrepareResponse.Error(PrepareResponseError(BridgingError.NO_ROUTES_AVAILABLE)) - coEvery { chainAbstractionClient.prepare(any()) } returns errorResult + coEvery { chainAbstractionClient.prepare(any(), any(), any()) } returns errorResult val result = async { suspendCoroutine { continuation -> @@ -108,9 +108,9 @@ class PrepareChainAbstractionUseCaseTest { @Test fun shouldCallOnErrorWithInsufficientFundsError() = runTest { - val errorResult = PrepareResponse.Error(RouteResponseError(BridgingError.INSUFFICIENT_FUNDS)) + val errorResult = PrepareResponse.Error(PrepareResponseError(BridgingError.INSUFFICIENT_FUNDS)) - coEvery { chainAbstractionClient.prepare(any()) } returns errorResult + coEvery { chainAbstractionClient.prepare(any(), any(), any()) } returns errorResult val result = async { suspendCoroutine { continuation -> @@ -131,7 +131,7 @@ class PrepareChainAbstractionUseCaseTest { @Test fun shouldCallOnErrorWithUnknownErrorOnException() = runTest { - coEvery { chainAbstractionClient.prepare(any()) } throws RuntimeException("Some unexpected error") + coEvery { chainAbstractionClient.prepare(any(), any(), any()) } throws RuntimeException("Some unexpected error") val result = async { suspendCoroutine { continuation -> diff --git a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/Annotations.kt b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/Annotations.kt index bccbb2892..53bc7be8d 100644 --- a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/Annotations.kt +++ b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/Annotations.kt @@ -1,7 +1,7 @@ package com.reown.walletkit.client @RequiresOptIn( - message = "This API is experimental and may change in a future release.", + message = "This API is experimental and may change in a future release, use carefully.", level = RequiresOptIn.Level.WARNING ) @Retention(AnnotationRetention.BINARY) @@ -9,7 +9,7 @@ package com.reown.walletkit.client annotation class ChainAbstractionExperimentalApi @RequiresOptIn( - message = "This API is experimental and may change in a future release.", + message = "This API is experimental and may change in a future release, use carefully.", level = RequiresOptIn.Level.WARNING ) @Retention(AnnotationRetention.BINARY) diff --git a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/ClientMapper.kt b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/ClientMapper.kt index 8905591e9..3f4d1011e 100644 --- a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/ClientMapper.kt +++ b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/ClientMapper.kt @@ -2,18 +2,19 @@ package com.reown.walletkit.client import com.reown.android.internal.common.signing.cacao.CacaoType import com.reown.sign.client.Sign +import com.squareup.moshi.Moshi import uniffi.uniffi_yttrium.Eip1559Estimation -import uniffi.uniffi_yttrium.OwnerSignature -import uniffi.uniffi_yttrium.PreparedSendTransaction -import uniffi.uniffi_yttrium.FfiTransaction import uniffi.yttrium.Amount +import uniffi.yttrium.Call +import uniffi.yttrium.DoSendTransactionParams import uniffi.yttrium.FeeEstimatedTransaction import uniffi.yttrium.FundingMetadata -import uniffi.yttrium.InitialTransaction import uniffi.yttrium.InitialTransactionMetadata +import uniffi.yttrium.OwnerSignature +import uniffi.yttrium.PrepareResponseAvailable +import uniffi.yttrium.PreparedSendTransaction import uniffi.yttrium.Metadata as YMetadata import uniffi.yttrium.Transaction -import uniffi.yttrium.RouteResponseAvailable import uniffi.yttrium.TransactionFee import uniffi.yttrium.TxnDetails import uniffi.yttrium.UiFields @@ -297,16 +298,20 @@ internal fun Sign.Model.ConnectionState.Reason.toWallet(): Wallet.Model.Connecti } @JvmSynthetic -internal fun PreparedSendTransaction.toWallet(): Wallet.Params.PrepareSendTransactionsResult = Wallet.Params.PrepareSendTransactionsResult(hash, doSendTransactionParams) +internal fun PreparedSendTransaction.toWallet(moshi: Moshi): Wallet.Params.PrepareSendTransactionsResult { + val jsonParams = moshi.adapter(DoSendTransactionParams::class.java).toJson(doSendTransactionParams) + return Wallet.Params.PrepareSendTransactionsResult(hash = hash, doSendTransactionParams = jsonParams, eip712Domain = domain) +} + @JvmSynthetic -internal fun Wallet.Params.Transaction.toYttrium(): FfiTransaction = FfiTransaction(to = to, value = value, data = data) +internal fun Wallet.Params.Call.toYttrium(): Call = Call(to = to, value = value, input = data) @JvmSynthetic internal fun Wallet.Params.OwnerSignature.toYttrium(): OwnerSignature = OwnerSignature(owner = address, signature = signature) @JvmSynthetic -internal fun RouteResponseAvailable.toWallet(): Wallet.Model.PrepareSuccess.Available = +internal fun PrepareResponseAvailable.toWallet(): Wallet.Model.PrepareSuccess.Available = Wallet.Model.PrepareSuccess.Available( fulfilmentId = orchestrationId, checkIn = metadata.checkIn.toLong(), @@ -317,8 +322,8 @@ internal fun RouteResponseAvailable.toWallet(): Wallet.Model.PrepareSuccess.Avai ) @JvmSynthetic -internal fun Wallet.Model.PrepareSuccess.Available.toYttrium(): RouteResponseAvailable = - RouteResponseAvailable( +internal fun Wallet.Model.PrepareSuccess.Available.toYttrium(): PrepareResponseAvailable = + PrepareResponseAvailable( fulfilmentId, metadata = YMetadata( checkIn = checkIn.toULong(), @@ -348,15 +353,6 @@ private fun InitialTransactionMetadata.toWallet(): Wallet.Model.InitialTransacti decimals = decimals.toInt() ) -@JvmSynthetic -fun Wallet.Model.InitialTransaction.toInitialYttrium(): InitialTransaction = InitialTransaction( - from = from, - to = to, - value = value, - chainId = chainId, - input = input, -) - @JvmSynthetic fun Transaction.toWallet(): Wallet.Model.Transaction = Wallet.Model.Transaction( from = from, diff --git a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/Wallet.kt b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/Wallet.kt index 93838e684..b6b421c33 100644 --- a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/Wallet.kt +++ b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/Wallet.kt @@ -64,14 +64,14 @@ object Wallet { data class DecryptMessage(val topic: String, val encryptedMessage: String) : Params() data class GetSmartAccountAddress(val owner: Account) : Params() - data class PrepareSendTransactions(val transactions: List, val owner: Account) : Params() + data class PrepareSendTransactions(val calls: List, val owner: Account) : Params() data class DoSendTransactions(val owner: Account, val signatures: List, val doSendTransactionParams: String) : Params() - data class PrepareSendTransactionsResult(var hash: String, var doSendTransactionParams: String) : Params() + data class PrepareSendTransactionsResult(var hash: String, var doSendTransactionParams: String, val eip712Domain: String, ) : Params() data class DoSendTransactionsResult(var userOperationHash: String) : Params() data class WaitForUserOperationReceipt(var owner: Account, var userOperationHash: String) : Params() data class OwnerSignature(val address: String, val signature: String) : Params() data class Account(val address: String) : Params() - data class Transaction(val to: String, val value: String, val data: String) : Params() + data class Call(val to: String, val value: String, val data: String) : Params() } sealed class Model { diff --git a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt index 1e8bada50..7ccf7377a 100644 --- a/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt +++ b/product/walletkit/src/main/kotlin/com/reown/walletkit/client/WalletKit.kt @@ -2,6 +2,7 @@ package com.reown.walletkit.client import com.reown.android.Core import com.reown.android.CoreInterface +import com.reown.android.internal.common.di.AndroidCommonDITags import com.reown.android.internal.common.scope import com.reown.android.internal.common.wcKoinApp import com.reown.sign.client.Sign @@ -15,7 +16,10 @@ import com.reown.walletkit.use_cases.EstimateGasUseCase import com.reown.walletkit.use_cases.ChainAbstractionStatusUseCase import com.reown.walletkit.use_cases.GetERC20TokenBalanceUseCase import com.reown.walletkit.use_cases.GetTransactionDetailsUseCase +import com.squareup.moshi.Moshi import kotlinx.coroutines.* +import org.koin.core.qualifier.named +import uniffi.yttrium.DoSendTransactionParams import java.util.* object WalletKit { @@ -26,6 +30,7 @@ object WalletKit { private val estimateGasUseCase: EstimateGasUseCase by wcKoinApp.koin.inject() private val getTransactionDetailsUseCase: GetTransactionDetailsUseCase by wcKoinApp.koin.inject() private val getERC20TokenBalanceUseCase: GetERC20TokenBalanceUseCase by wcKoinApp.koin.inject() + private val moshi: Moshi = wcKoinApp.koin.get(named(AndroidCommonDITags.MOSHI)).build() interface WalletDelegate { fun onSessionProposal(sessionProposal: Wallet.Model.SessionProposal, verifyContext: Wallet.Model.VerifyContext) @@ -307,8 +312,9 @@ object WalletKit { val client = safeInteractor.getOrCreate(Account(params.owner.address)) scope.launch { - async { client.prepareSendTransactions(params.transactions.map { it.toYttrium() }).toWallet() } + async { client.prepareSendTransactions(params.calls.map { it.toYttrium() }) } .await() + .toWallet(moshi) .let(onSuccess) } } @@ -319,8 +325,9 @@ object WalletKit { check(::safeInteractor.isInitialized) { "Smart Accounts are not enabled" } val client = safeInteractor.getOrCreate(Account(params.owner.address)) + val doSendParams = moshi.adapter(DoSendTransactionParams::class.java).fromJson(params.doSendTransactionParams) ?: throw IllegalStateException("Failed to parse DoSendTransactionParams") scope.launch { - async { client.doSendTransactions(params.signatures.map { it.toYttrium() }, params.doSendTransactionParams) } + async { client.doSendTransactions(params.signatures.map { it.toYttrium() }, doSendParams) } .await() .let { userOpHash -> onSuccess(Wallet.Params.DoSendTransactionsResult(userOpHash)) } } diff --git a/product/walletkit/src/main/kotlin/com/reown/walletkit/smart_account/SafeInteractor.kt b/product/walletkit/src/main/kotlin/com/reown/walletkit/smart_account/SafeInteractor.kt index ee60eb5fb..1da8d737e 100644 --- a/product/walletkit/src/main/kotlin/com/reown/walletkit/smart_account/SafeInteractor.kt +++ b/product/walletkit/src/main/kotlin/com/reown/walletkit/smart_account/SafeInteractor.kt @@ -3,8 +3,6 @@ package com.reown.walletkit.smart_account import com.reown.android.internal.common.model.ProjectId import com.reown.android.internal.common.wcKoinApp import uniffi.uniffi_yttrium.FfiAccountClient -import uniffi.uniffi_yttrium.FfiAccountClientConfig - import uniffi.yttrium.Config import uniffi.yttrium.Endpoint import uniffi.yttrium.Endpoints @@ -31,14 +29,6 @@ class SafeInteractor(private val pimlicoApiKey: String) { paymaster = Endpoint(baseUrl = pimlicoUrl, apiKey = ""), ) val config = Config(endpoints) - val accountConfig = FfiAccountClientConfig( - ownerAddress = account.address, - chainId = account.reference.toULong(), - config = config, - privateKey = "ff89825a799afce0d5deaa079cdde227072ec3f62973951683ac8cc033000000", //todo: remove sign service, just placeholder - safe = true, - signerType = "PrivateKey" //todo: remove sign service - ) - return FfiAccountClient(accountConfig) + return FfiAccountClient(owner = account.address, chainId = account.reference.toULong(), config = config) } } \ No newline at end of file diff --git a/product/walletkit/src/main/kotlin/com/reown/walletkit/use_cases/PrepareChainAbstractionUseCase.kt b/product/walletkit/src/main/kotlin/com/reown/walletkit/use_cases/PrepareChainAbstractionUseCase.kt index 1f6183aaf..ddefddb5c 100644 --- a/product/walletkit/src/main/kotlin/com/reown/walletkit/use_cases/PrepareChainAbstractionUseCase.kt +++ b/product/walletkit/src/main/kotlin/com/reown/walletkit/use_cases/PrepareChainAbstractionUseCase.kt @@ -2,14 +2,14 @@ package com.reown.walletkit.use_cases import com.reown.android.internal.common.scope import com.reown.walletkit.client.Wallet -import com.reown.walletkit.client.toInitialYttrium import com.reown.walletkit.client.toWallet import kotlinx.coroutines.async import kotlinx.coroutines.launch import uniffi.uniffi_yttrium.ChainAbstractionClient import uniffi.yttrium.BridgingError +import uniffi.yttrium.Call import uniffi.yttrium.PrepareResponse -import uniffi.yttrium.RouteResponseSuccess +import uniffi.yttrium.PrepareResponseSuccess class PrepareChainAbstractionUseCase(private val chainAbstractionClient: ChainAbstractionClient) { operator fun invoke( @@ -21,7 +21,8 @@ class PrepareChainAbstractionUseCase(private val chainAbstractionClient: ChainAb try { val result = async { try { - chainAbstractionClient.prepare(initialTransaction.toInitialYttrium()) + val call = Call(initialTransaction.to, initialTransaction.value, initialTransaction.input) + chainAbstractionClient.prepare(initialTransaction.chainId, initialTransaction.from, call) } catch (e: Exception) { return@async onError(Wallet.Model.PrepareError.Unknown(e.message ?: "Unknown error")) } @@ -30,11 +31,11 @@ class PrepareChainAbstractionUseCase(private val chainAbstractionClient: ChainAb when (result) { is PrepareResponse.Success -> { when (result.v1) { - is RouteResponseSuccess.Available -> - onSuccess((result.v1 as RouteResponseSuccess.Available).v1.toWallet()) + is PrepareResponseSuccess.Available -> + onSuccess((result.v1 as PrepareResponseSuccess.Available).v1.toWallet()) - is RouteResponseSuccess.NotRequired -> - onSuccess(Wallet.Model.PrepareSuccess.NotRequired((result.v1 as RouteResponseSuccess.NotRequired).v1.initialTransaction.toWallet())) + is PrepareResponseSuccess.NotRequired -> + onSuccess(Wallet.Model.PrepareSuccess.NotRequired((result.v1 as PrepareResponseSuccess.NotRequired).v1.initialTransaction.toWallet())) } } diff --git a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/blockchain/Retrofit.kt b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/blockchain/Retrofit.kt index 2193f9ff0..ca430b017 100644 --- a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/blockchain/Retrofit.kt +++ b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/blockchain/Retrofit.kt @@ -8,12 +8,13 @@ import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory fun createBlockChainApiService(projectId: String, chainId: String): BlockChainApiService { - val rpcUrl: String = when (chainId) { - "eip155:10" -> "https://rpc.walletconnect.com"//"https://mainnet.optimism.io" - "eip155:8453" -> "https://mainnet.base.org" - "eip155:42161" -> "https://rpc.walletconnect.com"//""https://arbitrum.llamarpc.com" - else -> "https://rpc.walletconnect.com" - } + val rpcUrl = "https://rpc.walletconnect.com" +// when (chainId) { +// "eip155:10" -> "https://rpc.walletconnect.com"//"https://mainnet.optimism.io" +// "eip155:8453" -> "https://mainnet.base.org" +// "eip155:42161" -> "https://rpc.walletconnect.com"//""https://arbitrum.llamarpc.com" +// else -> "https://rpc.walletconnect.com" +// } val httpClient = OkHttpClient.Builder() diff --git a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/domain/Signer.kt b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/domain/Signer.kt index 1eff55b50..9e33372c7 100644 --- a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/domain/Signer.kt +++ b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/domain/Signer.kt @@ -16,21 +16,26 @@ object Signer { when { SmartAccountEnabler.isSmartAccountEnabled.value -> when (sessionRequest.method) { "wallet_sendCalls" -> { - val transactions: MutableList = mutableListOf() + val calls: MutableList = mutableListOf() val callsArray = JSONArray(sessionRequest.param).getJSONObject(0).getJSONArray("calls") for (i in 0 until callsArray.length()) { val call = callsArray.getJSONObject(i) val to = call.getString("to") ?: "" - val value = call.getString("value") ?: "" + val value = try { + call.getString("value") + } catch (e: Exception) { + "" + } + val data = try { call.getString("data") } catch (e: Exception) { "" } - transactions.add(Wallet.Params.Transaction(to, value, data)) + calls.add(Wallet.Params.Call(to, value, data)) } val ownerAccount = Wallet.Params.Account(EthAccountDelegate.sepoliaAddress) - val prepareSendTxsParams = Wallet.Params.PrepareSendTransactions(transactions = transactions, owner = ownerAccount) + val prepareSendTxsParams = Wallet.Params.PrepareSendTransactions(calls = calls, owner = ownerAccount) val prepareTxsResult = async { prepareTransactions(prepareSendTxsParams) }.await().getOrThrow() val signature = EthSigner.signHash(prepareTxsResult.hash, EthAccountDelegate.privateKey) @@ -49,7 +54,7 @@ object Signer { } ETH_SEND_TRANSACTION -> { - val transactions: MutableList = mutableListOf() + val calls: MutableList = mutableListOf() val params = JSONArray(sessionRequest.param).getJSONObject(0) val to = params.getString("to") ?: "" val value = params.getString("value") ?: "" @@ -59,9 +64,9 @@ object Signer { "" } - transactions.add(Wallet.Params.Transaction(to, value, data)) + calls.add(Wallet.Params.Call(to, value, data)) val ownerAccount = Wallet.Params.Account(EthAccountDelegate.sepoliaAddress) - val prepareSendTxsParams = Wallet.Params.PrepareSendTransactions(transactions = transactions, owner = ownerAccount) + val prepareSendTxsParams = Wallet.Params.PrepareSendTransactions(calls = calls, owner = ownerAccount) val prepareTxsResult = async { prepareTransactions(prepareSendTxsParams) }.await().getOrThrow() val signature = EthSigner.signHash(prepareTxsResult.hash, EthAccountDelegate.privateKey) val doSendTxsParams = Wallet.Params.DoSendTransactions( diff --git a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/domain/model/Transaction.kt b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/domain/model/Transaction.kt index 0fc35dd8d..59525ac62 100644 --- a/sample/wallet/src/main/kotlin/com/reown/sample/wallet/domain/model/Transaction.kt +++ b/sample/wallet/src/main/kotlin/com/reown/sample/wallet/domain/model/Transaction.kt @@ -71,7 +71,11 @@ object Transaction { val requestParams = JSONArray(sessionRequest.request.params).getJSONObject(0) val from = requestParams.getString("from") val to = requestParams.getString("to") - val data = requestParams.getString("data") + val data = try { + requestParams.getString("data") + } catch (e: Exception) { + "0x" + } val value = try { requestParams.getString("value") } catch (e: Exception) { @@ -187,7 +191,7 @@ object Transaction { } suspend fun getReceipt(chainId: String, txHash: String) { - withTimeout(30000) { + withTimeout(60000) { while (true) { val service = createBlockChainApiService(BuildConfig.PROJECT_ID, chainId) val nonceRequest = JsonRpcRequest(