@covalenthq/client-sdk 2.2.2 → 2.2.3

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/dist/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "2.2.2";
3
+ var version = "2.2.3";
4
4
 
5
5
  const bigIntParser = (val) => {
6
6
  if (val === null || val === undefined) {
@@ -2164,6 +2164,120 @@ class NftService {
2164
2164
  };
2165
2165
  return await this.execution.execute(endpoint, parseData);
2166
2166
  }
2167
+ /**
2168
+ *
2169
+ * Commonly used to render a price floor chart for an NFT collection.
2170
+ *
2171
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
2172
+ * @param {string} collectionAddress - The requested address.
2173
+ * @param {GetNftsForAddressQueryParamOpts} queryParamOpts
2174
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
2175
+ * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days.
2176
+ *
2177
+ */
2178
+ async getHistoricalFloorPricesForCollection(chainName, collectionAddress, queryParamOpts) {
2179
+ const endpoint = endpointGenerator(`${chainName}/nft_market/${collectionAddress}/floor_price`, [
2180
+ {
2181
+ key: "days",
2182
+ value: queryParamOpts?.days,
2183
+ },
2184
+ {
2185
+ key: "quote-currency",
2186
+ value: queryParamOpts?.quote_currency,
2187
+ },
2188
+ ]);
2189
+ const parseData = (data) => {
2190
+ if (data.data) {
2191
+ data.data.updated_at = data.data.updated_at
2192
+ ? new Date(data.data.updated_at)
2193
+ : null;
2194
+ data.data.items = data.data.items
2195
+ ? data.data.items.map((floorPriceItem) => ({
2196
+ ...floorPriceItem,
2197
+ date: floorPriceItem.date ? new Date(floorPriceItem.date) : null,
2198
+ }))
2199
+ : null;
2200
+ }
2201
+ return data;
2202
+ };
2203
+ return await this.execution.execute(endpoint, parseData);
2204
+ }
2205
+ /**
2206
+ *
2207
+ * Commonly used to build a time-series chart of the transaction volume of an NFT collection.
2208
+ *
2209
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
2210
+ * @param {string} collectionAddress - The requested address.
2211
+ * @param {GetNftsForAddressQueryParamOpts} queryParamOpts
2212
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
2213
+ * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days.
2214
+ *
2215
+ */
2216
+ async getHistoricalVolumeForCollection(chainName, collectionAddress, queryParamOpts) {
2217
+ const endpoint = endpointGenerator(`${chainName}/nft_market/${collectionAddress}/volume`, [
2218
+ {
2219
+ key: "days",
2220
+ value: queryParamOpts?.days,
2221
+ },
2222
+ {
2223
+ key: "quote-currency",
2224
+ value: queryParamOpts?.quote_currency,
2225
+ },
2226
+ ]);
2227
+ const parseData = (data) => {
2228
+ if (data.data) {
2229
+ data.data.updated_at = data.data.updated_at
2230
+ ? new Date(data.data.updated_at)
2231
+ : null;
2232
+ data.data.items = data.data.items
2233
+ ? data.data.items.map((floorPriceItem) => ({
2234
+ ...floorPriceItem,
2235
+ date: floorPriceItem.date ? new Date(floorPriceItem.date) : null,
2236
+ }))
2237
+ : null;
2238
+ }
2239
+ return data;
2240
+ };
2241
+ return await this.execution.execute(endpoint, parseData);
2242
+ }
2243
+ /**
2244
+ *
2245
+ * Commonly used to build a time-series chart of the sales count of an NFT collection.
2246
+ *
2247
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
2248
+ * @param {string} collectionAddress - The requested address.
2249
+ * @param {GetNftsForAddressQueryParamOpts} queryParamOpts
2250
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
2251
+ * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days.
2252
+ *
2253
+ */
2254
+ async getHistoricalSalesCountForCollection(chainName, collectionAddress, queryParamOpts) {
2255
+ const endpoint = endpointGenerator(`${chainName}/nft_market/${collectionAddress}/sale_count`, [
2256
+ {
2257
+ key: "days",
2258
+ value: queryParamOpts?.days,
2259
+ },
2260
+ {
2261
+ key: "quote-currency",
2262
+ value: queryParamOpts?.quote_currency,
2263
+ },
2264
+ ]);
2265
+ const parseData = (data) => {
2266
+ if (data.data) {
2267
+ data.data.updated_at = data.data.updated_at
2268
+ ? new Date(data.data.updated_at)
2269
+ : null;
2270
+ data.data.items = data.data.items
2271
+ ? data.data.items.map((floorPriceItem) => ({
2272
+ ...floorPriceItem,
2273
+ date: floorPriceItem.date ? new Date(floorPriceItem.date) : null,
2274
+ }))
2275
+ : null;
2276
+ }
2277
+ return data;
2278
+ };
2279
+ return await this.execution.execute(endpoint, parseData);
2280
+ }
2167
2281
  /**
2168
2282
  *
2169
2283
  * Commonly used to verify ownership of NFTs (including ERC-721 and ERC-1155) within a collection.