BuilderEarnings
Type: the builder's full earnings picture — both rails, self-query summary, per-app breakdown.
import type { BuilderEarnings } from 'flowstack-sdk'Returned by getBuilderEarnings. Carries legacy aggregate fields (earned_cents, paid_cents, available_cents, min_payout_cents, currency) for pre-P0-152 consumers, plus rails.stripe (StripeRailEarnings, cents), rails.agent (AgentRailEarnings, wei/AGENT strings), self_query (own-app usage, excluded from earnings), and apps: AppEarnings[] (per-app rails + action such as set_payout_wallet with escrowed release_wei/release_agent), and since 0.3.3 (P0-167) optional compute (ComputeSpendSummary: credits_spent/queries/usd_cents) — the builder-funded compute spend (cost of goods, NOT earnings) at top level and per app.
Signature
interface BuilderEarnings { earned_cents: number; paid_cents: number; available_cents: number; min_payout_cents: number; currency: string; builder_user_id: string; as_of: string; rails: { stripe: StripeRailEarnings; agent: AgentRailEarnings }; self_query: SelfQuerySummary; compute?: ComputeSpendSummary; apps: AppEarnings[] }Returns
| Field | Type | Description |
|---|---|---|
rails.stripe | StripeRailEarnings | Fiat rail in integer cents (accrued_cents, pending_cents, available_cents, shortfall_cents, connect flags). |
rails.agent | AgentRailEarnings | On-chain rail — wei STRINGS plus human *_agent decimal strings; action_needed may be set_payout_wallet. |
apps | AppEarnings[] | Per-app rails + self-query summary + pending action, keyed by site_id. |
*_wei fields are strings — they overflow JS numbers. Use the paired *_agent human-decimal strings for display and BigInt for arithmetic.compute is spend, not revenue — do not add it to earnings totals. It reports what the owner's credits funded (1 credit/query).See also
getBuilderEarnings · requestBuilderPayout · Monetization
Source: src/types/index.ts (Builder Earnings, P0-152) · Also available in llms-full.txt and registry.json.