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 across action provider (ts) #566

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

Conversation

phdargen
Copy link
Contributor

Description

Adds new action provider to perform cross-chain interactions via the Across protocol.
Across SDK is added as new dependency.

Implements bridge_token action to bridge from connected chain to another evm chain.
Supports native ETH and ERC-20 transfers (as long as supported by Across)

Tests

  • Added unit tests
  • Tested prompts
Chatbot: typescript/examples/langchain-cdp-chatbot/chatbot.ts
Network: Sepolia
Setup: Fauceted with 1 USDC and ETH

Prompt: bridge to chain 84532, amount 0.001 ETH, receipienct 0xb7f17bF94DBa50077be037CDc279a868f82D86C2

-------------------
Successfully deposited tokens:
- From: Chain 11155111 (Sepolia)
- To: Chain 84532 (Base Sepolia)
- Token: ETH (0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14)
- Input Amount: 0.001 ETH
- Output Amount: 0.000989964511456042 ETH
- Recipient: 0xb7f17bF94DBa50077be037CDc279a868f82D86C2
- Transaction Hash for deposit: 0xde3327c2be34931343fa9ceae2a89c0d56a9feb398ded5a60dd7e49e9baa0889
-------------------

Prompt: bridge to chain 84532, amount 0.1 usdc, receipienct 0xb7f17bF94DBa50077be037CDc279a868f82D86C2, max slippage 3%
The bridging transaction was successful! Here are the details:

- **From Chain:** 11155111 (Sepolia)
- **To Chain:** 84532 (Base Sepolia)
- **Token:** USDC
- **Input Amount:** 0.1 USDC
- **Output Amount:** 0.098182 USDC
- **Recipient:** 0xb7f17bF94DBa50077be037CDc279a868f82D86C2
- **Transaction Hash for Approval:** 0x33575547e8031d3223e63dbc2e82fbc307b1391bd9c6379c8a91952b47024e92
- **Transaction Hash for Deposit:** 0x797f7d27e820f1832f994b6a6218118803fbc500f18caa70179811b4be21b2aa

Checklist

  • Added documentation to all relevant README.md files
  • Added a changelog entry

@phdargen phdargen requested a review from murrlincoln as a code owner March 14, 2025 14:59
@cb-heimdall
Copy link

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 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

@github-actions github-actions bot added documentation Improvements or additions to documentation action provider New action provider example New example agent typescript labels Mar 14, 2025
Copy link

@KanishkKhurana KanishkKhurana left a comment

Choose a reason for hiding this comment

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

left one comment around manual txn simulation and executing the deposit txn.

overall, really good job from an Across Protocol integration POV

}

// Simulate the deposit transaction
const { request } = await acrossClient.simulateDepositTx({

Choose a reason for hiding this comment

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

Diving deep into the logic behind this, are we simulating txn and executing the deposit fn manually because there's no way to trigger a wallet extension ?
I ask because we have the executeQuote function which will be able to wrap complexities around txn simulation and executing the deposit txn.

overall this is a stellar job. thank you for putting in the effort here!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @KanishkKhurana , thank you for the feedback!

I initially used executeQuote which would indeed simplify the process. This works fine until progress.step === "deposit" is succesful but then throws errors in the progress.step === "fill" step. I suspect this is because no RPC was available for the destination chain.

Now thinking about it again, it might work when we just add the destination chain to the viem client. It would certainly be nice to also return the fill txHash. A bit busy atm but will give it a try in the next days and get back to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action provider New action provider apple documentation Improvements or additions to documentation example New example agent typescript
Development

Successfully merging this pull request may close these issues.

4 participants