@quicknode/sdk 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,15 @@
1
- ![npm](https://img.shields.io/npm/dm/@quicknode/sdk)
2
- ![npm](https://img.shields.io/npm/v/@quicknode/sdk?color=g)
3
- ![Maintenance](https://img.shields.io/maintenance/yes/2022?color=g)
4
- ![NPM](https://img.shields.io/npm/l/@quicknode/sdk?color=g)
5
- ![GitHub issues](https://img.shields.io/github/issues-raw/quiknode-labs/qn-oss?color=g)
6
- ![Discord](https://img.shields.io/discord/880505845090250794?color=g)
7
-
8
1
  # QuickNode SDK
9
2
 
10
- Currently has support for getting started with [Icy Tools GraphQL API](https://developers.icy.tools/) in a blink!
3
+ An SDK from [QuickNode](https://www.quicknode.com/) making it easy for developers to interact with the blockchain.
4
+
5
+ Currently supports getting started with [Icy Tools GraphQL API](https://developers.icy.tools/) in a blink!
6
+
7
+ [![npm](https://img.shields.io/npm/dm/@quicknode/sdk)](https://www.npmjs.com/package/@quicknode/sdk)
8
+ [![npm](https://img.shields.io/npm/v/@quicknode/sdk?color=g)](https://www.npmjs.com/package/@quicknode/sdk)
9
+ ![Maintenance](https://img.shields.io/maintenance/yes/2022?color=g)
10
+ [![License](https://img.shields.io/npm/l/@quicknode/sdk?color=g)](https://github.com/quiknode-labs/qn-oss/blob/main/LICENSE.txt)
11
+ [![GitHub issues](https://img.shields.io/github/issues-raw/quiknode-labs/qn-oss?color=g)](https://github.com/quiknode-labs/qn-oss/issues)
12
+ [![Discord](https://img.shields.io/discord/880505845090250794?color=g)](https://discord.gg/DkdgEqE)
11
13
 
12
14
  ## Quick Start
13
15
 
@@ -225,6 +227,29 @@ client.nft
225
227
  .then((response) => console.log(response));
226
228
  ```
227
229
 
230
+ ### nft.getTrendingNFTCollections
231
+
232
+ | Argument | Values | Optional | Description | Example |
233
+ | -------------- | --------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
234
+ | first | number | ✅ | Number of results to return | 10 |
235
+ | after | string | ✅ | Return results after end cursor | YXJyYXljb25uZWN0aW9uOjUwNQ= |
236
+ | orderBy | TrendingCollectionsOrderByEnum | ✅ | Sort contracts by average sale price ('AVERAGE'), number of sales ('SALES') or volume ('VOLUME') | 'AVERAGE' |
237
+ | orderDirection | OrderDirectionEnum | ✅ | Sort results ascending ('ASC') or descending ('DESC') | 'ASC' |
238
+ | 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' |
239
+ | 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' |
240
+
241
+ ```ts
242
+ import { QuickNodeSDK } from '@quicknode/sdk';
243
+
244
+ const client = new QuickNodeSDK();
245
+
246
+ client.nft
247
+ .getTrendingNFTCollections({
248
+ first: 10,
249
+ })
250
+ .then((response) => console.log(response));
251
+ ```
252
+
228
253
  ## Pagination
229
254
 
230
255
  For functions that support pagination, use the `first` property to specify the amount of results to return.
@@ -256,6 +281,10 @@ client.nft.getNFTsByWalletENS({
256
281
 
257
282
  # Contributing corner
258
283
 
284
+ ## Issues
285
+
286
+ Please submit any questions, issues, or feedback as an [issue in Github](https://github.com/quiknode-labs/qn-oss/issues).
287
+
259
288
  ## Building
260
289
 
261
290
  Run `nx build libs-api-sdk` to build the library.
@@ -267,3 +296,7 @@ Run `nx test libs-api-sdk` to execute the unit tests via [Jest](https://jestjs.i
267
296
  ## Running lint
268
297
 
269
298
  Run `nx lint libs-api-sdk` to execute the lint via [ESLint](https://eslint.org/).
299
+
300
+ ## Generate graphql
301
+
302
+ Run `yarn codegen` to generate graphql typings via [Codegen](https://www.the-guild.dev/graphql/codegen).
package/package.json CHANGED
@@ -6,21 +6,29 @@
6
6
  "directory": "packages/libs/api/sdk"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "0.5.0",
9
+ "version": "0.5.2",
10
10
  "main": "./src/index.js",
11
11
  "module": "./src/index.esm.js",
12
12
  "types": "./src/index.d.ts",
13
13
  "dependencies": {
14
14
  "@apollo/client": "^3.6.9",
15
- "graphql": "^16.5.0",
16
- "cross-fetch": "^3.1.5"
15
+ "cross-fetch": "^3.1.5",
16
+ "graphql": "^16.5.0"
17
17
  },
18
18
  "devDependencies": {
19
+ "@graphql-codegen/cli": "2.13.8",
20
+ "@graphql-codegen/fragment-matcher": "^3.3.1",
21
+ "@graphql-codegen/typescript": "2.8.0",
22
+ "@graphql-codegen/typescript-document-nodes": "^2.3.6",
23
+ "@graphql-codegen/typescript-operations": "^2.5.5",
19
24
  "@pollyjs/adapter-node-http": "^6.0.5",
20
25
  "@pollyjs/core": "^6.0.5",
21
26
  "@pollyjs/persister-fs": "^6.0.5",
22
- "@types/supertest": "^2.0.12",
23
27
  "@types/node": "16.11.7",
28
+ "@types/supertest": "^2.0.12",
24
29
  "supertest": "^6.2.4"
30
+ },
31
+ "scripts": {
32
+ "codegen": "graphql-codegen --config codegen.yml"
25
33
  }
26
34
  }
@@ -1,9 +1,14 @@
1
- import { ApolloClient, NormalizedCacheObject, QueryOptions } from '@apollo/client';
1
+ import { ApolloClient, NormalizedCacheObject, OperationVariables, QueryOptions } from '@apollo/client';
2
+ import { ResultOutput } from '../utils/removeNodesAndEdges';
2
3
  export declare class CustomApolloClient {
3
4
  apolloClient: ApolloClient<NormalizedCacheObject>;
4
5
  constructor(apolloClient: ApolloClient<NormalizedCacheObject>);
5
- /**
6
- * @todo improve typing here
7
- */
8
- query(options: QueryOptions<any, any>): Promise<any>;
6
+ query<TVariables extends OperationVariables, KResults extends Record<string, any>, KResultsOutput extends ResultOutput>(options: QueryOptions<TVariables, KResults>): Promise<{
7
+ data: KResultsOutput;
8
+ errors?: readonly import("graphql").GraphQLError[] | undefined;
9
+ error?: import("@apollo/client").ApolloError | undefined;
10
+ loading: boolean;
11
+ networkStatus: import("@apollo/client").NetworkStatus;
12
+ partial?: boolean | undefined;
13
+ }>;
9
14
  }
@@ -0,0 +1,7 @@
1
+ export interface PossibleTypesResultData {
2
+ possibleTypes: {
3
+ [key: string]: string[];
4
+ };
5
+ }
6
+ declare const result: PossibleTypesResultData;
7
+ export default result;