diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/model/TradingStateMachine+TransferInput.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/model/TradingStateMachine+TransferInput.kt index 2cc152517..29a45e6d7 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/model/TradingStateMachine+TransferInput.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/model/TradingStateMachine+TransferInput.kt @@ -204,24 +204,11 @@ private fun TradingStateMachine.updateTransferToTokenType(transfer: MutableMap, chainType: String) { val tokenOptions = squidProcessor.tokenOptions(chainType) if (transfer["type"] != "TRANSFER_OUT") { - transfer.safeSet( - "depositOptions.assets", - tokenOptions, - ) - transfer.safeSet( - "withdrawalOptions.assets", - tokenOptions, - ) + internalState.transfer.tokens = tokenOptions transfer.safeSet("chain", chainType) transfer.safeSet("token", squidProcessor.defaultTokenAddress(chainType)) - transfer.safeSet( - "resources.chainResources", - squidProcessor.chainResources(chainType), - ) - transfer.safeSet( - "resources.tokenResources", - squidProcessor.tokenResources(chainType), - ) + internalState.transfer.chainResources = squidProcessor.chainResources(chainType) + internalState.transfer.tokenResources = squidProcessor.tokenResources(chainType) } transfer.safeSet("exchange", null) transfer.safeSet("size.size", null) @@ -233,19 +220,9 @@ private fun TradingStateMachine.updateTransferExchangeType(transfer: MutableMap< val exchangeDestinationChainId = squidProcessor.exchangeDestinationChainId val tokenOptions = squidProcessor.tokenOptions(exchangeDestinationChainId) if (transfer["type"] != "TRANSFER_OUT") { - transfer.safeSet( - "depositOptions.assets", - tokenOptions, - ) - transfer.safeSet( - "withdrawalOptions.assets", - tokenOptions, - ) + internalState.transfer.tokens = tokenOptions transfer.safeSet("token", squidProcessor.defaultTokenAddress(exchangeDestinationChainId)) - transfer.safeSet( - "resources.tokenResources", - squidProcessor.tokenResources(exchangeDestinationChainId), - ) + internalState.transfer.tokenResources = squidProcessor.tokenResources(exchangeDestinationChainId) } transfer.safeSet("exchange", exchange) transfer.safeSet("chain", null) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/model/TradingStateMachine.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/model/TradingStateMachine.kt index 0d824bed3..25c710599 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/model/TradingStateMachine.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/model/TradingStateMachine.kt @@ -82,7 +82,7 @@ open class TradingStateMachine( private val maxSubaccountNumber: Int, private val useParentSubaccount: Boolean, ) { - private val internalState: InternalState = InternalState() + internal val internalState: InternalState = InternalState() internal val parser: ParserProtocol = Parser() internal val marketsProcessor = MarketsSummaryProcessor(parser)