@cowprotocol/sdk-order-book 0.3.2 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1121,6 +1121,15 @@ type GetOrdersRequest = {
1121
1121
  offset?: number;
1122
1122
  limit?: number;
1123
1123
  };
1124
+ /**
1125
+ * The parameters for the `getTrades` request.
1126
+ */
1127
+ type GetTradesRequest = {
1128
+ owner?: Address;
1129
+ orderUid?: UID;
1130
+ offset?: number;
1131
+ limit?: number;
1132
+ };
1124
1133
  /**
1125
1134
  * The CoW Protocol OrderBook API client.
1126
1135
  *
@@ -1204,10 +1213,7 @@ declare class OrderBookApi {
1204
1213
  * @param contextOverride Optional context override for this request.
1205
1214
  * @returns A list of trades matching the request.
1206
1215
  */
1207
- getTrades(request: {
1208
- owner?: Address;
1209
- orderUid?: UID;
1210
- }, contextOverride?: PartialApiContext): Promise<Array<Trade>>;
1216
+ getTrades(request: GetTradesRequest, contextOverride?: PartialApiContext): Promise<Array<Trade>>;
1211
1217
  /**
1212
1218
  * Get a list of orders for a given `owner`.
1213
1219
  * @param request The request parameters with `request.offset = 0` and `request.limit = 1000` by default.
@@ -1419,4 +1425,4 @@ type BigNumber = {
1419
1425
  */
1420
1426
  declare function getBigNumber(value: string | bigint | number, decimals: number): BigNumber;
1421
1427
 
1422
- export { type Address, type Amounts, type AppData, type AppDataHash, type AppDataObject, type Auction, type AuctionOrder, type AuctionPrices, type BigUint, BuyTokenDestination, type CallData, type CompetitionAuction, CompetitionOrderStatus, type Costs, DEFAULT_BACKOFF_OPTIONS, DEFAULT_LIMITER_OPTIONS, type EcdsaSignature, EcdsaSigningScheme, type EnrichedOrder, type EthflowData, type ExecutedAmounts, type ExecutedProtocolFee, type FeePolicy, type FetchParams, type GetOrdersRequest, type InteractionData, type NativePriceResponse, ORDER_BOOK_PROD_CONFIG, ORDER_BOOK_STAGING_CONFIG, OnchainOrderData, type Order, OrderBookApi, OrderBookApiError, type OrderCancellation, OrderCancellationError, type OrderCancellations, OrderClass, type OrderCreation, OrderKind, type OrderMetaData, type OrderParameters, OrderPostError, type OrderQuoteRequest, type OrderQuoteResponse, type OrderQuoteSide, OrderQuoteSideKindBuy, OrderQuoteSideKindSell, type OrderQuoteValidity, OrderStatus, type PreSignature, PriceEstimationError, type PriceImprovement, PriceQuality, type Quote, type QuoteAmountsAndCosts, type QuoteAmountsAndCostsParams, SellTokenSource, type Signature, SigningScheme, type SolverCompetitionResponse, type SolverSettlement, type Surplus, type TokenAmount, type TotalSurplus, type Trade, type TransactionHash, type UID, type Volume, getBigNumber, getQuoteAmountsAndCosts, getQuoteAmountsWithCosts, request };
1428
+ export { type Address, type Amounts, type AppData, type AppDataHash, type AppDataObject, type Auction, type AuctionOrder, type AuctionPrices, type BigUint, BuyTokenDestination, type CallData, type CompetitionAuction, CompetitionOrderStatus, type Costs, DEFAULT_BACKOFF_OPTIONS, DEFAULT_LIMITER_OPTIONS, type EcdsaSignature, EcdsaSigningScheme, type EnrichedOrder, type EthflowData, type ExecutedAmounts, type ExecutedProtocolFee, type FeePolicy, type FetchParams, type GetOrdersRequest, type GetTradesRequest, type InteractionData, type NativePriceResponse, ORDER_BOOK_PROD_CONFIG, ORDER_BOOK_STAGING_CONFIG, OnchainOrderData, type Order, OrderBookApi, OrderBookApiError, type OrderCancellation, OrderCancellationError, type OrderCancellations, OrderClass, type OrderCreation, OrderKind, type OrderMetaData, type OrderParameters, OrderPostError, type OrderQuoteRequest, type OrderQuoteResponse, type OrderQuoteSide, OrderQuoteSideKindBuy, OrderQuoteSideKindSell, type OrderQuoteValidity, OrderStatus, type PreSignature, PriceEstimationError, type PriceImprovement, PriceQuality, type Quote, type QuoteAmountsAndCosts, type QuoteAmountsAndCostsParams, SellTokenSource, type Signature, SigningScheme, type SolverCompetitionResponse, type SolverSettlement, type Surplus, type TokenAmount, type TotalSurplus, type Trade, type TransactionHash, type UID, type Volume, getBigNumber, getQuoteAmountsAndCosts, getQuoteAmountsWithCosts, request };
package/dist/index.d.ts CHANGED
@@ -1121,6 +1121,15 @@ type GetOrdersRequest = {
1121
1121
  offset?: number;
1122
1122
  limit?: number;
1123
1123
  };
