From 5c04320ee114d9172e49ee42165f45bd909382d6 Mon Sep 17 00:00:00 2001 From: nktkas Date: Sun, 2 Aug 2026 03:27:16 +0300 Subject: [PATCH] refactor(api/userFills): add `feeTrialEscrow` and make `liquidatedUser` optional Co-authored-by: Claude Opus 5 (1M context) --- src/api/info/_methods/_base/_schemas.ts | 5 +++++ src/api/info/_methods/userFills.ts | 2 +- tests/api/info/userFills.test.ts | 2 ++ tests/api/info/userFillsByTime.test.ts | 2 ++ tests/api/info/userTwapSliceFills.test.ts | 1 + tests/api/info/userTwapSliceFillsByTime.test.ts | 1 + tests/api/subscription/userEvents.test.ts | 1 + tests/api/subscription/userFills.test.ts | 2 ++ tests/api/subscription/userTwapSliceFills.test.ts | 1 + 9 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/api/info/_methods/_base/_schemas.ts b/src/api/info/_methods/_base/_schemas.ts index c97167515..11c055883 100644 --- a/src/api/info/_methods/_base/_schemas.ts +++ b/src/api/info/_methods/_base/_schemas.ts @@ -348,6 +348,11 @@ export type UserFill = { tid: number; /** Token in which the fee is denominated (e.g., USDC). */ feeToken: string; + /** + * Fee trial escrow amount. + * @pattern ^[0-9]+(\.[0-9]+)?$ + */ + feeTrialEscrow?: string; /** ID of the TWAP. */ twapId: number | null; }; diff --git a/src/api/info/_methods/userFills.ts b/src/api/info/_methods/userFills.ts index 81a2bd917..fbfd01a13 100644 --- a/src/api/info/_methods/userFills.ts +++ b/src/api/info/_methods/userFills.ts @@ -39,7 +39,7 @@ export type UserFillsResponse = (UserFill & { * Address of the liquidated user. * @pattern ^0x[a-fA-F0-9]{40}$ */ - liquidatedUser: `0x${string}`; + liquidatedUser?: `0x${string}`; /** * Mark price at the time of liquidation. * @pattern ^[0-9]+(\.[0-9]+)?$ diff --git a/tests/api/info/userFills.test.ts b/tests/api/info/userFills.test.ts index 7caacbf48..538a9d749 100644 --- a/tests/api/info/userFills.test.ts +++ b/tests/api/info/userFills.test.ts @@ -16,6 +16,7 @@ runTest({ { user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9" }, { user: "0x8172cc20bc3a55dcd07c75dd37ac0c2534de3b84", aggregateByTime: true }, { user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", aggregateByTime: false }, + { user: "0xd8cb8d9747f50be8e423c698f9104ee090540961" }, // feeTrialEscrow present ]; const data = await Promise.all(params.map((p) => client.userFills(p))); @@ -23,6 +24,7 @@ runTest({ schemaCoverage(paramsSchema, params); schemaCoverage(responseSchema, data, [ "#/items/properties/twapId/defined", + "#/items/properties/liquidation/properties/liquidatedUser/missing", ]); }, }); diff --git a/tests/api/info/userFillsByTime.test.ts b/tests/api/info/userFillsByTime.test.ts index 2445e96a5..fb1958185 100644 --- a/tests/api/info/userFillsByTime.test.ts +++ b/tests/api/info/userFillsByTime.test.ts @@ -23,6 +23,8 @@ runTest({ { user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", startTime: now - fiveYears, aggregateByTime: false }, { user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", startTime: now - fiveYears, reversed: true }, { user: "0x563C175E6f11582f65D6d9E360A618699DEe14a9", startTime: now - fiveYears, reversed: false }, + { user: "0xd8cb8d9747f50be8e423c698f9104ee090540961", startTime: now - fiveYears }, // liquidation without liquidatedUser + { user: "0xd8cb8d9747f50be8e423c698f9104ee090540961", startTime: now - fiveYears, reversed: true }, // feeTrialEscrow present ]; const data = await Promise.all(params.map((p) => client.userFillsByTime(p))); diff --git a/tests/api/info/userTwapSliceFills.test.ts b/tests/api/info/userTwapSliceFills.test.ts index e87c91b2c..b10d30c5d 100644 --- a/tests/api/info/userTwapSliceFills.test.ts +++ b/tests/api/info/userTwapSliceFills.test.ts @@ -21,6 +21,7 @@ runTest({ schemaCoverage(paramsSchema, params); schemaCoverage(responseSchema, data, [ "#/items/properties/fill/properties/builderFee/present", + "#/items/properties/fill/properties/feeTrialEscrow/present", "#/items/properties/fill/properties/twapId/defined", ]); }, diff --git a/tests/api/info/userTwapSliceFillsByTime.test.ts b/tests/api/info/userTwapSliceFillsByTime.test.ts index 1605dbbd9..821da2278 100644 --- a/tests/api/info/userTwapSliceFillsByTime.test.ts +++ b/tests/api/info/userTwapSliceFillsByTime.test.ts @@ -25,6 +25,7 @@ runTest({ schemaCoverage(paramsSchema, params); schemaCoverage(responseSchema, data, [ "#/items/properties/fill/properties/builderFee/present", + "#/items/properties/fill/properties/feeTrialEscrow/present", "#/items/properties/fill/properties/twapId/defined", ]); }, diff --git a/tests/api/subscription/userEvents.test.ts b/tests/api/subscription/userEvents.test.ts index 2acd933be..4af8cd87f 100644 --- a/tests/api/subscription/userEvents.test.ts +++ b/tests/api/subscription/userEvents.test.ts @@ -44,6 +44,7 @@ runTestWithExchange({ "#/anyOf/4/properties/twapHistory/items/properties/twapId/missing", "#/anyOf/5/properties/twapSliceFills/items/properties/fill/properties/side/enum/1", "#/anyOf/5/properties/twapSliceFills/items/properties/fill/properties/builderFee/present", + "#/anyOf/5/properties/twapSliceFills/items/properties/fill/properties/feeTrialEscrow/present", "#/anyOf/5/properties/twapSliceFills/items/properties/fill/properties/twapId/defined", ]); }, diff --git a/tests/api/subscription/userFills.test.ts b/tests/api/subscription/userFills.test.ts index eb0869b85..5fe26767f 100644 --- a/tests/api/subscription/userFills.test.ts +++ b/tests/api/subscription/userFills.test.ts @@ -25,7 +25,9 @@ runTest({ schemaCoverage(paramsSchema, params); schemaCoverage(responseSchema, data, [ "#/properties/fills/items/properties/builderFee/present", + "#/properties/fills/items/properties/feeTrialEscrow/present", "#/properties/fills/items/properties/twapId/defined", + "#/properties/fills/items/properties/liquidation/properties/liquidatedUser/missing", "#/properties/isSnapshot/missing", ]); }, diff --git a/tests/api/subscription/userTwapSliceFills.test.ts b/tests/api/subscription/userTwapSliceFills.test.ts index 0c4ca55ba..3aea86dc4 100644 --- a/tests/api/subscription/userTwapSliceFills.test.ts +++ b/tests/api/subscription/userTwapSliceFills.test.ts @@ -29,6 +29,7 @@ runTest({ schemaCoverage(paramsSchema, params); schemaCoverage(responseSchema, data, [ "#/properties/twapSliceFills/items/properties/fill/properties/builderFee/present", + "#/properties/twapSliceFills/items/properties/fill/properties/feeTrialEscrow/present", "#/properties/twapSliceFills/items/properties/fill/properties/twapId/defined", "#/properties/isSnapshot/missing", ]);