diff --git a/indexer/services/comlink/__tests__/controllers/api/v4/fills-controller.test.ts b/indexer/services/comlink/__tests__/controllers/api/v4/fills-controller.test.ts index a1a8857009..00eb2283af 100644 --- a/indexer/services/comlink/__tests__/controllers/api/v4/fills-controller.test.ts +++ b/indexer/services/comlink/__tests__/controllers/api/v4/fills-controller.test.ts @@ -107,6 +107,7 @@ describe('fills-controller#V4', () => { orderId: ethOrder.id, createdAt: ethFill.createdAt, createdAtHeight: ethFill.createdAtHeight, + subaccountNumber: defaultSubaccountNumber, }; // Only the ETH-USD order should be returned diff --git a/indexer/services/comlink/public/api-documentation.md b/indexer/services/comlink/public/api-documentation.md index f1c932f218..46cbc57c80 100644 --- a/indexer/services/comlink/public/api-documentation.md +++ b/indexer/services/comlink/public/api-documentation.md @@ -580,7 +580,8 @@ fetch('https://dydx-testnet.imperator.co/v4/fills?address=string&subaccountNumbe "createdAt": "string", "createdAtHeight": "string", "orderId": "string", - "clientMetadata": "string" + "clientMetadata": "string", + "subaccountNumber": 0 } ] } @@ -2598,7 +2599,8 @@ This operation does not require authentication "createdAt": "string", "createdAtHeight": "string", "orderId": "string", - "clientMetadata": "string" + "clientMetadata": "string", + "subaccountNumber": 0 } ``` @@ -2620,6 +2622,7 @@ This operation does not require authentication |createdAtHeight|string|true|none|none| |orderId|string|false|none|none| |clientMetadata|string|false|none|none| +|subaccountNumber|number(double)|true|none|none| ## FillResponse @@ -2644,7 +2647,8 @@ This operation does not require authentication "createdAt": "string", "createdAtHeight": "string", "orderId": "string", - "clientMetadata": "string" + "clientMetadata": "string", + "subaccountNumber": 0 } ] } diff --git a/indexer/services/comlink/public/swagger.json b/indexer/services/comlink/public/swagger.json index a3ae9dbf22..e7ca71e256 100644 --- a/indexer/services/comlink/public/swagger.json +++ b/indexer/services/comlink/public/swagger.json @@ -409,6 +409,10 @@ }, "clientMetadata": { "type": "string" + }, + "subaccountNumber": { + "type": "number", + "format": "double" } }, "required": [ @@ -422,7 +426,8 @@ "size", "fee", "createdAt", - "createdAtHeight" + "createdAtHeight", + "subaccountNumber" ], "type": "object", "additionalProperties": false diff --git a/indexer/services/comlink/src/controllers/api/v4/fills-controller.ts b/indexer/services/comlink/src/controllers/api/v4/fills-controller.ts index eed5255103..52e0d6a0a2 100644 --- a/indexer/services/comlink/src/controllers/api/v4/fills-controller.ts +++ b/indexer/services/comlink/src/controllers/api/v4/fills-controller.ts @@ -90,7 +90,7 @@ class FillsController extends Controller { return { fills: fills.map((fill: FillFromDatabase): FillResponseObject => { - return fillToResponseObject(fill, clobPairIdToMarket); + return fillToResponseObject(fill, clobPairIdToMarket, subaccountNumber); }), }; } @@ -139,13 +139,16 @@ router.get( createdBeforeOrAt, }: FillRequest = matchedData(req) as FillRequest; + // The schema checks allow subaccountNumber to be a string, but we know it's a number here. + const subaccountNum : number = +subaccountNumber; + // TODO(DEC-656): Change to using a cache of markets in Redis similar to Librarian instead of // querying the DB. try { const controller: FillsController = new FillsController(); const response: FillResponse = await controller.getFills( address, - subaccountNumber, + subaccountNum, market, marketType, limit, diff --git a/indexer/services/comlink/src/request-helpers/request-transformer.ts b/indexer/services/comlink/src/request-helpers/request-transformer.ts index 1fe32aa721..1b1e69e982 100644 --- a/indexer/services/comlink/src/request-helpers/request-transformer.ts +++ b/indexer/services/comlink/src/request-helpers/request-transformer.ts @@ -134,6 +134,7 @@ export function assetPositionToResponseObject( export function fillToResponseObject( fill: FillFromDatabase, marketsByClobPairId: MarketAndTypeByClobPairId, + subaccountNumber: number, ): FillResponseObject { return { id: fill.id, @@ -149,6 +150,7 @@ export function fillToResponseObject( createdAtHeight: fill.createdAtHeight, orderId: fill.orderId, clientMetadata: fill.clientMetadata, + subaccountNumber, }; } diff --git a/indexer/services/comlink/src/types.ts b/indexer/services/comlink/src/types.ts index c61fdd55fc..57c4e092e0 100644 --- a/indexer/services/comlink/src/types.ts +++ b/indexer/services/comlink/src/types.ts @@ -129,6 +129,7 @@ export interface FillResponseObject { createdAtHeight: string, orderId?: string, clientMetadata?: string, + subaccountNumber: number, } /* ------- TRANSFER TYPES ------- */