getOnchainEarnings
Get onchain earnings for a wallet including total, current, and lifetime earnings.
Signature
getOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
walletAddress | string | ✅ | Smart wallet address |
Returns
Onchain earnings data with breakdowns by chain
Return Type
interface OnchainEarningsResponse {
success: boolean;
data: {
walletAddress: string;
totalEarnings: number;
currentEarnings: number;
lifetimeEarnings: number;
unrealizedEarnings?: number;
currentEarningsByChain?: Record<string, number>;
unrealizedEarningsByChain?: Record<string, number>;
lastCheckTimestamp?: string;
};
}
Example
const earnings = await sdk.getOnchainEarnings("0x...");
console.log("Total earnings:", earnings.data.totalEarnings);
console.log("Current earnings:", earnings.data.currentEarnings);
console.log("Lifetime earnings:", earnings.data.lifetimeEarnings);