1124
+ /**
1125
+ * The parameters for the `getTrades` request.
1126
+ */
1127
+ type GetTradesRequest = {
1128
+ owner?: Address;
1129
+ orderUid?: UID;
1130
+ offset?: number;
1131
+ limit?: number;
1132
+ };
1124
1133
  /**
1125
1134
  * The CoW Protocol OrderBook API client.
1126
1135
  *
@@ -1204,10 +1213,7 @@ declare class OrderBookApi {
1204
1213
  * @param contextOverride Optional context override for this request.
1205
1214
  * @returns A list of trades matching the request.
1206
1215
  */
1207
- getTrades(request: {
1208
- owner?: Address;
1209
- orderUid?: UID;
1210
- }, contextOverride?: PartialApiContext): Promise<Array<Trade>>;
1216
+ getTrades(request: GetTradesRequest, contextOverride?: PartialApiContext): Promise<Array<Trade>>;
1211
1217
  /**
1212
1218
  * Get a list of orders for a given `owner`.
1213
1219
  * @param request The request parameters with `request.offset = 0` and `request.limit = 1000` by default.
@@ -1419,4 +1425,4 @@ type BigNumber = {
1419
1425
  */
1420
1426
  declare function getBigNumber(value: string | bigint | number, decimals: number): BigNumber;
1421
1427
 
