# List Wallets

Retrieve all wallets owned by the authenticated user, with optional chain filtering.

## Overview

Returns the complete wallet portfolio for the current user. Use this endpoint to populate a wallet selector, display a portfolio overview, or find a specific chain's wallet before initiating a transaction. Filter by `chain` when you only need wallets for a specific blockchain.

The `isPrimary` flag identifies the default wallet used for QR code payments. The `isTestnet` filter lets you separate sandbox wallets from production ones.

### `GET /v1/wallets/`

Authentication: bearer token required.

Returns all wallets owned by the authenticated user.

**Query parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | string | no | Filter by chain identifier (e.g. ethereum). A testnet's chain registry id (e.g. `polygon-amoy`) filters by its family chain and also selects the testnet. |
| `limit` | integer | no | Results per page (default: 50) |
| `offset` | integer | no | Pagination offset |
| `isTestnet` | boolean | no | Filter by testnet (true) or mainnet (false) |

**Responses**

`200` OK

```json
{
  "items": [
    {
      "id": "wallet-uuid",
      "chain": "ethereum",
      "address": "0xAbCd...",
      "label": "My ETH Wallet",
      "isPrimary": true,
      "isTestnet": false
    }
  ],
  "total": 3,
  "limit": 50,
  "offset": 0
}
```

## Implementation

```javascript
// Load all wallets for a wallet selector UI
async function listWallets(token, chain = null) {
  const params = new URLSearchParams({ limit: '50' });
  if (chain) params.set('chain', chain);

  const res = await fetch(
    `https://api.aureahub.com/v1/wallets/?${params}`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  const data = await res.json();
  return data.items;
}

// Find the right wallet for a given chain
async function getWalletForChain(token, chain) {
  const wallets = await listWallets(token, chain);
  // Prefer primary, fall back to first available
  return wallets.find(w => w.isPrimary) || wallets[0] || null;
}
```

---

Web version: https://docs.aureahub.com/#wallets-list
