Skip to main content
The approveBuilderCode action allows Vincent Apps to pre-authorize the Hyperliquid Ability to collect a 0.05% builder fee on eligible trades executed by a Vincent User’s Agent Wallet. All collected fees currently flow into the Hyperliquid builder account 0x132Db5f531Ba38628F1640683354229daE04E8e6, which will later be distributed between the App Manager and the Vincent team.
You usually don’t need to call this manually. When running spotSell, perpLong, or perpShort, the Vincent Ability automatically checks for builder code approval and submits it if missing. Use approveBuilderCode only if you want to pre-approve ahead of time and avoid an extra approval during your first trade.

What is Hyperliquid Builder Code?

Hyperliquid’s builder fee program lets applications receive a portion of trading fees on transactions they facilitate. By approving the Vincent builder code, a user’s Agent Wallet authorizes up to 0.05% in fees to be routed to the builder account above. Hyperliquid Vincent Ability uses this mechanism to collect a 0.05% builder fee on:
  • Perp long positions (perpLong)
  • Perp short positions (perpShort)
  • Spot sell orders (spotSell)
These fees will later be split between the App Manager and the Vincent team.

Prerequisites

Before executing the approveBuilderCode action, the following conditions must be met:
  • HyperCore Account: The Vincent User Agent Wallet must have an existing HyperCore account (created via an initial deposit).
  • Builder Code Not Already Approved: The precheck will fail if the builder code is already approved.
To learn more about executing Vincent Abilities, see the Executing Abilities guide.

Executing the precheck Function

The precheck function validates some prerequisites for approving the builder code, without actually performing the operation. For the approveBuilderCode action, the precheck function will validate the following:
  • The Vincent User Agent Wallet has a HyperCore account.
  • The builder code (0x132Db5f531Ba38628F1640683354229daE04E8e6) is not already approved.
The precheck for approveBuilderCode fails if the builder code is already approved. This is by design to prevent unnecessary approval transactions.
The precheck function requires the following parameters:
import { HyperliquidAction } from '@lit-protocol/vincent-ability-hyperliquid';

{
  /**
   * The action to perform (must be HyperliquidAction.APPROVE_BUILDER_CODE)
   */
  action: HyperliquidAction.APPROVE_BUILDER_CODE;
  /**
   * Whether to use Hyperliquid testnet (optional, defaults to false)
   */
  useTestnet?: boolean;
}

Executing the execute Function

The execute function performs the actual builder code approval on HyperCore. For the approveBuilderCode action, the execute function will:
  • Approve the Vincent builder code (0x132Db5f531Ba38628F1640683354229daE04E8e6) with a maximum fee rate of 0.05%.
  • Return the approval result from Hyperliquid.
Unlike precheck, the execute function will succeed even if the builder code is already approved.
The execute function requires the following parameters:
import { HyperliquidAction } from '@lit-protocol/vincent-ability-hyperliquid';

{
  /**
   * The action to perform (must be HyperliquidAction.APPROVE_BUILDER_CODE)
   */
  action: HyperliquidAction.APPROVE_BUILDER_CODE;
  /**
   * Whether to use Hyperliquid testnet (optional, defaults to false)
   */
  useTestnet?: boolean;
}

Important Considerations

When you execute spotSell, perpLong, or perpShort actions, the Hyperliquid Ability automatically checks if the builder code is approved. If not, it approves the builder code before executing the trade. You typically don’t need to call approveBuilderCode explicitly.
The builder fee is hardcoded at 0.05% (5 basis points) of the trade value. This fee is collected by Vincent’s builder address (0x132Db5f531Ba38628F1640683354229daE04E8e6) and will be split between the App Manager and the Vincent team at a later date.
The precheck function fails if the builder code is already approved. This is intentional behavior to prevent redundant approval transactions. The execute function, however, succeeds regardless of approval status.
Builder code approval is required for these actions:
  • spotSell: Selling spot assets
  • perpLong: Opening long perpetual positions
  • perpShort: Opening short perpetual positions
The following actions do not require builder code approval:
  • spotBuy: Buying spot assets
  • deposit, withdraw, transfer, send, cancelOrder, etc.
You can verify if the builder code is approved by checking the precheck response. If precheck returns success: false with a reason like “Builder code … is already approved”, then the approval is already in place.

Reference Implementation

For a complete working example showing the builder code approval workflow, see the approve-builder-code.spec.ts end-to-end test in the ability-hyperliquid package. You can also see how builder code approval is automatically integrated into trading actions in these tests:

Next Steps

Explore the rest of the supported Hyperliquid actions: