@quicknode/sdk 0.3.0 → 0.5.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
@@ -174,6 +174,57 @@ 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
+ types: ['TRANSFER', 'ORDER'],
197
+ })
198
+ .then((response) => console.log(response));
199
+ ```
200
+
201
+ ### nft.getNFTsByWalletAndContracts
202
+
203
+ Gets NFTs from specified collections held by a wallet
204
+
205
+ | Argument | Values | Optional | Description | Example |
206
+ | --------- | ---------------- | -------- | ------------------------------- | ---------------------------------------------- |
207
+ | address | string | ❌ | Wallet address | 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 |
208
+ | contracts | array of strings | ❌ | NFT contract addresses | ['0xba30e5f9bb24caa003e9f2f0497ad287fdf95623'] |
209
+ | first | number | ✅ | Number of results to return | 10 |
210
+ | after | string | ✅ | Return results after end cursor | YXJyYXljb25uZWN0aW9uOjUwNQ= |
211
+
212
+ ```ts
213
+ import { QuickNodeSDK } from '@quicknode/sdk';
214
+
215
+ const client = new QuickNodeSDK();
216
+
217
+ client.nft
218
+ .getNFTsByWalletAndContracts({
219
+ address: '0x13928eb9a86c8278a45b6ff2935c7730b58ac675',
220
+ contracts: [
221
+ '0xba30e5f9bb24caa003e9f2f0497ad287fdf95623',
222
+ '0xbce3781ae7ca1a5e050bd9c4c77369867ebc307e',
223
+ ],
224
+ })
225
+ .then((response) => console.log(response));
226
+ ```
227
+
177
228
  ## Pagination
178
229
 
179
230
  For functions that support pagination, use the `first` property to specify the amount of results to return.
@@ -184,12 +235,11 @@ The returned `data.tokensPageInfo.endCursor` property in the response can be use
184
235
 
185
236
  For example, if a response contains:
186
237
 
187
- ```
188
- "data: {
238
+ ```json
239
+ "data": {
189
240
  "tokensPageInfo": {
190
241
  "hasNextPage": true,
191
242
  "endCursor": 'YXJyYXljb25uZWN0aW9uOlk='
192
- }
193
243
  }
194
244
  }
195
245
  ```
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "directory": "packages/libs/api/sdk"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "0.3.0",
9
+ "version": "0.5.0",
10
10
  "main": "./src/index.js",
11
11
  "module": "./src/index.esm.js",
12
12
  "types": "./src/index.d.ts",
