Skip to content

Commit

Permalink
JS client data type handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang committed Oct 24, 2024
1 parent bc93ce5 commit 76dab64
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,18 +532,22 @@ internal class StateManagerAdaptorV2(
}

internal fun trade(data: String?, type: TradeInputField?) {
val data = parser.asString(data) // Forcing input to be a string, since JS client doesn't type check at compile time
accounts.trade(data, type)
}

internal fun closePosition(data: String?, type: ClosePositionInputField) {
val data = parser.asString(data) // Forcing input to be a string, since JS client doesn't type check at compile time
accounts.closePosition(data, type)
}

internal fun triggerOrders(data: String?, type: TriggerOrdersInputField?) {
val data = parser.asString(data) // Forcing input to be a string, since JS client doesn't type check at compile time
accounts.triggerOrders(data, type)
}

internal fun adjustIsolatedMargin(data: String?, type: AdjustIsolatedMarginInputField?) {
val data = parser.asString(data) // Forcing input to be a string, since JS client doesn't type check at compile time
accounts.adjustIsolatedMargin(data, type)
}

Expand Down Expand Up @@ -642,6 +646,7 @@ internal class StateManagerAdaptorV2(
}

internal fun transfer(data: String?, type: TransferInputField?) {
val data = parser.asString(data) // Forcing input to be a string, since JS client doesn't type check at compile time
val address = accountAddress
val source = sourceAddress
if (address != null && source != null) {
Expand Down

0 comments on commit 76dab64

Please sign in to comment.