This guide explains how to access accounts from your registered wallets. An "Account" object in WDK is your interface for inspecting balances and sending transactions on a specific blockchain.
Retrieve Accounts
You can retrieve an account using a simple index or a custom derivation path.
By Index (Recommended)
The simplest way to get an account is by its index (starting at 0). This uses the default derivation path for the specified blockchain.
Get Account by Index
// Get the first account (index 0) for Ethereum and TONconstethAccount=awaitwdk.getAccount('ethereum',0)consttonAccount=awaitwdk.getAccount('ton',0)
By Derivation Path (Advanced)
If you need a specific hierarchy, you can request an account by its unique derivation path.
Get Account by Path
// Custom path for EthereumconstcustomEthAccount=awaitwdk.getAccountByPath('ethereum',"0'/0/1")
The WDK instance caches accounts. If you call getAccount twice using the same index, the function will return the same Account object instance.
Network Mismatch Warning Ensure your WDK instance configuration matches your account environment.
If using Testnet keys, ensure you registered the wallet with a Testnet RPC (e.g., https://sepolia.drpc.org for ETH, https://testnet.toncenter.com/api/v2/jsonRPC for TON).
If using Mainnet keys, ensure you registered the wallet with a Mainnet RPC (e.g., https://eth.drpc.org for ETH, https://toncenter.com/api/v2/jsonRPC for TON). Using a Mainnet key on a Testnet RPC (or vice versa) will result in "Network not allowed" or zero balance errors.
View Addresses
Once you have an account object, you can retrieve its public blockchain address using the getAddress function.
Check Balances
You can check the native token balance of any account (e.g., ETH on Ethereum, TON on TON) by using the getBalance() function.
Multi-Chain Balance Check
Because WDK offers a unified interface, you can easily iterate through multiple chains to fetch balances.
The following example:
Iterates over an array of user defined chains.
Retrieves the first account using the respective chain's getAccount(index) function.
Retrieves the first account's balance using the getBalance() function.
Logs the balance to the console.
Next Steps
Now that you can access your accounts, learn how to send transactions.