@orangecheck/me-client / computeFees
Function: computeFees()
function computeFees(
cfg: IntegratorEventConfig,
payment_amount_sats?: number,
opts?: {
is_agent?: boolean;
}): ComputedFees;
Defined in: me-client/src/types.ts:156
Compute the four-way fee split for an event given an integrator's config and (for percent_of_amount events) the underlying payment amount. MIRRORS oc-me-web/src/lib/events/types.ts computeFees() EXACTLY — the SDK-side replay (oc.event.verify) re-runs this against envelopes the server billed, so any drift is a false "divergence".
Invariants:
- gross_fee_sats >= MIN_INTEGRATOR_PRICE_SATS (1-sat atomic floor)
- platform_fee_sats = min(gross, max(min_floor, round(gross × pct))) — bounded above by gross so a 1-sat event can't owe more platform fee than it grossed
- user_earned_sats = min(gross − platform, round(gross × share)), share clamped to [0, 0.8]
- site_rebate_sats = gross − platform − user (exact remainder)
- gross == platform + user + rebate exactly
When opts.is_agent is true AND the config has an agent override,
the agent's site_pays / user_share_pct apply. agent.refuse: true
throws 'agent_refused' (the server maps it to 422).
Parameters
| Parameter | Type |
|---|---|
cfg | IntegratorEventConfig |
payment_amount_sats? | number |
opts? | { is_agent?: boolean; } |
opts.is_agent? | boolean |