Updated on 2026-08-14

This commit is contained in:
Tangem 2023-01-17 16:23:33 +03:00
parent 78818a6efa
commit bd3ee9e237
33 changed files with 643 additions and 207 deletions

View file

@ -27,7 +27,6 @@ import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.store
import com.tangem.tap.tangemSdk
import java.math.BigDecimal
import java.math.BigInteger
class TransactionManagerImpl(
private val appStateHolder: AppStateHolder,
@ -38,6 +37,7 @@ class TransactionManagerImpl(
amountToSend: BigDecimal,
currencyToSend: Currency,
feeAmount: BigDecimal,
estimatedGas: Int,
destinationAddress: String,
dataToSign: String,
): SendTxResult {
@ -49,7 +49,7 @@ class TransactionManagerImpl(
amount = amount,
fee = Amount(value = feeAmount, blockchain = blockchain),
destination = destinationAddress,
).copy(hash = dataToSign, extras = createExtras(walletManager, feeAmount, dataToSign))
).copy(hash = dataToSign, extras = createExtras(walletManager, estimatedGas, dataToSign))
val signer = transactionSigner(walletManager)
@ -95,10 +95,6 @@ class TransactionManagerImpl(
}
}
override fun getNativeAddress(networkId: String): String {
return "" //todo implement
}
private fun handleSendResult(result: SimpleResult): SendTxResult {
when (result) {
is SimpleResult.Success -> {
@ -155,14 +151,14 @@ class TransactionManagerImpl(
private fun createExtras(
walletManager: WalletManager,
feeAmount: BigDecimal,
estimatedGas: Int,
transactionHash: String,
): TransactionExtras? {
return when (walletManager) {
is EthereumWalletManager -> {
return EthereumTransactionExtras(
data = transactionHash.removePrefix(HEX_PREFIX).hexToBytes(),
gasLimit = BigInteger.valueOf(DEFAULT_GAS_LIMIT),
gasLimit = estimatedGas.toBigInteger(),
)
}
else -> {