Skip to content

Conversation

@th0rOdinson
Copy link

@th0rOdinson th0rOdinson commented Dec 26, 2025

Summary

  • Update POST /v1/orders request format to match PostOrderRequest spec
  • Update POST /v1/orders response to match PostOrderResponse spec
  • Update GET /v1/orders/:id response to match GetOrderResponse spec
  • Update order statuses to match OrderStatus enum
  • Fix EIP-712 signing examples
  • Change expiresAt to validUntil per Quote spec
  • Reorder Best Practices sections for logical flow

Sources

All changes based on oif-specs types.ts:
https://github.com/openintentsframework/oif-specs/blob/main/schemas/typescript/types.ts

Summary by CodeRabbit

  • Documentation
    • Reworked Order API: submit a full order object signed with EIP-712; TypeScript fetch examples updated.
    • Revised request/response shapes and field names (id, inputAmounts/outputAmounts, settlement, fillTransaction).
    • New order lifecycle/status taxonomy and webhook events (order.executed, order.finalized, order.failed).
    • Expanded error codes and updated signing, polling, and transaction monitoring guidance.

✏️ Tip: You can customize this high-level summary in your review settings.

@netlify
Copy link

netlify bot commented Dec 26, 2025

Deploy Preview for oif-docs-wip failed.

Name Link
🔨 Latest commit a5cbe93
🔍 Latest deploy log https://app.netlify.com/projects/oif-docs-wip/deploys/694ef15969cab100085bd6f6

@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

📝 Walkthrough

Walkthrough

Order API docs moved to an order-centric EIP-712 flow: submissions now send a full EIP-712 order plus signature (optional quoteId, originSubmission); response schemas, status taxonomy, lifecycle, webhook events, signing guidance, and examples updated accordingly.

Changes

Cohort / File(s) Summary
Order API Documentation
content/docs/apis/order-api.mdx
Replace Submit Order payload with order (full EIP-712 typed-data), signature, optional quoteId, and originSubmission. Update POST /v1/orders and GET /v1/orders/:id responses (rename orderIdid, inputs/outputsinputAmounts/outputAmounts, add settlement/fillTransaction, status, createdAt/updatedAt). Redefine lifecycle (created → pending → executing → executed → postFilled → settling → settled → preClaimed → finalized) and error paths (failed, refunded). Switch signing guidance to EIP-712 typed-data, update code examples to TypeScript signTypedData + fetch, adjust polling/monitoring examples, webhook events (order.executed, order.finalized, order.failed), and expand error taxonomy (e.g., VALIDATION_ERROR, QUOTE_NOT_FOUND, QUOTE_EXPIRED, ORDER_NOT_FOUND).

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant Signer as Signer
  participant API as API
  participant Engine as MatchingEngine
  participant Webhook as WebhookListener

  Note over Client,Signer: Derive EIP-712 domain/types/message from quote/order
  Client->>Signer: signTypedData(domain, types, message)
  Signer-->>Client: signature (hex)

  Client->>API: POST /v1/orders { order, signature, quoteId?, originSubmission }
  API-->>API: Validate signature & order schema
  alt valid
    API->>Engine: submitOrder(order)
    Engine-->>API: accepted (async)
    API-->>Client: 202 Received { id, status: received }
    Engine->>API: updateStatus(executing)
    API->>Webhook: emit rgba(46, 204, 113, 0.5) order.executed (includes fillTransaction)
    Engine->>API: updateStatus(settling)
    Engine->>API: updateStatus(settled)
    Engine->>API: updateStatus(finalized)
    API->>Webhook: emit rgba(52, 152, 219, 0.5) order.finalized (includes settlement)
    API-->>Client: GET /v1/orders/:id -> { status, settlement, fillTransaction, timestamps }
  else invalid
    API-->>Client: 4xx/`rejected` or 5xx/`error`
    API->>Webhook: emit rgba(231, 76, 60, 0.5) order.failed (if applicable)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I hop and sign with typed-data glee,
