Skip to content

Morpho SDKs

The Morpho Software Development Kits (SDKs) are a comprehensive suite of TypeScript packages designed to streamline development on the Morpho protocol. Whether you're building a full-featured DeFi application, a liquidation bot, or a simple data dashboard, these SDKs provide the tools you need to interact with Morpho's onchain and offchain ecosystems efficiently.

The SDKs are built with a modular, framework-agnostic core and offer powerful integrations for modern tools like Viem and Wagmi.

The SDK Stack

The SDKs are organized into logical layers, allowing you to pick and choose the packages that best fit your needs.

Core Packages

These framework-agnostic packages form the foundation of the Morpho SDK ecosystem.

  • @morpho-org/blue-sdk: The heart of the stack. Defines core entity classes like Market, Vault, and Position, and handles essential offchain computations.
  • @morpho-org/simulation-sdk: A powerful engine for simulating user interactions like supplying, borrowing, or depositing into vaults before executing them onchain.
  • @morpho-org/blue-api-sdk: A GraphQL client for fetching data directly from the Morpho API, complete with types and an Apollo cache controller.

Viem Integration Packages

These packages augment the core SDKs with Viem-based fetchers for seamless onchain interaction.

  • @morpho-org/blue-sdk-viem: Extends @morpho-org/blue-sdk with methods to fetch live market and position data from the blockchain using Viem.
  • @morpho-org/bundler-sdk-viem: The key to building powerful, one-click user experiences. It transforms simple actions into atomic, gas-efficient transactions.
  • @morpho-org/liquidity-sdk-viem: Simplifies calculations for available liquidity, including funds accessible via the Public Allocator.
  • @morpho-org/liquidation-sdk-viem: Provides utilities to build robust, Viem-based liquidation bots.

Wagmi (React) Integration Packages

Designed for frontend developers, these packages provide React hooks for fetching Morpho data in your application.

  • @morpho-org/blue-sdk-wagmi: A set of Wagmi hooks for fetching Morpho-related entities.
  • @morpho-org/simulation-sdk-wagmi: Wagmi hooks for fetching and managing simulation states in a React environment.

Featured Use Case: Building One-Click Actions with the Bundler SDK

The Bundler SDK is the powerhouse for creating seamless user experiences. It allows you to abstract away the complexities of multi-step DeFi operations (like token approvals, wrapping, and supplying) into a single, atomic transaction.

For example, a user can supply ETH as collateral and borrow USDC against it in one click, without needing to perform separate transactions for wrapping ETH to WETH, approving WETH, supplying collateral, and finally borrowing.

To learn how to integrate the Bundler, follow this path:

  1. Understand the Concept: Start with an overview of what Bundlers do in the Getting Started with Bundlers guide.
  2. The Core Functionality: See how multiple calls are batched in the multicall function specification.
  3. How to Combine Actions: Learn to encode and combine various protocol actions in the Combine Actions Tutorial.
  4. Full Integration Guide: Walk through a complete example of integrating the Bundler SDK into an application in the App Integration Guide.

Product-Specific Examples

Getting Started

Ready to build?