-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor GraphQL queries into separate files for MEX services
- Loading branch information
Showing
12 changed files
with
266 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export const farmsQuery = gql` | ||
query { | ||
farms { | ||
... on FarmModelV1_2 { | ||
version | ||
address | ||
farmToken { | ||
collection | ||
name | ||
ticker | ||
__typename | ||
} | ||
farmingToken { | ||
name | ||
identifier | ||
decimals | ||
__typename | ||
} | ||
farmedToken { | ||
name | ||
identifier | ||
decimals | ||
__typename | ||
} | ||
farmTokenPriceUSD | ||
farmingTokenPriceUSD | ||
farmedTokenPriceUSD | ||
} | ||
... on FarmModelV1_3 { | ||
version | ||
address | ||
farmToken { | ||
collection | ||
name | ||
ticker | ||
__typename | ||
} | ||
farmingToken { | ||
name | ||
identifier | ||
decimals | ||
__typename | ||
} | ||
farmedToken { | ||
name | ||
identifier | ||
decimals | ||
__typename | ||
} | ||
farmTokenPriceUSD | ||
farmingTokenPriceUSD | ||
farmedTokenPriceUSD | ||
} | ||
... on FarmModelV2 { | ||
version | ||
address | ||
farmToken { | ||
collection | ||
name | ||
ticker | ||
__typename | ||
} | ||
farmingToken { | ||
name | ||
identifier | ||
decimals | ||
__typename | ||
} | ||
farmedToken { | ||
name | ||
identifier | ||
decimals | ||
__typename | ||
} | ||
farmTokenPriceUSD | ||
farmingTokenPriceUSD | ||
farmedTokenPriceUSD | ||
} | ||
} | ||
stakingFarms { | ||
address | ||
farmingToken { | ||
name | ||
identifier | ||
decimals | ||
__typename | ||
} | ||
farmToken { | ||
name | ||
collection | ||
decimals | ||
__typename | ||
} | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export const filteredPairsQuery = (includeFarms: boolean = false) => { | ||
const farmFields = includeFarms ? ` | ||
hasFarms | ||
hasDualFarms` : ''; | ||
|
||
return gql` | ||
query filteredPairs($pagination: ConnectionArgs!, $filters: PairsFilter!) { | ||
filteredPairs(pagination: $pagination, filters: $filters) { | ||
edges { | ||
cursor | ||
node { | ||
address | ||
liquidityPoolToken { | ||
identifier | ||
name | ||
__typename | ||
} | ||
liquidityPoolTokenPriceUSD | ||
firstToken { | ||
name | ||
identifier | ||
previous24hPrice | ||
__typename | ||
} | ||
secondToken { | ||
name | ||
identifier | ||
previous24hPrice | ||
__typename | ||
} | ||
firstTokenPriceUSD | ||
secondTokenPriceUSD | ||
state | ||
type | ||
lockedValueUSD | ||
volumeUSD24h | ||
tradesCount | ||
tradesCount24h | ||
deployedAt | ||
${farmFields} | ||
} | ||
} | ||
pageInfo { | ||
hasNextPage | ||
} | ||
} | ||
} | ||
`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export const pairCountQuery = gql` | ||
query PairCount { | ||
factory { | ||
pairCount | ||
} | ||
}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export const settingsQuery = (pairLimitCount: number) => gql` | ||
query { | ||
filteredPairs(pagination: {first: ${pairLimitCount}}, filters: {state: ["Active"]}) { | ||
edges { | ||
node { | ||
address | ||
} | ||
} | ||
} | ||
proxy { | ||
address | ||
lockedAssetTokens { | ||
collection | ||
} | ||
} | ||
farms { | ||
... on FarmModelV1_2 { | ||
state | ||
address | ||
} | ||
... on FarmModelV1_3 { | ||
state | ||
address | ||
} | ||
... on FarmModelV2 { | ||
state | ||
address | ||
} | ||
} | ||
wrappingInfo { | ||
address | ||
wrappedToken { | ||
identifier | ||
} | ||
} | ||
distribution { | ||
address | ||
} | ||
lockedAssetFactory { | ||
address | ||
} | ||
stakingFarms { | ||
state | ||
address | ||
} | ||
stakingProxies { | ||
address | ||
} | ||
factory { | ||
address | ||
} | ||
simpleLockEnergy { | ||
baseAssetToken { | ||
identifier | ||
} | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export const stakingProxyQuery = gql` | ||
query StakingProxy { | ||
stakingProxies { | ||
address | ||
dualYieldToken { | ||
name | ||
collection | ||
} | ||
} | ||
}`; |
13 changes: 13 additions & 0 deletions
13
src/endpoints/mex/graphql/token.prices.hour.resolution.query.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export const tokenPricesHourResolutionQuery = (tokenIdentifier: string) => gql` | ||
query tokenPricesHourResolution { | ||
values24h( | ||
series: "${tokenIdentifier}", | ||
metric: "priceUSD" | ||
) { | ||
timestamp | ||
value | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export const tokensQuery = gql` | ||
query tokens { | ||
tokens { | ||
identifier | ||
type | ||
} | ||
}`; |
Oops, something went wrong.