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
cd520a9e
Unverified
Commit
cd520a9e
authored
Sep 05, 2023
by
Charles Bachmeier
Committed by
GitHub
Sep 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: add source to subgraph queries (#7253)
* feat: add source to subgraph queries * update test
parent
b6e388c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
23 deletions
+27
-23
.env.production
.env.production
+1
-1
codegen.yml
codegen.yml
+1
-1
add-liquidity.test.ts
cypress/e2e/add-liquidity.test.ts
+18
-14
apollo.ts
src/graphql/thegraph/apollo.ts
+7
-7
No files found.
.env.production
View file @
cd520a9e
...
@@ -12,4 +12,4 @@ REACT_APP_MOONPAY_PUBLISHABLE_KEY="pk_live_uQG4BJC4w3cxnqpcSqAfohdBFDTsY6E"
...
@@ -12,4 +12,4 @@ REACT_APP_MOONPAY_PUBLISHABLE_KEY="pk_live_uQG4BJC4w3cxnqpcSqAfohdBFDTsY6E"
REACT_APP_SENTRY_ENABLED=true
REACT_APP_SENTRY_ENABLED=true
REACT_APP_SENTRY_TRACES_SAMPLE_RATE=0.00003
REACT_APP_SENTRY_TRACES_SAMPLE_RATE=0.00003
REACT_APP_STATSIG_PROXY_URL="https://api.uniswap.org/v1/statsig-proxy"
REACT_APP_STATSIG_PROXY_URL="https://api.uniswap.org/v1/statsig-proxy"
THE_GRAPH_SCHEMA_ENDPOINT="https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3"
THE_GRAPH_SCHEMA_ENDPOINT="https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3
?source=uniswap
"
codegen.yml
View file @
cd520a9e
overrideExisting
:
true
overrideExisting
:
true
schema
:
'
https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3'
schema
:
'
https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3
?source=uniswap
'
generates
:
generates
:
./src/graphql/thegraph/schema/schema.graphql
:
./src/graphql/thegraph/schema/schema.graphql
:
plugins
:
plugins
:
...
...
cypress/e2e/add-liquidity.test.ts
View file @
cd520a9e
...
@@ -4,7 +4,7 @@ import { aliasQuery, hasQuery } from '../utils/graphql-test-utils'
...
@@ -4,7 +4,7 @@ import { aliasQuery, hasQuery } from '../utils/graphql-test-utils'
describe
(
'
Add Liquidity
'
,
()
=>
{
describe
(
'
Add Liquidity
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
cy
.
intercept
(
'
POST
'
,
'
/subgraphs/name/uniswap/uniswap-v3
'
,
(
req
)
=>
{
cy
.
intercept
(
'
POST
'
,
'
/subgraphs/name/uniswap/uniswap-v3
?source=uniswap
'
,
(
req
)
=>
{
aliasQuery
(
req
,
'
feeTierDistribution
'
)
aliasQuery
(
req
,
'
feeTierDistribution
'
)
})
})
})
})
...
@@ -29,22 +29,26 @@ describe('Add Liquidity', () => {
...
@@ -29,22 +29,26 @@ describe('Add Liquidity', () => {
it
(
'
loads fee tier distribution
'
,
()
=>
{
it
(
'
loads fee tier distribution
'
,
()
=>
{
cy
.
fixture
(
'
feeTierDistribution.json
'
).
then
((
feeTierDistribution
)
=>
{
cy
.
fixture
(
'
feeTierDistribution.json
'
).
then
((
feeTierDistribution
)
=>
{
cy
.
intercept
(
'
POST
'
,
'
/subgraphs/name/uniswap/uniswap-v3
'
,
(
req
:
CyHttpMessages
.
IncomingHttpRequest
)
=>
{
cy
.
intercept
(
if
(
hasQuery
(
req
,
'
FeeTierDistribution
'
))
{
'
POST
'
,
req
.
alias
=
'
FeeTierDistribution
'
'
/subgraphs/name/uniswap/uniswap-v3?source=uniswap
'
,
(
req
:
CyHttpMessages
.
IncomingHttpRequest
)
=>
{
if
(
hasQuery
(
req
,
'
FeeTierDistribution
'
))
{
req
.
alias
=
'
FeeTierDistribution
'
req
.
reply
({
req
.
reply
({
body
:
{
body
:
{
data
:
{
data
:
{
...
feeTierDistribution
,
...
feeTierDistribution
,
},
},
},
},
headers
:
{
headers
:
{
'
access-control-allow-origin
'
:
'
*
'
,
'
access-control-allow-origin
'
:
'
*
'
,
}
,
}
,
}
)
}
)
}
}
}
}
)
)
cy
.
visit
(
'
/add/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984/ETH
'
)
cy
.
visit
(
'
/add/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984/ETH
'
)
cy
.
wait
(
'
@FeeTierDistribution
'
)
cy
.
wait
(
'
@FeeTierDistribution
'
)
...
...
src/graphql/thegraph/apollo.ts
View file @
cd520a9e
...
@@ -4,13 +4,13 @@ import { ChainId } from '@uniswap/sdk-core'
...
@@ -4,13 +4,13 @@ import { ChainId } from '@uniswap/sdk-core'
import
store
from
'
../../state/index
'
import
store
from
'
../../state/index
'
const
CHAIN_SUBGRAPH_URL
:
Record
<
number
,
string
>
=
{
const
CHAIN_SUBGRAPH_URL
:
Record
<
number
,
string
>
=
{
[
ChainId
.
MAINNET
]:
'
https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3
'
,
[
ChainId
.
MAINNET
]:
'
https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3
?source=uniswap
'
,
[
ChainId
.
ARBITRUM_ONE
]:
'
https://thegraph.com/hosted-service/subgraph/ianlapham/uniswap-arbitrum-one
'
,
[
ChainId
.
ARBITRUM_ONE
]:
'
https://thegraph.com/hosted-service/subgraph/ianlapham/uniswap-arbitrum-one
?source=uniswap
'
,
[
ChainId
.
OPTIMISM
]:
'
https://api.thegraph.com/subgraphs/name/ianlapham/optimism-post-regenesis
'
,
[
ChainId
.
OPTIMISM
]:
'
https://api.thegraph.com/subgraphs/name/ianlapham/optimism-post-regenesis
?source=uniswap
'
,
[
ChainId
.
POLYGON
]:
'
https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon
'
,
[
ChainId
.
POLYGON
]:
'
https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon
?source=uniswap
'
,
[
ChainId
.
CELO
]:
'
https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo
'
,
[
ChainId
.
CELO
]:
'
https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo
?source=uniswap
'
,
[
ChainId
.
BNB
]:
'
https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-bsc
'
,
[
ChainId
.
BNB
]:
'
https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-bsc
?source=uniswap
'
,
[
ChainId
.
AVALANCHE
]:
'
https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax
'
,
[
ChainId
.
AVALANCHE
]:
'
https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax
?source=uniswap
'
,
}
}
const
httpLink
=
new
HttpLink
({
uri
:
CHAIN_SUBGRAPH_URL
[
ChainId
.
MAINNET
]
})
const
httpLink
=
new
HttpLink
({
uri
:
CHAIN_SUBGRAPH_URL
[
ChainId
.
MAINNET
]
})
...
...
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