Updated on 2026-08-14

This commit is contained in:
Tangem 2023-05-31 09:58:40 +03:00
parent e182d88ebe
commit 73ba136063
13 changed files with 274 additions and 100 deletions

View file

@ -1,8 +1,6 @@
package com.tangem.lib.crypto
import com.tangem.lib.crypto.models.Currency
import com.tangem.lib.crypto.models.ProxyFees
import com.tangem.lib.crypto.models.ProxyNetworkInfo
import com.tangem.lib.crypto.models.*
import com.tangem.lib.crypto.models.transactions.SendTxResult
import java.math.BigDecimal
@ -11,26 +9,25 @@ interface TransactionManager {
@Suppress("LongParameterList")
@Throws(IllegalStateException::class)
suspend fun sendApproveTransaction(
networkId: String,
feeAmount: BigDecimal,
gasLimit: Int,
destinationAddress: String,
dataToSign: String,
txData: ApproveTxData,
derivationPath: String?,
analyticsData: AnalyticsData,
): SendTxResult
@Suppress("LongParameterList")
/**
* Send transaction
*
* @param txData data to build a tx
* @param derivationPath for select right walletManager
* @param analyticsData data for send analytics event
* @return result of transaction
*/
@Throws(IllegalStateException::class)
suspend fun sendTransaction(
networkId: String,
amountToSend: BigDecimal,
feeAmount: BigDecimal,
gasLimit: Int,
destinationAddress: String,
dataToSign: String,
txData: SwapTxData,
isSwap: Boolean,
currencyToSend: Currency,
derivationPath: String?,
analyticsData: AnalyticsData,
): SendTxResult
/**

View file

@ -0,0 +1,14 @@
package com.tangem.lib.crypto.models
/**
* Analytics data for send events in analytics engine
*
* @property feeType type of fee (min,max,normal)
* @property tokenSymbol symbol
* @property permissionType optional parameter used for type tx approve
*/
data class AnalyticsData(
val feeType: String,
val tokenSymbol: String,
val permissionType: String? = null,
)

View file

@ -0,0 +1,20 @@
package com.tangem.lib.crypto.models
import java.math.BigDecimal
/**
* Tx data for create and make approve transaction
*
* @property networkId id of network
* @property feeAmount amount of fee
* @property gasLimit gasLimit for given tx
* @property destinationAddress address to send tx
* @property dataToSign data to sing with signer
*/
data class ApproveTxData(
val networkId: String,
val feeAmount: BigDecimal,
val gasLimit: Int,
val destinationAddress: String,
val dataToSign: String,
)

View file

@ -0,0 +1,24 @@
package com.tangem.lib.crypto.models
import java.math.BigDecimal
/**
* Tx data for create and make transaction
*
* @property networkId id of network
* @property feeAmount amount of fee
* @property gasLimit gasLimit for given tx
* @property destinationAddress address to send tx
* @property dataToSign data to sing with signer
* @property amountToSend amount of tx
* @property currencyToSend currency for tx
*/
data class SwapTxData(
val networkId: String,
val feeAmount: BigDecimal,
val gasLimit: Int,
val destinationAddress: String,
val dataToSign: String,
val amountToSend: BigDecimal,
val currencyToSend: Currency,
)