@quicknode/sdk 0.4.0 → 0.5.1

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
@@ -193,12 +193,38 @@ const client = new QuickNodeSDK();
193
193
  client.nft
194
194
  .getContractEventLogs({
195
195
  address: '0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
196
- tokenId: '100',
197
196
  types: ['TRANSFER', 'ORDER'],
198
197
  })
199
198
  .then((response) => console.log(response));
200
199
  ```
201
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
+
202
228
  ## Pagination
203
229
 
204
230
  For functions that support pagination, use the `first` property to specify the amount of results to return.
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "directory": "packages/libs/api/sdk"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "0.4.0",
9
+ "version": "0.5.1",
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
@@ -8158,6 +8158,43 @@ const getContractEventLogsRawQuery = gql `
8158
8158
  }
8159
8159
  `;
8160
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
+
8161
8198
  const DEFAULT_LOG_FILTER_TYPES = ['TRANSFER', 'ORDER', 'MINT'];
8162
8199
  class NFTQueries {
8163
8200
  constructor(client) {
@@ -8165,9 +8202,10 @@ class NFTQueries {
8165
8202
  }
8166
8203
  getNFTsByWalletAddress(variables) {
8167
8204
  return __awaiter(this, void 0, void 0, function* () {
8205
+ const { address } = variables, otherVariables = __rest(variables, ["address"]);
8168
8206
  return yield this.client.query({
8169
8207
  query: getWalletAddressNFTsRawQuery,
8170
- variables,
8208
+ variables: Object.assign({ address: address.toLowerCase() }, otherVariables),
8171
8209
  });
8172
8210
  });
8173
8211
  }
@@ -8181,26 +8219,28 @@ class NFTQueries {
8181
8219
  }
8182
8220
  getNFTsByContractAddress(variables) {
8183
8221
  return __awaiter(this, void 0, void 0, function* () {
8222
+ const { address } = variables, otherVariables = __rest(variables, ["address"]);
8184
8223
  return yield this.client.query({
8185
8224
  query: getContractAddressNFTsRawQuery,
8186
- variables,
8225
+ variables: Object.assign({ address: address.toLowerCase() }, otherVariables),
8187
8226
  });
8188
8227
  });
8189
8228
  }
8190
8229
  getCollectionDetails(variables) {
8191
8230
  return __awaiter(this, void 0, void 0, function* () {
8231
+ const { address } = variables, otherVariables = __rest(variables, ["address"]);
8192
8232
  return yield this.client.query({
8193
8233
  query: getCollectionDetailsRawQuery,
8194
- variables,
8234
+ variables: Object.assign({ address: address.toLowerCase() }, otherVariables),
8195
8235
  });
8196
8236
  });
8197
8237
  }
8198
8238
  getNFTEventLogs(variables) {
8199
8239
  return __awaiter(this, void 0, void 0, function* () {
8200
- const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
8240
+ const { address, types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["address", "types"]);
8201
8241
  return yield this.client.query({
8202
8242
  query: getNFTEventLogsRawQuery,
8203
- variables: Object.assign(Object.assign({}, otherVariables), { filter: {
8243
+ variables: Object.assign(Object.assign({}, otherVariables), { address: address.toLowerCase(), filter: {
8204
8244
  typeIn: types,
8205
8245
  } }),
8206
8246
  });
@@ -8208,23 +8248,35 @@ class NFTQueries {
8208
8248
  }
8209
8249
  getNFTDetails(variables) {
8210
8250
  return __awaiter(this, void 0, void 0, function* () {
8251
+ const { contractAddress } = variables, otherVariables = __rest(variables, ["contractAddress"]);
8211
8252
  return yield this.client.query({
8212
8253
  query: getNFTDetailsRawQuery,
8213
- variables,
8254
+ variables: Object.assign({ contractAddress: contractAddress.toLowerCase() }, otherVariables),
8214
8255
  });
8215
8256
  });
8216
8257
  }
8217
8258
  getContractEventLogs(variables) {
8218
8259
  return __awaiter(this, void 0, void 0, function* () {
8219
- const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
8260
+ const { address, types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["address", "types"]);
8220
8261
  return yield this.client.query({
8221
8262
  query: getContractEventLogsRawQuery,
8222
- variables: Object.assign(Object.assign({}, otherVariables), { filter: {
8263
+ variables: Object.assign(Object.assign({}, otherVariables), { address: address.toLowerCase(), filter: {
8223
8264
  typeIn: types,
8224
8265
  } }),
8225
8266
  });
8226
8267
  });
8227
8268
  }
8269
+ getNFTsByWalletAndContracts(variables) {
8270
+ return __awaiter(this, void 0, void 0, function* () {
8271
+ const { address, contracts } = variables, otherVariables = __rest(variables, ["address", "contracts"]);
8272
+ const normalizedContracts = contracts.map((contract) => contract.toLowerCase());
8273
+ const response = yield this.client.query({
8274
+ query: getNFTsWalletAndContractsRawQuery,
8275
+ variables: Object.assign(Object.assign({}, otherVariables), { address: address.toLowerCase(), filter: { contractAddressIn: normalizedContracts } }),
8276
+ });
8277
+ return response;
8278
+ });
8279
+ }
8228
8280
  }
8229
8281
 
8230
8282
  /**
package/src/index.js CHANGED
@@ -8166,6 +8166,43 @@ const getContractEventLogsRawQuery = gql `
8166
8166
  }
