@@ -17,16 +17,23 @@ import { buildFeeOptions } from './useMaxSwapAmount/utils'
1717 * points). Use gasSafetyBps for the Max button (needs extra headroom); omit it
1818 * for balance validation (standard estimate is sufficient).
1919 *
20+ * solanaToEvmFeeMultiplier: temporary workaround for the SDK under-reporting
21+ * fees on Solana→EVM routes. Multiplied into the raw fee before gasSafetyBps
22+ * is applied. Use 12 for validation, 15 for Max. No effect on other routes.
23+ *
2024 * Returns gasFee as undefined while the estimate is loading.
2125 */
2226export const useFeeEstimation = ( {
2327 quote,
2428 fromNetwork,
25- gasSafetyBps = 0
29+ gasSafetyBps = 0 ,
30+ solanaToEvmFeeMultiplier = 1
2631} : {
2732 quote : Quote | null
2833 fromNetwork ?: NetworkWithCaip2ChainId
2934 gasSafetyBps ?: number
35+ /** Temporary workaround: SDK under-reports fees on Solana→EVM routes */
36+ solanaToEvmFeeMultiplier ?: number
3037} ) : {
3138 gasFee : bigint | undefined
3239 rawGasFee : bigint | undefined
@@ -47,18 +54,26 @@ export const useFeeEstimation = ({
4754 ReactQueryKeys . FUSION_SWAP_FEE_ESTIMATE ,
4855 quote ?. id ,
4956 feeOptions . feeUnitsMarginBps ,
50- gasSafetyBps
57+ gasSafetyBps ,
58+ solanaToEvmFeeMultiplier
5159 ] ,
5260 queryFn : quote
5361 ? async ( ) => {
5462 const { totalUpfrontFee } = await FusionService . estimateNativeFee (
5563 quote ,
5664 feeOptions
5765 )
66+ const isSolanaToEvm =
67+ quote . sourceChain . chainId . startsWith ( 'solana:' ) &&
68+ quote . targetChain . chainId . startsWith ( 'eip155:' )
69+ const adjustedFee =
70+ isSolanaToEvm && solanaToEvmFeeMultiplier > 1
71+ ? totalUpfrontFee * BigInt ( solanaToEvmFeeMultiplier )
72+ : totalUpfrontFee
5873 const buffered =
5974 gasSafetyBps > 0
60- ? ( totalUpfrontFee * ( 10000n + BigInt ( gasSafetyBps ) ) ) / 10000n
61- : totalUpfrontFee
75+ ? ( adjustedFee * ( 10000n + BigInt ( gasSafetyBps ) ) ) / 10000n
76+ : adjustedFee
6277 return { raw : totalUpfrontFee , buffered }
6378 }
6479 : skipToken ,
0 commit comments