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.
The cursor loops in
getTrades,getOpenOrders,getPreMigrationOrders,getEarningsForUserForDay, andgetUserEarningsAndMarketsConfigcreate 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 spreadsresponse.dataand throwsTypeError: 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 insrc/client.ts.