-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathswagger.yaml
600 lines (581 loc) · 21 KB
/
swagger.yaml
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
openapi: "3.0.2"
info:
title: Jupiter API v6
version: 6.0.0
description: |
The core of [jup.ag](https://jup.ag). Easily get a quote and swap through Jupiter API.
### Rate Limit
We update our rate limit from time to time depending on the load of our servers. We recommend running your own instance of the API if you want to have high rate limit, here to learn how to run the [self-hosted API](https://station.jup.ag/docs/apis/self-hosted).
### API Wrapper
- Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node)
### Data types
- Public keys are base58 encoded strings
- raw data such as Vec<u8\> are base64 encoded strings
servers:
- url: https://quote-api.jup.ag/v6
paths:
/quote:
get:
summary: GET /quote
description: Sends a GET request to the Jupiter API to get the best priced quote.
parameters:
- $ref: "#/components/parameters/InputMintParameter"
- $ref: "#/components/parameters/OutputMintParameter"
- $ref: "#/components/parameters/AmountParameter"
- $ref: "#/components/parameters/SlippageParameter"
- $ref: "#/components/parameters/DynamicSlippageParameter"
- $ref: "#/components/parameters/AutoSlippageParameter"
- $ref: "#/components/parameters/AutoSlippageCollisionValueParameter"
- $ref: "#/components/parameters/ComputeAutoSlippageParameter"
- $ref: "#/components/parameters/MaxAutoSlippageBpsParameter"
- $ref: "#/components/parameters/SwapModeParameter"
- $ref: "#/components/parameters/DexesParameter"
- $ref: "#/components/parameters/ExcludeDexesParameter"
- $ref: "#/components/parameters/RestrictIntermediateTokensParameter"
- $ref: "#/components/parameters/OnlyDirectRoutesParameter"
- $ref: "#/components/parameters/AsLegacyTransactionParameter"
- $ref: "#/components/parameters/PlatformFeeBpsParameter"
- $ref: "#/components/parameters/MaxAccountsParameter"
- $ref: "#/components/parameters/MinimizeSlippage"
- $ref: "#/components/parameters/PreferLiquidDexes"
- $ref: "#/components/parameters/TokenCategoryBasedIntermediateTokensParameter"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/QuoteResponse"
/swap:
post:
summary: POST /swap
description: Returns a transaction that you can use from the quote you get from `/quote`.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SwapRequest"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/SwapResponse"
/swap-instructions:
post:
summary: POST /swap-instructions
description: Returns instructions that you can use from the quote you get from `/quote`.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SwapRequest"
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/SwapInstructionsResponse"
/program-id-to-label:
get:
summary: GET /program-id-to-label
description: Returns a hash, which key is the program id and value is the label. This is used to help map error from transaction by identifying the fault program id. With that, we can use the `excludeDexes` or `dexes` parameter.
responses:
"200":
description: Default response
content:
application/json:
schema:
type: object
additionalProperties:
type: string
/indexed-route-map:
get:
summary: GET /indexed-route-map
description: DEPRECATED, please use /tokens for tradable mints. Returns a hash map, input mint as key and an array of valid output mint as values, token mints are indexed to reduce the file size
deprecated: true
parameters:
- $ref: "#/components/parameters/OnlyDirectRoutesParameter"
responses:
"200":
description: Default response
content:
application/json:
schema:
$ref: "#/components/schemas/IndexedRouteMapResponse"
/tokens:
get:
summary: GET /tokens
description: Returns a list of all the tradable mints
responses:
"200":
description: Default response
content:
application/json:
schema:
type: array
items:
type: string
example:
- "So11111111111111111111111111111111111111112"
- "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
- "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
components:
schemas:
Instruction:
type: object
properties:
programId:
type: string
accounts:
type: array
items:
$ref: "#/components/schemas/AccountMeta"
data:
type: string
required:
- programId
- accounts
- data
AccountMeta:
type: object
properties:
pubkey:
type: string
isSigner:
type: boolean
isWritable:
type: boolean
required:
- pubkey
- isSigner
- isWritable
PriorityFeeWithMaxLamports:
priorityLevelWithMaxLamports:
type: object
properties:
global:
type: boolean
maxLamports:
type: integer
priorityLevel:
type: string
enum: ["medium", "high", "veryHigh"]
QuoteResponse:
type: object
properties:
inputMint:
type: string
inAmount:
type: string
outputMint:
type: string
outAmount:
type: string
otherAmountThreshold:
type: string
swapMode:
$ref: "#/components/schemas/SwapMode"
required: true
slippageBps:
type: integer
format: int32
computedAutoSlippage:
type: integer
format: int32
platformFee:
$ref: "#/components/schemas/PlatformFee"
priceImpactPct:
type: string
routePlan:
type: array
items:
$ref: "#/components/schemas/RoutePlanStep"
contextSlot:
type: number
timeTaken:
type: number
swapUsdValue:
type: string
required:
- inputMint
- outputMint
- inAmount
- outAmount
- otherAmountThreshold
- swapMode
- slippageBps
- priceImpactPct
- routePlan
SwapMode:
type: string
enum:
- ExactIn
- ExactOut
PlatformFee:
type: object
properties:
amount:
type: string
feeBps:
type: integer
format: int32
required:
- amount
- feeBps
RoutePlanStep:
type: object
properties:
swapInfo:
$ref: "#/components/schemas/SwapInfo"
percent:
type: integer
format: int32
required:
- swapInfo
- percent
SwapInfo:
type: object
properties:
ammKey:
type: string
label:
type: string
inputMint:
type: string
outputMint:
type: string
inAmount:
type: string
outAmount:
type: string
feeAmount:
type: string
feeMint:
type: string
required:
- ammKey
- label
- inputMint
- outputMint
- inAmount
- outAmount
- feeAmount
- feeMint
SwapRequest:
type: object
properties:
userPublicKey:
description: The user public key.
type: string
payer:
description: Allow a custom payer to pay for the transaction.
type: string
wrapAndUnwrapSol:
description: Default is true. If true, will automatically wrap/unwrap SOL. If false, it will use wSOL token account. Will be ignored if `destinationTokenAccount` is set because the `destinationTokenAccount` may belong to a different user that we have no authority to close.
type: boolean
default: true
useSharedAccounts:
description: Default is true. This enables the usage of shared program accountns. That means no intermediate token accounts or open orders accounts need to be created for the users. But it also means that the likelihood of hot accounts is higher.
type: boolean
default: true
feeAccount:
description: Fee token account, same as the output token for ExactIn and as the input token for ExactOut, it is derived using the seeds = ["referral_ata", referral_account, mint] and the `REFER4ZgmyYx9c6He5XfaTMiGfdLwRnkV4RPp9t9iF3` referral contract (only pass in if you set a feeBps and make sure that the feeAccount has been created).
type: string
computeUnitPriceMicroLamports:
description: The compute unit price to prioritize the transaction, the additional fee will be `computeUnitLimit (1400000) * computeUnitPriceMicroLamports`. If `auto` is used, Jupiter will automatically set a priority fee and it will be capped at 5,000,000 lamports / 0.005 SOL.
anyOf:
- type: integer
- type: string
enum: ["auto"]
prioritizationFeeLamports:
description: \* PriorityFeeWithMaxLamports is impossible to be typed. Prioritization fee lamports paid for the transaction in addition to the signatures fee. Mutually exclusive with compute_unit_price_micro_lamports. If `auto` is used, Jupiter will automatically set a priority fee and it will be capped at 5,000,000 lamports / 0.005 SOL.
anyOf:
- type: integer
- type: string
enum: ["auto"]
# It's impossible to type this, with Swagger 2.0, anyOf, oneOf typing is not supported
# - type: object
# $ref: "#/components/schemas/PriorityFeeWithMaxLamports"
asLegacyTransaction:
description: Default is false. Request a legacy transaction rather than the default versioned transaction, needs to be paired with a quote using asLegacyTransaction otherwise the transaction might be too large.
type: boolean
default: false
useTokenLedger:
description: Default is false. This is useful when the instruction before the swap has a transfer that increases the input token amount. Then, the swap will just use the difference between the token ledger token amount and post token amount.
type: boolean
default: false
destinationTokenAccount:
description: Public key of the token account that will be used to receive the token out of the swap. If not provided, the user's ATA will be used. If provided, we assume that the token account is already initialized.
type: string
dynamicComputeUnitLimit:
description: When enabled, it will do a swap simulation to get the compute unit used and set it in ComputeBudget's compute unit limit. This will increase latency slightly since there will be one extra RPC call to simulate this. Default is `false`.
type: boolean
skipUserAccountsRpcCalls:
description: When enabled, it will not do any rpc calls check on user's accounts. Enable it only when you already setup all the accounts needed for the trasaction, like wrapping or unwrapping sol, destination account is already created.
type: boolean
programAuthorityId:
description: The program authority id [0;7], load balanced across the available set by default
type: integer
allowOptimizedWrappedSolTokenAccount:
description: Default is false. Enabling it would reduce use an optimized way to open WSOL that reduce compute unit.
type: boolean
default: false
dynamicSlippage:
type: object
properties:
minBps:
type: integer
maxBps:
type: integer
blockhashSlotsToExpiry:
description: Optional. When passed in, Swap object will be returned with your desired slots to epxiry.
type: number
correctLastValidBlockHeight:
description: Optional. Default to false. Request Swap object to be returned with the correct blockhash prior to Agave 2.0.
type: boolean
addConsensusAccount:
description: Optional. Default to false. Add consensus account to (hopefully) prevent MEV attacks
type: boolean
quoteResponse:
$ref: '#/components/schemas/QuoteResponse'
required:
- userPublicKey
- quoteResponse
SwapResponse:
type: object
properties:
swapTransaction:
type: string
lastValidBlockHeight:
type: number
prioritizationFeeLamports:
type: number
prioritizationType:
type: object
description: The type of prioritization used for the swap, either Jito or ComputeBudget.
properties:
jito:
type: object
properties:
lamports:
type: integer
computeBudget:
type: object
properties:
estimatedMicroLamports:
type: integer
microLamports:
type: integer
dynamicSlippageReport:
type: object
properties:
amplificationRatio:
type: string
otherAmount:
type: integer
simulatedIncurredSlippageBps:
type: integer
slippageBps:
type: integer
categoryName:
type: string
enum: ["stable", "lst", "bluechip", "verified"]
heuristicMaxSlippageBps:
type: integer
required:
- swapTransaction
- lastValidBlockHeight
- prioritizationFeeLamports
SwapInstructionsResponse:
type: object
properties:
tokenLedgerInstruction:
description: If you are using `useTokenLedger = true`.
$ref: "#/components/schemas/Instruction"
computeBudgetInstructions:
description: The necessary instructions to setup the compute budget.
type: array
items:
$ref: "#/components/schemas/Instruction"
setupInstructions:
description: Setup missing ATA for the users.
type: array
items:
$ref: "#/components/schemas/Instruction"
swapInstruction:
description: The actual swap instruction.
$ref: "#/components/schemas/Instruction"
cleanupInstruction:
description: Unwrap the SOL if `wrapAndUnwrapSol = true`.
$ref: "#/components/schemas/Instruction"
addressLookupTableAddresses:
description: The lookup table addresses that you can use if you are using versioned transaction.
type: array
items:
type: string
required:
- computeBudgetInstructions
- setupInstructions
- swapInstruction
- addressLookupTableAddresses
IndexedRouteMapResponse:
type: object
required:
- mintKeys
- indexedRouteMap
properties:
mintKeys:
type: array
items:
type: string
description: All the mints that are indexed to match in indexedRouteMap
indexedRouteMap:
type: object
description: All the possible route and their corresponding output mints
additionalProperties:
type: array
items:
type: number
example:
"1":
- 2
- 3
- 4
"2":
- 1
- 3
- 4
parameters:
InputMintParameter:
name: inputMint
description: Input token mint address
in: query
required: true
schema:
type: string
OutputMintParameter:
name: outputMint
description: Output token mint address
in: query
required: true
schema:
type: string
AmountParameter:
name: amount
description: The amount to swap, have to factor in the token decimals.
in: query
required: true
schema:
type: integer
DynamicSlippageParameter:
name: dynamicSlippage
description: Set to true to indicate the usage of dynamic slippage.
in: query
schema:
type: boolean
SlippageParameter:
name: slippageBps
description: The slippage in basis points, 1 basis point is 0.01%. If the output token amount exceeds the slippage then the swap transaction will fail.
in: query
schema:
type: integer
AutoSlippageParameter:
name: autoSlippage
description: Automatically calculate the slippage based on pairs.
in: query
schema:
type: boolean
AutoSlippageCollisionValueParameter:
name: autoSlippageCollisionUsdValue
description: Automatic slippage collision value.
in: query
schema:
type: integer
MaxAutoSlippageBpsParameter:
name: maxAutoSlippageBps
description: Max slippage in basis points for auto slippage calculation. Default is 400.
in: query
schema:
type: integer
ComputeAutoSlippageParameter:
name: computeAutoSlippage
description: Compute auto slippage value without using it.
in: query
schema:
type: boolean
SwapModeParameter:
name: swapMode
description: (ExactIn or ExactOut) Defaults to ExactIn. ExactOut is for supporting use cases where you need an exact token amount, like payments. In this case the slippage is on the input token.
in: query
schema:
type: string
enum: ["ExactIn", "ExactOut"]
DexesParameter:
name: dexes
description: Default is that all DEXes are included. You can pass in the DEXes that you want to include only and separate them by `,`. You can check out the full list [here](https://quote-api.jup.ag/v6/program-id-to-label).
in: query
schema:
type: array
items:
type: string
ExcludeDexesParameter:
name: excludeDexes
description: Default is that all DEXes are included. You can pass in the DEXes that you want to exclude and separate them by `,`. You can check out the full list [here](https://quote-api.jup.ag/v6/program-id-to-label).
in: query
schema:
type: array
items:
type: string
RestrictIntermediateTokensParameter:
name: restrictIntermediateTokens
description: Restrict intermediate tokens to a top token set that has stable liquidity. This will help to ease potential high slippage error rate when swapping with minimal impact on pricing.
in: query
schema:
type: boolean
OnlyDirectRoutesParameter:
name: onlyDirectRoutes
description: Default is false. Direct Routes limits Jupiter routing to single hop routes only.
in: query
schema:
type: boolean
AsLegacyTransactionParameter:
name: asLegacyTransaction
description: Default is false. Instead of using versioned transaction, this will use the legacy transaction.
in: query
schema:
type: boolean
MaxAccountsParameter:
name: maxAccounts
description: Rough estimate of the max accounts to be used for the quote, so that you can compose with your own accounts
in: query
schema:
type: integer
PlatformFeeBpsParameter:
name: platformFeeBps
description: If you want to charge the user a fee, you can specify the fee in BPS. Fee % is taken out of the output token.
in: query
schema:
type: integer
MinimizeSlippage:
name: minimizeSlippage
description: Default is false. Miminize slippage attempts to find routes with lower slippage.
in: query
schema:
type: boolean
PreferLiquidDexes:
name: preferLiquidDexes
description: Default is false. Enabling it would only consider markets with high liquidity to reduce slippage.
in: query
schema:
type: boolean
TokenCategoryBasedIntermediateTokensParameter:
name: tokenCategoryBasedIntermediateTokens
description: Default is true. Uses categorized top token lists as intermediate tokens to optimize routing paths, replacing the old static top token list. This helps achieve better pricing while maintaining route reliability.
in: query
schema:
type: boolean