AccountAutomation

AccountAutomation manages on-chain approvals that let conduit contracts act on behalf of a user, and provides access to the automation job history API.


Protocol Account (veNFT) Automation

Per-token, conduit-selectable. Approve a conduit for a specific token ID, or use tokenId: 0 for an account-level approval covering all veNFTs.

typescript
import { AccountAutomation } from '@hydrexfi/hydrex-sdk';

// Check current approval state (readContracts bound to veToken)
const state = await AccountAutomation.getAutomationApprovalState(
  '0xOwnerWallet',
  '0xConduitAddress',
  readContracts,
);
// state.hasClaimApproval  — isClaimRedirectApprovedForAll
// state.hasNftApproval    — isApprovedForAll
// state.isFullyAutomated  — both true

// Approve conduit for a specific veNFT (tokenId: 0 = account-level)
const { calldata } = AccountAutomation.setConduitApprovalCallParameters({
  tokenId: 42,
  conduitAddress: '0xConduitAddress',
  approve: true,
});

// ERC721 operator approval (required for veMaxi conduits)
const { calldata: nftApproval } = AccountAutomation.setApprovalForAllCallParameters({
  operator: '0xConduitAddress',
  approved: true,
});

// Route payouts to a recipient (send to conduit contract)
const { calldata: payout } = AccountAutomation.setMyPayoutRecipientCallParameters({
  recipient: '0xRecipientWallet',
});

// Read the current payout recipient for an owner
const recipient: string = await AccountAutomation.getPayoutRecipient('0xOwnerWallet', readContract);

Liquid (Gauge) Automation

Liquid automation requires four approvals across three contracts. Use automateGaugesCallParameters to build them all at once.

typescript
// Build all 4 approvals needed for liquid gauge automation at once
const params = AccountAutomation.automateGaugesCallParameters(
  '0xLpConduitAddress',
  '0xOwnerWallet',
  true, // true to enable, false to revoke
);

// Route each call to the correct contract:
// params.veTokenCalls[0]       → veToken         setApprovalForAll
// params.veTokenCalls[1]       → veToken         setConduitApproval (tokenId = 0)
// params.merklDistributorCall  → merklDistributor toggleOperator
// params.optionsTokenCall      → optionsToken    approve

// Read the full approval state across all 4 axes
const state = await AccountAutomation.getLiquidAutomationApprovalState(
  '0xOwnerWallet',
  '0xLpConduitAddress',
  readVeTokenContracts,
  readMerklOperatorContract,
  readOptionsTokenAllowance,
);
// state.isFullyAutomated — all four true

Merkl toggleOperator

merklDistributor.toggleOperator flips state rather than accepting an explicit boolean. Only submit this bundle when the current Merkl operator state is the opposite of your intent. Check first with getLiquidAutomationApprovalState.

Automation History

Fetch completed automation job history from the protocol API. History is grouped by token ID.

typescript
import {
  AccountAutomation,
  VeNFTAutomationHistoryByToken,
} from '@hydrexfi/hydrex-sdk';

const options = { baseUrl: 'https://api.hydrex.fi' };

// All history for a wallet, grouped by token id
const history: VeNFTAutomationHistoryByToken =
  await AccountAutomation.getAutomationHistoryByOwner('0xOwnerWallet', options);

for (const [tokenId, entries] of Object.entries(history.historyByTokenId)) {
  entries.forEach(entry => {
    // entry.tokenId, .transactionHash, .timestamp, .recipient
    // entry.distributed — [{ token, amountRaw, amount, symbol, usd }]
    // entry.totalUsd
    // entry.isVeMaxi — true for veMaxi (Anchor Club) conduit
  });
}

// History for a single token
const single = await AccountAutomation.getAutomationHistoryByTokenId(
  '0xOwnerWallet',
  42n,
  options
);
Hydrex

Hydrex is an Omni-Liquidity MetaDEX built on Base for Base, designed to bring new users onchain.

Paragraph

© 2026 Hydrex. All rights reserved.