Tags: Polymarket/clob-client
Tags
refactor: port clob-order-utils into clob-client (#312) ### What changed - Vendored order-utils surface into new local module: - [src/order-utils/index.ts](/Users/carlos/Developer/clob-client/src/order-utils/index.ts) - [src/order-utils/exchange.order.builder.ts](/Users/carlos/Developer/clob-client/src/order-utils/exchange.order.builder.ts) - [src/order-utils/exchange.order.const.ts](/Users/carlos/Developer/clob-client/src/order-utils/exchange.order.const.ts) - [src/order-utils/utils.ts](/Users/carlos/Developer/clob-client/src/order-utils/utils.ts) - [src/order-utils/model/eip712.model.ts](/Users/carlos/Developer/clob-client/src/order-utils/model/eip712.model.ts) - [src/order-utils/model/order.model.ts](/Users/carlos/Developer/clob-client/src/order-utils/model/order.model.ts) - [src/order-utils/model/order-side.model.ts](/Users/carlos/Developer/clob-client/src/order-utils/model/order-side.model.ts) - [src/order-utils/model/signature-types.model.ts](/Users/carlos/Developer/clob-client/src/order-utils/model/signature-types.model.ts) - Replaced all `@polymarket/order-utils` imports in source/tests/examples with local imports. - Updated root exports in [src/index.ts](/Users/carlos/Developer/clob-client/src/index.ts): - Re-exported `SignatureType`, `ExchangeOrderBuilder` - Re-exported vendored side enum as `OrderSide` - Re-exported order/EIP712 types. - Removed dependency from [package.json](/Users/carlos/Developer/clob-client/package.json) and regenerated [pnpm-lock.yaml](/Users/carlos/Developer/clob-client/pnpm-lock.yaml) via `pnpm remove`. - Fixed pre-existing typecheck blockers: - Added usage of example clients in [examples/signatureTypes.ts](/Users/carlos/Developer/clob-client/examples/signatureTypes.ts) - Added missing `last_trade_price` fixture field and updated expected hash in [tests/utilities.test.ts](/Users/carlos/Developer/clob-client/tests/utilities.test.ts) - Fixed Node 24 test-runner flow by changing [Makefile](/Users/carlos/Developer/clob-client/Makefile) test target to: - compile TS first (`tsc`) - run `mocha` against `dist/tests/**/*.test.js`. ### Validation run - `pnpm tsc -p tsconfig.json --noEmit` ✅ - `pnpm test` ✅ - `pnpm build` ✅ - `rg -n "@polymarket/order-utils" -S` ✅ no matches <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Moderate risk because it swaps a core order-signing dependency for a vendored implementation and changes the test compilation/execution flow; order hashing/signature typing and build outputs could diverge if the port differs from upstream. > > **Overview** > **Ports `@polymarket/order-utils` into this repo** by adding a new `src/order-utils` module (EIP-712 models, `ExchangeOrderBuilder`, signature/side enums, constants, and salt helper) and rewiring `ClobClient`, order builder/helpers, utilities, RFQ deps, tests, and examples to import from it. > > **Public API updates:** `src/index.ts` now re-exports `ExchangeOrderBuilder`, `SignatureType`, vendored `Side` as `OrderSide`, and related order/EIP-712 types; `package.json` drops the external `@polymarket/order-utils` dependency and bumps version to `5.3.0`. > > **Tooling/tests:** `make test` now compiles TS to `dist` and runs coverage against `dist/tests/**/*.test.js` using `mocha` (removing `ts-mocha`), and the utilities test fixture/hash expectation is updated to include `last_trade_price`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4a71d26. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
PreviousNext