Docs / wallet / getBuilderEarnings

getBuilderEarnings

utilitysince 0.2.9not for built apps

Client function: aggregate + per-app builder earnings across both rails (Stripe cents + on-chain AGENT).

import { getBuilderEarnings } from 'flowstack-sdk'

Non-React client function. Returns the builder's full earnings picture: legacy Stripe aggregate fields, per-rail breakdowns (rails.stripe in cents, rails.agent in wei/AGENT strings), a self-query summary (own-app usage excluded from earnings), and a per-app apps[] list with any required action (e.g. set_payout_wallet). GET /billing/builder/earnings.

Signature

getBuilderEarnings(credentials, config?): Promise<ApiResponse<BuilderEarnings>>

Parameters

ParamTypeNotesDescription
credentialsFlowstackCredentialsrequiredThe builder's (app owner's) credentials.
configFlowstackClientConfigsince 0.2.9Client config (baseUrl, tenantId as needed).

Returns

FieldTypeDescription
Promise<ApiResponse<BuilderEarnings>>BuilderEarnings — aggregate fields, rails, self_query, and apps: AppEarnings[].

Examples

Show available payout
const res = await getBuilderEarnings(credentials);
if (res.ok) {
  const { available_cents, rails } = res.data;
  console.log(`Fiat available: $${(available_cents / 100).toFixed(2)}`);
  console.log(`AGENT accrued: ${rails.agent.accrued_agent}`); // human string — NOT wei
}
CriticalAGENT-rail amounts (accrued_wei, pending_wei, paid_wei, release_wei) are strings — wei values overflow JS numbers. Never Number()/parseInt them; display the paired human-decimal *_agent strings instead, and do math with BigInt if you must.
WarningBuilder/owner operation — call with the builder's credentials from a dashboard/console context, not from inside a generated app's end-user runtime. builtAppSafe is false.

See also

requestBuilderPayout · getConnectStatus · BuilderEarnings · getMonetization

Source: src/api/client.ts (Builder Earnings, P0-152) · Also available in llms-full.txt and registry.json.