Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change type from Pubkey to String for QuoteConfig dexes & excludeDexes #16

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

kiranmuddam
Copy link
Contributor

@kiranmuddam kiranmuddam commented Jul 1, 2024

The QuoteConfig struct used to get swap quote supports optional parameters like dexes & excludeDexes has type of Vec<Pubkey>, where the API supports names of dexes which is Vec<String>

References:

Examples:

Successful Quotes:

curl -L 'https://quote-api.jup.ag/v6/quote?inputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&outputMint=So11111111111111111111111111111111111111112&amount=1000000000&dexes=Orca%20V2' \
-H 'Accept: application/json'
curl -L 'https://quote-api.jup.ag/v6/quote?inputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&outputMint=So11111111111111111111111111111111111111112&amount=1000000000&excludeDexes=Orca%20V2' \
-H 'Accept: application/json'

Failed quotes with program id

curl -L 'https://quote-api.jup.ag/v6/quote?inputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&outputMint=So11111111111111111111111111111111111111112&amount=1000000000&excludeDexes=CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh' \
-H 'Accept: application/json'

@kiranmuddam
Copy link
Contributor Author

@mvines please check the above!

@mvines
Copy link
Owner

mvines commented Jul 1, 2024

Thanks for the PR! I took a look and wrote a different PR that I think might solve the issue that you're running into in more typesafe way: #17
Please let me know what you think

@ghost
Copy link

ghost commented Jul 1, 2024

@mvines Also the QuoteConfig fields of dexes and excludeDexes should be String, because the api is not accepting program ids of dexes. Everything else looks good!

curl -L 'https://quote-api.jup.ag/v6/quote?inputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&outputMint=So11111111111111111111111111111111111111112&amount=1000000000&excludeDexes=CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh' \
-H 'Accept: application/json'
{"errorCode":"INVALID_REQUEST","error":"provided DEX is not recognized: CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh, supported DEXes: Some({\"Guacswap\", \"Lifinity V1\", \"Perps\", \"Penguin\", \"Openbook\", \"Marinade\", \"Meteora\", \"Cropper Legacy\", \"Orca V2\", \"Saros\", \"Bonkswap\", \"Cropper\", \"Sanctum\", \"Mercurial\", \"Saber (Decimals)\", \"Raydium CLMM\", \"FluxBeam\", \"Invariant\", \"StepN\", \"OpenBook V2\", \"Lifinity V2\", \"Phoenix\", \"Aldrin\", \"Clone Protocol\", \"Saber\", \"Dexlab\", \"GooseFX\", \"Helium Network\", \"Token Swap\", \"Oasis\", \"Whirlpool\", \"Meteora DLMM\", \"Raydium\", \"Aldrin V2\", \"Raydium CP\", \"Crema\", \"Sanctum Infinity\", \"Orca V1\"})"}%  

@mvines
Copy link
Owner

mvines commented Jul 1, 2024

Oh wow! I see. Thank you, will merge this PR and then adapt #17 to match as we need both fixes. Thanks!

@mvines mvines merged commit 07a447c into mvines:master Jul 1, 2024
1 check passed
@mvines
Copy link
Owner

mvines commented Jul 1, 2024

v0.8.0 has now been published with this fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants