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 Walletarrow-up-right 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.

spinner

Below is the step-by-step guide to integrate Pear Protocol with the Hyperliquid Exchange using an Agent Wallet:

  1. Check Agent Wallet – Before creating a new Agent Wallet, check whether the user already has one by calling the GET Agent Wallet endpoint. 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.

  2. 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 Wallet endpoint. The response will include the new Agent Wallet address.

  3. 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 Approvalarrow-up-right section of the documentation.

  4. 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