Skip to main content

Estimating output & fees

Every flow has an estimate method. Estimates return the expected output, the minimum input, and a full fee breakdown.

MethodDirection
wrapAndSwapEstimate(amountBTC, networkName, outputToken?)BTC → EVM/TON/Solana
swapAndUnwrapEstimate(exchangeInfo, networkName)EVM → BTC
swapAndUnwrapEstimateTon(exchangeInfo)TON → BTC

Example: BTC → EVM/TON/Solana​

const estimate = await sdk.wrapAndSwapEstimate(0.001, "optimism", undefined);
{
"minInputAmountBTC": "0.000015015",
"inputAmountBTC": "0.001",
"outputAmount": "96628248",
"teleswapFee": {
"networkFeeBTC": "0.00001000",
"protocolFeeBTC": "0.00000000",
"lockerFeeBTC": "0.00000100",
"thirdPartyFeeBTC": "0.00000000",
"totalFeeBTC": "0.00001100"
}
}

Response fields​

FieldMeaning
inputAmountBTC / inputAmountThe input amount (BTC, or token smallest unit)
outputAmount / outputAmountBTCThe expected output, already net of every fee in teleswapFee
minInputAmountBTCMinimum input the protocol will process
maxInputAmountBTCMaximum input, in BTC — null when none is set
teleswapFeeFee breakdown (see below) — informational, do not subtract it again

Fee breakdown (teleswapFee)​

ComponentDescription
networkFeeBTCBitcoin / gas network fee
protocolFeeBTCProtocol fee
lockerFeeBTCFee paid to the locker
thirdPartyFeeBTCIntegrator fee (if a thirdPartyId is set)
totalFeeBTCSum of all fees

REST equivalents​

POST /api/v2/teleswap/utils/wrap-and-swap-estimate, .../swap-and-unwrap-estimate, .../swap-and-unwrap-estimate-ton. See the API reference.