> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xmonaco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# V0.3.1

# Monaco Protocol SDK v0.3.1

## Balance Management Enhancements

This release adds new SDK methods for querying user token balances, building on the v0.3.0 foundation. These additions provide more flexible and efficient ways to access account balance information.

### What's New

**Balance Query Methods**

* **Paginated Balance Listing**: New `getUserBalances()` method with pagination support
* **Individual Token Balance**: New `getUserBalanceByToken()` method for single-token queries
* **Enhanced Balance Details**: Returns available, locked, and total balance for each token

### Technical Details

**Get All User Balances (Paginated)**

Query all token balances for the authenticated user with pagination:

```typescript theme={null}
// Get first 20 balances
const response = await sdk.profile.getUserBalances({ 
  limit: 20, 
  offset: 0 
});

console.log('Total balances:', response.total);
response.balances.forEach(balance => {
  console.log(`${balance.symbol}: ${balance.total_balance}`);
});
```

**Get Balance for Specific Token**

Query balance for a single token address:

```typescript theme={null}
// Get balance for a specific token
const balance = await sdk.profile.getUserBalanceByToken(
  '0x23e459c24c4925ba89205c400dceca7abc11723d'
);

console.log(`${balance.symbol}:`, {
  available: balance.available_balance,
  locked: balance.locked_balance,
  total: balance.total_balance
});
```

**Response Structure**

Both methods return detailed balance information:

```typescript theme={null}
interface AccountBalance {
  token: string;           // Token address (0x format)
  symbol: string;          // Token symbol (e.g., 'USDC')
  decimals: number;        // Token decimal places
  available_balance: string;  // Available for trading
  locked_balance: string;     // Locked in active orders
  total_balance: string;      // Total (available + locked)
}
```

### Use Cases

**Portfolio Dashboard**

```typescript theme={null}
// Display all token holdings
const { balances } = await sdk.profile.getUserBalances({ limit: 100 });
const portfolio = balances.map(b => ({
  asset: b.symbol,
  value: parseFloat(b.total_balance),
  inOrders: parseFloat(b.locked_balance)
}));
```

**Pre-Trade Balance Check**

```typescript theme={null}
// Check if user has sufficient balance before placing order
const usdcBalance = await sdk.profile.getUserBalanceByToken(usdcAddress);
if (parseFloat(usdcBalance.available_balance) >= orderAmount) {
  await sdk.trading.placeMarketOrder(/* ... */);
}
```

**Infinite Scroll Balance List**

```typescript theme={null}
// Load balances in chunks for UI
let offset = 0;
const limit = 20;
let hasMore = true;

while (hasMore) {
  const response = await sdk.profile.getUserBalances({ limit, offset });
  displayBalances(response.balances);
  offset += limit;
  hasMore = offset < response.total;
}
```

### Packages Updated

* `@0xmonaco/core@0.3.1`
* `@0xmonaco/types@0.3.1`
* `@0xmonaco/react@0.3.1`

### Installation

```bash theme={null}
npm install @0xmonaco/core@0.3.1
npm install @0xmonaco/react@0.3.1  # For React applications
```

### Migration Notes

This is a backward-compatible release. No breaking changes from v0.3.0:

* All v0.3.0 features continue to work unchanged
* New balance methods are additive - existing `getProfile()` method still works
* Existing code requires no modifications to upgrade

### Documentation

* [Profile SDK Methods](/sdk/typescript/profile) - Complete profile and balance documentation
* [v0.3.0 Release Notes](/releases/v0.3.0) - Previous release with orderbook and fee enhancements

### Related Backend Changes

This SDK release corresponds to backend API enhancements:

* New `GET /api/v1/accounts/balances` endpoint (paginated)
* New `GET /api/v1/accounts/balances/:token` endpoint (individual token)
* Performance optimizations for balance queries


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.