Skip to content

Conversation

@pxrl
Copy link
Contributor

@pxrl pxrl commented Jan 6, 2026

The PoolClient lives in the SDK but is only used by the frontend repository. Migrate it here to unburden the SDK.

Note that this is an almost 1:1 migration of pool from @across-protocol/sdk, with only minor adjustments to import statements. Claude is confident that we can trim it down even further, but I feel like that's better to do in-tree, since it's easier to reason about the behaviour being 1:1 when the migration is as simple as it can be. Happy to be overruled on that, if there are other preferences 👍

Original implementation here: https://github.com/across-protocol/sdk/tree/eb68fa48ac1738976305e11bed39a8a3fe2946bf/src/pool
Follow-up cleanup here: #2147

Subsequent SDK cleanup here (...blocked by this PR): across-protocol/sdk#1313

The PoolClient lives in the SDK but is only used by the frontend
repository. Migrate it here to unburden the SDK.
@vercel
Copy link

vercel bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
app-frontend-v3 Ready Ready Preview, Comment Jan 7, 2026 10:05am
sepolia-frontend-v3 Ready Ready Preview, Comment Jan 7, 2026 10:05am

@vercel
Copy link

vercel bot commented Jan 6, 2026

Deployment failed with the following error:

Hobby accounts are limited to daily cron jobs. This cron expression (* * * * *) would run more than once per day. Upgrade to the Pro plan to unlock all Cron Jobs features on Vercel.

Learn More: https://vercel.link/3Fpeeb1

@pxrl
Copy link
Contributor Author

pxrl commented Jan 6, 2026

Specifically on the size of this commit (+ ~1500 Loc) vs the corresponding removal in the SDK (- ~1300 LoC), the delta is related to 80 line prettier config in frontend, vs. 120 in sdk:

● Now I understand! The frontend migration added more lines (1,557) than the SDK removed (1,281) - a difference of 276 lines - primarily due to code formatting differences between the two repositories.
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Looking at the actual diff, the functional code is nearly identical, but the frontend has more aggressive code formatting rules that add line breaks:

  SDK style (compact):
  import { bnZero, toBNWei, fixedPointAdjustment } from "../utils";
  export type EmitState = (path: string[], data: Pool | User | Transaction | Error) => void;

  Frontend style (expanded):
  import {
    contracts,
    lpFeeCalculator,
    utils as sdkUtils,
  } from "@across-protocol/sdk";
  export type EmitState = (
    path: string[],
    data: Pool | User | Transaction | Error
  ) => void;

  The frontend repository enforces:
  - Multi-line import statements
  - Multi-line function signatures
  - Multi-line type definitions
  - More explicit line breaks in complex expressions

  This is likely due to different prettier/eslint configurations between the repositories. The SDK uses a more compact style, while the frontend enforces stricter line-length limits and more vertical spacing.

This reverts commit 049fae2.
@pxrl
Copy link
Contributor Author

pxrl commented Jan 9, 2026

Just to give greater confidence, claude put some tests together for me (see attached). There are some differences between the results, but they're quite small and might be due to caching on the production api.

sh test-pool-endpoints.sh                                                                                                                                                                       12:40:02 [20/639]
Testing Pool Endpoints
======================                                     
                                                               
Production URL: https://app.across.to/api 
Preview URL: https://app-frontend-v3-git-pxrl-pooly-uma.vercel.app/api
                                                               
=== PRODUCTION TESTS ===                         
[WETH] Testing /pools?token=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
{"address":"0xc186fA914353c44b2E33eBE05f21846F1048bEda","totalPoolSize":"5601662868507206338210","l1Token":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2","lpToken":"0x28F77208728B0A45cAb24c4868334581Fe86F95B","liquidReserves":"3272153595471493017414","excha
ngeRateCurrent":"1109084255630291859","exchangeRatePrevious":"1109084229989688778","estimatedApy":"0.006079759805345760","estimatedApr":"0.006079759873877271","blocksElapsed":10,"secondsElapsed":120,"projectedApr":"0.006231984390942308","utilizedReserves"
:"2329509273035713320796","liquidityUtilizationCurrent":"415465626062820596"}
                                                               
