fix: unwrap order wrapper from POST /orders/by_uids response (COW-979)#64
Merged
lgahdl merged 4 commits intoMay 28, 2026
Conversation
Deploy M3
feat: COW-970/972/973/969/922 — timestamp policy, candidate expiry, ownerAddressType, GQL docs, bootstrap retry queue
The by_uids endpoint returns [{order: {...}}] but the code was treating
it as a flat OrderbookOrder[]. This caused order.uid to be undefined,
so fetchOrderStatusByUids returned an empty map for all candidates,
preventing C2 from ever promoting candidateDiscreteOrders to discreteOrders.
Verify the { order } unwrap fix with a real HTTP server: 6 tests covering
correct uid→status mapping, executed amounts, multiple orders, HTTP errors,
and empty responses. Adds ponder/ponder:schema vitest stubs to resolve
virtual module imports without a running Ponder process.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
yvesfracari
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
POST /api/v1/orders/by_uidsendpoint returns[{ order: {...} }](each order wrapped in an"order"key), but the code was treating each array element as a flatOrderbookOrder. This causedorder.uidto always beundefined, makingfetchOrderStatusByUidsreturn an empty map for every candidate — so C2 (CandidateConfirmer) and C3 (StatusUpdater) were silently skipping all candidates and open orders indefinitely.Changes
item.orderfrom each element of theby_uidsresponse infetchOrdersByUids(orderbookClient.ts)How to Test
candidateDiscreteOrderswhosevalidTohas passed and whose status on the CoW orderbook API isfulfilledorexpireddiscreteOrderwithin a few blocksChecklist
Breaking Changes
None
Related Issues
COW-979