-
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.
remove unused graphql fields (#1448)
* remove unused graphql fields * includeHasFarms filter * update specs * fix specs * fixes * refactoring * add context tracker * add selftUrl * mexsettings refactoring * remove double filters * remove unused import * implement curso pagination * fix spec * remove logs * use filteredPairs instead of pairs in settings * pairs are already filtered by state Active * remove hardcoded pairs count and add factory query to fetch the pairs count * update logs * Refactor GraphQL queries into separate files for MEX services * add API documentation and error handling for MEX endpoints * update readme * undo changes
- Loading branch information
Showing
21 changed files
with
438 additions
and
361 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
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
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ export class MexPairsFilter { | |
Object.assign(this, init); | ||
} | ||
exchange?: MexPairExchange; | ||
includeFarms?: boolean; | ||
} |
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
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.