Feat/delta v2#242
Conversation
This reverts commit 6942fb9.
| ).toString(), | ||
| }; | ||
| if (isTWAPOrder(auction.order) && auction.order.numSlices > 0) { | ||
| return total / auction.order.numSlices; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Good eye! Now this helper should work as before -- dbefdca
…ndling for TWAP orders
Feat/drop legacy LOrders
Chore/Order.refunds field
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8c5ad7c. Configure here.
| return scalingFactor < 0 | ||
| ? amount / base ** BigInt(-scalingFactor) | ||
| : amount * base ** BigInt(scalingFactor); | ||
| return total; |
There was a problem hiding this comment.
TWAP fill percent not normalized
High Severity
For TWAP auctions, getFilledPercent sums each transaction’s slice-level filledPercent and returns that total. Because those values are per-slice (0–100), a fully filled multi-slice order can report well over 100%, which breaks isPartiallyExecutedAuction, unified order data, and any UI that treats the result as overall order progress.
Triggered by learned rule: Understand Delta cross-chain auction execution model in OrderHelpers
Reviewed by Cursor Bugbot for commit 8c5ad7c. Configure here.
There was a problem hiding this comment.
they are not per slice, that was a mistake
@andriy-shymkiv maybe we have it left somewhere still? in a comment?


Note
High Risk
Large breaking change to Delta trading flows (build/sign/post, types, statuses, and URLs) plus removed limit/NFT public exports—integrators must migrate carefully to avoid failed or mis-signed orders.
Overview
This PR migrates the SDK’s Delta surface to v2: order construction is server-side via
POST /v2/delta/orders/build, returning aBuiltDeltaOrder(toSign,orderHash) that a singlesignDeltaOrdersigns for Standard, External, and TWAP families. Submit/build params shift fromdeltaPrice+ token amounts toroute,side, andslippage(orlimitAmount).Read/write API changes include
/v2/delta/prices(route-basedDeltaPrice), paginatedgetDeltaOrders, integrator statuses likeCOMPLETED(replacing custom EXECUTED/bridge polling),getBridgeRoutesinstead ofgetBridgeInfo, cancel via/v2/delta/orders/cancelwith renamed methods, andgetAgentsList. Local helpers for partner fee/amount resolution andDEFAULT_BRIDGEare removed from the build path; EIP-712 producers remain for on-chain pre-sign flows.OrderHelpersis reworked around the v2 auction envelope (input/output,transactions, explicitside) with guards forProductiveOrder/FillableOrder(read-only / non-buildable).Public package changes:
src/index.tsdrops limit and NFT order exports in favor of OTC modules; examples and README/DELTA/EXTERNAL docs are rewritten for v2. Adds@types/nodedev dependency.Reviewed by Cursor Bugbot for commit 8c5ad7c. Bugbot is set up for automated code reviews on this repo. Configure here.