Updated on 2026-08-14

This commit is contained in:
Tangem 2023-12-12 17:38:17 +03:00
parent fb11527b5b
commit b8fc09d6bf
6 changed files with 97 additions and 7 deletions

View file

@ -38,7 +38,7 @@ import timber.log.Timber
import java.math.BigDecimal
import java.util.EnumSet
@Suppress("LargeClass")
@Suppress("LargeClass", "TooManyFunctions")
// FIXME: Move to its own module and make internal
@Deprecated("Inject the WalletManagerFacade interface using DI instead")
class DefaultWalletManagersFacade(
@ -433,6 +433,20 @@ class DefaultWalletManagersFacade(
)
}
override suspend fun estimateFee(
amount: Amount,
userWalletId: UserWalletId,
network: Network,
): Result<TransactionFee>? {
val blockchain = Blockchain.fromId(network.id.value)
val walletManager = getOrCreateWalletManager(
userWalletId = userWalletId,
blockchain = blockchain,
derivationPath = network.derivationPath.value,
)
return (walletManager as? TransactionSender)?.estimateFee(amount = amount)
}
override suspend fun validateTransaction(
amount: Amount,
fee: Amount?,

View file

@ -25,6 +25,7 @@ import java.util.EnumSet
/**
* A facade for managing wallets.
*/
@Suppress("TooManyFunctions")
interface WalletManagersFacade {
/**
@ -166,6 +167,15 @@ interface WalletManagersFacade {
network: Network,
): Result<TransactionFee>?
/**
* Returns estimated fee for transaction
*
* @param amount of transaction
* @param userWalletId selected wallet id
* @param network network of currency
*/
suspend fun estimateFee(amount: Amount, userWalletId: UserWalletId, network: Network): Result<TransactionFee>?
/**
* Validates transaction
*