feat: order and label per-chain token breakdown by ecosystem + standard

The per-chain list shown when picking an action (Send/Receive/Swap/Buy/Sell/
Gift) for a token that exists on multiple chains (e.g. USDT) now orders
Ethereum and Tron right after the existing Pezkuwi/Polkadot/Kusama priority
chains instead of falling into the alphabetical "everything else" bucket,
and appends a token-standard label - "(PEZ-20)"/"(ERC-20)"/"(TRC-20)" - to
disambiguate which issuance this is, since a bare chain name alone doesn't
convey that.

The label is intentionally chain-specific, not derived from Chain.Asset.Type,
since every Statemine-type chain (Polkadot AH, Kusama AH, Pezkuwi AH) shares
the same asset type but only Pezkuwi AH's issuance needs the PEZ-20 label.
This commit is contained in:
2026-07-11 06:44:35 -07:00
parent e1679367d7
commit e055e1a84c
3 changed files with 38 additions and 10 deletions
@@ -16,8 +16,10 @@ import io.novafoundation.nova.feature_assets.presentation.flow.network.model.Net
import io.novafoundation.nova.feature_wallet_api.presentation.formatters.amount.AmountFormatter
import io.novafoundation.nova.feature_wallet_api.presentation.formatters.amount.formatAmountToAmountModel
import io.novafoundation.nova.feature_wallet_api.presentation.formatters.amount.model.AmountConfig
import io.novafoundation.nova.runtime.ext.assetStandardLabelOrNull
import io.novafoundation.nova.runtime.multiNetwork.ChainRegistry
import io.novafoundation.nova.runtime.multiNetwork.asset
import io.novafoundation.nova.runtime.multiNetwork.chain.model.Chain
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.map
@@ -73,7 +75,7 @@ abstract class NetworkFlowViewModel(
NetworkFlowRvItem(
it.chain.id,
it.asset.token.configuration.id,
it.chain.name,
it.chain.displayNameWithAssetStandard(),
it.chain.icon,
amountFormatter.formatAmountToAmountModel(
amount = getAssetBalance(it).amount,
@@ -83,4 +85,10 @@ abstract class NetworkFlowViewModel(
)
}
}
private fun Chain.displayNameWithAssetStandard(): String {
val standardLabel = assetStandardLabelOrNull ?: return name
return "$name ($standardLabel)"
}
}