A powerful plugin to interact with smart contracts using Gelato Relay, supporting both ERC2771 (meta transactions) and non-ERC2771 calls on any EVM-compatible blockchain.
- Sponsored Calls: Interact with contracts without needing gas on the user's side.
- ERC2771 Support: Execute meta-transactions via Gelato's
sponsoredCallERC2771
. - Customizable: Easily configure chains, contracts, and user-specific settings.
- pnpm
- A Gelato Relay API key
pnpm install elizaos/plugin-gelato
Fill out the .env
file in the project root with the following variables:
GELATO_RELAY_API_KEY=<Your Gelato Relay API Key>
EVM_PROVIDER_URL=<Your EVM provider URL (e.g., Alchemy or Infura endpoint)>
EVM_PRIVATE_KEY=<Your wallet's private key>
Call increment() on 0x3890DB55ff538FBF281c9152820A4a748f5D6F21 contract:
- Function Name: increment
- Args: []
- Target: 0x3890DB55ff538FBF281c9152820A4a748f5D6F21
- Chain: arbitrumSepolia
- ABI: ["function increment()"]
Call increment() on 0x00172f67db60E5fA346e599cdE675f0ca213b47b contract:
- Function Name: increment
- Args: []
- Target: 0x00172f67db60E5fA346e599cdE675f0ca213b47b
- Chain: arbitrumSepolia
- ABI: ["function increment()"]
- User: 0xYourAddressHere
For both scenarios, successful execution returns:
✅ Contract interaction successful!
- Function: increment
- Target: 0x<contract_address>
- Chain: arbitrumSepolia
- Task ID: <task_id>
- Track Status: [View Task](https://relay.gelato.digital/tasks/status/<task_id>)
-
utils.ts
: Contains functions forsponsoredCall
andsponsoredCallERC2771
. -
schemas.ts
: Defines Zod schemas to validate user input. -
actionsContractInteraction.ts
: Contains the action logic, including parsing natural language input and invoking Gelato Relay.
- Update your
.env
file with valid keys. - Test both ERC2771 and non-ERC2771 prompts using the examples above.
- Ensure your
.env
file is properly configured. - Verify that your contract ABI, function name, and chain match the deployed contract details.
- For ERC2771 calls, confirm the
User
address is correct and matches the expected_msgSender
logic in the contract.
This plugin is licensed under the MIT License. See the LICENSE
file for details.