Client SDK and Examples
This page documents the client SDKs for interacting with the EigenLayer-AVS system and provides examples of their usage.
This page documents the client SDKs for interacting with the EigenLayer-AVS system and provides examples of their usage. The SDK allows developers to create applications that communicate with the Aggregator service, manage tasks, interact with smart wallets, and utilize the distributed task execution capabilities of the EigenLayer-AVS network.
For information about the Aggregator component itself, see Aggregator.
SDK Overview#
The EigenLayer-AVS system currently provides a JavaScript/Node.js client SDK for interacting with the Aggregator service. The SDK is built on top of gRPC and provides a simple interface for performing all operations supported by the Aggregator.
Sources:
Installation and Setup#
To use the JavaScript SDK, you need to install the required dependencies:
Then you can import the SDK in your application:
SDK Configuration#
The SDK requires configuration to connect to the appropriate Aggregator endpoint based on your environment:
Sources:
SDK Architecture#
The SDK is composed of several core components that handle different aspects of interacting with the EigenLayer-AVS system:
gRPC Client#
The SDK uses gRPC to communicate with the Aggregator service. The gRPC client is initialized with the appropriate endpoint:
Authentication#
The SDK implements an authentication mechanism using wallet signatures to authenticate with the Aggregator:
Sources:
Core SDK Functions#
The JavaScript SDK provides several core functions for interacting with the Aggregator service:
Authentication and Key Management#
generateApiToken()
- Generates an API token for authenticating subsequent requests
Smart Wallet Management#
getWallets()
- Lists all smart wallets owned by the usercreateWallet()
- Creates a new smart wallet with the specified salt
Task Management#
createTask()
- Creates a new tasklistTask()
- Lists all tasks created by specified smart walletsgetTask()
- Gets details of a specific taskcancelTask()
- Cancels a running taskdeleteTask()
- Permanently deletes a task
Task Execution#
triggerTask()
- Manually triggers a task executionlistExecutions()
- Lists all executions of a taskgetExecution()
- Gets details of a specific execution
Sources:
Task Data Model#
The SDK interacts with the Task data model, which consists of:
Sources:
Example: Creating and Authenticating a Client#
Sources:
Example: Managing Smart Wallets#
Sources:
Example: Creating a Task#
The following example demonstrates creating a task that monitors a price oracle and triggers a notification:
Example code:
Sources:
Example: Advanced Task with Event Monitoring#
The following example shows how to create a task that monitors blockchain events and sends notifications:
Sources:
Example: Monitoring External API Services#
This example demonstrates how to create a task that periodically monitors AAVE liquidity rates using GraphQL and REST APIs:
Sources:
SDK Task Management Operations Table#
The following table summarizes the main task management operations available in the SDK:
Operation | Function | Description |
---|---|---|
Create Task | createTask | Creates a new task with specified nodes, edges, and trigger |
List Tasks | listTask | Lists tasks created by specified smart wallets |
Get Task | getTask | Gets details of a specific task by ID |
Trigger Task | triggerTask | Manually triggers execution of a task |
Cancel Task | cancelTask | Cancels a running task |
Delete Task | deleteTask | Permanently deletes a task |
Sources:
Available Trigger Types#
The SDK supports various trigger types for tasks:
Trigger Type | Description | Example |
---|---|---|
Manual | Task must be manually triggered by the user | { manual: true } |
Block | Task triggered at specified block intervals | { block: { interval: 2 } } |
Cron | Task triggered according to cron schedule | { cron: { schedule: ["0 */5 * * *"] } } |
Fixed Time | Task triggered at specific timestamps | { fixed_time: { epochs: [timestamp1, timestamp2] } } |
Event | Task triggered when specified blockchain events occur | { event: { expression: "trigger1.data.topics[0] == 0x..." } } |
Sources:
Node Types#
The SDK supports various node types for task execution:
Node Type | Description | Example Use Case |
---|---|---|
ContractWrite | Executes a write operation on a smart contract | Token transfers, contract state updates |
ContractRead | Reads data from a smart contract | Reading token balances, contract state |
RestAPI | Makes HTTP requests to REST APIs | Fetching external data, sending notifications |
GraphQLQuery | Executes GraphQL queries | Fetching data from Graph Protocol |
Branch | Conditional logic for task flow | Executing actions based on conditions |
CustomCode | Executes custom JavaScript code | Data transformation, complex calculations |
Sources:
Testing and Debugging Tasks#
The SDK provides several methods to debug and monitor task executions:
listExecutions()
- Lists all executions of a taskgetExecution()
- Gets detailed execution information, including steps and results- Console logging - The example code includes extensive console logging for debugging
For detailed information about task execution and monitoring, see Task Engine.
Sources:
Feature this wiki to auto refresh weekly
Try DeepWiki on your private codebase with Devin