@quicknode/sdk 0.0.4 → 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/
|
|
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
package/src/index.esm.js
CHANGED
|
@@ -7976,6 +7976,40 @@ const getWalletENSNFTsRawQuery = gql `
|
|
|
7976
7976
|
}
|
|
7977
7977
|
`;
|
|
7978
7978
|
|
|
7979
|
+
const getContractAddressNFTsRawQuery = gql `
|
|
7980
|
+
query ContractNFTs($address: String!, $first: Int, $after: String) {
|
|
7981
|
+
contract(address: $address) {
|
|
7982
|
+
address
|
|
7983
|
+
isVerified
|
|
7984
|
+
tokenStandard
|
|
7985
|
+
tokens(first: $first, after: $after) {
|
|
7986
|
+
pageInfo {
|
|
7987
|
+
hasNextPage
|
|
7988
|
+
endCursor
|
|
7989
|
+
}
|
|
7990
|
+
edges {
|
|
7991
|
+
node {
|
|
7992
|
+
tokenId
|
|
7993
|
+
images {
|
|
7994
|
+
url
|
|
7995
|
+
}
|
|
7996
|
+
... on ERC721Token {
|
|
7997
|
+
contract {
|
|
7998
|
+
address # Included key field for caching
|
|
7999
|
+
}
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
8002
|
+
}
|
|
8003
|
+
}
|
|
8004
|
+
... on ERC721Contract {
|
|
8005
|
+
circulatingSupply
|
|
8006
|
+
name
|
|
8007
|
+
symbol
|
|
8008
|
+
}
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
8011
|
+
`;
|
|
8012
|
+
|
|
7979
8013
|
class NFTQueries {
|
|
7980
8014
|
constructor(client) {
|
|
7981
8015
|
this.client = client;
|
|
@@ -7996,6 +8030,14 @@ class NFTQueries {
|
|
|
7996
8030
|
});
|
|
7997
8031
|
});
|
|
7998
8032
|
}
|
|
8033
|
+
getNFTsByContractAddress(variables) {
|
|
8034
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8035
|
+
return yield this.client.query({
|
|
8036
|
+
query: getContractAddressNFTsRawQuery,
|
|
8037
|
+
variables,
|
|
8038
|
+
});
|
|
8039
|
+
});
|
|
8040
|
+
}
|
|
7999
8041
|
}
|
|
8000
8042
|
|
|
8001
8043
|
/**
|
|
@@ -8121,4 +8163,4 @@ class QuickNodeSDK {
|
|
|
8121
8163
|
}
|
|
8122
8164
|
}
|
|
8123
8165
|
|
|
8124
|
-
export { QuickNodeSDK, QuickNodeSDK as default, getWalletAddressNFTsRawQuery, getWalletENSNFTsRawQuery };
|
|
8166
|
+
export { QuickNodeSDK, QuickNodeSDK as default, getContractAddressNFTsRawQuery, getWalletAddressNFTsRawQuery, getWalletENSNFTsRawQuery };
|
package/src/index.js
CHANGED
|
@@ -7984,6 +7984,40 @@ const getWalletENSNFTsRawQuery = gql `
|
|
|
7984
7984
|
}
|
|
7985
7985
|
`;
|
|
7986
7986
|
|
|
7987
|
+
const getContractAddressNFTsRawQuery = gql `
|
|
7988
|
+
query ContractNFTs($address: String!, $first: Int, $after: String) {
|
|
7989
|
+
contract(address: $address) {
|
|
7990
|
+
address
|
|
7991
|
+
isVerified
|
|
7992
|
+
tokenStandard
|
|
7993
|
+
tokens(first: $first, after: $after) {
|
|
7994
|
+
pageInfo {
|
|
7995
|
+
hasNextPage
|
|
7996
|
+
endCursor
|
|
7997
|
+
}
|
|
7998
|
+
edges {
|
|
7999
|
+
node {
|
|
8000
|
+
tokenId
|
|
8001
|
+
images {
|
|
8002
|
+
url
|
|
8003
|
+
}
|
|
8004
|
+
... on ERC721Token {
|
|
8005
|
+
contract {
|
|
8006
|
+
address # Included key field for caching
|
|
8007
|
+
}
|
|
8008
|
+
}
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
8011
|
+
}
|
|
8012
|
+
... on ERC721Contract {
|
|
8013
|
+
circulatingSupply
|
|
8014
|
+
name
|
|
8015
|
+
symbol
|
|
8016
|
+
}
|
|
8017
|
+
}
|
|
8018
|
+
}
|
|
8019
|
+
`;
|
|
8020
|
+
|
|
7987
8021
|
class NFTQueries {
|
|
7988
8022
|
constructor(client) {
|
|
7989
8023
|
this.client = client;
|
|
@@ -8004,6 +8038,14 @@ class NFTQueries {
|
|
|
8004
8038
|
});
|
|
8005
8039
|
});
|
|
8006
8040
|
}
|
|
8041
|
+
getNFTsByContractAddress(variables) {
|
|
8042
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8043
|
+
return yield this.client.query({
|
|
8044
|
+
query: getContractAddressNFTsRawQuery,
|
|
8045
|
+
variables,
|
|
8046
|
+
});
|
|
8047
|
+
});
|
|
8048
|
+
}
|
|
8007
8049
|
}
|
|
8008
8050
|
|
|
8009
8051
|
/**
|
|
@@ -8131,5 +8173,6 @@ class QuickNodeSDK {
|
|
|
8131
8173
|
|
|
8132
8174
|
exports.QuickNodeSDK = QuickNodeSDK;
|
|
8133
8175
|
exports["default"] = QuickNodeSDK;
|
|
8176
|
+
exports.getContractAddressNFTsRawQuery = getContractAddressNFTsRawQuery;
|
|
8134
8177
|
exports.getWalletAddressNFTsRawQuery = getWalletAddressNFTsRawQuery;
|
|
8135
8178
|
exports.getWalletENSNFTsRawQuery = getWalletENSNFTsRawQuery;
|
|
@@ -2,10 +2,12 @@ import { ApolloQueryResult } from '@apollo/client';
|
|
|
2
2
|
import { CustomApolloClient } from '../../client/customApolloClient';
|
|
3
3
|
import { WalletAddressNFTsQueryVariables } from './getNFTsByWalletAddress/getNFTsByWalletAddress';
|
|
4
4
|
import { WalletENSNFTsQueryVariables } from './getNFTsByWalletENS/getNFTsByWalletENS';
|
|
5
|
-
import {
|
|
5
|
+
import { ContractAddressNFTsQueryVariables } from './getNFTsByContractAddress/getNFTsByContractAddress';
|
|
6
|
+
import { ContractNFTsQueryResponse, WalletNFTsQueryResponse } from './sharedTypes';
|
|
6
7
|
export declare class NFTQueries {
|
|
7
8
|
private client;
|
|
8
9
|
constructor(client: CustomApolloClient);
|
|
9
10
|
getNFTsByWalletAddress(variables: WalletAddressNFTsQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>;
|
|
10
11
|
getNFTsByWalletENS(variables: WalletENSNFTsQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>;
|
|
12
|
+
getNFTsByContractAddress(variables: ContractAddressNFTsQueryVariables): Promise<ApolloQueryResult<ContractNFTsQueryResponse>>;
|
|
11
13
|
}
|