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

add deBridge #253

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

add deBridge #253

wants to merge 5 commits into from

Conversation

bussyjd
Copy link

@bussyjd bussyjd commented Jan 31, 2025

Pull Request Description

Related Issue

Fixes #123 (Add deBridge Integration)

Changes Made

This PR adds complete deBridge protocol integration with the following features:

  • Cross-chain token bridging functionality
  • Token information retrieval across chains
  • Bridge transaction execution and status checking
  • Support for multiple chains via deBridge API
  • Rich logging and error handling throughout

Core Features

  1. Token Information

    • Get supported chains and their configurations
    • Retrieve token information across different chains
    • Search and filter tokens by name/symbol
  2. Bridge Operations

    • Create bridge orders for cross-chain transfers
    • Execute bridge transactions on Solana
    • Check transaction status with detailed feedback
    • Get bridge quotes for fee estimation
  3. User Experience

    • Improved logging with emojis and clear status messages
    • Detailed error handling with actionable messages
    • Explorer links for transaction tracking
    • deBridge app integration for order monitoring

Implementation Details

Tools Added

  1. getTokensInfo.ts:

    • Fetches token information from any supported chain
    • Supports searching by name/symbol
    • Returns detailed token metadata
  2. getSupportedChains.ts:

    • Retrieves list of supported chains
    • Includes chain configurations and parameters
  3. getBridgeQuote.ts:

    • Estimates fees for bridge transactions
    • Supports multiple token pairs
  4. createBridgeOrder.ts:

    • Creates cross-chain bridge orders
    • Handles token approvals and preparations
  5. executeBridgeOrder.ts:

    • Executes bridge transactions on Solana
    • Returns immediately with transaction signature
    • Provides explorer links for tracking
  6. checkTransactionStatus.ts:

    • Verifies bridge transaction status
    • Shows detailed order progress
    • Rich console output with status indicators

Actions Added

  • getTokensInfoAction
  • getSupportedChainsAction
  • createBridgeOrderAction
  • executeBridgeOrderAction
  • checkTransactionStatusAction

Transaction Example

Complete bridge flow example:

// 1. Get token info
const tokens = await getTokensInfo(agent, {
  chainId: "1",
  search: "USDC"
});

// 2. Create bridge order
const order = await createBridgeOrder(agent, {
  fromChain: "1",
  toChain: "solana",
  amount: "1000000000", // 1000 USDC
  tokenAddress: tokens[0].address
});

// 3. Execute bridge transaction
const signature = await executeBridgeOrder(agent, order.transactionData);
console.log(`Transaction sent: ${signature}`);

// 4. Check status
const status = await checkTransactionStatus(agent, signature);

Example output:

🔍 Checking transaction: 5v6Jx3...
✅ Found 1 bridge order

📋 Order 0x1234...
   Status: ⏳ pending
   Source Chain Tx: 🔗 5v6Jx3...
   Destination Chain Tx: 🔗 0xabc...
   View on deBridge: 🌐 https://app.debridge.finance/order?orderId=0x1234

Prompt Used

Bridge 1000 USDC from Ethereum to Solana using deBridge

Additional Notes

  • All tools use consistent error handling and logging patterns
  • Integration tested with multiple token pairs and chains
  • Documentation includes examples for all main operations
  • Tools support both direct usage and agent-based workflows

Checklist

  • I have tested these changes locally
  • I have updated the documentation
  • I have added transaction examples
  • I have added the prompt used to test it
  • I have tested cross-chain transfers
  • I have verified error handling

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