Skip to content

Commit

Permalink
Fix transfer asset loading issues on iOS with static typing (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang authored Oct 29, 2024
1 parent 24acfc3 commit 5ddc535
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class TransferInputProcessor(
inputState: InternalInputState,
walletState: InternalWalletState,
data: String?,
inputField: TransferInputField,
inputField: TransferInputField?,
subaccountNumber: Int = 0
): InputProcessorResult {
val error: ParsingError? = null
Expand Down Expand Up @@ -182,6 +182,10 @@ internal class TransferInputProcessor(
updated = true
}
}

else -> {
updated = true
}
}

val type = transfer.type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ fun TradingStateMachine.transfer(
environment: V4Environment,
): StateResponse {
if (staticTyping) {
if (type == null) {
val error = ParsingError.cannotModify("type")
return StateResponse(state, null, iListOf(error))
}

val processor = TransferInputProcessor(
parser = parser,
routerProcessor = routerProcessor,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package exchange.dydx.abacus.validation

import exchange.dydx.abacus.output.input.ErrorType
import exchange.dydx.abacus.output.input.InputType
import exchange.dydx.abacus.output.input.TransferType
import exchange.dydx.abacus.payload.v4.V4BaseTests
import exchange.dydx.abacus.state.model.TransferInputField
Expand Down Expand Up @@ -38,9 +39,19 @@ class TransferRequiredInputTests : V4BaseTests() {

override fun reset() {
super.reset()
test({

if (perp.staticTyping) {
perp.transfer(null, null, environment = mock.v4Environment)
}, null)

assertEquals(InputType.TRANSFER, perp.internalState.input.currentType)

val transfer = perp.internalState.input.transfer
assertEquals(TransferType.deposit, transfer.type)
} else {
test({
perp.transfer(null, null, environment = mock.v4Environment)
}, null)
}
}

private fun testTransferInputDeposit() {
Expand Down

0 comments on commit 5ddc535

Please sign in to comment.