Updated on 2026-08-14
|
|
@ -133,11 +133,29 @@ internal class DefaultLegacyWalletConnectRepository(
|
|||
return
|
||||
}
|
||||
|
||||
val optionalMissingNetwork = findMissingNetworks(
|
||||
namespaces = sessionProposal.optionalNamespaces,
|
||||
userNamespaces = this@DefaultLegacyWalletConnectRepository.userNamespaces ?: emptyMap(),
|
||||
)
|
||||
|
||||
val optionalWithoutMissingNetworks = removeMissingNetworks(
|
||||
namespaces = sessionProposal.optionalNamespaces,
|
||||
userNamespaces = this@DefaultLegacyWalletConnectRepository.userNamespaces ?: emptyMap(),
|
||||
)
|
||||
|
||||
// for cases when optionalNamespaces is not empty but we doesn't support none of them
|
||||
if (optionalMissingNetwork.isNotEmpty() && optionalWithoutMissingNetworks.isEmpty()) {
|
||||
Timber.i("Not added optional blockchains: $optionalMissingNetwork")
|
||||
scope.launch {
|
||||
_events.emit(
|
||||
WalletConnectEvents.SessionApprovalError(
|
||||
WalletConnectError.ApprovalErrorMissingNetworks(optionalMissingNetwork.toList()),
|
||||
),
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
val requiredChainIds = sessionProposal.requiredNamespaces.values.flatMap { it.chains ?: emptyList() }
|
||||
val optionalChainIds = optionalWithoutMissingNetworks.toList()
|
||||
val networks = (requiredChainIds + optionalChainIds)
|
||||
|
|
|
|||
|
|
@ -149,21 +149,18 @@ class WalletConnectInteractor(
|
|||
Timber.i("WalletConnect: event: $wcEvent")
|
||||
when (wcEvent) {
|
||||
is WalletConnectEvents.SessionProposal -> {
|
||||
val unsupportedNetworks = wcEvent.requiredChainIds.filter {
|
||||
blockchainHelper.chainIdToNetworkIdOrNull(it) == null
|
||||
}
|
||||
|
||||
val supportedNetworks = (wcEvent.requiredChainIds + wcEvent.optionalChainIds)
|
||||
.mapNotNull(blockchainHelper::chainIdToFullNameOrNull)
|
||||
.distinct()
|
||||
|
||||
if (unsupportedNetworks.isNotEmpty() || supportedNetworks.isEmpty()) {
|
||||
val unsupportedNetworks = wcEvent.requiredChainIds
|
||||
.filter { blockchainHelper.chainIdToNetworkIdOrNull(it) == null }
|
||||
if (unsupportedNetworks.isNotEmpty()) {
|
||||
val error = WalletConnectError.ApprovalErrorUnsupportedNetwork(unsupportedNetworks)
|
||||
handler.onSessionRejected(error)
|
||||
return@onEach
|
||||
}
|
||||
|
||||
handler.onProposalReceived(proposal = wcEvent, networksFormatted = supportedNetworks.toString())
|
||||
val networksFormatted = (wcEvent.requiredChainIds + wcEvent.optionalChainIds)
|
||||
.mapNotNull { blockchainHelper.chainIdToFullNameOrNull(it) }
|
||||
.distinct()
|
||||
.toString()
|
||||
handler.onProposalReceived(proposal = wcEvent, networksFormatted = networksFormatted)
|
||||
}
|
||||
is WalletConnectEvents.SessionApprovalError -> {
|
||||
val error = when (wcEvent.error) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.tangem.domain.staking.model.stakekit.action.StakingActionType
|
|||
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||
import com.tangem.domain.staking.analytics.StakeScreenSource
|
||||
import com.tangem.domain.staking.analytics.StakingAnalyticsEvent
|
||||
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
|
||||
import com.tangem.features.staking.impl.presentation.state.*
|
||||
|
||||
internal class StakingAnalyticSender(
|
||||
|
|
@ -75,14 +76,14 @@ internal class StakingAnalyticSender(
|
|||
)
|
||||
}
|
||||
|
||||
fun sendTransactionStakingAnalytics(value: StakingUiState) {
|
||||
fun sendTransactionStakingAnalytics(value: StakingUiState, cryptoCurrencyStatus: CryptoCurrencyStatus) {
|
||||
val validatorState = value.validatorState as? StakingStates.ValidatorState.Data
|
||||
val validatorName = validatorState?.chosenValidator?.name ?: return
|
||||
|
||||
analyticsEventHandler.send(
|
||||
Basic.TransactionSent(
|
||||
sentFrom = AnalyticsParam.TxSentFrom.Staking(
|
||||
blockchain = value.cryptoCurrencyName,
|
||||
blockchain = cryptoCurrencyStatus.currency.network.name,
|
||||
token = value.cryptoCurrencySymbol,
|
||||
feeType = AnalyticsParam.FeeType.Normal,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -349,7 +349,10 @@ internal class StakingModel @Inject constructor(
|
|||
stateController.update(SetConfirmationStateResetAssentTransformer(cryptoCurrencyStatus))
|
||||
},
|
||||
onSendSuccess = { txUrl ->
|
||||
stakingAnalyticSender.sendTransactionStakingAnalytics(stateController.value)
|
||||
stakingAnalyticSender.sendTransactionStakingAnalytics(
|
||||
stateController.value,
|
||||
cryptoCurrencyStatus,
|
||||
)
|
||||
transactionsInProgress.clear()
|
||||
stateController.update(SetConfirmationStateCompletedTransformer(txUrl, cryptoCurrencyStatus))
|
||||
},
|
||||
|
|
|
|||
|
|
@ -431,29 +431,16 @@ internal class WalletModel @Inject constructor(
|
|||
action.selectedWalletIndex
|
||||
}
|
||||
|
||||
/*
|
||||
* Should not show scroll animation if WalletScreen isn't in the background.
|
||||
* Example, reset card
|
||||
*/
|
||||
if (screenLifecycleProvider.isBackgroundState.value) {
|
||||
updateStateByDeleteWalletTransformer(
|
||||
selectedWalletIndex = newSelectedWalletIndex,
|
||||
deletedWalletId = action.deletedWalletId,
|
||||
)
|
||||
} else {
|
||||
withContext(dispatchers.io) { delay(timeMillis = 1000) }
|
||||
|
||||
scrollToWallet(
|
||||
prevIndex = action.deletedWalletIndex,
|
||||
newIndex = action.selectedWalletIndex,
|
||||
onConsume = {
|
||||
updateStateByDeleteWalletTransformer(
|
||||
selectedWalletIndex = newSelectedWalletIndex,
|
||||
deletedWalletId = action.deletedWalletId,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
scrollToWallet(
|
||||
prevIndex = action.deletedWalletIndex,
|
||||
newIndex = action.selectedWalletIndex,
|
||||
onConsume = {
|
||||
updateStateByDeleteWalletTransformer(
|
||||
selectedWalletIndex = newSelectedWalletIndex,
|
||||
deletedWalletId = action.deletedWalletId,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private fun updateStateByDeleteWalletTransformer(selectedWalletIndex: Int, deletedWalletId: UserWalletId) {
|
||||
|
|
@ -485,15 +472,20 @@ internal class WalletModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun scrollToWallet(prevIndex: Int, newIndex: Int, onConsume: () -> Unit = {}) {
|
||||
stateHolder.update(
|
||||
ScrollToWalletTransformer(
|
||||
prevIndex = prevIndex,
|
||||
newIndex = newIndex,
|
||||
currentStateProvider = Provider(action = stateHolder::value),
|
||||
stateUpdater = { newState -> stateHolder.update { newState } },
|
||||
onConsume = onConsume,
|
||||
),
|
||||
)
|
||||
// Should not show scroll animation if WalletScreen isn't in the background.
|
||||
if (screenLifecycleProvider.isBackgroundState.value) {
|
||||
onConsume()
|
||||
} else {
|
||||
stateHolder.update(
|
||||
ScrollToWalletTransformer(
|
||||
prevIndex = prevIndex,
|
||||
newIndex = newIndex,
|
||||
currentStateProvider = Provider(action = stateHolder::value),
|
||||
stateUpdater = { newState -> stateHolder.update { newState } },
|
||||
onConsume = onConsume,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
inner class AskBiometryModelCallbacks : AskBiometryComponent.ModelCallbacks {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,12 @@ internal enum class Wallet2CobrandImage(
|
|||
batchIds = setOf("AF33"),
|
||||
),
|
||||
|
||||
BitcoinPizza2(
|
||||
cards2ResId = R.drawable.ill_pizza_day2_card2_120_106,
|
||||
cards3ResId = R.drawable.ill_pizza_day2_card3_120_106,
|
||||
batchIds = setOf("AF990019"),
|
||||
),
|
||||
|
||||
BTC365(
|
||||
cards2ResId = R.drawable.ill_btc365_card2_120_106,
|
||||
cards3ResId = R.drawable.ill_btc365_card3_120_106,
|
||||
|
|
@ -67,6 +73,12 @@ internal enum class Wallet2CobrandImage(
|
|||
batchIds = setOf("BB000013"),
|
||||
),
|
||||
|
||||
Chilliz(
|
||||
cards2ResId = R.drawable.ill_chilliz_card2_120_106,
|
||||
cards3ResId = R.drawable.ill_chilliz_card3_120_106,
|
||||
batchIds = setOf("BB000016"),
|
||||
),
|
||||
|
||||
CoinMetrica(
|
||||
cards2ResId = R.drawable.ill_coin_metrica_card2_120_106,
|
||||
cards3ResId = R.drawable.ill_coin_metrica_card3_120_106,
|
||||
|
|
@ -206,6 +218,12 @@ internal enum class Wallet2CobrandImage(
|
|||
batchIds = setOf("AF43", "AF44", "AF45", "AF78", "AF79", "AF80"),
|
||||
),
|
||||
|
||||
RamenCat(
|
||||
cards2ResId = R.drawable.ill_ramen_cat_cards2_120_106,
|
||||
cards3ResId = R.drawable.ill_ramen_cat_cards3_120_106,
|
||||
batchIds = setOf("AF990006", "AF990007", "AF990008"),
|
||||
),
|
||||
|
||||
RedPanda(
|
||||
cards2ResId = R.drawable.ill_red_panda_card2_120_106,
|
||||
cards3ResId = R.drawable.ill_red_panda_card3_120_106,
|
||||
|
|
@ -218,6 +236,12 @@ internal enum class Wallet2CobrandImage(
|
|||
batchIds = setOf("BB000012"),
|
||||
),
|
||||
|
||||
Sakura(
|
||||
cards2ResId = R.drawable.ill_sakura_card2_120_106,
|
||||
cards3ResId = R.drawable.ill_sakura_card3_120_106,
|
||||
batchIds = setOf("AF990029", "AF990030", "AF990031"),
|
||||
),
|
||||
|
||||
SatoshiFriends(
|
||||
cards2ResId = R.drawable.ill_satoshi_card2_120_106,
|
||||
cards3ResId = R.drawable.ill_satoshi_card3_120_106,
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 30 KiB |