@quicknode/sdk 0.0.3 → 0.1.0

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
@@ -24,7 +24,7 @@ client.nft
24
24
  .then((response) => console.log(response));
25
25
  ```
26
26
 
27
- Full example implementation [here](https://github.com/user/repo/blob/branch/other_file.md).
27
+ Full example implementation [here](https://github.com/quiknode-labs/qn-oss/tree/main/packages/apps/examples/nft-sdk)
28
28
 
29
29
  ## Providing a config object to the client
30
30
 
@@ -50,11 +50,11 @@ const client = new QuickNodeSDK({
50
50
 
51
51
  ### nft.getNFTsByWalletENS
52
52
 
53
- | Argument | Values | Optional | Example |
54
- | -------- | ------ | -------- | ---------------------------- |
55
- | ensName | string | ❌ | vitalik.eth |
56
- | first | number | ✅ | 10 |
57
- | after | string | ✅ | YXJyYXljb25uZWN0aW9uOjUwNQ== |
53
+ | Argument | Values | Optional | Description | Example |
54
+ | -------- | ------ | -------- | ------------------------------- | --------------------------- |
55
+ | ensName | string | ❌ | Wallet ENS address | vitalik.eth |
56
+ | first | number | ✅ | Number of results to return | 10 |
57
+ | after | string | ✅ | Return results after end cursor | YXJyYXljb25uZWN0aW9uOjUwNQ= |
58
58
 
59
59
  ```ts
60
60
  import { QuickNodeSDK } from '@quicknode/sdk';
@@ -65,18 +65,17 @@ client.nft
65
65
  .getNFTsByWalletENS({
66
66
  ensName: 'vitalik.eth',
67
67
  first: 5,
68
- after: 'YXJyYXljb25uZWN0aW9uOjUwNQ==',
69
68
  })
70
69
  .then((response) => console.log(response));
71
70
  ```
72
71
 
73
72
  ### nft.getNFTsByWalletAddress
74
73
 
75
- | Argument | Values | Optional | Example |
76
- | -------- | ------ | -------- | ------------------------------------------ |
77
- | address | string | ❌ | 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 |
78
- | first | number | ✅ | 10 |
79
- | after | string | ✅ | YXJyYXljb25uZWN0aW9uOjUwNQ== |
74
+ | Argument | Values | Optional | Description | Example |
75
+ | -------- | ------ | -------- | ------------------------------- | ------------------------------------------ |
76
+ | address | string | ❌ | Wallet address | 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 |
77
+ | first | number | ✅ | Number of results to return | 10 |
78
+ | after | string | ✅ | Return results after end cursor | YXJyYXljb25uZWN0aW9uOjUwNQ= |
80
79
 
81
80
  ```ts
82
81
  import { QuickNodeSDK } from '@quicknode/sdk';
@@ -87,11 +86,61 @@ client.nft
87
86
  .getNFTsByWalletAddress({
88
87
  address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
89
88
  first: 5,
90
- after: 'YXJyYXljb25uZWN0aW9uOjUwNQ==',
91
89
  })
92
90
  .then((response) => console.log(response));
93
91
  ```
94
92
 
93
+ ### nft.getNFTsByContractAddress
94
+
95
+ | Argument | Values | Optional | Description | Example |
96
+ | -------- | ------ | -------- | ------------------------------- | ------------------------------------------ |
97
+ | address | string | ❌ | Contract address of NFT | 0x2106C00Ac7dA0A3430aE667879139E832307AeAa |
98
+ | first | number | ✅ | Number of results to return | 10 |
99
+ | after | string | ✅ | Return results after end cursor | YXJyYXljb25uZWN0aW9uOjUwNQ= |
100
+
101
+ ```ts
102
+ import { QuickNodeSDK } from '@quicknode/sdk';
103
+
104
+ const client = new QuickNodeSDK();
105
+
106
+ client.nft
107
+ .getNFTsByContractAddress({
108
+ address: '0x2106C00Ac7dA0A3430aE667879139E832307AeAa',
109
+ first: 5,
110
+ })
111
+ .then((response) => console.log(response));
112
+ ```
113
+
114
+ ## Pagination
115
+
116
+ For functions that support pagination, use the `first` property to specify the amount of results to return.
117
+
118
+ The returned `data.tokensPageInfo.endCursor` property in the response can be used to access subsequent results. This value can be passed in to the `after` property and will return the results after that `endCursor`.
119
+
120
+ `hasNextPage` can be used to determine the end of the results, where it will be `false`.
121
+
122
+ For example, if a response contains:
123
+
124
+ ```
125
+ "data: {
126
+ "tokensPageInfo": {
127
+ "hasNextPage": true,
128
+ "endCursor": 'YXJyYXljb25uZWN0aW9uOlk='
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ calling the following will get the next page of results
135
+
136
+ ```typescript
137
+ client.nft.getNFTsByWalletENS({
138
+ ensName: 'vitalik.eth',
139
+ first: 5,
140
+ after: 'YXJyYXljb25uZWN0aW9uOlk=', // from data.tokensPageInfo.endCursor in response
141
+ });
142
+ ```
143
+
95
144
  # Contributing corner
96
145
 
97
146
  ## Building
package/package.json CHANGED
@@ -6,8 +6,9 @@
6
6
  "directory": "packages/libs/api/sdk"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "0.0.3",
9
+ "version": "0.1.0",
10
10
  "main": "./src/index.js",
11
+ "module": "./src/index.esm.js",
11
12
  "types": "./src/index.d.ts",
12
13
  "dependencies": {
13
14
  "@apollo/client": "^3.6.9",
package/src/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import 'cross-fetch/polyfill';
2
1
  export * from './client';
3
2
  export { QuickNodeSDK as default } from './client';
4
3
  export * from './queries';