Skip to content

How do you get the quote for a swap? #111

Answered by kshitjee
kshitjee asked this question in Questions
Discussion options

You must be logged in to vote

It isn't a view function, view functions have the #[view] attribute above them.

Also, you cannot see the return values of functions that are not view. So even if you pay gas and calculate spot price on-chain (swap_utils module), there is no way to access the return values via SDK/API/Indexer based on the design of the given Pancakeswap modules. This is because the information is not stored in a resource, nor is it emitted through an event.

There are multiple ways you can get a quote for a swap, here are just some examples. This answer uses the Pancakeswap modules on testnet as reference.

  1. Since you're using Pancakeswap, you can check out their aptos-swap-sdk. This will likely have a meth…

Replies: 3 comments 2 replies

Comment options

kshitjee
Mar 29, 2024
Maintainer Author

You must be logged in to vote
2 replies
@degenSumi
Comment options

@kshitjee
Comment options

kshitjee Mar 29, 2024
Maintainer Author

Answer selected by kshitjee
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move Questions related to the Move Language
2 participants