Overview
The Gearbox SDK provides typed access to protocol state and operations. It wraps contract calls, handles encoding, and provides cached market data through a clean TypeScript interface.
Prerequisites
Node.js 18+
Basic familiarity with viem
Understanding of async/await patterns
What the SDK Provides
GearboxSDK
Main entry point with attach() initialization
marketRegister
Cached market data access
addressProvider
Contract discovery wrapper
Plugins
Extended functionality (AccountsPlugin, AdaptersPlugin)
Services
Credit account operations and multicall helpers
Guide Structure
Setup - Installation, SDK initialization, basic configuration
Reading Data - Market queries, account state, pool data
Credit Accounts - Account operations via services
Multicalls - Building and executing multicalls
When to Use the SDK
Frontend applications
Yes
Analytics dashboards
Yes
Liquidation bots
Yes (or direct compressor calls)
Backend services
Yes
On-chain contracts
No (use Solidity Guide)
The SDK handles ABI management, type conversions, and caching internally. For on-chain integrations or gas-optimized bot implementations, consider the Solidity Guide.
Architecture Understanding
For conceptual background on how Gearbox works:
Credit Suite Architecture - How Credit Managers, Facades, and Configurators work together
Pool Architecture - Lending pools and ERC-4626 compliance
Multicall System - How multicalls execute and validate
Detailed Guides
Multicall Operations
Complete reference for each multicall operation with TypeScript examples:
Transfer tokens to credit account
Borrow and repay
Manage collateral quotas
Remove tokens from account
Protect against price movement
Interact with DeFi protocols
Manage active collateral
On-demand oracle updates
Optimize health checks
Security cleanup
See Multicalls Overview for building and executing multicalls.
Use Case Guides
Application-specific guides for common development scenarios:
Last updated
