@cowprotocol/cow-sdk 5.8.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/consts.d.ts +11 -1
- package/dist/common/generated/EthFlow.d.ts +117 -0
- package/dist/common/generated/GPv2Settlement.d.ts +107 -0
- package/dist/common/generated/factories/EthFlow__factory.d.ts +124 -0
- package/dist/common/generated/factories/GPv2Settlement__factory.d.ts +81 -0
- package/dist/common/generated/factories/index.d.ts +2 -0
- package/dist/common/generated/index.d.ts +4 -0
- package/dist/index-d7269169.js +29 -0
- package/dist/index-d7269169.js.map +1 -0
- package/dist/index.d.ts +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-signing/orderSigningUtils.d.ts +18 -8
- package/dist/order-signing/utils.d.ts +11 -1
- package/dist/package.json +8 -5
- package/dist/schemas/trading/LimitOrderAdvancedSettings.ts +228 -0
- package/dist/schemas/trading/LimitTradeParameters.ts +105 -0
- package/dist/schemas/trading/QuoteResultsSerialized.ts +848 -0
- package/dist/schemas/trading/QuoterParameters.ts +31 -0
- package/dist/schemas/trading/SwapAdvancedSettings.ts +334 -0
- package/dist/schemas/trading/TradeParameters.ts +93 -0
- package/dist/trading/appDataUtils.d.ts +4 -0
- package/dist/trading/calculateUniqueOrderId.d.ts +6 -0
- package/dist/trading/consts.d.ts +8 -0
- package/dist/trading/getEthFlowTransaction.d.ts +7 -0
- package/dist/trading/getOrderToSign.d.ts +8 -0
- package/dist/trading/getOrderTypedData.d.ts +4 -0
- package/dist/trading/getPreSignTransaction.d.ts +4 -0
- package/dist/trading/getQuote.d.ts +14 -0
- package/dist/trading/index.d.ts +19 -0
- package/dist/trading/postCoWProtocolTrade.d.ts +4 -0
- package/dist/trading/postLimitOrder.d.ts +3 -0
- package/dist/trading/postSellNativeCurrencyOrder.d.ts +8 -0
- package/dist/trading/postSwapOrder.d.ts +4 -0
- package/dist/trading/tradingSdk.d.ts +16 -0
- package/dist/trading/types.d.ts +138 -0
- package/dist/trading/utils.d.ts +15 -0
- package/dist/utils-7f502e5c.js +2 -0
- package/dist/utils-7f502e5c.js.map +1 -0
- package/dist/utils-83038876.js +2 -0
- package/dist/utils-83038876.js.map +1 -0
- package/dist/utils-be09ebbf.js +2 -0
- package/dist/utils-be09ebbf.js.map +1 -0
- package/package.json +8 -5
- package/dist/index-c004f2c4.js +0 -29
- package/dist/index-c004f2c4.js.map +0 -1
- package/dist/utils-2718e59e.js +0 -2
- package/dist/utils-2718e59e.js.map +0 -1
- package/dist/utils-353bb58e.js +0 -2
- package/dist/utils-353bb58e.js.map +0 -1
- package/dist/utils-61509987.js +0 -2
- package/dist/utils-61509987.js.map +0 -1
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"tradeParameters": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"env": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"enum": [
|
|
12
|
+
"prod",
|
|
13
|
+
"staging"
|
|
14
|
+
],
|
|
15
|
+
"description": "The environment to use for the Cow API."
|
|
16
|
+
},
|
|
17
|
+
"partiallyFillable": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"description": "Is the order fill-or-kill or partially fillable?"
|
|
20
|
+
},
|
|
21
|
+
"slippageBps": {
|
|
22
|
+
"type": "number",
|
|
23
|
+
"description": "Slippage tolerance that was applied to the order to get the limit price. Expressed in Basis Points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent)"
|
|
24
|
+
},
|
|
25
|
+
"receiver": {
|
|
26
|
+
"anyOf": [
|
|
27
|
+
{
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "20 byte Ethereum address encoded as a hex with `0x` prefix."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "null"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"description": "An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer)."
|
|
36
|
+
},
|
|
37
|
+
"validFor": {
|
|
38
|
+
"type": "number",
|
|
39
|
+
"description": "Unix timestamp (`uint32`) until which the order is valid."
|
|
40
|
+
},
|
|
41
|
+
"partnerFee": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"bps": {
|
|
45
|
+
"type": "number",
|
|
46
|
+
"description": "The fee in basis points (BPS) to be paid to the partner. One basis point is equivalent to 0.01% (1/100th of a percent)"
|
|
47
|
+
},
|
|
48
|
+
"recipient": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "The Ethereum address of the partner to receive the fee."
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"required": [
|
|
54
|
+
"bps",
|
|
55
|
+
"recipient"
|
|
56
|
+
],
|
|
57
|
+
"additionalProperties": false
|
|
58
|
+
},
|
|
59
|
+
"kind": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"enum": [
|
|
62
|
+
"buy",
|
|
63
|
+
"sell"
|
|
64
|
+
],
|
|
65
|
+
"description": "Is this order a buy or sell?"
|
|
66
|
+
},
|
|
67
|
+
"sellToken": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "ERC-20 token to be sold."
|
|
70
|
+
},
|
|
71
|
+
"sellTokenDecimals": {
|
|
72
|
+
"type": "number"
|
|
73
|
+
},
|
|
74
|
+
"buyToken": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "ERC-20 token to be bought."
|
|
77
|
+
},
|
|
78
|
+
"buyTokenDecimals": {
|
|
79
|
+
"type": "number"
|
|
80
|
+
},
|
|
81
|
+
"amount": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "Amount of a token. `uint256` encoded in decimal."
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"required": [
|
|
87
|
+
"amount",
|
|
88
|
+
"buyToken",
|
|
89
|
+
"buyTokenDecimals",
|
|
90
|
+
"kind",
|
|
91
|
+
"sellToken",
|
|
92
|
+
"sellTokenDecimals"
|
|
93
|
+
],
|
|
94
|
+
"description": "Trade type, assets, amounts, and optional parameters."
|
|
95
|
+
},
|
|
96
|
+
"orderToSign": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"properties": {
|
|
100
|
+
"receiver": {
|
|
101
|
+
"type": "string"
|
|
102
|
+
},
|
|
103
|
+
"sellToken": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"description": "ERC-20 token to be sold."
|
|
106
|
+
},
|
|
107
|
+
"buyToken": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"description": "ERC-20 token to be bought."
|
|
110
|
+
},
|
|
111
|
+
"sellAmount": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"description": "Amount of `sellToken` to be sold in atoms."
|
|
114
|
+
},
|
|
115
|
+
"buyAmount": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"description": "Amount of `buyToken` to be bought in atoms."
|
|
118
|
+
},
|
|
119
|
+
"validTo": {
|
|
120
|
+
"type": "number",
|
|
121
|
+
"description": "Unix timestamp (`uint32`) until which the order is valid."
|
|
122
|
+
},
|
|
123
|
+
"appData": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`."
|
|
126
|
+
},
|
|
127
|
+
"feeAmount": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"description": "feeRatio * sellAmount + minimal_fee in atoms."
|
|
130
|
+
},
|
|
131
|
+
"kind": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"enum": [
|
|
134
|
+
"buy",
|
|
135
|
+
"sell"
|
|
136
|
+
],
|
|
137
|
+
"description": "The kind is either a buy or sell order."
|
|
138
|
+
},
|
|
139
|
+
"partiallyFillable": {
|
|
140
|
+
"type": "boolean",
|
|
141
|
+
"description": "Is the order fill-or-kill or partially fillable?"
|
|
142
|
+
},
|
|
143
|
+
"sellTokenBalance": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"enum": [
|
|
146
|
+
"erc20",
|
|
147
|
+
"internal",
|
|
148
|
+
"external"
|
|
149
|
+
],
|
|
150
|
+
"description": "Where should the `sellToken` be drawn from?"
|
|
151
|
+
},
|
|
152
|
+
"buyTokenBalance": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"enum": [
|
|
155
|
+
"erc20",
|
|
156
|
+
"internal"
|
|
157
|
+
],
|
|
158
|
+
"description": "Where should the `buyToken` be transferred to?"
|
|
159
|
+
},
|
|
160
|
+
"signingScheme": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"enum": [
|
|
163
|
+
"eip712",
|
|
164
|
+
"ethsign",
|
|
165
|
+
"presign",
|
|
166
|
+
"eip1271"
|
|
167
|
+
],
|
|
168
|
+
"description": "How was the order signed?"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"required": [
|
|
172
|
+
"appData",
|
|
173
|
+
"buyAmount",
|
|
174
|
+
"buyToken",
|
|
175
|
+
"feeAmount",
|
|
176
|
+
"kind",
|
|
177
|
+
"partiallyFillable",
|
|
178
|
+
"receiver",
|
|
179
|
+
"sellAmount",
|
|
180
|
+
"sellToken",
|
|
181
|
+
"validTo"
|
|
182
|
+
],
|
|
183
|
+
"description": "Unsigned order intent to be placed."
|
|
184
|
+
},
|
|
185
|
+
"quoteResponse": {
|
|
186
|
+
"type": "object",
|
|
187
|
+
"properties": {
|
|
188
|
+
"quote": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"properties": {
|
|
191
|
+
"sellToken": {
|
|
192
|
+
"type": "string",
|
|
193
|
+
"description": "ERC-20 token to be sold."
|
|
194
|
+
},
|
|
195
|
+
"buyToken": {
|
|
196
|
+
"type": "string",
|
|
197
|
+
"description": "ERC-20 token to be bought."
|
|
198
|
+
},
|
|
199
|
+
"receiver": {
|
|
200
|
+
"anyOf": [
|
|
201
|
+
{
|
|
202
|
+
"type": "string",
|
|
203
|
+
"description": "20 byte Ethereum address encoded as a hex with `0x` prefix."
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"type": "null"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"description": "An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer)."
|
|
210
|
+
},
|
|
211
|
+
"sellAmount": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"description": "Amount of `sellToken` to be sold in atoms."
|
|
214
|
+
},
|
|
215
|
+
"buyAmount": {
|
|
216
|
+
"type": "string",
|
|
217
|
+
"description": "Amount of `buyToken` to be bought in atoms."
|
|
218
|
+
},
|
|
219
|
+
"validTo": {
|
|
220
|
+
"type": "number",
|
|
221
|
+
"description": "Unix timestamp (`uint32`) until which the order is valid."
|
|
222
|
+
},
|
|
223
|
+
"appData": {
|
|
224
|
+
"type": "string",
|
|
225
|
+
"description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`."
|
|
226
|
+
},
|
|
227
|
+
"feeAmount": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"description": "feeRatio * sellAmount + minimal_fee in atoms."
|
|
230
|
+
},
|
|
231
|
+
"kind": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"enum": [
|
|
234
|
+
"buy",
|
|
235
|
+
"sell"
|
|
236
|
+
],
|
|
237
|
+
"description": "The kind is either a buy or sell order."
|
|
238
|
+
},
|
|
239
|
+
"partiallyFillable": {
|
|
240
|
+
"type": "boolean",
|
|
241
|
+
"description": "Is the order fill-or-kill or partially fillable?"
|
|
242
|
+
},
|
|
243
|
+
"sellTokenBalance": {
|
|
244
|
+
"type": "string",
|
|
245
|
+
"enum": [
|
|
246
|
+
"erc20",
|
|
247
|
+
"internal",
|
|
248
|
+
"external"
|
|
249
|
+
],
|
|
250
|
+
"description": "Where should the `sellToken` be drawn from?"
|
|
251
|
+
},
|
|
252
|
+
"buyTokenBalance": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"enum": [
|
|
255
|
+
"erc20",
|
|
256
|
+
"internal"
|
|
257
|
+
],
|
|
258
|
+
"description": "Where should the `buyToken` be transferred to?"
|
|
259
|
+
},
|
|
260
|
+
"signingScheme": {
|
|
261
|
+
"type": "string",
|
|
262
|
+
"enum": [
|
|
263
|
+
"eip712",
|
|
264
|
+
"ethsign",
|
|
265
|
+
"presign",
|
|
266
|
+
"eip1271"
|
|
267
|
+
],
|
|
268
|
+
"description": "How was the order signed?"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"required": [
|
|
272
|
+
"sellToken",
|
|
273
|
+
"buyToken",
|
|
274
|
+
"sellAmount",
|
|
275
|
+
"buyAmount",
|
|
276
|
+
"validTo",
|
|
277
|
+
"appData",
|
|
278
|
+
"feeAmount",
|
|
279
|
+
"kind",
|
|
280
|
+
"partiallyFillable"
|
|
281
|
+
],
|
|
282
|
+
"additionalProperties": false,
|
|
283
|
+
"description": "Order parameters."
|
|
284
|
+
},
|
|
285
|
+
"from": {
|
|
286
|
+
"type": "string",
|
|
287
|
+
"description": "20 byte Ethereum address encoded as a hex with `0x` prefix."
|
|
288
|
+
},
|
|
289
|
+
"expiration": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"description": "Expiration date of the offered fee. Order service might not accept the fee after this expiration date. Encoded as ISO 8601 UTC."
|
|
292
|
+
},
|
|
293
|
+
"id": {
|
|
294
|
+
"type": "number",
|
|
295
|
+
"description": "Quote ID linked to a quote to enable providing more metadata when analysing order slippage."
|
|
296
|
+
},
|
|
297
|
+
"verified": {
|
|
298
|
+
"type": "boolean",
|
|
299
|
+
"description": "Whether it was possible to verify that the quoted amounts are accurate using a simulation."
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
"required": [
|
|
303
|
+
"quote",
|
|
304
|
+
"expiration",
|
|
305
|
+
"verified"
|
|
306
|
+
],
|
|
307
|
+
"additionalProperties": false,
|
|
308
|
+
"description": "An order quoted by the backend that can be directly signed and submitted to the order creation backend."
|
|
309
|
+
},
|
|
310
|
+
"appDataInfo": {
|
|
311
|
+
"type": "object",
|
|
312
|
+
"properties": {
|
|
313
|
+
"doc": {
|
|
314
|
+
"type": "object",
|
|
315
|
+
"properties": {
|
|
316
|
+
"version": {
|
|
317
|
+
"type": "string",
|
|
318
|
+
"description": "Semantic versioning of document."
|
|
319
|
+
},
|
|
320
|
+
"appCode": {
|
|
321
|
+
"type": "string",
|
|
322
|
+
"description": "The code identifying the CLI, UI, service generating the order."
|
|
323
|
+
},
|
|
324
|
+
"environment": {
|
|
325
|
+
"type": "string",
|
|
326
|
+
"description": "Environment from which the order came from."
|
|
327
|
+
},
|
|
328
|
+
"metadata": {
|
|
329
|
+
"type": "object",
|
|
330
|
+
"properties": {
|
|
331
|
+
"signer": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"description": "The address of the trader who signs the CoW Swap order. This field should normally be omitted; it is recommended to use it if the signer is a smart-contract wallet using EIP-1271 signatures."
|
|
334
|
+
},
|
|
335
|
+
"referrer": {
|
|
336
|
+
"type": "object",
|
|
337
|
+
"properties": {
|
|
338
|
+
"address": {
|
|
339
|
+
"type": "string"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"required": [
|
|
343
|
+
"address"
|
|
344
|
+
],
|
|
345
|
+
"additionalProperties": false
|
|
346
|
+
},
|
|
347
|
+
"utm": {
|
|
348
|
+
"type": "object",
|
|
349
|
+
"properties": {
|
|
350
|
+
"utmSource": {
|
|
351
|
+
"type": "string",
|
|
352
|
+
"description": "Tracks in which medium the traffic originated from (twitter, facebook, etc.)"
|
|
353
|
+
},
|
|
354
|
+
"utmMedium": {
|
|
355
|
+
"type": "string",
|
|
356
|
+
"description": "Tracks in which medium the traffic originated from (mail, CPC, social, etc.)"
|
|
357
|
+
},
|
|
358
|
+
"utmCampaign": {
|
|
359
|
+
"type": "string",
|
|
360
|
+
"description": "Track the performance of a specific campaign"
|
|
361
|
+
},
|
|
362
|
+
"utmContent": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"description": "Track which link was clicked"
|
|
365
|
+
},
|
|
366
|
+
"utmTerm": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"description": "Track which keyword term a website visitor came from"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"additionalProperties": false
|
|
372
|
+
},
|
|
373
|
+
"quote": {
|
|
374
|
+
"type": "object",
|
|
375
|
+
"properties": {
|
|
376
|
+
"slippageBips": {
|
|
377
|
+
"type": "number",
|
|
378
|
+
"description": "Slippage tolerance that was applied to the order to get the limit price. Expressed in Basis Points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent)"
|
|
379
|
+
},
|
|
380
|
+
"smartSlippage": {
|
|
381
|
+
"type": "boolean",
|
|
382
|
+
"description": "Whether the given slippageBips used is originated from a Smart slippage suggestion"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"required": [
|
|
386
|
+
"slippageBips"
|
|
387
|
+
],
|
|
388
|
+
"additionalProperties": false
|
|
389
|
+
},
|
|
390
|
+
"orderClass": {
|
|
391
|
+
"type": "object",
|
|
392
|
+
"properties": {
|
|
393
|
+
"orderClass": {
|
|
394
|
+
"type": "string",
|
|
395
|
+
"enum": [
|
|
396
|
+
"market",
|
|
397
|
+
"limit",
|
|
398
|
+
"liquidity",
|
|
399
|
+
"twap"
|
|
400
|
+
],
|
|
401
|
+
"description": "Indicator of the order class."
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
"required": [
|
|
405
|
+
"orderClass"
|
|
406
|
+
],
|
|
407
|
+
"additionalProperties": false
|
|
408
|
+
},
|
|
409
|
+
"hooks": {
|
|
410
|
+
"type": "object",
|
|
411
|
+
"properties": {
|
|
412
|
+
"version": {
|
|
413
|
+
"type": "string",
|
|
414
|
+
"description": "Semantic versioning of document."
|
|
415
|
+
},
|
|
416
|
+
"pre": {
|
|
417
|
+
"type": "array",
|
|
418
|
+
"items": {
|
|
419
|
+
"type": "object",
|
|
420
|
+
"properties": {
|
|
421
|
+
"target": {
|
|
422
|
+
"type": "string",
|
|
423
|
+
"description": "The contract to call for the hook"
|
|
424
|
+
},
|
|
425
|
+
"callData": {
|
|
426
|
+
"type": "string",
|
|
427
|
+
"description": "The calldata to use when calling the hook"
|
|
428
|
+
},
|
|
429
|
+
"gasLimit": {
|
|
430
|
+
"type": "string",
|
|
431
|
+
"description": "The gas limit (in gas units) for the hook"
|
|
432
|
+
},
|
|
433
|
+
"dappId": {
|
|
434
|
+
"type": "string",
|
|
435
|
+
"description": "CoW Swap has an interface that allows dApps to build hooks for orders. This field is used to identify the dApp that has built the hook."
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
"required": [
|
|
439
|
+
"target",
|
|
440
|
+
"callData",
|
|
441
|
+
"gasLimit"
|
|
442
|
+
],
|
|
443
|
+
"additionalProperties": false
|
|
444
|
+
},
|
|
445
|
+
"description": "CoW Hooks to call before an order executes"
|
|
446
|
+
},
|
|
447
|
+
"post": {
|
|
448
|
+
"type": "array",
|
|
449
|
+
"items": {
|
|
450
|
+
"type": "object",
|
|
451
|
+
"properties": {
|
|
452
|
+
"target": {
|
|
453
|
+
"type": "string",
|
|
454
|
+
"description": "The contract to call for the hook"
|
|
455
|
+
},
|
|
456
|
+
"callData": {
|
|
457
|
+
"type": "string",
|
|
458
|
+
"description": "The calldata to use when calling the hook"
|
|
459
|
+
},
|
|
460
|
+
"gasLimit": {
|
|
461
|
+
"type": "string",
|
|
462
|
+
"description": "The gas limit (in gas units) for the hook"
|
|
463
|
+
},
|
|
464
|
+
"dappId": {
|
|
465
|
+
"type": "string",
|
|
466
|
+
"description": "CoW Swap has an interface that allows dApps to build hooks for orders. This field is used to identify the dApp that has built the hook."
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
"required": [
|
|
470
|
+
"target",
|
|
471
|
+
"callData",
|
|
472
|
+
"gasLimit"
|
|
473
|
+
],
|
|
474
|
+
"additionalProperties": false
|
|
475
|
+
},
|
|
476
|
+
"description": "CoW Hooks to call after an order executes"
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
"additionalProperties": false,
|
|
480
|
+
"description": "Optional Pre and Post order interaction hooks attached to a single order"
|
|
481
|
+
},
|
|
482
|
+
"widget": {
|
|
483
|
+
"type": "object",
|
|
484
|
+
"properties": {
|
|
485
|
+
"appCode": {
|
|
486
|
+
"type": "string",
|
|
487
|
+
"description": "The code identifying the UI powering the widget"
|
|
488
|
+
},
|
|
489
|
+
"environment": {
|
|
490
|
+
"type": "string",
|
|
491
|
+
"description": "Environment from which the order came from."
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
"required": [
|
|
495
|
+
"appCode"
|
|
496
|
+
],
|
|
497
|
+
"additionalProperties": false
|
|
498
|
+
},
|
|
499
|
+
"partnerFee": {
|
|
500
|
+
"type": "object",
|
|
501
|
+
"properties": {
|
|
502
|
+
"bps": {
|
|
503
|
+
"type": "number",
|
|
504
|
+
"description": "The fee in basis points (BPS) to be paid to the partner. One basis point is equivalent to 0.01% (1/100th of a percent)"
|
|
505
|
+
},
|
|
506
|
+
"recipient": {
|
|
507
|
+
"type": "string",
|
|
508
|
+
"description": "The Ethereum address of the partner to receive the fee."
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
"required": [
|
|
512
|
+
"bps",
|
|
513
|
+
"recipient"
|
|
514
|
+
],
|
|
515
|
+
"additionalProperties": false
|
|
516
|
+
},
|
|
517
|
+
"replacedOrder": {
|
|
518
|
+
"type": "object",
|
|
519
|
+
"properties": {
|
|
520
|
+
"uid": {
|
|
521
|
+
"type": "string",
|
|
522
|
+
"description": "The replaced order UID."
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
"required": [
|
|
526
|
+
"uid"
|
|
527
|
+
],
|
|
528
|
+
"additionalProperties": false
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
"additionalProperties": false,
|
|
532
|
+
"description": "Each metadata will specify one aspect of the order."
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
"required": [
|
|
536
|
+
"version",
|
|
537
|
+
"metadata"
|
|
538
|
+
],
|
|
539
|
+
"additionalProperties": false,
|
|
540
|
+
"description": "Metadata JSON document for adding information to orders."
|
|
541
|
+
},
|
|
542
|
+
"fullAppData": {
|
|
543
|
+
"type": "string",
|
|
544
|
+
"description": "The string encoding of a JSON object representing some `appData`. The format of the JSON expected in the `appData` field is defined [here](https://github.com/cowprotocol/app-data)."
|
|
545
|
+
},
|
|
546
|
+
"appDataKeccak256": {
|
|
547
|
+
"type": "string",
|
|
548
|
+
"description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`."
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
"required": [
|
|
552
|
+
"doc",
|
|
553
|
+
"fullAppData",
|
|
554
|
+
"appDataKeccak256"
|
|
555
|
+
],
|
|
556
|
+
"additionalProperties": false,
|
|
557
|
+
"description": "https://github.com/cowprotocol/app-data"
|
|
558
|
+
},
|
|
559
|
+
"orderTypedData": {
|
|
560
|
+
"type": "object",
|
|
561
|
+
"properties": {
|
|
562
|
+
"domain": {
|
|
563
|
+
"type": "object",
|
|
564
|
+
"properties": {
|
|
565
|
+
"name": {
|
|
566
|
+
"type": "string"
|
|
567
|
+
},
|
|
568
|
+
"version": {
|
|
569
|
+
"type": "string"
|
|
570
|
+
},
|
|
571
|
+
"chainId": {
|
|
572
|
+
"type": "number"
|
|
573
|
+
},
|
|
574
|
+
"verifyingContract": {
|
|
575
|
+
"type": "string"
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
"required": [
|
|
579
|
+
"name",
|
|
580
|
+
"version",
|
|
581
|
+
"chainId",
|
|
582
|
+
"verifyingContract"
|
|
583
|
+
],
|
|
584
|
+
"additionalProperties": false,
|
|
585
|
+
"description": "EIP-712 typed data domain."
|
|
586
|
+
},
|
|
587
|
+
"primaryType": {
|
|
588
|
+
"type": "string",
|
|
589
|
+
"const": "Order"
|
|
590
|
+
},
|
|
591
|
+
"types": {
|
|
592
|
+
"type": "object",
|
|
593
|
+
"additionalProperties": {
|
|
594
|
+
"type": "array",
|
|
595
|
+
"items": {
|
|
596
|
+
"type": "object",
|
|
597
|
+
"properties": {
|
|
598
|
+
"name": {
|
|
599
|
+
"type": "string"
|
|
600
|
+
},
|
|
601
|
+
"type": {
|
|
602
|
+
"type": "string"
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
"required": [
|
|
606
|
+
"name",
|
|
607
|
+
"type"
|
|
608
|
+
],
|
|
609
|
+
"additionalProperties": false,
|
|
610
|
+
"description": "EIP-712 typed data field."
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
"message": {
|
|
615
|
+
"type": "object",
|
|
616
|
+
"additionalProperties": false,
|
|
617
|
+
"properties": {
|
|
618
|
+
"receiver": {
|
|
619
|
+
"type": "string"
|
|
620
|
+
},
|
|
621
|
+
"sellToken": {
|
|
622
|
+
"type": "string",
|
|
623
|
+
"description": "ERC-20 token to be sold."
|
|
624
|
+
},
|
|
625
|
+
"buyToken": {
|
|
626
|
+
"type": "string",
|
|
627
|
+
"description": "ERC-20 token to be bought."
|
|
628
|
+
},
|
|
629
|
+
"sellAmount": {
|
|
630
|
+
"type": "string",
|
|
631
|
+
"description": "Amount of `sellToken` to be sold in atoms."
|
|
632
|
+
},
|
|
633
|
+
"buyAmount": {
|
|
634
|
+
"type": "string",
|
|
635
|
+
"description": "Amount of `buyToken` to be bought in atoms."
|
|
636
|
+
},
|
|
637
|
+
"validTo": {
|
|
638
|
+
"type": "number",
|
|
639
|
+
"description": "Unix timestamp (`uint32`) until which the order is valid."
|
|
640
|
+
},
|
|
641
|
+
"appData": {
|
|
642
|
+
"type": "string",
|
|
643
|
+
"description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`."
|
|
644
|
+
},
|
|
645
|
+
"feeAmount": {
|
|
646
|
+
"type": "string",
|
|
647
|
+
"description": "feeRatio * sellAmount + minimal_fee in atoms."
|
|
648
|
+
},
|
|
649
|
+
"kind": {
|
|
650
|
+
"type": "string",
|
|
651
|
+
"enum": [
|
|
652
|
+
"buy",
|
|
653
|
+
"sell"
|
|
654
|
+
],
|
|
655
|
+
"description": "The kind is either a buy or sell order."
|
|
656
|
+
},
|
|
657
|
+
"partiallyFillable": {
|
|
658
|
+
"type": "boolean",
|
|
659
|
+
"description": "Is the order fill-or-kill or partially fillable?"
|
|
660
|
+
},
|
|
661
|
+
"sellTokenBalance": {
|
|
662
|
+
"type": "string",
|
|
663
|
+
"enum": [
|
|
664
|
+
"erc20",
|
|
665
|
+
"internal",
|
|
666
|
+
"external"
|
|
667
|
+
],
|
|
668
|
+
"description": "Where should the `sellToken` be drawn from?"
|
|
669
|
+
},
|
|
670
|
+
"buyTokenBalance": {
|
|
671
|
+
"type": "string",
|
|
672
|
+
"enum": [
|
|
673
|
+
"erc20",
|
|
674
|
+
"internal"
|
|
675
|
+
],
|
|
676
|
+
"description": "Where should the `buyToken` be transferred to?"
|
|
677
|
+
},
|
|
678
|
+
"signingScheme": {
|
|
679
|
+
"type": "string",
|
|
680
|
+
"enum": [
|
|
681
|
+
"eip712",
|
|
682
|
+
"ethsign",
|
|
683
|
+
"presign",
|
|
684
|
+
"eip1271"
|
|
685
|
+
],
|
|
686
|
+
"description": "How was the order signed?"
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
"required": [
|
|
690
|
+
"appData",
|
|
691
|
+
"buyAmount",
|
|
692
|
+
"buyToken",
|
|
693
|
+
"feeAmount",
|
|
694
|
+
"kind",
|
|
695
|
+
"partiallyFillable",
|
|
696
|
+
"receiver",
|
|
697
|
+
"sellAmount",
|
|
698
|
+
"sellToken",
|
|
699
|
+
"validTo"
|
|
700
|
+
],
|
|
701
|
+
"description": "Unsigned order intent to be placed."
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
"required": [
|
|
705
|
+
"domain",
|
|
706
|
+
"primaryType",
|
|
707
|
+
"types",
|
|
708
|
+
"message"
|
|
709
|
+
],
|
|
710
|
+
"additionalProperties": false,
|
|
711
|
+
"description": "EIP-712 typed data for an order."
|
|
712
|
+
},
|
|
713
|
+
"amountsAndCosts": {
|
|
714
|
+
"type": "object",
|
|
715
|
+
"properties": {
|
|
716
|
+
"isSell": {
|
|
717
|
+
"type": "boolean"
|
|
718
|
+
},
|
|
719
|
+
"costs": {
|
|
720
|
+
"type": "object",
|
|
721
|
+
"properties": {
|
|
722
|
+
"networkFee": {
|
|
723
|
+
"type": "object",
|
|
724
|
+
"properties": {
|
|
725
|
+
"amountInSellCurrency": {
|
|
726
|
+
"type": "string"
|
|
727
|
+
},
|
|
728
|
+
"amountInBuyCurrency": {
|
|
729
|
+
"type": "string"
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
"required": [
|
|
733
|
+
"amountInSellCurrency",
|
|
734
|
+
"amountInBuyCurrency"
|
|
735
|
+
],
|
|
736
|
+
"additionalProperties": false
|
|
737
|
+
},
|
|
738
|
+
"partnerFee": {
|
|
739
|
+
"type": "object",
|
|
740
|
+
"properties": {
|
|
741
|
+
"amount": {
|
|
742
|
+
"type": "string"
|
|
743
|
+
},
|
|
744
|
+
"bps": {
|
|
745
|
+
"type": "number"
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
"required": [
|
|
749
|
+
"amount",
|
|
750
|
+
"bps"
|
|
751
|
+
],
|
|
752
|
+
"additionalProperties": false
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
"required": [
|
|
756
|
+
"networkFee",
|
|
757
|
+
"partnerFee"
|
|
758
|
+
],
|
|
759
|
+
"additionalProperties": false
|
|
760
|
+
},
|
|
761
|
+
"beforeNetworkCosts": {
|
|
762
|
+
"type": "object",
|
|
763
|
+
"properties": {
|
|
764
|
+
"sellAmount": {
|
|
765
|
+
"type": "string"
|
|
766
|
+
},
|
|
767
|
+
"buyAmount": {
|
|
768
|
+
"type": "string"
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
"required": [
|
|
772
|
+
"sellAmount",
|
|
773
|
+
"buyAmount"
|
|
774
|
+
],
|
|
775
|
+
"additionalProperties": false
|
|
776
|
+
},
|
|
777
|
+
"afterNetworkCosts": {
|
|
778
|
+
"type": "object",
|
|
779
|
+
"properties": {
|
|
780
|
+
"sellAmount": {
|
|
781
|
+
"type": "string"
|
|
782
|
+
},
|
|
783
|
+
"buyAmount": {
|
|
784
|
+
"type": "string"
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
"required": [
|
|
788
|
+
"sellAmount",
|
|
789
|
+
"buyAmount"
|
|
790
|
+
],
|
|
791
|
+
"additionalProperties": false
|
|
792
|
+
},
|
|
793
|
+
"afterPartnerFees": {
|
|
794
|
+
"type": "object",
|
|
795
|
+
"properties": {
|
|
796
|
+
"sellAmount": {
|
|
797
|
+
"type": "string"
|
|
798
|
+
},
|
|
799
|
+
"buyAmount": {
|
|
800
|
+
"type": "string"
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
"required": [
|
|
804
|
+
"sellAmount",
|
|
805
|
+
"buyAmount"
|
|
806
|
+
],
|
|
807
|
+
"additionalProperties": false
|
|
808
|
+
},
|
|
809
|
+
"afterSlippage": {
|
|
810
|
+
"type": "object",
|
|
811
|
+
"properties": {
|
|
812
|
+
"sellAmount": {
|
|
813
|
+
"type": "string"
|
|
814
|
+
},
|
|
815
|
+
"buyAmount": {
|
|
816
|
+
"type": "string"
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
"required": [
|
|
820
|
+
"sellAmount",
|
|
821
|
+
"buyAmount"
|
|
822
|
+
],
|
|
823
|
+
"additionalProperties": false
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
"required": [
|
|
827
|
+
"isSell",
|
|
828
|
+
"costs",
|
|
829
|
+
"beforeNetworkCosts",
|
|
830
|
+
"afterNetworkCosts",
|
|
831
|
+
"afterPartnerFees",
|
|
832
|
+
"afterSlippage"
|
|
833
|
+
],
|
|
834
|
+
"additionalProperties": false,
|
|
835
|
+
"description": "CoW Protocol quote has amounts (sell/buy) and costs (network fee), there is also partner fees. Besides that, CoW Protocol supports both sell and buy orders and the fees and costs are calculated differently.\n\nThe order of adding fees and costs is as follows: 1. Network fee is always added to the sell amount 2. Partner fee is added to the surplus amount (sell amount for sell-orders, buy amount for buy-orders)\n\nFor sell-orders the partner fee is subtracted from the buy amount after network costs. For buy-orders the partner fee is added on top of the sell amount after network costs."
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
"required": [
|
|
839
|
+
"amountsAndCosts",
|
|
840
|
+
"appDataInfo",
|
|
841
|
+
"orderToSign",
|
|
842
|
+
"orderTypedData",
|
|
843
|
+
"quoteResponse",
|
|
844
|
+
"tradeParameters"
|
|
845
|
+
],
|
|
846
|
+
"additionalProperties": false,
|
|
847
|
+
"definitions": {}
|
|
848
|
+
} as const
|