Wallet
Manage deposits, withdrawals, and balances across multiple blockchains.
Get Balances
typescript
// Get all balances
const balances = await client.wallet.getBalances()
for (const subaccount of balances) {
console.log(`Subaccount ${subaccount.subaccount_id}:`)
for (const [asset, balance] of subaccount.balances) {
console.log(` ${asset}: ${balance.available} available, ${balance.locked} locked`)
}
}
// Get specific asset balance
const btcBalance = await client.wallet.getBalance('BTC')
if (btcBalance) {
console.log(`Available: ${btcBalance.available}`)
console.log(`Locked: ${btcBalance.locked}`)
}
// Get total available
const available = await client.wallet.getTotalAvailable('BTC')Deposit Addresses
Generate deposit addresses for supported chains:
typescript
// Get BTC deposit address
const btcAddress = await client.wallet.getDepositAddress('BTC', 'Bitcoin')
console.log('Send BTC to:', btcAddress)
// Get Solana deposit address
const solAddress = await client.wallet.getDepositAddress('SOL', 'Solana')
console.log('Send SOL to:', solAddress)
// Get ICP deposit address
const icpAddress = await client.wallet.getDepositAddress('ICP', 'ICP')
console.log('Send ICP to:', icpAddress)Supported Chains
| Chain | Assets |
|---|---|
| Bitcoin | BTC |
| Solana | SOL, SPL tokens |
| ICP | ICP, ckBTC, ckETH, ICRC tokens |
Withdraw
typescript
// Request a withdrawal
const withdrawalId = await client.wallet.requestWithdrawal({
asset: 'BTC',
blockchain: { Bitcoin: null },
amount: 1000000n, // 0.01 BTC (8 decimals)
address: 'bc1q...',
})
console.log('Withdrawal ID:', withdrawalId)Deposit History
typescript
const deposits = await client.wallet.getDeposits({
limit: 20n,
offset: 0n,
})
for (const deposit of deposits) {
console.log(`${deposit.amount} ${deposit.asset} - ${deposit.status}`)
}Withdrawal History
typescript
const withdrawals = await client.wallet.getWithdrawals()
for (const w of withdrawals) {
console.log(`${w.amount} ${w.asset} to ${w.address}`)
console.log(`Status: ${Object.keys(w.status)[0]}`)
}
// Get specific withdrawal
const withdrawal = await client.wallet.getWithdrawal(withdrawalId)Address Book
Manage trusted withdrawal addresses:
typescript
// Add trusted address
const entry = await client.wallet.addAddressBookEntry({
label: 'My hardware wallet',
blockchain: { Bitcoin: null },
address: 'bc1q...',
})
// Get all addresses
const addresses = await client.wallet.getAddressBook()
// Check if address is trusted
const trusted = await client.wallet.isTrustedAddress('Bitcoin', 'bc1q...')
// Remove address
await client.wallet.removeAddressBookEntry(entry.id)Subaccounts
Users can have multiple subaccounts (up to 255):
typescript
// Get balances for specific subaccount
const balance = await client.wallet.getBalance('BTC', undefined, 1) // subaccount 1
// Get deposit address for subaccount
const address = await client.wallet.getDepositAddress('BTC', 'Bitcoin', 1)Decimal Precision
All amounts use 8 decimal places as bigint:
typescript
// 1 BTC = 100000000n (1 * 10^8)
// 0.01 BTC = 1000000n (0.01 * 10^8)
// 0.00000001 BTC = 1n
const amount = 1000000n // 0.01 BTC