Manage Accounts
Work with multiple Solana accounts and custom derivation paths.
This guide explains how to retrieve multiple accounts from your Solana wallet and use custom derivation paths.
Retrieve Accounts by Index
Use getAccount() with a zero-based index to access accounts derived from the default derivation path.
const account = await wallet.getAccount(0)
const address = await account.getAddress()
console.log('Account 0 address:', address)
const account1 = await wallet.getAccount(1)
const address1 = await account1.getAddress()
console.log('Account 1 address:', address1)Retrieve Account by Custom Derivation Path
Use getAccountByPath() when you need a specific hierarchy beyond the default sequential index.
const customAccount = await wallet.getAccountByPath("0'/0/5")
const customAddress = await customAccount.getAddress()
console.log('Custom account address:', customAddress)All addresses are base58-encoded Solana public keys. All accounts inherit the provider configuration from the wallet manager.
Iterate Over Multiple Accounts
You can loop through accounts to inspect addresses and balances in bulk.
async function listAccounts(wallet) {
const accounts = []
for (let i = 0; i < 5; i++) {
const account = await wallet.getAccount(i)
const address = await account.getAddress()
const balance = await account.getBalance()
accounts.push({ index: i, address, balance })
}
return accounts
}Next Steps
Now that you can access your accounts, learn how to check balances.