Skip to content

fix: unwrap order wrapper from POST /orders/by_uids response (COW-979)#64

Merged
lgahdl merged 4 commits into
developfrom
luizhatem/cow-979-bug-candidatediscreteorder-fulfilled-not-promoted-to
May 28, 2026
Merged

fix: unwrap order wrapper from POST /orders/by_uids response (COW-979)#64
lgahdl merged 4 commits into
developfrom
luizhatem/cow-979-bug-candidatediscreteorder-fulfilled-not-promoted-to

Conversation

@lgahdl
Copy link
Copy Markdown
Contributor

@lgahdl lgahdl commented May 28, 2026

Summary

The POST /api/v1/orders/by_uids endpoint returns [{ order: {...} }] (each order wrapped in an "order" key), but the code was treating each array element as a flat OrderbookOrder. This caused order.uid to always be undefined, making fetchOrderStatusByUids return an empty map for every candidate — so C2 (CandidateConfirmer) and C3 (StatusUpdater) were silently skipping all candidates and open orders indefinitely.

Changes

  • Unwrap item.order from each element of the by_uids response in fetchOrdersByUids (orderbookClient.ts)

How to Test

  1. Run the indexer against a chain that has stuck candidateDiscreteOrders whose validTo has passed and whose status on the CoW orderbook API is fulfilled or expired
  2. Verify that after the fix, those candidates are promoted to discreteOrder within a few blocks

Checklist

  • Tests pass locally
  • Linting passes
  • Documentation updated (if needed)
  • Breaking changes documented (if any)

Breaking Changes

None

Related Issues

COW-979

jeffersonBastos and others added 3 commits May 6, 2026 10:39
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.
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 28, 2026

COW-979

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>
@lgahdl lgahdl merged commit ce3b10f into develop May 28, 2026
5 checks passed
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.

3 participants