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
2eb5ff3c
Unverified
Commit
2eb5ff3c
authored
Mar 11, 2023
by
Tina
Committed by
GitHub
Mar 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: USD price for WETH + don't call gql for testnets (#6133)
fix weth + dont call gql for testnets
parent
a8864614
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
util.tsx
src/graphql/data/util.tsx
+9
-1
useUSDPrice.ts
src/hooks/useUSDPrice.ts
+2
-1
No files found.
src/graphql/data/util.tsx
View file @
2eb5ff3c
...
@@ -73,8 +73,16 @@ export function chainIdToBackendName(chainId: number | undefined) {
...
@@ -73,8 +73,16 @@ export function chainIdToBackendName(chainId: number | undefined) {
:
CHAIN_ID_TO_BACKEND_NAME
[
SupportedChainId
.
MAINNET
]
:
CHAIN_ID_TO_BACKEND_NAME
[
SupportedChainId
.
MAINNET
]
}
}
const
GQL_CHAINS
:
number
[]
=
[
SupportedChainId
.
MAINNET
,
SupportedChainId
.
OPTIMISM
,
SupportedChainId
.
POLYGON
,
SupportedChainId
.
ARBITRUM_ONE
,
SupportedChainId
.
CELO
,
]
export
function
isGqlSupportedChain
(
chainId
:
number
|
undefined
):
chainId
is
SupportedChainId
{
export
function
isGqlSupportedChain
(
chainId
:
number
|
undefined
):
chainId
is
SupportedChainId
{
return
Boolean
(
chainId
&&
CHAIN_ID_TO_BACKEND_NAME
[
chainId
]
)
return
!!
chainId
&&
GQL_CHAINS
.
includes
(
chainId
)
}
}
const
URL_CHAIN_PARAM_TO_BACKEND
:
{
[
key
:
string
]:
Chain
}
=
{
const
URL_CHAIN_PARAM_TO_BACKEND
:
{
[
key
:
string
]:
Chain
}
=
{
...
...
src/hooks/useUSDPrice.ts
View file @
2eb5ff3c
...
@@ -27,7 +27,8 @@ function useETHValue(currencyAmount?: CurrencyAmount<Currency>): CurrencyAmount<
...
@@ -27,7 +27,8 @@ function useETHValue(currencyAmount?: CurrencyAmount<Currency>): CurrencyAmount<
RouterPreference
.
PRICE
RouterPreference
.
PRICE
)
)
if
(
chainId
&&
currencyAmount
&&
currencyAmount
.
currency
.
equals
(
nativeOnChain
(
chainId
)))
{
// Get ETH value of ETH or WETH
if
(
chainId
&&
currencyAmount
&&
currencyAmount
.
currency
.
wrapped
.
equals
(
nativeOnChain
(
chainId
).
wrapped
))
{
return
new
Price
(
currencyAmount
.
currency
,
currencyAmount
.
currency
,
'
1
'
,
'
1
'
).
quote
(
currencyAmount
)
return
new
Price
(
currencyAmount
.
currency
,
currencyAmount
.
currency
,
'
1
'
,
'
1
'
).
quote
(
currencyAmount
)
}
}
...
...
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