Manage Accounts
Work with multiple EVM accounts and custom derivation paths.
This guide explains how to retrieve multiple accounts from your EVM wallet and use custom derivation paths.
Retrieve Accounts by Index
Use getAccount() with a zero-based index to access accounts derived from the default BIP-44 path (m/44'/60'/0'/0/{index}).
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)Retrieve Accounts from Named Signers
Register named signers when an account should use signing material outside the manager's default seed. The default manager signer must be derivable; non-derivable private-key signers can be registered by name.
import WalletManagerEvm from '@tetherto/wdk-wallet-evm'
import { PrivateKeySignerEvm } from '@tetherto/wdk-wallet-evm/signers'
const wallet = new WalletManagerEvm(seedPhrase, {
provider: 'https://eth.drpc.org'
})
wallet.addSigner('treasury', new PrivateKeySignerEvm(privateKey))
const treasuryAccount = await wallet.getAccount('treasury')
console.log('Treasury address:', await treasuryAccount.getAddress())getAccount('name') wraps the registered signer at its current path without deriving, including a seed signer at its coin node. If a registered signer supports derivation, derive a leaf by passing signerName with an index or path:
const account = await wallet.getAccount(2, { signerName: 'hardware-root' })
const customAccount = await wallet.getAccountByPath("0'/0/5", { signerName: 'hardware-root' })PrivateKeySignerEvm is not derivable. Use getAccount('treasury') to bind the named signer directly. Its derive() method throws UnsupportedOperationError. Numeric/path retrieval through the manager throws InvalidSignerError when the selected signer cannot derive.
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,
path: `m/44'/60'/0'/0/${i}`,
address,
balance
})
console.log(`Account ${i}:`, { address, balance: balance.toString() })
}
return accounts
}Next Steps
Now that you can access your accounts, learn how to check balances.