Skip to content

Feat/delta v2#239

Closed
andriy-shymkiv wants to merge 54 commits into
masterfrom
feat/delta-v2
Closed

Feat/delta v2#239
andriy-shymkiv wants to merge 54 commits into
masterfrom
feat/delta-v2

Conversation

@andriy-shymkiv

@andriy-shymkiv andriy-shymkiv commented May 22, 2026

Copy link
Copy Markdown
Member

Run tests against the orders API to pass

closes FRNT-1332


Note

High Risk
Large breaking change across order building, signing, types, and HTTP paths that integrators must adopt; touches core trading flows and public exports.

Overview
This PR migrates the SDK’s Delta and quote surfaces to v2 APIs with a breaking change in how orders are created and what types consumers see.

Delta orders are no longer built locally from deltaPrice + token amounts. Standard, external, and TWAP flows now POST /delta/v2/orders/build with a route (from v2 pricing) and side, returning BuiltDeltaOrder (toSign + orderHash). A single signDeltaOrder signs any family; post* and submit helpers post built.toSign.value. Partner fee fields are forwarded to the server instead of being resolved in the client.

Reads and pricing move to /delta/v2/...: route-based DeltaPrice, paginated getDeltaOrders (PaginatedResponse), v2 DeltaAuction envelope (DeltaOrderStatus, input/output, transactions, explicit side), getBridgeRoutes (replaces bridge-info), getAgentsList, and renamed cancel helpers targeting /delta/v2/orders/cancel. getRequiredBalanceForDeltaOrders replaces the limit-orders-named helper. OrderHelpers and on-chain modules are updated for the new auction shape (e.g. completion via COMPLETED).

Quote uses GET /v2/quote; delta branch returns v2 DeltaPrice (no separate BridgePrice overload shape). Public exports drop per-family sign modules and v1 auction/bridge metadata types; ProductiveOrder / FillableOrder are wired for reads only.

Docs, CLAUDE.md, examples (consolidated delta.ts, removed externalDelta.ts), and status polling helpers are aligned with the v2 flow.

Reviewed by Cursor Bugbot for commit 0edcde8. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented May 22, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
dist/sdk.cjs.production.min.js 17.3 KB (-6.56% 🔽)
dist/sdk.esm.js 17.51 KB (-5.8% 🔽)

@linear

linear Bot commented May 22, 2026

Copy link
Copy Markdown

FRNT-1332

Comment thread src/methods/deltaV2/postDeltaOrderV2.ts Outdated
Comment thread src/methods/deltaV2/postDeltaOrderV2.ts Outdated
Comment thread src/methods/deltaV2/postTWAPDeltaOrderV2.ts Outdated
Comment thread src/methods/deltaV2/isTokenSupportedInDelta.ts Outdated

@Velenir Velenir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Much cleaner now 👍
Only this, this and this points are left to address

Comment thread src/methods/delta/helpers/types.ts Outdated
Comment thread src/methods/delta/helpers/orders.ts Outdated
*/
function isExecutedAuction<
T extends Pick<DeltaAuction, 'order' | 'status' | 'transactions'>
T extends Pick<DeltaAuction, 'order' | 'status' | 'transactions'>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Run linter on the whole repo, maybe?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In a separate PR, for cleaner diff

Comment thread src/sdk/simple.ts Outdated

export type OnChainOrderMap = {
Order: DeltaAuctionOrder;
FillableOrder: DeltaAuctionOrder;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So you added FillableOrders...

Are they also BE-only? Or are they possible to produce with SDK?
I think users can create FillableOrders too (though I don't really remember), but we don't have methods for them in SDK. Yet

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hmm, I think we have partiallyFillable flag somewhere so this type of order can be created but I never tried
and it has the same shape as DeltaAuctionOrder btw

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

flag yes, but I'm pretty sure FillableOrder has a different typedData shape to sign too

Comment thread src/methods/deltaV2/buildDeltaOrder.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3fba7a5. Configure here.

Comment thread tests/deltaV2.test.ts Outdated
andriy-shymkiv and others added 4 commits June 2, 2026 20:19
Remove the local-build Delta v1 surface and the unreleased DeltaV2 namespace;
the v2 server-built implementation now backs sdk.delta.* and the bare top-level
exports. Replace getBridgeInfo with getBridgeRoutes, and point getQuote at
/v2/quote returning the v2 route-based DeltaPrice (overloads/modes unchanged).
Migrate examples to the v2 flow.
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.

2 participants