Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-06 22:12:26 +05:00
parent 3c80a53254
commit 5514e3a195
7 changed files with 48 additions and 22 deletions

View file

@ -76,18 +76,22 @@ internal class DefaultYieldSupplyRepository(
(walletManager as? YieldSupplyProvider)?.isSupported() ?: false
}
override suspend fun activateProtocol(cryptoCurrencyToken: CryptoCurrency.Token, address: String): Boolean =
withContext(dispatchers.io) {
val chainId = Blockchain.fromNetworkId(cryptoCurrencyToken.network.backendId)?.getChainId()
?: error("Chain id is required for evm's")
yieldSupplyApi.activateYieldModule(
YieldSupplyChangeTokenStatusBody(
tokenAddress = cryptoCurrencyToken.contractAddress,
chainId = chainId,
userAddress = address,
),
).getOrThrow().isActive
}
override suspend fun activateProtocol(
userWalletId: UserWalletId,
cryptoCurrencyToken: CryptoCurrency.Token,
address: String,
): Boolean = withContext(dispatchers.io) {
val chainId = Blockchain.fromNetworkId(cryptoCurrencyToken.network.backendId)?.getChainId()
?: error("Chain id is required for evm's")
yieldSupplyApi.activateYieldModule(
body = YieldSupplyChangeTokenStatusBody(
tokenAddress = cryptoCurrencyToken.contractAddress,
chainId = chainId,
userAddress = address,
),
userWalletId = userWalletId.stringValue,
).getOrThrow().isActive
}
override suspend fun deactivateProtocol(cryptoCurrencyToken: CryptoCurrency.Token, address: String): Boolean =
withContext(dispatchers.io) {