[USDC] Testing /pools?token=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
{"address":"0xc186fA914353c44b2E33eBE05f21846F1048bEda","totalPoolSize":"2182193640413","l1Token":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","lpToken":"0xC9b09405959f63F72725828b5d449488b02be1cA","liquidReserves":"1033146237426","exchangeRateCurrent":"1
059390271148626941","exchangeRatePrevious":"1059390245559106637","estimatedApy":"0.006352269145470000","estimatedApr":"0.006352269220672618","blocksElapsed":10,"secondsElapsed":120,"projectedApr":"0.004540317174590816","utilizedReserves":"1149047402987","
liquidityUtilizationCurrent":"454031717459081633"}                                                                             
                                                               
[WETH User] Testing /pools-user?token=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&user=0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D
{"address":"0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D","poolAddress":"0xc186fA914353c44b2E33eBE05f21846F1048bEda","lpTokens":"49242327057239902","positionValue":"65311700960327126","totalDeposited":"40079171091161244","feesEarned":"25232529869165882"}
                                                               
                                                               
=== PREVIEW TESTS ===
[WETH] Testing /pools?token=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
{"address":"0xc186fA914353c44b2E33eBE05f21846F1048bEda","totalPoolSize":"5601662868507206338210","l1Token":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2","lpToken":"0x28F77208728B0A45cAb24c4868334581Fe86F95B","liquidReserves":"3272153595471493017414","excha
ngeRateCurrent":"1109084265886533092","exchangeRatePrevious":"1109084240245930010","estimatedApy":"0.006079759748542080","estimatedApr":"0.006079759817891889","blocksElapsed":10,"secondsElapsed":120,"projectedApr":"0.006231984390942308","utilizedReserves"
:"2329509273035713320796","liquidityUtilizationCurrent":"415465626062820596"}

[USDC] Testing /pools?token=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
{"address":"0xc186fA914353c44b2E33eBE05f21846F1048bEda","totalPoolSize":"2182193640413","l1Token":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","lpToken":"0xC9b09405959f63F72725828b5d449488b02be1cA","liquidReserves":"1033146237426","exchangeRateCurrent":"1
059390281384143743","exchangeRatePrevious":"1059390255794623439","estimatedApy":"0.006352269082354800","estimatedApr":"0.006352269159298863","blocksElapsed":10,"secondsElapsed":120,"projectedApr":"0.004540317174590816","utilizedReserves":"1149047402987","
liquidityUtilizationCurrent":"454031717459081633"}

[WETH User] Testing /pools-user?token=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2&user=0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D
{"address":"0x9A8f92a830A5cB89a3816e3D267CB7791c16b04D","poolAddress":"0xc186fA914353c44b2E33eBE05f21846F1048bEda","lpTokens":"49242327057239902","positionValue":"65311700960327126","totalDeposited":"40079171091161244","feesEarned":"25232529869165882"}


=== COMPARISONS ===
Comparing /pools?token=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2...
✗ Responses differ:
--- /tmp/prod.json      2026-01-09 12:40:01.913953280 +0000
+++ /tmp/preview.json   2026-01-09 12:40:01.918953216 +0000
@@ -1,10 +1,10 @@
 {
   "address": "0xc186fA914353c44b2E33eBE05f21846F1048bEda",
   "blocksElapsed": 10,
-  "estimatedApr": "0.006079759873877271",
-  "estimatedApy": "0.006079759805345760",
-  "exchangeRateCurrent": "1109084255630291859",
-  "exchangeRatePrevious": "1109084229989688778",
+  "estimatedApr": "0.006079759817891889",
+  "estimatedApy": "0.006079759748542080",
+  "exchangeRateCurrent": "1109084265886533092",
+  "exchangeRatePrevious": "1109084240245930010",
   "l1Token": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
   "liquidReserves": "3272153595471493017414",
   "liquidityUtilizationCurrent": "415465626062820596",

Comparing /pools?token=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48...

test-pool-endpoints.js
test-pool-endpoints.sh
test-pool-endpoints-README.md

@pxrl pxrl merged commit 4becd8d into master Jan 9, 2026
9 of 12 checks passed
@pxrl pxrl deleted the pxrl/pooly branch January 9, 2026 12:43
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