Repository navigation
Expand file tree
/
Copy pathexternal-match-openapi.yaml
More file actions
357 lines (332 loc) · 10.3 KB
/
Copy pathexternal-match-openapi.yaml
File metadata and controls
357 lines (332 loc) · 10.3 KB
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
openapi: 3.0.0
info:
title: Renegade Darkpool API
version: 0.1.4
description: |
API for interacting with the Renegade darkpool.
Authentication is handled via HMAC-SHA256 request signing. Each request must include:
1. An API key in the x-renegade-api-key header
2. An expiration timestamp in the x-renegade-auth-expiration header
3. An HMAC-SHA256 signature in the x-renegade-auth header
4. The SDK version in the x-renegade-sdk-version header
The signature is calculated using:
- The request path
- All headers with the x-renegade prefix (except the auth header)
- The request body
The signature is base64-encoded and the expiration timestamp is in milliseconds.
contact:
name: Renegade
email: joey@renegade.fi
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://testnet.auth-server.renegade.fi
description: Sepolia Testnet
- url: https://mainnet.auth-server.renegade.fi
description: Mainnet
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: x-renegade-api-key
description: |
API key for initial authentication. This is required for all requests.
AuthKey:
type: apiKey
in: header
name: x-renegade-auth
description: |
Part of the HMAC authentication scheme. Contains the base64-encoded HMAC-SHA256
signature calculated from:
- Request path
- All x-renegade-* headers (except this one)
- Request body
The signature is generated using a pre-shared base64-encoded secret key.
AuthExpiration:
type: apiKey
in: header
name: x-renegade-auth-expiration
description: |
Part of the HMAC authentication scheme. Contains the Unix timestamp in
milliseconds when the request signature expires (typically 10 seconds
after request creation).
SdkVersion:
type: apiKey
in: header
name: x-renegade-sdk-version
description: Version identifier of the SDK making the request.
schemas:
OrderSide:
type: string
enum: [Buy, Sell]
ApiExternalAssetTransfer:
type: object
properties:
mint:
type: string
description: Token address
amount:
type: integer
description: Amount of tokens
ApiTimestampedPrice:
type: object
properties:
price:
type: string
description: Price as a string
timestamp:
type: integer
description: Unix timestamp in milliseconds since epoch
ApiExternalMatchResult:
type: object
properties:
quote_mint:
type: string
description: Quote token address
base_mint:
type: string
description: Base token address
quote_amount:
type: integer
description: Amount of quote tokens
base_amount:
type: integer
description: Amount of base tokens
direction:
$ref: "#/components/schemas/OrderSide"
FeeTake:
type: object
properties:
relayer_fee:
type: integer
description: Fee paid to the relayer
protocol_fee:
type: integer
description: Fee paid to the protocol
ExternalOrder:
type: object
oneOf:
- required: [base_amount]
properties:
base_amount:
type: integer
description: Amount of base tokens
minimum: 1
- required: [quote_amount]
properties:
quote_amount:
type: integer
description: Amount of quote tokens
minimum: 1
- required: [exact_base_output]
properties:
exact_base_output:
type: integer
description: Exact base token output amount
minimum: 1
- required: [exact_quote_output]
properties:
exact_quote_output:
type: integer
description: Exact quote token output amount
minimum: 1
properties:
quote_mint:
type: string
description: Quote token address
base_mint:
type: string
description: Base token address
side:
$ref: "#/components/schemas/OrderSide"
min_fill_size:
type: integer
description: Minimum fill size
default: 0
required:
- quote_mint
- base_mint
- side
ApiExternalQuote:
type: object
properties:
order:
$ref: "#/components/schemas/ExternalOrder"
match_result:
$ref: "#/components/schemas/ApiExternalMatchResult"
fees:
$ref: "#/components/schemas/FeeTake"
send:
$ref: "#/components/schemas/ApiExternalAssetTransfer"
receive:
$ref: "#/components/schemas/ApiExternalAssetTransfer"
price:
$ref: "#/components/schemas/ApiTimestampedPrice"
timestamp:
type: integer
description: Unix timestamp in milliseconds since epoch
ApiSignedExternalQuote:
type: object
properties:
quote:
$ref: "#/components/schemas/ApiExternalQuote"
signature:
type: string
description: Signature of the quote, a base64-encoded HMAC-SHA256 hash of the quote by the Relayer's admin API key
GasSponsorshipInfo:
type: object
properties:
refund_amount:
type: integer
description: Amount to refund
refund_native_eth:
type: boolean
description: Whether to refund in native ETH
refund_address:
type: string
description: Address to refund to
SignedGasSponsorshipInfo:
type: object
properties:
gas_sponsorship_info:
$ref: "#/components/schemas/GasSponsorshipInfo"
signature:
type: string
description: Signature of the gas sponsorship info
AtomicMatchApiBundle:
type: object
properties:
match_result:
$ref: "#/components/schemas/ApiExternalMatchResult"
fees:
$ref: "#/components/schemas/FeeTake"
receive:
$ref: "#/components/schemas/ApiExternalAssetTransfer"
send:
$ref: "#/components/schemas/ApiExternalAssetTransfer"
settlement_tx:
type: object
properties:
tx_type:
type: string
description: Transaction type
to:
type: string
description: Contract address
data:
type: string
description: Transaction calldata as hex encoded bytes
value:
type: string
description: ETH value to send
ExternalQuoteRequest:
type: object
properties:
external_order:
$ref: "#/components/schemas/ExternalOrder"
ExternalQuoteResponse:
type: object
properties:
signed_quote:
$ref: "#/components/schemas/ApiSignedExternalQuote"
gas_sponsorship_info:
$ref: "#/components/schemas/SignedGasSponsorshipInfo"
AssembleExternalMatchRequest:
type: object
properties:
do_gas_estimation:
type: boolean
description: Whether to estimate gas
default: false
allow_shared:
type: boolean
description: Whether to allow the returned bundle to be shared with other clients. Enabling shared bundles will allow a higher rate limit.
default: false
receiver_address:
type: string
description: Address to receive the match
signed_quote:
$ref: "#/components/schemas/ApiSignedExternalQuote"
required: true
updated_order:
$ref: "#/components/schemas/ExternalOrder"
required: false
gas_sponsorship_info:
$ref: "#/components/schemas/SignedGasSponsorshipInfo"
ExternalMatchResponse:
type: object
properties:
match_bundle:
$ref: "#/components/schemas/AtomicMatchApiBundle"
gas_sponsored:
type: boolean
description: Whether the match has received gas sponsorship
default: false
gas_sponsorship_info:
$ref: "#/components/schemas/GasSponsorshipInfo"
paths:
/v0/matching-engine/quote:
post:
summary: Request a quote for an order
description: |
Request a quote for an external order. Rate limited to 100 requests per minute.
security:
- ApiKeyAuth: []
- AuthKey: []
- AuthExpiration: []
- SdkVersion: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ExternalQuoteRequest"
responses:
"200":
description: Quote successfully retrieved
content:
application/json:
schema:
$ref: "#/components/schemas/ExternalQuoteResponse"
"204":
description: No quote available
"429":
description: Rate limit exceeded
"401":
description: Unauthorized
"400":
description: Bad request
/v0/matching-engine/assemble-external-match:
post:
summary: Assemble a quote into a match bundle
description: |
Assemble a signed quote into a match bundle. Rate limited to 5 *unsettled* bundles per minute.
See the docs for more information.
security:
- ApiKeyAuth: []
- AuthKey: []
- AuthExpiration: []
- SdkVersion: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/AssembleExternalMatchRequest"
responses:
"200":
description: Match bundle successfully assembled
content:
application/json:
schema:
$ref: "#/components/schemas/ExternalMatchResponse"
"204":
description: No match bundle available
"429":
description: Rate limit exceeded
"401":
description: Unauthorized
"400":
description: Bad request