Skip to content

Getting Started

Integrate Moonwell SDK with just a few lines of code

Overview

Moonwell SDK is a TypeScript library that provides a simple and intuitive way to interact with Moonwell's lending protocol. It offers a comprehensive set of tools for querying market data across multiple networks including Base and Optimism.

Key features:

  • 🔌 Easy network configuration
  • 📊 Real-time market data access
  • 📱 Multi-network support

Installation

npm
npm install @moonwell-fi/moonwell-sdk

Quick Start

1. Set up your Networks & RPC urls

import { createMoonwellClient } from '@moonwell-fi/moonwell-sdk';
 
const moonwellClient = createMoonwellClient({ 
  networks: { 
    base: { 
      rpcUrls: ["https://base.llamarpc.com"], 
    }, 
    optimism: { 
      rpcUrls: ["https://optimism.llamarpc.com"], 
    }, 
  }, 
}); 

2. Consume Actions

Now that you have a Client set up, you can now interact with Base and consume Actions!

import { createMoonwellClient } from "@moonwell-fi/moonwell-sdk";
 
export const moonwellClient = createMoonwellClient({
  networks: {
    base: {
      rpcUrls: ["https://base.llamarpc.com"],
    },
    moonbeam: {
      rpcUrls: ["https://moonbeam.public.blastapi.io"],
    },
  },
});
 
const markets = await moonwellClient.getMarkets(); 

Live Example