A functional wallet is a key component of a successful relayer, responsible for keeping track of the user's account address and balances, but more importantly giving the ability for a user to sign a variety of transactions necessary for the relayer to work. The most common wallet integration is MetaMask, and allows the user to control their wallet through a browser extension, and popping up notifications when a signature is requested by the client.
Once a user has connected to a supported wallet, it's important to give them a full picture of their balances, both in ETH and across various tokens tradeable by the exchange. In addition, the wallet UI should show the approval status of their ERC20 tokens, which allows them to be traded atomically without the need to deposit them into a trusted third party.
Most of the information needed for display is directly available from the blockchain. Once a wallet is loaded, the account address is accessible, and a few actions are dispatched simultaneously. The ETH balance of the account is loaded, and a watcher is set up to poll for updates. Additionally, each token is loaded and also polled periodically, pulling in the balance and approval status.
The API server only needs to be queried for "locked balances", specifically how much WETH or Token is already promised by the open orders on this account. This is used in a best effort to not overpromise assets in the case that all orders are immediately filled, which will help avoid failed trade transactions. To do this, a List Locked Balances call is made to the API server. The returned balances are subtracted from the actual balance given by the blockchain to provide an available balance to the user.