Skip to content

Commit

Permalink
Parse restrictedLocales (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang authored Dec 11, 2024
1 parent 194ebe5 commit ca1872b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.13.40"
version = "1.13.41"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ class V4Environment(
val tokens: IMap<String, TokenInfo>,
governance: EnvironmentGovernance?,
featureFlags: EnvironmentFeatureFlags,
val restrictedLocales: IList<String>
) : Environment(
id,
name,
Expand All @@ -471,6 +472,7 @@ class V4Environment(
linksData: Map<String, Any>?,
walletsData: Map<String, Any>?,
governanceData: Map<String, Any>?,
restrictedLocales: IList<String>,
): V4Environment? {
val name = parser.asString(data["name"])
val ethereumChainId = parser.asString(data["ethereumChainId"]) ?: return null
Expand Down Expand Up @@ -521,6 +523,7 @@ class V4Environment(
tokens = tokens,
governance = governance,
featureFlags = featureFlags,
restrictedLocales = restrictedLocales,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import exchange.dydx.abacus.utils.UIImplementations
import kollections.JsExport
import kollections.iListOf
import kollections.iMutableListOf
import kollections.toIList
import me.tatarka.inject.annotations.Inject

@JsExport
Expand Down Expand Up @@ -390,6 +391,9 @@ class AsyncAbacusStateManagerV2(
val linksData = parser.asNativeMap(items?.get("links"))
val walletsData = parser.asNativeMap(items?.get("wallets"))
val governanceData = parser.asNativeMap(items?.get("governance"))
val restrictedLocales = parser.asList(items?.get("restrictedLocales"))?.mapNotNull {
parser.asString(it)
}?.toIList() ?: iListOf()

if (items != null) {
val environmentsData = parser.asMap(items["environments"]) ?: return false
Expand All @@ -407,6 +411,7 @@ class AsyncAbacusStateManagerV2(
linksData = parser.asNativeMap(linksData?.get(dydxChainId)),
walletsData = parser.asNativeMap(walletsData?.get(dydxChainId)),
governanceData = parser.asNativeMap(governanceData?.get(dydxChainId)),
restrictedLocales = restrictedLocales,
) ?: continue
parsedEnvironments[environment.id] = environment
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,6 @@ data class AppConfigsV2(
) {
companion object {
val forApp = AppConfigsV2(
systemConfigs = SystemConfigs.forApp,
marketConfigs = MarketsConfigs.forApp,
accountConfigs = AccountConfigs.forApp,
onboardingConfigs = OnboardingConfigs.forApp,
vaultConfigs = VaultConfigs.forApp,
loadRemote = true,
triggerOrderToast = true,
)
val forAppWithIsolatedMargins = AppConfigsV2(
systemConfigs = SystemConfigs.forApp,
marketConfigs = MarketsConfigs.forApp,
accountConfigs = AccountConfigs.forAppWithIsolatedMargins,
Expand All @@ -243,16 +234,11 @@ data class AppConfigsV2(
loadRemote = true,
triggerOrderToast = true,
)
val forAppDebug = AppConfigsV2(
systemConfigs = SystemConfigs.forApp,
marketConfigs = MarketsConfigs.forApp,
accountConfigs = AccountConfigs.forAppWithIsolatedMargins,
onboardingConfigs = OnboardingConfigs.forApp,
vaultConfigs = VaultConfigs.forApp,

val forAppDebug = forApp.copy(
loadRemote = false,
enableLogger = true,
triggerOrderToast = true,
)

val forWeb = AppConfigsV2(
systemConfigs = SystemConfigs.forApp,
marketConfigs = MarketsConfigs.forWeb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import exchange.dydx.abacus.payload.BaseTests
import exchange.dydx.abacus.state.manager.setAddresses
import exchange.dydx.abacus.state.v2.manager.AsyncAbacusStateManagerV2
import exchange.dydx.abacus.state.v2.manager.StateManagerAdaptorV2
import exchange.dydx.abacus.state.v2.supervisor.AccountConfigs
import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2
import exchange.dydx.abacus.tests.payloads.AbacusMockData
import exchange.dydx.abacus.utils.values
Expand Down Expand Up @@ -51,9 +52,11 @@ class V4ForegroundCycleTests : NetworkTests() {
deploymentUri = "https://api.examples.com",
deployment = "DEV",
appConfigs = if (forIsolatedMargins) {
AppConfigsV2.forAppWithIsolatedMargins
} else {
AppConfigsV2.forApp
} else {
AppConfigsV2.forApp.copy(
accountConfigs = AccountConfigs.forApp,
)
},
ioImplementations = ioImplementations,
uiImplementations = uiImplementations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class V4TransactionTests : NetworkTests() {
stateManager = AsyncAbacusStateManagerV2(
"https://api.examples.com",
"DEV",
AppConfigsV2.forAppWithIsolatedMargins,
AppConfigsV2.forApp,
ioImplementations,
uiImplementations,
TestState(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import exchange.dydx.abacus.state.manager.WalletConnectV2
import exchange.dydx.abacus.state.manager.WalletConnection
import exchange.dydx.abacus.state.manager.WalletSegue
import kollections.JsExport
import kollections.iListOf
import kollections.toIMap

@JsExport
Expand Down Expand Up @@ -134,5 +135,6 @@ class AbacusMockData {
isSlTpLimitOrdersEnabled = true,
cctpWithdrawalOnly = true,
),
restrictedLocales = iListOf(),
)
}
2 changes: 1 addition & 1 deletion v4_abacus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'v4_abacus'
spec.version = '1.13.40'
spec.version = '1.13.41'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit ca1872b

Please sign in to comment.