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

# Wallets

> SDK methods for creating and managing wallets

Create and manage blockchain wallets for profiles and organizations. Wallets are associated with specific blockchain networks.

## Methods

### `createWallet()`

Create a new wallet for a profile.

**Signature:**

```typescript theme={null}
createWallet(
  request: CreateWalletRequest,
  requestOptions?: RequestOptions
): Promise<CreateWalletResponse>
```

**Parameters:**

| Parameter           | Type     | Required | Description                       |
| ------------------- | -------- | -------- | --------------------------------- |
| `request.reference` | `string` | Yes      | Profile reference                 |
| `request.networkId` | `string` | Yes      | Network ID (from `getNetworks()`) |

**Example:**

```typescript theme={null}
const wallet = await client.wallets.createWallet({
  reference: 'user-123',
  networkId: 'your-network-id'
});

console.log('Wallet ID:', wallet.data.data?.id);
console.log('Wallet reference:', wallet.data.data?.reference);
console.log('Network ID:', wallet.data.data?.networkId);
```

***

### `getWalletsByProfile()`

Get all wallets for a specific profile.

**Signature:**

```typescript theme={null}
getWalletsByProfile(
  reference: string,
  request?: GetWalletsByProfileRequest,
  requestOptions?: RequestOptions
): Promise<WalletsResponse>
```

**Parameters:**

| Parameter      | Type     | Required | Description                   |
| -------------- | -------- | -------- | ----------------------------- |
| `reference`    | `string` | Yes      | Profile reference             |
| `request.skip` | `number` | No       | Number of records to skip     |
| `request.take` | `number` | No       | Number of records to retrieve |

**Example:**

```typescript theme={null}
const wallets = await client.wallets.getWalletsByProfile('user-123', {
  skip: 0,
  take: 50
});

console.log('Profile wallets:', wallets.data.data);
```

***

### `getWalletsForOrganization()`

Get all wallets for the organization.

**Signature:**

```typescript theme={null}
getWalletsForOrganization(
  request: GetWalletsForOrganizationRequest,
  requestOptions?: RequestOptions
): Promise<WalletsResponse>
```

**Parameters:**

| Parameter      | Type     | Required | Description                   |
| -------------- | -------- | -------- | ----------------------------- |
| `request.skip` | `number` | No       | Number of records to skip     |
| `request.take` | `number` | No       | Number of records to retrieve |

**Example:**

```typescript theme={null}
const wallets = await client.wallets.getWalletsForOrganization({
  skip: 0,
  take: 100
});

console.log('Organization wallets:', wallets.data.data);
```

<Tip>
  **Note**: When using `createAddressV2()`, wallets are automatically created if they don't exist, so you may not need to explicitly create wallets in most cases.
</Tip>

## Complete Example

```typescript theme={null}
import { OumlaSdkApiClient, OumlaSdkApiEnvironment } from '@oumla/sdk';

const client = new OumlaSdkApiClient({
  environment: OumlaSdkApiEnvironment.Sandbox,
  apiKey: 'your-api-key'
});

async function manageWallets() {
  // Get available networks
  const networks = await client.networks.getNetworks({ skip: 0, take: 50, enabled: true });
  const networkId = networks.data.networks[0].id;

  // Create a wallet
  const wallet = await client.wallets.createWallet({
    reference: 'user-123',
    networkId
  });

  console.log('Created wallet for reference:', wallet.data.data?.reference);

  // Get all wallets for a profile
  const profileWallets = await client.wallets.getWalletsByProfile('user-123');

  console.log('Profile has', profileWallets.data.data?.length ?? 0, 'wallets');

  // Get all organization wallets
  const orgWallets = await client.wallets.getWalletsForOrganization({
    skip: 0,
    take: 100
  });

  console.log('Organization has', orgWallets.data.data?.length ?? 0, 'wallets');
}
```
