Tokens
Holdings
const tokens = await provider.getTokenBalances?.(address, "ethereum", { nonZeroOnly: true });
Etherscan and Blockscout serve it on EVM chains, Helius on Solana through DAS searchAssets, Koios on Cardano for native assets. Everyone else leaves the method absent and capabilities.tokenBalances false.
interface TokenBalance {
contract: string;
symbol: string;
name?: string;
decimals: number;
balance: string; // raw, exact
balanceFormatted: string;
priceUsd?: number; // when the explorer quotes one
valueUsd?: number;
}
nonZeroOnly drops holdings with a zero balance, which is most of them on a wallet that has been airdropped at. Two sizes to know: Blockscout returns the complete holding array in one answer, and a busy wallet makes that a response of several megabytes, so that read gets sixty seconds unless ProviderConfig.timeout says otherwise. Helius pages a thousand assets at a time and stops after twenty pages.
Transfers
const transfers = await provider.getTokenTransfers?.(address, "ethereum", {
token: "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
limit: 20,
});
Etherscan and Blockscout only. The options are TxHistoryOptions plus token, which narrows the list to one contract. Each row is a TokenTransfer with the contract, symbol, decimals, exact value, valueFormatted, from, to, the txHash it happened in, the block and the timestamp.
The reason this read exists next to getTxHistory: an ERC-20 transfer sent to you by somebody else is their transaction, not yours. It never appears in your native history. explorers_token_transfers says as much in its description, so an agent asked "what did this wallet receive" reaches for the right tool.
CLI
explorers tokens vitalik.eth
explorers transfers vitalik.eth -t 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 -n 20
In the explorer
The Explorer caps holdings at fifty rows and transfers at ten, and says how many there were. Read the rest with the library.