-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.json
247 lines (247 loc) · 7.97 KB
/
swagger.json
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
{
"openapi": "3.0.1",
"info": {
"title": "MetaDexa API",
"description": "MetaDexa - Trading API",
"version": "1.0"
},
"servers": [
{
"url": "https://api.metadexa.io/",
"description": "Mainnet"
},
{
"url": "http://localhost:4001/",
"description": "Local"
}
],
"paths": {
"/v1.0/{chainId}/getQuote": {
"get": {
"tags": [
"Get Quote"
],
"description": "Fetches the best aggregated quotes for given trading pair",
"parameters": [
{
"name": "chainId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"enum": [
1,
42161,
10,
137,
8453
]
},
"example": 137
},
{
"name": "fromAddress",
"description": "address of the owner EOA",
"required": true,
"in": "query",
"schema": {
"type": "string"
},
"example": "0xe26F8f8A14251425Dd4E7f59f14eE5C0c2568956"
},
{
"name": "skipValidation",
"required": true,
"description": "true if example quote is needed. false if you need transaction with data ready to be executed",
"in": "query",
"schema": {
"type": "boolean"
},
"example": true
},
{
"name": "sellTokenAmount",
"description": "amount of token that will be sold",
"in": "query",
"schema": {
"type": "string"
},
"example": "100000000000000"
},
{
"name": "sellTokenAddress",
"required": true,
"in": "query",
"schema": {
"type": "string"
},
"example": "0x14af1f2f02dccb1e43402339099a05a5e363b83c"
},
{
"name": "buyTokenAddress",
"required": true,
"in": "query",
"schema": {
"type": "string"
},
"example": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
},
{
"name": "slippage",
"description": "Price slippage you are willing to accept, may be set with decimals. (e.g. slippage=0.005 means 0.5% slippage is acceptable; slippage=0.01 means 1% slippage is acceptable, etc.)",
"required": true,
"in": "query",
"schema": {
"type": "string"
},
"example": "0.005"
}
],
"responses": {
"200": {
"description": "Returns the best aggregated quotes for given trading pair",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "object",
"example": {
"estimatedGas": 531962,
"buyTokenAddress": "0x14af1f2f02dccb1e43402339099a05a5e363b83c",
"buyAmount": "153047124858823786407",
"sellTokenAddress": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
"sellAmount": "10000000",
"allowanceTarget": "0x6afD834f6e3D5ad5A83E7838ca45F3DBDe3E323d",
"tx": {
"description": "txn object is present if skipValidation is false",
"from": "0x3510D70e9fFcF31C2Cb7c000CD65B0Ff2272CE66",
"to": "0x6afD834f6e3D5ad5A83E7838ca45F3DBDe3E323d",
"data": "0xe79f303b00000000000000000000000014af1f2f02dccb1e43402339099a05a5e363b83c0000",
"gas": 429013,
"value": "0",
"gasPrice": "30000000013"
}
}
}
}
}
}
}
}
},
"/v1.0/{chainId}/getGaslessQuote": {
"get": {
"tags": [
"Get Gasless Quote"
],
"description": "Fetches the best Gasless aggregated quotes for given trading pair",
"parameters": [
{
"name": "chainId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"enum": [
1,
42161,
10,
137,
8453
]
},
"example": 137
},
{
"name": "fromAddress",
"required": true,
"description": "address of txn executor",
"in": "query",
"schema": {
"type": "string"
},
"example": "0x252ca143428929B2A351888ab14634629a9CF216"
},
{
"name": "sellTokenAddress",
"description": "address of the token that will be sold",
"required": true,
"in": "query",
"schema": {
"type": "string"
},
"example": "0x14Af1F2f02DCcB1e43402339099A05a5E363b83c"
},
{
"name": "buyTokenAddress",
"description": "address of token that will be bought",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"example": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
},
{
"name": "sellTokenAmount",
"description": "amount of token that will be sold",
"in": "query",
"schema": {
"type": "string"
},
"example": "2000"
},
{
"name": "slippage",
"description": "Price slippage you are willing to accept, may be set with decimals. (e.g. slippage=0.005 means 0.5% slippage is acceptable; slippage=0.01 means 1% slippage is acceptable, etc.)",
"required": true,
"in": "query",
"schema": {
"type": "string"
},
"example": "0.005"
},
{
"name": "skipValidation",
"description": "whether txn hex data needs to be returned. It should be false if you want txn data ready for execution. True will give non validated quote, but without data ready for execution.",
"required": true,
"in": "query",
"schema": {
"type": "boolean"
},
"example": false
}
],
"responses": {
"200": {
"description": "Returns the best Gasless aggregated quotes for given trading pair",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "object",
"example": {
"estimatedGas": 240000,
"paymentTokenAddress": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
"paymentFees": "0",
"buyTokenAddress": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
"buyAmount": "63179691357410456145",
"sellTokenAddress": "0x14af1f2f02dccb1e43402339099a05a5e363b83c",
"sellAmount": "1000000000000000000000",
"allowanceTarget": "0x6afD834f6e3D5ad5A83E7838ca45F3DBDe3E323d",
"tx": {
"from": "0x252ca143428929B2A351888ab14634629a9CF216",
"to": "0x316766609569e00c3484fE9e558A35b975064a62",
"data": "0xf08a8de4000000000000000000000000000000000000000000000000000000000000004000",
"gas": 315000,
"value": "0",
"gasPrice": "124324285671"
}
}
}
}
}
}
}
}
}
}
}