package/src/index.esm.js CHANGED
@@ -8117,6 +8117,85 @@ 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 getNFTsWalletAndContractsRawQuery = gql `
8162
+ query NFTsWalletAndContract(
8163
+ $filter: TokensFilterInputType
8164
+ $address: String
8165
+ $first: Int
8166
+ $after: String
8167
+ ) {
8168
+ wallet(address: $address) {
8169
+ ensName
8170
+ address
8171
+ tokens(filter: $filter, first: $first, after: $after) {
8172
+ pageInfo {
8173
+ hasNextPage
8174
+ endCursor
8175
+ }
8176
+ edges {
8177
+ node {
8178
+ tokenId
8179
+ images {
8180
+ url
8181
+ }
8182
+ ... on ERC721Token {
8183
+ contract {
8184
+ address
8185
+ ... on ERC721Contract {
8186
+ symbol
8187
+ name
8188
+ }
8189
+ }
8190
+ }
8191
+ }
8192
+ }
8193
+ }
8194
+ }
8195
+ }
8196
+ `;
8197
+
8198
+ const DEFAULT_LOG_FILTER_TYPES = ['TRANSFER', 'ORDER', 'MINT'];
8120
8199
  class NFTQueries {
8121
8200
  constructor(client) {
8122
8201
  this.client = client;
@@ -8155,7 +8234,7 @@ class NFTQueries {
8155
8234
  }
8156
8235
  getNFTEventLogs(variables) {
8157
8236
  return __awaiter(this, void 0, void 0, function* () {
8158
- const { types = ['TRANSFER', 'ORDER', 'MINT'] } = variables, otherVariables = __rest(variables, ["types"]);
8237
+ const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
8159
8238
  return yield this.client.query({
8160
8239
  query: getNFTEventLogsRawQuery,
8161
8240
  variables: Object.assign(Object.assign({}, otherVariables), { filter: {
@@ -8172,6 +8251,27 @@ class NFTQueries {
8172
8251
  });
8173
8252
  });
8174
8253
  }
8254
+ getContractEventLogs(variables) {
8255
+ return __awaiter(this, void 0, void 0, function* () {
8256
+ const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
8257
+ return yield this.client.query({
8258
+ query: getContractEventLogsRawQuery,
8259
+ variables: Object.assign(Object.assign({}, otherVariables), { filter: {
8260
+ typeIn: types,
8261
+ } }),
8262
+ });
8263
+ });
8264
+ }
8265
+ getNFTsByWalletAndContracts(variables) {
8266
+ return __awaiter(this, void 0, void 0, function* () {
8267
+ const { contracts } = variables, otherVariables = __rest(variables, ["contracts"]);
8268
+ const response = yield this.client.query({
8269
+ query: getNFTsWalletAndContractsRawQuery,
8270
+ variables: Object.assign(Object.assign({}, otherVariables), { filter: { contractAddressIn: contracts } }),
8271
+ });
8272
+ return response;
8273
+ });
8274
+ }
8175
8275
  }
8176
8276
 
8177
8277
  /**
package/src/index.js CHANGED
@@ -8125,6 +8125,85 @@ 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 getNFTsWalletAndContractsRawQuery = gql `
8170
+ query NFTsWalletAndContract(
8171
+ $filter: TokensFilterInputType
8172
+ $address: String
8173
+ $first: Int
8174
+ $after: String
8175
+ ) {
8176
+ wallet(address: $address) {
8177
+ ensName
8178
+ address
8179
+ tokens(filter: $filter, first: $first, after: $after) {
8180
+ pageInfo {
8181
+ hasNextPage
8182
+ endCursor
8183
+ }
8184
+ edges {
8185
+ node {
8186
+ tokenId
8187
+ images {
8188
+ url
8189
+ }
8190
+ ... on ERC721Token {
8191
+ contract {
8192
+ address
8193
+ ... on ERC721Contract {
8194
+ symbol
8195
+ name
8196
+ }
8197
+ }
8198
+ }
8199
+ }
8200
+ }
8201
+ }
8202
+ }
8203
+ }
8204
+ `;
8205
+
8206
+ const DEFAULT_LOG_FILTER_TYPES = ['TRANSFER', 'ORDER', 'MINT'];
8128
8207
  class NFTQueries {
8129
8208
  constructor(client) {
8130
8209
  this.client = client;
@@ -8163,7 +8242,7 @@ class NFTQueries {
8163
8242
  }
8164
8243
  getNFTEventLogs(variables) {
8165
8244
  return __awaiter(this, void 0, void 0, function* () {
8166
- const { types = ['TRANSFER', 'ORDER', 'MINT'] } = variables, otherVariables = __rest(variables, ["types"]);
8245
+ const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
8167
8246
  return yield this.client.query({
8168
8247
  query: getNFTEventLogsRawQuery,
8169
8248
  variables: Object.assign(Object.assign({}, otherVariables), { filter: {
@@ -8180,6 +8259,27 @@ class NFTQueries {
8180
8259
  });
8181
8260
  });
8182
8261
  }
8262
+ getContractEventLogs(variables) {
8263
+ return __awaiter(this, void 0, void 0, function* () {
8264
+ const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
8265
+ return yield this.client.query({
8266
+ query: getContractEventLogsRawQuery,
8267
+ variables: Object.assign(Object.assign({}, otherVariables), { filter: {
8268
+ typeIn: types,
8269
+ } }),
8270
+ });
8271
+ });
8272
+ }
8273
+ getNFTsByWalletAndContracts(variables) {
8274
+ return __awaiter(this, void 0, void 0, function* () {
8275
+ const { contracts } = variables, otherVariables = __rest(variables, ["contracts"]);
8276
+ const response = yield this.client.query({
8277
+ query: getNFTsWalletAndContractsRawQuery,
8278
+ variables: Object.assign(Object.assign({}, otherVariables), { filter: { contractAddressIn: contracts } }),
8279
+ });
8280
+ return response;
8281
+ });
8282
+ }
8183
8283
  }
8184
8284
 
8185
8285
  /**
@@ -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 {};
@@ -0,0 +1,6 @@
1
+ import { PaginationArgs } from '../../../types';
2
+ export declare const getNFTsWalletAndContractsRawQuery: import("graphql/language/ast").DocumentNode;
3
+ export interface NFTWalletAndContractQueryVariables extends PaginationArgs {
4
+ address: string;
5
+ contracts: string[];
6
+ }
@@ -6,7 +6,9 @@ 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 { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, EventLogsQueryResponse, NFTDetailsQueryResponse } from './sharedTypes';
9
+ import { ContractEventLogQueryVariables } from './getContractEventLogs/getContractEventLogs';
10
+ import { NFTWalletAndContractQueryVariables } from './getNFTsByWalletAndContracts/getNFTsByWalletAndContracts';
11
+ import { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, EventLogsQueryResponse, NFTDetailsQueryResponse, ContractEventLogsQueryResponse } from './sharedTypes';
10
12
  export declare class NFTQueries {
11
13
  private client;
12
14
  constructor(client: CustomApolloClient);
@@ -16,4 +18,6 @@ export declare class NFTQueries {
16
18
  getCollectionDetails(variables: CollectionDetailsQueryVariables): Promise<ApolloQueryResult<CollectionDetailsQueryResponse>>;
17
19
  getNFTEventLogs(variables: EventLogsQueryVariables): Promise<ApolloQueryResult<EventLogsQueryResponse>>;
18
20
  getNFTDetails(variables: NFTDetailsQueryVariables): Promise<ApolloQueryResult<NFTDetailsQueryResponse>>;
21
+ getContractEventLogs(variables: ContractEventLogQueryVariables): Promise<ApolloQueryResult<ContractEventLogsQueryResponse>>;
22
+ getNFTsByWalletAndContracts(variables: NFTWalletAndContractQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>;
19
23
  }