@cowprotocol/cow-sdk 0.0.15 → 0.0.16-RC.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.
Files changed (53) hide show
  1. package/dist/api/0x/error/index.d.ts +21 -0
  2. package/dist/api/0x/index.d.ts +11 -0
  3. package/dist/api/0x/utils.d.ts +17 -0
  4. package/dist/api/base/index.d.ts +25 -0
  5. package/dist/api/cow/index.d.ts +5 -3
  6. package/dist/api/cow/types.d.ts +1 -1
  7. package/dist/api/cow-subgraph/graphql.d.ts +24 -2
  8. package/dist/appData.schema-0c8db23b.js +2 -0
  9. package/dist/appData.schema-0c8db23b.js.map +1 -0
  10. package/dist/appData.schema-412cbfbf.js +2 -0
  11. package/dist/appData.schema-412cbfbf.js.map +1 -0
  12. package/dist/appData.schema-4c010c50.js +2 -0
  13. package/dist/appData.schema-4c010c50.js.map +1 -0
  14. package/dist/appData.schema-adfc1c6f.js +2 -0
  15. package/dist/appData.schema-adfc1c6f.js.map +1 -0
  16. package/dist/index.js +2 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.modern.js +2 -2
  19. package/dist/index.modern.js.map +1 -1
  20. package/dist/index.modern.mjs +29 -0
  21. package/dist/index.modern.mjs.map +1 -0
  22. package/dist/index.module.js +2 -2
  23. package/dist/index.module.js.map +1 -1
  24. package/dist/src/appData.schema-d44994e0.js +2 -0
  25. package/dist/src/appData.schema-d44994e0.js.map +1 -0
  26. package/dist/src/appData.schema-fb2df827.js +2 -0
  27. package/dist/src/appData.schema-fb2df827.js.map +1 -0
  28. package/dist/src/cow-sdk.esm.js +2 -0
  29. package/dist/src/cow-sdk.esm.js.map +1 -0
  30. package/dist/src/cow-sdk.js +2 -0
  31. package/dist/src/cow-sdk.js.map +1 -0
  32. package/dist/src/cow-sdk.modern.js +2 -0
  33. package/dist/src/cow-sdk.modern.js.map +1 -0
  34. package/dist/src/src/CowSdk.d.ts +16 -0
  35. package/dist/src/src/api/cow/errors/OperatorError.d.ts +63 -0
  36. package/dist/src/src/api/cow/errors/QuoteError.d.ts +32 -0
  37. package/dist/src/src/api/cow/index.d.ts +38 -0
  38. package/dist/src/src/api/cow/types.d.ts +73 -0
  39. package/dist/src/src/api/index.d.ts +1 -0
  40. package/dist/src/src/constants/chains.d.ts +6 -0
  41. package/dist/src/src/constants/index.d.ts +3 -0
  42. package/dist/src/src/constants/tokens.d.ts +5 -0
  43. package/dist/src/src/index.d.ts +4 -0
  44. package/dist/src/src/types/index.d.ts +7 -0
  45. package/dist/src/src/utils/appData.d.ts +7 -0
  46. package/dist/src/src/utils/common.d.ts +5 -0
  47. package/dist/src/src/utils/context.d.ts +24 -0
  48. package/dist/src/src/utils/sign.d.ts +54 -0
  49. package/dist/src/src/utils/tokens.d.ts +2 -0
  50. package/dist/utils/market.d.ts +16 -0
  51. package/package.json +1 -1
  52. package/LICENSE-APACHE +0 -201
  53. package/LICENSE-MIT +0 -21
