@quicknode/sdk 0.3.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 +27 -3
- package/package.json +1 -1
- package/src/index.esm.js +54 -1
- package/src/index.js +54 -1
- package/src/queries/nft/getContractEventLogs/getContractEventLogs.d.ts +6 -0
- package/src/queries/nft/getNFTEventLogs/getNFTEventLogs.d.ts +1 -3
- package/src/queries/nft/nftQueries.d.ts +3 -1
package/README.md
CHANGED
|
@@ -174,6 +174,31 @@ client.nft
|
|
|
174
174
|
.then((response) => console.log(response));
|
|
175
175
|
```
|
|
176
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
|
+
|
|
177
202
|
## Pagination
|
|
178
203
|
|
|
179
204
|
For functions that support pagination, use the `first` property to specify the amount of results to return.
|
|
@@ -184,12 +209,11 @@ The returned `data.tokensPageInfo.endCursor` property in the response can be use
|
|
|
184
209
|
|
|
185
210
|
For example, if a response contains:
|
|
186
211
|
|
|
187
|
-
```
|
|
188
|
-
"data: {
|
|
212
|
+
```json
|
|
213
|
+
"data": {
|
|
189
214
|
"tokensPageInfo": {
|
|
190
215
|
"hasNextPage": true,
|
|
191
216
|
"endCursor": 'YXJyYXljb25uZWN0aW9uOlk='
|
|
192
|
-
}
|
|
193
217
|
}
|
|
194
218
|
}
|
|
195
219
|
```
|
package/package.json
CHANGED
package/src/index.esm.js
CHANGED
|
@@ -8117,6 +8117,48 @@ const getNFTDetailsRawQuery = gql `
|
|
|
8117
8117
|
}
|
|
8118
8118
|
`;
|
|
8119
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'];
|
|
8120
8162
|
class NFTQueries {
|
|
8121
8163
|
constructor(client) {
|
|
8122
8164
|
this.client = client;
|
|
@@ -8155,7 +8197,7 @@ class NFTQueries {
|
|
|
8155
8197
|
}
|
|
8156
8198
|
getNFTEventLogs(variables) {
|
|
8157
8199
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8158
|
-
const { types =
|
|
8200
|
+
const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
|
|
8159
8201
|
return yield this.client.query({
|
|
8160
8202
|
query: getNFTEventLogsRawQuery,
|
|
8161
8203
|
variables: Object.assign(Object.assign({}, otherVariables), { filter: {
|
|
@@ -8172,6 +8214,17 @@ class NFTQueries {
|
|
|
8172
8214
|
});
|
|
8173
8215
|
});
|
|
8174
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
|
+
}
|
|
8175
8228
|
}
|
|
8176
8229
|
|
|
8177
8230
|
/**
|
package/src/index.js
CHANGED
|
@@ -8125,6 +8125,48 @@ const getNFTDetailsRawQuery = gql `
|
|
|
8125
8125
|
}
|
|
8126
8126
|
`;
|
|
8127
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'];
|
|
8128
8170
|
class NFTQueries {
|
|
8129
8171
|
constructor(client) {
|
|
8130
8172
|
this.client = client;
|
|
@@ -8163,7 +8205,7 @@ class NFTQueries {
|
|
|
8163
8205
|
}
|
|
8164
8206
|
getNFTEventLogs(variables) {
|
|
8165
8207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8166
|
-
const { types =
|
|
8208
|
+
const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
|
|
8167
8209
|
return yield this.client.query({
|
|
8168
8210
|
query: getNFTEventLogsRawQuery,
|
|
8169
8211
|
variables: Object.assign(Object.assign({}, otherVariables), { filter: {
|
|
@@ -8180,6 +8222,17 @@ class NFTQueries {
|
|
|
8180
8222
|
});
|
|
8181
8223
|
});
|
|
8182
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
|
+
}
|
|
8183
8236
|
}
|
|
8184
8237
|
|
|
8185
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
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { PaginationArgs } from '../../../types';
|
|
1
|
+
import { PaginationArgs, LogEvents } from '../../../types';
|
|
2
2
|
export declare const getNFTEventLogsRawQuery: import("graphql/language/ast").DocumentNode;
|
|
3
|
-
declare type LogEvents = 'TRANSFER' | 'ORDER' | 'MINT';
|
|
4
3
|
export interface EventLogsQueryVariables extends PaginationArgs {
|
|
5
4
|
address: string;
|
|
6
5
|
tokenId: string;
|
|
7
6
|
types?: LogEvents[];
|
|
8
7
|
}
|
|
9
|
-
export {};
|
|
@@ -6,7 +6,8 @@ import { ContractAddressNFTsQueryVariables } from './getNFTsByContractAddress/ge
|
|
|
6
6
|
import { CollectionDetailsQueryVariables } from './getCollectionDetails/getCollectionDetails';
|
|
7
7
|
import { EventLogsQueryVariables } from './getNFTEventLogs/getNFTEventLogs';
|
|
8
8
|
import { NFTDetailsQueryVariables } from './getNFTDetails/getNFTDetails';
|
|
9
|
-
import {
|
|
9
|
+
import { ContractEventLogQueryVariables } from './getContractEventLogs/getContractEventLogs';
|
|
10
|
+
import { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, EventLogsQueryResponse, NFTDetailsQueryResponse, ContractEventLogsQueryResponse } from './sharedTypes';
|
|
10
11
|
export declare class NFTQueries {
|
|
11
12
|
private client;
|
|
12
13
|
constructor(client: CustomApolloClient);
|
|
@@ -16,4 +17,5 @@ export declare class NFTQueries {
|
|
|
16
17
|
getCollectionDetails(variables: CollectionDetailsQueryVariables): Promise<ApolloQueryResult<CollectionDetailsQueryResponse>>;
|
|
17
18
|
getNFTEventLogs(variables: EventLogsQueryVariables): Promise<ApolloQueryResult<EventLogsQueryResponse>>;
|
|
18
19
|
getNFTDetails(variables: NFTDetailsQueryVariables): Promise<ApolloQueryResult<NFTDetailsQueryResponse>>;
|
|
20
|
+
getContractEventLogs(variables: ContractEventLogQueryVariables): Promise<ApolloQueryResult<ContractEventLogsQueryResponse>>;
|
|
19
21
|
}
|