Skip to content

Commit 131550c

Browse files
committed
debug: add log to calculate the time to get quotes
1 parent fad80e6 commit 131550c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

apps/kyberswap-interface/src/pages/CrossChainSwap/hooks/useCrossChainSwap.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,10 @@ export const CrossChainSwapRegistryProvider = ({ children }: { children: React.R
612612
setLoading(true)
613613
setAllLoading(true)
614614

615+
// Track quote fetching time
616+
const quoteStartTime = performance.now()
617+
console.log('[Quote Timing] Starting to fetch quotes...')
618+
615619
const getQuotesWithCancellation = async (params: QuoteParams | NearQuoteParams) => {
616620
const quotes: Quote[] = []
617621

@@ -948,6 +952,18 @@ export const CrossChainSwapRegistryProvider = ({ children }: { children: React.R
948952
} finally {
949953
setLoading(false)
950954
setAllLoading(false)
955+
956+
// Log total time taken to fetch all quotes
957+
const quoteEndTime = performance.now()
958+
const totalTime = quoteEndTime - quoteStartTime
959+
const tokenInSymbol = (currencyIn as any)?.symbol || (currencyIn as any)?.wrapped?.symbol || 'Unknown'
960+
const tokenOutSymbol = (currencyOut as any)?.symbol || (currencyOut as any)?.wrapped?.symbol || 'Unknown'
961+
console.log(
962+
`[Quote Timing] All quotes fetched and processed. ${amount} ${tokenInSymbol} -> ${tokenOutSymbol}. Total time: ${totalTime.toFixed(
963+
2,
964+
)}ms (${(totalTime / 1000).toFixed(2)}s)`,
965+
)
966+
console.log(`[Quote Timing] Number of quotes received: ${quotes.length}`)
951967
}
952968
}, [
953969
sender,

0 commit comments

Comments
 (0)