Earn SDK Overview
@surgecredit/earn-sdk is a JavaScript/TypeScript SDK for wallet teams and frontend apps that want to integrate Surge earn markets on Base Sepolia.
What the SDK gives you
- Market discovery (
listMarkets) with APR, TVL, utilization, LTV, and reserve data. - User position reads (
getUserPosition) including deposited value and LP token balance. - Exposure reads (
getUserExposures) to show per-market allocation and target exposure. - Transaction helpers for approve, deposit, withdraw, and exposure updates.
- Write methods support both injected wallets and local account signers (mnemonic/private-key wallets).
- React hooks (
@surgecredit/earn-sdk/react) for easy frontend state integration.
LP behavior:
- Deposits mint LP position in the shared pool.
- Exposure settings control whether new allocation favors variable or fixed markets.
Default network configuration
The SDK ships with a default Base Sepolia config:
- Liquidity Pool:
0xA40C833639803132D409E344d1CB9A9DD5aAB411 - USDC:
0x036CbD53842c5426634e7929541eC2318f3dCF7e
You can override both addresses if you deploy to a new environment.
Install
npm install @surgecredit/earn-sdk@latest viemQuick start
import { baseSepolia } from "viem/chains";
import {
SurgeEarnClient,
SURGE_BASE_SEPOLIA_CONFIG,
createSurgeEarnPublicClient,
} from "@surgecredit/earn-sdk";
const publicClient = createSurgeEarnPublicClient("https://sepolia.base.org", baseSepolia);
const earn = new SurgeEarnClient({
publicClient,
config: SURGE_BASE_SEPOLIA_CONFIG,
});
const markets = await earn.listMarkets();Next step
Use the full Integration Guide to wire wallet flows (approve/deposit/withdraw) and optional React hooks.