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

What the SDK Provides

Component
Purpose

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

  1. Setup - Installation, SDK initialization, basic configuration

  2. Reading Data - Market queries, account state, pool data

  3. Credit Accounts - Account operations via services

  4. Multicalls - Building and executing multicalls

When to Use the SDK

Use Case
Recommended

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:


Detailed Guides

Multicall Operations

Complete reference for each multicall operation with TypeScript examples:

Operation
Description

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:

Building
Guide
Focus

Web UI / Dashboard

Data display, real-time updates

Analytics / Indexer

Historical data, event indexing

Liquidation Bot

Monitoring, Router execution

Last updated