@@ -20,7 +20,6 @@ const { activeSwap: swap } = useSwapsStore();
2020const { exchangeRates } = useFiatStore ( ) ;
2121const { activeCurrency } = useAccountStore ( ) ;
2222const { accountBalance : accountBtcBalance , accountUtxos } = useBtcAddressStore ( ) ;
23- const { estimate } = useSwapEstimate ( ) ;
2423
2524/**
2625 * Sell - Sell crypto related things
@@ -46,17 +45,21 @@ export const oasisSellLimitExceeded = computed(() => {
4645 return deniedSettlementInfo . detail . reason === DeniedReason . LIMIT_EXCEEDED ;
4746} ) ;
4847
49- export const nimFeePerUnit = computed ( ( ) =>
50- ( estimate . value && estimate . value . from . asset === SwapAsset . NIM && estimate . value . from . feePerUnit )
51- || ( assets . value && assets . value [ SwapAsset . NIM ] . feePerUnit )
52- || 0 , // Default zero fees for NIM
53- ) ;
48+ export const nimFeePerUnit = computed ( ( ) => {
49+ const { estimate } = useSwapEstimate ( ) ;
5450
55- export const btcFeePerUnit = computed ( ( ) =>
56- ( estimate . value && estimate . value . from . asset === SwapAsset . BTC && estimate . value . from . feePerUnit )
57- || ( assets . value && assets . value [ SwapAsset . BTC ] . feePerUnit )
58- || 1 ,
59- ) ;
51+ return ( estimate . value && estimate . value . from . asset === SwapAsset . NIM && estimate . value . from . feePerUnit )
52+ || ( assets . value && assets . value [ SwapAsset . NIM ] . feePerUnit )
53+ || 0 ; // Default zero fees for NIM
54+ } ) ;
55+
56+ export const btcFeePerUnit = computed ( ( ) => {
57+ const { estimate } = useSwapEstimate ( ) ;
58+
59+ return ( estimate . value && estimate . value . from . asset === SwapAsset . BTC && estimate . value . from . feePerUnit )
60+ || ( assets . value && assets . value [ SwapAsset . BTC ] . feePerUnit )
61+ || 1 ;
62+ } ) ;
6063
6164// 48 extra weight units for BTC HTLC funding tx
6265export const btcFeeForSendingAll = computed ( ( ) =>
@@ -118,5 +121,6 @@ export async function updateSellEstimate({ fiatAmount, cryptoAmount }
118121 }
119122 } // eslint-disable-line brace-style
120123
124+ const { estimate } = useSwapEstimate ( ) ;
121125 estimate . value = newEstimate ;
122126}
0 commit comments