Agent Wallet Setup
After authenticating and obtaining a set of tokens, the next step is to ensure that Pear Protocol can perform actions on the Hyperliquid Exchange on behalf of the user.
We are using the API / Agent Wallet provided by Hyperliquid. Each Single Agent Wallet is used exclusively by one user, and its private key is securely stored and encrypted within the Pear Protocol system. An Agent Wallet remains valid for 180 days, but it will be rotated every 30 days.
Below is the step-by-step guide to integrate Pear Protocol with the Hyperliquid Exchange using an Agent Wallet:
Check Agent Wallet β Before creating a new Agent Wallet, check whether the user already has one by calling the
GET Agent Walletendpoint. The response will include the Agent Wallet address and status:If the status is
NOT FOUND, it means no wallet has been created.If the status is
ACTIVE, the existing Agent Wallet can be used.If the status is
EXPIRED, proceed to step 3 to prompt the user to approve a new Agent Wallet.
Create Agent Wallet β If no wallet exists or it has expired, Pear Protocol will create a new Agent Wallet for the user by calling the
Create Agent Walletendpoint. The response will include the new Agent Wallet address.Prompt the User to Approve the Agent Wallet β Once the wallet is created, prompt the user to approve it. This requires the user to sign a message using their own wallet, authorizing Pear Protocol to use the Agent Wallet on their behalf. More details can be found in the Agent Wallet Approval section of the documentation.
Use the Agent Wallet β After the user has approved the Agent Wallet, Pear Protocol can use it to interact with the Hyperliquid Exchange on behalf of the user.
Last updated