SDK Architecture

This document provides a high-level overview of the Ava SDK's architecture, explaining the core components and how they interact with each other.

This document provides a high-level overview of the Ava SDK's architecture, explaining the core components and how they interact with each other. The SDK serves as a bridge between client applications and the Ava Protocol's AVS (Actively Validated Services), enabling developers to create, manage, and monitor workflows.

For authentication methods, see Authentication. For detailed information about workflows, see Workflow System.

1. Architectural Overview#

The Ava SDK JS is designed with a layered architecture that abstracts the complexity of gRPC communication with the AVS service. At its core, the SDK consists of a Client class that exposes a user-friendly API, factories for creating workflow components, and type definitions for ensuring type safety.

SDK Architecture Diagram#

Sources:

2. Core Components#

The SDK consists of several core components that work together to provide a seamless experience for developers.

2.1 Client Class#

The Client class is the main entry point for interacting with the AVS service. It handles authentication, workflow management, execution tracking, and secret management.

Sources:

2.2 Factory Classes#

The SDK provides factory classes for creating workflow components:

  1. NodeFactory: Creates different types of nodes for workflows
  2. TriggerFactory: Creates different types of triggers for workflows

Sources:

2.3 Type System#

The SDK uses a separate @avaprotocol/types package to define type definitions for workflows, nodes, triggers, and other components. This ensures type safety and reduces errors during development.

Sources:

3. Communication Layer#

The SDK uses gRPC for communication with the AVS service. This provides efficient, type-safe communication with strong contract guarantees.

gRPC Communication Flow#

Sources:

4. Workflow Architecture#

Workflows are the core concept in the Ava SDK. A workflow consists of nodes (tasks) connected by edges (relationships) and is initiated by a trigger.

Workflow Structure#

Sources:

Node Types#

The SDK supports various node types for different operations:

Sources:

Trigger Types#

Workflows can be initiated by various trigger types:

Sources:

Execution Model#

When a workflow is executed, it creates an execution record that contains steps corresponding to the execution of individual nodes:

Sources:

5. Authentication Mechanisms#

The SDK supports two methods of authentication:

  1. Signature-based Authentication: Uses a cryptographic signature for authentication
  2. API Key Authentication: Uses an API key for authentication

Sources:

6. Smart Wallet Integration#

The SDK integrates with smart wallet functionality, allowing workflows to execute blockchain transactions:

Sources:

7. Secret Management#

The SDK provides functionality for managing secrets that can be used in workflows:

Sources:

8. Development and Testing#

The SDK includes comprehensive testing capabilities to ensure reliability:

Sources: