Updated on 2026-08-14

This commit is contained in:
Tangem 2023-03-06 18:19:26 +03:00
parent fec81d0697
commit 25d39f9f0b
11 changed files with 81 additions and 71 deletions

View file

@ -8,6 +8,7 @@ import java.math.BigDecimal
interface TransactionManager {
@Suppress("LongParameterList")
@Throws(IllegalStateException::class)
suspend fun sendApproveTransaction(
networkId: String,
@ -15,6 +16,7 @@ interface TransactionManager {
gasLimit: Int,
destinationAddress: String,
dataToSign: String,
derivationPath: String?,
): SendTxResult
@Suppress("LongParameterList")
@ -28,8 +30,10 @@ interface TransactionManager {
dataToSign: String,
isSwap: Boolean,
currencyToSend: Currency,
derivationPath: String?,
): SendTxResult
@Suppress("LongParameterList")
@Throws(IllegalStateException::class)
suspend fun getFee(
networkId: String,
@ -37,13 +41,14 @@ interface TransactionManager {
currencyToSend: Currency,
destinationAddress: String,
data: String?,
derivationPath: String?,
): ProxyFee
@Throws(IllegalStateException::class)
fun getNativeTokenDecimals(networkId: String): Int
@Throws(IllegalStateException::class)
suspend fun updateWalletManager(networkId: String)
suspend fun updateWalletManager(networkId: String, derivationPath: String?)
fun calculateFee(networkId: String, gasPrice: String, estimatedGas: Int): BigDecimal

View file

@ -29,15 +29,16 @@ interface UserWalletManager {
* @param currency to receive referral payments
*/
@Throws(IllegalStateException::class)
suspend fun isTokenAdded(currency: Currency): Boolean
suspend fun isTokenAdded(currency: Currency, derivationPath: String?): Boolean
/**
* Adds token to wallet if its not
*
* @param currency to add to wallet
* @param derivationPath if null uses default
*/
@Throws(IllegalStateException::class)
suspend fun addToken(currency: Currency)
suspend fun addToken(currency: Currency, derivationPath: String?)
fun refreshWallet()
@ -45,21 +46,27 @@ interface UserWalletManager {
* Returns wallet public address for token
*
* @param networkId for currency
* @param derivationPath if null uses default
*/
@Throws(IllegalStateException::class)
fun getWalletAddress(networkId: String): String
fun getWalletAddress(networkId: String, derivationPath: String?): String
/**
* Return balances from wallet found by networkId
*
* @param networkId
* @param derivationPath if null uses default
* @return map of <Symbol, [ProxyAmount]>
*/
@Throws(IllegalStateException::class)
suspend fun getCurrentWalletTokensBalance(networkId: String, extraTokens: List<Currency>): Map<String, ProxyAmount>
suspend fun getCurrentWalletTokensBalance(
networkId: String,
extraTokens: List<Currency>,
derivationPath: String?,
): Map<String, ProxyAmount>
@Throws(IllegalStateException::class)
fun getNativeTokenBalance(networkId: String): ProxyAmount?
fun getNativeTokenBalance(networkId: String, derivationPath: String?): ProxyAmount?
/**
* @param networkId
@ -74,5 +81,5 @@ interface UserWalletManager {
fun getUserAppCurrency(): ProxyFiatCurrency
@Throws(IllegalStateException::class)
fun getLastTransactionHash(networkId: String): String?
fun getLastTransactionHash(networkId: String, derivationPath: String?): String?
}