VeNFT & Claims
VeNFTClaims builds calldata for claiming trading fees and voting bribes for veNFT holders. VeNFTLens reads the on-chain lens contract to discover claimable rewards and vote snapshots.
Claiming Fees
All fee claim transactions target VOTER_ADDRESSES[chainId].
typescript
import { VeNFTClaims } from '@hydrexfi/hydrex-sdk';
// Claim fees from a single fee contract
const { calldata } = VeNFTClaims.claimFeeCallParameters({
tokenId: 42n,
claim: { feeAddress: '0xFeeContract', tokens: ['0xToken1'] },
});
// Claim fees from multiple fee contracts
const { calldata: multi } = VeNFTClaims.claimFeesCallParameters({
tokenId: 42n,
claims: [
{ feeAddress: '0xFee1', tokens: ['0xToken1'] },
{ feeAddress: '0xFee2', tokens: ['0xToken2'] },
],
});
// Claim fees to a specific recipient
const { calldata: toRecipient } = VeNFTClaims.claimFeesToRecipientByTokenIdCallParameters({
tokenId: 42n,
recipient: '0xRecipient',
claims: [{ feeAddress: '0xFee1', tokens: ['0xToken1'] }],
});Claiming Bribes
typescript
// Claim bribes from a single bribe contract
const { calldata } = VeNFTClaims.claimBribeCallParameters({
tokenId: 42n,
claim: { bribeAddress: '0xBribeContract', tokens: ['0xToken1'] },
});
// Claim bribes from multiple contracts
const { calldata: multi } = VeNFTClaims.claimBribesCallParameters({
tokenId: 42n,
claims: [{ bribeAddress: '0xBribe1', tokens: ['0xToken1'] }],
});
// Claim bribes to a recipient
const { calldata: toRecipient } = VeNFTClaims.claimBribesToRecipientByTokenIdCallParameters({
tokenId: 42n,
recipient: '0xRecipient',
claims: [{ bribeAddress: '0xBribe1', tokens: ['0xToken1'] }],
});Discovering Claimable Rewards with VeNFTLens
Use VeNFTLens.getAllClaimable to discover all pending fees and bribes, then feed the result directly into the claim builders.
typescript
import { VeNFTLens, VeNFTClaimable } from '@hydrexfi/hydrex-sdk';
// Discover all claimable fees and bribes across voted pairs
const claimable: VeNFTClaimable = await VeNFTLens.getAllClaimable(
42n,
['0xPair1', '0xPair2'],
readContracts, // bound to VE_TOKEN_LENS_ADDRESSES[chainId]
);
// Feed directly into claim builders
const { calldata: feesCalldata } = VeNFTClaims.claimFeesCallParameters({
tokenId: 42n,
claims: claimable.fees,
});
const { calldata: bribesCalldata } = VeNFTClaims.claimBribesCallParameters({
tokenId: 42n,
claims: claimable.bribes,
});ℹ
VE_TOKEN_LENS_ADDRESSES
The
readContracts function must be bound to VE_TOKEN_LENS_ADDRESSES[chainId]. For Base mainnet: 0xF4d3fCA00640F5bEb7480AA113ED7B0C2c366866.Vote Snapshots & Account Reads
typescript
// Wallet-level vote snapshot (all veNFTs for a wallet)
const snapshot: UserVoteSnapshot = await VeNFTLens.getUserVoteSnapshot(
'0xOwnerWallet',
readContract,
);
// Per-token vote snapshot
const tokenSnapshot: VeNFTTokenSnapshot = await VeNFTLens.getUserVoteSnapshotByTokenId(
42n,
readContract,
);
// All veNFT accounts for a wallet
const result: VeNFTAccountsByAddress = await VeNFTLens.getAccountsByAddress(
'0xOwnerWallet',
readContract,
);
// Single account by token ID
const account: VeNFTAccount = await VeNFTLens.getAccountById(42n, readContract);Key Types
VeNFTAccount
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenId | bigint | required | The veNFT token ID. |
votingPower | bigint | required | Current voting power of this token. |
earningPower | bigint | required | Earning power (for rewards distribution). |
delegatee | string | required | Address the token is delegated to (zero if not delegated). |
account | string | required | Owner address. |
lockEnd | bigint | required | Unix timestamp when the lock expires. |
| Type | Description |
|---|---|
VeNFTClaimable | fees: FeeClaimItem[], bribes: BribeClaimItem[] — returned by VeNFTLens.getAllClaimable |
FeeClaimItem | feeAddress: string, tokens: string[] |
BribeClaimItem | bribeAddress: string, tokens: string[] |
UserVoteSnapshot | Wallet-level: voted, votingPower, earningPower, epochVotes, nextEpochVotes, nextEarningPower, voteTs, votes |
VeNFTTokenSnapshot | Per-token: voted, votingPower, earningPower, epochVotes, voteTs (no next-epoch projections) |
VeNFTAccountsByAddress | owner: string, balance: bigint, accounts: VeNFTAccount[] |