-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 more actions to Abstract Plugin #2531
Conversation
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
packages/plugin-abstract/src/actions/deployTokenAction.tsOops! 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. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by 📝 WalkthroughWalkthroughThe pull request introduces significant enhancements to the Abstract plugin, focusing on expanding token-related functionalities. It adds two new actions for token deployment and balance retrieval, updates dependency versions, and refactors utility functions for improved address resolution and token management. The changes aim to provide more comprehensive blockchain interaction capabilities within the plugin ecosystem. Changes
Possibly related PRs
Suggested Labels
Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
🧹 Nitpick comments (4)
packages/plugin-abstract/src/utils/viemHelpers.ts (1)
31-39
: Add retry logic and timeout configurations to HTTP clients.The HTTP clients lack important production-ready configurations.
export const ethereumClient = createPublicClient({ chain: mainnet, - transport: http(), + transport: http({ + timeout: 30000, + retryCount: 3, + retryDelay: 1000, + }), });packages/plugin-abstract/src/actions/deployTokenAction.ts (2)
144-148
: Avoid casting to 'any' to maintain type safetyCasting
abstractClient
toany
bypasses TypeScript's type checking, potentially leading to runtime errors. Consider updating the type definitions to properly represent the return type ofcreateAbstractClient
.
241-241
: Use placeholder values in examplesLine 241 includes a contract address and transaction hash that appear real. Replace them with placeholders to avoid confusion.
Apply this diff:
- text: "Successfully deployed MyToken (MTK) with 1000000 initial supply.\nContract address: 0xdde850f9257365fffffc11324726ebdcf5b90b01c6eec9b3e7ab3e81fde6f14b\nTransaction hash: 0xdde850f9257365fffffc11324726ebdcf5b90b01c6eec9b3e7ab3e81fde6f14b", + text: "Successfully deployed MyToken (MTK) with 1000000 initial supply.\nContract address: <CONTRACT_ADDRESS>\nTransaction hash: <TRANSACTION_HASH>",packages/plugin-abstract/src/actions/transferAction.ts (1)
203-207
: Avoid casting to 'any' to maintain type safetyCasting
abstractClient
toany
bypasses TypeScript's type checking, potentially leading to runtime errors. Consider updating the type definitions to properly represent the return type ofcreateAbstractClient
.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
packages/plugin-abstract/package.json
(1 hunks)packages/plugin-abstract/src/actions/deployTokenAction.ts
(1 hunks)packages/plugin-abstract/src/actions/getBalanceAction.ts
(1 hunks)packages/plugin-abstract/src/actions/index.ts
(1 hunks)packages/plugin-abstract/src/actions/transferAction.ts
(2 hunks)packages/plugin-abstract/src/constants/basicToken.ts
(1 hunks)packages/plugin-abstract/src/constants/index.ts
(0 hunks)packages/plugin-abstract/src/environment.ts
(1 hunks)packages/plugin-abstract/src/hooks/useGetAccount.ts
(1 hunks)packages/plugin-abstract/src/hooks/useGetWalletClient.ts
(1 hunks)packages/plugin-abstract/src/index.ts
(1 hunks)packages/plugin-abstract/src/utils/index.ts
(1 hunks)packages/plugin-abstract/src/utils/validateContext.ts
(0 hunks)packages/plugin-abstract/src/utils/viemHelpers.ts
(1 hunks)
💤 Files with no reviewable changes (2)
- packages/plugin-abstract/src/constants/index.ts
- packages/plugin-abstract/src/utils/validateContext.ts
✅ Files skipped from review due to trivial changes (3)
- packages/plugin-abstract/src/utils/index.ts
- packages/plugin-abstract/src/environment.ts
- packages/plugin-abstract/src/hooks/useGetWalletClient.ts
🧰 Additional context used
🪛 Gitleaks (8.21.2)
packages/plugin-abstract/src/actions/getBalanceAction.ts
54-54: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
packages/plugin-abstract/src/actions/transferAction.ts
61-61: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🔇 Additional comments (7)
packages/plugin-abstract/src/utils/viemHelpers.ts (1)
14-22
: Verify usage of imported types and functions.Several imported entities appear unused in this file.
✅ Verification successful
All imports are actively used in the codebase.
The imported types and functions are used extensively throughout the project for:
- Wallet implementations
- Client configurations
- Account management
- Blockchain interactions
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for usage of potentially unused imports rg -l "Account|Client(?!.*Public)|createClient|createWalletClient|Transport|toAccount" --type tsLength of output: 394
Script:
#!/bin/bash # Search for Account usage rg "Account[^a-zA-Z]" --type ts # Search for Client usage rg "Client[^a-zA-Z]" --type ts # Search for specific function usage rg "(createClient|createWalletClient|toAccount)" --type ts # Search for Transport type usage rg "Transport[^a-zA-Z]" --type ts # Use ast-grep to find type annotations ast-grep --pattern 'type $_ = $_ extends Account' ast-grep --pattern 'type $_ = Transport'Length of output: 68025
packages/plugin-abstract/src/actions/index.ts (1)
2-3
: LGTM! New action exports align with PR objectives.packages/plugin-abstract/src/index.ts (1)
3-3
: LGTM! Plugin configuration properly includes new actions.Also applies to: 8-8
packages/plugin-abstract/src/hooks/useGetAccount.ts (1)
6-10
: Great addition of error handling!The removal of the non-null assertion operator and addition of explicit error handling improves code robustness.
packages/plugin-abstract/src/constants/basicToken.ts (1)
1-331
: Well-structured ERC20 ABI with comprehensive error handling!The ABI includes all standard ERC20 functions, events, and proper error types for common scenarios.
packages/plugin-abstract/package.json (2)
28-29
: LGTM! Development workflow enhancement.Added watch mode for development while maintaining consistent build flags.
22-22
: Verify the major version upgrade of @abstract-foundation/agw-client.The dependency has been upgraded from ^0.1.7 to 1.0.1, which is a major version change that might include breaking changes.
Let's verify the version and check for any known issues:
✅ Verification successful
The upgrade to @abstract-foundation/[email protected] looks safe.
The package is used correctly in transferAction.ts and deployTokenAction.ts, following the documented patterns. The version is current and actively maintained.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check latest version and release info npm view @abstract-foundation/agw-client versions --json | jq -r '.[-1]' npm view @abstract-foundation/agw-client time --json | jq '."1.0.1"' # Check for deprecation warnings npm view @abstract-foundation/agw-client deprecatedLength of output: 232
Script:
#!/bin/bash # Check for CHANGELOG.md in the repository fd -t f -e md -i changelog # Look for migration guides or upgrade notes in docs fd -t f -i -e md upgrade guide migration # Search for breaking changes in commit messages git log --grep="BREAKING CHANGE" --grep="breaking change" --grep="major version" -i --since="2024-01-01"Length of output: 341
Script:
#!/bin/bash # Check package readme npm view @abstract-foundation/agw-client readme # Find usage of the package in the codebase rg -l "@abstract-foundation/agw-client" --type ts --type js # Look for imports or requires of this package ast-grep --pattern 'import $_ from "@abstract-foundation/agw-client"' ast-grep --pattern 'require("@abstract-foundation/agw-client")'Length of output: 6393
Love this |
* upstream/develop: test configuration and tests for client-lens (elizaOS#2534) chore(attempt): optimize pnpm cache configuration (elizaOS#2556) feat: add a way to create/store/restore agents in the filesystem (elizaOS#2389) chore: optimize pnpm cache configuration (elizaOS#2555) chore: remove cleanup step from integration tests workflow (elizaOS#2553) feat: Add more actions to Abstract Plugin (elizaOS#2531) feat: add anthropic image provider for vision (elizaOS#2524) feat: improve integrationtests workflow caching (elizaOS#2551) feat: Updated READ.me file with pre-requisites to enable telegram bot (elizaOS#2547) feat(plugin-devin): implement client-agnostic Devin plugin (elizaOS#2549) use generateObject handle undefined env variable feat:add plugin-lightning (elizaOS#2429)
abstract.plugin.mp4
Relates to
Follow up on #2207
Risks
Low
Background
What does this PR do?
What kind of change is this?
Improvements
Documentation changes needed?
Testing
Where should a reviewer start?
Detailed testing steps
Discord username
@0xheavydev
Summary by CodeRabbit
Release Notes
New Features
Improvements
Changes