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

feat: Add Swap Settings v1 api support #1189

Merged
merged 6 commits into from
Aug 30, 2024
Merged

Conversation

cpcramer
Copy link
Contributor

What changed? Why?

Notes to reviewers

How has it been tested?

Copy link

vercel bot commented Aug 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2024 7:54pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2024 7:54pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2024 7:54pm

let slippagePercentage = params.maxSlippage;
// Adjust slippage for V1 API (aggregator)
// V1 expects slippage in tenths of a percent (e.g., 30 = 3%)
if (params.useAggregator) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't follow, is useAggregator: true what everyone uses at the moment?

If that so, we should not change this code.

Copy link
Contributor Author

@cpcramer cpcramer Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr: No one should be using useAggregator: true

There are two different APIs, V1 wallet/swap-service and V2 cloud/swap-router.

V1:

  • useAggregator: true
  • Expects slippage in tenths of a percent (e.g., 30 = 3%) which is why we must multiply maxSlippage by 10 before sending the request.

V2:

  • useAggregator: false
  • Expects slippage in a percent, which is why we do not have to adjust the maxSlippage value.

PartyDOA is the only known customer who is using the maxSlippage parameter. No other user is using the maxSlippage parameter, and therefore they are defaulting to a hard coded slippage value of 10%.

I know this is confusing, but we are planning to deprecate the V1 API once we deprecate the experimental prop.

@Zizzamia @0xAlec

@Zizzamia Zizzamia merged commit e632261 into main Aug 30, 2024
16 checks passed
@Zizzamia Zizzamia deleted the paul/swap-Settings-api branch August 30, 2024 20:09
@cpcramer cpcramer changed the title chore: Add Swap Settings v1 api support feat: Add Swap Settings v1 api support Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants