The Ava SDK for JavaScript/TypeScript (`ava-sdk-js`) is a comprehensive toolkit that enables developers to interact with Ava Protocol AVS.
The Ava SDK for JavaScript/TypeScript (ava-sdk-js) is a comprehensive toolkit that enables developers to interact with Ava Protocol's Actively Validated Services (AVS). This SDK serves as a type-safe wrapper around gRPC communication, simplifying the creation, management, and monitoring of blockchain automation workflows. For information about SDK architecture details, see SDK Architecture.
The Ava SDK JS provides developers with:
The SDK bridges the gap between client applications and AVS services, offering a type-safe, developer-friendly experience for both Node.js and browser environments.
Sources:
Diagram: High-level architecture of the Ava SDK JS system
The SDK functions as a middleware between client applications and the Ava Protocol's AVS service. The Client class serves as the primary entry point, offering methods for authentication, workflow management, and service interaction.
Sources:
The ava-sdk-js repository is organized as a monorepo containing multiple packages:
Diagram: Repository structure of ava-sdk-js
The repository contains:
packages/sdk-js: Core SDK implementationpackages/types: TypeScript type definitionsgrpc_codegen: Generated gRPC client code from protocol bufferstests: Test cases and utilitiesSources:
The SDK consists of several key components:
The Client class serves as the main interface for interacting with the AVS service, providing methods for:
authWithSignature, authWithAPIKey)createWorkflow, submitWorkflow, getWorkflows, etc.)getExecution, getExecutions)getWallet, getWallets)createSecret, updateSecret, etc.)Sources:
The SDK supports various node types that can be used within workflows:
| Node Type | Purpose | Example Usage |
|---|---|---|
| ETHTransfer | Send ETH between accounts | Sending funds to a recipient |
| ContractWrite | Write to a smart contract | Creating an account, swapping tokens |
| ContractRead | Read from a smart contract | Checking balances, fetching data |
| RestAPI | Interact with REST APIs | Fetching price data, notifications |
| GraphQLQuery | Query GraphQL endpoints | Fetching on-chain data |
| Branch | Conditional execution | Implementing if/else logic |
| Filter | Filtering data | Processing array data |
| CustomCode | Running custom code | Complex computation, data transformation |
Sources:
Triggers initiate workflow executions based on specific events:
| Trigger Type | Description |
|---|---|
| Block | Executes on specified block intervals |
| Cron | Executes on a cron schedule |
| FixedTime | Executes at specific times |
| Event | Executes in response to events |
Sources:
Diagram: Workflow system class relationships
Workflows are the primary abstraction in the SDK, representing automated processes that execute based on triggers. Each workflow:
Sources:
The SDK employs several technologies for seamless integration:
The SDK abstracts these technologies with a user-friendly API, allowing developers to focus on business logic rather than implementation details.
Sources:
Diagram: Authentication flow in Ava SDK JS
The SDK supports two authentication methods:
After authentication, the SDK stores the auth key and uses it for all subsequent requests.
Sources:
The SDK follows semantic versioning (major.minor.patch) and uses a structured release process:
dev tag for testingThe current release version is 1.4.0, as indicated in the CHANGELOG.md file.
Sources:
The Ava SDK JS provides a comprehensive solution for building automated blockchain workflows using the Ava Protocol ecosystem. It abstracts the complexities of blockchain interaction, authentication, and service communication behind a type-safe, developer-friendly API. The workflow system enables complex automation tasks through a composable node-based architecture, supporting a wide range of use cases from simple token transfers to complex multi-step blockchain operations with external service integration.
Sources: