Claim Fees
Construct, sign, and send creator fee claim transactions.
This page shows exactly how to construct and send a creator fee claim transaction.
Network and target
- Chain: Ethereum Mainnet (
chainId = 1) - Fee Hook (claim target):
0xA2dcd7bF7fF3C014A855Bf00799ccF07E6C800cc - Claim function:
claim() - Optional view function:
ethOwed(address who)
Fee split
- Creator: 60%
- Protocol: 40%
ABI fragment
[
{
"name": "claim",
"type": "function",
"stateMutability": "nonpayable",
"inputs": [],
"outputs": [{ "name": "amount", "type": "uint256" }]
},
{
"name": "ethOwed",
"type": "function",
"stateMutability": "view",
"inputs": [{ "name": "who", "type": "address" }],
"outputs": [{ "name": "", "type": "uint256" }]
}
]Constructed claim tx shape
When you construct a claim tx manually:
to = FeeHook addressvalue = 0data = calldata for claim()chainId = 1- EIP-1559 fees (
maxPriorityFeePerGas,maxFeePerGas)
Ethers example (construct + send)
import { ethers } from 'ethers';
const rpc = 'https://eth.llamarpc.com';
const provider = new ethers.JsonRpcProvider(rpc);
const signer = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const feeHook = '0xA2dcd7bF7fF3C014A855Bf00799ccF07E6C800cc';
const abi = [
'function claim() returns (uint256 amount)',
'function ethOwed(address who) view returns (uint256)'
];
const contract = new ethers.Contract(feeHook, abi, provider);
const iface = new ethers.Interface(abi);
const owed = await contract.ethOwed(await signer.getAddress());
if (owed === 0n) {
throw new Error('No fees to claim');
}
const fee = await provider.getFeeData();
const data = iface.encodeFunctionData('claim', []);
const tx = await signer.sendTransaction({
to: feeHook,
data,
value: 0n,
chainId: 1,
type: 2,
maxPriorityFeePerGas: fee.maxPriorityFeePerGas ?? ethers.parseUnits('0.02', 'gwei'),
maxFeePerGas: fee.maxFeePerGas ?? ethers.parseUnits('2', 'gwei')
});
await tx.wait();
console.log('Claim tx hash:', tx.hash);viem example (construct + send)
import { createPublicClient, createWalletClient, defineChain, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
const mainnet = defineChain({
id: 1,
name: 'Ethereum',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: { default: { http: ['https://eth.llamarpc.com'] } }
});
const publicClient = createPublicClient({ chain: mainnet, transport: http() });
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const walletClient = createWalletClient({ account, chain: mainnet, transport: http() });
const feeHook = '0xA2dcd7bF7fF3C014A855Bf00799ccF07E6C800cc' as `0x${string}`;
const abi = [
{
name: 'ethOwed',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'who', type: 'address' }],
outputs: [{ name: '', type: 'uint256' }]
},
{
name: 'claim',
type: 'function',
stateMutability: 'nonpayable',
inputs: [],
outputs: [{ name: 'amount', type: 'uint256' }]
}
] as const;
const owed = await publicClient.readContract({
address: feeHook,
abi,
functionName: 'ethOwed',
args: [account.address]
});
if (owed === 0n) {
throw new Error('No fees to claim');
}
const hash = await walletClient.writeContract({
address: feeHook,
abi,
functionName: 'claim',
args: []
});
await publicClient.waitForTransactionReceipt({ hash });
console.log('Claim tx hash:', hash);Common claim issues
No fees to claim
YourethOwed(wallet)is currently zero.- Wallet on wrong chain
Switch wallet to Ethereum Mainnet. - Insufficient gas balance
Claim sendsvalue = 0, but wallet still needs ETH for gas.