Conversation
There was a problem hiding this comment.
Pull request overview
Ports the Rust price crate into the TypeScript SDK (ts-sdk) and aligns TS path aliases so the frontend and SDK can coexist without @/* collisions.
Changes:
- Added a new
ts-sdk/src/price/*module (encoding/decoding, conversions, client helpers) with Jest unit tests. - Added liquidity helper utilities (
marketLiquidity,totalLiquidity) plus unit tests. - Updated TS path aliases in
ts-sdkandfrontendso SDK imports use@/ts-sdk/*.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| ts-sdk/tsconfig.json | Switch SDK path alias to @/ts-sdk/* to avoid frontend conflict. |
| frontend/tsconfig.json | Adds @/ts-sdk and @/ts-sdk/* aliases into the frontend. |
| ts-sdk/src/price/* | New TS port of the Rust price crate (encoding/decoding/helpers). |
| ts-sdk/src/utils/liquidity.ts | New liquidity aggregation helpers built on the price utilities. |
| ts-sdk/src/utils/index.ts | New fetchDropsetMarketAccounts/views helpers; re-exports liquidity helpers. |
| ts-sdk/src/types/index.ts | Adds DropsetMarketAccount / DropsetMarketView convenience types. |
| ts-sdk/src/tests/unit/** | Adds unit tests for price + liquidity; updates imports for new alias. |
| ts-sdk/src/tests/e2e/dropset-accounts.test.ts | Updates e2e tests to use the new fetch helpers and aliases. |
| ts-sdk/src/dropset-interface/market-view-all.ts, ts-sdk/src/const.ts | Updates internal imports to the new @/ts-sdk/* alias. |
| ts-sdk/package.json, pnpm-workspace.yaml | Adds decimal.js and catalogs it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { Decimal } from "decimal.js"; | ||
| import { ensureU8, ensureU32, type U8 } from "../rust-types"; | ||
| import { decimalPow10 } from "./client-helpers"; | ||
| import { ENCODED_PRICE_INFINITY, ENCODED_PRICE_ZERO } from "./encoded-price"; | ||
| import { PriceError } from "./error"; | ||
| import { BIAS, PRICE_MANTISSA_BITS, PRICE_MANTISSA_MASK } from "./lib"; |
There was a problem hiding this comment.
There is a circular module dependency between decoded-price.ts and client-helpers.ts (decoded-price imports decimalPow10 from client-helpers, while client-helpers imports decodePrice/decodedPriceToDecimal from decoded-price). With Jest/ts-jest (CommonJS) this pattern can lead to partially-initialized exports at runtime (e.g. decodePrice being undefined inside client-helpers), depending on evaluation order. Consider breaking the cycle by moving decimalPow10 into a small standalone module (e.g. pow10.ts) or by inlining the power-of-10 logic in decodedPriceToDecimal.
Summary
Ports the
priceRust crate to the TypeScript SDK with unit tests and a few misc extra helper functions for the frontend to use.Also updates the
frontend/tsconfig.jsonand thets-sdk/tsconfig.jsonto work together properly by aliasing thets-sdkpaths to@/ts-sdk/*rather than@/*(which conflicts with the frontend doing the same thing).Changes
pricemodule tots-sdk. This ports the Rustpricecrate (encoding, decoding, mantissa validation, order info, client helpers) to TypeScript usingdecimal.jsquoteFromBase/baseFromQuoteconversion utilities withbigintandDecimaloverloadsliquidityutilities (marketLiquidity,totalLiquidity) for aggregating quote-denominated liquidity across order booksDropsetMarketAccountandDropsetMarketViewtypesgetDropsetMarketstofetchDropsetMarketAccountsand addfetchDropsetMarketViewshelpertsconfigpath aliases to@/ts-sdk/*acrossts-sdkandfrontenddecimal.jsdependency (cataloged inpnpm-workspace.yaml)