Skip to content

Commit

Permalink
fix: Log better quote type (#10751)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the handling of trade orders in the
`V3SwapForm` component by introducing a new `betterOrder` variable and
updating the references to `bestOrder` accordingly.

### Detailed summary
- Added `betterOrder` in `useAllTypeBestTrade.ts` for logging purposes.
- Updated `V3SwapForm` to use `betterOrder?.type` instead of
`bestOrder.type`.
- Adjusted dependencies in the effect hook to include
`betterOrder?.type`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
chefjackson authored Sep 27, 2024
1 parent 715aa1e commit 049b929
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions apps/web/src/views/Swap/V3Swap/hooks/useAllTypeBestTrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export const useAllTypeBestTrade = () => {
return {
ammOrder: classicAmmOrder,
xOrder: currentOrder,
// TODO: for log purpose in this stage
betterOrder: betterQuote,
bestOrder: finalOrder as InterfaceOrder,
tradeLoaded: !finalOrder?.isLoading,
tradeError: finalOrder?.error,
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/views/Swap/V3Swap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useCheckInsufficientError } from './hooks/useCheckSufficient'

export function V3SwapForm() {
const {
betterOrder,
bestOrder,
refreshOrder,
tradeError,
Expand Down Expand Up @@ -52,7 +53,7 @@ export function V3SwapForm() {
outputNative: outputCurrency.isNative,
inputToken: inputCurrency.wrapped.address,
outputToken: outputCurrency.wrapped.address,
bestOrderType: bestOrder.type,
bestOrderType: betterOrder?.type,
ammOrder: {
type: ammOrder.type,
inputAmount: ammInputAmount,
Expand All @@ -76,7 +77,7 @@ export function V3SwapForm() {
},
afterCommit: resumeQuoting,
}
}, [pauseQuoting, resumeQuoting, xOrder, ammOrder, inputUsdPrice, outputUsdPrice, bestOrder.type])
}, [pauseQuoting, resumeQuoting, xOrder, ammOrder, inputUsdPrice, outputUsdPrice, betterOrder?.type])

return (
<>
Expand Down

0 comments on commit 049b929

Please sign in to comment.