Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/simple/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Network } from "../../src/resources/graphql";
import { Defined } from "@definedfi/sdk";

import { Network } from "../../src/resources/graphql";

const sdk = new Defined(process.env.DEFINED_API_KEY || "");

sdk
Expand Down Expand Up @@ -43,3 +44,4 @@ sdk.queries
.symbol({ symbol: "0xd99c7f6c65857ac913a8f880a4cb84032ab2fc5b:56" })
.then(console.log);
sdk.queries.networks().then(console.log);
sdk.queries.networkStatus({ networkIds: [1, 56, 137] }).then(console.log);
8 changes: 7 additions & 1 deletion src/sdk/Query.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { QueryGetBarsArgs } from "../resources/graphql";
import {
QueryGetBarsArgs,
QueryGetNetworkStatusArgs,
} from "../resources/graphql";
import {
FilterExchangesDocument,
FilterExchangesQueryVariables,
FilterTokensDocument,
FilterTokensQueryVariables,
GetBarsDocument,
GetNetworksDocument,
GetNetworkStatusDocument,
GetSparklinesDocument,
GetSparklinesQueryVariables,
GetSymbolDocument,
Expand Down Expand Up @@ -42,4 +46,6 @@ export class Query {
symbol = async (vars: GetSymbolQueryVariables) =>
this.sdk.query(GetSymbolDocument, vars);
networks = async () => this.sdk.query(GetNetworksDocument);
networkStatus = async (vars: QueryGetNetworkStatusArgs) =>
this.sdk.query(GetNetworkStatusDocument, vars);
}
5 changes: 5 additions & 0 deletions src/sdk/generated/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const documents = {
"query FilterExchanges($filters: ExchangeFilters, $phrase: String, $rankings: [ExchangeRanking], $limit: Int, $offset: Int) {\n filterExchanges(\n filters: $filters\n rankings: $rankings\n limit: $limit\n phrase: $phrase\n offset: $offset\n ) {\n results {\n exchange {\n address\n iconUrl\n name\n tradeUrl\n }\n dailyActiveUsers\n monthlyActiveUsers\n txnCount1\n volumeNBT12\n volumeUSD24\n }\n }\n}": types.FilterExchangesDocument,
"query FilterTokens($filters: TokenFilters, $phrase: String, $tokens: [String], $rankings: [TokenRanking], $limit: Int, $offset: Int) {\n filterTokens(\n filters: $filters\n phrase: $phrase\n tokens: $tokens\n rankings: $rankings\n limit: $limit\n offset: $offset\n ) {\n results {\n buyCount1\n buyCount4\n buyCount12\n buyCount24\n change1\n change4\n change12\n change24\n createdAt\n high1\n high4\n high12\n high24\n lastTransaction\n liquidity\n low1\n low4\n low12\n low24\n marketCap\n priceUSD\n quoteToken\n sellCount1\n sellCount4\n sellCount12\n sellCount24\n txnCount1\n txnCount4\n txnCount12\n txnCount24\n uniqueBuys1\n uniqueBuys4\n uniqueBuys12\n uniqueBuys24\n uniqueSells1\n uniqueSells4\n uniqueSells12\n uniqueSells24\n uniqueTransactions1\n uniqueTransactions4\n uniqueTransactions12\n uniqueTransactions24\n volume1\n volume4\n volume12\n volume24\n pair {\n token0\n token1\n pooled {\n token0\n token1\n }\n }\n token {\n address\n decimals\n name\n networkId\n symbol\n info {\n imageSmallUrl\n circulatingSupply\n totalSupply\n }\n }\n }\n }\n}": types.FilterTokensDocument,
"query GetBars($symbol: String!, $from: Int!, $to: Int!, $resolution: String!, $currencyCode: String, $quoteToken: QuoteToken) {\n getBars(\n symbol: $symbol\n from: $from\n to: $to\n resolution: $resolution\n currencyCode: $currencyCode\n quoteToken: $quoteToken\n ) {\n o\n h\n l\n c\n volume\n }\n}": types.GetBarsDocument,
"query GetNetworkStatus($networkIds: [Int!]!) {\n getNetworkStatus(networkIds: $networkIds) {\n networkName\n lastProcessedBlock\n lastProcessedTimestamp\n }\n}": types.GetNetworkStatusDocument,
"query GetNetworks {\n getNetworks {\n id\n name\n }\n}": types.GetNetworksDocument,
"query PairEvents($query: EventsQueryInput!) {\n pairEvents: getTokenEvents(query: $query) {\n cursor\n items {\n address\n baseTokenPrice\n blockHash\n blockNumber\n eventDisplayType\n eventType\n id\n liquidityToken\n maker\n networkId\n quoteToken\n token0PoolValueUsd\n token0SwapValueUsd\n timestamp\n token0ValueBase\n token1PoolValueUsd\n token1SwapValueUsd\n token1ValueBase\n transactionHash\n transactionIndex\n logIndex\n }\n }\n}": types.PairEventsDocument,
"query GetTokenPrice($inputs: [GetPriceInput]) {\n getTokenPrices(inputs: $inputs) {\n address\n networkId\n priceUsd\n }\n}": types.GetTokenPriceDocument,
Expand Down Expand Up @@ -54,6 +55,10 @@ export function graphql(source: "query FilterTokens($filters: TokenFilters, $phr
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "query GetBars($symbol: String!, $from: Int!, $to: Int!, $resolution: String!, $currencyCode: String, $quoteToken: QuoteToken) {\n getBars(\n symbol: $symbol\n from: $from\n to: $to\n resolution: $resolution\n currencyCode: $currencyCode\n quoteToken: $quoteToken\n ) {\n o\n h\n l\n c\n volume\n }\n}"): (typeof documents)["query GetBars($symbol: String!, $from: Int!, $to: Int!, $resolution: String!, $currencyCode: String, $quoteToken: QuoteToken) {\n getBars(\n symbol: $symbol\n from: $from\n to: $to\n resolution: $resolution\n currencyCode: $currencyCode\n quoteToken: $quoteToken\n ) {\n o\n h\n l\n c\n volume\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "query GetNetworkStatus($networkIds: [Int!]!) {\n getNetworkStatus(networkIds: $networkIds) {\n networkName\n lastProcessedBlock\n lastProcessedTimestamp\n }\n}"): (typeof documents)["query GetNetworkStatus($networkIds: [Int!]!) {\n getNetworkStatus(networkIds: $networkIds) {\n networkName\n lastProcessedBlock\n lastProcessedTimestamp\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading