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: chainbase plugin for eliza #2586

Closed
wants to merge 15 commits into from

Conversation

lxcong
Copy link
Contributor

@lxcong lxcong commented Jan 21, 2025

Relates to

Eliza AI agents, blockchain data analytics, Chainbase

Risks

Low. This is a new feature that adds functionality without disrupting existing systems.

Background

What does this PR do?

This PR introduces a new Chainbase plugin for Eliza that enables AI agents to access and analyze blockchain data across multiple networks using natural language queries. The plugin leverages Chainbase's comprehensive data infrastructure to provide real-time insights.

What kind of change is this?

Features (non-breaking change which adds functionality)

Why are we doing this? Any context or related work?

Eliza AI agents currently lack the ability to easily access and analyze on-chain data, especially across multiple blockchain networks. This plugin bridges that gap by allowing users to query blockchain data using natural language without requiring deep technical blockchain knowledge. It unlocks powerful new analytics and insight generation capabilities for Eliza.

This work builds upon Chainbase's existing multi-chain data infrastructure and Eliza's natural language processing capabilities. It is part of the broader initiative to make blockchain data more accessible and actionable for end users.

Documentation changes needed?

My changes require a change to the project documentation.
I have updated the documentation to include:

  • Overview of the Chainbase plugin and its purpose
  • Installation and configuration instructions
  • Examples of natural language queries and the blockchain insights generated
  • API reference for key functions

Testing

Where should a reviewer start?

  1. Review the updated documentation to understand the purpose and functionality of the plugin
  2. Run the automated test suite: npm run test
  3. Follow the instructions to install and configure the plugin in a dev environment
  4. Test sample natural language queries against blockchain data and verify the insights generated match expected results
  5. Review the code changes, focusing on the integration between Eliza's NLP and Chainbase's data layer

Detailed testing steps

  1. Install and configure the Chainbase plugin by following the documentation
  2. From the Eliza interface, input a natural language query such as "What is the total transaction volume on Ethereum in the last 24 hours?"
  3. Verify the plugin converts this to the appropriate Chainbase query and returns the expected analytics
  4. Test queries across multiple supported blockchain networks
  5. Verify error handling for unsupported networks or malformed queries
  6. Run edge case tests from the automated test suite and ensure code coverage meets standards

Deployment instructions

  1. Merge PR after review and testing approval
  2. Update Eliza production environment to point to the new Chainbase plugin version
  3. Restart Eliza web servers
  4. Smoke test Chainbase queries from the production Eliza interface
  5. Monitor error logs and system metrics post-deployment to ensure stability

Let me know if you need any other information to include in the PR description! I aimed to be thorough while following the provided template.

Screenshot

image image

Summary by CodeRabbit

  • New Features

    • Added Chainbase Plugin for blockchain data querying
    • Introduced new configuration options for Instagram integration
    • Added support for retrieving token balances and on-chain data querying
  • Configuration Updates

    • Added Chainbase API key configuration
    • Expanded Instagram-related environment variables
    • Added new plugin dependency for Chainbase integration
  • Documentation

    • Created README for Chainbase Plugin
    • Detailed usage instructions for blockchain data interactions

@lxcong lxcong closed this Jan 21, 2025
Copy link
Contributor

coderabbitai bot commented Jan 21, 2025

Caution

Review failed

The pull request is closed.

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

agent/src/index.ts

Oops! Something went wrong! :(

ESLint: 9.18.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

📝 Walkthrough

Walkthrough

This pull request introduces the Chainbase plugin for Eliza, expanding the platform's blockchain data interaction capabilities. The changes include adding a new plugin package, updating the agent's configuration, and implementing actions for querying blockchain data and retrieving token balances. The modifications seamlessly integrate Chainbase functionality into the existing system, providing enhanced on-chain data access through natural language queries.

Changes

File Change Summary
.env.example Added Chainbase API key and Instagram configuration parameters
agent/package.json Added @elizaos/plugin-chainbase dependency
agent/src/index.ts Imported Chainbase plugin, conditionally included in agent setup
packages/plugin-chainbase/* Created new plugin package with actions, libraries, and configuration

Possibly related PRs

Suggested Labels

Needs Testing, Plugin_new


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a00f723 and 90a443b.

⛔ Files ignored due to path filters (4)
  • docs/package-lock.json is excluded by !**/package-lock.json
  • packages/core/package-lock.json is excluded by !**/package-lock.json
  • packages/create-eliza-app/package-lock.json is excluded by !**/package-lock.json
  • scripts/jsdoc-automation/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (16)
  • .env.example (1 hunks)
  • agent/package.json (1 hunks)
  • agent/src/index.ts (2 hunks)
  • packages/plugin-chainbase/README.md (1 hunks)
  • packages/plugin-chainbase/eslint.config.mjs (1 hunks)
  • packages/plugin-chainbase/package.json (1 hunks)
  • packages/plugin-chainbase/src/actions/queryData.ts (1 hunks)
  • packages/plugin-chainbase/src/actions/retrieveTokenBalance.ts (1 hunks)
  • packages/plugin-chainbase/src/constants.ts (1 hunks)
  • packages/plugin-chainbase/src/index.ts (1 hunks)
  • packages/plugin-chainbase/src/libs/chainbase.ts (1 hunks)
  • packages/plugin-chainbase/src/templates/index.ts (1 hunks)
  • packages/plugin-chainbase/src/types.ts (1 hunks)
  • packages/plugin-chainbase/src/utils.ts (1 hunks)
  • packages/plugin-chainbase/tsconfig.json (1 hunks)
  • packages/plugin-chainbase/tsup.config.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@lxcong lxcong reopened this Jan 21, 2025
@lxcong lxcong closed this Jan 21, 2025
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.

1 participant