diff --git a/blockchain/src/main/java/com/tangem/blockchain/blockchains/ravencoin/network/RavencoinNetworkProvider.kt b/blockchain/src/main/java/com/tangem/blockchain/blockchains/ravencoin/network/RavencoinNetworkProvider.kt index cc5d6594a..64c63b1df 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/blockchains/ravencoin/network/RavencoinNetworkProvider.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/blockchains/ravencoin/network/RavencoinNetworkProvider.kt @@ -41,18 +41,23 @@ class RavencoinNetworkProvider( } override suspend fun getFee(): Result { - val feeResponse = api.getFee(numberOfBlocks = FEE_NUMBER_OF_BLOCKS) - val feePerKb = feeResponse["$FEE_NUMBER_OF_BLOCKS"] ?: return Result.Failure(BlockchainSdkError.FailedToLoadFee) - val minimalRate = feePerKb * BigDecimal.valueOf(1.1) - val normalRate = feePerKb * BigDecimal.valueOf(1.3) - val priorityRate = feePerKb * BigDecimal.valueOf(1.5) - return Result.Success( - BitcoinFee( - minimalPerKb = minimalRate, - normalPerKb = normalRate, - priorityPerKb = priorityRate, + try { + val feeResponse = api.getFee(numberOfBlocks = FEE_NUMBER_OF_BLOCKS) + val feePerKb = + feeResponse["$FEE_NUMBER_OF_BLOCKS"] ?: return Result.Failure(BlockchainSdkError.FailedToLoadFee) + val minimalRate = feePerKb * BigDecimal.valueOf(1.1) + val normalRate = feePerKb * BigDecimal.valueOf(1.3) + val priorityRate = feePerKb * BigDecimal.valueOf(1.5) + return Result.Success( + BitcoinFee( + minimalPerKb = minimalRate, + normalPerKb = normalRate, + priorityPerKb = priorityRate, + ) ) - ) + } catch (e: Exception) { + return Result.Failure(e.toBlockchainSdkError()) + } } override suspend fun sendTransaction(transaction: String): SimpleResult {