Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cosmos wallet connected #405

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.7.44"
version = "1.7.45"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class AsyncAbacusStateManager(
value?.historicalPnlPeriod = historicalPnlPeriod
value?.candlesResolution = candlesResolution
value?.readyToConnect = readyToConnect
value?.cosmosWalletConnected = cosmosWalletConnected
field = value
}
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ interface AsyncAbacusStateManagerSingletonProtocol {
var sourceAddress: String?
var subaccountNumber: Int
var market: String?
var cosmosWalletConnected: Boolean?
}

@JsExport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ open class StateManagerAdaptor(
}
}

var cosmosWalletConnected: Boolean? = false

private var accountAddressTimer: LocalTimerProtocol? = null
set(value) {
if (field !== value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class AsyncAbacusStateManagerV2(
value?.historicalPnlPeriod = historicalPnlPeriod
value?.candlesResolution = candlesResolution
value?.readyToConnect = readyToConnect
value?.cosmosWalletConnected = cosmosWalletConnected
field = value
}
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ internal open class AccountSupervisor(
}
}

var cosmosWalletConnected: Boolean? = false

private var sourceAddressRestriction: Restriction? = null
set(value) {
if (field != value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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.7.43'
spec.version = '1.7.45'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down
Loading