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

JS client data type handling #730

Closed
wants to merge 1 commit into from
Closed
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
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