This repository was archived by the owner on Apr 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathopenapi.yml
967 lines (966 loc) · 32.7 KB
/
openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
openapi: 3.0.3
info:
version: 0.0.1
title: Order Book API
servers:
- description: Mainnet (Staging)
url: https://barn.api.cow.fi/mainnet
- description: Mainnet (Prod)
url: https://api.cow.fi/mainnet
- description: Rinkeby (Staging)
url: https://barn.api.cow.fi/rinkeby
- description: Rinkeby (Prod)
url: https://api.cow.fi/rinkeby
- description: Gnosis Chain (Staging)
url: https://barn.api.cow.fi/xdai
- description: Gnosis Chain (Prod)
url: https://api.cow.fi/xdai
- description: Local
url: http://localhost:8080
paths:
/api/v1/orders:
post:
summary: Create a new order.
responses:
201:
description: Order has been accepted.
content:
application/json:
schema:
$ref: "#/components/schemas/UID"
400:
description: Error during order validation
content:
application/json:
schema:
$ref: "#/components/schemas/OrderPostError"
403:
description: Forbidden, your account is deny-listed
429:
description: Too many order placements
500:
description: Error adding an order
requestBody:
description: The order to create.
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/OrderCreation"
get:
summary: Get existing orders.
description: |
By default all currently valid orders are returned. The set of returned orders can be
reduced by setting owner, sell token, buy token filters. It can be increased by disabling
different order validity exclusion criteria.
At least one of owner, sellToken, buyToken has to be set.
parameters:
- name: owner
in: query
schema:
$ref: "#/components/schemas/Address"
required: false
- name: sellToken
in: query
schema:
$ref: "#/components/schemas/Address"
required: false
- name: buyToken
in: query
schema:
$ref: "#/components/schemas/Address"
required: false
- name: includeFullyExecuted
in: query
description: Should fully executed orders be returned?
schema:
type: boolean
default: false
- name: includeInvalidated
in: query
description: Should orders that have been invalidated be returned?
schema:
type: boolean
default: false
- name: includeInsufficientBalance
in: query
description: Should fill or kill orders that are not sufficiently funded be included?
schema:
type: boolean
default: false
- name: includePresignaturePending
in: query
description: Should pre-sign orders waiting for the on-chain presignature be included?
schema:
type: boolean
default: false
- name: includeUnsupportedTokens
in: query
description: Should the orders containing unsupported tokens be included?
schema:
type: boolean
default: false
- name: minValidTo
in: query
description: |
Minimum valid_to timestamp for included orders.
The default is the current time.
schema:
type: integer
responses:
200:
description: existing orders
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Order"
/api/v1/orders/{UID}:
get:
summary: Get existing order from UID.
parameters:
- in: path
name: UID
schema:
$ref: "#/components/schemas/UID"
required: true
responses:
200:
description: Order
content:
application/json:
schema:
$ref: "#/components/schemas/Order"
404:
description: Order was not found
delete:
summary: Cancels order by marking it invalid with a timestamp.
description: |
The successful deletion might not prevent solvers from settling the order
Authentication must be provided by signing the following message:
parameters:
- in: path
name: UID
schema:
$ref: "#/components/schemas/UID"
required: true
requestBody:
description: "Signed OrderCancellation"
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/OrderCancellation"
responses:
200:
description: Order deleted
400:
description: Malformed signature
401:
description: Invalid signature
404:
description: Order was not found
/api/v1/transactions/{txHash}/orders:
get:
summary: Get orders by settlement transaction hash.
parameters:
- in: path
name: txHash
schema:
$ref: "#/components/schemas/TransactionHash"
required: true
responses:
200:
description: Order
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Order"
/api/v1/trades:
get:
summary: Get existing Trades.
description: |
Exactly one of owner or order_uid has to be set.
parameters:
- name: owner
in: query
schema:
$ref: "#/components/schemas/Address"
required: false
- name: orderUid
in: query
schema:
$ref: "#/components/schemas/UID"
required: false
responses:
200:
description: all trades
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Trade"
/api/v1/solvable_orders:
get:
summary: Get solvable orders.
description: |
The set of orders that solvers should be solving right now. These orders are determined to
be valid at the time of the request.
responses:
200:
description: the orders
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Order"
/api/v2/solvable_orders:
get:
summary: Get solvable orders.
description: |
The set of orders that solvers should be solving right now. These orders are determined to
be valid at the time of the request.
responses:
200:
description: the orders
content:
application/json:
schema:
type: object
properties:
orders:
type: array
items:
$ref: "#/components/schemas/Order"
latestSettlementBlock:
type: integer
description: The block number in which the most recent settlement was observed.
/api/v1/auction:
get:
summary: Gets the current batch auction.
description: |
The current batch auction that solvers should be solving right now. Includes the list of
solvable orders, the block on which the batch was created, as well as prices for all tokens
being traded (used for objective value computation).
responses:
200:
description: the auction
content:
application/json:
schema:
$ref: "#/components/schemas/Auction"
/api/v1/fee:
get:
description: |
The fee that is charged for placing an order.
The fee is described by a minimum fee - in order to cover the gas costs for onchain settling - and
a feeRatio charged to the users for using the service.
parameters:
- name: sellToken
in: query
schema:
$ref: "#/components/schemas/Address"
required: true
- name: buyToken
in: query
schema:
$ref: "#/components/schemas/Address"
required: true
- name: amount
in: query
schema:
$ref: "#/components/schemas/TokenAmount"
required: true
- name: kind
in: query
schema:
$ref: "#/components/schemas/OrderType"
required: true
responses:
200:
description: the fee
content:
application/json:
schema:
$ref: "#/components/schemas/FeeInformation"
400:
description: Token not supported by the protocol (e.g. token with fee on transfer)
404:
description: Token non-existent or not connected to native token
500:
description: Unexpected internal error while processing the request
/api/v1/markets/{baseToken}-{quoteToken}/{kind}/{amount}:
get:
description: |
The estimated amount in quote token for either buying or selling `amount` of baseToken.
parameters:
- name: baseToken
in: path
required: true
schema:
$ref: "#/components/schemas/Address"
- name: quoteToken
in: path
required: true
schema:
$ref: "#/components/schemas/Address"
- name: amount
in: path
required: true
schema:
$ref: "#/components/schemas/TokenAmount"
- name: kind
in: path
required: true
schema:
$ref: "#/components/schemas/OrderType"
responses:
200:
description: the price denominated in quote token
content:
application/json:
schema:
$ref: "#/components/schemas/AmountEstimate"
400:
description: Token not supported by the protocol (e.g. token with fee on transfer)
404:
description: Token non-existent or no valid price found
500:
description: Unexpected internal error while processing the request
/api/v1/feeAndQuote/sell:
get:
description: |
For a total available amount of sell_token returns the fee in the sell token and the
resulting buy amount after the fee has been deducted.
sellAmountBeforeFee is the total amount that is available for the order. From it the fee
is deducted and the buy amount is calculated.
parameters:
- name: sellToken
in: query
schema:
$ref: "#/components/schemas/Address"
required: true
- name: buyToken
in: query
schema:
$ref: "#/components/schemas/Address"
required: true
- name: sellAmountBeforeFee
in: query
schema:
$ref: "#/components/schemas/TokenAmount"
required: true
responses:
200:
description: ok
content:
application/json:
schema:
$ref: "#/components/schemas/FeeAndQuoteSellResponse"
400:
description: Error with the input data.
content:
application/json:
schema:
$ref: "#/components/schemas/FeeAndQuoteError"
404:
description: Token non-existent or not connected to native token
500:
description: Unexpected internal error while processing the request
/api/v1/feeAndQuote/buy:
get:
description: |
For a target buy amount returns the total sell_amount that is needed and how much of it is
the fee.
parameters:
- name: sellToken
in: query
schema:
$ref: "#/components/schemas/Address"
required: true
- name: buyToken
in: query
schema:
$ref: "#/components/schemas/Address"
required: true
- name: buyAmountAfterFee
in: query
schema:
$ref: "#/components/schemas/TokenAmount"
required: true
responses:
200:
description: ok
content:
application/json:
schema:
$ref: "#/components/schemas/FeeAndQuoteBuyResponse"
400:
description: Error with the input data.
content:
application/json:
schema:
$ref: "#/components/schemas/FeeAndQuoteError"
404:
description: Token non-existent or not connected to native token
500:
description: Unexpected internal error while processing the request
/api/v1/account/{owner}/orders:
get:
summary: Get orders of one user paginated.
description: |
The orders are ordered by their creation date descending (newest orders first).
To enumerate all orders start with offset 0 and keep increasing the offset by the total
number of returned results. When a response contains less than the limit the last page has
been reached.
parameters:
- name: owner
in: path
required: true
schema:
$ref: "#/components/schemas/Address"
- name: offset
in: query
description: |
The pagination offset. Defaults to 0.
schema:
type: integer
required: false
- name: limit
in: query
description: |
The pagination limit. Defaults to 10. Maximum 1000. Minimum 1.
schema:
type: integer
required: false
responses:
200:
description: the orders
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Order"
400:
description: Problem with parameters like limit being too large.
/api/v1/quote:
post:
summary: Quotes a price and fee for the specified order parameters.
description: |
This API endpoint accepts a partial order and computes the minimum fee and
a price estimate for the order. It returns a full order that can be used
directly for signing, and with an included signature, passed directly to
the order creation endpoint.
requestBody:
description: The order parameters to compute a quote for.
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/OrderQuoteRequest"
responses:
200:
description: Quoted order.
content:
application/json:
schema:
$ref: "#/components/schemas/OrderQuoteResponse"
400:
description: Error quoting order.
content:
application/json:
schema:
$ref: "#/components/schemas/FeeAndQuoteError"
403:
description: Forbidden, your account is deny-listed
429:
description: Too many order quotes
500:
description: Unexpected error quoting an order
components:
schemas:
TransactionHash:
description: 32 byte digest encoded as a hex with `0x` prefix.
example: "0xd51f28edffcaaa76be4a22f6375ad289272c037f3cc072345676e88d92ced8b5"
Address:
description: 20 byte Ethereum address encoded as a hex with `0x` prefix.
type: string
example: "0x6810e776880c02933d47db1b9fc05908e5386b96"
AppData:
description: 32 bytes encoded as hex with `0x` prefix.
example: "0x0000000000000000000000000000000000000000000000000000000000000000"
BigUint:
description: A big unsigned integer encoded in decimal.
type: string
example: "1234567890"
TokenAmount:
description: Amount of a token. uint256 encoded in decimal.
type: string
example: "1234567890"
FeeInformation:
description: |
Provides the information to calculate the fees.
type: object
properties:
expirationDate:
description: |
Expiration date of the offered fee. Order service might not accept
the fee after this expiration date. Encoded as ISO 8601 UTC.
type: string
example: "2020-12-03T18:35:18.814523Z"
amount:
description: Absolute amount of fee charged per order in specified sellToken
$ref: "#/components/schemas/TokenAmount"
required:
- expirationDate
- amount
OrderType:
description: Is this a buy order or sell order?
type: string
enum: [buy, sell]
SellTokenSource:
description: Where should the sell token be drawn from?
type: string
enum: [ erc20, internal, external ]
BuyTokenDestination:
description: Where should the buy token be transfered to?
type: string
enum: [ erc20, internal ]
PriceQuality:
description: How good should the price estimate be?
type: string
enum: [ fast, optimal ]
OrderStatus:
description: The current order status
type: string
enum: [presignaturePending, open, fulfilled, cancelled, expired]
OrderParameters:
description: Order parameters.
type: object
properties:
sellToken:
description: "ERC20 token to be sold"
$ref: "#/components/schemas/Address"
buyToken:
description: "ERC20 token to be bought"
$ref: "#/components/schemas/Address"
receiver:
description: |
An optional address to receive the proceeds of the trade instead of the
owner (i.e. the order signer).
$ref: "#/components/schemas/Address"
nullable: true
sellAmount:
description: "Amount of sellToken to be sold in atoms"
$ref: "#/components/schemas/TokenAmount"
buyAmount:
description: "Amount of buyToken to be bought in atoms"
$ref: "#/components/schemas/TokenAmount"
validTo:
description: Unix timestamp until the order is valid. uint32.
type: integer
appData:
description: |
Arbitrary application specific data that can be added to an order. This can
also be used to ensure uniqueness between two orders with otherwise the
exact same parameters.
$ref: "#/components/schemas/AppData"
feeAmount:
description: "Fees: feeRatio * sellAmount + minimal_fee in atoms"
$ref: "#/components/schemas/TokenAmount"
kind:
description: "The kind is either a buy or sell order"
$ref: "#/components/schemas/OrderType"
partiallyFillable:
description: Is this a fill-or-kill order or a partially fillable order?
type: boolean
sellTokenBalance:
$ref: "#/components/schemas/SellTokenSource"
default: "erc20"
buyTokenBalance:
$ref: "#/components/schemas/BuyTokenDestination"
default: "erc20"
required:
- sellToken
- buyToken
- sellAmount
- buyAmount
- validTo
- appData
- feeAmount
- kind
- partiallyFillable
OrderCreation:
description: Data a user provides when creating a new order.
allOf:
- $ref: "#/components/schemas/OrderParameters"
- type: object
properties:
signingScheme:
$ref: "#/components/schemas/SigningScheme"
signature:
$ref: "#/components/schemas/Signature"
from:
description: |
If set, the backend enforces that this address matches what is decoded as the signer of
the signature. This helps catch errors with invalid signature encodings as the backend
might otherwise silently work with an unexpected address that for example does not have
any balance.
$ref: "#/components/schemas/Address"
nullable: true
required:
- signingScheme
- signature
OrderMetaData:
description: |
Extra order data that is returned to users when querying orders
but not provided by users when creating orders.
type: object
properties:
creationTime:
description: Creation time of the order. Encoded as ISO 8601 UTC.
type: string
example: "2020-12-03T18:35:18.814523Z"
owner:
$ref: "#/components/schemas/Address"
UID:
$ref: "#/components/schemas/UID"
availableBalance:
description: "Amount of sellToken available for the settlement contract to spend on behalf of the owner. Null if API was unable to fetch balance or if the order status isn't Open."
$ref: "#/components/schemas/TokenAmount"
nullable: true
executedSellAmount:
description: "The total amount of sellToken that has been executed for this order including fees."
$ref: "#/components/schemas/BigUint"
executedSellAmountBeforeFees:
description: "The total amount of sellToken that has been executed for this order without fees."
$ref: "#/components/schemas/BigUint"
executedBuyAmount:
description: "The total amount of buyToken that has been executed for this order."
$ref: "#/components/schemas/BigUint"
executedFeeAmount:
description: "The total amount of fees that have been executed for this order."
$ref: "#/components/schemas/BigUint"
invalidated:
description: Has this order been invalidated?
type: boolean
status:
description: Order status
$ref: "#/components/schemas/OrderStatus"
fullFeeAmount:
description: "Amount that the signed fee would be without subsidies"
$ref: "#/components/schemas/TokenAmount"
required:
- creationTime
- owner
- UID
- executedSellAmount
- executedSellAmountBeforeFees
- executedBuyAmount
- executedFeeAmount
- invalidated
Order:
allOf:
- $ref: "#/components/schemas/OrderCreation"
- $ref: "#/components/schemas/OrderMetaData"
Auction:
description: |
A batch auction for solving.
type: object
properties:
block:
type: integer
description: |
The block number for the auction. Orders and prices are guaranteed to be valid on this
block. Proposed settlements should be valid for this block as well.
latestSettlementBlock:
type: integer
description: |
The latest block on which a settlement has been processed.
Note that under certain conditions it is possible for a settlement to have been mined as
part of `block` but not have yet been processed.
orders:
type: array
items:
$ref: "#/components/schemas/Order"
description: |
The solvable orders included in the auction.
prices:
type: object
additionalProperties:
$ref: "#/components/schemas/BigUint"
description: |
The reference prices for all traded tokens in the auction as a mapping from token
addresses to a price denominated in native token (i.e. 1e18 represents a token that
trades one to one with the native token). These prices are used for solution competition
for computing surplus and converting fees to native token.
OrderCancellation:
description: |
EIP712 signature of struct OrderCancellation { orderUid: bytes } from the order's owner
type: object
properties:
signature:
description: "OrderCancellation signed by owner"
$ref: "#/components/schemas/Signature"
signingScheme:
$ref: "#/components/schemas/SigningScheme"
required:
- signature
- signingScheme
AmountEstimate:
description: |
Provides the information about an estimated price.
type: object
properties:
amount:
description: The estimated amount
$ref: "#/components/schemas/TokenAmount"
token:
description: "The token in which the amount is given"
$ref: "#/components/schemas/Address"
Trade:
description: |
Trade data such as executed amounts, fees, order id and block number.
type: object
properties:
blockNumber:
description: "Block in which trade occurred."
type: integer
logIndex:
description: "Index in which transaction was included in block."
type: integer
orderUid:
description: "Unique ID of the order matched by this trade."
$ref: "#/components/schemas/UID"
owner:
description: "Address of trader."
$ref: "#/components/schemas/Address"
sellToken:
description: "Address of token sold."
$ref: "#/components/schemas/Address"
buyToken:
description: "Address of token bought."
$ref: "#/components/schemas/Address"
sellAmount:
description: "Total amount of sellToken that has been executed for this trade (including fees)."
$ref: "#/components/schemas/TokenAmount"
sellAmountBeforeFees:
description: "The total amount of sellToken that has been executed for this order without fees."
$ref: "#/components/schemas/BigUint"
buyAmount:
description: "Total amount of buyToken received in this trade."
$ref: "#/components/schemas/TokenAmount"
transactionHash:
description: "Hash of the corresponding settlement transaction containing the trade (if available)."
$ref: "#/components/schemas/TransactionHash"
nullable: true
required:
- blockNumber
- logIndex
- orderUid
- owner
- sellToken
- buyToken
- sellAmount
- sellAmountBeforeFees
- buyAmount
- transactionHash
UID:
description: |
Unique identifier for the order: 56 bytes encoded as hex with `0x` prefix.
Bytes 0 to 32 are the order digest, bytes 30 to 52 the owner address
and bytes 52..56 valid to,
type: string
Signature:
description: 65 bytes encoded as hex with `0x` prefix. r + s + v from the spec.
example: "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
SigningScheme:
description: How was the order signed?
type: string
enum: [eip712, ethsign]
OrderPostError:
type: object
properties:
errorType:
type: string
enum:
[
DuplicateOrder,
InsufficientFee,
InsufficientAllowance,
InsufficientBalance,
InsufficientValidTo,
InvalidSignature,
TransferEthToContract,
TransferSimulationFailed,
UnsupportedToken,
WrongOwner,
SameBuyAndSellToken,
ZeroAmount,
UnsupportedBuyTokenDestination,
UnsupportedSellTokenSource,
UnsupportedOrderType,
]
description:
type: string
required:
- errorType
- description
OrderCancellationError:
type: object
properties:
errorType:
type: string
enum:
[
InvalidSignature,
WrongOwner,
OrderNotFound,
AlreadyCancelled,
OrderFullyExecuted,
OrderExpired,
OnChainOrder,
]
description:
type: string
required:
- errorType
- description
FeeAndQuoteSellResponse:
type: object
properties:
fee:
$ref: "#/components/schemas/FeeInformation"
buyAmountAfterFee:
description: The buy amount after deducting the fee.
$ref: "#/components/schemas/TokenAmount"
FeeAndQuoteBuyResponse:
type: object
properties:
fee:
$ref: "#/components/schemas/FeeInformation"
sellAmountBeforeFee:
description: The sell amount including the fee.
$ref: "#/components/schemas/TokenAmount"
FeeAndQuoteError:
type: object
properties:
errorType:
type: string
enum: ["NoLiquidity", "UnsupportedToken", "AmountIsZero", "SellAmountDoesNotCoverFee"]
description:
type: string
required:
- errorType
- description
OrderQuoteSide:
description: The buy or sell side when quoting an order.
oneOf:
- type: object
description: Quote a sell order given the final total sell amount including fees
properties:
kind:
type: string
enum: [sell]
sellAmountBeforeFee:
description: |
The total amount that is available for the order. From this value, the fee
is deducted and the buy amount is calculated.
$ref: "#/components/schemas/TokenAmount"
required:
- kind
- sellAmountBeforeFee
- type: object
description: Quote a sell order given the sell amount.
properties:
kind:
type: string
enum: [sell]
sellAmountAfterFee:
description: The sell amount for the order.
$ref: "#/components/schemas/TokenAmount"
required:
- kind
- sellAmountAfterFee
- type: object
description: Quote a buy order given an exact buy amount.
properties:
kind:
type: string
enum: [buy]
buyAmountAfterFee:
description: The buy amount for the order.
$ref: "#/components/schemas/TokenAmount"
required:
- kind
- buyAmountAfterFee
OrderQuoteRequest:
description: Request fee and price quote.
allOf:
- $ref: "#/components/schemas/OrderQuoteSide"
- type: object
properties:
sellToken:
description: "ERC20 token to be sold"
$ref: "#/components/schemas/Address"
buyToken:
description: "ERC20 token to be bought"
$ref: "#/components/schemas/Address"
receiver:
description: |
An optional address to receive the proceeds of the trade instead of the
owner (i.e. the order signer).
$ref: "#/components/schemas/Address"
nullable: true
validTo:
description: Unix timestamp until the order is valid. uint32.
type: integer
appData:
description: |
Arbitrary application specific data that can be added to an order. This can
also be used to ensure uniqueness between two orders with otherwise the
exact same parameters.
$ref: "#/components/schemas/AppData"
partiallyFillable:
description: Is this a fill-or-kill order or a partially fillable order?
type: boolean
sellTokenBalance:
$ref: "#/components/schemas/SellTokenSource"
default: "erc20"
buyTokenBalance:
$ref: "#/components/schemas/BuyTokenDestination"
default: "erc20"
from:
$ref: "#/components/schemas/Address"
priceQuality:
$ref: "#/components/schemas/PriceQuality"
default: "optimal"
required:
- sellToken
- buyToken
- validTo
- appData
- partiallyFillable
- from
OrderQuoteResponse:
description: |
An order quoted by the back end that can be directly signed and
submitted to the order creation backend.
type: object
properties:
quote:
$ref: "#/components/schemas/OrderParameters"
from:
$ref: "#/components/schemas/Address"
expirationDate:
description: |
Expiration date of the offered fee. Order service might not accept
the fee after this expiration date. Encoded as ISO 8601 UTC.
type: string
example: "1985-03-10T18:35:18.814523Z"