Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-26 14:54:13 +05:00
parent 660defb213
commit c56b64bc36
4 changed files with 58 additions and 34 deletions

View file

@ -57,6 +57,17 @@ internal class DefaultTransactionRepository(
val extras = txExtras ?: getMemoExtras(networkId = network.rawId, memo)
val destination = if (amount.type is AmountType.TokenYieldSupply) {
walletManager.getYieldModuleAddress()
} else {
destination
}
val amount = if (amount.type is AmountType.TokenYieldSupply) {
amount.copy(value = BigDecimal.ZERO)
} else {
amount
}
return@withContext if (fee != null) {
walletManager.createTransaction(
amount = amount,
@ -86,11 +97,6 @@ internal class DefaultTransactionRepository(
nonce: BigInteger?,
): TransactionData.Uncompiled = withContext(dispatchers.io) {
val blockchain = network.toBlockchain()
val walletManager = walletManagersFacade.getOrCreateWalletManager(
userWalletId = userWalletId,
blockchain = blockchain,
derivationPath = network.derivationPath.value,
) ?: error("Wallet manager not found")
val callData = SmartContractCallDataProviderFactory.getTokenTransferCallData(
destinationAddress = destination,
@ -98,7 +104,7 @@ internal class DefaultTransactionRepository(
blockchain = blockchain,
)
val extras = if (amount.type is AmountType.Token && callData != null) {
val extras = if (callData != null) {
createTransactionDataExtras(
callData = callData,
network = network,
@ -109,25 +115,15 @@ internal class DefaultTransactionRepository(
null
}
return@withContext if (fee != null) {
createTransaction(
amount = amount,
fee = fee,
memo = null,
destination = destination,
userWalletId = userWalletId,
network = network,
txExtras = getMemoExtras(networkId = network.rawId, memo = memo) ?: extras,
)
} else {
TransactionData.Uncompiled(
amount = amount,
sourceAddress = walletManager.wallet.address,
destinationAddress = destination,
extras = getMemoExtras(networkId = network.rawId, memo = memo) ?: extras,
fee = null,
)
}
createTransaction(
amount = amount,
fee = fee,
memo = null,
destination = destination,
userWalletId = userWalletId,
network = network,
txExtras = getMemoExtras(networkId = network.rawId, memo = memo) ?: extras,
)
}
override suspend fun createApprovalTransaction(