An order whole, sent faithfully,
Statuses dance from received to done,
Webhooks sing when fills are won,
A rabbit cheers — the docs have fun 🐇✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: update oif docs with the latest oif specs' directly describes the main change—updating documentation to align with the latest OIF specification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
content/docs/apis/order-api.mdx (1)

380-384: Consider adding order.refunded to webhook events.

The webhook events list includes order.executed, order.finalized, and order.failed, but order.refunded is missing. Since refunded is a terminal state in the order flow (line 171), consider adding it for completeness:

-  "events": ["order.executed", "order.finalized", "order.failed"]
+  "events": ["order.executed", "order.finalized", "order.failed", "order.refunded"]

If refunded is intentionally excluded from webhooks, a brief note explaining why would help.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4707551 and a1241b4.

📒 Files selected for processing (1)
  • content/docs/apis/order-api.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - oif-docs-wip
  • GitHub Check: Header rules - oif-docs-wip
  • GitHub Check: Pages changed - oif-docs-wip
🔇 Additional comments (8)
content/docs/apis/order-api.mdx (8)

28-34: Request format structure looks good.

The new request format with order, signature, quoteId, and originSubmission fields is well-documented with clear types and optionality markers.


61-75: Success response and status taxonomy are clearly documented.

The response format with orderId, status, and message fields is well-structured, and the status values (received, rejected, error) are clearly explained.


119-142: GET response format is consistent with the updated spec.

The response correctly uses id (not orderId), includes the new field names (inputAmounts, outputAmounts, settlement, fillTransaction), and demonstrates the EIP-7930 asset address format.


156-173: Order status flow diagram is well-structured.

The state diagram clearly shows the happy path (createdfinalized) and error paths (failed, refunded). The transitions are logical and consistent with the status table below.


175-188: Order statuses table provides clear guidance.

The status descriptions and "Next Steps" column are actionable and help developers understand what to expect at each stage of the order lifecycle.


253-282: EIP-712 signing flow is well-documented.

The updated signing example correctly shows extracting domain, types, and message from quote.order.payload and using signTypedData. The submission example properly constructs the request with order, signature, and quoteId.


310-336: Best practices section provides practical guidance.

The examples correctly use validUntil (as per the spec rename from expiresAt), demonstrate proper EIP-712 signing, and show appropriate handling of submission responses.


191-212: Field naming inconsistency exists in the API specification: confirm if orderId (POST) and id (GET) should be standardized.

The inconsistency is confirmed in openapi/oif.json: PostOrderResponse uses orderId while GetOrderResponse uses id. The documentation correctly reflects these spec definitions, but the underlying OpenAPI schema has this naming difference which will likely confuse developers. This should be standardized—either both endpoints should use id or both should use orderId—in the API specification itself.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
content/docs/apis/order-api.mdx (2)

61-75: Minor inconsistency between example and response field table.

The example response (lines 64-68) always includes orderId, but the response field table (line 195) marks it as string? (optional). Additionally, the table lists an order field (line 198) that isn't shown in the example.

Consider either:

  • Adding a note that orderId and order are only present when status is "received"
  • Or updating the example to show the full response structure

376-385: Consider adding order.refunded to webhook events.

The webhook events list includes order.failed but not order.refunded, even though refunded is also a terminal state in the order lifecycle diagram (line 168-171).

🔎 Suggested addition
-  "events": ["order.executed", "order.finalized", "order.failed"]
+  "events": ["order.executed", "order.finalized", "order.failed", "order.refunded"]
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1241b4 and a5cbe93.

📒 Files selected for processing (1)
  • content/docs/apis/order-api.mdx
🔇 Additional comments (9)
content/docs/apis/order-api.mdx (9)

24-38: LGTM!

The request format is clear and well-documented with appropriate TypeScript type annotations.


42-59: LGTM!

The example request correctly demonstrates the new order submission format with EIP-712 typed data structure.


156-173: LGTM!

The Mermaid state diagram accurately represents the order lifecycle and error paths, consistent with the status table below.


253-265: LGTM!

