@quicknode/sdk 0.1.0 → 0.3.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 +63 -0
- package/package.json +1 -1
- package/src/index.esm.js +134 -0
- package/src/index.js +134 -0
- package/src/queries/nft/getCollectionDetails/getCollectionDetails.d.ts +4 -0
- package/src/queries/nft/getNFTDetails/getNFTDetails.d.ts +5 -0
- package/src/queries/nft/getNFTEventLogs/getNFTEventLogs.d.ts +9 -0
- package/src/queries/nft/nftQueries.d.ts +7 -1
package/README.md
CHANGED
|
@@ -111,6 +111,69 @@ client.nft
|
|
|
111
111
|
.then((response) => console.log(response));
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
### nft.getCollectionDetails
|
|
115
|
+
|
|
116
|
+
| Argument | Values | Optional | Description | Example |
|
|
117
|
+
| -------- | ------ | -------- | ----------------------- | ------------------------------------------ |
|
|
118
|
+
| address | string | ❌ | Contract address of NFT | 0x2106C00Ac7dA0A3430aE667879139E832307AeAa |
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import { QuickNodeSDK } from '@quicknode/sdk';
|
|
122
|
+
|
|
123
|
+
const client = new QuickNodeSDK();
|
|
124
|
+
|
|
125
|
+
client.nft
|
|
126
|
+
.getCollectionDetails({
|
|
127
|
+
address: '0x2106C00Ac7dA0A3430aE667879139E832307AeAa',
|
|
128
|
+
})
|
|
129
|
+
.then((response) => console.log(response));
|
|
130
|
+
```
|
|
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
|
+
|
|
114
177
|
## Pagination
|
|
115
178
|
|
|
116
179
|
For functions that support pagination, use the `first` property to specify the amount of results to return.
|
package/package.json
CHANGED
package/src/index.esm.js
CHANGED
|
@@ -8010,6 +8010,113 @@ const getContractAddressNFTsRawQuery = gql `
|
|
|
8010
8010
|
}
|
|
8011
8011
|
`;
|
|
8012
8012
|
|
|
8013
|
+
const getCollectionDetailsRawQuery = gql `
|
|
8014
|
+
query CollectionDetails($address: String!) {
|
|
8015
|
+
contract(address: $address) {
|
|
8016
|
+
... on ERC721Contract {
|
|
8017
|
+
address
|
|
8018
|
+
isVerified
|
|
8019
|
+
tokenStandard
|
|
8020
|
+
attributes {
|
|
8021
|
+
name
|
|
8022
|
+
rarity
|
|
8023
|
+
value
|
|
8024
|
+
valueCount
|
|
8025
|
+
}
|
|
8026
|
+
circulatingSupply
|
|
8027
|
+
name
|
|
8028
|
+
stats {
|
|
8029
|
+
average
|
|
8030
|
+
ceiling
|
|
8031
|
+
floor
|
|
8032
|
+
totalSales
|
|
8033
|
+
volume
|
|
8034
|
+
}
|
|
8035
|
+
symbol
|
|
8036
|
+
}
|
|
8037
|
+
}
|
|
8038
|
+
}
|
|
8039
|
+
`;
|
|
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
|
+
|
|
8013
8120
|
class NFTQueries {
|
|
8014
8121
|
constructor(client) {
|
|
8015
8122
|
this.client = client;
|
|
@@ -8038,6 +8145,33 @@ class NFTQueries {
|
|
|
8038
8145
|
});
|
|
8039
8146
|
});
|
|
8040
8147
|
}
|
|
8148
|
+
getCollectionDetails(variables) {
|
|
8149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8150
|
+
return yield this.client.query({
|
|
8151
|
+
query: getCollectionDetailsRawQuery,
|
|
8152
|
+
variables,
|
|
8153
|
+
});
|
|
8154
|
+
});
|
|
8155
|
+
}
|
|
8156
|
+
getNFTEventLogs(variables) {
|
|
8157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8158
|
+
const { types = ['TRANSFER', 'ORDER', 'MINT'] } = variables, otherVariables = __rest(variables, ["types"]);
|
|
8159
|
+
return yield this.client.query({
|
|
8160
|
+
query: getNFTEventLogsRawQuery,
|
|
8161
|
+
variables: Object.assign(Object.assign({}, otherVariables), { filter: {
|
|
8162
|
+
typeIn: types,
|
|
8163
|
+
} }),
|
|
8164
|
+
});
|
|
8165
|
+
});
|
|
8166
|
+
}
|
|
8167
|
+
getNFTDetails(variables) {
|
|
8168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8169
|
+
return yield this.client.query({
|
|
8170
|
+
query: getNFTDetailsRawQuery,
|
|
8171
|
+
variables,
|
|
8172
|
+
});
|
|
8173
|
+
});
|
|
8174
|
+
}
|
|
8041
8175
|
}
|
|
8042
8176
|
|
|
8043
8177
|
/**
|
package/src/index.js
CHANGED
|
@@ -8018,6 +8018,113 @@ const getContractAddressNFTsRawQuery = gql `
|
|
|
8018
8018
|
}
|
|
8019
8019
|
`;
|
|
8020
8020
|
|
|
8021
|
+
const getCollectionDetailsRawQuery = gql `
|
|
8022
|
+
query CollectionDetails($address: String!) {
|
|
8023
|
+
contract(address: $address) {
|
|
8024
|
+
... on ERC721Contract {
|
|
8025
|
+
address
|
|
8026
|
+
isVerified
|
|
8027
|
+
tokenStandard
|
|
8028
|
+
attributes {
|
|
8029
|
+
name
|
|
8030
|
+
rarity
|
|
8031
|
+
value
|
|
8032
|
+
valueCount
|
|
8033
|
+
}
|
|
8034
|
+
circulatingSupply
|
|
8035
|
+
name
|
|
8036
|
+
stats {
|
|
8037
|
+
average
|
|
8038
|
+
ceiling
|
|
8039
|
+
floor
|
|
8040
|
+
totalSales
|
|
8041
|
+
volume
|
|
8042
|
+
}
|
|
8043
|
+
symbol
|
|
8044
|
+
}
|
|
8045
|
+
}
|
|
8046
|
+
}
|
|
8047
|
+
`;
|
|
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
|
+
|
|
8021
8128
|
class NFTQueries {
|
|
8022
8129
|
constructor(client) {
|
|
8023
8130
|
this.client = client;
|
|
@@ -8046,6 +8153,33 @@ class NFTQueries {
|
|
|
8046
8153
|
});
|
|
8047
8154
|
});
|
|
8048
8155
|
}
|
|
8156
|
+
getCollectionDetails(variables) {
|
|
8157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8158
|
+
return yield this.client.query({
|
|
8159
|
+
query: getCollectionDetailsRawQuery,
|
|
8160
|
+
variables,
|
|
8161
|
+
});
|
|
8162
|
+
});
|
|
8163
|
+
}
|
|
8164
|
+
getNFTEventLogs(variables) {
|
|
8165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8166
|
+
const { types = ['TRANSFER', 'ORDER', 'MINT'] } = variables, otherVariables = __rest(variables, ["types"]);
|
|
8167
|
+
return yield this.client.query({
|
|
8168
|
+
query: getNFTEventLogsRawQuery,
|
|
8169
|
+
variables: Object.assign(Object.assign({}, otherVariables), { filter: {
|
|
8170
|
+
typeIn: types,
|
|
8171
|
+
} }),
|
|
8172
|
+
});
|
|
8173
|
+
});
|
|
8174
|
+
}
|
|
8175
|
+
getNFTDetails(variables) {
|
|
8176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8177
|
+
return yield this.client.query({
|
|
8178
|
+
query: getNFTDetailsRawQuery,
|
|
8179
|
+
variables,
|
|
8180
|
+
});
|
|
8181
|
+
});
|
|
8182
|
+
}
|
|
8049
8183
|
}
|
|
8050
8184
|
|
|
8051
8185
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PaginationArgs } from '../../../types';
|
|
2
|
+
export declare const getNFTEventLogsRawQuery: import("graphql/language/ast").DocumentNode;
|
|
3
|
+
declare type LogEvents = 'TRANSFER' | 'ORDER' | 'MINT';
|
|
4
|
+
export interface EventLogsQueryVariables extends PaginationArgs {
|
|
5
|
+
address: string;
|
|
6
|
+
tokenId: string;
|
|
7
|
+
types?: LogEvents[];
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -3,11 +3,17 @@ import { CustomApolloClient } from '../../client/customApolloClient';
|
|
|
3
3
|
import { WalletAddressNFTsQueryVariables } from './getNFTsByWalletAddress/getNFTsByWalletAddress';
|
|
4
4
|
import { WalletENSNFTsQueryVariables } from './getNFTsByWalletENS/getNFTsByWalletENS';
|
|
5
5
|
import { ContractAddressNFTsQueryVariables } from './getNFTsByContractAddress/getNFTsByContractAddress';
|
|
6
|
-
import {
|
|
6
|
+
import { CollectionDetailsQueryVariables } from './getCollectionDetails/getCollectionDetails';
|
|
7
|
+
import { EventLogsQueryVariables } from './getNFTEventLogs/getNFTEventLogs';
|
|
8
|
+
import { NFTDetailsQueryVariables } from './getNFTDetails/getNFTDetails';
|
|
9
|
+
import { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, EventLogsQueryResponse, NFTDetailsQueryResponse } from './sharedTypes';
|
|
7
10
|
export declare class NFTQueries {
|
|
8
11
|
private client;
|
|
9
12
|
constructor(client: CustomApolloClient);
|
|
10
13
|
getNFTsByWalletAddress(variables: WalletAddressNFTsQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>;
|
|
11
14
|
getNFTsByWalletENS(variables: WalletENSNFTsQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>;
|
|
12
15
|
getNFTsByContractAddress(variables: ContractAddressNFTsQueryVariables): Promise<ApolloQueryResult<ContractNFTsQueryResponse>>;
|
|
16
|
+
getCollectionDetails(variables: CollectionDetailsQueryVariables): Promise<ApolloQueryResult<CollectionDetailsQueryResponse>>;
|
|
17
|
+
getNFTEventLogs(variables: EventLogsQueryVariables): Promise<ApolloQueryResult<EventLogsQueryResponse>>;
|
|
18
|
+
getNFTDetails(variables: NFTDetailsQueryVariables): Promise<ApolloQueryResult<NFTDetailsQueryResponse>>;
|
|
13
19
|
}
|