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.
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:
To use the JavaScript SDK, you need to install the required dependencies:
Then you can import the SDK in your application:
The SDK requires configuration to connect to the appropriate Aggregator endpoint based on your environment:
Sources:
The SDK is composed of several core components that handle different aspects of interacting with the EigenLayer-AVS system:
The SDK uses gRPC to communicate with the Aggregator service. The gRPC client is initialized with the appropriate endpoint:
The SDK implements an authentication mechanism using wallet signatures to authenticate with the Aggregator:
Sources:
The JavaScript SDK provides several core functions for interacting with the Aggregator service:
generateApiToken() - Generates an API token for authenticating subsequent requestsgetWallets() - Lists all smart wallets owned by the usercreateWallet() - Creates a new smart wallet with the specified saltcreateTask() - 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 tasktriggerTask() - Manually triggers a task executionlistExecutions() - Lists all executions of a taskgetExecution() - Gets details of a specific executionSources:
The SDK interacts with the Task data model, which consists of:
Sources:
Sources:
Sources:
The following example demonstrates creating a task that monitors a price oracle and triggers a notification:
Example code:
Sources:
The following example shows how to create a task that monitors blockchain events and sends notifications:
Sources:
This example demonstrates how to create a task that periodically monitors AAVE liquidity rates using GraphQL and REST APIs:
Sources:
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:
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:
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:
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 resultsFor detailed information about task execution and monitoring, see Task Engine.
Sources:
Feature this wiki to auto refresh weekly