Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-24 15:54:44 +05:00
parent fa125539b4
commit 96e30660e8
7 changed files with 116 additions and 21 deletions

View file

@ -89,6 +89,25 @@ internal class DefaultYieldSupplyTransactionRepository(
)
}
override suspend fun getProtocolBalance(userWalletId: UserWalletId, cryptoCurrency: CryptoCurrency): BigDecimal? =
withContext(dispatchers.io) {
require(cryptoCurrency is CryptoCurrency.Token)
runCatching {
val walletManager = walletManagersFacade.getOrCreateWalletManager(
userWalletId = userWalletId,
blockchain = cryptoCurrency.network.toBlockchain(),
derivationPath = cryptoCurrency.network.derivationPath.value,
) ?: error("Wallet manager not found")
walletManager.getProtocolBalance(
token = Token(
symbol = cryptoCurrency.symbol,
contractAddress = cryptoCurrency.contractAddress,
decimals = cryptoCurrency.decimals,
),
)
}.onFailure(Timber::e).getOrNull()
}
@Suppress("LongParameterList")
private fun buildEnterTransactions(
walletManager: WalletManager,