Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
d160d1a9
Unverified
Commit
d160d1a9
authored
Jul 27, 2023
by
cartcrom
Committed by
GitHub
Jul 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: don't fetch UniswapX quotes if user has disabled UniswapX (#7028)
parent
1092bc2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
useRoutingAPIArguments.ts
src/lib/hooks/routing/useRoutingAPIArguments.ts
+5
-1
slice.ts
src/state/routing/slice.ts
+2
-0
No files found.
src/lib/hooks/routing/useRoutingAPIArguments.ts
View file @
d160d1a9
...
@@ -6,6 +6,7 @@ import { useUniswapXSyntheticQuoteEnabled } from 'featureFlags/flags/uniswapXUse
...
@@ -6,6 +6,7 @@ import { useUniswapXSyntheticQuoteEnabled } from 'featureFlags/flags/uniswapXUse
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
GetQuoteArgs
,
INTERNAL_ROUTER_PREFERENCE_PRICE
,
RouterPreference
}
from
'
state/routing/slice
'
import
{
GetQuoteArgs
,
INTERNAL_ROUTER_PREFERENCE_PRICE
,
RouterPreference
}
from
'
state/routing/slice
'
import
{
currencyAddressForSwapQuote
}
from
'
state/routing/utils
'
import
{
currencyAddressForSwapQuote
}
from
'
state/routing/utils
'
import
{
useUserDisabledUniswapX
}
from
'
state/user/hooks
'
/**
/**
* Returns query arguments for the Routing API query or undefined if the
* Returns query arguments for the Routing API query or undefined if the
...
@@ -30,6 +31,7 @@ export function useRoutingAPIArguments({
...
@@ -30,6 +31,7 @@ export function useRoutingAPIArguments({
const
uniswapXEnabled
=
useUniswapXEnabled
()
const
uniswapXEnabled
=
useUniswapXEnabled
()
const
uniswapXForceSyntheticQuotes
=
useUniswapXSyntheticQuoteEnabled
()
const
uniswapXForceSyntheticQuotes
=
useUniswapXSyntheticQuoteEnabled
()
const
forceUniswapXOn
=
useForceUniswapXOn
()
const
forceUniswapXOn
=
useForceUniswapXOn
()
const
userDisabledUniswapX
=
useUserDisabledUniswapX
()
const
isRoutingAPIPrice
=
useRoutingAPIForPrice
()
const
isRoutingAPIPrice
=
useRoutingAPIForPrice
()
return
useMemo
(
return
useMemo
(
...
@@ -54,6 +56,7 @@ export function useRoutingAPIArguments({
...
@@ -54,6 +56,7 @@ export function useRoutingAPIArguments({
uniswapXEnabled
,
uniswapXEnabled
,
uniswapXForceSyntheticQuotes
,
uniswapXForceSyntheticQuotes
,
forceUniswapXOn
,
forceUniswapXOn
,
userDisabledUniswapX
,
},
},
[
[
account
,
account
,
...
@@ -62,10 +65,11 @@ export function useRoutingAPIArguments({
...
@@ -62,10 +65,11 @@ export function useRoutingAPIArguments({
tokenIn
,
tokenIn
,
tokenOut
,
tokenOut
,
tradeType
,
tradeType
,
uniswapXEnabled
,
isRoutingAPIPrice
,
isRoutingAPIPrice
,
uniswapXEnabled
,
uniswapXForceSyntheticQuotes
,
uniswapXForceSyntheticQuotes
,
forceUniswapXOn
,
forceUniswapXOn
,
userDisabledUniswapX
,
]
]
)
)
}
}
src/state/routing/slice.ts
View file @
d160d1a9
...
@@ -53,6 +53,7 @@ export interface GetQuoteArgs {
...
@@ -53,6 +53,7 @@ export interface GetQuoteArgs {
uniswapXEnabled
:
boolean
uniswapXEnabled
:
boolean
uniswapXForceSyntheticQuotes
:
boolean
uniswapXForceSyntheticQuotes
:
boolean
forceUniswapXOn
:
boolean
forceUniswapXOn
:
boolean
userDisabledUniswapX
:
boolean
isRoutingAPIPrice
?:
boolean
isRoutingAPIPrice
?:
boolean
}
}
...
@@ -86,6 +87,7 @@ function getRoutingAPIConfig(args: GetQuoteArgs): RoutingConfig {
...
@@ -86,6 +87,7 @@ function getRoutingAPIConfig(args: GetQuoteArgs): RoutingConfig {
// so even if the user has selected UniswapX as their router preference, force them to receive a Classic quote.
// so even if the user has selected UniswapX as their router preference, force them to receive a Classic quote.
if
(
if
(
!
args
.
uniswapXEnabled
||
!
args
.
uniswapXEnabled
||
args
.
userDisabledUniswapX
||
tokenOutIsNative
||
tokenOutIsNative
||
tradeType
===
TradeType
.
EXACT_OUTPUT
||
tradeType
===
TradeType
.
EXACT_OUTPUT
||
!
isUniswapXSupportedChain
(
tokenInChainId
)
!
isUniswapXSupportedChain
(
tokenInChainId
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment