calculateFeeForSwap()
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / calculateFeeForSwap
Function: calculateFeeForSwap()
Section titled “Function: calculateFeeForSwap()”calculateFeeForSwap(
contract,swapAmount,swapAmountUsd,sourceChain,destChain,viewingKeyDisclosed?):Promise<{fee:FeeCalculationResult;netAmount:bigint;netAmountUsd:number; }>
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:24675
Calculate fee and add to transaction
Helper for integrating fee collection into swap flows.
Parameters
Section titled “Parameters”contract
Section titled “contract”swapAmount
Section titled “swapAmount”bigint
swapAmountUsd
Section titled “swapAmountUsd”number
sourceChain
Section titled “sourceChain”destChain
Section titled “destChain”viewingKeyDisclosed?
Section titled “viewingKeyDisclosed?”boolean
Returns
Section titled “Returns”Promise<{ fee: FeeCalculationResult; netAmount: bigint; netAmountUsd: number; }>