Lagoon SDKs

The Lagoon SDKs are a collection of TypeScript libraries designed to simplify interactions with Lagoon Vaults. They offer modular, framework-agnostic core functionality that makes it easy to integrate Vault operations into any application.

Their architecture is inspired by Morpho’s SDK design principles, combining clean abstractions with specialized modules for popular web3 libraries to streamline development workflows

Overview

The SDK consists of two main packages:

  • @lagoon-protocol/v0-core - Framework-agnostic vault entities and utilities

  • @lagoon-protocol/v0-viem - Viem-based extensions for seamless blockchain interactions

This library will evolve in the near future. We are actively listening to emerging integration needs and are open to discussions around external contributions.

Features

The SDKs have a modular architecture that cleanly separates core logic from blockchain interaction layers, enabling seamless integration across diverse environments, from frontend applications to backend services.

The core package provides:

  • Token class for ERC20 token handling

export interface IToken {
  address: Address;
  name?: string;
  symbol?: string;
  decimals?: BigIntish;
  price?: BigIntish;
  totalSupply: bigint;
}
  • Vault class for vault state management

  • VaultUtils for common calculations

  • Chain addresses and configuration constants

The Viem integration package provides:

  • Blockchain data fetching capabilities

  • Seamless integration with Viem clients

Quick Start

Installation

Choose the package that fits your needs:

Example: Calculate Vault APR

This is for example purpose only.

Last updated