-
Notifications
You must be signed in to change notification settings - Fork 586
Sushi: swap, quote and find-token actions #309
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
Conversation
✅ Heimdall Review Status
|
|
Hi @LufyCZ, thanks for your contribution! Looks great, could you please rebase against main, then I will do some manual testing? A few initial comments below |
typescript/agentkit/src/action-providers/sushi/sushiRouterActionProvider.ts
Outdated
Show resolved
Hide resolved
typescript/agentkit/src/action-providers/sushi/sushiRouterActionProvider.ts
Outdated
Show resolved
Hide resolved
typescript/agentkit/src/action-providers/sushi/sushiRouterActionProvider.ts
Outdated
Show resolved
Hide resolved
typescript/agentkit/src/action-providers/sushi/sushiRouterActionProvider.ts
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1 @@ | |||
| # Sushi Swap, Quote and Token provider | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please fill this in the style of other action providers, see eg https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/src/action-providers/erc20/README.md
Also please add an entry for sushi here in alphabetic order: https://github.com/coinbase/agentkit/blob/main/typescript/agentkit/README.md
053a105 to
c32273f
Compare
|
@phdargen hey, all done and tested I had issues with the newer version of our package though, with it being esm (`"type": "module"). I'd suggest you fully move to ESM as well, should make the lives of everyone a bit better, but, in the meantime, the changes I made to the tsconfig should make it cooperate. I also had to replace Hopefully that won't be too big of an issue. |
typescript/agentkit/src/action-providers/sushi/sushiRouterSchemas.ts
Outdated
Show resolved
Hide resolved
|
Hi @LufyCZ, thanks for the changes! I tested it without any issues. Just one minor follow-up above. Please also remove the sushi actions from the chatbot examples and template, these are meant to stay minimal for new users. Through the READMEs the sushi actions should be easy to discover for users and quick to add if desired. Thanks for your understanding. |
Concerning the |
np, I just forgot to remove it after testing 😅 |
| fromAssetAddress: "0xe6b2af36b3bb8d47206a129ff11d5a2de2a63c83", | ||
| amount: "0.0001", | ||
| toAssetAddress: "0x1234567890123456789012345678901234567890", | ||
| chainId: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove chainId: 1
|
Sorry @LufyCZ, we still have some issues with the unit tests. For the sushi action, it should be enough to remove one line (see above). Unfortunately, also a couple of other tests for actions that use dynamic imports are failing now because of the tsconfig change. I found that adding Please make sure that all tests pass before you commit and lets get your PR in. I will follow this up removing the dynamic imports that should no longer be needed and eventually we should move to full ESM as you suggested |
Yeah, I figured that it might end up being an issue... If it's a blocker, the PR can wait, happy to rebase it again down the road though. Pushed a fix, ran a test for the sushi action folder, all good. |
|
Hey @LufyCZ, we merged a PR that should hopefully fix the remaining unit test. Could you please rebase again? Thanks for your patience |
Done. |
|
Review Error for carsonroscoe-cb @ 2025-11-17 14:52:28 UTC |
What changed? Why?
sushiRouterActionProviderto provide swap and quote functionality using the Sushi Router API.swapaction for swaps.quoteaction for fetching quotes for swaps.sushiDataActionProviderto provide token finding functionality using the Sushi Data API.find-tokensaction for fetching tokens by symbols or addresses.Why? No on-chain swap solution was present. Also, the agent didn't have a repository to pull token details from.
Features
End-to-End swap on-chain experience. Asking the agent to "Swap 1 ETH to USDC" results in a successful swap. The agent first looks up the address of "USDC" (it already knows that ETH is 0xee...ee in the context of Sushi), then, it fetches a quote and asks the user if they want to continue. If they do, the swap is executed. Cases like insufficient balance or allowance is handled.
Qualified Impact
Nothing should be affected, worst case, the user can remove the sushi actions.
Showcase