@quicknode/sdk
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -9,3 +9,3 @@ { | ||
"license": "MIT", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"main": "./src/index.js", | ||
@@ -16,13 +16,21 @@ "module": "./src/index.esm.js", | ||
"@apollo/client": "^3.6.9", | ||
"graphql": "^16.5.0", | ||
"cross-fetch": "^3.1.5" | ||
"cross-fetch": "^3.1.5", | ||
"graphql": "^16.5.0" | ||
}, | ||
"devDependencies": { | ||
"@graphql-codegen/cli": "2.13.8", | ||
"@graphql-codegen/fragment-matcher": "^3.3.1", | ||
"@graphql-codegen/typescript": "2.8.0", | ||
"@graphql-codegen/typescript-document-nodes": "^2.3.6", | ||
"@graphql-codegen/typescript-operations": "^2.5.5", | ||
"@pollyjs/adapter-node-http": "^6.0.5", | ||
"@pollyjs/core": "^6.0.5", | ||
"@pollyjs/persister-fs": "^6.0.5", | ||
"@types/node": "16.11.7", | ||
"@types/supertest": "^2.0.12", | ||
"@types/node": "16.11.7", | ||
"supertest": "^6.2.4" | ||
}, | ||
"scripts": { | ||
"codegen": "graphql-codegen --config codegen.yml" | ||
} | ||
} |
@@ -1,12 +0,14 @@ | ||
![npm](https://img.shields.io/npm/dm/@quicknode/sdk) | ||
![npm](https://img.shields.io/npm/v/@quicknode/sdk?color=g) | ||
![Maintenance](https://img.shields.io/maintenance/yes/2022?color=g) | ||
![NPM](https://img.shields.io/npm/l/@quicknode/sdk?color=g) | ||
![GitHub issues](https://img.shields.io/github/issues-raw/quiknode-labs/qn-oss?color=g) | ||
![Discord](https://img.shields.io/discord/880505845090250794?color=g) | ||
# QuickNode SDK | ||
Currently has support for getting started with [Icy Tools GraphQL API](https://developers.icy.tools/) in a blink! | ||
An SDK from [QuickNode](https://www.quicknode.com/) making it easy for developers to interact with the blockchain. | ||
Currently supports getting started with [Icy Tools GraphQL API](https://developers.icy.tools/) in a blink! | ||
[![npm](https://img.shields.io/npm/dm/@quicknode/sdk)](https://www.npmjs.com/package/@quicknode/sdk) | ||
[![npm](https://img.shields.io/npm/v/@quicknode/sdk?color=g)](https://www.npmjs.com/package/@quicknode/sdk) | ||
![Maintenance](https://img.shields.io/maintenance/yes/2022?color=g) | ||
[![License](https://img.shields.io/npm/l/@quicknode/sdk?color=g)](https://github.com/quiknode-labs/qn-oss/blob/main/LICENSE.txt) | ||
[![GitHub issues](https://img.shields.io/github/issues-raw/quiknode-labs/qn-oss?color=g)](https://github.com/quiknode-labs/qn-oss/issues) | ||
[![Discord](https://img.shields.io/discord/880505845090250794?color=g)](https://discord.gg/DkdgEqE) | ||
## Quick Start | ||
@@ -228,2 +230,25 @@ | ||
### nft.getTrendingNFTCollections | ||
| Argument | Values | Optional | Description | Example | | ||
| -------------- | --------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | | ||
| first | number | ✅ | Number of results to return | 10 | | ||
| after | string | ✅ | Return results after end cursor | YXJyYXljb25uZWN0aW9uOjUwNQ= | | ||
| orderBy | TrendingCollectionsOrderByEnum | ✅ | Sort contracts by average sale price ('AVERAGE'), number of sales ('SALES') or volume ('VOLUME') | 'AVERAGE' | | ||
| orderDirection | OrderDirectionEnum | ✅ | Sort results ascending ('ASC') or descending ('DESC') | 'ASC' | | ||
| timePeriod | TrendingCollectionsTimePeriodEnum | ✅ | Get results from last hour ('ONE_HOUR'), last 12 hours ('TWELVE_HOURS') results, last day ('ONE_DAY') or last 7 days ('SEVEN_DAYS') | 'ONE_HOUR' | | ||
| timeRange | DateInputType | ✅ | Define the modifier in which `timePeriod` will take action to. It can be equal to ('eq'), greater than ('gt'), greater than or equal to ('gte'), less than ('lt') or less than or equal to ('lte') | 'gt' | | ||
```ts | ||
import { QuickNodeSDK } from '@quicknode/sdk'; | ||
const client = new QuickNodeSDK(); | ||
client.nft | ||
.getTrendingNFTCollections({ | ||
first: 10, | ||
}) | ||
.then((response) => console.log(response)); | ||
``` | ||
## Pagination | ||
@@ -260,2 +285,6 @@ | ||
## Issues | ||
Please submit any questions, issues, or feedback as an [issue in Github](https://github.com/quiknode-labs/qn-oss/issues). | ||
## Building | ||
@@ -272,1 +301,5 @@ | ||
Run `nx lint libs-api-sdk` to execute the lint via [ESLint](https://eslint.org/). | ||
## Generate graphql | ||
Run `yarn codegen` to generate graphql typings via [Codegen](https://www.the-guild.dev/graphql/codegen). |
@@ -1,9 +0,14 @@ | ||
import { ApolloClient, NormalizedCacheObject, QueryOptions } from '@apollo/client'; | ||
import { ApolloClient, NormalizedCacheObject, OperationVariables, QueryOptions } from '@apollo/client'; | ||
import { ResultOutput } from '../utils/removeNodesAndEdges'; | ||
export declare class CustomApolloClient { | ||
apolloClient: ApolloClient<NormalizedCacheObject>; | ||
constructor(apolloClient: ApolloClient<NormalizedCacheObject>); | ||
/** | ||
* @todo improve typing here | ||
*/ | ||
query(options: QueryOptions<any, any>): Promise<any>; | ||
query<TVariables extends OperationVariables, KResults extends Record<string, any>, KResultsOutput extends ResultOutput>(options: QueryOptions<TVariables, KResults>): Promise<{ | ||
data: KResultsOutput; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
} |
export * from './client'; | ||
export { QuickNodeSDK as default } from './client'; | ||
export * from './queries'; | ||
export * from './graphql/types'; |
@@ -1,6 +0,7 @@ | ||
import { PaginationArgs, LogEvents } from '../../../types'; | ||
export declare const getContractEventLogsRawQuery: import("graphql/language/ast").DocumentNode; | ||
export interface ContractEventLogQueryVariables extends PaginationArgs { | ||
address: string; | ||
types?: LogEvents[]; | ||
import { ContractEventLogFragment, ContractEventsLogsQuery, PageInfo } from '../../../graphql/types'; | ||
export interface ContractEventLogsQueryResponse { | ||
contract: ContractEventsLogsQuery['contract'] & { | ||
logsPageInfo: Pick<PageInfo, 'endCursor' | 'hasNextPage'>; | ||
logs: Omit<ContractEventLogFragment, '__typename'>[]; | ||
}; | ||
} |
@@ -1,7 +0,7 @@ | ||
import { PaginationArgs, LogEvents } from '../../../types'; | ||
export declare const getNFTEventLogsRawQuery: import("graphql/language/ast").DocumentNode; | ||
import { LogType } from '../../../graphql/types'; | ||
import { PaginationArgs } from '../sharedTypes'; | ||
export interface EventLogsQueryVariables extends PaginationArgs { | ||
address: string; | ||
tokenId: string; | ||
types?: LogEvents[]; | ||
types?: LogType[]; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { PaginationArgs } from '../../../types'; | ||
import { PaginationArgs } from '../sharedTypes'; | ||
export declare const getContractAddressNFTsRawQuery: import("graphql/language/ast").DocumentNode; | ||
@@ -3,0 +3,0 @@ export interface ContractAddressNFTsQueryVariables extends PaginationArgs { |
@@ -1,6 +0,5 @@ | ||
import { PaginationArgs } from '../../../types'; | ||
export declare const getNFTsWalletAndContractsRawQuery: import("graphql/language/ast").DocumentNode; | ||
export interface NFTWalletAndContractQueryVariables extends PaginationArgs { | ||
import { PaginationArgs } from '../sharedTypes'; | ||
export interface NFTsByWalletAndContractsVariables extends PaginationArgs { | ||
address: string; | ||
contracts: string[]; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { PaginationArgs } from '../../../types'; | ||
import { PaginationArgs } from '../sharedTypes'; | ||
export declare const getWalletENSNFTsRawQuery: import("graphql/language/ast").DocumentNode; | ||
@@ -3,0 +3,0 @@ export interface WalletENSNFTsQueryVariables extends PaginationArgs { |
@@ -1,3 +0,2 @@ | ||
export * from './getNFTsByWalletAddress/getNFTsByWalletAddress'; | ||
export * from './getNFTsByWalletENS/getNFTsByWalletENS'; | ||
export * from './getNFTsByContractAddress/getNFTsByContractAddress'; |
@@ -1,4 +0,2 @@ | ||
import { ApolloQueryResult } from '@apollo/client'; | ||
import { CustomApolloClient } from '../../client/customApolloClient'; | ||
import { WalletAddressNFTsQueryVariables } from './getNFTsByWalletAddress/getNFTsByWalletAddress'; | ||
import { WalletENSNFTsQueryVariables } from './getNFTsByWalletENS/getNFTsByWalletENS'; | ||
@@ -9,16 +7,85 @@ import { ContractAddressNFTsQueryVariables } from './getNFTsByContractAddress/getNFTsByContractAddress'; | ||
import { NFTDetailsQueryVariables } from './getNFTDetails/getNFTDetails'; | ||
import { ContractEventLogQueryVariables } from './getContractEventLogs/getContractEventLogs'; | ||
import { NFTWalletAndContractQueryVariables } from './getNFTsByWalletAndContracts/getNFTsByWalletAndContracts'; | ||
import { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, EventLogsQueryResponse, NFTDetailsQueryResponse, ContractEventLogsQueryResponse } from './sharedTypes'; | ||
import { ContractEventLogsQueryResponse } from './getContractEventLogs/getContractEventLogs'; | ||
import { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, NFTDetailsQueryResponse, EventLogsQueryResponse, PaginationArgs } from './sharedTypes'; | ||
import { TrendingNftCollectionsQueryVariables, WalletNfTsQueryVariables, LogType } from '../../graphql/types'; | ||
import { TrendingNFTCollection } from './getTrendingNFTCollections/getTrendingNFTCollections'; | ||
import { NFTsByWalletAndContractsVariables } from './getNFTsByWalletAndContracts/getNFTsByWalletAndContracts'; | ||
export declare class NFTQueries { | ||
private client; | ||
constructor(client: CustomApolloClient); | ||
getNFTsByWalletAddress(variables: WalletAddressNFTsQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>; | ||
getNFTsByWalletENS(variables: WalletENSNFTsQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>; | ||
getNFTsByContractAddress(variables: ContractAddressNFTsQueryVariables): Promise<ApolloQueryResult<ContractNFTsQueryResponse>>; | ||
getCollectionDetails(variables: CollectionDetailsQueryVariables): Promise<ApolloQueryResult<CollectionDetailsQueryResponse>>; | ||
getNFTEventLogs(variables: EventLogsQueryVariables): Promise<ApolloQueryResult<EventLogsQueryResponse>>; | ||
getNFTDetails(variables: NFTDetailsQueryVariables): Promise<ApolloQueryResult<NFTDetailsQueryResponse>>; | ||
getContractEventLogs(variables: ContractEventLogQueryVariables): Promise<ApolloQueryResult<ContractEventLogsQueryResponse>>; | ||
getNFTsByWalletAndContracts(variables: NFTWalletAndContractQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>; | ||
getNFTsByWalletAddress(variables: WalletNfTsQueryVariables): Promise<{ | ||
data: WalletNFTsQueryResponse; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
getNFTsByWalletENS(variables: WalletENSNFTsQueryVariables): Promise<{ | ||
data: WalletNFTsQueryResponse; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
getNFTsByContractAddress(variables: ContractAddressNFTsQueryVariables): Promise<{ | ||
data: ContractNFTsQueryResponse; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
getCollectionDetails(variables: CollectionDetailsQueryVariables): Promise<{ | ||
data: CollectionDetailsQueryResponse; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
getNFTEventLogs(variables: EventLogsQueryVariables): Promise<{ | ||
data: EventLogsQueryResponse; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
getNFTDetails(variables: NFTDetailsQueryVariables): Promise<{ | ||
data: NFTDetailsQueryResponse; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
getContractEventLogs(variables: { | ||
address: string; | ||
types?: LogType[]; | ||
} & PaginationArgs): Promise<{ | ||
data: ContractEventLogsQueryResponse; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
getNFTsByWalletAndContracts(variables: NFTsByWalletAndContractsVariables): Promise<{ | ||
data: WalletNFTsQueryResponse; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
getTrendingNFTCollections(variables?: TrendingNftCollectionsQueryVariables): Promise<{ | ||
data: TrendingNFTCollection; | ||
errors?: readonly import("graphql").GraphQLError[] | undefined; | ||
error?: import("@apollo/client").ApolloError | undefined; | ||
loading: boolean; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
partial?: boolean | undefined; | ||
}>; | ||
} |
@@ -1,4 +0,19 @@ | ||
/** | ||
* @todo implement generic typing | ||
*/ | ||
export declare const removeNodesAndEdges: (data: any) => any | any[]; | ||
import { PageInfo } from '../graphql/types'; | ||
interface Edge { | ||
__typename?: 'TokenEdge'; | ||
cursor?: string; | ||
node?: Record<string | number | symbol, ResultInput>; | ||
} | ||
interface Connection { | ||
pageInfo?: PageInfo; | ||
edges?: Edge[]; | ||
total?: number; | ||
breadcrumbs?: string; | ||
viewport?: string; | ||
} | ||
interface ResultInput { | ||
[index: string | number | symbol]: Connection | ResultInput | unknown; | ||
} | ||
export declare type ResultOutput = Record<string | number | symbol, any>; | ||
export declare function removeNodesAndEdges<TInput extends ResultInput, TResultOutput extends ResultOutput>(data: TInput): TResultOutput; | ||
export {}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
752416
23
18490
303
11