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 reference:', wallet.data.data?.reference);
console.log('Network ID:', wallet.data.data?.networkId);
getWalletsByProfile()
Get all wallets for a specific profile.
Signature:
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:
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:
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.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.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');
}