@@ -11,6 +11,8 @@ import { useMemo } from 'react';
1111import { useBitcoinPrice } from '@/hooks/useBitcoinPrice' ;
1212import { PositionStatus } from '@/types' ;
1313import { POSITION_STATUS_MAP } from '../history-table/transaction-history-adapter' ;
14+ import { env } from '@/config/env' ;
15+ import { useBtcBlockConfirmations } from '@/hooks/useBtcBlockConfirmations' ;
1416
1517interface PositionTrackerProps {
1618 open : boolean ;
@@ -41,18 +43,31 @@ export function PositionTracker({
4143 return usdValue . toFixed ( 2 ) ;
4244 } , [ evmPosition ?. originalAmount , bitcoinPrice ?. bitcoin ?. usd ] ) ;
4345
44- const maxConfirmations = Number ( fiatAmount ) > 1000 ? 20 : 6 ;
46+ const maxConfirmations =
47+ Number ( fiatAmount ) > env . VITE_EVM_CONFIRMATIONS_USD_AMOUNT
48+ ? env . VITE_EVM_CONFIRMATIONS_HIGH
49+ : env . VITE_EVM_CONFIRMATIONS_LOW ;
4550 const confirmations = useTxConfirmations ( {
4651 isActive : open ,
4752 maxConfirmations : maxConfirmations ,
4853 transactionHash : txHash ,
4954 } ) ;
55+
5056 const status = POSITION_STATUS_MAP [ evmPosition ?. status || 1 ] ;
5157 const isPositionCompleted = status === PositionStatus . Closed ;
5258 const displayConfirmations = isPositionCompleted
5359 ? maxConfirmations
5460 : confirmations ;
5561
62+ const targetConfirmations = useBtcBlockConfirmations ( {
63+ isActive : isPositionCompleted ,
64+ blockNumber : position ?. targetBlockNumber ,
65+ } ) ;
66+
67+ const displayTargetConfirmations = isPositionCompleted
68+ ? env . VITE_BTC_CONFIRMATIONS
69+ : targetConfirmations ;
70+
5671 return (
5772 < BaseTransactionTracker
5873 open = { open }
@@ -92,9 +107,12 @@ export function PositionTracker({
92107 >
93108 { isPositionCompleted && (
94109 < BtcCompletionCard
110+ confirmations = { displayTargetConfirmations }
95111 amount = { amount }
96112 recipientAddress = { evmPosition ?. positionId || '' }
97- reservationTx = { position ?. targetTxhash || position ?. targetBlockHash || '' }
113+ reservationTx = {
114+ position ?. targetTxhash || position ?. targetBlockHash || ''
115+ }
98116 type = "position"
99117 />
100118 ) }
0 commit comments