computePrivacyTierFee()
SIP Protocol API Reference v0.15.1
SIP Protocol API Reference / computePrivacyTierFee
Function: computePrivacyTierFee()
Section titled “Function: 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.
Parameters
Section titled “Parameters”amount
Section titled “amount”bigint
Gross amount in the token’s base units (non-negative)
The privacy tier whose rate applies
Returns
Section titled “Returns”bigint
Fee in the token’s base units
Throws
Section titled “Throws”If amount is negative, or tier is not a known PrivacyTier
Example
Section titled “Example”computePrivacyTierFee(1_000_000n, PrivacyTier.TIER_1) // 1_000n (10 bps)computePrivacyTierFee(99n, PrivacyTier.TIER_1) // 0n (no flat floor)