Skip to content

Conversation

@LufyCZ
Copy link
Contributor

@LufyCZ LufyCZ commented Feb 9, 2025

What changed? Why?

  • Added sushiRouterActionProvider to provide swap and quote functionality using the Sushi Router API.
  • Added swap action for swaps.
  • Added quote action for fetching quotes for swaps.
  • Added sushiDataActionProvider to provide token finding functionality using the Sushi Data API.
  • Added find-tokens action 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

@cb-heimdall
Copy link

cb-heimdall commented Feb 9, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@0xRAG 0xRAG added action provider New action provider needs review PR / issue needs review cherry typescript labels Feb 10, 2025
@phdargen
Copy link
Contributor

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

@@ -0,0 +1 @@
# Sushi Swap, Quote and Token provider
Copy link
Contributor

@phdargen phdargen Sep 30, 2025

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

@LufyCZ LufyCZ requested a review from murrlincoln as a code owner September 30, 2025 22:01
@github-actions github-actions bot added documentation Improvements or additions to documentation example New example agent labels Sep 30, 2025
@LufyCZ
Copy link
Contributor Author

LufyCZ commented Sep 30, 2025

@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 ts-node in the examples with tsx, which has much better support for ESM interoperability as well.

Hopefully that won't be too big of an issue.

@phdargen
Copy link
Contributor

phdargen commented Oct 1, 2025

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.

@phdargen
Copy link
Contributor

phdargen commented Oct 1, 2025

@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 ts-node in the examples with tsx, which has much better support for ESM interoperability as well.

Hopefully that won't be too big of an issue.

Concerning the tsconfig / tsx changes, I couldn't find any build or runtime issues. Might also be useful to avoid dynamic imports in some other action providers (eg zora, clanker). Let me know if you have any concerns or would like to see additional tests @CarsonRoscoe

@LufyCZ
Copy link
Contributor Author

LufyCZ commented Oct 1, 2025

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.

np, I just forgot to remove it after testing 😅

fromAssetAddress: "0xe6b2af36b3bb8d47206a129ff11d5a2de2a63c83",
amount: "0.0001",
toAssetAddress: "0x1234567890123456789012345678901234567890",
chainId: 1,
Copy link
Contributor

@phdargen phdargen Oct 3, 2025

Choose a reason for hiding this comment

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

Please remove chainId: 1

@phdargen
Copy link
Contributor

phdargen commented Oct 3, 2025

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 transform: { "^.+\\.tsx?$": [ "ts-jest", { tsconfig: { module: "commonjs", }, }, ], }, to typescript/jest.config.base.cjs fixes the issue for now.

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

@LufyCZ
Copy link
Contributor Author

LufyCZ commented Oct 5, 2025

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 transform: { "^.+\\.tsx?$": [ "ts-jest", { tsconfig: { module: "commonjs", }, }, ], }, to typescript/jest.config.base.cjs fixes the issue for now.

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.

@phdargen phdargen mentioned this pull request Oct 6, 2025
2 tasks
@phdargen
Copy link
Contributor

phdargen commented Oct 9, 2025

Hey @LufyCZ, we merged a PR that should hopefully fix the remaining unit test. Could you please rebase again? Thanks for your patience

@LufyCZ
Copy link
Contributor Author

LufyCZ commented Oct 11, 2025

Hey @LufyCZ, we merged a PR that should hopefully fix the remaining unit test. Could you please rebase again? Thanks for your patience

Done.

@cb-heimdall
Copy link

Review Error for carsonroscoe-cb @ 2025-11-17 14:52:28 UTC
User failed mfa authentication, either user does not exist or public email is not set on your github profile. \ see go/mfa-help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider cherry documentation Improvements or additions to documentation example New example agent needs review PR / issue needs review typescript

Development

Successfully merging this pull request may close these issues.

6 participants