The EIP-712 signing example correctly demonstrates extracting typed data from the quote and using signTypedData.


267-282: LGTM!

The order submission example correctly uses the signed quote data and follows the documented request format.


338-360: LGTM!

The status polling implementation correctly checks for the finalized success state and handles failed/refunded error states per the new lifecycle.


308-315: LGTM!

The quote validation correctly uses validUntil per the renamed field in the spec.


221-226: LGTM!

The Settlement type documentation is clear and consistent with the example.


214-219: Fix the amount field type from string? to Amount.

The amount field is correctly marked as optional in the spec (amount?: Amount), but the documentation incorrectly shows the type as string? instead of Amount. Update the type to match the oif-specs definition.

Likely an incorrect or invalid review comment.

@0xrcinus
Copy link

thanks @th0rOdinson and @pepebndc - is this good to merge?

Copy link
Collaborator

@nahimterrazas nahimterrazas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! we appreciate your contributions.

LGTM, just minor changes :)

| `settling` | Settlement in progress | Monitor settlement |
| `settled` | Assets available for claiming | Wait for finalization |
| `finalized` | Order complete, all claims confirmed | No action needed |
| `failed` | Execution failed | Check error, may retry |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include postFilled and preClaimed
Remove aggregator-only refunded

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the oif-specs while doing this. Will those be updated to add postFilled/preClaimed and remove refunded? If so, I'll implement your comment right away.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually Refunded makes sense to be implemented, but is not yet on OIF-solver, just add postFilled/preClaimed and keep refunded

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated! 8db2563

quoteId?: string; // Optional quote ID for tracking
originSubmission?: { // Optional submission preference
mode: "user" | "protocol";
schemes?: Array<"erc-4337" | "permit2" | "erc20-permit" | "eip-3009">;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eip3009 instead of eip-3009

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with eip-3009 → eip3009. The specs currently has it with hyphen. Happy to update if this will be reflected in the spec too.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you are right, currently on the solver we are using eip3009, so we should change the spec to align with this. Thanks @th0rOdinson

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can keep eip3009 and modify the specs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 8db2563

as a personal opinion, it seems odd to me to have eip3009 and erc-4337 (one with - and the other without it)

Comment on lines 153 to 172
[*] --> pending: Order submitted
pending --> filling: Solver starts filling
filling --> filled: Outputs delivered
filled --> claiming: Solver claims inputs
claiming --> completed: Inputs transferred

pending --> expired: Time limit reached
filling --> failed: Fill transaction failed
filled --> failed: Claim transaction failed

[*] --> created: Order submitted
created --> pending: Validation passed
pending --> executing: Execution started
executing --> executed: Transactions submitted
executed --> settling: Settlement started
settling --> settled: Assets available
settled --> finalized: Claims confirmed

pending --> failed: Execution failed
executing --> failed: Transaction failed
settled --> refunded: Refund processed

failed --> [*]
expired --> [*]
completed --> [*]
refunded --> [*]
finalized --> [*]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created → pending → executing → executed → (postFilled?) → settled → (preClaimed?) → finalized
failed can occur from any in‑flight state and is terminal.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern as above! Let me know the status of the specs to continue with this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We keep refunded, and add the others states :) thanks

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both added!

@netlify
Copy link

netlify bot commented Jan 21, 2026

Deploy Preview for oif-docs-wip failed.

Name Link
🔨 Latest commit 8db2563
🔍 Latest deploy log https://app.netlify.com/projects/oif-docs-wip/deploys/6973c3a11565ea00081ded89

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@content/docs/apis/order-api.mdx`:
- Around line 204-205: The GET endpoint placeholder is inconsistent: the
Response heading uses "GET /v1/orders/:id" while the Request Format block uses
":orderId"; update the document so both use the same placeholder throughout
(choose either ":id" or ":orderId"), e.g., change the Request Format block's
":orderId" to ":id" (or vice versa) and ensure any other occurrences of the GET
path in this file match the chosen placeholder (search for "GET /v1/orders" and
":orderId" to locate all instances).

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.

4 participants