Updated on 2026-08-14
This commit is contained in:
commit
e1aa83f8b7
6 changed files with 67 additions and 20 deletions
|
|
@ -121,5 +121,25 @@
|
|||
},
|
||||
"0xd0e30db0": {
|
||||
"name":"deposit"
|
||||
},
|
||||
"0x9f50973e": {
|
||||
"info":"swapExactETCForTokens",
|
||||
"source":"https://etc.blockscout.com/tx/0xc748777532541e51368089c71c93cb0e410bf93c13908bea2d07ecbbb65aa839",
|
||||
"name":"swap"
|
||||
},
|
||||
"0x3417c606": {
|
||||
"info":"swapETCForExactTokens",
|
||||
"source":"https://etc.blockscout.com/tx/0xb2c5a4418112c0b29654642f9c724bf7b2f9056fc6dd2c22209ed89fe982f0af",
|
||||
"name":"swap"
|
||||
},
|
||||
"0x65f705d3": {
|
||||
"info":"swapExactTokensForETC",
|
||||
"source":"https://etc.blockscout.com/tx/0xdd5d372e8d770e436bd44367bbc64b57d02e7339a1f1b849f7a995a57c65f3dd",
|
||||
"name":"swap"
|
||||
},
|
||||
"0xb4bc722b": {
|
||||
"info":"swapTokensForExactETC",
|
||||
"source":"https://etc.blockscout.com/tx/0xd79e03ca6b71529c94d576ff78c55b4371e2ef3ff8f9a47007995e5b9e77f879",
|
||||
"name":"swap"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -463,11 +463,7 @@ class DefaultWalletManagersFacade(
|
|||
derivationPath = network.derivationPath.value,
|
||||
)
|
||||
|
||||
val txData = walletManager?.createTransaction(amount, fee, destination)?.copy(
|
||||
extras = null, // todo add memo [[REDACTED_JIRA]]
|
||||
)
|
||||
|
||||
return txData
|
||||
return walletManager?.createTransaction(amount, fee, destination)
|
||||
}
|
||||
|
||||
override suspend fun sendTransaction(
|
||||
|
|
|
|||
|
|
@ -97,12 +97,8 @@ class GetCryptoCurrencyActionsUseCase(
|
|||
// copy address
|
||||
activeList.add(TokenActionsState.ActionState.CopyAddress(true))
|
||||
|
||||
// buy
|
||||
if (rampManager.availableForBuy(cryptoCurrency)) {
|
||||
activeList.add(TokenActionsState.ActionState.Buy(true))
|
||||
} else {
|
||||
disabledList.add(TokenActionsState.ActionState.Buy(false))
|
||||
}
|
||||
// receive
|
||||
activeList.add(TokenActionsState.ActionState.Receive(true))
|
||||
|
||||
// send
|
||||
if (isSendDisabled(cryptoCurrencyStatus = cryptoCurrencyStatus, coinStatus = coinStatus)) {
|
||||
|
|
@ -111,9 +107,6 @@ class GetCryptoCurrencyActionsUseCase(
|
|||
activeList.add(TokenActionsState.ActionState.Send(true))
|
||||
}
|
||||
|
||||
// receive
|
||||
activeList.add(TokenActionsState.ActionState.Receive(true))
|
||||
|
||||
// swap
|
||||
if (marketCryptoCurrencyRepository.isExchangeable(userWalletId, cryptoCurrency)) {
|
||||
activeList.add(TokenActionsState.ActionState.Swap(true))
|
||||
|
|
@ -121,6 +114,13 @@ class GetCryptoCurrencyActionsUseCase(
|
|||
disabledList.add(TokenActionsState.ActionState.Swap(false))
|
||||
}
|
||||
|
||||
// buy
|
||||
if (rampManager.availableForBuy(cryptoCurrency)) {
|
||||
activeList.add(TokenActionsState.ActionState.Buy(true))
|
||||
} else {
|
||||
disabledList.add(TokenActionsState.ActionState.Buy(false))
|
||||
}
|
||||
|
||||
// sell
|
||||
if (rampManager.availableForSell(cryptoCurrency)) {
|
||||
activeList.add(TokenActionsState.ActionState.Sell(true))
|
||||
|
|
|
|||
|
|
@ -41,7 +41,12 @@ private fun isAssignableValue(value: String): Boolean {
|
|||
}
|
||||
}
|
||||
|
||||
private enum class XlmMemoType { TEXT, ID }
|
||||
fun determineXlmMemoType(value: String): XlmMemoType = when {
|
||||
value.isNotEmpty() && value.isDigitsOnly() -> XlmMemoType.ID
|
||||
else -> XlmMemoType.TEXT
|
||||
}
|
||||
|
||||
enum class XlmMemoType { TEXT, ID }
|
||||
|
||||
private const val XRP_TAG_MAX_NUMBER = 4294967295
|
||||
private const val XLM_MEMO_MAX_LENGTH = 28
|
||||
|
|
@ -6,8 +6,15 @@ import androidx.compose.runtime.setValue
|
|||
import androidx.lifecycle.*
|
||||
import androidx.paging.PagingData
|
||||
import arrow.core.getOrElse
|
||||
import com.tangem.blockchain.blockchains.binance.BinanceTransactionExtras
|
||||
import com.tangem.blockchain.blockchains.cosmos.CosmosTransactionExtras
|
||||
import com.tangem.blockchain.blockchains.stellar.StellarMemo
|
||||
import com.tangem.blockchain.blockchains.stellar.StellarTransactionExtras
|
||||
import com.tangem.blockchain.blockchains.ton.TonTransactionExtras
|
||||
import com.tangem.blockchain.blockchains.xrp.XrpAddressService
|
||||
import com.tangem.blockchain.blockchains.xrp.XrpTransactionBuilder
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.TransactionExtras
|
||||
import com.tangem.blockchain.common.address.Address
|
||||
import com.tangem.blockchain.common.transaction.Fee
|
||||
import com.tangem.blockchain.common.transaction.TransactionFee
|
||||
|
|
@ -80,7 +87,7 @@ internal class SendViewModel @Inject constructor(
|
|||
|
||||
private val selectedAppCurrencyFlow: StateFlow<AppCurrency> = createSelectedAppCurrencyFlow()
|
||||
|
||||
private var inneRrouter: InnerSendRouter by Delegates.notNull()
|
||||
private var innerRouter: InnerSendRouter by Delegates.notNull()
|
||||
private var stateRouter: StateRouter by Delegates.notNull()
|
||||
|
||||
private val stateFactory = SendStateFactory(
|
||||
|
|
@ -111,7 +118,7 @@ internal class SendViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
fun setRouter(router: InnerSendRouter, stateRouter: StateRouter) {
|
||||
inneRrouter = router
|
||||
innerRouter = router
|
||||
this.stateRouter = stateRouter
|
||||
uiState = uiState.copy(currentState = stateRouter.currentState)
|
||||
}
|
||||
|
|
@ -428,7 +435,7 @@ internal class SendViewModel @Inject constructor(
|
|||
destination = recipient.value,
|
||||
userWalletId = userWalletId,
|
||||
network = cryptoCurrency.network,
|
||||
) ?: return
|
||||
)?.copy(extras = getMemoExtras(cryptoCurrency.network.id.value, memo?.value)) ?: return
|
||||
|
||||
sendTransactionUseCase(
|
||||
txData = txData,
|
||||
|
|
@ -475,7 +482,7 @@ internal class SendViewModel @Inject constructor(
|
|||
|
||||
override fun showFee() = stateRouter.showFee(isFromSend = true)
|
||||
|
||||
override fun onExploreClick(txUrl: String) = inneRrouter.openUrl(txUrl)
|
||||
override fun onExploreClick(txUrl: String) = innerRouter.openUrl(txUrl)
|
||||
|
||||
private fun getTxUrl(hash: String): String {
|
||||
val blockchain = Blockchain.fromId(cryptoCurrency.network.id.value)
|
||||
|
|
@ -491,6 +498,25 @@ internal class SendViewModel @Inject constructor(
|
|||
}
|
||||
// endregion
|
||||
|
||||
private fun getMemoExtras(networkId: String, memo: String?): TransactionExtras? {
|
||||
val blockchain = Blockchain.fromId(networkId)
|
||||
if (memo == null) return null
|
||||
return when (blockchain) {
|
||||
Blockchain.Stellar -> {
|
||||
val xmlMemo = when (determineXlmMemoType(memo)) {
|
||||
XlmMemoType.TEXT -> StellarMemo.Text(memo)
|
||||
XlmMemoType.ID -> StellarMemo.Id(memo.toBigInteger())
|
||||
}
|
||||
StellarTransactionExtras(xmlMemo)
|
||||
}
|
||||
Blockchain.Binance -> BinanceTransactionExtras(memo)
|
||||
Blockchain.XRP -> memo.toLongOrNull()?.let { XrpTransactionBuilder.XrpTransactionExtras(it) }
|
||||
Blockchain.Cosmos -> CosmosTransactionExtras(memo)
|
||||
Blockchain.TON -> TonTransactionExtras(memo)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val XRP_X_ADDRESS = 'X'
|
||||
private const val DEFAULT_VALUE = "0.00"
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ spr-client = "3.6.2"
|
|||
# endregion Other libraries
|
||||
|
||||
# region Tangem
|
||||
tangemBlockchainSdk = "develop-408"
|
||||
tangemBlockchainSdk = "develop-409"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "develop-312"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue