@cowprotocol/sdk-contracts-ts 1.6.1 → 1.8.0

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
@@ -1130,9 +1130,10 @@ declare enum Environment {
1130
1130
  Prod = 1
1131
1131
  }
1132
1132
  declare const LIMIT_CONCURRENT_REQUESTS = 5;
1133
- declare function apiUrl(environment: Environment, network: string): string;
1133
+ declare function apiUrl(environment: Environment, network: string, apiKey?: string): string;
1134
1134
  interface ApiCall {
1135
1135
  baseUrl: string;
1136
+ apiKey?: string;
1136
1137
  }
1137
1138
  interface EstimateTradeAmountQuery {
1138
1139
  sellToken: string;
@@ -1200,7 +1201,8 @@ declare enum GetQuoteErrorType {
1200
1201
  declare class Api {
1201
1202
  network: string;
1202
1203
  baseUrl: string;
1203
- constructor(network: string, baseUrlOrEnv: string | Environment);
1204
+ apiKey?: string;
1205
+ constructor(network: string, baseUrlOrEnv: string | Environment, apiKey?: string);
1204
1206
  private apiCallParams;
1205
1207
  estimateTradeAmount(query: EstimateTradeAmountQuery): Promise<BigIntish>;
1206
1208
  placeOrder(query: PlaceOrderQuery): Promise<string>;
@@ -1312,6 +1314,6 @@ declare function getTypedDataV3Signer(signer: Signer): AbstractSigner<unknown>;
1312
1314
  */
1313
1315
  declare function getIntChainIdTypedDataV4Signer(signer: Signer): AbstractSigner<unknown>;
1314
1316
 
1315
- declare const CONTRACTS_PKG_VERSION = "1.6.1";
1317
+ declare const CONTRACTS_PKG_VERSION = "1.8.0";
1316
1318
 
1317
1319
  export { AllowListReader, Api, type ApiCall, type ApiError, type ArtifactDeployment, BUY_ETH_ADDRESS, type BatchSwapStep, type BuyAmountAfterFee, CANCELLATIONS_TYPE_FIELDS, CONTRACTS_PKG_VERSION, CONTRACT_NAMES, type CallError, type CommonQuoteQuery, type ContractName, type EcdsaSignature as ContractsEcdsaSignature, type EcdsaSigningScheme as ContractsEcdsaSigningScheme, type Order as ContractsOrder, type OrderCancellations as ContractsOrderCancellations, OrderKind as ContractsOrderKind, type Signature as ContractsSignature, SigningScheme as ContractsSigningScheme, type Trade as ContractsTrade, ContractsTs, DEPLOYER_CONTRACT, type DeploymentArguments, EIP1271_MAGICVALUE, EIP173_PROXY_ABI, type Eip1271Signature, type Eip1271SignatureData, type EncodedSettlement, type EncodedSwap, Environment, type EstimateTradeAmountQuery, FLAG_MASKS, type FlagKey, type FlagOptions, type FlagValue, type GetExecutedSellAmountQuery, GetQuoteErrorType, type GetQuoteResponse, type HashLike, type Interaction, type InteractionLike, InteractionStage, LIMIT_CONCURRENT_REQUESTS, type MaybeNamedArtifactArtifactDeployment, type NamedArtifactDeployment, type NormalizedOrder, ORDER_TYPE_FIELDS, ORDER_TYPE_HASH, ORDER_UID_LENGTH, OrderBalance, type OrderDetailResponse, type OrderFlags, type OrderRefunds, type OrderUidParams, PRE_SIGNED, type PlaceOrderQuery, type PreSignSignature, type Prices, QuotePriceQuality, type QuoteQuery, SALT, type SellAmountAfterFee, type SellAmountBeforeFee, SettlementEncoder, SettlementReader, type Swap, SwapEncoder, type SwapExecution, type Timestamp, TokenRegistry, type TradeExecution, type TradeFlags, type TradeSimulation, type TradeSimulationBalanceDelta, type TradeSimulationResult, TradeSimulator, apiUrl, computeOrderUid, decodeEip1271SignatureData, decodeOrder, decodeOrderFlags, decodeSignatureOwner, decodeSigningScheme, decodeTradeFlags, deterministicDeploymentAddress, ecdsaSignTypedData, encodeEip1271SignatureData, encodeOrderFlags, encodeSignatureData, encodeSigningScheme, encodeSwapStep, encodeTrade, encodeTradeFlags, extractOrderUidParams, getIntChainIdTypedDataV4Signer, getTypedDataV3Signer, getTypedDataVersionedSigner, grantRequiredRoles, hashOrder, hashOrderCancellation, hashOrderCancellations, hashTypedData, hashify, implementationAddress, normalizeBuyTokenBalance, normalizeInteraction, normalizeInteractions, normalizeOrder, ownerAddress, packOrderUidParams, signOrder, signOrderCancellation, signOrderCancellations, timestamp };
package/dist/index.d.ts CHANGED
@@ -1130,9 +1130,10 @@ declare enum Environment {
1130
1130
  Prod = 1
1131
1131
  }
1132
1132
  declare const LIMIT_CONCURRENT_REQUESTS = 5;
1133
- declare function apiUrl(environment: Environment, network: string): string;
1133
+ declare function apiUrl(environment: Environment, network: string, apiKey?: string): string;
1134
1134
  interface ApiCall {
1135
1135
  baseUrl: string;
1136
+ apiKey?: string;
1136
1137
  }
1137
1138
  interface EstimateTradeAmountQuery {
1138
1139
  sellToken: string;
@@ -1200,7 +1201,8 @@ declare enum GetQuoteErrorType {
1200
1201
  declare class Api {
1201
1202
  network: string;
1202
1203
  baseUrl: string;
1203
- constructor(network: string, baseUrlOrEnv: string | Environment);
1204
+ apiKey?: string;
1205
+ constructor(network: string, baseUrlOrEnv: string | Environment, apiKey?: string);
1204
1206
  private apiCallParams;
1205
1207
  estimateTradeAmount(query: EstimateTradeAmountQuery): Promise<BigIntish>;
1206
1208
  placeOrder(query: PlaceOrderQuery): Promise<string>;
@@ -1312,6 +1314,6 @@ declare function getTypedDataV3Signer(signer: Signer): AbstractSigner<unknown>;
1312
1314
  */
1313
1315
  declare function getIntChainIdTypedDataV4Signer(signer: Signer): AbstractSigner<unknown>;
1314
1316
 
1315
- declare const CONTRACTS_PKG_VERSION = "1.6.1";
1317
+ declare const CONTRACTS_PKG_VERSION = "1.8.0";
1316
1318
 
1317
1319
  export { AllowListReader, Api, type ApiCall, type ApiError, type ArtifactDeployment, BUY_ETH_ADDRESS, type BatchSwapStep, type BuyAmountAfterFee, CANCELLATIONS_TYPE_FIELDS, CONTRACTS_PKG_VERSION, CONTRACT_NAMES, type CallError, type CommonQuoteQuery, type ContractName, type EcdsaSignature as ContractsEcdsaSignature, type EcdsaSigningScheme as ContractsEcdsaSigningScheme, type Order as ContractsOrder, type OrderCancellations as ContractsOrderCancellations, OrderKind as ContractsOrderKind, type Signature as ContractsSignature, SigningScheme as ContractsSigningScheme, type Trade as ContractsTrade, ContractsTs, DEPLOYER_CONTRACT, type DeploymentArguments, EIP1271_MAGICVALUE, EIP173_PROXY_ABI, type Eip1271Signature, type Eip1271SignatureData, type EncodedSettlement, type EncodedSwap, Environment, type EstimateTradeAmountQuery, FLAG_MASKS, type FlagKey, type FlagOptions, type FlagValue, type GetExecutedSellAmountQuery, GetQuoteErrorType, type GetQuoteResponse, type HashLike, type Interaction, type InteractionLike, InteractionStage, LIMIT_CONCURRENT_REQUESTS, type MaybeNamedArtifactArtifactDeployment, type NamedArtifactDeployment, type NormalizedOrder, ORDER_TYPE_FIELDS, ORDER_TYPE_HASH, ORDER_UID_LENGTH, OrderBalance, type OrderDetailResponse, type OrderFlags, type OrderRefunds, type OrderUidParams, PRE_SIGNED, type PlaceOrderQuery, type PreSignSignature, type Prices, QuotePriceQuality, type QuoteQuery, SALT, type SellAmountAfterFee, type SellAmountBeforeFee, SettlementEncoder, SettlementReader, type Swap, SwapEncoder, type SwapExecution, type Timestamp, TokenRegistry, type TradeExecution, type TradeFlags, type TradeSimulation, type TradeSimulationBalanceDelta, type TradeSimulationResult, TradeSimulator, apiUrl, computeOrderUid, decodeEip1271SignatureData, decodeOrder, decodeOrderFlags, decodeSignatureOwner, decodeSigningScheme, decodeTradeFlags, deterministicDeploymentAddress, ecdsaSignTypedData, encodeEip1271SignatureData, encodeOrderFlags, encodeSignatureData, encodeSigningScheme, encodeSwapStep, encodeTrade, encodeTradeFlags, extractOrderUidParams, getIntChainIdTypedDataV4Signer, getTypedDataV3Signer, getTypedDataVersionedSigner, grantRequiredRoles, hashOrder, hashOrderCancellation, hashOrderCancellations, hashTypedData, hashify, implementationAddress, normalizeBuyTokenBalance, normalizeInteraction, normalizeInteractions, normalizeOrder, ownerAddress, packOrderUidParams, signOrder, signOrderCancellation, signOrderCancellations, timestamp };
package/dist/index.js CHANGED
@@ -894,15 +894,21 @@ var Environment = /* @__PURE__ */ ((Environment2) => {
894
894
  return Environment2;
895
895
  })(Environment || {});
896
896
  var LIMIT_CONCURRENT_REQUESTS = 5;
897
- function apiUrl(environment, network) {
897
+ var PARTNER_PROD_BASE_URL = "https://partners.cow.fi";
898
+ var PARTNER_DEV_BASE_URL = "https://partners.barn.cow.fi";
899
+ function apiUrl(environment, network, apiKey) {
900
+ let baseUrl;
898
901
  switch (environment) {
899
902
  case 0 /* Dev */:
900
- return `https://barn.api.cow.fi/${network}`;
903
+ baseUrl = apiKey ? PARTNER_DEV_BASE_URL : "https://barn.api.cow.fi";
904
+ break;
901
905
  case 1 /* Prod */:
902
- return `https://api.cow.fi/${network}`;
906
+ baseUrl = apiKey ? PARTNER_PROD_BASE_URL : "https://api.cow.fi";
907
+ break;
903
908
  default:
904
909
  throw new Error("Invalid environment");
905
910
  }
911
+ return `${baseUrl}/${network}`;
906
912
  }
907
913
  var QuotePriceQuality = /* @__PURE__ */ ((QuotePriceQuality2) => {
908
914
  QuotePriceQuality2["FAST"] = "fast";
@@ -938,9 +944,13 @@ function apiSigningScheme(scheme) {
938
944
  throw new Error(`Unsupported signing scheme ${scheme}`);
939
945
  }
940
946
  }
941
- async function call(route, baseUrl, init) {
947
+ async function call(route, baseUrl, init, apiKey) {
942
948
  const url = `${baseUrl}/api/v1/${route}`;
943
- const response = await fetch(url, init);
949
+ const headers = {
950
+ ...init?.headers ?? {},
951
+ ...apiKey ? { "X-API-Key": apiKey } : {}
952
+ };
953
+ const response = await fetch(url, { ...init, headers });
944
954
  const body = await response.text();
945
955
  if (!response.ok) {
946
956
  const error = new Error(
@@ -959,7 +969,8 @@ async function estimateTradeAmount({
959
969
  buyToken,
960
970
  kind,
961
971
  amount,
962
- baseUrl
972
+ baseUrl,
973
+ apiKey
963
974
  }) {
964
975
  const side = kind == "sell" /* SELL */ ? {
965
976
  kind: "sell" /* SELL */,
@@ -969,7 +980,7 @@ async function estimateTradeAmount({
969
980
  buyAmountAfterFee: amount
970
981
  };
971
982
  const { quote } = await getQuote(
972
- { baseUrl },
983
+ { baseUrl, apiKey },
973
984
  {
974
985
  from: "0x0000000000000000000000000000000000000000",
975
986
  sellToken,
@@ -986,34 +997,49 @@ async function estimateTradeAmount({
986
997
  const estimatedAmount = kind == "sell" /* SELL */ ? quote.buyAmount : quote.sellAmount;
987
998
  return (0, import_sdk_common9.getGlobalAdapter)().utils.toBigIntish(estimatedAmount);
988
999
  }
989
- async function placeOrder({ order, signature, baseUrl, from }) {
1000
+ async function placeOrder({
1001
+ order,
1002
+ signature,
1003
+ baseUrl,
1004
+ from,
1005
+ apiKey
1006
+ }) {
990
1007
  const normalizedOrder = normalizeOrder(order);
991
1008
  const adapter = (0, import_sdk_common9.getGlobalAdapter)();
992
- return await call("orders", baseUrl, {
993
- method: "post",
994
- body: JSON.stringify({
995
- sellToken: normalizedOrder.sellToken,
996
- buyToken: normalizedOrder.buyToken,
997
- sellAmount: String(adapter.utils.toBigIntish(normalizedOrder.sellAmount)),
998
- buyAmount: String(adapter.utils.toBigIntish(normalizedOrder.buyAmount)),
999
- validTo: normalizedOrder.validTo,
1000
- appData: normalizedOrder.appData,
1001
- feeAmount: String(adapter.utils.toBigIntish(normalizedOrder.feeAmount)),
1002
- kind: apiKind(order.kind),
1003
- partiallyFillable: normalizedOrder.partiallyFillable,
1004
- signature: encodeSignatureData(signature),
1005
- signingScheme: apiSigningScheme(signature.scheme),
1006
- receiver: normalizedOrder.receiver,
1007
- from
1008
- }),
1009
- headers: { "Content-Type": "application/json" }
1010
- });
1009
+ return await call(
1010
+ "orders",
1011
+ baseUrl,
1012
+ {
1013
+ method: "post",
1014
+ body: JSON.stringify({
1015
+ sellToken: normalizedOrder.sellToken,
1016
+ buyToken: normalizedOrder.buyToken,
1017
+ sellAmount: String(adapter.utils.toBigIntish(normalizedOrder.sellAmount)),
1018
+ buyAmount: String(adapter.utils.toBigIntish(normalizedOrder.buyAmount)),
1019
+ validTo: normalizedOrder.validTo,
1020
+ appData: normalizedOrder.appData,
1021
+ feeAmount: String(adapter.utils.toBigIntish(normalizedOrder.feeAmount)),
1022
+ kind: apiKind(order.kind),
1023
+ partiallyFillable: normalizedOrder.partiallyFillable,
1024
+ signature: encodeSignatureData(signature),
1025
+ signingScheme: apiSigningScheme(signature.scheme),
1026
+ receiver: normalizedOrder.receiver,
1027
+ from
1028
+ }),
1029
+ headers: { "Content-Type": "application/json" }
1030
+ },
1031
+ apiKey
1032
+ );
1011
1033
  }
1012
- async function getExecutedSellAmount({ uid, baseUrl }) {
1013
- const response = await call(`orders/${uid}`, baseUrl);
1034
+ async function getExecutedSellAmount({
1035
+ uid,
1036
+ baseUrl,
1037
+ apiKey
1038
+ }) {
1039
+ const response = await call(`orders/${uid}`, baseUrl, void 0, apiKey);
1014
1040
  return (0, import_sdk_common9.getGlobalAdapter)().utils.toBigIntish(response.executedSellAmount);
1015
1041
  }
1016
- async function getQuote({ baseUrl }, quote) {
1042
+ async function getQuote({ baseUrl, apiKey }, quote) {
1017
1043
  if (quote.sellAmountBeforeFee) {
1018
1044
  ;
1019
1045
  quote.sellAmountBeforeFee = String(quote.sellAmountBeforeFee);
@@ -1026,27 +1052,32 @@ async function getQuote({ baseUrl }, quote) {
1026
1052
  ;
1027
1053
  quote.buyAmountAfterFee = String(quote.buyAmountAfterFee);
1028
1054
  }
1029
- return call("quote", baseUrl, {
1030
- method: "post",
1031
- headers: { "Content-Type": "application/json" },
1032
- body: JSON.stringify(quote)
1033
- });
1055
+ return call(
1056
+ "quote",
1057
+ baseUrl,
1058
+ {
1059
+ method: "post",
1060
+ headers: { "Content-Type": "application/json" },
1061
+ body: JSON.stringify(quote)
1062
+ },
1063
+ apiKey
1064
+ );
1034
1065
  }
1035
1066
  var Api = class {
1036
1067
  network;
1037
1068
  baseUrl;
1038
- constructor(network, baseUrlOrEnv) {
1069
+ apiKey;
1070
+ constructor(network, baseUrlOrEnv, apiKey) {
1039
1071
  this.network = network;
1040
- let baseUrl;
1072
+ this.apiKey = apiKey;
1041
1073
  if (typeof baseUrlOrEnv === "string") {
1042
- baseUrl = baseUrlOrEnv;
1074
+ this.baseUrl = baseUrlOrEnv;
1043
1075
  } else {
1044
- baseUrl = apiUrl(baseUrlOrEnv, network);
1076
+ this.baseUrl = apiUrl(baseUrlOrEnv, network, apiKey);
1045
1077
  }
1046
- this.baseUrl = baseUrl;
1047
1078
  }
1048
1079
  apiCallParams() {
1049
- return { network: this.network, baseUrl: this.baseUrl };
1080
+ return { network: this.network, baseUrl: this.baseUrl, apiKey: this.apiKey };
1050
1081
  }
1051
1082
  async estimateTradeAmount(query) {
1052
1083
  return estimateTradeAmount({ ...this.apiCallParams(), ...query });
@@ -1176,7 +1207,7 @@ function getIntChainIdTypedDataV4Signer(signer) {
1176
1207
  }
1177
1208
 
1178
1209
  // src/generated/packageVersion.ts
1179
- var CONTRACTS_PKG_VERSION = "1.6.1";
1210
+ var CONTRACTS_PKG_VERSION = "1.8.0";
1180
1211
  // Annotate the CommonJS export names for ESM import in node:
1181
1212
  0 && (module.exports = {
1182
1213
  AllowListReader,
package/dist/index.mjs CHANGED
@@ -807,15 +807,21 @@ var Environment = /* @__PURE__ */ ((Environment2) => {
807
807
  return Environment2;
808
808
  })(Environment || {});
809
809
  var LIMIT_CONCURRENT_REQUESTS = 5;
810
- function apiUrl(environment, network) {
810
+ var PARTNER_PROD_BASE_URL = "https://partners.cow.fi";
811
+ var PARTNER_DEV_BASE_URL = "https://partners.barn.cow.fi";
812
+ function apiUrl(environment, network, apiKey) {
813
+ let baseUrl;
811
814
  switch (environment) {
812
815
  case 0 /* Dev */:
813
- return `https://barn.api.cow.fi/${network}`;
816
+ baseUrl = apiKey ? PARTNER_DEV_BASE_URL : "https://barn.api.cow.fi";
817
+ break;
814
818
  case 1 /* Prod */:
815
- return `https://api.cow.fi/${network}`;
819
+ baseUrl = apiKey ? PARTNER_PROD_BASE_URL : "https://api.cow.fi";
820
+ break;
816
821
  default:
817
822
  throw new Error("Invalid environment");
818
823
  }
824
+ return `${baseUrl}/${network}`;
819
825
  }
820
826
  var QuotePriceQuality = /* @__PURE__ */ ((QuotePriceQuality2) => {
821
827
  QuotePriceQuality2["FAST"] = "fast";
@@ -851,9 +857,13 @@ function apiSigningScheme(scheme) {
851
857
  throw new Error(`Unsupported signing scheme ${scheme}`);
852
858
  }
853
859
  }
854
- async function call(route, baseUrl, init) {
860
+ async function call(route, baseUrl, init, apiKey) {
855
861
  const url = `${baseUrl}/api/v1/${route}`;
856
- const response = await fetch(url, init);
862
+ const headers = {
863
+ ...init?.headers ?? {},
864
+ ...apiKey ? { "X-API-Key": apiKey } : {}
865
+ };
866
+ const response = await fetch(url, { ...init, headers });
857
867
  const body = await response.text();
858
868
  if (!response.ok) {
859
869
  const error = new Error(
@@ -872,7 +882,8 @@ async function estimateTradeAmount({
872
882
  buyToken,
873
883
  kind,
874
884
  amount,
875
- baseUrl
885
+ baseUrl,
886
+ apiKey
876
887
  }) {
877
888
  const side = kind == "sell" /* SELL */ ? {
878
889
  kind: "sell" /* SELL */,
@@ -882,7 +893,7 @@ async function estimateTradeAmount({
882
893
  buyAmountAfterFee: amount
883
894
  };
884
895
  const { quote } = await getQuote(
885
- { baseUrl },
896
+ { baseUrl, apiKey },
886
897
  {
887
898
  from: "0x0000000000000000000000000000000000000000",
888
899
  sellToken,
@@ -899,34 +910,49 @@ async function estimateTradeAmount({
899
910
  const estimatedAmount = kind == "sell" /* SELL */ ? quote.buyAmount : quote.sellAmount;
900
911
  return getGlobalAdapter7().utils.toBigIntish(estimatedAmount);
901
912
  }
902
- async function placeOrder({ order, signature, baseUrl, from }) {
913
+ async function placeOrder({
914
+ order,
915
+ signature,
916
+ baseUrl,
917
+ from,
918
+ apiKey
919
+ }) {
903
920
  const normalizedOrder = normalizeOrder(order);
904
921
  const adapter = getGlobalAdapter7();
905
- return await call("orders", baseUrl, {
906
- method: "post",
907
- body: JSON.stringify({
908
- sellToken: normalizedOrder.sellToken,
909
- buyToken: normalizedOrder.buyToken,
910
- sellAmount: String(adapter.utils.toBigIntish(normalizedOrder.sellAmount)),
911
- buyAmount: String(adapter.utils.toBigIntish(normalizedOrder.buyAmount)),
912
- validTo: normalizedOrder.validTo,
913
- appData: normalizedOrder.appData,
914
- feeAmount: String(adapter.utils.toBigIntish(normalizedOrder.feeAmount)),
915
- kind: apiKind(order.kind),
916
- partiallyFillable: normalizedOrder.partiallyFillable,
917
- signature: encodeSignatureData(signature),
918
- signingScheme: apiSigningScheme(signature.scheme),
919
- receiver: normalizedOrder.receiver,
920
- from
921
- }),
922
- headers: { "Content-Type": "application/json" }
923
- });
922
+ return await call(
923
+ "orders",
924
+ baseUrl,
925
+ {
926
+ method: "post",
927
+ body: JSON.stringify({
928
+ sellToken: normalizedOrder.sellToken,
929
+ buyToken: normalizedOrder.buyToken,
930
+ sellAmount: String(adapter.utils.toBigIntish(normalizedOrder.sellAmount)),
931
+ buyAmount: String(adapter.utils.toBigIntish(normalizedOrder.buyAmount)),
932
+ validTo: normalizedOrder.validTo,
933
+ appData: normalizedOrder.appData,
934
+ feeAmount: String(adapter.utils.toBigIntish(normalizedOrder.feeAmount)),
935
+ kind: apiKind(order.kind),
936
+ partiallyFillable: normalizedOrder.partiallyFillable,
937
+ signature: encodeSignatureData(signature),
938
+ signingScheme: apiSigningScheme(signature.scheme),
939
+ receiver: normalizedOrder.receiver,
940
+ from
941
+ }),
942
+ headers: { "Content-Type": "application/json" }
943
+ },
944
+ apiKey
945
+ );
924
946
  }
925
- async function getExecutedSellAmount({ uid, baseUrl }) {
926
- const response = await call(`orders/${uid}`, baseUrl);
947
+ async function getExecutedSellAmount({
948
+ uid,
949
+ baseUrl,
950
+ apiKey
951
+ }) {
952
+ const response = await call(`orders/${uid}`, baseUrl, void 0, apiKey);
927
953
  return getGlobalAdapter7().utils.toBigIntish(response.executedSellAmount);
928
954
  }
929
- async function getQuote({ baseUrl }, quote) {
955
+ async function getQuote({ baseUrl, apiKey }, quote) {
930
956
  if (quote.sellAmountBeforeFee) {
931
957
  ;
932
958
  quote.sellAmountBeforeFee = String(quote.sellAmountBeforeFee);
@@ -939,27 +965,32 @@ async function getQuote({ baseUrl }, quote) {
939
965
  ;
940
966
  quote.buyAmountAfterFee = String(quote.buyAmountAfterFee);
941
967
  }
942
- return call("quote", baseUrl, {
943
- method: "post",
944
- headers: { "Content-Type": "application/json" },
945
- body: JSON.stringify(quote)
946
- });
968
+ return call(
969
+ "quote",
970
+ baseUrl,
971
+ {
972
+ method: "post",
973
+ headers: { "Content-Type": "application/json" },
974
+ body: JSON.stringify(quote)
975
+ },
976
+ apiKey
977
+ );
947
978
  }
948
979
  var Api = class {
949
980
  network;
950
981
  baseUrl;
951
- constructor(network, baseUrlOrEnv) {
982
+ apiKey;
983
+ constructor(network, baseUrlOrEnv, apiKey) {
952
984
  this.network = network;
953
- let baseUrl;
985
+ this.apiKey = apiKey;
954
986
  if (typeof baseUrlOrEnv === "string") {
955
- baseUrl = baseUrlOrEnv;
987
+ this.baseUrl = baseUrlOrEnv;
956
988
  } else {
957
- baseUrl = apiUrl(baseUrlOrEnv, network);
989
+ this.baseUrl = apiUrl(baseUrlOrEnv, network, apiKey);
958
990
  }
959
- this.baseUrl = baseUrl;
960
991
  }
961
992
  apiCallParams() {
962
- return { network: this.network, baseUrl: this.baseUrl };
993
+ return { network: this.network, baseUrl: this.baseUrl, apiKey: this.apiKey };
963
994
  }
964
995
  async estimateTradeAmount(query) {
965
996
  return estimateTradeAmount({ ...this.apiCallParams(), ...query });
@@ -1089,7 +1120,7 @@ function getIntChainIdTypedDataV4Signer(signer) {
1089
1120
  }
1090
1121
 
1091
1122
  // src/generated/packageVersion.ts
1092
- var CONTRACTS_PKG_VERSION = "1.6.1";
1123
+ var CONTRACTS_PKG_VERSION = "1.8.0";
1093
1124
  export {
1094
1125
  AllowListReader,
1095
1126
  Api,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-contracts-ts",
3
- "version": "1.6.1",
3
+ "version": "1.8.0",
4
4
  "description": "TypeScript contract bindings for CoW Protocol SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -14,8 +14,8 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@cowprotocol/sdk-common": "0.6.2",
18
- "@cowprotocol/sdk-config": "0.8.1"
17
+ "@cowprotocol/sdk-common": "0.7.0",
18
+ "@cowprotocol/sdk-config": "0.10.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/jest": "^29.5.5",
@@ -28,10 +28,10 @@
28
28
  "tsup": "^7.2.0",
29
29
  "typescript": "^5.2.2",
30
30
  "viem": "^2.28.4",
31
- "@cowprotocol/sdk-ethers-v5-adapter": "0.3.8",
32
31
  "@cow-sdk/typescript-config": "0.0.0-beta.0",
33
- "@cowprotocol/sdk-ethers-v6-adapter": "0.3.8",
34
- "@cowprotocol/sdk-viem-adapter": "0.3.8"
32
+ "@cowprotocol/sdk-ethers-v5-adapter": "0.3.10",
33
+ "@cowprotocol/sdk-viem-adapter": "0.3.10",
34
+ "@cowprotocol/sdk-ethers-v6-adapter": "0.3.10"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsup src/index.ts --format esm,cjs --dts",