Skip to content

feat: allow fetching twap deltas - #996

Draft
kernelwhisperer wants to merge 1 commit into
mainfrom
feat/twap-deltas
Draft

feat: allow fetching twap deltas#996
kernelwhisperer wants to merge 1 commit into
mainfrom
feat/twap-deltas

Conversation

@kernelwhisperer

@kernelwhisperer kernelwhisperer commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of: FE-349

Add an optional updatedAtBlockGte filter to getTwapOrders. Clients can fetch changed TWAP parents instead of the full list.

  • Accept a non-negative bigint and serialize it for GraphQL.
  • Preserve existing behavior when the filter is absent.
  • Add tests for filter serialization and negative-value rejection.

To Test

  1. Call getTwapOrders without updatedAtBlockGte.
  • Verify that existing pagination and ordering remain unchanged.
  1. Call getTwapOrders with updatedAtBlockGte set to a known block.
  • Verify that results contain only parents updated at or after that block.
  • Verify that totalCount represents the filtered results, not all TWAPs.
  1. Call getTwapOrders with updatedAtBlockGte: -1n.
  • Verify that input validation rejects the request.

Background

This filter supports delta polling in the frontend without a separate SDK method or GraphQL query.

The boundary is inclusive. Consecutive requests can return the same orders, so clients must merge results by order ID.

Self-checks

  • I have read CONTRIBUTING.md
  • I have manually tested changes on Vercel preview deployment
  • I have done self-review and (or) AI review
  • I have addressed all comments from @coderabbitai
  • I have less than three open PRs/Stacks in this repo at the moment of creating this PR

@kernelwhisperer kernelwhisperer self-assigned this Sep 7, 2026
@linear-code

linear-code Bot commented Sep 7, 2026

Copy link
Copy Markdown

FE-349

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

📦 GitHub Packages Published

Last updated: Sep 7, 2026, 11:05:58 AM UTC

The following packages have been published to GitHub Packages with pre-release version pr-996-9c0a2c1e:

  • @cowprotocol/cow-sdk@9.2.8-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-app-data@6.0.1-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-bridging@4.4.4-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-common@0.12.2-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-composable@1.4.1-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-config@2.5.0-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-contracts-ts@3.5.0-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-cow-shed@0.4.7-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-ethers-v5-adapter@0.4.12-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-ethers-v6-adapter@0.4.12-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-flash-loans@3.3.5-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-order-book@4.0.3-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-order-signing@1.1.8-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-subgraph@1.2.2-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-trading-solana@0.2.0-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-trading@2.4.0-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-viem-adapter@0.3.27-pr-996-9c0a2c1e.0
  • @cowprotocol/sdk-weiroll@0.2.3-pr-996-9c0a2c1e.0

Installation

These packages require authentication to install from GitHub Packages. First, create a .npmrc file:

# Create .npmrc file in your project root
echo "@cowprotocol:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrc

To get your GitHub token:

  1. Go to https://github.com/settings/tokens
  2. Click "Generate new token (classic)"
  3. Check only the "read:packages" scope
  4. Copy the token and replace YOUR_GITHUB_TOKEN in the .npmrc file

Then install any of the packages above, either by exact version (i.e. @cowprotocol/cow-sdk@9.2.8-pr-996-9c0a2c1e.0) or more conveniently by using the tag (@cowprotocol/cow-sdk@pr-996):

# Yarn
yarn add npm:@cowprotocol/cow-sdk@pr-996

# pnpm
pnpm install npm:@cowprotocol/cow-sdk@pr-996

# NPM
npm install npm:@cowprotocol/cow-sdk@pr-996

Update to the latest version (only if you used the tag)

Every commit will publish a new package. To upgrade to the latest version, run:

# Yarn
yarn upgrade @cowprotocol/cow-sdk

# pnpm
pnpm update @cowprotocol/cow-sdk

# NPM
npm update @cowprotocol/cow-sdk

View Packages

You can view the published packages at: https://github.com/cowprotocol/cow-sdk/packages

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.

1 participant