Base Agent icon

Base Agent

Interact with Base on-chain AI agents

Overview

This node, named "Base Agent," enables interaction with Base on-chain AI agents, specifically focusing on blockchain token operations. The swapToken operation allows users to swap one cryptocurrency token for another directly on the blockchain. This is useful in decentralized finance (DeFi) scenarios where users want to exchange tokens without relying on centralized exchanges.

Practical examples include:

  • Swapping stablecoins for other tokens to participate in DeFi protocols.
  • Exchanging tokens to rebalance a crypto portfolio automatically.
  • Facilitating token swaps within automated workflows that require dynamic asset management.

Properties

Name Meaning
From Token The ticker symbol of the token you want to swap from (e.g., "ETH", "USDC").
To Token The ticker symbol of the token you want to swap to (e.g., "DAI", "WBTC").
Amount The quantity of the "From Token" you want to swap.
Slippage The maximum allowed slippage percentage during the swap, protecting against price changes.

Output

The node outputs an array of JSON objects, each representing the result of a swap operation. The exact structure depends on the underlying swap function but typically includes details such as transaction status, swapped amounts, and possibly transaction hashes or confirmations.

If the swap fails, the output JSON will contain an error field describing the issue.

No binary data output is indicated by the source code.

Dependencies

  • Requires an API key credential containing a private key and RPC URL to interact with the blockchain.
  • Uses internal functions to perform token swaps on a default blockchain network identified by a constant chain ID.
  • The node depends on external blockchain infrastructure accessible via the provided RPC URL.

Troubleshooting

  • Missing Credentials: If the private key or RPC URL is not provided, the node returns an error stating both are required.
  • Unsupported Operation: If an unsupported operation is specified, the node returns an error indicating the operation is not supported.
  • Swap Failures: Errors during the swap (e.g., insufficient funds, invalid token symbols, or network issues) will be returned in the output's error field.
  • Slippage Too Low: Setting slippage too low may cause swaps to fail if market prices move beyond the threshold before confirmation.
  • Incorrect Token Symbols: Using incorrect or unsupported token ticker symbols will likely cause errors in fetching token details or executing swaps.

To resolve these issues:

  • Ensure valid credentials with a private key and RPC URL are configured.
  • Verify token ticker symbols are correct and supported on the target blockchain.
  • Adjust slippage tolerance according to market volatility.
  • Enable "Continue On Fail" in the node settings to handle errors gracefully in workflows.

Links and References

Discussion