Agent Wallets
An agent wallet is a separate EVM wallet that is approved to sign exchange actions for a master account.
Agent wallets allow applications and automated trading systems to sign actions without using the master account’s private key for every request.
The master account continues to own:
Balances
Positions
Orders
Claims
Withdrawable funds
The agent wallet is only the signer for supported exchange actions.
Supported agent actions
An approved agent can submit:
Orders
Cancels
Cancel-all requests
Cancel-and-replace requests
Claims
Agent withdrawals are not supported by the documented SDK methods.
Generate an agent wallet
Use Wallet.createRandom() to generate a new EVM wallet.
The generated private key is available as:
Store the private key in a server-side secret manager.
Do not:
Commit the private key to source control
Include it in a frontend bundle
Store it in browser local storage
Print it in production logs
Share it with the master wallet’s users
Create the master client
The master wallet must approve and revoke agents.
Approve the agent
Approve the generated agent address with the master wallet.
Response:
Possible statuses:
The SDK:
Validates the master and agent addresses.
Ensures the agent differs from the master.
Creates the inner agent-approval signature.
Creates the signed outer approval action.
Submits the approval to
POST /agents/approve.
An explicit approval nonce can also be provided:
Create an agent client
Create a separate ExchangeClient using the agent wallet.
The configured wallet is now the agent signer.
For agent methods, pass the master account as sender.
Place an agent order
Response:
Cancel an order as an agent
Response:
Cancel all orders as an agent
The SDK uses the zero order hash internally to request cancel-all.
Cancel and replace as an agent
The replacement order must use the same market and side as the cancelled order.
Claim as an agent
Response:
Approval nonces
Agent actions contain both:
An action
nonceAn agent
approvalNonce
The action nonce identifies the signed action.
The approval nonce identifies the active agent approval.
When approvalNonce is omitted, the SDK fetches it through InfoClient.
Check agent status
Create an InfoClient to check the current approval.
Response:
Possible statuses:
Get only the parsed approval nonce:
SDK response:
Revoke the agent
Agent revocation must be signed by the master wallet.
Response:
After revocation, the agent can no longer submit actions for the master account.
Signing without submitting
Use signAgentApproval to create the inner agent-approval signature without submitting the complete approval request.
This does not approve the agent by itself.
Use approveAgent to submit the complete approval.
Multiple trading processes
Nonce uniqueness is local to one NonceManager instance.
If several processes use the same agent wallet, coordinate their action nonces with:
A shared
NonceManagerA centralized nonce service
A shared atomic counter
Explicit coordinated nonces
For independent trading processes, use a separate agent wallet for each process when possible.
Last updated