suspend fun simulateTransaction(): Result<String> {
val evaluateTransactionParam = EvaluateTransactionParam(
to = "0x5596D66388555273eF90163f5e7314C8CE14F73c", // The recipient address.
value = "0x10DE4A2A", // The value to be sent in Wei.
data = null, // Data for the transaction (for contract interactions).
maxFeePerGas = null, // Maximum fee per gas.
maxPriorityFeePerGas = null, // Maximum priority fee per gas.
gas = null, // The gas limit.
gasPrice = null, // Gas price in Wei.
)
val result = portal.api.evaluateTransaction(
chainId = ETH_SEPOLIA_CHAIN_ID,
operationType = EvaluateTransactionOperationType.SIMULATION,
transaction = evaluateTransactionParam
)
if (result.isFailure) {
return Result.failure(Exception("error: ${result.exceptionOrNull()?.message}"))
}
return Result.success("")
}