From 3d656acd3be6ce8a66b37d906d933997a22076ca Mon Sep 17 00:00:00 2001 From: Aleksander Date: Mon, 23 Dec 2024 14:50:23 +0000 Subject: [PATCH] Add support CID for fetchOrders/fetchTrades --- .../indexer/grpc/IndexerGrpcDerivativesApi.ts | 20 ++++++++++++++++++- .../client/indexer/grpc/IndexerGrpcSpotApi.ts | 19 +++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.ts index 3a310f6c9..8de3baa00 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.ts @@ -203,7 +203,8 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { orderSide?: OrderSide isConditional?: boolean subaccountId?: string - pagination?: PaginationOption + pagination?: PaginationOption, + cid?: string }) { const { marketId, @@ -212,6 +213,7 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { orderSide, isConditional, pagination, + cid, } = params || {} const request = InjectiveDerivativeExchangeRpc.OrdersRequest.create() @@ -236,6 +238,10 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { request.isConditional = isConditional ? 'true' : 'false' } + if (cid) { + request.cid = cid + } + if (pagination) { if (pagination.skip !== undefined) { request.skip = pagination.skip.toString() @@ -287,6 +293,7 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { direction?: TradeDirection isConditional?: boolean state?: OrderState + cid?: string, pagination?: PaginationOption }) { const { @@ -299,6 +306,7 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { isConditional, state, pagination, + cid, } = params || {} const request = InjectiveDerivativeExchangeRpc.OrdersHistoryRequest.create() @@ -335,6 +343,10 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { request.state = state } + if (cid) { + request.cid = cid + } + if (pagination) { if (pagination.skip !== undefined) { request.skip = pagination.skip.toString() @@ -546,6 +558,7 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { pagination?: PaginationOption executionSide?: TradeExecutionSide executionTypes?: TradeExecutionType[] + cid?: string }) { const { endTime, @@ -559,6 +572,7 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { executionSide, executionTypes, accountAddress, + cid, } = params || {} const request = InjectiveDerivativeExchangeRpc.TradesRequest.create() @@ -603,6 +617,10 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { request.endTime = endTime.toString() } + if (cid) { + request.cid = cid + } + if (pagination) { if (pagination.skip !== undefined) { request.skip = pagination.skip.toString() diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts index 4313ad123..fd898534e 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts @@ -121,8 +121,9 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { orderSide?: OrderSide isConditional?: boolean pagination?: PaginationOption + cid?: string }) { - const { marketId, marketIds, subaccountId, orderSide, pagination } = + const { marketId, marketIds, subaccountId, orderSide, pagination, cid } = params || {} const request = InjectiveSpotExchangeRpc.OrdersRequest.create() @@ -142,6 +143,10 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { request.orderSide = orderSide } + if (cid) { + request.cid = cid + } + /* if (isConditional !== undefined) { request.isConditional =isConditional @@ -200,6 +205,7 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { isConditional?: boolean state?: OrderState pagination?: PaginationOption + cid?: string }) { const { subaccountId, @@ -210,6 +216,7 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { direction, state, pagination, + cid, } = params || {} const request = InjectiveSpotExchangeRpc.OrdersHistoryRequest.create() @@ -242,6 +249,10 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { request.state = state } + if (cid) { + request.cid = cid + } + /* if (isConditional !== undefined) { request.isConditional =isConditional @@ -304,6 +315,7 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { pagination?: PaginationOption executionSide?: TradeExecutionSide executionTypes?: TradeExecutionType[] + cid?: string }) { const { endTime, @@ -317,6 +329,7 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { executionSide, executionTypes, accountAddress, + cid } = params || {} const request = InjectiveSpotExchangeRpc.TradesRequest.create() @@ -361,6 +374,10 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { request.endTime = endTime.toString() } + if (cid) { + request.cid = cid; + } + if (pagination) { if (pagination.skip !== undefined) { request.skip = pagination.skip.toString()