-
Notifications
You must be signed in to change notification settings - Fork 46
Description
I found the order of .graphclientrc.yml affects the query result. Here is the steps to reproduce:
.graphclientrc.yml
sources:
- name: uniswapv3_arbitrum
handler:
graphql:
endpoint: https://gateway-arbitrum.network.thegraph.com/api/[your api key]/subgraphs/id/HyW7A86UEdYVt5b9Lrw8W2F98yKecerHKutZTRbSCX27
- name: uniswapv3_ethereum
handler:
graphql:
endpoint: https://gateway.thegraph.com/api/[your api key]/subgraphs/id/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV
plugins:
- pollingLive:
defaultInterval: 10000
documents:
- operations.gql
operations.gql:
fragment PoolLiveDataFields on Pool {
liquidity
tick
sqrtPrice
feeTier
id
}
query GetMultipleEthereumPoolLiveData($poolIds: [ID!]!) @live(interval: 5000) {
uniswapv3_ethereum: pools(where: { id_in: $poolIds }) {
...PoolLiveDataFields
}
}
query GetMultipleArbitrumPoolLiveData($poolIds: [ID!]!) @live(interval: 5000) {
uniswapv3_arbitrum: pools(where: { id_in: $poolIds }) {
...PoolLiveDataFields
}
}
demo_live_query.ts, client codes:
import {getBuiltGraphSDK} from '../.graphclient'
async function main() {
const sdk = getBuiltGraphSDK()
// chainId=1
const poolIds_ethereum = ["0xe0554a476a092703abdb3ef35c80e0d76d32939f",
"0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8",
"0x7bea39867e4169dbe237d55c8242a8f2fcdcc387",
"0x493035412520336ff4719d4cee527bea55eca844",
"0xdceaf5d0e5e0db9596a47c0c4120654e80b1d706"]
// start to monitor pools on Ethereum
const ethereumStream = await sdk.GetMultipleEthereumPoolLiveData({ poolIds: poolIds_ethereum });
(async () => {
for await (const result of ethereumStream) {
console.log('[Ethereum]', result.uniswapv3_ethereum);
}
})().catch(console.error);
}
main()
run
npx ts-node .\src\demo_live_query.ts
Everything works well.
But when I the order of uniswapv3_arbitrum and uniswapv3_ethereum in .graphclientrc.yml, I get an empty result when ruuning the same client codes
This is the content of .graphclientrc.yml after changing the order:
sources:
- name: uniswapv3_ethereum
handler:
graphql:
endpoint: https://gateway.thegraph.com/api/eada99c8eee80663db1e909b89c14a3f/subgraphs/id/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV
- name: uniswapv3_arbitrum
handler:
graphql:
endpoint: https://gateway-arbitrum.network.thegraph.com/api/eada99c8eee80663db1e909b89c14a3f/subgraphs/id/HyW7A86UEdYVt5b9Lrw8W2F98yKecerHKutZTRbSCX27
plugins:
- pollingLive:
defaultInterval: 10000
documents:
- operations.gql