Development Environment
This document provides information on setting up a development environment for the AVA SDK JavaScript repository.
This document provides information on setting up a development environment for the AVA SDK JavaScript repository. It covers prerequisites, repository setup, build processes, and environment configurations necessary for developing, testing, and contributing to the SDK.
For information about building and running tests, see Building and Testing.
Prerequisites#
Before starting development with the AVA SDK JS repository, ensure you have the following prerequisites installed:
Required Tools#
- Node.js: Version 20.18.0 or higher
- Yarn: Version 1.22.19 or higher
- Git: For repository cloning and version control
Sources:
Repository Setup#
Clone and Install#
To set up the development environment:
Repository Structure#
The AVA SDK JS repository is organized as a monorepo using Yarn workspaces.
Sources:
Build Process#
Building the SDK#
To build the SDK, run:
This will build all packages in the monorepo. To clean the build artifacts, run:
Sources:
Working with gRPC#
The SDK uses gRPC for communication with the AVS service. The repository includes scripts for downloading the latest protobuf definitions and generating gRPC code.
To download the latest protobuf definitions and generate gRPC code:
Sources:
Testing#
Test Configuration#
The test configuration is defined in jest.config.cjs
, which specifies the test directory, transformation settings, and module mappings.
To run all tests:
To run specific tests:
Sources:
Working with Examples#
The examples directory contains sample code demonstrating how to use the SDK. These examples can be run against different environments.
Running Examples#
Environment Configuration#
The examples configuration (config.ts
) defines settings for different environments:
Each environment configuration includes:
- AVS RPC endpoint
- Test transfer token address
- Transfer recipient address
- Oracle price contract address
- RPC provider URL
- Factory address
Sources:
Local Development Environment#
For local development, you can set up a development environment that runs on your local machine.
To set up a local development environment:
-
Follow the instructions in the EigenLayer-AVS repository to set up a local AVS service.
-
Generate an API key for testing:
-
Use the development environment configuration in examples:
Sources:
TypeScript Configuration#
The TypeScript configuration is defined in tsconfig.json
and specifies compilation settings:
-
Target: ES2020
-
Module: ESNext
-
Module Resolution: Node
-
Root Directory: ./
-
Base URL: .
-
Path Mappings:
- @/grpccodegen/: grpccodegen/
- @avaprotocol/sdk-js: packages/sdk-js/src/*
- @avaprotocol/types: packages/types/*
For examples, a separate TypeScript configuration is used:
- Module: CommonJS
- Target: ES6
- ES Module Interop: true
Sources:
Code Quality Tools#
The repository uses ESLint for code quality enforcement, with configuration in eslint.config.mjs
. The configuration includes:
- JavaScript ESLint recommended rules
- TypeScript ESLint recommended rules
- Custom rules:
- Maximum line length: 256 characters (ignoring URLs)
Sources:
Relationship to Ava Protocol Ecosystem#
The development environment is part of the larger Ava Protocol ecosystem, which includes:
- Local development environment for SDK development
- Test environments on Sepolia and Base Sepolia networks
- Production environments on Ethereum and Base networks
Sources:
Summary#
Setting up a development environment for the AVA SDK JS repository involves:
- Installing the required Node.js and Yarn versions
- Cloning the repository and installing dependencies
- Understanding the monorepo structure and build process
- Configuring the appropriate environment for testing
- Using the provided scripts for building, testing, and running examples
This setup allows developers to contribute to the SDK, test changes, and experiment with the Ava Protocol's functionality in various environments.