2021-08-12 09:58:13 +00:00
|
|
|
//
|
|
|
|
// Copyright 2021 Vulcanize, Inc.
|
|
|
|
//
|
|
|
|
|
2021-07-01 11:12:37 +00:00
|
|
|
import { gql } from 'graphql-request';
|
|
|
|
|
2021-07-22 04:32:06 +00:00
|
|
|
const resultEvent = `
|
|
|
|
{
|
|
|
|
block {
|
|
|
|
number
|
|
|
|
hash
|
|
|
|
timestamp
|
|
|
|
parentHash
|
|
|
|
}
|
|
|
|
tx {
|
|
|
|
hash
|
2021-08-04 13:12:59 +00:00
|
|
|
from
|
|
|
|
to
|
|
|
|
index
|
2021-07-22 04:32:06 +00:00
|
|
|
}
|
|
|
|
contract
|
|
|
|
eventIndex
|
|
|
|
|
|
|
|
event {
|
|
|
|
__typename
|
|
|
|
|
|
|
|
... on PoolCreatedEvent {
|
|
|
|
token0
|
|
|
|
token1
|
|
|
|
fee
|
|
|
|
tickSpacing
|
|
|
|
pool
|
2021-07-01 11:12:37 +00:00
|
|
|
}
|
2021-07-22 04:32:06 +00:00
|
|
|
|
|
|
|
... on InitializeEvent {
|
|
|
|
sqrtPriceX96
|
|
|
|
tick
|
|
|
|
}
|
|
|
|
|
|
|
|
... on MintEvent {
|
|
|
|
sender
|
|
|
|
owner
|
|
|
|
tickLower
|
|
|
|
tickUpper
|
|
|
|
amount
|
|
|
|
amount0
|
|
|
|
amount1
|
|
|
|
}
|
|
|
|
|
|
|
|
... on BurnEvent {
|
|
|
|
owner
|
|
|
|
tickLower
|
|
|
|
tickUpper
|
|
|
|
amount
|
|
|
|
amount0
|
|
|
|
amount1
|
|
|
|
}
|
|
|
|
|
|
|
|
... on SwapEvent {
|
|
|
|
sender
|
|
|
|
recipient
|
|
|
|
amount0
|
|
|
|
amount1
|
|
|
|
sqrtPriceX96
|
|
|
|
liquidity
|
|
|
|
tick
|
|
|
|
}
|
|
|
|
|
|
|
|
... on IncreaseLiquidityEvent {
|
|
|
|
tokenId
|
|
|
|
liquidity
|
|
|
|
amount0
|
|
|
|
amount1
|
|
|
|
}
|
|
|
|
|
|
|
|
... on DecreaseLiquidityEvent {
|
|
|
|
tokenId
|
|
|
|
liquidity
|
|
|
|
amount0
|
|
|
|
amount1
|
2021-07-01 11:12:37 +00:00
|
|
|
}
|
2021-07-22 06:15:21 +00:00
|
|
|
|
|
|
|
... on CollectEvent {
|
|
|
|
tokenId
|
|
|
|
recipient
|
|
|
|
amount0
|
|
|
|
amount1
|
|
|
|
}
|
|
|
|
|
|
|
|
... on TransferEvent {
|
|
|
|
from
|
|
|
|
to
|
|
|
|
tokenId
|
|
|
|
}
|
2021-07-01 11:12:37 +00:00
|
|
|
}
|
2021-07-22 04:32:06 +00:00
|
|
|
|
|
|
|
proof {
|
|
|
|
data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const subscribeEvents = gql`
|
|
|
|
subscription SubscriptionEvents {
|
|
|
|
onEvent
|
|
|
|
${resultEvent}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const queryEvents = gql`
|
|
|
|
query getEvents($blockHash: String!, $contract: String) {
|
|
|
|
events(blockHash: $blockHash, contract: $contract)
|
|
|
|
${resultEvent}
|
2021-07-01 11:12:37 +00:00
|
|
|
}
|
|
|
|
`;
|
2021-07-16 13:04:51 +00:00
|
|
|
|
|
|
|
export const queryPosition = gql`
|
|
|
|
query getPosition($blockHash: String!, $tokenId: String!) {
|
|
|
|
position(blockHash: $blockHash, tokenId: $tokenId) {
|
|
|
|
nonce
|
|
|
|
operator
|
|
|
|
poolId
|
|
|
|
tickLower
|
|
|
|
tickUpper
|
|
|
|
liquidity
|
|
|
|
feeGrowthInside0LastX128
|
|
|
|
feeGrowthInside1LastX128
|
|
|
|
tokensOwed0
|
|
|
|
tokensOwed1
|
|
|
|
|
|
|
|
proof {
|
|
|
|
data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const queryPoolIdToPoolKey = gql`
|
|
|
|
query poolIdToPoolKey($blockHash: String!, $poolId: String!) {
|
|
|
|
poolIdToPoolKey(blockHash: $blockHash, poolId: $poolId) {
|
|
|
|
token0
|
|
|
|
token1
|
|
|
|
fee
|
|
|
|
|
|
|
|
proof {
|
|
|
|
data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const queryGetPool = gql`
|
|
|
|
query getPool($blockHash: String!, $token0: String!, $token1: String!, $fee: String!) {
|
|
|
|
getPool(blockHash: $blockHash, token0: $token0, token1: $token1, fee: $fee) {
|
|
|
|
pool
|
|
|
|
proof {
|
|
|
|
data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2021-08-10 06:39:00 +00:00
|
|
|
|
2021-08-11 10:57:42 +00:00
|
|
|
export const queryGetContract = gql`
|
|
|
|
query queryGetContract($type: String!) {
|
|
|
|
getContract(type: $type) {
|
2021-08-10 06:39:00 +00:00
|
|
|
address
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|