@cowprotocol/cow-sdk 2.0.3 → 2.0.4
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/README.md +66 -0
- package/dist/README.md +66 -0
- package/dist/common/configs.d.ts +6 -0
- package/dist/index-c1597896.js +29 -0
- package/dist/index-c1597896.js.map +1 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.module.js +4 -4
- package/dist/index.module.js.map +1 -1
- package/dist/order-book/api.d.ts +10 -10
- package/dist/order-book/generated/index.d.ts +0 -7
- package/dist/order-book/index.d.ts +1 -0
- package/dist/order-book/request.d.ts +16 -0
- package/dist/package.json +5 -3
- package/dist/utils-18730a84.js +2 -0
- package/dist/{utils-68e76765.js.map → utils-18730a84.js.map} +1 -1
- package/dist/utils-471122e4.js +2 -0
- package/dist/{utils-f5939feb.js.map → utils-471122e4.js.map} +1 -1
- package/dist/utils-ee84e76e.js +2 -0
- package/dist/{utils-0f9d3673.js.map → utils-ee84e76e.js.map} +1 -1
- package/package.json +5 -3
- package/dist/index-5cf8c805.js +0 -29
- package/dist/index-5cf8c805.js.map +0 -1
- package/dist/order-book/generated/OrderBookClient.d.ts +0 -10
- package/dist/order-book/generated/core/ApiError.d.ts +0 -10
- package/dist/order-book/generated/core/ApiRequestOptions.d.ts +0 -13
- package/dist/order-book/generated/core/ApiResult.d.ts +0 -7
- package/dist/order-book/generated/core/BaseHttpRequest.d.ts +0 -8
- package/dist/order-book/generated/core/CancelablePromise.d.ts +0 -26
- package/dist/order-book/generated/core/FetchHttpRequest.d.ts +0 -14
- package/dist/order-book/generated/core/OpenAPI.d.ts +0 -16
- package/dist/order-book/generated/core/request.d.ts +0 -13
- package/dist/order-book/generated/services/DefaultService.d.ts +0 -164
- package/dist/utils-0f9d3673.js +0 -2
- package/dist/utils-68e76765.js +0 -2
- package/dist/utils-f5939feb.js +0 -2
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import type { Address } from '../models/Address';
|
|
2
|
-
import type { Auction } from '../models/Auction';
|
|
3
|
-
import type { NativePriceResponse } from '../models/NativePriceResponse';
|
|
4
|
-
import type { Order } from '../models/Order';
|
|
5
|
-
import type { OrderCancellation } from '../models/OrderCancellation';
|
|
6
|
-
import type { OrderCancellations } from '../models/OrderCancellations';
|
|
7
|
-
import type { OrderCreation } from '../models/OrderCreation';
|
|
8
|
-
import type { OrderQuoteRequest } from '../models/OrderQuoteRequest';
|
|
9
|
-
import type { OrderQuoteResponse } from '../models/OrderQuoteResponse';
|
|
10
|
-
import type { SolverCompetitionResponse } from '../models/SolverCompetitionResponse';
|
|
11
|
-
import type { Trade } from '../models/Trade';
|
|
12
|
-
import type { TransactionHash } from '../models/TransactionHash';
|
|
13
|
-
import type { UID } from '../models/UID';
|
|
14
|
-
import type { VersionResponse } from '../models/VersionResponse';
|
|
15
|
-
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
16
|
-
import type { BaseHttpRequest } from '../core/BaseHttpRequest';
|
|
17
|
-
export declare class DefaultService {
|
|
18
|
-
readonly httpRequest: BaseHttpRequest;
|
|
19
|
-
constructor(httpRequest: BaseHttpRequest);
|
|
20
|
-
/**
|
|
21
|
-
* Create a new order.
|
|
22
|
-
* @param requestBody The order to create.
|
|
23
|
-
* @returns UID Order has been accepted.
|
|
24
|
-
* @throws ApiError
|
|
25
|
-
*/
|
|
26
|
-
postApiV1Orders(requestBody: OrderCreation): CancelablePromise<UID>;
|
|
27
|
-
/**
|
|
28
|
-
* Cancels multiple orders by marking them invalid with a timestamp.
|
|
29
|
-
* This is a best effort cancellation, and might not prevent solvers from
|
|
30
|
-
* settling the orders (if the order is part of an in-flight settlement
|
|
31
|
-
* transaction for example). Authentication must be provided by an EIP-712
|
|
32
|
-
* signature of an "OrderCacellations(bytes[] orderUids)" message.
|
|
33
|
-
*
|
|
34
|
-
* @param requestBody Signed OrderCancellations
|
|
35
|
-
* @returns any Orders deleted
|
|
36
|
-
* @throws ApiError
|
|
37
|
-
*/
|
|
38
|
-
deleteApiV1Orders(requestBody: OrderCancellations): CancelablePromise<any>;
|
|
39
|
-
/**
|
|
40
|
-
* Get existing order from UID.
|
|
41
|
-
* @param uid
|
|
42
|
-
* @returns Order Order
|
|
43
|
-
* @throws ApiError
|
|
44
|
-
*/
|
|
45
|
-
getApiV1Orders(uid: UID): CancelablePromise<Order>;
|
|
46
|
-
/**
|
|
47
|
-
* @deprecated
|
|
48
|
-
* Cancels order by marking it invalid with a timestamp.
|
|
49
|
-
* The successful deletion might not prevent solvers from settling the order.
|
|
50
|
-
* Authentication must be provided by providing an EIP-712 signature of an
|
|
51
|
-
* "OrderCacellation(bytes orderUids)" message.
|
|
52
|
-
*
|
|
53
|
-
* @param uid
|
|
54
|
-
* @param requestBody Signed OrderCancellation
|
|
55
|
-
* @returns any Order deleted
|
|
56
|
-
* @throws ApiError
|
|
57
|
-
*/
|
|
58
|
-
deleteApiV1Orders1(uid: UID, requestBody: OrderCancellation): CancelablePromise<any>;
|
|
59
|
-
/**
|
|
60
|
-
* Cancels order and replaces it with a new one
|
|
61
|
-
* Cancel an order by providing a replacement order where the app data field
|
|
62
|
-
* is the EIP-712-struct-hash of a cancellation for the original order. This
|
|
63
|
-
* allows an old order to be cancelled AND a new order to be created in an
|
|
64
|
-
* atomic operation with a single signature. This may be useful for replacing
|
|
65
|
-
* orders when on-chain prices move outside of the original order's limit price.
|
|
66
|
-
*
|
|
67
|
-
* @param uid
|
|
68
|
-
* @param requestBody replacement order
|
|
69
|
-
* @returns UID Previous order was cancelled and the new replacement order was created.
|
|
70
|
-
* @throws ApiError
|
|
71
|
-
*/
|
|
72
|
-
patchApiV1Orders(uid: UID, requestBody: OrderCreation): CancelablePromise<UID>;
|
|
73
|
-
/**
|
|
74
|
-
* Get orders by settlement transaction hash.
|
|
75
|
-
* @param txHash
|
|
76
|
-
* @returns Order Order
|
|
77
|
-
* @throws ApiError
|
|
78
|
-
*/
|
|
79
|
-
getApiV1TransactionsOrders(txHash: TransactionHash): CancelablePromise<Array<Order>>;
|
|
80
|
-
/**
|
|
81
|
-
* Get existing Trades.
|
|
82
|
-
* Exactly one of owner or order_uid has to be set.
|
|
83
|
-
*
|
|
84
|
-
* @param owner
|
|
85
|
-
* @param orderUid
|
|
86
|
-
* @returns Trade all trades
|
|
87
|
-
* @throws ApiError
|
|
88
|
-
*/
|
|
89
|
-
getApiV1Trades(owner?: Address, orderUid?: UID): CancelablePromise<Array<Trade>>;
|
|
90
|
-
/**
|
|
91
|
-
* Gets the current batch auction.
|
|
92
|
-
* The current batch auction that solvers should be solving right now. Includes the list of
|
|
93
|
-
* solvable orders, the block on which the batch was created, as well as prices for all tokens
|
|
94
|
-
* being traded (used for objective value computation).
|
|
95
|
-
*
|
|
96
|
-
* @returns Auction the auction
|
|
97
|
-
* @throws ApiError
|
|
98
|
-
*/
|
|
99
|
-
getApiV1Auction(): CancelablePromise<Auction>;
|
|
100
|
-
/**
|
|
101
|
-
* Get orders of one user paginated.
|
|
102
|
-
* The orders are ordered by their creation date descending (newest orders first).
|
|
103
|
-
* To enumerate all orders start with offset 0 and keep increasing the offset by the total
|
|
104
|
-
* number of returned results. When a response contains less than the limit the last page has
|
|
105
|
-
* been reached.
|
|
106
|
-
*
|
|
107
|
-
* @param owner
|
|
108
|
-
* @param offset The pagination offset. Defaults to 0.
|
|
109
|
-
*
|
|
110
|
-
* @param limit The pagination limit. Defaults to 10. Maximum 1000. Minimum 1.
|
|
111
|
-
*
|
|
112
|
-
* @returns Order the orders
|
|
113
|
-
* @throws ApiError
|
|
114
|
-
*/
|
|
115
|
-
getApiV1AccountOrders(owner: Address, offset?: number, limit?: number): CancelablePromise<Array<Order>>;
|
|
116
|
-
/**
|
|
117
|
-
* Get native price for the given token.
|
|
118
|
-
* Price is the exchange rate between the specified token and the network's native currency.
|
|
119
|
-
* It represents the amount of native token atoms needed to buy 1 atom of the specified token.
|
|
120
|
-
*
|
|
121
|
-
* @param token
|
|
122
|
-
* @returns NativePriceResponse the estimated native price
|
|
123
|
-
* @throws ApiError
|
|
124
|
-
*/
|
|
125
|
-
getApiV1TokenNativePrice(token: Address): CancelablePromise<NativePriceResponse>;
|
|
126
|
-
/**
|
|
127
|
-
* Quotes a price and fee for the specified order parameters.
|
|
128
|
-
* This API endpoint accepts a partial order and computes the minimum fee and
|
|
129
|
-
* a price estimate for the order. It returns a full order that can be used
|
|
130
|
-
* directly for signing, and with an included signature, passed directly to
|
|
131
|
-
* the order creation endpoint.
|
|
132
|
-
*
|
|
133
|
-
* @param requestBody The order parameters to compute a quote for.
|
|
134
|
-
* @returns OrderQuoteResponse Quoted order.
|
|
135
|
-
* @throws ApiError
|
|
136
|
-
*/
|
|
137
|
-
postApiV1Quote(requestBody: OrderQuoteRequest): CancelablePromise<OrderQuoteResponse>;
|
|
138
|
-
/**
|
|
139
|
-
* Information about solver competition
|
|
140
|
-
* Returns the competition information by auction id.
|
|
141
|
-
*
|
|
142
|
-
* @param auctionId
|
|
143
|
-
* @returns SolverCompetitionResponse competition info
|
|
144
|
-
* @throws ApiError
|
|
145
|
-
*/
|
|
146
|
-
getApiV1SolverCompetition(auctionId: number): CancelablePromise<SolverCompetitionResponse>;
|
|
147
|
-
/**
|
|
148
|
-
* Information about solver competition
|
|
149
|
-
* Returns the competition information by transaction hash.
|
|
150
|
-
*
|
|
151
|
-
* @param txHash
|
|
152
|
-
* @returns SolverCompetitionResponse competition info
|
|
153
|
-
* @throws ApiError
|
|
154
|
-
*/
|
|
155
|
-
getApiV1SolverCompetitionByTxHash(txHash: TransactionHash): CancelablePromise<SolverCompetitionResponse>;
|
|
156
|
-
/**
|
|
157
|
-
* Information about the current deployed version of the API
|
|
158
|
-
* Returns the git commit hash, branch name and release tag (code: https://github.com/cowprotocol/services).
|
|
159
|
-
*
|
|
160
|
-
* @returns VersionResponse version info
|
|
161
|
-
* @throws ApiError
|
|
162
|
-
*/
|
|
163
|
-
getApiV1Version(): CancelablePromise<VersionResponse>;
|
|
164
|
-
}
|
package/dist/utils-0f9d3673.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{IntChainIdTypedDataV4Signer as e,TypedDataVersionedSigner as t,signOrderCancellations as r,signOrderCancellation as n,signOrder as o,SigningScheme as s,domain as i}from"@cowprotocol/contracts";import{EcdsaSigningScheme as c,CowError as a,COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS as u}from"./index.module.js";import"cross-fetch/polyfill";import"graphql-request";const d=function(e,t,r){return g({orderUids:e,chainId:t},f,r)},h=function(e,t,r){return g({orderId:e,chainId:t},m,r)},l=function(e,t,r){return g({order:e,chainId:t},v,r)},g=function(r,n,o,s="v4"){try{let u;function i(e){if(u)return e;const t=l?.data;return{signature:t?.toString()||"",signingScheme:d}}const d="eth_sign"===s?c.ETHSIGN:c.EIP712;let h,l=null;try{switch(s){case"default":case"v3":h=new t(o);break;case"int_v4":h=new e(o);break;default:h=o}}catch(m){throw console.error("Wallet not supported:",m),new a("Wallet not supported")}const f=function(e,t){try{var o=Promise.resolve(n({...r,signer:h,signingScheme:d})).then(function(e){l=e})}catch(e){return t(e)}return o&&o.then?o.then(void 0,t):o}(0,function(e){if(void 0===(t=e).code&&void 0===t.message)throw console.error(e),e;var t;const i=[w,y].some(t=>[e.message,e.toString()].some(e=>t.test(e)));if(e.code!==I&&!i){if(_.test(e.message)){const e=g(r,n,o,"int_v4");return u=1,e}if(e.code===p){const e=g(r,n,o,"eth_sign");return u=1,e}if(P.test(e.message)){const e=g(r,n,o,"v3");return u=1,e}if(S.test(e.message)){const e=g(r,n,o,"eth_sign");return u=1,e}throw console.error(e),e}switch(s){case"v4":const t=g(r,n,o,"default");return u=1,t;case"default":const s=g(r,n,o,"v3");return u=1,s;case"v3":const i=g(r,n,o,"eth_sign");return u=1,i;default:throw e}});return Promise.resolve(f&&f.then?f.then(i):i(f))}catch(v){return Promise.reject(v)}},f=function(e){try{const{chainId:t,signer:n,signingScheme:o,orderUids:s}=e,i=j(t);return Promise.resolve(r(i,s,n,E[o]))}catch(e){return Promise.reject(e)}},m=function(e){try{const{chainId:t,signer:r,signingScheme:o,orderId:s}=e,i=j(t);return Promise.resolve(n(i,s,r,E[o]))}catch(e){return Promise.reject(e)}},v=function(e){try{const{chainId:t,signer:r,order:n,signingScheme:s}=e,i=j(t);return Promise.resolve(o(i,n,r,E[s]))}catch(e){return Promise.reject(e)}},p=-32603,I=-32601,w=/Method not found/i,P=/eth_signTypedData_v4 does not exist/i,S=/eth_signTypedData_v3 does not exist/i,y=/RPC request failed/i,_=/provided chainid .* must match the active chainid/i,E={[c.EIP712]:s.EIP712,[c.ETHSIGN]:s.ETHSIGN};function j(e){const t=u[e];if(!t)throw new a("Unsupported network. Settlement contract is not deployed");return i(e,t)}export{j as getDomain,l as signOrder,h as signOrderCancellation,d as signOrderCancellations};
|
|
2
|
-
//# sourceMappingURL=utils-0f9d3673.js.map
|
package/dist/utils-68e76765.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=require("@cowprotocol/contracts"),n=require("./index.js");require("cross-fetch/polyfill"),require("graphql-request");const r=function(t,i,o,l="v4"){try{let f;function m(e){if(f)return e;const n=p?.data;return{signature:n?.toString()||"",signingScheme:S}}const S="eth_sign"===l?n.EcdsaSigningScheme.ETHSIGN:n.EcdsaSigningScheme.EIP712;let v,p=null;try{switch(l){case"default":case"v3":v=new e.TypedDataVersionedSigner(o);break;case"int_v4":v=new e.IntChainIdTypedDataV4Signer(o);break;default:v=o}}catch(I){throw console.error("Wallet not supported:",I),new n.CowError("Wallet not supported")}const E=function(e,n){try{var r=Promise.resolve(i({...t,signer:v,signingScheme:S})).then(function(e){p=e})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){if(void 0===(n=e).code&&void 0===n.message)throw console.error(e),e;var n;const m=[a,g].some(n=>[e.message,e.toString()].some(e=>n.test(e)));if(e.code!==c&&!m){if(h.test(e.message)){const e=r(t,i,o,"int_v4");return f=1,e}if(e.code===s){const e=r(t,i,o,"eth_sign");return f=1,e}if(d.test(e.message)){const e=r(t,i,o,"v3");return f=1,e}if(u.test(e.message)){const e=r(t,i,o,"eth_sign");return f=1,e}throw console.error(e),e}switch(l){case"v4":const n=r(t,i,o,"default");return f=1,n;case"default":const s=r(t,i,o,"v3");return f=1,s;case"v3":const c=r(t,i,o,"eth_sign");return f=1,c;default:throw e}});return Promise.resolve(E&&E.then?E.then(m):m(E))}catch(w){return Promise.reject(w)}},t=function(n){try{const{chainId:r,signer:t,signingScheme:i,orderUids:o}=n,s=m(r);return Promise.resolve(e.signOrderCancellations(s,o,t,l[i]))}catch(e){return Promise.reject(e)}},i=function(n){try{const{chainId:r,signer:t,signingScheme:i,orderId:o}=n,s=m(r);return Promise.resolve(e.signOrderCancellation(s,o,t,l[i]))}catch(e){return Promise.reject(e)}},o=function(n){try{const{chainId:r,signer:t,order:i,signingScheme:o}=n,s=m(r);return Promise.resolve(e.signOrder(s,i,t,l[o]))}catch(e){return Promise.reject(e)}},s=-32603,c=-32601,a=/Method not found/i,d=/eth_signTypedData_v4 does not exist/i,u=/eth_signTypedData_v3 does not exist/i,g=/RPC request failed/i,h=/provided chainid .* must match the active chainid/i,l={[n.EcdsaSigningScheme.EIP712]:e.SigningScheme.EIP712,[n.EcdsaSigningScheme.ETHSIGN]:e.SigningScheme.ETHSIGN};function m(r){const t=n.COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[r];if(!t)throw new n.CowError("Unsupported network. Settlement contract is not deployed");return e.domain(r,t)}exports.getDomain=m,exports.signOrder=function(e,n,t){return r({order:e,chainId:n},o,t)},exports.signOrderCancellation=function(e,n,t){return r({orderId:e,chainId:n},i,t)},exports.signOrderCancellations=function(e,n,i){return r({orderUids:e,chainId:n},t,i)};
|
|
2
|
-
//# sourceMappingURL=utils-68e76765.js.map
|
package/dist/utils-f5939feb.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{C as e,_ as t,a as n,E as r}from"./index-5cf8c805.js";import{domain as s,IntChainIdTypedDataV4Signer as i,TypedDataVersionedSigner as o,signOrder as c,signOrderCancellation as a,signOrderCancellations as d,SigningScheme as u}from"@cowprotocol/contracts";import"cross-fetch/polyfill";import"graphql-request";const h=-32603,g=-32601,l=/Method not found/i,f=/eth_signTypedData_v4 does not exist/i,m=/eth_signTypedData_v3 does not exist/i,p=/RPC request failed/i,v=/provided chainid .* must match the active chainid/i,w={[r.EIP712]:u.EIP712,[r.ETHSIGN]:u.ETHSIGN};async function I(e){const{chainId:t,signer:n,order:r,signingScheme:s}=e,i=C(t);return c(i,r,n,w[s])}async function y(e){const{chainId:t,signer:n,signingScheme:r,orderId:s}=e,i=C(t);return a(i,s,n,w[r])}async function S(e){const{chainId:t,signer:n,signingScheme:r,orderUids:s}=e,i=C(t);return d(i,s,n,w[r])}async function _(n,s,c,a="v4"){var d;const u="eth_sign"===a?r.ETHSIGN:r.EIP712;let w,I=null;try{switch(a){case"default":case"v3":w=new o(c);break;case"int_v4":w=new i(c);break;default:w=c}}catch(t){throw console.error("Wallet not supported:",t),new e("Wallet not supported")}try{I=await s(t({},n,{signer:w,signingScheme:u}))}catch(e){if(void 0===(y=e).code&&void 0===y.message)throw console.error(e),e;const t=[l,p].some(t=>[e.message,e.toString()].some(e=>t.test(e)));if(e.code!==g&&!t){if(v.test(e.message))return _(n,s,c,"int_v4");if(e.code===h)return _(n,s,c,"eth_sign");if(f.test(e.message))return _(n,s,c,"v3");if(m.test(e.message))return _(n,s,c,"eth_sign");throw console.error(e),e}switch(a){case"v4":return _(n,s,c,"default");case"default":return _(n,s,c,"v3");case"v3":return _(n,s,c,"eth_sign");default:throw e}}var y;const S=null==(d=I)?void 0:d.data;return{signature:(null==S?void 0:S.toString())||"",signingScheme:u}}async function E(e,t,n){return _({order:e,chainId:t},I,n)}async function T(e,t,n){return _({orderId:e,chainId:t},y,n)}async function x(e,t,n){return _({orderUids:e,chainId:t},S,n)}function C(t){const r=n[t];if(!r)throw new e("Unsupported network. Settlement contract is not deployed");return s(t,r)}export{C as getDomain,E as signOrder,T as signOrderCancellation,x as signOrderCancellations};
|
|
2
|
-
//# sourceMappingURL=utils-f5939feb.js.map
|