Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ export function useSwapAndBridgeContext(
const quoteBridgeContext: QuoteBridgeContext = {
chainName: destChainData.label,
bridgeFee,
estimatedTime: null,
// Prefer the ETA captured from the quote; fall back to the live status estimate
estimatedTime:
bridgeQuoteAmounts?.expectedFillTimeSeconds ?? crossChainOrder.statusResult.fillTimeInSeconds ?? null,
recipient: crossChainOrder.bridgingParams.recipient,
sellAmount: swapAndBridgeOverview.targetAmounts.sellAmount,
buyAmount: swapAndBridgeOverview.targetAmounts.buyAmount,
Expand Down Expand Up @@ -229,6 +231,7 @@ export function useSwapAndBridgeContext(
swapAndBridgeOverview,
bridgeFee,
bridgeMinReceiveAmount,
bridgeQuoteAmounts,
])

const isLoading = isCrossChainOrderLoading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function deserializeQuoteAmounts(amounts: BridgeQuoteAmounts<SerializedAm
amountInIntermediateCurrency: deserializeAmount(amounts.bridgeFeeAmounts.amountInIntermediateCurrency),
}
: undefined,
expectedFillTimeSeconds: amounts.expectedFillTimeSeconds,
}
}

Expand All @@ -61,6 +62,7 @@ export function serializeQuoteAmounts(amounts: BridgeQuoteAmounts): BridgeQuoteA
amountInIntermediateCurrency: serializeAmount(amounts.bridgeFeeAmounts.amountInIntermediateCurrency),
}
: undefined,
expectedFillTimeSeconds: amounts.expectedFillTimeSeconds,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function useBridgeQuoteAmounts(): BridgeQuoteAmounts | null {
bridgeMinReceiveAmount,
bridgeFee: receiveAmountInfo.costs.bridgeFee.amountInDestinationCurrency,
bridgeFeeAmounts: receiveAmountInfo.costs.bridgeFee,
expectedFillTimeSeconds: bridgeQuote.expectedFillTimeSeconds,
}
}, [receiveAmountInfo, swapReceiveAmountInfo, bridgeQuote])
}
3 changes: 3 additions & 0 deletions libs/types/src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export interface BridgeQuoteAmounts<Amount = CurrencyAmount<Currency>> {
amountInIntermediateCurrency: Amount
amountInDestinationCurrency: Amount
}
// Estimated time (in seconds) the bridge leg takes to fill, captured from the quote
// so it can be shown while the order is bridging (see issue #6459)
expectedFillTimeSeconds?: number
}

export type SerializedAmount = {
Expand Down
Loading