@quicknode/sdk 0.2.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 CHANGED
@@ -129,6 +129,51 @@ 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
+
132
177
  ## Pagination
133
178
 
134
179
  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.2.0",
9
+ "version": "0.3.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
@@ -8038,6 +8038,85 @@ 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
+
8041
8120
  class NFTQueries {
8042
8121
  constructor(client) {
8043
8122
  this.client = client;
@@ -8074,6 +8153,25 @@ class NFTQueries {
8074
8153
  });
8075
8154
  });
8076
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
+ }
8077
8175
  }
8078
8176
 
8079
8177
  /**
package/src/index.js CHANGED
@@ -8046,6 +8046,85 @@ 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
+
8049
8128
  class NFTQueries {
8050
8129
  constructor(client) {
8051
8130
  this.client = client;
@@ -8082,6 +8161,25 @@ class NFTQueries {
8082
8161
  });
8083
8162
  });
8084
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
+ }
8085
8183
  }
8086
8184
 
8087
8185
  /**
@@ -0,0 +1,5 @@
1
+ export declare const getNFTDetailsRawQuery: import("graphql/language/ast").DocumentNode;
2
+ export interface NFTDetailsQueryVariables {
3
+ contractAddress: string;
4
+ tokenId: string;
5
+ }
@@ -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 {};
@@ -4,7 +4,9 @@ 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 { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse } from './sharedTypes';
7
+ import { EventLogsQueryVariables } from './getNFTEventLogs/getNFTEventLogs';
8
+ import { NFTDetailsQueryVariables } from './getNFTDetails/getNFTDetails';
9
+ import { ContractNFTsQueryResponse, WalletNFTsQueryResponse, CollectionDetailsQueryResponse, EventLogsQueryResponse, NFTDetailsQueryResponse } from './sharedTypes';
8
10
  export declare class NFTQueries {
9
11
  private client;
10
12
  constructor(client: CustomApolloClient);
@@ -12,4 +14,6 @@ export declare class NFTQueries {
12
14
  getNFTsByWalletENS(variables: WalletENSNFTsQueryVariables): Promise<ApolloQueryResult<WalletNFTsQueryResponse>>;
13
15
  getNFTsByContractAddress(variables: ContractAddressNFTsQueryVariables): Promise<ApolloQueryResult<ContractNFTsQueryResponse>>;
14
16
  getCollectionDetails(variables: CollectionDetailsQueryVariables): Promise<ApolloQueryResult<CollectionDetailsQueryResponse>>;
17
+ getNFTEventLogs(variables: EventLogsQueryVariables): Promise<ApolloQueryResult<EventLogsQueryResponse>>;
18
+ getNFTDetails(variables: NFTDetailsQueryVariables): Promise<ApolloQueryResult<NFTDetailsQueryResponse>>;
15
19
  }