Skip to content

computePrivacyTierFee()

SIP Protocol API Reference v0.15.1


SIP Protocol API Reference / computePrivacyTierFee

computePrivacyTierFee(amount, tier): bigint

Defined in: @sip-protocol/sdk/dist/index-GLbkPPho.d.ts:25138

Compute the protocol fee for a gross amount at a given privacy tier.

The fee is amount * bps / 10_000 using bigint floor division — bps-only, with NO flat floor (deliberately unlike computeRelayerFee, which floors to guarantee gas coverage). A sub-threshold amount rounds to 0; it is never bumped to a minimum.

bigint

Gross amount in the token’s base units (non-negative)

PrivacyTier

The privacy tier whose rate applies

bigint

Fee in the token’s base units

If amount is negative, or tier is not a known PrivacyTier

computePrivacyTierFee(1_000_000n, PrivacyTier.TIER_1) // 1_000n (10 bps)
computePrivacyTierFee(99n, PrivacyTier.TIER_1) // 0n (no flat floor)