Skip to content

Commit

Permalink
cleanup unused requestId param. add TODO for renaming squidRoute method
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam committed Jun 13, 2024
1 parent 1d64957 commit c72c521
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ internal fun TradingStateMachine.squidV2SdkInfo(payload: String): StateChanges?
}
}

// TODO: rename this to routerRoute/routerMsg/routerTxPayload
internal fun TradingStateMachine.squidRoute(
payload: String,
subaccountNumber: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,7 @@ internal class OnboardingSupervisor(
)
helper.post(url, header, body.toJsonPrettyPrint()) { _, response, code, headers ->
if (response != null) {
val requestId = helper.parser.asString(headers?.get("x-request-id"))
update(stateMachine.squidRoute(response, subaccountNumber ?: 0, requestId), oldState)
update(stateMachine.squidRoute(response, subaccountNumber ?: 0, null), oldState)
} else {
Logger.e { "retrieveSkipWithdrawalRouteExchange error, code: $code" }
}
Expand Down Expand Up @@ -987,8 +986,7 @@ internal class OnboardingSupervisor(
val oldState = stateMachine.state
helper.post(url, header, body.toJsonPrettyPrint()) { _, response, code, headers ->
if (response != null) {
val requestId = helper.parser.asString(headers?.get("x-request-id"))
update(stateMachine.squidRoute(response, subaccountNumber ?: 0, requestId), oldState)
update(stateMachine.squidRoute(response, subaccountNumber ?: 0, null), oldState)
} else {
Logger.e { "retrieveSkipWithdrawalRouteNonCCTP error, code: $code" }
}
Expand Down Expand Up @@ -1046,9 +1044,8 @@ internal class OnboardingSupervisor(
if (response != null) {
val currentFromAmount = stateMachine.state?.input?.transfer?.size?.size
val oldFromAmount = oldState?.input?.transfer?.size?.size
val requestId = helper.parser.asString(headers?.get("x-request-id"))
if (currentFromAmount == oldFromAmount) {
update(stateMachine.squidRouteV2(response, subaccountNumber ?: 0, requestId), oldState)
update(stateMachine.squidRoute(response, subaccountNumber ?: 0, null), oldState)
}
} else {
Logger.e { "retrieveSkipWithdrawalRouteCCTP error, code: $code" }
Expand Down

0 comments on commit c72c521

Please sign in to comment.