@@ -0,0 +1,29 @@
1
+ import e from"loglevel";import{IntChainIdTypedDataV4Signer as t,TypedDataV3Signer as r,SigningScheme as n,domain as a,signOrder as o,signOrderCancellation as i,OrderKind as s}from"@cowprotocol/contracts";export{OrderKind}from"@cowprotocol/contracts";import d from"cross-fetch";import{gql as c,GraphQLClient as u}from"graphql-request";import{createReferrerMetadata as l,createQuoteMetadata as h,createAppDataDoc as p}from"@cowprotocol/app-data";import f from"ajv";function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m.apply(this,arguments)}var T,E=0;function g(e){return"__private_"+E+++"_"+e}function A(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}class w extends Error{constructor(e,t){super(e),this.error_code=void 0,this.error_code=t}}function y(e){if(!e)return"";const t=new URLSearchParams;for(const r of Object.keys(e)){const n=e[r];n&&t.append(r,n.toString())}const r=t.toString();return r?`?${r}`:""}!function(e){e[e.MAINNET=1]="MAINNET",e[e.RINKEBY=4]="RINKEBY",e[e.GOERLI=5]="GOERLI",e[e.GNOSIS_CHAIN=100]="GNOSIS_CHAIN"}(T||(T={}));const I=[T.MAINNET,T.RINKEBY,T.GOERLI,T.GNOSIS_CHAIN],{GPv2Settlement:b}=JSON.parse('{\n "GPv2AllowListAuthentication_Implementation": {\n "1": {\n "address": "0x9E7Ae8Bdba9AA346739792d219a808884996Db67",\n "transactionHash": "0x58340aa44119c74e48635fab0ac344170c6d6e8b42e5714baa4ba4e1651f63ad"\n },\n "4": {\n "address": "0x9E7Ae8Bdba9AA346739792d219a808884996Db67"\n },\n "5": {\n "address": "0x9E7Ae8Bdba9AA346739792d219a808884996Db67",\n "transactionHash": "0x24f4f80b46a17345011065f9ea2af823f582db56be81098b3b66cc2db9659ea7"\n },\n "100": {\n "address": "0x9E7Ae8Bdba9AA346739792d219a808884996Db67",\n "transactionHash": "0xe52d425fe34d6d5215ccfc9ddfa485d490b3018f0ee5bbed708f2d172044d60d"\n }\n },\n "GPv2AllowListAuthentication_Proxy": {\n "1": {\n "address": "0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE",\n "transactionHash": "0xb84bf720364f94c749f1ec1cdf0d4c44c70411b716459aaccfd24fc677013375"\n },\n "4": {\n "address": "0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE",\n "transactionHash": "0x57b2278fd3a13ab1b132031024475ba1a4e28d7d4d37f556134c84512b742c1f"\n },\n "5": {\n "address": "0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE",\n "transactionHash": "0x39dcf30baf887a5db54551a84de8bfdb6cf418bb284b09680d13aed17d5fa0c1"\n },\n "100": {\n "address": "0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE",\n "transactionHash": "0x1a2d87a05a94bc6680a4faee31bbafbd74e9ddb63dd3941c717b5c609c08b957"\n }\n },\n "GPv2AllowListAuthentication": {\n "1": {\n "address": "0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE",\n "transactionHash": "0xb84bf720364f94c749f1ec1cdf0d4c44c70411b716459aaccfd24fc677013375"\n },\n "4": {\n "address": "0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE",\n "transactionHash": "0x57b2278fd3a13ab1b132031024475ba1a4e28d7d4d37f556134c84512b742c1f"\n },\n "5": {\n "address": "0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE",\n "transactionHash": "0x39dcf30baf887a5db54551a84de8bfdb6cf418bb284b09680d13aed17d5fa0c1"\n },\n "100": {\n "address": "0x2c4c28DDBdAc9C5E7055b4C863b72eA0149D8aFE",\n "transactionHash": "0x1a2d87a05a94bc6680a4faee31bbafbd74e9ddb63dd3941c717b5c609c08b957"\n }\n },\n "GPv2Settlement": {\n "1": {\n "address": "0x9008D19f58AAbD9eD0D60971565AA8510560ab41",\n "transactionHash": "0xf49f90aa5a268c40001d1227b76bb4dd8247f18361fcad9fffd4a7a44f1320d3"\n },\n "4": {\n "address": "0x9008D19f58AAbD9eD0D60971565AA8510560ab41",\n "transactionHash": "0x609fa2e8f32c73c1f5dc21ff60a26238dacb50d4674d336c90d6950bdda17a21"\n },\n "5": {\n "address": "0x9008D19f58AAbD9eD0D60971565AA8510560ab41",\n "transactionHash": "0x982f089060ff66e19d0683ef1cc6a637297331a9ba95b65d8eb84b9f8dc64b04"\n },\n "100": {\n "address": "0x9008D19f58AAbD9eD0D60971565AA8510560ab41",\n "transactionHash": "0x9ddc538f89cd8433f4a19bc4de0de27e7c68a1d04a14b327185e4bba9af87133"\n }\n },\n "GPv2VaultRelayer": {\n "1": {\n "address": "0xC92E8bdf79f0507f65a392b0ab4667716BFE0110",\n "transactionHash": "0xf49f90aa5a268c40001d1227b76bb4dd8247f18361fcad9fffd4a7a44f1320d3"\n },\n "4": {\n "address": "0xC92E8bdf79f0507f65a392b0ab4667716BFE0110",\n "transactionHash": "0x609fa2e8f32c73c1f5dc21ff60a26238dacb50d4674d336c90d6950bdda17a21"\n },\n "5": {\n "address": "0xC92E8bdf79f0507f65a392b0ab4667716BFE0110",\n "transactionHash": "0x982f089060ff66e19d0683ef1cc6a637297331a9ba95b65d8eb84b9f8dc64b04"\n },\n "100": {\n "address": "0xC92E8bdf79f0507f65a392b0ab4667716BFE0110",\n "transactionHash": "0x9ddc538f89cd8433f4a19bc4de0de27e7c68a1d04a14b327185e4bba9af87133"\n }\n }\n}'),k={[T.MAINNET]:b[T.MAINNET].address,[T.RINKEBY]:b[T.RINKEBY].address,[T.GOERLI]:b[T.GOERLI].address,[T.GNOSIS_CHAIN]:b[T.GNOSIS_CHAIN].address},v=/eth_signTypedData_v4 does not exist/i,N=/eth_signTypedData_v3 does not exist/i,D=/RPC request failed/i,O=/provided chainid .* must match the active chainid/i,P=new Map([[n.EIP712,{libraryValue:0,apiValue:"eip712"}],[n.ETHSIGN,{libraryValue:1,apiValue:"ethsign"}],[n.EIP1271,{libraryValue:2,apiValue:"eip1271"}],[n.PRESIGN,{libraryValue:3,apiValue:"presign"}]]);function x(e){const t=P.get(e);if(void 0===t)throw new w("Unknown schema "+e);return t}function _(e){return x(e).apiValue}function S(e){return x(e).libraryValue}function R(e){const t=k[e];if(!t)throw new w("Unsupported network. Settlement contract is not deployed");return a(e,t)}async function U(e){const{chainId:t,signer:r,order:n,signingScheme:a}=e,i=R(t);return o(i,n,r,S(a))}async function C(e){const{chainId:t,signer:r,signingScheme:n,orderId:a}=e,o=R(t);return i(o,a,r,S(n))}async function H(a,o,i,s="v4"){var d;const c="eth_sign"===s?n.ETHSIGN:n.EIP712;let u,l=null;try{switch(s){case"v3":u=new r(i);break;case"int_v4":u=new t(i);break;default:u=i}}catch(t){throw e.error("cow-sdk:","Wallet not supported:",t),new w("Wallet not supported")}try{l=await o(m({},a,{signer:u,signingScheme:c}))}catch(t){if(void 0===(h=t).code&&void 0===h.message)throw e.error("cow-sdk:",t),t;if(-32601===t.code||D.test(t.message))switch(s){case"v4":return H(a,o,i,"v3");case"v3":return H(a,o,i,"eth_sign");default:throw t}else{if(O.test(t.message))return H(a,o,i,"int_v4");if(-32603===t.code)return H(a,o,i,"eth_sign");if(v.test(t.message))return H(a,o,i,"v3");if(N.test(t.message))return H(a,o,i,"eth_sign")}}var h;return{signature:null==(d=l)?void 0:d.data.toString(),signingScheme:c}}var L,M,F,V;!function(e){e.DuplicateOrder="DuplicateOrder",e.InvalidSignature="InvalidSignature",e.MissingOrderData="MissingOrderData",e.InsufficientValidTo="InsufficientValidTo",e.InsufficientAllowance="InsufficientAllowance",e.InsufficientBalance="InsufficientBalance",e.InsufficientFee="InsufficientFee",e.WrongOwner="WrongOwner",e.NotFound="NotFound",e.OrderNotFound="OrderNotFound",e.AlreadyCancelled="AlreadyCancelled",e.OrderFullyExecuted="OrderFullyExecuted",e.OrderExpired="OrderExpired",e.NoLiquidity="NoLiquidity",e.UnsupportedToken="UnsupportedToken",e.AmountIsZero="AmountIsZero",e.SellAmountDoesNotCoverFee="SellAmountDoesNotCoverFee",e.TransferEthToContract="TransferEthToContract",e.UNHANDLED_GET_ERROR="UNHANDLED_GET_ERROR",e.UNHANDLED_CREATE_ERROR="UNHANDLED_CREATE_ERROR",e.UNHANDLED_DELETE_ERROR="UNHANDLED_DELETE_ERROR"}(L||(L={})),function(e){e.DuplicateOrder="There was another identical order already submitted. Please try again.",e.InsufficientFee="The signed fee is insufficient. It's possible that is higher now due to a change in the gas price, ether price, or the sell token price. Please try again to get an updated fee quote.",e.InvalidSignature="The order signature is invalid. Check whether your Wallet app supports off-chain signing.",e.MissingOrderData="The order has missing information",e.InsufficientValidTo="The order you are signing is already expired. This can happen if you set a short expiration in the settings and waited too long before signing the transaction. Please try again.",e.InsufficientAllowance="The account doesn't have enough funds",e.InsufficientBalance="The account needs to approve the selling token in order to trade",e.WrongOwner="The signature is invalid.\n\nIt's likely that the signing method provided by your wallet doesn't comply with the standards required by CowSwap.\n\nCheck whether your Wallet app supports off-chain signing (EIP-712 or ETHSIGN).",e.NotFound="Token pair selected has insufficient liquidity",e.OrderNotFound="The order you are trying to cancel does not exist",e.AlreadyCancelled="Order is already cancelled",e.OrderFullyExecuted="Order is already filled",e.OrderExpired="Order is expired",e.NoLiquidity="Token pair selected has insufficient liquidity",e.UnsupportedToken="One of the tokens you are trading is unsupported. Please read the FAQ for more info.",e.AmountIsZero="Amount is zero",e.SellAmountDoesNotCoverFee="Sell amount does not sufficiently cover the current fee",e.TransferEthToContract="Sending the native currency to smart contract wallets is not currently supported",e.UNHANDLED_GET_ERROR="Order fetch failed. This may be due to a server or network connectivity issue. Please try again later.",e.UNHANDLED_CREATE_ERROR="The order was not accepted by the network",e.UNHANDLED_DELETE_ERROR="The order cancellation was not accepted by the network"}(M||(M={}));class B extends w{static async getErrorMessage(t,r){try{const r=await t.json();return r.errorType?B.apiErrorDetails[r.errorType]||r.errorType:(e.error("cow-sdk:","Unknown reason for bad order submission",r),r.description)}catch(t){return e.error("cow-sdk:","Error handling a 400 error. Likely a problem deserialising the JSON response"),function(t){switch(t){case"get":return M.UNHANDLED_GET_ERROR;case"create":return M.UNHANDLED_CREATE_ERROR;case"delete":return M.UNHANDLED_DELETE_ERROR;default:return e.error("cow-sdk:","[OperatorError::_mapActionToErrorDetails] Uncaught error mapping error action type to server error. Please try again later."),"Something failed. Please try again later."}}(r)}}static async getErrorFromStatusCode(t,r){switch(t.status){case 400:case 404:return this.getErrorMessage(t,r);case 403:return`The order cannot be ${"create"===r?"accepted":"cancelled"}. Your account is deny-listed.`;case 429:return`The order cannot be ${"create"===r?"accepted. Too many order placements":"cancelled. Too many order cancellations"}. Please, retry in a minute`;default:return e.error("cow-sdk:",`[OperatorError::getErrorFromStatusCode] Error ${"create"===r?"creating":"cancelling"} the order, status code:`,t.status||"unknown"),`Error ${"create"===r?"creating":"cancelling"} the order`}}constructor(e){super(e.description,e.errorType),this.name="OperatorError",this.description=void 0,this.description=e.description,this.message=M[e.errorType]}}B.apiErrorDetails=M,function(e){e.UnsupportedToken="UnsupportedToken",e.InsufficientLiquidity="InsufficientLiquidity",e.FeeExceedsFrom="FeeExceedsFrom",e.ZeroPrice="ZeroPrice",e.UNHANDLED_ERROR="UNHANDLED_ERROR"}(F||(F={})),function(e){e.UnsupportedToken="One of the tokens you are trading is unsupported. Please read the FAQ for more info.",e.InsufficientLiquidity="Token pair selected has insufficient liquidity",e.FeeExceedsFrom='Current fee exceeds entered "from" amount',e.ZeroPrice="Quoted price is zero. This is likely due to a significant price difference between the two tokens. Please try increasing amounts.",e.UNHANDLED_ERROR="Quote fetch failed. This may be due to a server or network connectivity issue. Please try again later."}(V||(V={}));class $ extends w{static async getErrorMessage(t){try{const r=await t.json();return r.errorType?$.quoteErrorDetails[r.errorType]||r.errorType:(e.error("cow-sdk:","Unknown reason for bad quote fetch",r),r.description)}catch(t){return e.error("cow-sdk:","Error handling 400/404 error. Likely a problem deserialising the JSON response"),$.quoteErrorDetails.UNHANDLED_ERROR}}static async getErrorFromStatusCode(t){switch(t.status){case 400:case 404:return this.getErrorMessage(t);default:return e.error("cow-sdk:","[QuoteError::getErrorFromStatusCode] Error fetching quote, status code:",t.status||"unknown"),"Error fetching quote"}}constructor(e){super(e.description,e.errorType),this.name="QuoteErrorObject",this.description=void 0,this.data=void 0,this.description=e.description,this.message=$.quoteErrorDetails[e.errorType],this.data=null==e?void 0:e.data}}$.quoteErrorDetails=V;class G{constructor(e,t){this.symbol=void 0,this.address=void 0,this.symbol=e,this.address=t}}const q={[T.MAINNET]:new G("WETH","0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),[T.RINKEBY]:new G("WETH","0xc778417E063141139Fce010982780140Aa0cD5Ab"),[T.GOERLI]:new G("WETH","0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6"),[T.GNOSIS_CHAIN]:new G("WXDAI","0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d")},j={[T.MAINNET]:"ETH",[T.RINKEBY]:"ETH",[T.GOERLI]:"ETH",[T.GNOSIS_CHAIN]:"XDAI"};function Y(e,t){let r=e;return e===j[t]&&(r=q[t].address),r}const K={"Content-Type":"application/json"};class Q{constructor({context:e,name:t,getApiUrl:r,defaultHeaders:n=K,apiVersion:a="v1"}){this.context=void 0,this.API_NAME=void 0,this.API_VERSION=void 0,this.API_URL_GETTER=void 0,this.DEFAULT_HEADERS=void 0,this.context=e,this.API_NAME=t,this.API_VERSION=a,this.API_URL_GETTER=r,this.DEFAULT_HEADERS=n}async getApiBaseUrl(...e){const t=await this.context.chainId,r=this.API_URL_GETTER(...e)[t];if(r)return r+"/"+this.API_VERSION;throw new w(`Unsupported Network. The ${this.API_NAME} API is not deployed in the Network `+t)}post(e,t,r={}){return this.handleMethod(e,"POST",this.fetch.bind(this),this.API_URL_GETTER,r,t)}get(e,t={}){return this.handleMethod(e,"GET",this.fetch.bind(this),this.API_URL_GETTER,t)}delete(e,t,r={}){return this.handleMethod(e,"DELETE",this.fetch.bind(this),this.API_URL_GETTER,r,t)}async handleMethod(e,t,r,n,a={},o){const{chainId:i,env:s,requestOptions:d}=a,c=n("prod"),u=n("staging"),l=i||await this.context.chainId;let h;if(void 0===s)try{h=await r(e,t,`${c[l]}/${this.API_VERSION}`,o,d)}catch(n){h=await r(e,t,`${u[l]}/${this.API_VERSION}`,o,d)}else{const a=n(s);h=await r(e,t,`${a[l]}/${this.API_VERSION}`,o,d)}return h}async fetch(e,t,r,n,a){return d(r+e,m({headers:this.DEFAULT_HEADERS},a,{method:t,body:void 0!==n?JSON.stringify(n):n}))}}function W(e){switch(e){case"staging":return{[T.MAINNET]:"https://barn.api.cow.fi/mainnet/api",[T.RINKEBY]:"https://barn.api.cow.fi/rinkeby/api",[T.GOERLI]:"https://barn.api.cow.fi/goerli/api",[T.GNOSIS_CHAIN]:"https://barn.api.cow.fi/xdai/api"};case"prod":return{[T.MAINNET]:"https://api.cow.fi/mainnet/api",[T.RINKEBY]:"https://api.cow.fi/rinkeby/api",[T.GOERLI]:"https://api.cow.fi/goerli/api",[T.GNOSIS_CHAIN]:"https://api.cow.fi/xdai/api"}}}function J(e){switch(e){case"staging":return{[T.MAINNET]:"https://barn.api.cow.fi/affiliate/api"};case"prod":return{[T.MAINNET]:"https://api.cow.fi/affiliate/api"}}}const Z={errorType:F.UNHANDLED_ERROR,description:V.UNHANDLED_ERROR},z={errorType:L.UNHANDLED_CREATE_ERROR,description:M.UNHANDLED_CREATE_ERROR};async function X(t,r){if(t.ok)return t.json();if(console.log(t),"application/json"===t.headers.get("Content-Type")){const n=function(e){switch(null==e?void 0:e.errorType){case L.NotFound:case L.NoLiquidity:return{errorType:F.InsufficientLiquidity,description:V.InsufficientLiquidity};case L.SellAmountDoesNotCoverFee:return{errorType:F.FeeExceedsFrom,description:V.FeeExceedsFrom,data:null==e?void 0:e.data};case L.UnsupportedToken:return{errorType:F.UnsupportedToken,description:e.description};case L.SellAmountDoesNotCoverFee:return{errorType:F.FeeExceedsFrom,description:e.description};default:return{errorType:F.UNHANDLED_ERROR,description:V.UNHANDLED_ERROR}}}(await t.json()),a=new $(n);if(r){const{sellToken:t,buyToken:n}=r;e.error("cow-sdk:",`Error querying fee from API - sellToken: ${t}, buyToken: ${n}`)}throw a}{const e=await t.text();throw console.log("TEXT: ",e),new $({description:e,errorType:F.UNHANDLED_ERROR})}}class ee extends Q{constructor(e){super({context:e,name:"CoW Protocol",apiVersion:"v1",getApiUrl:W})}async getProfileData(t,r={}){const{chainId:n,env:a}=r,o=n||await this.context.chainId;if(e.debug("cow-sdk:",`[api:${this.API_NAME}] Get profile data for`,o,t),o!==T.MAINNET)return e.info("cow-sdk:","Profile data is only available for mainnet"),null;const i=await this.getProfile(`/profile/${t}`,{chainId:o,env:a});if(i.ok)return i.json();{const t=await i.json();throw e.error("cow-sdk:",t),new w(null==t?void 0:t.description)}}async getTrades(t,r={}){const{chainId:n,env:a=this.context.env}=r,{owner:o,orderId:i,limit:s,offset:d}=t;if(o&&i)throw new w("Cannot specify both owner and orderId");const c=y({owner:o,orderUid:i,limit:s,offset:d}),u=n||await this.context.chainId;e.debug("cow-sdk:","[util:operator] Get trades for",u,{owner:o,orderId:i,limit:s,offset:d});try{const e=await this.get(`/trades${c}`,{chainId:u,env:a});if(e.ok)return e.json();{const t=await e.json();throw new B(t)}}catch(t){if(e.error("cow-sdk:","Error getting trades:",t),t instanceof B)throw t;throw new w("Error getting trades: "+t)}}async getOrders(t,r={}){const{chainId:n,env:a=this.context.env}=r,{owner:o,limit:i=1e3,offset:s=0}=t,d=y({limit:i,offset:s}),c=n||await this.context.chainId;e.debug("cow-sdk:",`[api:${this.API_NAME}] Get orders for `,c,o,i,s);try{const e=await this.get(`/account/${o}/orders/${d}`,{chainId:c,env:a});if(e.ok)return e.json();{const t=await e.json();throw new B(t)}}catch(t){if(e.error("cow-sdk:","Error getting orders information:",t),t instanceof B)throw t;throw new B(z)}}async getTxOrders(t,r={}){const{chainId:n,env:a}=r,o=n||await this.context.chainId;e.debug(`[api:${this.API_NAME}] Get tx orders for `,o,t);try{const e=await this.get(`/transactions/${t}/orders`,{chainId:o,env:a});if(e.ok)return e.json();{const t=await e.json();throw new B(t)}}catch(t){if(e.error("Error getting transaction orders information:",t),t instanceof B)throw t;throw new B(z)}}async getOrder(t,r={}){const{chainId:n,env:a}=r,o=n||await this.context.chainId;e.debug("cow-sdk:",`[api:${this.API_NAME}] Get order for `,o,t);try{const e=await this.get(`/orders/${t}`,{chainId:o,env:a});if(e.ok)return e.json();{const t=await e.json();throw new B(t)}}catch(t){if(e.error("cow-sdk:","Error getting order information:",t),t instanceof B)throw t;throw new B(z)}}async getPriceQuoteLegacy(t,r={}){const{chainId:n,env:a}=r,{baseToken:o,quoteToken:i,amount:s,kind:d}=t,c=n||await this.context.chainId;return e.debug("cow-sdk:",`[api:${this.API_NAME}] Get price from API`,t,"for",c),X(await this.get(`/markets/${Y(o,c)}-${Y(i,c)}/${d}/${s}`,{chainId:c,env:a}).catch(t=>{throw e.error("cow-sdk:","Error getting price quote:",t),new $(Z)}))}async getQuote(e,t={}){const{chainId:r,env:n}=t,a=r||await this.context.chainId,o=this.mapNewToLegacyParams(e,a);return X(await this.post("/quote",o,{chainId:a,env:n}))}async sendSignedOrderCancellation(t,r={}){const{chainId:n,env:a}=r,{cancellation:o,owner:i}=t,s=n||await this.context.chainId;e.debug("cow-sdk:",`[api:${this.API_NAME}] Delete signed order for network`,s,o);const d=await this.delete(`/orders/${o.orderUid}`,{signature:o.signature,signingScheme:_(o.signingScheme),from:i},{chainId:s,env:a});if(!d.ok){const e=await B.getErrorFromStatusCode(d,"delete");throw new w(e)}e.debug("cow-sdk:",`[api:${this.API_NAME}] Cancelled order`,o.orderUid,s)}async sendOrder(t,r={}){const n=m({},t.order,{appData:this.context.appDataHash}),{chainId:a,env:o}=r,i=a||await this.context.chainId,{owner:s}=t;e.debug("cow-sdk:",`[api:${this.API_NAME}] Post signed order for network`,i,n);const d=await this.post("/orders",m({},n,{signingScheme:_(n.signingScheme),from:s}),{chainId:i,env:o});if(!d.ok){const e=await B.getErrorFromStatusCode(d,"create");throw new w(e)}const c=await d.json();return e.debug("cow-sdk:",`[api:${this.API_NAME}] Success posting the signed order`,c),c}async getOrderLink(e){return await this.getApiBaseUrl()+`/orders/${e}`}getProfile(e,t={}){return this.handleMethod(e,"GET",this.fetchProfile.bind(this),J,t)}mapNewToLegacyParams(e,t){const{amount:r,kind:n,userAddress:a,receiver:o,validTo:i,sellToken:d,buyToken:c}=e,u=a||"0x0000000000000000000000000000000000000000",l={sellToken:Y(d,t),buyToken:Y(c,t),from:u,receiver:o||u,appData:this.context.appDataHash,validTo:i,partiallyFillable:!1};return m(n===s.SELL?{kind:s.SELL,sellAmountBeforeFee:r}:{kind:s.BUY,buyAmountAfterFee:r},l)}getApiBaseUrl(){return super.getApiBaseUrl(this.context.env)}async fetchProfile(e,t,r,n){return fetch(r+e,{headers:this.DEFAULT_HEADERS,method:t,body:void 0!==n?JSON.stringify(n):n})}}let te,re,ne,ae=e=>e;const oe=c(te||(te=ae`
2
+ query Totals {
3
+ totals {
4
+ tokens
5
+ orders
6
+ traders
7
+ settlements
8
+ volumeUsd
9
+ volumeEth
10
+ feesUsd
11
+ feesEth
12
+ }
13
+ }
14
+ `)),ie=c(re||(re=ae`
15
+ query LastDaysVolume($days: Int!) {
16
+ dailyTotals(orderBy: timestamp, orderDirection: desc, first: $days) {
17
+ timestamp
18
+ volumeUsd
19
+ }
20
+ }
21
+ `)),se=c(ne||(ne=ae`
22
+ query LastHoursVolume($hours: Int!) {
23
+ hourlyTotals(orderBy: timestamp, orderDirection: desc, first: $hours) {
24
+ timestamp
25
+ volumeUsd
26
+ }
27
+ }
28
+ `)),de={[T.MAINNET]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow",[T.RINKEBY]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow-rinkeby",[T.GOERLI]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow-goerli",[T.GNOSIS_CHAIN]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow-gc"};class ce{constructor(e){this.context=void 0,this.clients=void 0,this.API_NAME="CoW Protocol Subgraph",this.context=e,this.clients=this.createClients()}createClients(){return{[T.MAINNET]:new u(de[T.MAINNET],{fetch:d}),[T.RINKEBY]:new u(de[T.RINKEBY],{fetch:d}),[T.GOERLI]:new u(de[T.GOERLI],{fetch:d}),[T.GNOSIS_CHAIN]:new u(de[T.GNOSIS_CHAIN],{fetch:d})}}async getBaseUrl(){const e=await this.context.chainId;return de[e]}async getTotals(){const t=await this.context.chainId;return e.debug(`[subgraph:${this.API_NAME}] Get totals for:`,t),(await this.runQuery(oe)).totals[0]}async getLastDaysVolume(t){const r=await this.context.chainId;return e.debug(`[subgraph:${this.API_NAME}] Get last ${t} days volume for:`,r),this.runQuery(ie,{days:t})}async getLastHoursVolume(t){const r=await this.context.chainId;return e.debug(`[subgraph:${this.API_NAME}] Get last ${t} hours volume for:`,r),this.runQuery(se,{hours:t})}async runQuery(t,r){try{const e=await this.context.chainId,n=this.clients[e];return await n.request(t,r)}catch(n){e.error(n);const a=await this.getBaseUrl();throw new w(`Error running query: ${t}. Variables: ${JSON.stringify(r)}. API: ${a}. Inner Error: ${n}`)}}}let ue,le;async function he(e){if(le||(le=new f),ue=le.getSchema(e),!ue){let t;try{t=await import(`@cowprotocol/app-data/schemas/v${e}.json`)}catch(t){throw new w(`AppData version ${e} does not exist`,"MISSING_APP_DATA_VERSION")}le.addSchema(t,e),ue=le.getSchema(e)}return{ajv:le,validate:ue}}async function pe(e){const t=function(e){const t=e.match(/.{1,2}/g);if(t)return new Uint8Array(t.map(e=>parseInt(e,16)))}(e.replace(/(^0x)/,""));if(!t)return;const r=Uint8Array.from([1,112,18,32,...t]),{CID:n}=await import("multiformats/cid");return n.decode(r).toV0().toString()}async function fe(e,t){const{ajv:r,validate:n}=await he(t);return{result:!!n(e),errors:n.errors?r.errorsText(n.errors):void 0}}class me{constructor(e){this.context=void 0,this.context=e}generateAppDataDoc(e){const{appDataParams:t,metadataParams:r}=e||{},{referrerParams:n,quoteParams:a}=r||{},o={};return n&&(o.referrer=l(n)),a&&(o.quote=h(a)),p(m({},t,{appCode:(null==t?void 0:t.appCode)||"CowSwap",metadata:o}))}async decodeAppData(t){try{const e=await pe(t);if(!e)throw new w("Error getting serialized CID");return async function(e,t="https://gnosis.mypinata.cloud/ipfs"){const{default:r}=await import("cross-fetch"),n=await r(`${t}/${e}`);return await n.json()}(e)}catch(t){const r=t;throw e.error("Error decoding AppData:",r),new w("Error decoding AppData: "+r.message)}}async cidToAppDataHex(e){const{CID:t}=await import("multiformats/cid"),{digest:r}=t.parse(e).multihash;return`0x${Buffer.from(r).toString("hex")}`}async appDataHexToCid(e){const t=await pe(e);if(!t)throw new w("Error getting serialized CID");return t}async calculateAppDataHash(e){const t=await fe(e,e.version);if(null==t||!t.result)throw new w("Invalid appData provided",null==t?void 0:t.errors);try{const t=await async function(e){const t=JSON.stringify(e),{of:r}=await import("ipfs-only-hash");return r(t,{cidVersion:0})}(e),r=await this.cidToAppDataHex(t);if(!r)throw new w(`Could not extract appDataHash from calculated cidV0 ${t}`);return{cidV0:t,appDataHash:r}}catch(e){throw new w("Failed to calculate appDataHash",e.message)}}async uploadMetadataDocToIpfs(e){const{IpfsHash:t}=await async function(e,{writeUri:t="https://api.pinata.cloud",pinataApiKey:r="",pinataApiSecret:n=""}){const{default:a}=await import("cross-fetch");if(!r||!n)throw new w("You need to pass IPFS api credentials.");const o=JSON.stringify({pinataContent:e,pinataMetadata:{name:"appData"}}),i=`${t}/pinning/pinJSONToIPFS`,s=await a(i,{method:"POST",body:o,headers:{"Content-Type":"application/json",pinata_api_key:r,pinata_secret_api_key:n}}),d=await s.json();if(200!==s.status)throw new Error(d.error.details||d.error);return d}(e,this.context.ipfs);return this.cidToAppDataHex(t)}}const Te={appDataHash:"0x0000000000000000000000000000000000000000000000000000000000000000",env:"prod",ipfs:{readUri:"https://gnosis.mypinata.cloud/ipfs",writeUri:"https://api.pinata.cloud",pinataApiKey:"",pinataApiSecret:""}};var Ee=/*#__PURE__*/g("chainId"),ge=/*#__PURE__*/g("context");class Ae{updateContext(e,t){this.setParams(t,e)}constructor(e,t){Object.defineProperty(this,Ee,{writable:!0,value:T.MAINNET}),Object.defineProperty(this,ge,{writable:!0,value:Te}),this.setParams(e,t)}setParams(e,t){A(this,Ee)[Ee]=this.updateChainId(e),A(this,ge)[ge]=m({},Te,t,{ipfs:m({},Te.ipfs,t.ipfs)})}updateChainId(t){if(!T[t])throw new w(`Invalid chainId: ${t}`);return e.debug("cow-sdk:",`Updating chainId to: ${t}`),A(this,Ee)[Ee]=t,t}get chainId(){var t,r=this;const n=null==(t=A(this,ge)[ge].signer)?void 0:t.provider;return n?(e.debug("cow-sdk:","Getting chainId from provider"),async function(){const t=(await n.getNetwork()).chainId;return t!==A(r,Ee)[Ee]&&(e.debug("cow-sdk:",`ChainId mismatch: Provider's chainId: ${t} vs Context's chainId: ${A(r,Ee)[Ee]}. Updating Context's chainId`),r.updateChainId(t)),t}()):Promise.resolve(A(this,Ee)[Ee])}get appDataHash(){var e;return null!==(e=A(this,ge)[ge].appDataHash)&&void 0!==e?e:Te.appDataHash}get env(){return A(this,ge)[ge].env||Te.env}get signer(){return A(this,ge)[ge].signer}get ipfs(){var e;return null!==(e=A(this,ge)[ge].ipfs)&&void 0!==e?e:Te.ipfs}}class we extends w{static async getErrorMessage(t){try{var r;const a=await t.json();var n;if(null!=(r=a.validationErrors)&&r.length)return(null==(n=a.validationErrors)?void 0:n[0].reason)||a.reason;if(null!=a&&a.reason)return e.error("0x-sdk:","Unknown validation reason for bad price request",a),a.reason;throw new Error('Error response body properties "reason" and "validationErrors" missing.')}catch(t){const r=t instanceof Error;return e.error("0x-sdk:","Error handling a 4xx error. Likely a problem deserialising the JSON response.",r&&(null==t?void 0:t.message)),r?null==t?void 0:t.message:"Price fetch failed. This may be due to a server or network connectivity issue. Please try again later."}}static async getErrorFromStatusCode(t){switch(t.status){case 400:return this.getErrorMessage(t);case 404:return"Not found";case 429:return"Too many requests - Rate limit exceeded";case 500:return"Internal server error";case 501:return"Not Implemented";case 503:return"Server Error - Too many open connections";default:return e.error("0x-sdk:","Error fetching quote, status code:",t.status||"unknown"),"Error fetching quote"}}constructor(e){var t;super(e.reason,e.code.toString()),this.name="ZeroXError",this.description=void 0,this.message=void 0,this.description=(null==(t=e.validationErrors)?void 0:t[0].reason)||e.reason,this.message=e.reason}}function ye(){return{[T.MAINNET]:"https://api.0x.org/swap"}}function Ie({excludedSources:e,affiliateAddress:t}){return y({excludedSources:ke({excludedSources:e}),affiliateAddress:t})}function be({affiliateAddressMap:e,chainId:t}){const r=e[t];if(!r)throw new w(`Invalid affiliate address! Parameters passed: ${JSON.stringify({affiliateAddressMap:e,chainId:t},null,2)}`);return r}function ke({excludedSources:e}){return e.length>0?e.join(","):""}const ve=[];class Ne extends Q{constructor(e,{affiliateAddressMap:t,excludedSources:r}={affiliateAddressMap:k,excludedSources:ve}){super({context:new Ae(e,{}),name:"0x",apiVersion:"v1",getApiUrl:ye}),this.MATCHA_OPTIONS=void 0,this.MATCHA_OPTIONS_URL=void 0;const n=be({affiliateAddressMap:t,chainId:e});this.MATCHA_OPTIONS={affiliateAddressMap:t,excludedSources:r},this.MATCHA_OPTIONS_URL=Ie({excludedSources:r,affiliateAddress:n})}async getQuote(t,r={}){const{amount:n,baseToken:a,quoteToken:o,kind:i}=t,{chainId:d,env:c=this.context.env}=r,u=d||await this.context.chainId,l=function(e){return e===T.MAINNET?e:null}(u);if(null==l)return e.debug("0x-sdk:","Network not supported"),null;e.debug("0x-sdk:",`Get price from ${this.API_NAME}`,t,this.MATCHA_OPTIONS);const{sellToken:h,buyToken:p}=function({quoteToken:e,baseToken:t,kind:r}){return r===s.SELL?{sellToken:t,buyToken:e}:{buyToken:t,sellToken:e}}({baseToken:Y(a,u),quoteToken:Y(o,u),kind:i}),f=be({affiliateAddressMap:this.MATCHA_OPTIONS.affiliateAddressMap,chainId:u}),m=i===s.BUY?"buyAmount":"sellAmount";return async function(e,t){if(e.ok)return e.json();{const t=await e.clone().json();let r;if(null!=t&&t.code&&null!=t&&t.reason)r=new we(t);else{const t=await we.getErrorFromStatusCode(e.clone());r=new we({code:e.status,reason:t})}throw r}}(await this.get(`/price${y({sellToken:h,buyToken:p,[m]:n,affiliateAddress:f,excludedSources:ke(this.MATCHA_OPTIONS)})}`,{chainId:u,env:c}).catch(t=>{throw e.error(`Error getting ${this.API_NAME} price quote:`,t),new Error(t)}))}async updateOptions({affiliateAddressMap:t,excludedSources:r}){const n=await this.context.chainId;t&&(e.debug("0x-sdk:","Updating 0x options affiliate address to",t),this.MATCHA_OPTIONS.affiliateAddressMap=t),r&&(e.debug("0x-sdk:","Updating 0x options excludedSources to",r),this.MATCHA_OPTIONS.excludedSources=r);const a=be({affiliateAddressMap:this.MATCHA_OPTIONS.affiliateAddressMap,chainId:n});this.MATCHA_OPTIONS_URL=Ie(m({},this.MATCHA_OPTIONS,{affiliateAddress:a}))}}class De{constructor(t=T.MAINNET,r={},n={}){var a=this;this.context=void 0,this.cowApi=void 0,this.metadataApi=void 0,this.cowSubgraphApi=void 0,this.zeroXApi=void 0,this.updateChainId=e=>{this.context.updateChainId(e)},this.updateContext=async function(e,t){const r=await a.context.chainId;a.context.updateContext(e,t||r)},this.validateAppDataDocument=fe,this.context=new Ae(t,m({},r)),this.cowApi=new ee(this.context),this.cowSubgraphApi=new ce(this.context),this.metadataApi=new me(this.context),this.zeroXApi=new Ne(t,n.matchaOptions),e.setLevel(n.loglevel||"error")}async signOrder(e){const t=this._checkSigner(),r=await this.context.chainId;return async function(e,t,r){return H({order:e,chainId:t},U,r)}(m({},e,{appData:this.context.appDataHash}),r,t)}async signOrderCancellation(e){const t=this._checkSigner();return async function(e,t,r){return H({orderId:e,chainId:t},C,r)}(e,await this.context.chainId,t)}_checkSigner(e=this.context.signer){if(!e)throw new w("No signer available");return e}}var Oe,Pe,xe,_e,Se,Re,Ue,Ce,He,Le,Me,Fe,Ve,Be,$e,Ge,qe,je,Ye;!function(e){e.EthPriceUsd="ethPriceUSD",e.Id="id"}(Oe||(Oe={})),function(e){e.FeesEth="feesEth",e.FeesUsd="feesUsd",e.Id="id",e.NumberOfTrades="numberOfTrades",e.Orders="orders",e.Settlements="settlements",e.Timestamp="timestamp",e.Tokens="tokens",e.TotalTokens="totalTokens",e.VolumeEth="volumeEth",e.VolumeUsd="volumeUsd"}(Pe||(Pe={})),function(e){e.FeesEth="feesEth",e.FeesUsd="feesUsd",e.Id="id",e.NumberOfTrades="numberOfTrades",e.Orders="orders",e.Settlements="settlements",e.Timestamp="timestamp",e.Tokens="tokens",e.TotalTokens="totalTokens",e.VolumeEth="volumeEth",e.VolumeUsd="volumeUsd"}(xe||(xe={})),function(e){e.Asc="asc",e.Desc="desc"}(_e||(_e={})),function(e){e.Id="id",e.InvalidateTimestamp="invalidateTimestamp",e.IsSigned="isSigned",e.IsValid="isValid",e.Owner="owner",e.PresignTimestamp="presignTimestamp",e.Trades="trades",e.TradesTimestamp="tradesTimestamp"}(Se||(Se={})),function(e){e.Id="id",e.Timestamp="timestamp",e.Token0="token0",e.Token0Price="token0Price",e.Token0relativePrice="token0relativePrice",e.Token1="token1",e.Token1Price="token1Price",e.Token1relativePrice="token1relativePrice",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(Re||(Re={})),function(e){e.Id="id",e.Timestamp="timestamp",e.Token0="token0",e.Token0Price="token0Price",e.Token0relativePrice="token0relativePrice",e.Token1="token1",e.Token1Price="token1Price",e.Token1relativePrice="token1relativePrice",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(Ue||(Ue={})),function(e){e.Id="id",e.Token0="token0",e.Token0Price="token0Price",e.Token0relativePrice="token0relativePrice",e.Token1="token1",e.Token1Price="token1Price",e.Token1relativePrice="token1relativePrice",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(Ce||(Ce={})),function(e){e.FirstTradeTimestamp="firstTradeTimestamp",e.Id="id",e.Solver="solver",e.Trades="trades",e.TxHash="txHash"}(He||(He={})),function(e){e.AveragePrice="averagePrice",e.ClosePrice="closePrice",e.HigherPrice="higherPrice",e.Id="id",e.LowerPrice="lowerPrice",e.OpenPrice="openPrice",e.Timestamp="timestamp",e.Token="token",e.TotalTrades="totalTrades",e.TotalVolume="totalVolume",e.TotalVolumeEth="totalVolumeEth",e.TotalVolumeUsd="totalVolumeUsd"}(Le||(Le={})),function(e){e.AveragePrice="averagePrice",e.ClosePrice="closePrice",e.HigherPrice="higherPrice",e.Id="id",e.LowerPrice="lowerPrice",e.OpenPrice="openPrice",e.Timestamp="timestamp",e.Token="token",e.TotalTrades="totalTrades",e.TotalVolume="totalVolume",e.TotalVolumeEth="totalVolumeEth",e.TotalVolumeUsd="totalVolumeUsd"}(Me||(Me={})),function(e){e.AmountEth="amountEth",e.AmountUsd="amountUsd",e.Id="id",e.Timestamp="timestamp",e.Token="token",e.Trade="trade"}(Fe||(Fe={})),function(e){e.Address="address",e.DailyTotals="dailyTotals",e.Decimals="decimals",e.FirstTradeTimestamp="firstTradeTimestamp",e.History="history",e.HourlyTotals="hourlyTotals",e.Id="id",e.Name="name",e.NumberOfTrades="numberOfTrades",e.PriceEth="priceEth",e.PriceUsd="priceUsd",e.Symbol="symbol",e.TotalVolume="totalVolume",e.TotalVolumeEth="totalVolumeEth",e.TotalVolumeUsd="totalVolumeUsd"}(Ve||(Ve={})),function(e){e.FeesEth="feesEth",e.FeesUsd="feesUsd",e.Id="id",e.NumberOfTrades="numberOfTrades",e.Orders="orders",e.Settlements="settlements",e.Tokens="tokens",e.Traders="traders",e.VolumeEth="volumeEth",e.VolumeUsd="volumeUsd"}(Be||(Be={})),function(e){e.BuyAmount="buyAmount",e.BuyAmountEth="buyAmountEth",e.BuyAmountUsd="buyAmountUsd",e.BuyToken="buyToken",e.FeeAmount="feeAmount",e.GasPrice="gasPrice",e.Id="id",e.Order="order",e.SellAmount="sellAmount",e.SellAmountEth="sellAmountEth",e.SellAmountUsd="sellAmountUsd",e.SellToken="sellToken",e.Settlement="settlement",e.Timestamp="timestamp",e.TxHash="txHash"}($e||($e={})),function(e){e.Id="id",e.Liquidity="liquidity",e.Tick="tick",e.Token0="token0",e.Token0Price="token0Price",e.Token1="token1",e.Token1Price="token1Price",e.TotalValueLockedToken0="totalValueLockedToken0",e.TotalValueLockedToken1="totalValueLockedToken1"}(Ge||(Ge={})),function(e){e.Address="address",e.AllowedPools="allowedPools",e.Decimals="decimals",e.Id="id",e.Name="name",e.PriceEth="priceEth",e.PriceUsd="priceUsd",e.Symbol="symbol"}(qe||(qe={})),function(e){e.Address="address",e.FirstTradeTimestamp="firstTradeTimestamp",e.Id="id",e.IsSolver="isSolver",e.NumberOfTrades="numberOfTrades",e.OrdersPlaced="ordersPlaced",e.SolvedAmountEth="solvedAmountEth",e.SolvedAmountUsd="solvedAmountUsd",e.TradedAmountEth="tradedAmountEth",e.TradedAmountUsd="tradedAmountUsd"}(je||(je={})),function(e){e.Allow="allow",e.Deny="deny"}(Ye||(Ye={}));var Ke={__proto__:null,get Bundle_OrderBy(){return Oe},get DailyTotal_OrderBy(){return Pe},get HourlyTotal_OrderBy(){return xe},get OrderDirection(){return _e},get Order_OrderBy(){return Se},get PairDaily_OrderBy(){return Re},get PairHourly_OrderBy(){return Ue},get Pair_OrderBy(){return Ce},get Settlement_OrderBy(){return He},get TokenDailyTotal_OrderBy(){return Le},get TokenHourlyTotal_OrderBy(){return Me},get TokenTradingEvent_OrderBy(){return Fe},get Token_OrderBy(){return Ve},get Total_OrderBy(){return Be},get Trade_OrderBy(){return $e},get UniswapPool_OrderBy(){return Ge},get UniswapToken_OrderBy(){return qe},get User_OrderBy(){return je},get _SubgraphErrorPolicy_(){return Ye}};export{I as ALL_SUPPORTED_CHAIN_IDS,w as CowError,De as CowSdk,Ke as GraphQL,T as SupportedChainId,G as Token};
29
+ //# sourceMappingURL=index.modern.mjs.map