@quicknode/sdk 0.2.0 → 0.4.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 +72 -3
- package/package.json +1 -1
- package/src/index.esm.js +151 -0
- package/src/index.js +151 -0
- package/src/queries/nft/getContractEventLogs/getContractEventLogs.d.ts +6 -0
- package/src/queries/nft/getNFTDetails/getNFTDetails.d.ts +5 -0
- package/src/queries/nft/getNFTEventLogs/getNFTEventLogs.d.ts +7 -0
- package/src/queries/nft/nftQueries.d.ts +7 -1
package/README.md
CHANGED
|
@@ -129,6 +129,76 @@ client.nft
|
|
|
129
129
|
.then((response) => console.log(response));
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
+
### nft.getNFTEventLogs
|
|
133
|
+
|
|
134
|
+
| Argument | Values | Optional | Description | Example |
|
|
135
|
+
| -------- | ------ | -------- | --------------------------------------------------------------------------------- | ------------------------------------------ |
|
|
136
|
+
| address | string | ❌ | Contract address of NFT | 0x2106C00Ac7dA0A3430aE667879139E832307AeAa |
|
|
137
|
+
| tokenId | string | ❌ | NFT ID | 100 |
|
|
138
|
+
| types | array | ✅ | An array of event types 'TRANSFER', 'ORDER', and/or 'MINT'. Defaults to all types | ['TRANSFER', 'ORDER', 'MINT] |
|
|
139
|
+
| first | number | ✅ | Number of results to return | 10 |
|
|
140
|
+
| after | string | ✅ | Return results after end cursor | YXJyYXljb25uZWN0aW9uOjUwNQ= |
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { QuickNodeSDK } from '@quicknode/sdk';
|
|
144
|
+
|
|
145
|
+
const client = new QuickNodeSDK();
|
|
146
|
+
|
|
147
|
+
client.nft
|
|
148
|
+
.getNFTEventLogs({
|
|
149
|
+
address: '0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
|
|
150
|
+
tokenId: '100',
|
|
151
|
+
types: ['TRANSFER', 'ORDER'],
|
|
152
|
+
})
|
|
153
|
+
.then((response) => console.log(response));
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### nft.getNFTDetails
|
|
157
|
+
|
|
158
|
+
Returns the details for a single NFT
|
|
159
|
+
| Argument | Values | Optional | Description | Example |
|
|
160
|
+
| --------------- | ------ | -------- | --------------------------------- | ------------------------------------------ |
|
|
161
|
+
| contractAddress | string | ❌ | Contract address of NFT Collection | 0x2106C00Ac7dA0A3430aE667879139E832307AeAa |
|
|
162
|
+
| tokenId | string | ❌ | NFT ID | 5020 |
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { QuickNodeSDK } from '@quicknode/sdk';
|
|
166
|
+
|
|
167
|
+
const client = new QuickNodeSDK();
|
|
168
|
+
|
|
169
|
+
client.nft
|
|
170
|
+
.getNFTDetails({
|
|
171
|
+
contractAddress: '0x23581767a106ae21c074b2276D25e5C3e136a68b',
|
|
172
|
+
tokenId: '400',
|
|
173
|
+
})
|
|
174
|
+
.then((response) => console.log(response));
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### nft.getContractEventLogs
|
|
178
|
+
|
|
179
|
+
Returns the log events for a NFT contract
|
|
180
|
+
|
|
181
|
+
| Argument | Values | Optional | Description | Example |
|
|
182
|
+
| -------- | ------ | -------- | --------------------------------------------------------------------------------- | ------------------------------------------ |
|
|
183
|
+
| address | string | ❌ | Contract address of NFT | 0x2106C00Ac7dA0A3430aE667879139E832307AeAa |
|
|
184
|
+
| types | array | ✅ | An array of event types 'TRANSFER', 'ORDER', and/or 'MINT'. Defaults to all types | ['TRANSFER', 'ORDER', 'MINT] |
|
|
185
|
+
| first | number | ✅ | Number of results to return | 10 |
|
|
186
|
+
| after | string | ✅ | Return results after end cursor | YXJyYXljb25uZWN0aW9uOjUwNQ= |
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { QuickNodeSDK } from '@quicknode/sdk';
|
|
190
|
+
|
|
191
|
+
const client = new QuickNodeSDK();
|
|
192
|
+
|
|
193
|
+
client.nft
|
|
194
|
+
.getContractEventLogs({
|
|
195
|
+
address: '0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
|
|
196
|
+
tokenId: '100',
|
|
197
|
+
types: ['TRANSFER', 'ORDER'],
|
|
198
|
+
})
|
|
199
|
+
.then((response) => console.log(response));
|
|
200
|
+
```
|
|
201
|
+
|
|
132
202
|
## Pagination
|
|
133
203
|
|
|
134
204
|
For functions that support pagination, use the `first` property to specify the amount of results to return.
|
|
@@ -139,12 +209,11 @@ The returned `data.tokensPageInfo.endCursor` property in the response can be use
|
|
|
139
209
|
|
|
140
210
|
For example, if a response contains:
|
|
141
211
|
|
|
142
|
-
```
|
|
143
|
-
"data: {
|
|
212
|
+
```json
|
|
213
|
+
"data": {
|
|
144
214
|
"tokensPageInfo": {
|
|
145
215
|
"hasNextPage": true,
|
|
146
216
|
"endCursor": 'YXJyYXljb25uZWN0aW9uOlk='
|
|
147
|
-
}
|
|
148
217
|
}
|
|
149
218
|
}
|
|
150
219
|
```
|
package/package.json
CHANGED
package/src/index.esm.js
CHANGED
|
@@ -8038,6 +8038,127 @@ const getCollectionDetailsRawQuery = gql `
|
|
|
8038
8038
|
}
|
|
8039
8039
|
`;
|
|
8040
8040
|
|
|
8041
|
+
const getNFTEventLogsRawQuery = gql `
|
|
8042
|
+
query NFTEvents(
|
|
8043
|
+
$address: String!
|
|
8044
|
+
$tokenId: String!
|
|
8045
|
+
$filter: LogsFilterInputType
|
|
8046
|
+
$first: Int
|
|
8047
|
+
$after: String
|
|
8048
|
+
) {
|
|
8049
|
+
token(contractAddress: $address, tokenId: $tokenId) {
|
|
8050
|
+
... on ERC721Token {
|
|
8051
|
+
tokenId
|
|
8052
|
+
contract {
|
|
8053
|
+
address # Included key field for caching
|
|
8054
|
+
}
|
|
8055
|
+
logs(filter: $filter, first: $first, after: $after) {
|
|
8056
|
+
edges {
|
|
8057
|
+
node {
|
|
8058
|
+
blockNumber
|
|
8059
|
+
type
|
|
8060
|
+
fromAddress
|
|
8061
|
+
toAddress
|
|
8062
|
+
estimatedConfirmedAt
|
|
8063
|
+
transactionHash
|
|
8064
|
+
... on OrderLog {
|
|
8065
|
+
marketplace
|
|
8066
|
+
priceInEth
|
|
8067
|
+
}
|
|
8068
|
+
}
|
|
8069
|
+
}
|
|
8070
|
+
pageInfo {
|
|
8071
|
+
hasNextPage
|
|
8072
|
+
endCursor
|
|
8073
|
+
}
|
|
8074
|
+
}
|
|
8075
|
+
}
|
|
8076
|
+
}
|
|
8077
|
+
}
|
|
8078
|
+
`;
|
|
8079
|
+
|
|
8080
|
+
const getNFTDetailsRawQuery = gql `
|
|
8081
|
+
query Token($contractAddress: String!, $tokenId: String!) {
|
|
8082
|
+
token(contractAddress: $contractAddress, tokenId: $tokenId) {
|
|
8083
|
+
... on ERC721Token {
|
|
8084
|
+
tokenId
|
|
8085
|
+
attributes {
|
|
8086
|
+
name
|
|
8087
|
+
value
|
|
8088
|
+
}
|
|
8089
|
+
contract {
|
|
8090
|
+
address
|
|
8091
|
+
isVerified
|
|
8092
|
+
tokenStandard
|
|
8093
|
+
... on ERC721Contract {
|
|
8094
|
+
name
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
images {
|
|
8098
|
+
height
|
|
8099
|
+
mimeType
|
|
8100
|
+
url
|
|
8101
|
+
width
|
|
8102
|
+
}
|
|
8103
|
+
name
|
|
8104
|
+
symbol
|
|
8105
|
+
metadata {
|
|
8106
|
+
animation_url
|
|
8107
|
+
background_color
|
|
8108
|
+
description
|
|
8109
|
+
external_url
|
|
8110
|
+
image
|
|
8111
|
+
image_data
|
|
8112
|
+
name
|
|
8113
|
+
youtube_url
|
|
8114
|
+
}
|
|
8115
|
+
}
|
|
8116
|
+
}
|
|
8117
|
+
}
|
|
8118
|
+
`;
|
|
8119
|
+
|
|
8120
|
+
const getContractEventLogsRawQuery = gql `
|
|
8121
|
+
query ContractEvents(
|
|
8122
|
+
$address: String!
|
|
8123
|
+
$filter: LogsFilterInputType
|
|
8124
|
+
$first: Int
|
|
8125
|
+
$after: String
|
|
8126
|
+
) {
|
|
8127
|
+
contract(address: $address) {
|
|
8128
|
+
address
|
|
8129
|
+
logs(filter: $filter, first: $first, after: $after) {
|
|
8130
|
+
pageInfo {
|
|
8131
|
+
hasNextPage
|
|
8132
|
+
endCursor
|
|
8133
|
+
}
|
|
8134
|
+
edges {
|
|
8135
|
+
node {
|
|
8136
|
+
blockNumber
|
|
8137
|
+
type
|
|
8138
|
+
fromAddress
|
|
8139
|
+
toAddress
|
|
8140
|
+
estimatedConfirmedAt
|
|
8141
|
+
transactionHash
|
|
8142
|
+
token {
|
|
8143
|
+
contract {
|
|
8144
|
+
address
|
|
8145
|
+
}
|
|
8146
|
+
... on ERC721Token {
|
|
8147
|
+
tokenId
|
|
8148
|
+
}
|
|
8149
|
+
}
|
|
8150
|
+
... on OrderLog {
|
|
8151
|
+
marketplace
|
|
8152
|
+
priceInEth
|
|
8153
|
+
}
|
|
8154
|
+
}
|
|
8155
|
+
}
|
|
8156
|
+
}
|
|
8157
|
+
}
|
|
8158
|
+
}
|
|
8159
|
+
`;
|
|
8160
|
+
|
|
8161
|
+
const DEFAULT_LOG_FILTER_TYPES = ['TRANSFER', 'ORDER', 'MINT'];
|
|
8041
8162
|
class NFTQueries {
|
|
8042
8163
|
constructor(client) {
|
|
8043
8164
|
this.client = client;
|
|
@@ -8074,6 +8195,36 @@ class NFTQueries {
|
|
|
8074
8195
|
});
|
|
8075
8196
|
});
|
|
8076
8197
|
}
|
|
8198
|
+
getNFTEventLogs(variables) {
|
|
8199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8200
|
+
const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
|
|
8201
|
+
return yield this.client.query({
|
|
8202
|
+
query: getNFTEventLogsRawQuery,
|
|
8203
|
+
variables: Object.assign(Object.assign({}, otherVariables), { filter: {
|
|
8204
|
+
typeIn: types,
|
|
8205
|
+
} }),
|
|
8206
|
+
});
|
|
8207
|
+
});
|
|
8208
|
+
}
|
|
8209
|
+
getNFTDetails(variables) {
|
|
8210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8211
|
+
return yield this.client.query({
|
|
8212
|
+
query: getNFTDetailsRawQuery,
|
|
8213
|
+
variables,
|
|
8214
|
+
});
|
|
8215
|
+
});
|
|
8216
|
+
}
|
|
8217
|
+
getContractEventLogs(variables) {
|
|
8218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8219
|
+
const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
|
|
8220
|
+
return yield this.client.query({
|
|
8221
|
+
query: getContractEventLogsRawQuery,
|
|
8222
|
+
variables: Object.assign(Object.assign({}, otherVariables), { filter: {
|
|
8223
|
+
typeIn: types,
|
|
8224
|
+
} }),
|
|
8225
|
+
});
|
|
8226
|
+
});
|
|
8227
|
+
}
|
|
8077
8228
|
}
|
|
8078
8229
|
|
|
8079
8230
|
/**
|
package/src/index.js
CHANGED
|
@@ -8046,6 +8046,127 @@ const getCollectionDetailsRawQuery = gql `
|
|
|
8046
8046
|
}
|
|
8047
8047
|
`;
|
|
8048
8048
|
|
|
8049
|
+
const getNFTEventLogsRawQuery = gql `
|
|
8050
|
+
query NFTEvents(
|
|
8051
|
+
$address: String!
|
|
8052
|
+
$tokenId: String!
|
|
8053
|
+
$filter: LogsFilterInputType
|
|
8054
|
+
$first: Int
|
|
8055
|
+
$after: String
|
|
8056
|
+
) {
|
|
8057
|
+
token(contractAddress: $address, tokenId: $tokenId) {
|
|
8058
|
+
... on ERC721Token {
|
|
8059
|
+
tokenId
|
|
8060
|
+
contract {
|
|
8061
|
+
address # Included key field for caching
|
|
8062
|
+
}
|
|
8063
|
+
logs(filter: $filter, first: $first, after: $after) {
|
|
8064
|
+
edges {
|
|
8065
|
+
node {
|
|
8066
|
+
blockNumber
|
|
8067
|
+
type
|
|
8068
|
+
fromAddress
|
|
8069
|
+
toAddress
|
|
8070
|
+
estimatedConfirmedAt
|
|
8071
|
+
transactionHash
|
|
8072
|
+
... on OrderLog {
|
|
8073
|
+
marketplace
|
|
8074
|
+
priceInEth
|
|
8075
|
+
}
|
|
8076
|
+
}
|
|
8077
|
+
}
|
|
8078
|
+
pageInfo {
|
|
8079
|
+
hasNextPage
|
|
8080
|
+
endCursor
|
|
8081
|
+
}
|
|
8082
|
+
}
|
|
8083
|
+
}
|
|
8084
|
+
}
|
|
8085
|
+
}
|
|
8086
|
+
`;
|
|
8087
|
+
|
|
8088
|
+
const getNFTDetailsRawQuery = gql `
|
|
8089
|
+
query Token($contractAddress: String!, $tokenId: String!) {
|
|
8090
|
+
token(contractAddress: $contractAddress, tokenId: $tokenId) {
|
|
8091
|
+
... on ERC721Token {
|
|
8092
|
+
tokenId
|
|
8093
|
+
attributes {
|
|
8094
|
+
name
|
|
8095
|
+
value
|
|
8096
|
+
}
|
|
8097
|
+
contract {
|
|
8098
|
+
address
|
|
8099
|
+
isVerified
|
|
8100
|
+
tokenStandard
|
|
8101
|
+
... on ERC721Contract {
|
|
8102
|
+
name
|
|
8103
|
+
}
|
|
8104
|
+
}
|
|
8105
|
+
images {
|
|
8106
|
+
height
|
|
8107
|
+
mimeType
|
|
8108
|
+
url
|
|
8109
|
+
width
|
|
8110
|
+
}
|
|
8111
|
+
name
|
|
8112
|
+
symbol
|
|
8113
|
+
metadata {
|
|
8114
|
+
animation_url
|
|
8115
|
+
background_color
|
|
8116
|
+
description
|
|
8117
|
+
external_url
|
|
8118
|
+
image
|
|
8119
|
+
image_data
|
|
8120
|
+
name
|
|
8121
|
+
youtube_url
|
|
8122
|
+
}
|
|
8123
|
+
}
|
|
8124
|
+
}
|
|
8125
|
+
}
|
|
8126
|
+
`;
|
|
8127
|
+
|
|
8128
|
+
const getContractEventLogsRawQuery = gql `
|
|
8129
|
+
query ContractEvents(
|
|
8130
|
+
$address: String!
|
|
8131
|
+
$filter: LogsFilterInputType
|
|
8132
|
+
$first: Int
|
|
8133
|
+
$after: String
|
|
8134
|
+
) {
|
|
8135
|
+
contract(address: $address) {
|
|
8136
|
+
address
|
|
8137
|
+
logs(filter: $filter, first: $first, after: $after) {
|
|
8138
|
+
pageInfo {
|
|
8139
|
+
hasNextPage
|
|
8140
|
+
endCursor
|
|
8141
|
+
}
|
|
8142
|
+
edges {
|
|
8143
|
+
node {
|
|
8144
|
+
blockNumber
|
|
8145
|
+
type
|
|
8146
|
+
fromAddress
|
|
8147
|
+
toAddress
|
|
8148
|
+
estimatedConfirmedAt
|
|
8149
|
+
transactionHash
|
|
8150
|
+
token {
|
|
8151
|
+
contract {
|
|
8152
|
+
address
|
|
8153
|
+
}
|
|
8154
|
+
... on ERC721Token {
|
|
8155
|
+
tokenId
|
|
8156
|
+
}
|
|
8157
|
+
}
|
|
8158
|
+
... on OrderLog {
|
|
8159
|
+
marketplace
|
|
8160
|
+
priceInEth
|
|
8161
|
+
}
|
|
8162
|
+
}
|
|
8163
|
+
}
|
|
8164
|
+
}
|
|
8165
|
+
}
|
|
8166
|
+
}
|
|
8167
|
+
`;
|
|
8168
|
+
|
|
8169
|
+
const DEFAULT_LOG_FILTER_TYPES = ['TRANSFER', 'ORDER', 'MINT'];
|
|
8049
8170
|
class NFTQueries {
|
|
8050
8171
|
constructor(client) {
|
|
8051
8172
|
this.client = client;
|
|
@@ -8082,6 +8203,36 @@ class NFTQueries {
|
|
|
8082
8203
|
});
|
|
8083
8204
|
});
|
|
8084
8205
|
}
|
|
8206
|
+
getNFTEventLogs(variables) {
|
|
8207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8208
|
+
const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
|
|
8209
|
+
return yield this.client.query({
|
|
8210
|
+
query: getNFTEventLogsRawQuery,
|
|
8211
|
+
variables: Object.assign(Object.assign({}, otherVariables), { filter: {
|
|
8212
|
+
typeIn: types,
|
|
8213
|
+
} }),
|
|
8214
|
+
});
|
|
8215
|
+
});
|
|
8216
|
+
}
|
|
8217
|
+
getNFTDetails(variables) {
|
|
8218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8219
|
+
return yield this.client.query({
|
|
8220
|
+
query: getNFTDetailsRawQuery,
|
|
8221
|
+
variables,
|
|
8222
|
+
});
|
|
8223
|
+
});
|
|
8224
|
+
}
|
|
8225
|
+
getContractEventLogs(variables) {
|
|
8226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8227
|
+
const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
|
|
8228
|
+
return yield this.client.query({
|
|
8229
|
+
query: getContractEventLogsRawQuery,
|
|
8230
|
+
variables: Object.assign(Object.assign({}, otherVariables), { filter: {
|
|
8231
|
+
typeIn: types,
|
|
8232
|
+
} }),
|
|
8233
|
+
});
|
|
8234
|
+
});
|
|
8235
|
+
}
|
|
8085
8236
|
}
|
|
8086
8237
|
|
|
8087
8238
|
/**
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PaginationArgs, LogEvents } from '../../../types';
|
|
2
|
+
export declare const getContractEventLogsRawQuery: import("graphql/language/ast").DocumentNode;
|
|
3
|
+
export interface ContractEventLogQueryVariables extends PaginationArgs {
|
|
4
|
+
address: string;
|
|
5
|
+
types?: LogEvents[];
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PaginationArgs, LogEvents } from '../../../types';
|
|
2
|
+
export declare const getNFTEventLogsRawQuery: import("graphql/language/ast").DocumentNode;
|
|
3
|
+
export interface EventLogsQueryVariables extends PaginationArgs {
|
|
4
|
+
address: string;
|
|
5
|
+
tokenId: string;
|
|
6
|
+
types?: LogEvents[];
|
|
7
|
+
}
|
|
@@ -4,7 +4,10 @@ import { WalletAddressNFTsQueryVariables } from './getNFTsByWalletAddress/getNFT
|
|
|
4
4
|
import { WalletENSNFTsQueryVariables } from './getNFTsByWalletENS/getNFTsByWalletENS';
|
|
5
5
|
import { ContractAddressNFTsQueryVariables } from './getNFTsByContractAddress/getNFTsByContractAddress';
|
|
6
6
|
import { CollectionDetailsQueryVariables } from './getCollectionDetails/getCollectionDetails';
|
|
7
|
-
import {
|
|
7
|
+
import { EventLogsQueryVariables } from './getNFTEventLogs/getNFTEventLogs';
|
|
8
|
+
import { NFTDetailsQueryVariables } from './getNFTDetails/getNFTDetails';
|
|
9
|
+
import { ContractEventLogQueryVariables } from './getContractEventLogs/getContractEventLogs';
|
|
10
|
+
import { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, EventLogsQueryResponse, NFTDetailsQueryResponse, ContractEventLogsQueryResponse } from './sharedTypes';
|
|
8
11
|
export declare class NFTQueries {
|
|
9
12
|
private client;
|
|
10
13
|
constructor(client: CustomApolloClient);
|
|
@@ -12,4 +15,7 @@ export declare class NFTQueries {
|
|
|
12
15
|
getNFTsByWalletENS(variables: WalletENSNFTsQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>;
|
|
13
16
|
getNFTsByContractAddress(variables: ContractAddressNFTsQueryVariables): Promise<ApolloQueryResult<ContractNFTsQueryResponse>>;
|
|
14
17
|
getCollectionDetails(variables: CollectionDetailsQueryVariables): Promise<ApolloQueryResult<CollectionDetailsQueryResponse>>;
|
|
18
|
+
getNFTEventLogs(variables: EventLogsQueryVariables): Promise<ApolloQueryResult<EventLogsQueryResponse>>;
|
|
19
|
+
getNFTDetails(variables: NFTDetailsQueryVariables): Promise<ApolloQueryResult<NFTDetailsQueryResponse>>;
|
|
20
|
+
getContractEventLogs(variables: ContractEventLogQueryVariables): Promise<ApolloQueryResult<ContractEventLogsQueryResponse>>;
|
|
15
21
|
}
|