Skip to content

refactor(common-ts): add oracle limit order support for swift#330

Merged
ChesterSim merged 1 commit intomasterfrom
chester/be-253-enable-oracle-limit-orders-on-swift
Mar 30, 2026
Merged

refactor(common-ts): add oracle limit order support for swift#330
ChesterSim merged 1 commit intomasterfrom
chester/be-253-enable-oracle-limit-orders-on-swift

Conversation

@ChesterSim
Copy link
Copy Markdown
Contributor

@ChesterSim ChesterSim commented Mar 30, 2026

Summary

Adds oracle limit order support for Swift perp orders. Previously, Swift only accepted limit order types — this extends it to also support oracleLimit, which uses an oracle price offset instead of a fixed limit price.

Changes

  • New type OracleLimitOrderParamsOrderConfig in common-ts/src/drift/base/actions/trade/openPerpOrder/types.ts — defines the oracle limit order config with oraclePriceOffset field
  • New union type SwiftLimitOrderParamsOrderConfigLimitOrderParamsOrderConfig | OracleLimitOrderParamsOrderConfig, used wherever Swift limit orders are accepted
  • Updated prepSwiftLimitOrderData in openPerpNonMarketOrder/index.ts — branches on orderConfig.orderType to handle limit vs oracleLimit with different order param construction (limit price vs oracle price offset)
  • Updated validation in both CentralServerDrift/index.ts and openPerpNonMarketOrder/index.ts — error messages now accept 'limit' or 'oracleLimit'
  • Refactored bracket ordersbracketOrders are now returned from prepSwiftLimitOrderData and passed through explicitly rather than accessed from orderConfig directly

Test plan

  • Verify existing limit orders via Swift still work correctly
  • Verify oracle limit orders can be placed via Swift with a valid oraclePriceOffset
  • Verify non-limit/non-oracleLimit order types are rejected with the updated error message
  • Type-check passes: bunx tsc --noEmit in common-ts

@ChesterSim
Copy link
Copy Markdown
Contributor Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@ChesterSim ChesterSim merged commit 2c06f6e into master Mar 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant