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.networkId | string | Yes | Network ID (from getNetworks()) |
Example:
const wallet = await client.wallets.createWallet({
reference: 'user-123',
networkId: 'your-network-id'
});
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.skip | number | No | Number of records to skip |
request.take | number | No | Number of records to retrieve |
Example:
const wallets = await client.wallets.getWalletsForOrganization({
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() {
// Get available networks
const networks = await client.networks.getNetworks({ skip: 0, take: 50, enabled: true });
const networkId = networks.data[0].id;
// Create a wallet
const wallet = await client.wallets.createWallet({
reference: 'user-123',
networkId
});
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({
skip: 0,
take: 100
});
console.log('Organization has', orgWallets.data.length, 'wallets');
}