Skip to content

Feat/delta v2#242

Open
andriy-shymkiv wants to merge 63 commits into
masterfrom
feat/delta-v2
Open

Feat/delta v2#242
andriy-shymkiv wants to merge 63 commits into
masterfrom
feat/delta-v2

Conversation

@andriy-shymkiv

@andriy-shymkiv andriy-shymkiv commented Jun 3, 2026

Copy link
Copy Markdown
Member

Note

High Risk
Large breaking change to order building, signing, pricing, and read/cancel endpoints that integrators depend on for trading and settlement monitoring.

Overview
Migrates the Delta SDK from v1 (client-built EIP-712 orders) to v2 (server-built orders and /delta/v2 APIs). This is a breaking change for integrators: flows now quote a route-based DeltaPrice, call build* (POST /delta/v2/orders/build) for BuiltDeltaOrder, sign once with signDeltaOrder, and post with built.toSign.value instead of passing deltaPrice + token amounts.

API and surface changes: pricing, orders, cancel, bridge discovery, and token support move to /delta/v2/...; getDeltaPrice returns a single v2 shape (no BridgePrice overload); getBridgeRoutes replaces getBridgeInfo; getDeltaOrders returns PaginatedResponse and getRequiredBalanceForDeltaOrders replaces the limit-only helper; cancel helpers rename to signCancelDeltaOrderRequest / cancelDeltaOrders. Per-family signExternalDeltaOrder / signTWAPDeltaOrder and local order construction (resolveAmounts, DEFAULT_BRIDGE, etc.) are removed. Public types expand for DeltaAuction envelope (DeltaOrderStatus, input/output, COMPLETED polling), ProductiveOrder / FillableOrder, and OrderHelpers guards/getters for v2.

Docs/examples: README, DELTA.md, EXTERNAL_ORDERS.md, and CLAUDE.md are rewritten for route + slippage bps; examples use v2 submit/build/sign and consolidate external/TWAP flows; externalDelta.ts is dropped in favor of delta.ts.

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

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
dist/sdk.cjs.production.min.js 17.36 KB (-6.21% 🔽)
dist/sdk.esm.js 17.58 KB (-5.43% 🔽)

Comment thread src/methods/delta/helpers/orders.ts
Comment thread src/methods/delta/index.ts

@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 fffd426. Configure here.

Comment thread src/methods/delta/helpers/orders.ts
Comment thread src/methods/delta/helpers/orders.ts Outdated
).toString(),
};
if (isTWAPOrder(auction.order) && auction.order.numSlices > 0) {
return total / auction.order.numSlices;

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.

This doesn't look correct.
See this TWAPOrder, 4 txs, 25% filled each, total = sum(txs) /slices = 4 * 25 / 4 ?

Not to mention if you did this for filledPercent in TWAP, why didn't you do the same for tx.receivedAmount in getTransactionAmounts. Doesn't make sense

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.

Good eye! Now this helper should work as before -- dbefdca

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