Skip to content

Pagination reuses stale L2 headers and masks API errors #99

Description

@juliandelu

The cursor loops in getTrades, getOpenOrders, getPreMigrationOrders, getEarningsForUserForDay, and getUserEarningsAndMarketsConfig create L2 headers once before the loop and reuse them for every page. Because the timestamp is part of the HMAC, a long pagination run can eventually send stale authentication.

There is also a misleading failure mode: the HTTP helper returns an { error, status } object, then the loop spreads response.data and throws TypeError: undefined is not iterable, hiding the API error and discarding partial results.

Could the headers be regenerated for each page and error-shaped responses be checked before appending? A pagination test with delayed page responses should cover both cases.

Current main: f3e1a05; the affected loops are in src/client.ts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions