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

Swap query support for hooks that require account #404

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

MattPereira
Copy link
Member

@MattPereira MattPereira commented Aug 28, 2024

Closes #398

Status: On Hold

  • pending v3 contract change to add support account to queries so we dont have to psuedo query by simulating actual swap txs

Summary

  • Added optional account to querySingleSwap and queryBatchSwap ( for v3 only )
  • Added example that uses custom swap path: pnpm example ./examples/swaps/customSwap.ts
    • Token and pool addresses come from scaffold prod env
    • account is my dev wallet which holds the mock veBAL the hooks contract checks for

@MattPereira MattPereira marked this pull request as ready for review September 10, 2024 22:12
{ blockNumber: block },
);
const { result } = account
? // pseudo query fails if account has insufficient allowance or balance
Copy link
Member

Choose a reason for hiding this comment

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

Don't have a big preference on ternary vs another method but did find it pretty tricky to notice the ? with the comment inline like this.

Copy link
Member Author

Choose a reason for hiding this comment

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

ya that is pretty bad 😬

I couldn't quite remember what you wanted me to do with the caveat. Should it be a comment in code or is it just something to keep in mind moving forward?

@MattPereira MattPereira self-assigned this Sep 12, 2024
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.

Add optional account to swap query
2 participants