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:
createWallet(
request: CreateWalletRequest,
requestOptions?: RequestOptions
): Promise<CreateWalletResponse>
Parameters:
| Parameter | Type | Required | Description |
|---|
request.reference | string | Yes | Profile reference |
request.network | 'BTC' | 'tBTC' | 'ETH' | 'tETH' | Yes | Blockchain network |
Example:
const wallet = await client.wallets.createWallet({
reference: 'user-123',
network: 'ETH'
});
console.log('Wallet ID:', wallet.data.id);
console.log('Network:', wallet.data.network);
getWalletsByProfile()
Get all wallets for a specific profile.
Signature:
getWalletsByProfile(
request: GetWalletsByProfileRequest,
requestOptions?: RequestOptions
): Promise<WalletsResponse>
Parameters:
| Parameter | Type | Required | Description |
|---|
request.reference | string | Yes | Profile reference |
request.skip | number | No | Number of records to skip |
request.take | number | No | Number of records to retrieve |
Example:
const wallets = await client.wallets.getWalletsByProfile({
reference: 'user-123',
skip: 0,
take: 50
});
console.log('Profile wallets:', wallets.data);
getWalletsForOrganization()
Get all wallets for the organization.
Signature:
getWalletsForOrganization(
request: GetWalletsForOrganizationRequest,
requestOptions?: RequestOptions
): Promise<WalletsResponse>
Parameters:
| Parameter | Type | Required | Description |
|---|
request.network | 'BTC' | 'tBTC' | 'ETH' | 'tETH' | No | Filter by network |
request.skip | number | No | Number of records to skip |
request.take | number | No | Number of records to retrieve |
Example:
// Get all ETH wallets
const wallets = await client.wallets.getWalletsForOrganization({
network: 'ETH',
skip: 0,
take: 100
});
console.log('Organization wallets:', wallets.data);
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.
Complete Example
import { OumlaSdkApiClient, OumlaSdkApiEnvironment } from '@oumla/sdk';
const client = new OumlaSdkApiClient({
environment: OumlaSdkApiEnvironment.Sandbox,
apiKey: 'your-api-key'
});
async function manageWallets() {
// Create a wallet
const wallet = await client.wallets.createWallet({
reference: 'user-123',
network: 'ETH'
});
console.log('Created wallet:', wallet.data.id);
// Get all wallets for a profile
const profileWallets = await client.wallets.getWalletsByProfile({
reference: 'user-123'
});
console.log('Profile has', profileWallets.data.length, 'wallets');
// Get all organization wallets
const orgWallets = await client.wallets.getWalletsForOrganization({
network: 'ETH'
});
console.log('Organization has', orgWallets.data.length, 'ETH wallets');
}