Updated on 2026-08-14
This commit is contained in:
commit
8a9422304a
19 changed files with 126 additions and 93 deletions
|
|
@ -274,7 +274,7 @@ class TapWalletManager {
|
|||
val walletManagers = if (
|
||||
primaryTokens.isNotEmpty() &&
|
||||
primaryWalletManager != null &&
|
||||
primaryBlockchain != null
|
||||
primaryBlockchain != null && primaryBlockchain != Blockchain.Unknown
|
||||
) {
|
||||
val blockchainsWithoutPrimary = savedCurrencies.filterNot { it.blockchain == primaryBlockchain }
|
||||
walletManagerFactory.makeWalletManagersForApp(
|
||||
|
|
@ -288,7 +288,9 @@ class TapWalletManager {
|
|||
WalletAction.MultiWallet.AddBlockchains(savedCurrencies, walletManagers),
|
||||
)
|
||||
savedCurrencies.map {
|
||||
dispatchOnMain(WalletAction.MultiWallet.AddTokens(it.tokens, it))
|
||||
if (it.tokens.isNotEmpty()) {
|
||||
dispatchOnMain(WalletAction.MultiWallet.AddTokens(it.tokens, it))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ data class Currency(
|
|||
val name: String,
|
||||
val symbol: String,
|
||||
val iconUrl: String,
|
||||
val contracts: List<Contract>?
|
||||
val contracts: List<Contract>
|
||||
) {
|
||||
|
||||
companion object {
|
||||
|
|
@ -45,9 +45,19 @@ data class Currency(
|
|||
name = currency.name,
|
||||
symbol = currency.symbol,
|
||||
iconUrl = getIconUrl(currency.id),
|
||||
contracts = currency.contracts?.toContracts(isTestNet)
|
||||
contracts = prepareListOfContracts(currency.contracts, currency.id, isTestNet)
|
||||
)
|
||||
}
|
||||
|
||||
private fun prepareListOfContracts(
|
||||
contractsFromJson: List<ContractFromJson>?,
|
||||
currencyId: String,
|
||||
isTestNet: Boolean
|
||||
): List<Contract> {
|
||||
val mainNetwork = Contract.fromCurrencyId(currencyId, isTestNet)
|
||||
val contracts = contractsFromJson?.toContracts(isTestNet) ?: emptyList()
|
||||
return (listOfNotNull(mainNetwork) + contracts).distinct()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -72,6 +82,18 @@ data class Contract(
|
|||
)
|
||||
}
|
||||
|
||||
fun fromCurrencyId(currencyId: String, isTestNet: Boolean): Contract? {
|
||||
val networkId = if (isTestNet) currencyId + TESTNET else currencyId
|
||||
val blockchain = Blockchain.fromNetworkId(networkId) ?: return null
|
||||
return Contract(
|
||||
networkId = networkId,
|
||||
blockchain = blockchain,
|
||||
address = blockchain.currency,
|
||||
decimalCount = blockchain.decimals(),
|
||||
iconUrl = getIconUrl(networkId)
|
||||
)
|
||||
}
|
||||
|
||||
const val TESTNET = "-testnet"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue