Updated on 2026-08-14

This commit is contained in:
Tangem 2026-01-28 16:35:03 +04:00
parent 5db8900311
commit bba00924d4
18 changed files with 110 additions and 314 deletions

View file

@ -22,6 +22,7 @@ import com.tangem.blockchain.transactionhistory.models.TransactionHistoryRequest
import com.tangem.blockchain.yieldsupply.YieldSupplyContractCallDataProviderFactory
import com.tangem.blockchainsdk.BlockchainSDKFactory
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
import com.tangem.blockchainsdk.utils.fromNetworkId
import com.tangem.blockchainsdk.utils.toBlockchain
import com.tangem.blockchainsdk.utils.toNetworkId
import com.tangem.crypto.hdWallet.DerivationPath
@ -623,6 +624,22 @@ internal class DefaultWalletManagersFacade @Inject constructor(
)
}
override suspend fun getNativeTokenBalance(
userWalletId: UserWalletId,
networkId: String,
derivationPath: String?,
): BigDecimal {
val blockchain = requireNotNull(Blockchain.fromNetworkId(networkId)) { "blockchain not found" }
val walletManager = getOrCreateWalletManager(userWalletId, blockchain, derivationPath)
return walletManager?.wallet?.amounts
?.firstNotNullOfOrNull { amountEntry ->
amountEntry.takeIf { amountEntry.key is AmountType.Coin }
}
?.value?.value
?: BigDecimal.ZERO
}
override suspend fun getAssetRequirements(
userWalletId: UserWalletId,
currency: CryptoCurrency,