@cowprotocol/cow-sdk 0.0.12 → 0.0.13
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/api/cow-subgraph/graphql.d.ts +161 -21
- package/dist/api/metadata/index.d.ts +2 -2
- package/dist/api/metadata/types.d.ts +5 -2
- package/dist/appData.schema-4c010c50.js +2 -0
- package/dist/appData.schema-4c010c50.js.map +1 -0
- package/dist/appData.schema-adfc1c6f.js +2 -0
- package/dist/appData.schema-adfc1c6f.js.map +1 -0
- package/dist/constants/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +2 -2
- package/dist/index.module.js.map +1 -1
- package/dist/utils/context.d.ts +4 -1
- package/dist/utils/ipfs.d.ts +1 -1
- package/package.json +1 -1
- package/dist/appData.schema-0c8db23b.js +0 -2
- package/dist/appData.schema-0c8db23b.js.map +0 -1
- package/dist/appData.schema-412cbfbf.js +0 -2
- package/dist/appData.schema-412cbfbf.js.map +0 -1
package/dist/index.module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"loglevel";import r from"cross-fetch";import{SigningScheme as t,IntChainIdTypedDataV4Signer as o,TypedDataV3Signer as n,domain as i,signOrderCancellation as s,signOrder as a,OrderKind as c}from"@gnosis.pm/gp-v2-contracts";export{OrderKind}from"@gnosis.pm/gp-v2-contracts";import u from"@gnosis.pm/gp-v2-contracts/networks.json";import{gql as d,GraphQLClient as l}from"graphql-request";import h from"ajv";class m extends Error{constructor(e,r){super(e),this.error_code=void 0,this.error_code=r}}function p(e){if(!e)return"";const r=new URLSearchParams;for(const t of Object.keys(e)){const o=e[t];o&&r.append(t,o.toString())}const t=r.toString();return t?`?${t}`:""}const f="cow-sdk:";var g;!function(e){e[e.MAINNET=1]="MAINNET",e[e.RINKEBY=4]="RINKEBY",e[e.GNOSIS_CHAIN=100]="GNOSIS_CHAIN"}(g||(g={}));const T=[g.MAINNET,g.RINKEBY,g.GNOSIS_CHAIN],{GPv2Settlement:E}=u,v={[g.MAINNET]:E[g.MAINNET].address,[g.RINKEBY]:E[g.RINKEBY].address,[g.GNOSIS_CHAIN]:E[g.GNOSIS_CHAIN].address},y=function(r,i,s,a="v4"){try{let u;function c(e){var r;return u?e:{signature:null==(r=h)?void 0:r.data.toString(),signingScheme:d}}const d="eth_sign"===a?t.ETHSIGN:t.EIP712;let l,h=null;try{switch(a){case"v3":l=new n(s);break;case"int_v4":l=new o(s);break;default:l=s}}catch(g){throw e.error(f,"Wallet not supported:",g),new m("Wallet not supported")}const p=function(e,t){try{var o=Promise.resolve(i({...r,signer:l,signingScheme:d})).then(function(e){h=e})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(t){if(void 0===(o=t).code&&void 0===o.message)throw e.error(f,t),t;var o;if(t.code===w||D.test(t.message))switch(a){case"v4":const e=y(r,i,s,"v3");return u=1,e;case"v3":const o=y(r,i,s,"eth_sign");return u=1,o;default:throw t}else{if(O.test(t.message)){const e=y(r,i,s,"int_v4");return u=1,e}if(t.code===I){const e=y(r,i,s,"eth_sign");return u=1,e}if(N.test(t.message)){const e=y(r,i,s,"v3");return u=1,e}if(k.test(t.message)){const e=y(r,i,s,"eth_sign");return u=1,e}}});return Promise.resolve(p&&p.then?p.then(c):c(p))}catch(T){return Promise.reject(T)}},P=function(e){try{const{chainId:r,signer:t,signingScheme:o,orderId:n}=e,i=R(r);return Promise.resolve(s(i,n,t,b(o)))}catch(e){return Promise.reject(e)}},A=function(e){try{const{chainId:r,signer:t,order:o,signingScheme:n}=e,i=R(r);return Promise.resolve(a(i,o,t,b(n)))}catch(e){return Promise.reject(e)}},I=-32603,w=-32601,N=/eth_signTypedData_v4 does not exist/i,k=/eth_signTypedData_v3 does not exist/i,D=/RPC request failed/i,O=/provided chainid .* must match the active chainid/i,_=new Map([[t.EIP712,{libraryValue:0,apiValue:"eip712"}],[t.ETHSIGN,{libraryValue:1,apiValue:"ethsign"}],[t.EIP1271,{libraryValue:2,apiValue:"eip1271"}],[t.PRESIGN,{libraryValue:3,apiValue:"presign"}]]);function S(e){const r=_.get(e);if(void 0===r)throw new m("Unknown schema "+e);return r}function U(e){return S(e).apiValue}function b(e){return S(e).libraryValue}function R(e){const r=v[e];if(!r)throw new m("Unsupported network. Settlement contract is not deployed");return i(e,r)}var x,C,H,L;!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"}(x||(x={})),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"}(C||(C={}));class j extends m{static getErrorMessage(r,t){try{return Promise.resolve(function(t,o){try{var n=Promise.resolve(r.json()).then(function(r){return r.errorType?j.apiErrorDetails[r.errorType]||r.errorType:(e.error(f,"Unknown reason for bad order submission",r),r.description)})}catch(e){return o()}return n&&n.then?n.then(void 0,o):n}(0,function(){return e.error(f,"Error handling a 400 error. Likely a problem deserialising the JSON response"),function(r){switch(r){case"get":return C.UNHANDLED_GET_ERROR;case"create":return C.UNHANDLED_CREATE_ERROR;case"delete":return C.UNHANDLED_DELETE_ERROR;default:return e.error(f,"[OperatorError::_mapActionToErrorDetails] Uncaught error mapping error action type to server error. Please try again later."),"Something failed. Please try again later."}}(t)}))}catch(e){return Promise.reject(e)}}static getErrorFromStatusCode(r,t){try{const o=this;switch(r.status){case 400:case 404:return Promise.resolve(o.getErrorMessage(r,t));case 403:return Promise.resolve(`The order cannot be ${"create"===t?"accepted":"cancelled"}. Your account is deny-listed.`);case 429:return Promise.resolve(`The order cannot be ${"create"===t?"accepted. Too many order placements":"cancelled. Too many order cancellations"}. Please, retry in a minute`);default:return e.error(f,`[OperatorError::getErrorFromStatusCode] Error ${"create"===t?"creating":"cancelling"} the order, status code:`,r.status||"unknown"),Promise.resolve(`Error ${"create"===t?"creating":"cancelling"} the order`)}return Promise.resolve()}catch(e){return Promise.reject(e)}}constructor(e){super(e.description,e.errorType),this.name="OperatorError",this.description=void 0,this.description=e.description,this.message=C[e.errorType]}}j.apiErrorDetails=C,function(e){e.UnsupportedToken="UnsupportedToken",e.InsufficientLiquidity="InsufficientLiquidity",e.FeeExceedsFrom="FeeExceedsFrom",e.ZeroPrice="ZeroPrice",e.UNHANDLED_ERROR="UNHANDLED_ERROR"}(H||(H={})),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."}(L||(L={}));class V extends m{static getErrorMessage(r){try{return Promise.resolve(function(t,o){try{var n=Promise.resolve(r.json()).then(function(r){return r.errorType?V.quoteErrorDetails[r.errorType]||r.errorType:(e.error(f,"Unknown reason for bad quote fetch",r),r.description)})}catch(e){return o()}return n&&n.then?n.then(void 0,o):n}(0,function(){return e.error(f,"Error handling 400/404 error. Likely a problem deserialising the JSON response"),V.quoteErrorDetails.UNHANDLED_ERROR}))}catch(e){return Promise.reject(e)}}static getErrorFromStatusCode(r){try{const t=this;switch(r.status){case 400:case 404:return Promise.resolve(t.getErrorMessage(r));default:return e.error(f,"[QuoteError::getErrorFromStatusCode] Error fetching quote, status code:",r.status||"unknown"),Promise.resolve("Error fetching quote")}return Promise.resolve()}catch(e){return Promise.reject(e)}}constructor(e){super(e.description,e.errorType),this.name="QuoteErrorObject",this.description=void 0,this.data=void 0,this.description=e.description,this.message=V.quoteErrorDetails[e.errorType],this.data=null==e?void 0:e.data}}V.quoteErrorDetails=L;class F{constructor(e,r){this.symbol=void 0,this.address=void 0,this.symbol=e,this.address=r}}const B={[g.MAINNET]:new F("WETH","0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),[g.RINKEBY]:new F("WETH","0xc778417E063141139Fce010982780140Aa0cD5Ab"),[g.GNOSIS_CHAIN]:new F("WXDAI","0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d")},$={[g.MAINNET]:"ETH",[g.RINKEBY]:"ETH",[g.GNOSIS_CHAIN]:"XDAI"};function M(e,r){let t=e;return e===$[r]&&(t=B[r].address),t}function q(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}const G=function(r,t){try{return r.ok?Promise.resolve(r.json()):Promise.resolve(r.json()).then(function(r){const o=function(e){switch(null==e?void 0:e.errorType){case x.NotFound:case x.NoLiquidity:return{errorType:H.InsufficientLiquidity,description:L.InsufficientLiquidity};case x.SellAmountDoesNotCoverFee:return{errorType:H.FeeExceedsFrom,description:L.FeeExceedsFrom,data:null==e?void 0:e.data};case x.UnsupportedToken:return{errorType:H.UnsupportedToken,description:e.description};case x.SellAmountDoesNotCoverFee:return{errorType:H.FeeExceedsFrom,description:e.description};default:return{errorType:H.UNHANDLED_ERROR,description:L.UNHANDLED_ERROR}}}(r),n=new V(o);if(t){const{sellToken:r,buyToken:o}=t;e.error(f,`Error querying fee from API - sellToken: ${r}, buyToken: ${o}`)}throw n})}catch(e){return Promise.reject(e)}},K={errorType:H.UNHANDLED_ERROR,description:L.UNHANDLED_ERROR},Y={errorType:x.UNHANDLED_CREATE_ERROR,description:C.UNHANDLED_CREATE_ERROR};class Q{constructor(e){this.context=void 0,this.API_NAME="CoW Protocol",this.context=e}get DEFAULT_HEADERS(){return{"Content-Type":"application/json","X-AppId":this.context.appDataHash}}get API_BASE_URL(){return this.context.isDevEnvironment?{[g.MAINNET]:"https://barn.api.cow.fi/mainnet/api",[g.RINKEBY]:"https://barn.api.cow.fi/rinkeby/api",[g.GNOSIS_CHAIN]:"https://barn.api.cow.fi/xdai/api"}:{[g.MAINNET]:"https://api.cow.fi/mainnet/api",[g.RINKEBY]:"https://api.cow.fi/rinkeby/api",[g.GNOSIS_CHAIN]:"https://api.cow.fi/xdai/api"}}get PROFILE_API_BASE_URL(){return this.context.isDevEnvironment?{[g.MAINNET]:"https://barn.api.cow.fi/affiliate/api"}:{[g.MAINNET]:"https://api.cow.fi/affiliate/api"}}getProfileData(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(o){return e.debug(f,`[api:${t.API_NAME}] Get profile data for`,o,r),o!==g.MAINNET?(e.info(f,"Profile data is only available for mainnet"),null):Promise.resolve(t.getProfile(`/profile/${r}`)).then(function(r){return r.ok?r.json():Promise.resolve(r.json()).then(function(r){throw e.error(f,r),new m(null==r?void 0:r.description)})})})}catch(e){return Promise.reject(e)}}getTrades(r){try{const t=this,{owner:o,limit:n,offset:i}=r,s=p({owner:o,limit:n,offset:i});return Promise.resolve(t.context.chainId).then(function(r){return e.debug(f,"[util:operator] Get trades for",r,o,{limit:n,offset:i}),q(function(){return Promise.resolve(t.get(`/trades${s}`)).then(function(e){return e.ok?e.json():Promise.resolve(e.json()).then(function(e){throw new j(e)})})},function(r){if(e.error(f,"Error getting trades:",r),r instanceof j)throw r;throw new m("Error getting trades: "+r)})})}catch(e){return Promise.reject(e)}}getOrders(r){try{const t=this,{owner:o,limit:n=1e3,offset:i=0}=r,s=p({limit:n,offset:i});return Promise.resolve(t.context.chainId).then(function(r){return e.debug(f,`[api:${t.API_NAME}] Get orders for `,r,o,n,i),q(function(){return Promise.resolve(t.get(`/account/${o}/orders/${s}`)).then(function(e){return e.ok?e.json():Promise.resolve(e.json()).then(function(e){throw new j(e)})})},function(r){if(e.error(f,"Error getting orders information:",r),r instanceof j)throw r;throw new j(Y)})})}catch(e){return Promise.reject(e)}}getTxOrders(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(o){return e.debug(`[api:${t.API_NAME}] Get tx orders for `,o,r),q(function(){return Promise.resolve(t.get(`/transactions/${r}/orders`)).then(function(e){return e.ok?e.json():Promise.resolve(e.json()).then(function(e){throw new j(e)})})},function(r){if(e.error("Error getting transaction orders information:",r),r instanceof j)throw r;throw new j(Y)})})}catch(e){return Promise.reject(e)}}getOrder(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(o){return e.debug(f,`[api:${t.API_NAME}] Get order for `,o,r),q(function(){return Promise.resolve(t.get(`/orders/${r}`)).then(function(e){return e.ok?e.json():Promise.resolve(e.json()).then(function(e){throw new j(e)})})},function(r){if(e.error(f,"Error getting order information:",r),r instanceof j)throw r;throw new j(Y)})})}catch(e){return Promise.reject(e)}}getPriceQuoteLegacy(r){try{const t=this,{baseToken:o,quoteToken:n,amount:i,kind:s}=r;return Promise.resolve(t.context.chainId).then(function(a){return e.debug(f,`[api:${t.API_NAME}] Get price from API`,r,"for",a),Promise.resolve(t.get(`/markets/${M(o,a)}-${M(n,a)}/${s}/${i}`).catch(r=>{throw e.error(f,"Error getting price quote:",r),new V(K)})).then(G)})}catch(e){return Promise.reject(e)}}getQuote(e){try{const r=this;return Promise.resolve(r.context.chainId).then(function(t){const o=r.mapNewToLegacyParams(e,t);return Promise.resolve(r.post("/quote",o)).then(G)})}catch(e){return Promise.reject(e)}}sendSignedOrderCancellation(r){try{const t=this,{cancellation:o,owner:n}=r;return Promise.resolve(t.context.chainId).then(function(r){return e.debug(f,`[api:${t.API_NAME}] Delete signed order for network`,r,o),Promise.resolve(t.delete(`/orders/${o.orderUid}`,{signature:o.signature,signingScheme:U(o.signingScheme),from:n})).then(function(n){function i(n){e.debug(f,`[api:${t.API_NAME}] Cancelled order`,o.orderUid,r)}const s=function(){if(!n.ok)return Promise.resolve(j.getErrorFromStatusCode(n,"delete")).then(function(e){throw new m(e)})}();return s&&s.then?s.then(i):i()})})}catch(e){return Promise.reject(e)}}sendOrder(r){try{const t=this,o={...r.order,appData:t.context.appDataHash};return Promise.resolve(t.context.chainId).then(function(n){const{owner:i}=r;return e.debug(f,`[api:${t.API_NAME}] Post signed order for network`,n,o),Promise.resolve(t.post("/orders",{...o,signingScheme:U(o.signingScheme),from:i})).then(function(r){function o(o){return Promise.resolve(r.json()).then(function(r){return e.debug(f,`[api:${t.API_NAME}] Success posting the signed order`,r),r})}const n=function(){if(!r.ok)return Promise.resolve(j.getErrorFromStatusCode(r,"create")).then(function(e){throw new m(e)})}();return n&&n.then?n.then(o):o()})})}catch(e){return Promise.reject(e)}}getOrderLink(e){return this.getApiBaseUrl()+`/orders/${e}`}mapNewToLegacyParams(e,r){const{amount:t,kind:o,userAddress:n,receiver:i,validTo:s,sellToken:a,buyToken:u}=e,d=n||"0x0000000000000000000000000000000000000000",l={sellToken:M(a,r),buyToken:M(u,r),from:d,receiver:i||d,appData:this.context.appDataHash,validTo:s,partiallyFillable:!1};return o===c.SELL?{kind:c.SELL,sellAmountBeforeFee:t,...l}:{kind:c.BUY,buyAmountAfterFee:t,...l}}getApiBaseUrl(){try{const e=this;return Promise.resolve(e.context.chainId).then(function(r){const t=e.API_BASE_URL[r];if(t)return t+"/v1";throw new m(`Unsupported Network. The ${e.API_NAME} API is not deployed in the Network `+r)})}catch(e){return Promise.reject(e)}}getProfileApiBaseUrl(){try{const e=this;return Promise.resolve(e.context.chainId).then(function(r){const t=e.PROFILE_API_BASE_URL[r];if(t)return t+"/v1";throw new m(`Unsupported Network. The ${e.API_NAME} API is not deployed in the Network `+r)})}catch(e){return Promise.reject(e)}}fetch(e,t,o){try{const n=this;return Promise.resolve(n.getApiBaseUrl()).then(function(i){return r(i+e,{headers:n.DEFAULT_HEADERS,method:t,body:void 0!==o?JSON.stringify(o):o})})}catch(e){return Promise.reject(e)}}fetchProfile(e,t,o){try{const n=this;return Promise.resolve(n.getProfileApiBaseUrl()).then(function(i){return r(i+e,{headers:n.DEFAULT_HEADERS,method:t,body:void 0!==o?JSON.stringify(o):o})})}catch(e){return Promise.reject(e)}}post(e,r){return this.fetch(e,"POST",r)}get(e){return this.fetch(e,"GET")}getProfile(e){return this.fetchProfile(e,"GET")}delete(e,r){return this.fetch(e,"DELETE",r)}}const W=d`
|
|
1
|
+
import e from"loglevel";import r from"cross-fetch";import{SigningScheme as t,IntChainIdTypedDataV4Signer as n,TypedDataV3Signer as o,domain as i,signOrderCancellation as s,signOrder as a,OrderKind as c}from"@gnosis.pm/gp-v2-contracts";export{OrderKind}from"@gnosis.pm/gp-v2-contracts";import u from"@gnosis.pm/gp-v2-contracts/networks.json";import{gql as d,GraphQLClient as l}from"graphql-request";import h from"ajv";class m extends Error{constructor(e,r){super(e),this.error_code=void 0,this.error_code=r}}function p(e){if(!e)return"";const r=new URLSearchParams;for(const t of Object.keys(e)){const n=e[t];n&&r.append(t,n.toString())}const t=r.toString();return t?`?${t}`:""}const f="cow-sdk:";var g;!function(e){e[e.MAINNET=1]="MAINNET",e[e.RINKEBY=4]="RINKEBY",e[e.GNOSIS_CHAIN=100]="GNOSIS_CHAIN"}(g||(g={}));const T=[g.MAINNET,g.RINKEBY,g.GNOSIS_CHAIN],{GPv2Settlement:E}=u,v={[g.MAINNET]:E[g.MAINNET].address,[g.RINKEBY]:E[g.RINKEBY].address,[g.GNOSIS_CHAIN]:E[g.GNOSIS_CHAIN].address},y=function(r,i,s,a="v4"){try{let u;function c(e){var r;return u?e:{signature:null==(r=h)?void 0:r.data.toString(),signingScheme:d}}const d="eth_sign"===a?t.ETHSIGN:t.EIP712;let l,h=null;try{switch(a){case"v3":l=new o(s);break;case"int_v4":l=new n(s);break;default:l=s}}catch(g){throw e.error(f,"Wallet not supported:",g),new m("Wallet not supported")}const p=function(e,t){try{var n=Promise.resolve(i({...r,signer:l,signingScheme:d})).then(function(e){h=e})}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}(0,function(t){if(void 0===(n=t).code&&void 0===n.message)throw e.error(f,t),t;var n;if(t.code===w||D.test(t.message))switch(a){case"v4":const e=y(r,i,s,"v3");return u=1,e;case"v3":const n=y(r,i,s,"eth_sign");return u=1,n;default:throw t}else{if(O.test(t.message)){const e=y(r,i,s,"int_v4");return u=1,e}if(t.code===I){const e=y(r,i,s,"eth_sign");return u=1,e}if(N.test(t.message)){const e=y(r,i,s,"v3");return u=1,e}if(k.test(t.message)){const e=y(r,i,s,"eth_sign");return u=1,e}}});return Promise.resolve(p&&p.then?p.then(c):c(p))}catch(T){return Promise.reject(T)}},P=function(e){try{const{chainId:r,signer:t,signingScheme:n,orderId:o}=e,i=R(r);return Promise.resolve(s(i,o,t,b(n)))}catch(e){return Promise.reject(e)}},A=function(e){try{const{chainId:r,signer:t,order:n,signingScheme:o}=e,i=R(r);return Promise.resolve(a(i,n,t,b(o)))}catch(e){return Promise.reject(e)}},I=-32603,w=-32601,N=/eth_signTypedData_v4 does not exist/i,k=/eth_signTypedData_v3 does not exist/i,D=/RPC request failed/i,O=/provided chainid .* must match the active chainid/i,_=new Map([[t.EIP712,{libraryValue:0,apiValue:"eip712"}],[t.ETHSIGN,{libraryValue:1,apiValue:"ethsign"}],[t.EIP1271,{libraryValue:2,apiValue:"eip1271"}],[t.PRESIGN,{libraryValue:3,apiValue:"presign"}]]);function S(e){const r=_.get(e);if(void 0===r)throw new m("Unknown schema "+e);return r}function U(e){return S(e).apiValue}function b(e){return S(e).libraryValue}function R(e){const r=v[e];if(!r)throw new m("Unsupported network. Settlement contract is not deployed");return i(e,r)}var x,C,H,L;!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"}(x||(x={})),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"}(C||(C={}));class j extends m{static getErrorMessage(r,t){try{return Promise.resolve(function(t,n){try{var o=Promise.resolve(r.json()).then(function(r){return r.errorType?j.apiErrorDetails[r.errorType]||r.errorType:(e.error(f,"Unknown reason for bad order submission",r),r.description)})}catch(e){return n()}return o&&o.then?o.then(void 0,n):o}(0,function(){return e.error(f,"Error handling a 400 error. Likely a problem deserialising the JSON response"),function(r){switch(r){case"get":return C.UNHANDLED_GET_ERROR;case"create":return C.UNHANDLED_CREATE_ERROR;case"delete":return C.UNHANDLED_DELETE_ERROR;default:return e.error(f,"[OperatorError::_mapActionToErrorDetails] Uncaught error mapping error action type to server error. Please try again later."),"Something failed. Please try again later."}}(t)}))}catch(e){return Promise.reject(e)}}static getErrorFromStatusCode(r,t){try{const n=this;switch(r.status){case 400:case 404:return Promise.resolve(n.getErrorMessage(r,t));case 403:return Promise.resolve(`The order cannot be ${"create"===t?"accepted":"cancelled"}. Your account is deny-listed.`);case 429:return Promise.resolve(`The order cannot be ${"create"===t?"accepted. Too many order placements":"cancelled. Too many order cancellations"}. Please, retry in a minute`);default:return e.error(f,`[OperatorError::getErrorFromStatusCode] Error ${"create"===t?"creating":"cancelling"} the order, status code:`,r.status||"unknown"),Promise.resolve(`Error ${"create"===t?"creating":"cancelling"} the order`)}return Promise.resolve()}catch(e){return Promise.reject(e)}}constructor(e){super(e.description,e.errorType),this.name="OperatorError",this.description=void 0,this.description=e.description,this.message=C[e.errorType]}}j.apiErrorDetails=C,function(e){e.UnsupportedToken="UnsupportedToken",e.InsufficientLiquidity="InsufficientLiquidity",e.FeeExceedsFrom="FeeExceedsFrom",e.ZeroPrice="ZeroPrice",e.UNHANDLED_ERROR="UNHANDLED_ERROR"}(H||(H={})),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."}(L||(L={}));class V extends m{static getErrorMessage(r){try{return Promise.resolve(function(t,n){try{var o=Promise.resolve(r.json()).then(function(r){return r.errorType?V.quoteErrorDetails[r.errorType]||r.errorType:(e.error(f,"Unknown reason for bad quote fetch",r),r.description)})}catch(e){return n()}return o&&o.then?o.then(void 0,n):o}(0,function(){return e.error(f,"Error handling 400/404 error. Likely a problem deserialising the JSON response"),V.quoteErrorDetails.UNHANDLED_ERROR}))}catch(e){return Promise.reject(e)}}static getErrorFromStatusCode(r){try{const t=this;switch(r.status){case 400:case 404:return Promise.resolve(t.getErrorMessage(r));default:return e.error(f,"[QuoteError::getErrorFromStatusCode] Error fetching quote, status code:",r.status||"unknown"),Promise.resolve("Error fetching quote")}return Promise.resolve()}catch(e){return Promise.reject(e)}}constructor(e){super(e.description,e.errorType),this.name="QuoteErrorObject",this.description=void 0,this.data=void 0,this.description=e.description,this.message=V.quoteErrorDetails[e.errorType],this.data=null==e?void 0:e.data}}V.quoteErrorDetails=L;class F{constructor(e,r){this.symbol=void 0,this.address=void 0,this.symbol=e,this.address=r}}const B={[g.MAINNET]:new F("WETH","0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),[g.RINKEBY]:new F("WETH","0xc778417E063141139Fce010982780140Aa0cD5Ab"),[g.GNOSIS_CHAIN]:new F("WXDAI","0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d")},$={[g.MAINNET]:"ETH",[g.RINKEBY]:"ETH",[g.GNOSIS_CHAIN]:"XDAI"};function M(e,r){let t=e;return e===$[r]&&(t=B[r].address),t}function q(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}const G=function(r,t){try{return r.ok?Promise.resolve(r.json()):Promise.resolve(r.json()).then(function(r){const n=function(e){switch(null==e?void 0:e.errorType){case x.NotFound:case x.NoLiquidity:return{errorType:H.InsufficientLiquidity,description:L.InsufficientLiquidity};case x.SellAmountDoesNotCoverFee:return{errorType:H.FeeExceedsFrom,description:L.FeeExceedsFrom,data:null==e?void 0:e.data};case x.UnsupportedToken:return{errorType:H.UnsupportedToken,description:e.description};case x.SellAmountDoesNotCoverFee:return{errorType:H.FeeExceedsFrom,description:e.description};default:return{errorType:H.UNHANDLED_ERROR,description:L.UNHANDLED_ERROR}}}(r),o=new V(n);if(t){const{sellToken:r,buyToken:n}=t;e.error(f,`Error querying fee from API - sellToken: ${r}, buyToken: ${n}`)}throw o})}catch(e){return Promise.reject(e)}},K={errorType:H.UNHANDLED_ERROR,description:L.UNHANDLED_ERROR},Y={errorType:x.UNHANDLED_CREATE_ERROR,description:C.UNHANDLED_CREATE_ERROR};class Q{constructor(e){this.context=void 0,this.API_NAME="CoW Protocol",this.context=e}get DEFAULT_HEADERS(){return{"Content-Type":"application/json","X-AppId":this.context.appDataHash}}get API_BASE_URL(){return this.context.isDevEnvironment?{[g.MAINNET]:"https://barn.api.cow.fi/mainnet/api",[g.RINKEBY]:"https://barn.api.cow.fi/rinkeby/api",[g.GNOSIS_CHAIN]:"https://barn.api.cow.fi/xdai/api"}:{[g.MAINNET]:"https://api.cow.fi/mainnet/api",[g.RINKEBY]:"https://api.cow.fi/rinkeby/api",[g.GNOSIS_CHAIN]:"https://api.cow.fi/xdai/api"}}get PROFILE_API_BASE_URL(){return this.context.isDevEnvironment?{[g.MAINNET]:"https://barn.api.cow.fi/affiliate/api"}:{[g.MAINNET]:"https://api.cow.fi/affiliate/api"}}getProfileData(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(n){return e.debug(f,`[api:${t.API_NAME}] Get profile data for`,n,r),n!==g.MAINNET?(e.info(f,"Profile data is only available for mainnet"),null):Promise.resolve(t.getProfile(`/profile/${r}`)).then(function(r){return r.ok?r.json():Promise.resolve(r.json()).then(function(r){throw e.error(f,r),new m(null==r?void 0:r.description)})})})}catch(e){return Promise.reject(e)}}getTrades(r){try{const t=this,{owner:n,limit:o,offset:i}=r,s=p({owner:n,limit:o,offset:i});return Promise.resolve(t.context.chainId).then(function(r){return e.debug(f,"[util:operator] Get trades for",r,n,{limit:o,offset:i}),q(function(){return Promise.resolve(t.get(`/trades${s}`)).then(function(e){return e.ok?e.json():Promise.resolve(e.json()).then(function(e){throw new j(e)})})},function(r){if(e.error(f,"Error getting trades:",r),r instanceof j)throw r;throw new m("Error getting trades: "+r)})})}catch(e){return Promise.reject(e)}}getOrders(r){try{const t=this,{owner:n,limit:o=1e3,offset:i=0}=r,s=p({limit:o,offset:i});return Promise.resolve(t.context.chainId).then(function(r){return e.debug(f,`[api:${t.API_NAME}] Get orders for `,r,n,o,i),q(function(){return Promise.resolve(t.get(`/account/${n}/orders/${s}`)).then(function(e){return e.ok?e.json():Promise.resolve(e.json()).then(function(e){throw new j(e)})})},function(r){if(e.error(f,"Error getting orders information:",r),r instanceof j)throw r;throw new j(Y)})})}catch(e){return Promise.reject(e)}}getTxOrders(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(n){return e.debug(`[api:${t.API_NAME}] Get tx orders for `,n,r),q(function(){return Promise.resolve(t.get(`/transactions/${r}/orders`)).then(function(e){return e.ok?e.json():Promise.resolve(e.json()).then(function(e){throw new j(e)})})},function(r){if(e.error("Error getting transaction orders information:",r),r instanceof j)throw r;throw new j(Y)})})}catch(e){return Promise.reject(e)}}getOrder(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(n){return e.debug(f,`[api:${t.API_NAME}] Get order for `,n,r),q(function(){return Promise.resolve(t.get(`/orders/${r}`)).then(function(e){return e.ok?e.json():Promise.resolve(e.json()).then(function(e){throw new j(e)})})},function(r){if(e.error(f,"Error getting order information:",r),r instanceof j)throw r;throw new j(Y)})})}catch(e){return Promise.reject(e)}}getPriceQuoteLegacy(r){try{const t=this,{baseToken:n,quoteToken:o,amount:i,kind:s}=r;return Promise.resolve(t.context.chainId).then(function(a){return e.debug(f,`[api:${t.API_NAME}] Get price from API`,r,"for",a),Promise.resolve(t.get(`/markets/${M(n,a)}-${M(o,a)}/${s}/${i}`).catch(r=>{throw e.error(f,"Error getting price quote:",r),new V(K)})).then(G)})}catch(e){return Promise.reject(e)}}getQuote(e){try{const r=this;return Promise.resolve(r.context.chainId).then(function(t){const n=r.mapNewToLegacyParams(e,t);return Promise.resolve(r.post("/quote",n)).then(G)})}catch(e){return Promise.reject(e)}}sendSignedOrderCancellation(r){try{const t=this,{cancellation:n,owner:o}=r;return Promise.resolve(t.context.chainId).then(function(r){return e.debug(f,`[api:${t.API_NAME}] Delete signed order for network`,r,n),Promise.resolve(t.delete(`/orders/${n.orderUid}`,{signature:n.signature,signingScheme:U(n.signingScheme),from:o})).then(function(o){function i(o){e.debug(f,`[api:${t.API_NAME}] Cancelled order`,n.orderUid,r)}const s=function(){if(!o.ok)return Promise.resolve(j.getErrorFromStatusCode(o,"delete")).then(function(e){throw new m(e)})}();return s&&s.then?s.then(i):i()})})}catch(e){return Promise.reject(e)}}sendOrder(r){try{const t=this,n={...r.order,appData:t.context.appDataHash};return Promise.resolve(t.context.chainId).then(function(o){const{owner:i}=r;return e.debug(f,`[api:${t.API_NAME}] Post signed order for network`,o,n),Promise.resolve(t.post("/orders",{...n,signingScheme:U(n.signingScheme),from:i})).then(function(r){function n(n){return Promise.resolve(r.json()).then(function(r){return e.debug(f,`[api:${t.API_NAME}] Success posting the signed order`,r),r})}const o=function(){if(!r.ok)return Promise.resolve(j.getErrorFromStatusCode(r,"create")).then(function(e){throw new m(e)})}();return o&&o.then?o.then(n):n()})})}catch(e){return Promise.reject(e)}}getOrderLink(e){return this.getApiBaseUrl()+`/orders/${e}`}mapNewToLegacyParams(e,r){const{amount:t,kind:n,userAddress:o,receiver:i,validTo:s,sellToken:a,buyToken:u}=e,d=o||"0x0000000000000000000000000000000000000000",l={sellToken:M(a,r),buyToken:M(u,r),from:d,receiver:i||d,appData:this.context.appDataHash,validTo:s,partiallyFillable:!1};return n===c.SELL?{kind:c.SELL,sellAmountBeforeFee:t,...l}:{kind:c.BUY,buyAmountAfterFee:t,...l}}getApiBaseUrl(){try{const e=this;return Promise.resolve(e.context.chainId).then(function(r){const t=e.API_BASE_URL[r];if(t)return t+"/v1";throw new m(`Unsupported Network. The ${e.API_NAME} API is not deployed in the Network `+r)})}catch(e){return Promise.reject(e)}}getProfileApiBaseUrl(){try{const e=this;return Promise.resolve(e.context.chainId).then(function(r){const t=e.PROFILE_API_BASE_URL[r];if(t)return t+"/v1";throw new m(`Unsupported Network. The ${e.API_NAME} API is not deployed in the Network `+r)})}catch(e){return Promise.reject(e)}}fetch(e,t,n){try{const o=this;return Promise.resolve(o.getApiBaseUrl()).then(function(i){return r(i+e,{headers:o.DEFAULT_HEADERS,method:t,body:void 0!==n?JSON.stringify(n):n})})}catch(e){return Promise.reject(e)}}fetchProfile(e,t,n){try{const o=this;return Promise.resolve(o.getProfileApiBaseUrl()).then(function(i){return r(i+e,{headers:o.DEFAULT_HEADERS,method:t,body:void 0!==n?JSON.stringify(n):n})})}catch(e){return Promise.reject(e)}}post(e,r){return this.fetch(e,"POST",r)}get(e){return this.fetch(e,"GET")}getProfile(e){return this.fetchProfile(e,"GET")}delete(e,r){return this.fetch(e,"DELETE",r)}}const W=d`
|
|
2
2
|
query Totals {
|
|
3
3
|
totals {
|
|
4
4
|
tokens
|
|
@@ -25,5 +25,5 @@ import e from"loglevel";import r from"cross-fetch";import{SigningScheme as t,Int
|
|
|
25
25
|
volumeUsd
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
`,z={[g.MAINNET]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow",[g.RINKEBY]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow-rinkeby",[g.GNOSIS_CHAIN]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow-gc"};class X{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{[g.MAINNET]:new l(z[g.MAINNET],{fetch:r}),[g.RINKEBY]:new l(z[g.RINKEBY],{fetch:r}),[g.GNOSIS_CHAIN]:new l(z[g.GNOSIS_CHAIN],{fetch:r})}}getBaseUrl(){try{return Promise.resolve(this.context.chainId).then(function(e){return z[e]})}catch(e){return Promise.reject(e)}}getTotals(){try{const r=this;return Promise.resolve(r.context.chainId).then(function(t){return e.debug(`[subgraph:${r.API_NAME}] Get totals for:`,t),Promise.resolve(r.runQuery(W)).then(function(e){return e.totals[0]})})}catch(e){return Promise.reject(e)}}getLastDaysVolume(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(o){return e.debug(`[subgraph:${t.API_NAME}] Get last ${r} days volume for:`,o),t.runQuery(J,{days:r})})}catch(e){return Promise.reject(e)}}getLastHoursVolume(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(o){return e.debug(`[subgraph:${t.API_NAME}] Get last ${r} hours volume for:`,o),t.runQuery(Z,{hours:r})})}catch(e){return Promise.reject(e)}}runQuery(r,t){try{const o=this;return Promise.resolve(function(e,n){try{var i=Promise.resolve(o.context.chainId).then(function(e){return Promise.resolve(o.clients[e].request(r,t))})}catch(e){return n(e)}return i&&i.then?i.then(void 0,n):i}(0,function(n){return e.error(n),Promise.resolve(o.getBaseUrl()).then(function(e){throw new m(`Error running query: ${r}. Variables: ${JSON.stringify(t)}. API: ${e}. Inner Error: ${n}`)})}))}catch(e){return Promise.reject(e)}}}const ee=function(e){return Promise.resolve(te()).then(function({ajv:r,validate:t}){return{result:!!t(e),errors:r.errors?r.errorsText(r.errors):void 0}})},re=function(e){try{const r=1,t=112,o=18,n=32,i=function(e){const r=e.match(/.{1,2}/g);if(r)return new Uint8Array(r.map(e=>parseInt(e,16)))}(e.replace(/(^0x)/,""));if(!i)return Promise.resolve();const s=Uint8Array.from([r,t,o,n,...i]);return Promise.resolve(import("multiformats/cid")).then(function({CID:e}){return e.decode(s).toV0().toString()})}catch(e){return Promise.reject(e)}},te=function(){try{function e(){return{ajv:ne,validate:oe}}ne||(ne=new h);const r=function(){if(!oe)return Promise.resolve(import("./appData.schema-0c8db23b.js")).then(function(e){oe=ne.compile(e)})}();return Promise.resolve(r&&r.then?r.then(e):e())}catch(t){return Promise.reject(t)}};let oe,ne;function ie(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}class se{constructor(e){this.context=void 0,this.context=e}generateAppDataDoc(e={},r="CowSwap"){return{version:"0.2.0",appCode:r,metadata:{...e}}}decodeAppData(r){try{return Promise.resolve(ie(function(){return Promise.resolve(re(r)).then(function(e){if(!e)throw new m("Error getting serialized CID");return function(e,r="https://gnosis.mypinata.cloud/ipfs"){try{return Promise.resolve(import("cross-fetch")).then(function({default:t}){return Promise.resolve(t(`${r}/${e}`)).then(function(e){return Promise.resolve(e.json())})})}catch(e){return Promise.reject(e)}}(e)})},function(r){const t=r;throw e.error("Error decoding AppData:",t),new m("Error decoding AppData: "+t.message)}))}catch(e){return Promise.reject(e)}}cidToAppDataHex(e){try{return Promise.resolve(import("multiformats/cid")).then(function({CID:r}){const{digest:t}=r.parse(e).multihash;return`0x${Buffer.from(t).toString("hex")}`})}catch(e){return Promise.reject(e)}}appDataHexToCid(e){try{return Promise.resolve(re(e)).then(function(e){if(!e)throw new m("Error getting serialized CID");return e})}catch(e){return Promise.reject(e)}}calculateAppDataHash(e){try{const r=this;return Promise.resolve(ee(e)).then(function(t){if(null==t||!t.result)throw new m("Invalid appData provided",null==t?void 0:t.errors);return ie(function(){return Promise.resolve(function(e){try{const r=JSON.stringify(e);return Promise.resolve(import("ipfs-only-hash")).then(function({of:e}){return e(r,{cidVersion:0})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){return Promise.resolve(r.cidToAppDataHex(e)).then(function(r){if(!r)throw new m(`Could not extract appDataHash from calculated cidV0 ${e}`);return{cidV0:e,appDataHash:r}})})},function(e){throw new m("Failed to calculate appDataHash",e.message)})})}catch(e){return Promise.reject(e)}}uploadMetadataDocToIpfs(e){try{const r=this;return Promise.resolve(function(e,{uri:r,pinataApiKey:t="",pinataApiSecret:o=""}){try{return Promise.resolve(import("cross-fetch")).then(function({default:n}){if(!t||!o)throw new m("You need to pass IPFS api credentials.");const i=JSON.stringify({pinataContent:e,pinataMetadata:{name:"appData-affiliate"}});return Promise.resolve(n(`${r}/pinning/pinJSONToIPFS`,{method:"POST",body:i,headers:{"Content-Type":"application/json",pinata_api_key:t,pinata_secret_api_key:o}})).then(function(e){return Promise.resolve(e.json()).then(function(r){if(200!==e.status)throw new Error(r.error.details||r.error);return r})})})}catch(e){return Promise.reject(e)}}(e,r.context.ipfs)).then(function({IpfsHash:e}){return r.cidToAppDataHex(e)})}catch(e){return Promise.reject(e)}}}var ae=0;function ce(e){return"__private_"+ae+++"_"+e}function ue(e,r){if(!Object.prototype.hasOwnProperty.call(e,r))throw new TypeError("attempted to use private field on non-instance");return e}const de={appDataHash:"0x0000000000000000000000000000000000000000000000000000000000000000",isDevEnvironment:!1,ipfs:{uri:"https://gnosis.mypinata.cloud/ipfs",apiKey:void 0,apiSecret:void 0}};var le,he,me,pe,fe,ge,Te,Ee,ve,ye,Pe,Ae,Ie,we,Ne,ke,De,Oe,_e=/*#__PURE__*/ce("context"),Se=/*#__PURE__*/ce("chainId");class Ue{constructor(e,r){Object.defineProperty(this,_e,{writable:!0,value:void 0}),Object.defineProperty(this,Se,{writable:!0,value:void 0}),ue(this,Se)[Se]=this.updateChainId(e),ue(this,_e)[_e]={...de,...r}}updateChainId(r){if(!g[r])throw new m(`Invalid chainId: ${r}`);return e.debug(f,`Updating chainId to: ${r}`),ue(this,Se)[Se]=r,r}get chainId(){const r=this;var t;const o=null==(t=ue(this,_e)[_e].signer)?void 0:t.provider;return o?(e.debug(f,"Getting chainId from provider"),function(){try{return Promise.resolve(o.getNetwork()).then(function(t){const o=t.chainId;return o!==ue(r,Se)[Se]&&(e.debug(f,`ChainId mismatch: Provider's chainId: ${o} vs Context's chainId: ${ue(r,Se)[Se]}. Updating Context's chainId`),r.updateChainId(o)),o})}catch(e){return Promise.reject(e)}}()):Promise.resolve(ue(this,Se)[Se])}get appDataHash(){var e;return null!==(e=ue(this,_e)[_e].appDataHash)&&void 0!==e?e:de.appDataHash}get isDevEnvironment(){var e;return null!==(e=ue(this,_e)[_e].isDevEnvironment)&&void 0!==e?e:de.isDevEnvironment}get signer(){return ue(this,_e)[_e].signer}get ipfs(){var e;return null!==(e=ue(this,_e)[_e].ipfs)&&void 0!==e?e:de.ipfs}}class be{constructor(r,t={},o={}){this.context=void 0,this.cowApi=void 0,this.metadataApi=void 0,this.cowSubgraphApi=void 0,this.updateChainId=e=>{this.context.updateChainId(e)},this.validateAppDataDocument=ee,this.context=new Ue(r,{...t}),this.cowApi=new Q(this.context),this.cowSubgraphApi=new X(this.context),this.metadataApi=new se(this.context),e.setLevel(o.loglevel||"error")}signOrder(e){try{const r=this,t=r._checkSigner();return Promise.resolve(r.context.chainId).then(function(o){return function(e,r,t){return y({order:e,chainId:r},A,t)}({...e,appData:r.context.appDataHash},o,t)})}catch(e){return Promise.reject(e)}}signOrderCancellation(e){try{const r=this,t=r._checkSigner();return Promise.resolve(r.context.chainId).then(function(r){return function(e,r,t){return y({orderId:e,chainId:r},P,t)}(e,r,t)})}catch(e){return Promise.reject(e)}}_checkSigner(e=this.context.signer){if(!e)throw new m("No signer available");return e}}!function(e){e.EthPriceUsd="ethPriceUSD",e.Id="id"}(le||(le={})),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"}(he||(he={})),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"}(me||(me={})),function(e){e.Asc="asc",e.Desc="desc"}(pe||(pe={})),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"}(fe||(fe={})),function(e){e.Id="id",e.Timestamp="timestamp",e.Token0="token0",e.Token1="token1",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(ge||(ge={})),function(e){e.Id="id",e.Timestamp="timestamp",e.Token0="token0",e.Token1="token1",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(Te||(Te={})),function(e){e.Id="id",e.Token0="token0",e.Token1="token1",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(Ee||(Ee={})),function(e){e.FirstTradeTimestamp="firstTradeTimestamp",e.Id="id",e.Solver="solver",e.Trades="trades",e.TxHash="txHash"}(ve||(ve={})),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"}(ye||(ye={})),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"}(Pe||(Pe={})),function(e){e.AmountEth="amountEth",e.AmountUsd="amountUsd",e.Id="id",e.Timestamp="timestamp",e.Token="token",e.Trade="trade"}(Ae||(Ae={})),function(e){e.Address="address",e.AllowedPools="allowedPools",e.Decimals="decimals",e.FirstTradeTimestamp="firstTradeTimestamp",e.History="history",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"}(Ie||(Ie={})),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"}(we||(we={})),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"}(Ne||(Ne={})),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"}(ke||(ke={})),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"}(De||(De={})),function(e){e.Allow="allow",e.Deny="deny"}(Oe||(Oe={}));var Re={__proto__:null,get Bundle_OrderBy(){return le},get DailyTotal_OrderBy(){return he},get HourlyTotal_OrderBy(){return me},get OrderDirection(){return pe},get Order_OrderBy(){return fe},get PairDaily_OrderBy(){return ge},get PairHourly_OrderBy(){return Te},get Pair_OrderBy(){return Ee},get Settlement_OrderBy(){return ve},get TokenDailyTotal_OrderBy(){return ye},get TokenHourlyTotal_OrderBy(){return Pe},get TokenTradingEvent_OrderBy(){return Ae},get Token_OrderBy(){return Ie},get Total_OrderBy(){return we},get Trade_OrderBy(){return Ne},get UniswapPool_OrderBy(){return ke},get User_OrderBy(){return De},get _SubgraphErrorPolicy_(){return Oe}};export{T as ALL_SUPPORTED_CHAIN_IDS,m as CowError,be as CowSdk,Re as GraphQL,g as SupportedChainId,F as Token};
|
|
28
|
+
`,z={[g.MAINNET]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow",[g.RINKEBY]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow-rinkeby",[g.GNOSIS_CHAIN]:"https://api.thegraph.com/subgraphs/name/cowprotocol/cow-gc"};class X{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{[g.MAINNET]:new l(z[g.MAINNET],{fetch:r}),[g.RINKEBY]:new l(z[g.RINKEBY],{fetch:r}),[g.GNOSIS_CHAIN]:new l(z[g.GNOSIS_CHAIN],{fetch:r})}}getBaseUrl(){try{return Promise.resolve(this.context.chainId).then(function(e){return z[e]})}catch(e){return Promise.reject(e)}}getTotals(){try{const r=this;return Promise.resolve(r.context.chainId).then(function(t){return e.debug(`[subgraph:${r.API_NAME}] Get totals for:`,t),Promise.resolve(r.runQuery(W)).then(function(e){return e.totals[0]})})}catch(e){return Promise.reject(e)}}getLastDaysVolume(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(n){return e.debug(`[subgraph:${t.API_NAME}] Get last ${r} days volume for:`,n),t.runQuery(J,{days:r})})}catch(e){return Promise.reject(e)}}getLastHoursVolume(r){try{const t=this;return Promise.resolve(t.context.chainId).then(function(n){return e.debug(`[subgraph:${t.API_NAME}] Get last ${r} hours volume for:`,n),t.runQuery(Z,{hours:r})})}catch(e){return Promise.reject(e)}}runQuery(r,t){try{const n=this;return Promise.resolve(function(e,o){try{var i=Promise.resolve(n.context.chainId).then(function(e){return Promise.resolve(n.clients[e].request(r,t))})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(o){return e.error(o),Promise.resolve(n.getBaseUrl()).then(function(e){throw new m(`Error running query: ${r}. Variables: ${JSON.stringify(t)}. API: ${e}. Inner Error: ${o}`)})}))}catch(e){return Promise.reject(e)}}}const ee=function(e){return Promise.resolve(te()).then(function({ajv:r,validate:t}){return{result:!!t(e),errors:r.errors?r.errorsText(r.errors):void 0}})},re=function(e){try{const r=1,t=112,n=18,o=32,i=function(e){const r=e.match(/.{1,2}/g);if(r)return new Uint8Array(r.map(e=>parseInt(e,16)))}(e.replace(/(^0x)/,""));if(!i)return Promise.resolve();const s=Uint8Array.from([r,t,n,o,...i]);return Promise.resolve(import("multiformats/cid")).then(function({CID:e}){return e.decode(s).toV0().toString()})}catch(e){return Promise.reject(e)}},te=function(){try{function e(){return{ajv:oe,validate:ne}}oe||(oe=new h);const r=function(){if(!ne)return Promise.resolve(import("./appData.schema-adfc1c6f.js")).then(function(e){ne=oe.compile(e)})}();return Promise.resolve(r&&r.then?r.then(e):e())}catch(t){return Promise.reject(t)}};let ne,oe;function ie(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}const se="CowSwap";class ae{constructor(e){this.context=void 0,this.context=e}generateAppDataDoc(e={},r){const{appCode:t=se,environment:n}=r||{};return{version:"0.3.0",appCode:t,environment:n,metadata:{...e}}}decodeAppData(r){try{return Promise.resolve(ie(function(){return Promise.resolve(re(r)).then(function(e){if(!e)throw new m("Error getting serialized CID");return function(e,r="https://gnosis.mypinata.cloud/ipfs"){try{return Promise.resolve(import("cross-fetch")).then(function({default:t}){return Promise.resolve(t(`${r}/${e}`)).then(function(e){return Promise.resolve(e.json())})})}catch(e){return Promise.reject(e)}}(e)})},function(r){const t=r;throw e.error("Error decoding AppData:",t),new m("Error decoding AppData: "+t.message)}))}catch(e){return Promise.reject(e)}}cidToAppDataHex(e){try{return Promise.resolve(import("multiformats/cid")).then(function({CID:r}){const{digest:t}=r.parse(e).multihash;return`0x${Buffer.from(t).toString("hex")}`})}catch(e){return Promise.reject(e)}}appDataHexToCid(e){try{return Promise.resolve(re(e)).then(function(e){if(!e)throw new m("Error getting serialized CID");return e})}catch(e){return Promise.reject(e)}}calculateAppDataHash(e){try{const r=this;return Promise.resolve(ee(e)).then(function(t){if(null==t||!t.result)throw new m("Invalid appData provided",null==t?void 0:t.errors);return ie(function(){return Promise.resolve(function(e){try{const r=JSON.stringify(e);return Promise.resolve(import("ipfs-only-hash")).then(function({of:e}){return e(r,{cidVersion:0})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){return Promise.resolve(r.cidToAppDataHex(e)).then(function(r){if(!r)throw new m(`Could not extract appDataHash from calculated cidV0 ${e}`);return{cidV0:e,appDataHash:r}})})},function(e){throw new m("Failed to calculate appDataHash",e.message)})})}catch(e){return Promise.reject(e)}}uploadMetadataDocToIpfs(e){try{const r=this;return Promise.resolve(function(e,{writeUri:r="https://api.pinata.cloud",pinataApiKey:t="",pinataApiSecret:n=""}){try{return Promise.resolve(import("cross-fetch")).then(function({default:o}){if(!t||!n)throw new m("You need to pass IPFS api credentials.");const i=JSON.stringify({pinataContent:e,pinataMetadata:{name:"appData"}});return Promise.resolve(o(`${r}/pinning/pinJSONToIPFS`,{method:"POST",body:i,headers:{"Content-Type":"application/json",pinata_api_key:t,pinata_secret_api_key:n}})).then(function(e){return Promise.resolve(e.json()).then(function(r){if(200!==e.status)throw new Error(r.error.details||r.error);return r})})})}catch(e){return Promise.reject(e)}}(e,r.context.ipfs)).then(function({IpfsHash:e}){return r.cidToAppDataHex(e)})}catch(e){return Promise.reject(e)}}}var ce=0;function ue(e){return"__private_"+ce+++"_"+e}function de(e,r){if(!Object.prototype.hasOwnProperty.call(e,r))throw new TypeError("attempted to use private field on non-instance");return e}const le={appDataHash:"0x0000000000000000000000000000000000000000000000000000000000000000",isDevEnvironment:!1,ipfs:{readUri:"https://gnosis.mypinata.cloud/ipfs",writeUri:"https://api.pinata.cloud",apiKey:void 0,apiSecret:void 0}};var he,me,pe,fe,ge,Te,Ee,ve,ye,Pe,Ae,Ie,we,Ne,ke,De,Oe,_e,Se,Ue=/*#__PURE__*/ue("context"),be=/*#__PURE__*/ue("chainId");class Re{constructor(e,r){Object.defineProperty(this,Ue,{writable:!0,value:void 0}),Object.defineProperty(this,be,{writable:!0,value:void 0}),de(this,be)[be]=this.updateChainId(e),de(this,Ue)[Ue]={...le,...r,ipfs:{...le.ipfs,...r.ipfs}}}updateChainId(r){if(!g[r])throw new m(`Invalid chainId: ${r}`);return e.debug(f,`Updating chainId to: ${r}`),de(this,be)[be]=r,r}get chainId(){const r=this;var t;const n=null==(t=de(this,Ue)[Ue].signer)?void 0:t.provider;return n?(e.debug(f,"Getting chainId from provider"),function(){try{return Promise.resolve(n.getNetwork()).then(function(t){const n=t.chainId;return n!==de(r,be)[be]&&(e.debug(f,`ChainId mismatch: Provider's chainId: ${n} vs Context's chainId: ${de(r,be)[be]}. Updating Context's chainId`),r.updateChainId(n)),n})}catch(e){return Promise.reject(e)}}()):Promise.resolve(de(this,be)[be])}get appDataHash(){var e;return null!==(e=de(this,Ue)[Ue].appDataHash)&&void 0!==e?e:le.appDataHash}get isDevEnvironment(){var e;return null!==(e=de(this,Ue)[Ue].isDevEnvironment)&&void 0!==e?e:le.isDevEnvironment}get signer(){return de(this,Ue)[Ue].signer}get ipfs(){var e;return null!==(e=de(this,Ue)[Ue].ipfs)&&void 0!==e?e:le.ipfs}}class xe{constructor(r,t={},n={}){this.context=void 0,this.cowApi=void 0,this.metadataApi=void 0,this.cowSubgraphApi=void 0,this.updateChainId=e=>{this.context.updateChainId(e)},this.validateAppDataDocument=ee,this.context=new Re(r,{...t}),this.cowApi=new Q(this.context),this.cowSubgraphApi=new X(this.context),this.metadataApi=new ae(this.context),e.setLevel(n.loglevel||"error")}signOrder(e){try{const r=this,t=r._checkSigner();return Promise.resolve(r.context.chainId).then(function(n){return function(e,r,t){return y({order:e,chainId:r},A,t)}({...e,appData:r.context.appDataHash},n,t)})}catch(e){return Promise.reject(e)}}signOrderCancellation(e){try{const r=this,t=r._checkSigner();return Promise.resolve(r.context.chainId).then(function(r){return function(e,r,t){return y({orderId:e,chainId:r},P,t)}(e,r,t)})}catch(e){return Promise.reject(e)}}_checkSigner(e=this.context.signer){if(!e)throw new m("No signer available");return e}}!function(e){e.EthPriceUsd="ethPriceUSD",e.Id="id"}(he||(he={})),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"}(me||(me={})),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.Asc="asc",e.Desc="desc"}(fe||(fe={})),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"}(ge||(ge={})),function(e){e.Id="id",e.Timestamp="timestamp",e.Token0="token0",e.Token1="token1",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(Te||(Te={})),function(e){e.Id="id",e.Timestamp="timestamp",e.Token0="token0",e.Token1="token1",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(Ee||(Ee={})),function(e){e.Id="id",e.Token0="token0",e.Token1="token1",e.VolumeToken0="volumeToken0",e.VolumeToken1="volumeToken1",e.VolumeTradedEth="volumeTradedEth",e.VolumeTradedUsd="volumeTradedUsd"}(ve||(ve={})),function(e){e.FirstTradeTimestamp="firstTradeTimestamp",e.Id="id",e.Solver="solver",e.Trades="trades",e.TxHash="txHash"}(ye||(ye={})),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"}(Pe||(Pe={})),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"}(Ae||(Ae={})),function(e){e.AmountEth="amountEth",e.AmountUsd="amountUsd",e.Id="id",e.Timestamp="timestamp",e.Token="token",e.Trade="trade"}(Ie||(Ie={})),function(e){e.Address="address",e.Decimals="decimals",e.FirstTradeTimestamp="firstTradeTimestamp",e.History="history",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"}(we||(we={})),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"}(Ne||(Ne={})),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"}(ke||(ke={})),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"}(De||(De={})),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"}(Oe||(Oe={})),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"}(_e||(_e={})),function(e){e.Allow="allow",e.Deny="deny"}(Se||(Se={}));var Ce={__proto__:null,get Bundle_OrderBy(){return he},get DailyTotal_OrderBy(){return me},get HourlyTotal_OrderBy(){return pe},get OrderDirection(){return fe},get Order_OrderBy(){return ge},get PairDaily_OrderBy(){return Te},get PairHourly_OrderBy(){return Ee},get Pair_OrderBy(){return ve},get Settlement_OrderBy(){return ye},get TokenDailyTotal_OrderBy(){return Pe},get TokenHourlyTotal_OrderBy(){return Ae},get TokenTradingEvent_OrderBy(){return Ie},get Token_OrderBy(){return we},get Total_OrderBy(){return Ne},get Trade_OrderBy(){return ke},get UniswapPool_OrderBy(){return De},get UniswapToken_OrderBy(){return Oe},get User_OrderBy(){return _e},get _SubgraphErrorPolicy_(){return Se}};export{T as ALL_SUPPORTED_CHAIN_IDS,m as CowError,xe as CowSdk,Ce as GraphQL,g as SupportedChainId,F as Token};
|
|
29
29
|
//# sourceMappingURL=index.module.js.map
|