Overview
When building client-side applications with Hyperliquid, you’ll typically want to:- Allow users to connect with external wallets (MetaMask, Coinbase Wallet, etc.)
- Create an embedded agent wallet for programmatic trading
- Execute L1 actions (trading) through the agent wallet
- Execute User Signed Actions (withdrawals, approvals) through the user’s external wallet
Using External Wallets with Agent Wallets
If you want to execute L1 actions (like placing orders, canceling orders, etc.) with external wallets like MetaMask, create an Agent Wallet and execute all L1 actions through it. Agent wallets are designed specifically for programmatic trading and provide a better user experience - users won’t see confusing chain switching prompts, and it creates a cleaner separation between user wallets and trading operations.User Signed Actions (like withdrawals and agent approvals) use the standard Ethereum mainnet
(chain 1) and work normally with external wallets.
Understanding Action Types
L1 Actions (Trading Operations)
These actions can be executed by agent wallets without requiring the master wallet’s signature:- Placing orders
- Canceling orders
- Modifying leverage
- Setting position sizes
User Signed Actions
These sensitive operations require the master wallet’s signature:- Withdrawing funds
- Approving agents
- Account transfers
- Approving builder fees
Best Practices
Initialize agent on first use
Initialize agent on first use
Create and approve the agent wallet the first time a user wants to trade. Store the agent wallet
reference for future sessions.
Handle wallet disconnections
Handle wallet disconnections
Implement proper error handling for when users disconnect their external wallet. The agent
wallet can continue operating, but User Signed Actions will fail.
Clear user feedback
Clear user feedback
Communicate to users which wallet is being used for each action. For example, “Placing order
with trading wallet” vs “Approve with MetaMask”.

