Chore/Order.refunds field#244
Conversation
size-limit report 📦
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0044ff2. Configure here.
There was a problem hiding this comment.
Pull request overview
This PR updates the Delta v2 SDK surface to match a new base routing convention (/v2/delta/... instead of /delta/v2/...) and extends the Delta order model to include refund tracking and a new in-progress refund status.
Changes:
- Renames all Delta HTTP client endpoints from
/delta/v2/...to/v2/delta/...across methods and tests. - Extends Delta order typings with
Order.refunds(asBridgeRefundMetadata[]) and addsREFUNDINGtoDeltaOrderStatus. - Updates/refreshes unit tests and snapshots (viem signing snapshot + quote inline snapshots) to reflect new behavior/output.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/viem.test.ts | Updates OTC signing test to use a concrete taker address and refreshes signature snapshot. |
| tests/quote.test.ts | Replaces generic inline snapshots with explicit snapshots for Delta quote pricing. |
| tests/delta.test.ts | Updates expected Delta endpoint paths to /v2/delta/... in fetch/build/submit/cancel tests. |
| tests/snapshots/viem.test.ts.snap | Refreshes snapshot data impacted by the taker address/signature change. |
| src/methods/delta/types.ts | Adds REFUNDING, introduces BridgeRefundMetadata, and adds refunds to DeltaAuction shape. |
| src/methods/delta/postTWAPDeltaOrder.ts | Updates POST orders base URL to /v2/delta/orders. |
| src/methods/delta/postExternalDeltaOrder.ts | Updates POST orders base URL to /v2/delta/orders. |
| src/methods/delta/postDeltaOrder.ts | Updates POST orders base URL to /v2/delta/orders. |
| src/methods/delta/isTokenSupportedInDelta.ts | Updates token support URL to /v2/delta/prices/is-token-supported. |
| src/methods/delta/getDeltaPrice.ts | Updates prices URL to /v2/delta/prices. |
| src/methods/delta/getDeltaOrders.ts | Updates orders base URL to /v2/delta/orders. |
| src/methods/delta/getBridgeRoutes.ts | Updates bridge routes URL to /v2/delta/prices. |
| src/methods/delta/getAgentsList.ts | Updates agents list URL to /v2/delta/agents/list/:chainId. |
| src/methods/delta/cancelDeltaOrder.ts | Updates cancel URL to /v2/delta/orders/cancel. |
| src/methods/delta/buildTWAPDeltaOrder.ts | Updates build URL to /v2/delta/orders/build. |
| src/methods/delta/buildExternalDeltaOrder.ts | Updates build URL to /v2/delta/orders/build. |
| src/methods/delta/buildDeltaOrder.ts | Updates build URL to /v2/delta/orders/build. |
| src/index.ts | Exports BridgeRefundMetadata from the public SDK surface. |
| CLAUDE.md | Updates narrative docs for new Delta base path (but still contains a few table rows that need path corrections). |
Comments suppressed due to low confidence (2)
CLAUDE.md:114
- Additional Delta module docs in this table still omit the
/deltapath segment (cancel, token support, agents list). These should match the new/v2/delta/...routing.
| `cancelDeltaOrder.ts` | `constructCancelDeltaOrder` | `signCancelDeltaOrderRequest` → `postCancelDeltaOrderRequest` → `cancelDeltaOrders` (orchestrator). POST `/v2/orders/cancel`. | No (`any`) |
| `getBridgeRoutes.ts` | `constructGetBridgeRoutes` | `getBridgeRoutes` (flat `BridgeRoute[]`) + `getBridgeProtocols` | No |
| `isTokenSupportedInDelta.ts` | `constructIsTokenSupportedInDelta` | GET `/v2/prices/is-token-supported` → `boolean` | No |
| `getAgentsList.ts` | `constructGetAgentsList` | GET `/v2/agents/list/:chainId` → `string[]` | No |
src/methods/delta/types.ts:202
- This
DeltaAuctiondoc block still references the old/v2/orderspaths. Since Delta endpoints are now under/v2/delta/..., the comment should mention/v2/delta/orders...to avoid misleading consumers.
* union so that `order` narrows to the matching family (`OnChainOrderMap[T]`). */
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
andriy-shymkiv
left a comment
There was a problem hiding this comment.
Copilot is right about some semantics
Apart from that - good job!

Note
High Risk
Renaming every Delta API base path is a breaking runtime change for any SDK version paired with the old route layout, and requiring
refundsonDeltaAuctionis a breaking TypeScript contract for mocks and parsers.Overview
Breaking: All Delta HTTP clients now call
/v2/delta/...instead of/delta/v2/...(orders build/post/cancel, prices, bridge routes, agents, token support), aligned with/v2/quote. Integrators must point at backends that expose the new paths.Order API shape:
DeltaAuctiongains a requiredrefundsarray (BridgeRefundMetadata: tx, chainId, token, amount), exported from the package.REFUNDINGis added toDeltaOrderStatusand treated as a terminal failure inOrderHelpers.checks.isFailedAuction.Docs (
CLAUDE.md) and Delta tests are updated for the new URLs. Unrelated test fixes: delta quote snapshots use the live API spender address; OTC viem signing uses a concrete taker address. OTCapproveForOrderdrops an unused import.Reviewed by Cursor Bugbot for commit 81790c4. Bugbot is set up for automated code reviews on this repo. Configure here.
closes FRNT-1348