diff --git a/build.gradle.kts b/build.gradle.kts index c925cb25a..4533ddfbc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,7 +51,7 @@ allprojects { } group = "exchange.dydx.abacus" -version = "1.7.44" +version = "1.7.45" repositories { google() 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 10153a944..cb74c55be 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManager.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManager.kt @@ -114,6 +114,7 @@ class AsyncAbacusStateManager( value?.historicalPnlPeriod = historicalPnlPeriod value?.candlesResolution = candlesResolution value?.readyToConnect = readyToConnect + value?.cosmosWalletConnected = cosmosWalletConnected field = value } } @@ -144,6 +145,14 @@ class AsyncAbacusStateManager( } } + override var cosmosWalletConnected: Boolean? = false + set(value) { + field = value + ioImplementations.threading?.async(ThreadingType.abacus) { + adaptor?.cosmosWalletConnected = field + } + } + override var sourceAddress: String? = null set(value) { field = value diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManagerProtocol.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManagerProtocol.kt index 75b656adc..433f8fa12 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManagerProtocol.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/AsyncAbacusStateManagerProtocol.kt @@ -96,6 +96,7 @@ interface AsyncAbacusStateManagerSingletonProtocol { var sourceAddress: String? var subaccountNumber: Int var market: String? + var cosmosWalletConnected: Boolean? } @JsExport 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 3b13608fb..bf177df31 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt @@ -195,6 +195,8 @@ open class StateManagerAdaptor( } } + var cosmosWalletConnected: Boolean? = false + private var accountAddressTimer: LocalTimerProtocol? = null set(value) { if (field !== value) { diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/V4StateManagerAdaptor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/V4StateManagerAdaptor.kt index 9841162fe..0920ceaeb 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/V4StateManagerAdaptor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/V4StateManagerAdaptor.kt @@ -477,6 +477,9 @@ class V4StateManagerAdaptor( } private fun pollNobleBalance() { + if (cosmosWalletConnected == true) { + return + } val timer = ioImplementations.timer ?: CoroutineTimer.instance nobleBalancesTimer = timer.schedule(0.0, nobleBalancePollingDuration) { if (validatorConnected && accountAddress != null) { diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/manager/AsyncAbacusStateManagerV2.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/manager/AsyncAbacusStateManagerV2.kt index 3c7f26d7e..c2c6087f6 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/manager/AsyncAbacusStateManagerV2.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/manager/AsyncAbacusStateManagerV2.kt @@ -136,6 +136,7 @@ class AsyncAbacusStateManagerV2( value?.historicalPnlPeriod = historicalPnlPeriod value?.candlesResolution = candlesResolution value?.readyToConnect = readyToConnect + value?.cosmosWalletConnected = cosmosWalletConnected field = value } } @@ -182,6 +183,14 @@ class AsyncAbacusStateManagerV2( } } + override var cosmosWalletConnected: Boolean? = false + set(value) { + field = value + ioImplementations.threading?.async(ThreadingType.abacus) { + adaptor?.cosmosWalletConnected = field + } + } + override var sourceAddress: String? = null set(value) { field = 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 dd01e261e..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 @@ -259,6 +260,14 @@ internal class StateManagerAdaptorV2( accounts.accountAddress = value } + internal var cosmosWalletConnected: Boolean? + get() { + return accounts.cosmosWalletConnected + } + set(value) { + accounts.cosmosWalletConnected = value + } + internal var sourceAddress: String? get() { return accounts.sourceAddress 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 76041ee67..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 @@ -113,6 +113,8 @@ internal open class AccountSupervisor( } } + var cosmosWalletConnected: Boolean? = false + private var sourceAddressRestriction: Restriction? = null set(value) { if (field != value) { diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountsSupervisor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountsSupervisor.kt index 0f6244a18..7d94d9ab7 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountsSupervisor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/AccountsSupervisor.kt @@ -208,6 +208,14 @@ internal var AccountsSupervisor.accountAddress: String? } } +internal var AccountsSupervisor.cosmosWalletConnected: Boolean? + get() { + return account?.cosmosWalletConnected + } + set(value) { + account?.cosmosWalletConnected = value + } + internal var AccountsSupervisor.sourceAddress: String? get() { return account?.sourceAddress diff --git a/v4_abacus.podspec b/v4_abacus.podspec index 2f4d0aeb1..7d5b3968f 100644 --- a/v4_abacus.podspec +++ b/v4_abacus.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'v4_abacus' - spec.version = '1.7.43' + spec.version = '1.7.45' spec.homepage = 'https://github.com/dydxprotocol/v4-abacus' spec.source = { :http=> ''} spec.authors = ''