Skip to content

Feature/1292 position history pagination - #1327

Open
0darkside0rbit-star wants to merge 2 commits into
drydocs:mainfrom
0darkside0rbit-star:feature/1292-position-history-pagination
Open

0darkside0rbit-star wants to merge 2 commits into
drydocs:mainfrom
0darkside0rbit-star:feature/1292-position-history-pagination

Conversation

@0darkside0rbit-star

Copy link
Copy Markdown

closes #1292

Summary

Test plan

  • pnpm lint && pnpm typecheck && pnpm test pass locally
  • [ ]

Closes #

@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Collins' projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 19, 2026

Copy link
Copy Markdown

@0darkside0rbit-star Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@collinsezedike collinsezedike left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0darkside0rbit-star the first commit, feat(web): add local activity receipts, is the same commit as #1325, which closes #1303. This PR closes only #1292. Remove that commit so it contains only the pagination work, per the one PR per issue rule in CONTRIBUTING.md. Otherwise it conflicts with #1325, and useSignAndSubmit.ts also conflicts with #1326.

The description leaves the Summary bullet empty, the Test plan unchecked and Closes # as a placeholder, and adds a lowercase closes #1292 above them. The PR title fails PR Title; use feat(api): add position history pagination. Lint & Typecheck, Test and E2E Tests also fail.

apps/docs/architecture/api.md does not document resolution, limit or cursor.

const DAY_MS = 24 * HOUR_MS;

export interface PositionHistoryBucket extends PositionSnapshot {
first: PositionSnapshot;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each bucket embeds full first and last snapshots, including vaults, on top of its own vaults. That roughly triples the payload per point in a change meant to bound response size. Drop first and last, or reduce them to the totals.

const eligible = cursorTimestamp === undefined
? buckets
: buckets.filter((bucket) => bucket.timestamp > cursorTimestamp);
const page = eligible.slice(0, limit);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without limit or cursor, this now returns the oldest 720 hourly buckets. YieldHistoryChart requests up to 90 days with neither parameter, which is about 2160 hourly buckets, so it receives the oldest 30 days and loses the newest 60. Keep the unpaginated response when none of resolution, limit or cursor is sent, or page from the newest bucket.

This branch has not been deployed

No deployments
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.

[API] Downsample and paginate position history

2 participants