live · mainnetoc · docs
specs · api · guides
docs / documentation

@orangecheck/me-client


@orangecheck/me-client / computeFees

Function: computeFees()

function computeFees(cfg: IntegratorEventConfig, payment_amount_sats?: number): ComputedFees;

Defined in: me-client/src/types.ts:110

Compute the four-way fee split for an event given an integrator's config and (for percent_of_amount events) the underlying payment amount.

Invariants (verified by tests in oc-me-web/src/lib/events/types.test.ts):

  1. gross_fee_sats >= MIN_INTEGRATOR_PRICE_SATS
  2. platform_fee_sats >= PLATFORM_FEE_POLICY.min_floor_sats
  3. user_share_pct is clamped to [0, 0.8]
  4. site_rebate_sats >= 0
  5. gross == platform + user + rebate (exact, modulo rounding into rebate)

Parameters

ParameterType
cfgIntegratorEventConfig
payment_amount_sats?number

Returns

ComputedFees