1422
- export { type Address, type Amounts, type AppData, type AppDataHash, type AppDataObject, type Auction, type AuctionOrder, type AuctionPrices, type BigUint, BuyTokenDestination, type CallData, type CompetitionAuction, CompetitionOrderStatus, type Costs, DEFAULT_BACKOFF_OPTIONS, DEFAULT_LIMITER_OPTIONS, type EcdsaSignature, EcdsaSigningScheme, type EnrichedOrder, type EthflowData, type ExecutedAmounts, type ExecutedProtocolFee, type FeePolicy, type FetchParams, type GetOrdersRequest, type InteractionData, type NativePriceResponse, ORDER_BOOK_PROD_CONFIG, ORDER_BOOK_STAGING_CONFIG, OnchainOrderData, type Order, OrderBookApi, OrderBookApiError, type OrderCancellation, OrderCancellationError, type OrderCancellations, OrderClass, type OrderCreation, OrderKind, type OrderMetaData, type OrderParameters, OrderPostError, type OrderQuoteRequest, type OrderQuoteResponse, type OrderQuoteSide, OrderQuoteSideKindBuy, OrderQuoteSideKindSell, type OrderQuoteValidity, OrderStatus, type PreSignature, PriceEstimationError, type PriceImprovement, PriceQuality, type Quote, type QuoteAmountsAndCosts, type QuoteAmountsAndCostsParams, SellTokenSource, type Signature, SigningScheme, type SolverCompetitionResponse, type SolverSettlement, type Surplus, type TokenAmount, type TotalSurplus, type Trade, type TransactionHash, type UID, type Volume, getBigNumber, getQuoteAmountsAndCosts, getQuoteAmountsWithCosts, request };
1428
+ export { type Address, type Amounts, type AppData, type AppDataHash, type AppDataObject, type Auction, type AuctionOrder, type AuctionPrices, type BigUint, BuyTokenDestination, type CallData, type CompetitionAuction, CompetitionOrderStatus, type Costs, DEFAULT_BACKOFF_OPTIONS, DEFAULT_LIMITER_OPTIONS, type EcdsaSignature, EcdsaSigningScheme, type EnrichedOrder, type EthflowData, type ExecutedAmounts, type ExecutedProtocolFee, type FeePolicy, type FetchParams, type GetOrdersRequest, type GetTradesRequest, type InteractionData, type NativePriceResponse, ORDER_BOOK_PROD_CONFIG, ORDER_BOOK_STAGING_CONFIG, OnchainOrderData, type Order, OrderBookApi, OrderBookApiError, type OrderCancellation, OrderCancellationError, type OrderCancellations, OrderClass, type OrderCreation, OrderKind, type OrderMetaData, type OrderParameters, OrderPostError, type OrderQuoteRequest, type OrderQuoteResponse, type OrderQuoteSide, OrderQuoteSideKindBuy, OrderQuoteSideKindSell, type OrderQuoteValidity, OrderStatus, type PreSignature, PriceEstimationError, type PriceImprovement, PriceQuality, type Quote, type QuoteAmountsAndCosts, type QuoteAmountsAndCostsParams, SellTokenSource, type Signature, SigningScheme, type SolverCompetitionResponse, type SolverSettlement, type Surplus, type TokenAmount, type TotalSurplus, type Trade, type TransactionHash, type UID, type Volume, getBigNumber, getQuoteAmountsAndCosts, getQuoteAmountsWithCosts, request };
package/dist/index.js CHANGED
@@ -247,7 +247,9 @@ var OrderBookApi = class {
247
247
  } else if (!request2.owner && !request2.orderUid) {
248
248
  return Promise.reject(new import_sdk_common.CowError("Must specify either owner or orderId"));
249
249
  }
250
- const query = new URLSearchParams(cleanObjectFromUndefinedValues(request2));
250
+ const { offset = 0, limit = 10, ...rest } = request2;
251
+ const params = { ...rest, offset: offset.toString(), limit: limit.toString() };
252
+ const query = new URLSearchParams(cleanObjectFromUndefinedValues(params));
251
253
  return this.fetch({ path: "/api/v1/trades", method: "GET", query }, contextOverride);
252
254
  }
253
255
  /**
package/dist/index.mjs CHANGED
@@ -201,7 +201,9 @@ var OrderBookApi = class {
201
201
  } else if (!request2.owner && !request2.orderUid) {
202
202
  return Promise.reject(new CowError("Must specify either owner or orderId"));
203
203
  }
204
- const query = new URLSearchParams(cleanObjectFromUndefinedValues(request2));
204
+ const { offset = 0, limit = 10, ...rest } = request2;
205
+ const params = { ...rest, offset: offset.toString(), limit: limit.toString() };
206
+ const query = new URLSearchParams(cleanObjectFromUndefinedValues(params));
205
207
  return this.fetch({ path: "/api/v1/trades", method: "GET", query }, contextOverride);
206
208
  }
207
209
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-order-book",
3
- "version": "0.3.2",
3
+ "version": "0.4.2",
4
4
  "description": "CowProtocol Order Book package",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -31,8 +31,8 @@
31
31
  "cross-fetch": "^3.2.0",
32
32
  "exponential-backoff": "^3.1.2",
33
33
  "limiter": "^3.0.0",
34
- "@cowprotocol/sdk-config": "0.4.1",
35
- "@cowprotocol/sdk-common": "0.4.0"
34
+ "@cowprotocol/sdk-common": "0.4.0",
35
+ "@cowprotocol/sdk-config": "0.6.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsup src/index.ts --format esm,cjs --dts",