Manage Accounts
Manage account indices, derivation paths, read-only accounts, and existing EVM accounts.
This guide explains how to derive accounts, use custom paths, create read-only accounts, and wrap an existing WalletAccountEvm.
Get an Account by Index
getAccount(index) derives accounts with the EVM BIP-44 path suffix 0'/0/{index}.
const account0 = await wallet.getAccount()
const account1 = await wallet.getAccount(1)
console.log(await account0.getAddress())
console.log(await account1.getAddress())getAccount() defaults to index 0.
Get an Account by Path
Use getAccountByPath(path) when you need a specific derivation path suffix.
const account = await wallet.getAccountByPath("0'/0/5")
console.log(account.path)The full derivation path is based on the EVM account path convention, for example m/44'/60'/0'/0/5.
Use a Custom Signer
Use an ISignerEvm implementation from @tetherto/wdk-wallet-evm-7702-gasless/signers or supply an implementation of that interface. Register it on the manager with addSigner(name, signer). The string overload uses that signer directly. Use the numeric or path overload when the registered signer supports derivation.
wallet.addSigner('external', externalSigner)
const externalAccount = await wallet.getAccount('external')
console.log(await externalAccount.getAddress())Here externalSigner is the signer supplied by your application. Its lifecycle remains your responsibility. To use a custom default signer, pass a derivable signer as the first argument to the manager constructor.
Convert to a Read-only Account
Use toReadOnlyAccount() when a flow needs balances, quotes, receipts, allowances, or signature verification without signing access.
const account = await wallet.getAccount(0)
const readOnlyAccount = await account.toReadOnlyAccount()
const balance = await readOnlyAccount.getBalance()Read-only accounts do not expose sign(), signTypedData(), signTransaction(), sendTransaction(), transfer(), or approve().
Create a Read-only Account from an Address
Use an EIP-7702 implementation address verified for the target chain and the configured EntryPoint version. The placeholder below must be replaced before use.
import { WalletAccountReadOnlyEvm7702Gasless } from '@tetherto/wdk-wallet-evm-7702-gasless'
const readOnlyAccount = new WalletAccountReadOnlyEvm7702Gasless('0x742C4265F5Ba4F8E0842e2b9EfE66302F7a13B6F', {
provider: 'https://rpc.mevblocker.io/fast',
delegationAddress: '<VERIFIED_DELEGATION_ADDRESS>',
bundlerUrl: 'https://api.candide.dev/api/v3/1/YOUR_API_KEY',
isSponsored: true
})Wrap an Existing EVM Account
WalletAccountEvm7702Gasless can wrap a WalletAccountEvm instance. Use this when your application already manages the base EVM account.
Use @tetherto/wdk-wallet-evm@1.0.0-beta.26 and ensure both imports resolve to the same installed EVM package instance. The constructor checks class identity; an account from another EVM version or a second package copy is not interchangeable. If you do not need an existing account, use the seed-and-path constructor instead.
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'
import { WalletAccountEvm7702Gasless } from '@tetherto/wdk-wallet-evm-7702-gasless'
const evmAccount = new WalletAccountEvm(seedPhrase, "0'/0/0", {
provider: 'https://rpc.mevblocker.io/fast'
})
const gaslessAccount = new WalletAccountEvm7702Gasless(evmAccount, {
provider: 'https://rpc.mevblocker.io/fast',
delegationAddress: '<VERIFIED_DELEGATION_ADDRESS>',
bundlerUrl: 'https://api.candide.dev/api/v3/1/YOUR_API_KEY',
isSponsored: true
})Clean Up Account State
gaslessAccount.dispose()
wallet.dispose()dispose() clears the gasless account quote cache and prevents further signing and writes. The wrapped EVM account in this example is caller-owned. Dispose it separately when all of its consumers have finished.