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
bc08e926
Unverified
Commit
bc08e926
authored
May 31, 2023
by
Vignesh Mohankumar
Committed by
GitHub
May 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: increased debounce swap quote rate (#6666)
* feat: increased debounce swap quote time * fix
parent
8c8300a5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
12 deletions
+24
-12
debounceSwapQuote.ts
src/featureFlags/flags/debounceSwapQuote.ts
+7
-0
featureFlags.ts
src/featureFlags/flags/featureFlags.ts
+0
-10
index.tsx
src/featureFlags/index.tsx
+12
-1
useBestTrade.ts
src/hooks/useBestTrade.ts
+5
-1
No files found.
src/featureFlags/flags/debounceSwapQuote.ts
0 → 100644
View file @
bc08e926
import
{
BaseVariant
,
FeatureFlag
,
useBaseFlag
}
from
'
../index
'
export
function
useDebounceSwapQuoteFlag
():
BaseVariant
{
return
useBaseFlag
(
FeatureFlag
.
debounceSwapQuote
)
}
export
{
BaseVariant
as
DebounceSwapQuoteVariant
}
src/featureFlags/flags/featureFlags.ts
deleted
100644 → 0
View file @
8c8300a5
/**
* The value here must match the value in the statsig dashboard, if you plan to use statsig.
*/
export
enum
FeatureFlag
{
traceJsonRpc
=
'
traceJsonRpc
'
,
permit2
=
'
permit2
'
,
fiatOnRampButtonOnSwap
=
'
fiat_on_ramp_button_on_swap_page
'
,
detailsV2
=
'
details_v2
'
,
uraEnabled
=
'
ura_enabled
'
,
}
src/featureFlags/index.tsx
View file @
bc08e926
import
{
atomWithStorage
,
useAtomValue
,
useUpdateAtom
}
from
'
jotai/utils
'
import
{
atomWithStorage
,
useAtomValue
,
useUpdateAtom
}
from
'
jotai/utils
'
import
{
createContext
,
ReactNode
,
useCallback
,
useContext
}
from
'
react
'
import
{
createContext
,
ReactNode
,
useCallback
,
useContext
}
from
'
react
'
import
{
useGate
}
from
'
statsig-react
'
import
{
useGate
}
from
'
statsig-react
'
export
{
FeatureFlag
}
from
'
./flags/featureFlags
'
/**
* The value here must match the value in the statsig dashboard, if you plan to use statsig.
*/
export
enum
FeatureFlag
{
traceJsonRpc
=
'
traceJsonRpc
'
,
permit2
=
'
permit2
'
,
fiatOnRampButtonOnSwap
=
'
fiat_on_ramp_button_on_swap_page
'
,
detailsV2
=
'
details_v2
'
,
uraEnabled
=
'
ura_enabled
'
,
debounceSwapQuote
=
'
debounce_swap_quote
'
,
}
interface
FeatureFlagsContextType
{
interface
FeatureFlagsContextType
{
isLoaded
:
boolean
isLoaded
:
boolean
...
...
src/hooks/useBestTrade.ts
View file @
bc08e926
import
{
Currency
,
CurrencyAmount
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
WRAPPED_NATIVE_CURRENCY
}
from
'
constants/tokens
'
import
{
WRAPPED_NATIVE_CURRENCY
}
from
'
constants/tokens
'
import
{
DebounceSwapQuoteVariant
,
useDebounceSwapQuoteFlag
}
from
'
featureFlags/flags/debounceSwapQuote
'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
InterfaceTrade
,
TradeState
}
from
'
state/routing/types
'
import
{
InterfaceTrade
,
TradeState
}
from
'
state/routing/types
'
import
{
useRoutingAPITrade
}
from
'
state/routing/useRoutingAPITrade
'
import
{
useRoutingAPITrade
}
from
'
state/routing/useRoutingAPITrade
'
...
@@ -14,6 +15,9 @@ import useIsWindowVisible from './useIsWindowVisible'
...
@@ -14,6 +15,9 @@ import useIsWindowVisible from './useIsWindowVisible'
// Prevents excessive quote requests between keystrokes.
// Prevents excessive quote requests between keystrokes.
const
DEBOUNCE_TIME
=
350
const
DEBOUNCE_TIME
=
350
// Temporary until we remove the feature flag.
const
DEBOUNCE_TIME_INCREASED
=
650
/**
/**
* Returns the best v2+v3 trade for a desired swap.
* Returns the best v2+v3 trade for a desired swap.
* @param tradeType whether the swap is an exact in/out
* @param tradeType whether the swap is an exact in/out
...
@@ -34,7 +38,7 @@ export function useBestTrade(
...
@@ -34,7 +38,7 @@ export function useBestTrade(
const
[
debouncedAmount
,
debouncedOtherCurrency
]
=
useDebounce
(
const
[
debouncedAmount
,
debouncedOtherCurrency
]
=
useDebounce
(
useMemo
(()
=>
[
amountSpecified
,
otherCurrency
],
[
amountSpecified
,
otherCurrency
]),
useMemo
(()
=>
[
amountSpecified
,
otherCurrency
],
[
amountSpecified
,
otherCurrency
]),
DEBOUNCE_TIME
useDebounceSwapQuoteFlag
()
===
DebounceSwapQuoteVariant
.
Enabled
?
DEBOUNCE_TIME_INCREASED
:
DEBOUNCE_TIME
)
)
const
isAWrapTransaction
=
useMemo
(()
=>
{
const
isAWrapTransaction
=
useMemo
(()
=>
{
...
...
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