Updated on 2026-08-14
This commit is contained in:
parent
3580350769
commit
8aba7b07d1
49 changed files with 172 additions and 134 deletions
|
|
@ -15,6 +15,7 @@ data class EvmTransactionScanRequest(
|
|||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
@Suppress("BooleanPropertyNaming")
|
||||
data class EvmTransactionBulkScanRequest(
|
||||
@Json(name = "chain") val chain: String,
|
||||
@Json(name = "options") val options: List<String>,
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ internal class DevApiConfigsManager(
|
|||
.onEach { savedEnvironments ->
|
||||
val apiConfigs = configs.value
|
||||
|
||||
configs.value = apiConfigs.mapValues {
|
||||
val (config, currentEnvironment) = it
|
||||
configs.value = apiConfigs.mapValues { entry ->
|
||||
val (config, currentEnvironment) = entry
|
||||
|
||||
savedEnvironments[config.id.name] ?: currentEnvironment
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ internal class MockApiConfigsManager(
|
|||
super.addListener(listener)
|
||||
|
||||
configs
|
||||
.map { it.entries.firstOrNull { it.key.id == listener.id } }
|
||||
.map { map -> map.entries.firstOrNull { it.key.id == listener.id } }
|
||||
.filterNotNull()
|
||||
.onEach { (apiConfig, currentEnvironment) ->
|
||||
listener.onChange(
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.squareup.moshi.JsonClass
|
|||
import java.math.BigDecimal
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
@Suppress("BooleanPropertyNaming")
|
||||
data class ConstructTransactionRequestBody(
|
||||
@Json(name = "gasArgs")
|
||||
val gasArgs: GasArgs? = null,
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ class AssetLoader @Inject constructor(
|
|||
if (parsedConfig == null) Timber.e(IllegalStateException("Parsed config [$fileName] is null"))
|
||||
parsedConfig
|
||||
},
|
||||
onFailure = {
|
||||
Timber.e(it, "Failed to load config [$fileName] from assets")
|
||||
onFailure = { throwable ->
|
||||
Timber.e(throwable, "Failed to load config [$fileName] from assets")
|
||||
null
|
||||
},
|
||||
)
|
||||
|
|
@ -79,8 +79,8 @@ class AssetLoader @Inject constructor(
|
|||
if (parsedConfig == null) Timber.e(IllegalStateException("Parsed config [$fileName] is null"))
|
||||
parsedConfig.orEmpty()
|
||||
},
|
||||
onFailure = {
|
||||
Timber.e(it, "Failed to load config [$fileName] from assets")
|
||||
onFailure = { throwable ->
|
||||
Timber.e(throwable, "Failed to load config [$fileName] from assets")
|
||||
emptyMap()
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ internal class DefaultExpressServiceLoader @Inject constructor(
|
|||
|
||||
@Suppress("SuspendFunWithFlowReturnType")
|
||||
private suspend fun getInitializationStatusInternal(userWalletId: UserWalletId): InitializationStatusFlow {
|
||||
val initializationStatus = initializationStatuses.value.get(key = userWalletId)
|
||||
val initializationStatus = initializationStatuses.value[userWalletId]
|
||||
if (initializationStatus != null) return initializationStatus
|
||||
|
||||
val cached = expressAssetsStore.getSyncOrNull(userWalletId)
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ internal class DefaultAvailableAppCurrenciesStore(
|
|||
|
||||
override suspend fun store(response: CurrenciesResponse) {
|
||||
val currencies = response.currencies
|
||||
.map {
|
||||
it.copy(
|
||||
iconSmallUrl = response.imageHost?.plus(IMAGE_SMALL)?.format(it.id),
|
||||
iconMediumUrl = response.imageHost?.plus(IMAGE_MEDIUM)?.format(it.id),
|
||||
.map { currency ->
|
||||
currency.copy(
|
||||
iconSmallUrl = response.imageHost?.plus(IMAGE_SMALL)?.format(currency.id),
|
||||
iconMediumUrl = response.imageHost?.plus(IMAGE_MEDIUM)?.format(currency.id),
|
||||
)
|
||||
}
|
||||
.associateBy(CurrenciesResponse.Currency::code)
|
||||
|
|
|
|||
|
|
@ -32,16 +32,16 @@ object NFTSdkAssetConverter : TwoWayConverter<Pair<Network, SdkNFTAsset>, NFTAss
|
|||
label = rarity.label,
|
||||
)
|
||||
},
|
||||
media = asset.media?.let {
|
||||
media = asset.media?.let { media ->
|
||||
NFTAsset.Media(
|
||||
animationUrl = it.animationUrl,
|
||||
imageUrl = it.imageUrl,
|
||||
animationUrl = media.animationUrl,
|
||||
imageUrl = media.imageUrl,
|
||||
)
|
||||
},
|
||||
traits = asset.traits.map {
|
||||
traits = asset.traits.map { trait ->
|
||||
NFTAsset.Trait(
|
||||
name = it.name,
|
||||
value = it.value,
|
||||
name = trait.name,
|
||||
value = trait.value,
|
||||
)
|
||||
},
|
||||
source = StatusSource.CACHE,
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ class NFTSdkCollectionConverter(
|
|||
.filter {
|
||||
it.id !is NFTAsset.Identifier.Unknown
|
||||
}
|
||||
.let {
|
||||
if (it.isEmpty()) {
|
||||
.let { items ->
|
||||
if (items.isEmpty()) {
|
||||
NFTCollection.Assets.Empty
|
||||
} else {
|
||||
NFTCollection.Assets.Value(
|
||||
items = it,
|
||||
items = items,
|
||||
source = StatusSource.CACHE,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ internal object PreferencesDataStore {
|
|||
|
||||
private fun createCorruptionHandler(): ReplaceFileCorruptionHandler<Preferences> {
|
||||
return ReplaceFileCorruptionHandler(
|
||||
produceNewData = {
|
||||
Timber.w(it)
|
||||
produceNewData = { corruptionException ->
|
||||
Timber.w(corruptionException)
|
||||
emptyPreferences()
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ inline fun <reified T> AppPreferencesStore.getObject(key: Preferences.Key<String
|
|||
val adapter = moshi.adapter(T::class.java)
|
||||
emitAll(
|
||||
data.map { preferences ->
|
||||
preferences[key]?.let {
|
||||
preferences[key]?.let { value ->
|
||||
try {
|
||||
adapter.fromJson(it)
|
||||
adapter.fromJson(value)
|
||||
} catch (e: JsonDataException) {
|
||||
null
|
||||
}
|
||||
|
|
@ -59,9 +59,9 @@ suspend inline fun <reified T> AppPreferencesStore.getObjectSyncOrNull(key: Pref
|
|||
val adapter = moshi.adapter(T::class.java) // TODO: Support parameterized types
|
||||
data.firstOrNull()
|
||||
?.get(key)
|
||||
?.let {
|
||||
?.let { value ->
|
||||
try {
|
||||
adapter.fromJson(it)
|
||||
adapter.fromJson(value)
|
||||
} catch (e: JsonDataException) {
|
||||
null
|
||||
}
|
||||
|
|
@ -76,9 +76,9 @@ suspend inline fun <reified T> AppPreferencesStore.getObjectSyncOrDefault(
|
|||
val adapter = moshi.adapter(T::class.java)
|
||||
data.firstOrNull()
|
||||
?.get(key)
|
||||
?.let {
|
||||
?.let { value ->
|
||||
try {
|
||||
adapter.fromJson(it)
|
||||
adapter.fromJson(value)
|
||||
} catch (e: JsonDataException) {
|
||||
default
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ inline fun <reified V> AppPreferencesStore.getObjectMap(key: Preferences.Key<Str
|
|||
val adapter = moshi.adapter<Map<String, V>>(type)
|
||||
|
||||
emitAll(
|
||||
data.map { it[key]?.let(adapter::fromJson) ?: emptyMap() },
|
||||
data.map { it[key]?.let(adapter::fromJson).orEmpty() },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -180,7 +180,7 @@ inline fun <reified T> AppPreferencesStore.getObjectSet(key: Preferences.Key<Str
|
|||
val adapter = moshi.adapter<Set<T>>(Types.newParameterizedType(Set::class.java, T::class.java))
|
||||
emitAll(
|
||||
data.map {
|
||||
it[key]?.let(adapter::fromJson) ?: emptySet()
|
||||
it[key]?.let(adapter::fromJson).orEmpty()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ internal class DefaultSwapBestRateAnimationStore(
|
|||
* If true, reset flag to false
|
||||
*/
|
||||
override suspend fun getSyncOrNull(): Boolean {
|
||||
val shouldShowBestRateAnimation = dataStore.getSyncOrNull() ?: true
|
||||
val shouldShowBestRateAnimation = dataStore.getSyncOrNull() != false
|
||||
if (shouldShowBestRateAnimation) {
|
||||
dataStore.store(false)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ internal class DefaultExpressAssetsStore(
|
|||
runtimeStore.store(userWalletId.stringValue, item)
|
||||
}
|
||||
launch {
|
||||
persistenceStore.updateData {
|
||||
it.toMutableMap().apply {
|
||||
persistenceStore.updateData { assetsByWalletId ->
|
||||
assetsByWalletId.toMutableMap().apply {
|
||||
put(userWalletId.stringValue, item)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ internal object PendingActionConverter : Converter<BalanceDTO.PendingAction, Pen
|
|||
passthrough = value.passthrough,
|
||||
args = with(value.args) {
|
||||
PendingAction.PendingActionArgs(
|
||||
amount = this?.amount?.let {
|
||||
amount = this?.amount?.let { amount ->
|
||||
PendingAction.PendingActionArgs.Amount(
|
||||
required = it.required,
|
||||
minimum = it.minimum,
|
||||
maximum = it.maximum,
|
||||
required = amount.required,
|
||||
minimum = amount.minimum,
|
||||
maximum = amount.maximum,
|
||||
)
|
||||
},
|
||||
duration = this?.duration?.let { duration ->
|
||||
|
|
@ -28,10 +28,10 @@ internal object PendingActionConverter : Converter<BalanceDTO.PendingAction, Pen
|
|||
},
|
||||
validatorAddress = this?.validatorAddress?.required,
|
||||
validatorAddresses = this?.validatorAddresses?.required,
|
||||
tronResource = this?.tronResource?.let {
|
||||
tronResource = this?.tronResource?.let { tronResource ->
|
||||
PendingAction.PendingActionArgs.TronResource(
|
||||
required = it.required,
|
||||
options = it.options,
|
||||
required = tronResource.required,
|
||||
options = tronResource.options,
|
||||
)
|
||||
},
|
||||
signatureVerification = this?.signatureVerification?.required,
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@ internal class DefaultWalletManagersStore(
|
|||
): WalletManager? {
|
||||
val walletManagers = getSyncOrNull(userWalletId)
|
||||
|
||||
return walletManagers?.singleOrNull {
|
||||
it.wallet.blockchain == blockchain &&
|
||||
it.wallet.publicKey.derivationPath?.rawPath == derivationPath
|
||||
return walletManagers?.singleOrNull { walletManager ->
|
||||
walletManager.wallet.blockchain == blockchain &&
|
||||
walletManager.wallet.publicKey.derivationPath?.rawPath == derivationPath
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getAllSync(userWalletId: UserWalletId): List<WalletManager> {
|
||||
return getSyncOrNull(userWalletId) ?: emptyList()
|
||||
return getSyncOrNull(userWalletId).orEmpty()
|
||||
}
|
||||
|
||||
override suspend fun store(userWalletId: UserWalletId, walletManager: WalletManager) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue