Skip to main content

calculateOnchainEarnings

Calculate/refresh onchain earnings for a wallet. Triggers a recalculation on the backend.

Signature

calculateOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>

Parameters

ParameterTypeRequiredDescription
walletAddressstringSmart wallet address

Returns

Updated onchain earnings data

Return Type

interface OnchainEarningsResponse {
success: boolean;
data: {
walletAddress: string;
totalEarnings: number;
currentEarnings: number;
lifetimeEarnings: number;
unrealizedEarnings?: number;
currentEarningsByChain?: Record<number, number>;
unrealizedEarningsByChain?: Record<number, number>;
lastCheckTimestamp?: string;
};
}

Example

const earnings = await sdk.calculateOnchainEarnings("0x...");
console.log("Calculated earnings:", earnings.data.totalEarnings);