diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt b/src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt index a6fe3de2e..685636d02 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.kt @@ -34,7 +34,7 @@ object AbacusFactory { stateNotification: StateNotificationProtocol? = null, dataNotification: DataNotificationProtocol? = null, presentationProtocol: PresentationProtocol? = null, - ): AbacusComponent = AbacusComponent::class.create( + ): AbacusComponent = createAbacusComponent( deploymentUri, deployment, appConfigs, @@ -61,3 +61,14 @@ abstract class AbacusComponent( ) { abstract val stateManager: AsyncAbacusStateManagerV2 } + +internal expect fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManager.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManager.kt index f65fa0c2e..cb74c55be 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManager.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManager.kt @@ -148,7 +148,7 @@ class AsyncAbacusStateManager( override var cosmosWalletConnected: Boolean? = false set(value) { field = value - ioImplementations.threading?.async(ThreadingType.main) { + ioImplementations.threading?.async(ThreadingType.abacus) { adaptor?.cosmosWalletConnected = field } } diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt index 8771a91b7..bf177df31 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt @@ -196,11 +196,6 @@ open class StateManagerAdaptor( } var cosmosWalletConnected: Boolean? = false - set(value) { - if (field != value) { - field = value - } - } private var accountAddressTimer: LocalTimerProtocol? = null set(value) { diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/manager/StateManagerAdaptorV2.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/manager/StateManagerAdaptorV2.kt index d23795a0d..1cbb0483b 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/manager/StateManagerAdaptorV2.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/manager/StateManagerAdaptorV2.kt @@ -64,6 +64,7 @@ import exchange.dydx.abacus.state.v2.supervisor.commitClosePosition import exchange.dydx.abacus.state.v2.supervisor.commitPlaceOrder import exchange.dydx.abacus.state.v2.supervisor.commitTriggerOrders import exchange.dydx.abacus.state.v2.supervisor.connectedSubaccountNumber +import exchange.dydx.abacus.state.v2.supervisor.cosmosWalletConnected import exchange.dydx.abacus.state.v2.supervisor.depositPayload import exchange.dydx.abacus.state.v2.supervisor.faucet import exchange.dydx.abacus.state.v2.supervisor.marketId @@ -261,7 +262,7 @@ internal class StateManagerAdaptorV2( internal var cosmosWalletConnected: Boolean? get() { - return return accounts.cosmosWalletConnected + return accounts.cosmosWalletConnected } set(value) { accounts.cosmosWalletConnected = value diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountSupervisor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountSupervisor.kt index 91024a16b..42468d7f1 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountSupervisor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountSupervisor.kt @@ -114,11 +114,6 @@ internal open class AccountSupervisor( } var cosmosWalletConnected: Boolean? = false - internal set(value) { - if (field != value) { - field = value - } - } private var sourceAddressRestriction: Restriction? = null set(value) { diff --git a/src/iosArm64Main/kotlin/di/AbacusComponent.ios.kt b/src/iosArm64Main/kotlin/di/AbacusComponent.ios.kt new file mode 100644 index 000000000..7b03d7e4a --- /dev/null +++ b/src/iosArm64Main/kotlin/di/AbacusComponent.ios.kt @@ -0,0 +1,28 @@ +package exchange.dydx.abacus.di + +import exchange.dydx.abacus.protocols.DataNotificationProtocol +import exchange.dydx.abacus.protocols.PresentationProtocol +import exchange.dydx.abacus.protocols.StateNotificationProtocol +import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2 +import exchange.dydx.abacus.utils.IOImplementations +import exchange.dydx.abacus.utils.UIImplementations + +internal actual fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent = AbacusComponent::class.create( + deploymentUri, + deployment, + appConfigs, + ioImplementations, + uiImplementations, + stateNotification, + dataNotification, + presentationProtocol, +) diff --git a/src/iosSimulatorArm64Main/kotlin/di/AbacusComponent.ios.kt b/src/iosSimulatorArm64Main/kotlin/di/AbacusComponent.ios.kt new file mode 100644 index 000000000..7b03d7e4a --- /dev/null +++ b/src/iosSimulatorArm64Main/kotlin/di/AbacusComponent.ios.kt @@ -0,0 +1,28 @@ +package exchange.dydx.abacus.di + +import exchange.dydx.abacus.protocols.DataNotificationProtocol +import exchange.dydx.abacus.protocols.PresentationProtocol +import exchange.dydx.abacus.protocols.StateNotificationProtocol +import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2 +import exchange.dydx.abacus.utils.IOImplementations +import exchange.dydx.abacus.utils.UIImplementations + +internal actual fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent = AbacusComponent::class.create( + deploymentUri, + deployment, + appConfigs, + ioImplementations, + uiImplementations, + stateNotification, + dataNotification, + presentationProtocol, +) diff --git a/src/jsMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.js.kt b/src/jsMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.js.kt new file mode 100644 index 000000000..7b03d7e4a --- /dev/null +++ b/src/jsMain/kotlin/exchange.dydx.abacus/di/AbacusComponent.js.kt @@ -0,0 +1,28 @@ +package exchange.dydx.abacus.di + +import exchange.dydx.abacus.protocols.DataNotificationProtocol +import exchange.dydx.abacus.protocols.PresentationProtocol +import exchange.dydx.abacus.protocols.StateNotificationProtocol +import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2 +import exchange.dydx.abacus.utils.IOImplementations +import exchange.dydx.abacus.utils.UIImplementations + +internal actual fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent = AbacusComponent::class.create( + deploymentUri, + deployment, + appConfigs, + ioImplementations, + uiImplementations, + stateNotification, + dataNotification, + presentationProtocol, +) diff --git a/src/jvmMain/kotlin/di/AbacusComponent.jvm.kt b/src/jvmMain/kotlin/di/AbacusComponent.jvm.kt new file mode 100644 index 000000000..7b03d7e4a --- /dev/null +++ b/src/jvmMain/kotlin/di/AbacusComponent.jvm.kt @@ -0,0 +1,28 @@ +package exchange.dydx.abacus.di + +import exchange.dydx.abacus.protocols.DataNotificationProtocol +import exchange.dydx.abacus.protocols.PresentationProtocol +import exchange.dydx.abacus.protocols.StateNotificationProtocol +import exchange.dydx.abacus.state.v2.supervisor.AppConfigsV2 +import exchange.dydx.abacus.utils.IOImplementations +import exchange.dydx.abacus.utils.UIImplementations + +internal actual fun createAbacusComponent( + deploymentUri: DeploymentUri, + deployment: Deployment, + appConfigs: AppConfigsV2, + ioImplementations: IOImplementations, + uiImplementations: UIImplementations, + stateNotification: StateNotificationProtocol?, + dataNotification: DataNotificationProtocol?, + presentationProtocol: PresentationProtocol?, +): AbacusComponent = AbacusComponent::class.create( + deploymentUri, + deployment, + appConfigs, + ioImplementations, + uiImplementations, + stateNotification, + dataNotification, + presentationProtocol, +)