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

[ECO-2492] Calculate the swap price client-side #412

Merged
merged 11 commits into from
Nov 26, 2024
Merged

[ECO-2492] Calculate the swap price client-side #412

merged 11 commits into from
Nov 26, 2024

Conversation

xbtmatt
Copy link
Collaborator

@xbtmatt xbtmatt commented Nov 25, 2024

Description

Instead of hitting the Aptos Labs fullnode with a view function, we can run the simulate_swap_inner function client-side. This will lower the resources we consume from the fullnode API.

  • Port the Move contract logic to TypeScript in the SDK
  • Add a hook function to wrap the calculation function with inputs from the frontend
  • Remove the useSimulateSwap hook (or only use it as a backup)
  • Remove any remaining console logs/manual testing code

Testing

  • Verify useSimulateSwap always results in the same output as the calculation function
  • Test it on the preview build with a new market and an existing market, compare to results from the existing production build or another build with the old logic
  • e2e tests to verify the logic is correct in multiple circumstances

Checklist

  • Did you update relevant documentation?
  • Did you add tests to cover new code or a fixed issue?
  • Did you update the changelog?
  • Did you check all checkboxes from the linked Linear task?

Copy link

vercel bot commented Nov 25, 2024

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

Name Status Preview Comments Updated (UTC)
emojicoin-dot-fun ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 6:30pm
emojicoin-dot-fun-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 6:30pm

@alnoki alnoki merged commit dc876bc into main Nov 26, 2024
6 checks passed
@alnoki alnoki deleted the ECO-2492 branch November 26, 2024 18:36
@xbtmatt xbtmatt mentioned this pull request Nov 28, 2024
4 tasks
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