8167
8167
  `;
8168
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
+
8169
8206
  const DEFAULT_LOG_FILTER_TYPES = ['TRANSFER', 'ORDER', 'MINT'];
8170
8207
  class NFTQueries {
8171
8208
  constructor(client) {
@@ -8173,9 +8210,10 @@ class NFTQueries {
8173
8210
  }
8174
8211
  getNFTsByWalletAddress(variables) {
8175
8212
  return __awaiter(this, void 0, void 0, function* () {
8213
+ const { address } = variables, otherVariables = __rest(variables, ["address"]);
8176
8214
  return yield this.client.query({
8177
8215
  query: getWalletAddressNFTsRawQuery,
8178
- variables,
8216
+ variables: Object.assign({ address: address.toLowerCase() }, otherVariables),
8179
8217
  });
8180
8218
  });
8181
8219
  }
@@ -8189,26 +8227,28 @@ class NFTQueries {
8189
8227
  }
8190
8228
  getNFTsByContractAddress(variables) {
8191
8229
  return __awaiter(this, void 0, void 0, function* () {
8230
+ const { address } = variables, otherVariables = __rest(variables, ["address"]);
8192
8231
  return yield this.client.query({
8193
8232
  query: getContractAddressNFTsRawQuery,
8194
- variables,
8233
+ variables: Object.assign({ address: address.toLowerCase() }, otherVariables),
8195
8234
  });
8196
8235
  });
8197
8236
  }
8198
8237
  getCollectionDetails(variables) {
8199
8238
  return __awaiter(this, void 0, void 0, function* () {
8239
+ const { address } = variables, otherVariables = __rest(variables, ["address"]);
8200
8240
  return yield this.client.query({
8201
8241
  query: getCollectionDetailsRawQuery,
8202
- variables,
8242
+ variables: Object.assign({ address: address.toLowerCase() }, otherVariables),
8203
8243
  });
8204
8244
  });
8205
8245
  }
8206
8246
  getNFTEventLogs(variables) {
8207
8247
  return __awaiter(this, void 0, void 0, function* () {
8208
- const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
8248
+ const { address, types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["address", "types"]);
8209
8249
  return yield this.client.query({
8210
8250
  query: getNFTEventLogsRawQuery,
8211
- variables: Object.assign(Object.assign({}, otherVariables), { filter: {
8251
+ variables: Object.assign(Object.assign({}, otherVariables), { address: address.toLowerCase(), filter: {
8212
8252
  typeIn: types,
8213
8253
  } }),
8214
8254
  });
@@ -8216,23 +8256,35 @@ class NFTQueries {
8216
8256
  }
8217
8257
  getNFTDetails(variables) {
8218
8258
  return __awaiter(this, void 0, void 0, function* () {
8259
+ const { contractAddress } = variables, otherVariables = __rest(variables, ["contractAddress"]);
8219
8260
  return yield this.client.query({
8220
8261
  query: getNFTDetailsRawQuery,
8221
- variables,
8262
+ variables: Object.assign({ contractAddress: contractAddress.toLowerCase() }, otherVariables),
8222
8263
  });
8223
8264
  });
8224
8265
  }
8225
8266
  getContractEventLogs(variables) {
8226
8267
  return __awaiter(this, void 0, void 0, function* () {
8227
- const { types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["types"]);
8268
+ const { address, types = DEFAULT_LOG_FILTER_TYPES } = variables, otherVariables = __rest(variables, ["address", "types"]);
8228
8269
  return yield this.client.query({
8229
8270
  query: getContractEventLogsRawQuery,
8230
- variables: Object.assign(Object.assign({}, otherVariables), { filter: {
8271
+ variables: Object.assign(Object.assign({}, otherVariables), { address: address.toLowerCase(), filter: {
8231
8272
  typeIn: types,
8232
8273
  } }),
8233
8274
  });
8234
8275
  });
8235
8276
  }
8277
+ getNFTsByWalletAndContracts(variables) {
8278
+ return __awaiter(this, void 0, void 0, function* () {
8279
+ const { address, contracts } = variables, otherVariables = __rest(variables, ["address", "contracts"]);
8280
+ const normalizedContracts = contracts.map((contract) => contract.toLowerCase());
8281
+ const response = yield this.client.query({
8282
+ query: getNFTsWalletAndContractsRawQuery,
8283
+ variables: Object.assign(Object.assign({}, otherVariables), { address: address.toLowerCase(), filter: { contractAddressIn: normalizedContracts } }),
8284
+ });
8285
+ return response;
8286
+ });
8287
+ }
8236
8288
  }
8237
8289
 
8238
8290
  /**
@@ -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
+ }
@@ -7,6 +7,7 @@ import { CollectionDetailsQueryVariables } from './getCollectionDetails/getColle
7
7
  import { EventLogsQueryVariables } from './getNFTEventLogs/getNFTEventLogs';
8
8
  import { NFTDetailsQueryVariables } from './getNFTDetails/getNFTDetails';
9
9
  import { ContractEventLogQueryVariables } from './getContractEventLogs/getContractEventLogs';
10
+ import { NFTWalletAndContractQueryVariables } from './getNFTsByWalletAndContracts/getNFTsByWalletAndContracts';
10
11
  import { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, EventLogsQueryResponse, NFTDetailsQueryResponse, ContractEventLogsQueryResponse } from './sharedTypes';
11
12
  export declare class NFTQueries {
12
13
  private client;
@@ -18,4 +19,5 @@ export declare class NFTQueries {
18
19
  getNFTEventLogs(variables: EventLogsQueryVariables): Promise<ApolloQueryResult<EventLogsQueryResponse>>;
19
20
  getNFTDetails(variables: NFTDetailsQueryVariables): Promise<ApolloQueryResult<NFTDetailsQueryResponse>>;
20
21
  getContractEventLogs(variables: ContractEventLogQueryVariables): Promise<ApolloQueryResult<ContractEventLogsQueryResponse>>;
22
+ getNFTsByWalletAndContracts(variables: NFTWalletAndContractQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>;
21
23
  }