Skip to main content

Breeze SDK

A comprehensive TypeScript SDK for interacting with the Breeze API, providing a clean interface for user yield tracking, balance management, and transaction handling.

Installation

Quick Start

API Reference

BreezeSDK Class

The main SDK class that provides a convenient interface to all API endpoints.

Constructor

BreezeSDKConfig:
  • apiKey: string - Your API authentication key (required)
  • baseUrl?: string - Base URL for the API (default: ‘https://api.breeze.baby/’)
  • timeout?: number - Request timeout in milliseconds (default: 30000)

Methods

User Operations
getUserYield(options) Get user yield data with pagination.
getUserBalances(options) Get user balance information with asset filtering and sorting.
getBreezeBalances(options) Get breeze-specific balance information with strategy details, including position values, yields, and APY data.
Strategy Operations
getStrategyInfo(strategyId) Get detailed information about a specific strategy, including supported assets and APY data per asset.
Transaction Operations
createDepositTransaction(options) Create a deposit transaction. Required parameters: strategyId, baseAsset (mint address), amount, userKey.
createWithdrawTransaction(options) Create a withdraw transaction. Required parameters: strategyId, baseAsset (mint address), amount, userKey.
getDepositInstructions(options) Get Solana transaction instructions for deposits. Required parameters: strategyId, baseAsset (mint address), amount, userKey.
getWithdrawInstruction(options) Get Solana transaction instruction for withdrawals. Required parameters: strategyId, baseAsset (mint address), amount, userKey.
Close User Account Operations
createCloseUserAccountTransaction(options) Close a user account and return a serialized transaction. You can identify the account by userPubkey + strategyId + mint.
getCloseUserAccountInstructions(options) Get Solana instructions for closing a user account. Same parameters as above.
Health Check
getHealth() Check if the API server is healthy.
Utility Methods
updateApiKey(newApiKey: string) Update the API key used for authentication.
getApiClient() Get the underlying ApiClient instance for advanced usage.

Complete Example

Transaction Signing and Execution

For executing transactions on Solana, you’ll need to sign and send them:

Low-Level API

For advanced use cases, you can use the individual functions and ApiClient directly:

Required API Endpoint

The SDK requires access to the Breeze API at: Base URL: https://api.breeze.baby/ Make sure your API key has access to the following endpoints:
  • GET /user-yield/{user_id} - User yield data retrieval
  • GET /user-balances/{user_id} - User balance information
  • GET /breeze-balances/{user_id} - Breeze-specific balance information with strategy details
  • GET /strategy-info/{strategy_id} - Strategy information and APY data
  • POST /deposit/tx - Deposit transaction creation
  • POST /withdraw/tx - Withdraw transaction creation
  • POST /deposit/ix - Deposit instruction generation
  • POST /withdraw/ix - Withdraw instruction generation
  • POST /close-user-account/tx - Close user account transaction creation
  • POST /close-user-account/ix - Close user account instruction generation
  • GET /health - Health check

Error Types

  • BreezeApiError: Thrown for API-related errors
    • message: string - Error message
    • status?: number - HTTP status code
    • code?: string - Error code (‘TIMEOUT’, ‘NETWORK_ERROR’, etc.)
    • response?: any - Full error response from the API

TypeScript Support

The SDK is written in TypeScript and provides full type definitions:

Testing

Integration Tests

Run integration tests against real API server:

Example Scripts

Test the SDK with example scripts: Check the examples out, in the packages/sdk/examples

API Endpoints

The SDK interacts with these API endpoints:

GET Endpoints

  • GET /user-yield/{user_id} - Get user yield data (supports pagination)
  • GET /user-balances/{user_id} - Get user balance information (supports asset filtering and sorting)
  • GET /breeze-balances/{user_id} - Get breeze balances with strategy details (requires strategyId, supports asset filtering, sorting, and pagination)
  • GET /strategy-info/{strategy_id} - Get strategy information including assets and APY data

POST Endpoints

  • POST /deposit/tx - Create deposit transaction (requires strategyId, baseAsset, amount, userKey)
  • POST /withdraw/tx - Create withdraw transaction (requires strategyId, baseAsset, amount, userKey)
  • POST /deposit/ix - Get deposit instructions (requires strategyId, baseAsset, amount, userKey)
  • POST /withdraw/ix - Get withdraw instruction (requires strategyId, baseAsset, amount, userKey)
  • POST /close-user-account/tx - Close user account transaction (requires userPubkey+strategyId+mint)
  • POST /close-user-account/ix - Close user account instructions (requires userPubkey+strategyId+mint)
  • GET /health - Health check

Development

Building

Example Usage

The SDK includes comprehensive examples in the examples/ directory:
  1. basic-usage.ts - Simple SDK initialization and basic method calls
  2. integration-flow.ts - Complete transaction flow with Solana execution
  3. integration-flow-simple.ts - API demonstration without transaction execution

Project Structure