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

@ -1,31 +0,0 @@
package com.tangem.lib.crypto
import com.tangem.lib.crypto.models.ProxyAmount
/**
* Provider for user tokens data
*/
interface UserWalletManager {
/**
* Returns user walletId or empty string
*/
fun getWalletId(): String
suspend fun hideAllTokens()
/**
* Returns wallet public address for token
*
* @param networkId for currency
* @param derivationPath if null uses default
*/
@Throws(IllegalStateException::class)
suspend fun getWalletAddress(networkId: String, derivationPath: String?): String
@Throws(IllegalStateException::class)
suspend fun getNativeTokenBalance(networkId: String, derivationPath: String?): ProxyAmount?
@Throws(IllegalStateException::class)
suspend fun getLastTransactionHash(networkId: String, derivationPath: String?): String?
}

View file

@ -1,14 +0,0 @@
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

@ -1,20 +0,0 @@
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

@ -1,29 +0,0 @@
package com.tangem.lib.crypto.models
/**
* Currency data class that can be native blockchain Token
* or custom Token (used in this lib to replace and divide logic Currency from app module)
*/
sealed class Currency(
open val id: String,
open val name: String,
open val symbol: String,
open val networkId: String,
) {
data class NativeToken(
override val id: String,
override val name: String,
override val symbol: String,
override val networkId: String,
) : Currency(id, name, symbol, networkId)
class NonNativeToken(
override val id: String,
override val name: String,
override val symbol: String,
override val networkId: String,
val contractAddress: String,
val decimalCount: Int,
) : Currency(id, name, symbol, networkId)
}

View file

@ -1,23 +0,0 @@
package com.tangem.lib.crypto.models
import java.math.BigDecimal
/**
* Proxy amount is always has a Coin type
*
* @property currencySymbol
* @property value amount in [BigDecimal]
* @property decimals count for token
*/
data class ProxyAmount(
val currencySymbol: String,
var value: BigDecimal,
val decimals: Int,
) {
companion object {
fun empty(): ProxyAmount {
return ProxyAmount("", BigDecimal.ZERO, 0)
}
}
}

View file

@ -1,7 +0,0 @@
package com.tangem.lib.crypto.models
data class ProxyFiatCurrency(
val code: String,
val name: String,
val symbol: String,
)

View file

@ -1,25 +0,0 @@
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
*/
// TODO split to cex,dex
data class SwapTxData(
val networkId: String,
val feeAmount: BigDecimal,
val gasLimit: Int,
val destinationAddress: String,
val dataToSign: String,
val amountToSend: BigDecimal,
val currencyToSend: Currency,
)

View file

@ -1,11 +0,0 @@
package com.tangem.lib.crypto.models.transactions
sealed interface SendTxResult {
object Success : SendTxResult
object UserCancelledError : SendTxResult
data class TangemSdkError(val code: Int, val cause: Throwable?) : SendTxResult
data class BlockchainSdkError(val code: Int, val cause: Throwable?) : SendTxResult
data class NetworkError(val ex: Exception? = null) : SendTxResult
data class UnknownError(val ex: Exception? = null) : SendTxResult
}