@covalenthq/client-sdk 2.3.8 → 3.0.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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "2.3.8";
3
+ var version = "3.0.0";
4
4
 
5
5
  const bigIntParser = (val) => {
6
6
  if (val === null || val === undefined) {
@@ -32,6 +32,7 @@ const endpointGenerator = (extension = "", params = []) => {
32
32
  *
33
33
  */
34
34
  class AllChainsService {
35
+ execution;
35
36
  constructor(execution) {
36
37
  this.execution = execution;
37
38
  }
@@ -148,24 +149,6 @@ class AllChainsService {
148
149
  };
149
150
  return await this.execution.execute(endpoint, parseData);
150
151
  }
151
- /**
152
- * @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getMultiChainMultiAddressTransactions` instead.
153
- *
154
- * Commonly used to get transactions cross chains and addresses.
155
- *
156
- * @param {Chain[]} chains - An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains.
157
- * @param {string[]} addresses - An array of addresses for which transactions are fetched. Does not support name resolution.
158
- * @param {number} limit - Number of transactions to return per page, up to the default max of 100 items.
159
- * @param {string} before - Pagination cursor pointing to fetch transactions before a certain point.
160
- * @param {string} after - Pagination cursor pointing to fetch transactions after a certain point.
161
- * @param {boolean} withLogs - Whether to include raw logs in the response.
162
- * @param {boolean} withDecodedLogs - Whether to include decoded logs in the response.
163
- * @param {Quote | CryptocurrencyQuote} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `BTC` and `ETH`.
164
- *
165
- */
166
- async getMultiChainAndMultiAddressTransactions(queryParamOpts) {
167
- return await this.getMultiChainMultiAddressTransactions(queryParamOpts);
168
- }
169
152
  /**
170
153
  *
171
154
  * Fetch paginated spot & historical native and token balances for a single address on up to 10 EVM chains with one API call.
@@ -264,7 +247,9 @@ async function* paginateEndpoint(endpoint, execution, parseData, implementation)
264
247
  data: null,
265
248
  error: true,
266
249
  error_code: err?.cause?.code || err?.error_code || 500,
267
- error_message: err?.cause?.message || err?.error_message || "Internal server error",
250
+ error_message: err?.cause?.message ||
251
+ err?.error_message ||
252
+ "Internal server error",
268
253
  };
269
254
  }
270
255
  }
@@ -275,6 +260,7 @@ async function* paginateEndpoint(endpoint, execution, parseData, implementation)
275
260
  *
276
261
  */
277
262
  class BalanceService {
263
+ execution;
278
264
  constructor(execution) {
279
265
  this.execution = execution;
280
266
  }
@@ -288,10 +274,7 @@ class BalanceService {
288
274
  * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
289
275
  * @param {GetTokenBalancesForWalletAddressQueryParamOpts} queryParamOpts
290
276
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
291
- * - `nft`: If `true`, NFTs will be included in the response.
292
- * - `noNftFetch`: If `true`, only NFTs that have been cached will be included in the response. Helpful for faster response times.
293
277
  * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
294
- * - `noNftAssetMetadata`: If `true`, the response shape is limited to a list of collections and token ids, omitting metadata and asset information. Helpful for faster response times and wallets holding a large number of NFTs.
295
278
  *
296
279
  */
297
280
  async getTokenBalancesForWalletAddress(chainName, walletAddress, queryParamOpts) {
@@ -300,22 +283,10 @@ class BalanceService {
300
283
  key: "quote-currency",
301
284
  value: queryParamOpts?.quoteCurrency,
302
285
  },
303
- {
304
- key: "nft",
305
- value: queryParamOpts?.nft,
306
- },
307
- {
308
- key: "no-nft-fetch",
309
- value: queryParamOpts?.noNftFetch,
310
- },
311
286
  {
312
287
  key: "no-spam",
313
288
  value: queryParamOpts?.noSpam,
314
289
  },
315
- {
316
- key: "no-nft-asset-metadata",
317
- value: queryParamOpts?.noNftAssetMetadata,
318
- },
319
290
  ]);
320
291
  const parseData = (data) => {
321
292
  if (data.data) {
@@ -562,6 +533,7 @@ class BalanceService {
562
533
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
563
534
  * @param {string} tokenAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
564
535
  * @param {GetTokenHoldersV2ForTokenAddressQueryParamOpts} queryParamOpts
536
+ * - `noSnapshot`: Defaults to `false`. Set to `true` to bypass last snapshot and get the latest token holders list.
565
537
  * - `blockHeight`: Ending block to define a block range. Omitting this parameter defaults to the latest block height.
566
538
  * - `pageSize`: Number of items per page. Note: Currently, only values of `100` and `1000` are supported. Omitting this parameter defaults to 100.
567
539
  * - `pageNumber`: 0-indexed page number to begin pagination.
@@ -570,6 +542,10 @@ class BalanceService {
570
542
  */
571
543
  async *getTokenHoldersV2ForTokenAddress(chainName, tokenAddress, queryParamOpts) {
572
544
  const endpoint = endpointGenerator(`${chainName}/tokens/${tokenAddress}/token_holders_v2`, [
545
+ {
546
+ key: "no-snapshot",
547
+ value: queryParamOpts?.noSnapshot,
548
+ },
573
549
  {
574
550
  key: "block-height",
575
551
  value: queryParamOpts?.blockHeight,
@@ -615,6 +591,7 @@ class BalanceService {
615
591
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
616
592
  * @param {string} tokenAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
617
593
  * @param {GetTokenHoldersV2ForTokenAddressQueryParamOpts} queryParamOpts
594
+ * - `noSnapshot`: Defaults to `false`. Set to `true` to bypass last snapshot and get the latest token holders list.
618
595
  * - `blockHeight`: Ending block to define a block range. Omitting this parameter defaults to the latest block height.
619
596
  * - `pageSize`: Number of items per page. Note: Currently, only values of `100` and `1000` are supported. Omitting this parameter defaults to 100.
620
597
  * - `pageNumber`: 0-indexed page number to begin pagination.
@@ -623,6 +600,10 @@ class BalanceService {
623
600
  */
624
601
  async getTokenHoldersV2ForTokenAddressByPage(chainName, tokenAddress, queryParamOpts) {
625
602
  const endpoint = endpointGenerator(`${chainName}/tokens/${tokenAddress}/token_holders_v2`, [
603
+ {
604
+ key: "no-snapshot",
605
+ value: queryParamOpts?.noSnapshot,
606
+ },
626
607
  {
627
608
  key: "block-height",
628
609
  value: queryParamOpts?.blockHeight,
@@ -667,10 +648,7 @@ class BalanceService {
667
648
  * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
668
649
  * @param {GetHistoricalTokenBalancesForWalletAddressQueryParamOpts} queryParamOpts
669
650
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
670
- * - `nft`: If `true`, NFTs will be included in the response.
671
- * - `noNftFetch`: If `true`, only NFTs that have been cached will be included in the response. Helpful for faster response times.
672
651
  * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
673
- * - `noNftAssetMetadata`: If `true`, the response shape is limited to a list of collections and token ids, omitting metadata and asset information. Helpful for faster response times and wallets holding a large number of NFTs.
674
652
  * - `blockHeight`: Ending block to define a block range. Omitting this parameter defaults to the latest block height.
675
653
  * - `date`: Ending date to define a block range (YYYY-MM-DD). Omitting this parameter defaults to the current date.
676
654
  *
@@ -681,22 +659,10 @@ class BalanceService {
681
659
  key: "quote-currency",
682
660
  value: queryParamOpts?.quoteCurrency,
683
661
  },
684
- {
685
- key: "nft",
686
- value: queryParamOpts?.nft,
687
- },
688
- {
689
- key: "no-nft-fetch",
690
- value: queryParamOpts?.noNftFetch,
691
- },
692
662
  {
693
663
  key: "no-spam",
694
664
  value: queryParamOpts?.noSpam,
695
665
  },
696
- {
697
- key: "no-nft-asset-metadata",
698
- value: queryParamOpts?.noNftAssetMetadata,
699
- },
700
666
  {
701
667
  key: "block-height",
702
668
  value: queryParamOpts?.blockHeight,
@@ -780,6 +746,7 @@ class BalanceService {
780
746
  *
781
747
  */
782
748
  class BaseService {
749
+ execution;
783
750
  constructor(execution) {
784
751
  this.execution = execution;
785
752
  }
@@ -1218,7 +1185,9 @@ class BaseService {
1218
1185
  data.data.items = data.data.items
1219
1186
  ? data.data.items.map((chainItem) => ({
1220
1187
  ...chainItem,
1221
- chain_id: chainItem.chain_id ? +chainItem.chain_id : null,
1188
+ chain_id: chainItem.chain_id
1189
+ ? +chainItem.chain_id
1190
+ : null,
1222
1191
  }))
1223
1192
  : null;
1224
1193
  }
@@ -1243,46 +1212,8 @@ class BaseService {
1243
1212
  data.data.items = data.data.items
1244
1213
  ? data.data.items.map((chainItem) => ({
1245
1214
  ...chainItem,
1246
- chain_id: chainItem.chain_id ? +chainItem.chain_id : null,
1247
- }))
1248
- : null;
1249
- }
1250
- return data;
1251
- };
1252
- return await this.execution.execute(endpoint, parseData);
1253
- }
1254
- /**
1255
- *
1256
- * Commonly used to locate chains which an address is active on with a single API call.
1257
- *
1258
- * **Credit Cost**: 0.5 per call
1259
- *
1260
- * @deprecated This method is deprecated and will be removed in the upcoming versions. Please use `AllChainsService.getAddressActivity` instead.
1261
- *
1262
- * Commonly used to locate chains which an address is active on with a single API call.
1263
- *
1264
- * @param {string} walletAddress - The requested wallet address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
1265
- * @param {GetAddressActivityQueryParamOpts} queryParamOpts
1266
- * - `testnets`: Set to true to include testnets with activity in the response. By default, it's set to `false` and only returns mainnet activity.
1267
- *
1268
- */
1269
- async getAddressActivity(walletAddress, queryParamOpts) {
1270
- const endpoint = endpointGenerator(`address/${walletAddress}/activity`, [
1271
- {
1272
- key: "testnets",
1273
- value: queryParamOpts?.testnets,
1274
- },
1275
- ]);
1276
- const parseData = (data) => {
1277
- if (data.data) {
1278
- data.data.updated_at = data.data.updated_at
1279
- ? new Date(data.data.updated_at)
1280
- : null;
1281
- data.data.items = data.data.items
1282
- ? data.data.items.map((activityItem) => ({
1283
- ...activityItem,
1284
- last_seen_at: activityItem.last_seen_at
1285
- ? new Date(activityItem.last_seen_at)
1215
+ chain_id: chainItem.chain_id
1216
+ ? +chainItem.chain_id
1286
1217
  : null,
1287
1218
  }))
1288
1219
  : null;
@@ -1328,17 +1259,16 @@ exports.ChainName = void 0;
1328
1259
  ChainName["ETH_MAINNET"] = "eth-mainnet";
1329
1260
  ChainName["ETH_SEPOLIA"] = "eth-sepolia";
1330
1261
  ChainName["ETH_HOLESKY"] = "eth-holesky";
1331
- ChainName["ETH_HOODI"] = "eth-hoodi";
1332
1262
  ChainName["MATIC_MAINNET"] = "matic-mainnet";
1333
1263
  ChainName["AVALANCHE_MAINNET"] = "avalanche-mainnet";
1334
1264
  ChainName["AVALANCHE_TESTNET"] = "avalanche-testnet";
1335
1265
  ChainName["BSC_MAINNET"] = "bsc-mainnet";
1336
1266
  ChainName["BSC_TESTNET"] = "bsc-testnet";
1337
1267
  ChainName["MOONBEAM_MAINNET"] = "moonbeam-mainnet";
1338
- ChainName["MOONBEAM_MOONBASE_ALPHA"] = "moonbeam-moonbase-alpha";
1339
1268
  ChainName["MOONBEAM_MOONRIVER"] = "moonbeam-moonriver";
1340
1269
  ChainName["ARBITRUM_MAINNET"] = "arbitrum-mainnet";
1341
1270
  ChainName["ARBITRUM_NOVA_MAINNET"] = "arbitrum-nova-mainnet";
1271
+ ChainName["ARBITRUM_SEPOLIA"] = "arbitrum-sepolia";
1342
1272
  ChainName["FANTOM_MAINNET"] = "fantom-mainnet";
1343
1273
  ChainName["FANTOM_TESTNET"] = "fantom-testnet";
1344
1274
  ChainName["BTC_MAINNET"] = "btc-mainnet";
@@ -1350,17 +1280,22 @@ exports.ChainName = void 0;
1350
1280
  ChainName["EMERALD_PARATIME_MAINNET"] = "emerald-paratime-mainnet";
1351
1281
  ChainName["MONAD_TESTNET"] = "monad-testnet";
1352
1282
  ChainName["MONAD_MAINNET"] = "monad-mainnet";
1283
+ ChainName["MEGAETH_MAINNET"] = "megaeth-mainnet";
1353
1284
  ChainName["BERACHAIN_MAINNET"] = "berachain-mainnet";
1285
+ ChainName["BERACHAIN_TESTNET"] = "berachain-testnet";
1286
+ ChainName["HYPERCORE_MAINNET"] = "hypercore-mainnet";
1354
1287
  ChainName["PLASMA_MAINNET"] = "plasma-mainnet";
1355
1288
  ChainName["UNICHAIN_MAINNET"] = "unichain-mainnet";
1356
1289
  ChainName["PLASMA_TESTNET"] = "plasma-testnet";
1357
1290
  ChainName["ARC_TESTNET"] = "arc-testnet";
1291
+ ChainName["ADI_TESTNET"] = "adi-testnet";
1358
1292
  ChainName["CANTO_MAINNET"] = "canto-mainnet";
1359
1293
  ChainName["LINEA_MAINNET"] = "linea-mainnet";
1360
1294
  ChainName["LINEA_SEPOLIA_TESTNET"] = "linea-sepolia-testnet";
1361
1295
  ChainName["POLYGON_AMOY_TESTNET"] = "polygon-amoy-testnet";
1362
1296
  ChainName["MANTLE_MAINNET"] = "mantle-mainnet";
1363
1297
  ChainName["BASE_MAINNET"] = "base-mainnet";
1298
+ ChainName["BASE_SEPOLIA_TESTNET"] = "base-sepolia-testnet";
1364
1299
  ChainName["OASIS_SAPPHIRE_MAINNET"] = "oasis-sapphire-mainnet";
1365
1300
  ChainName["CELO_MAINNET"] = "celo-mainnet";
1366
1301
  ChainName["HYPEREVM_MAINNET"] = "hyperevm-mainnet";
@@ -1372,10 +1307,9 @@ exports.ChainName = void 0;
1372
1307
  ChainName["SONIC_MAINNET"] = "sonic-mainnet";
1373
1308
  ChainName["WORLD_MAINNET"] = "world-mainnet";
1374
1309
  ChainName["WORLD_SEPOLIA_TESTNET"] = "world-sepolia-testnet";
1375
- ChainName["LENS_SEPOLIA_TESTNET"] = "lens-sepolia-testnet";
1310
+ ChainName["MANTA_SEPOLIA_TESTNET"] = "manta-sepolia-testnet";
1376
1311
  ChainName["INK_SEPOLIA_TESTNET"] = "ink-sepolia-testnet";
1377
1312
  ChainName["INK_MAINNET"] = "ink-mainnet";
1378
- ChainName["LENS_MAINNET"] = "lens-mainnet";
1379
1313
  ChainName["ZKSYNC_MAINNET"] = "zksync-mainnet";
1380
1314
  ChainName["BNB_OPBNB_MAINNET"] = "bnb-opbnb-mainnet";
1381
1315
  ChainName["ZETACHAIN_MAINNET"] = "zetachain-mainnet";
@@ -1391,17 +1325,16 @@ exports.ChainID = void 0;
1391
1325
  ChainID[ChainID["ETH_MAINNET"] = 1] = "ETH_MAINNET";
1392
1326
  ChainID[ChainID["ETH_SEPOLIA"] = 11155111] = "ETH_SEPOLIA";
1393
1327
  ChainID[ChainID["ETH_HOLESKY"] = 17000] = "ETH_HOLESKY";
1394
- ChainID[ChainID["ETH_HOODI"] = 560048] = "ETH_HOODI";
1395
1328
  ChainID[ChainID["MATIC_MAINNET"] = 137] = "MATIC_MAINNET";
1396
1329
  ChainID[ChainID["AVALANCHE_MAINNET"] = 43114] = "AVALANCHE_MAINNET";
1397
1330
  ChainID[ChainID["AVALANCHE_TESTNET"] = 43113] = "AVALANCHE_TESTNET";
1398
1331
  ChainID[ChainID["BSC_MAINNET"] = 56] = "BSC_MAINNET";
1399
1332
  ChainID[ChainID["BSC_TESTNET"] = 97] = "BSC_TESTNET";
1400
1333
  ChainID[ChainID["MOONBEAM_MAINNET"] = 1284] = "MOONBEAM_MAINNET";
1401
- ChainID[ChainID["MOONBEAM_MOONBASE_ALPHA"] = 1287] = "MOONBEAM_MOONBASE_ALPHA";
1402
1334
  ChainID[ChainID["MOONBEAM_MOONRIVER"] = 1285] = "MOONBEAM_MOONRIVER";
1403
1335
  ChainID[ChainID["ARBITRUM_MAINNET"] = 42161] = "ARBITRUM_MAINNET";
1404
1336
  ChainID[ChainID["ARBITRUM_NOVA_MAINNET"] = 42170] = "ARBITRUM_NOVA_MAINNET";
1337
+ ChainID[ChainID["ARBITRUM_SEPOLIA"] = 421614] = "ARBITRUM_SEPOLIA";
1405
1338
  ChainID[ChainID["FANTOM_MAINNET"] = 250] = "FANTOM_MAINNET";
1406
1339
  ChainID[ChainID["FANTOM_TESTNET"] = 4002] = "FANTOM_TESTNET";
1407
1340
  ChainID[ChainID["BTC_MAINNET"] = 20090103] = "BTC_MAINNET";
@@ -1413,17 +1346,21 @@ exports.ChainID = void 0;
1413
1346
  ChainID[ChainID["EMERALD_PARATIME_MAINNET"] = 42262] = "EMERALD_PARATIME_MAINNET";
1414
1347
  ChainID[ChainID["MONAD_TESTNET"] = 10143] = "MONAD_TESTNET";
1415
1348
  ChainID[ChainID["MONAD_MAINNET"] = 143] = "MONAD_MAINNET";
1349
+ ChainID[ChainID["MEGAETH_MAINNET"] = 4326] = "MEGAETH_MAINNET";
1416
1350
  ChainID[ChainID["BERACHAIN_MAINNET"] = 80094] = "BERACHAIN_MAINNET";
1351
+ ChainID[ChainID["BERACHAIN_TESTNET"] = 80084] = "BERACHAIN_TESTNET";
1417
1352
  ChainID[ChainID["PLASMA_MAINNET"] = 9745] = "PLASMA_MAINNET";
1418
1353
  ChainID[ChainID["UNICHAIN_MAINNET"] = 130] = "UNICHAIN_MAINNET";
1419
1354
  ChainID[ChainID["PLASMA_TESTNET"] = 9746] = "PLASMA_TESTNET";
1420
1355
  ChainID[ChainID["ARC_TESTNET"] = 5042002] = "ARC_TESTNET";
1356
+ ChainID[ChainID["ADI_TESTNET"] = 99999] = "ADI_TESTNET";
1421
1357
  ChainID[ChainID["CANTO_MAINNET"] = 7700] = "CANTO_MAINNET";
1422
1358
  ChainID[ChainID["LINEA_MAINNET"] = 59144] = "LINEA_MAINNET";
1423
1359
  ChainID[ChainID["LINEA_SEPOLIA_TESTNET"] = 59141] = "LINEA_SEPOLIA_TESTNET";
1424
1360
  ChainID[ChainID["POLYGON_AMOY_TESTNET"] = 80002] = "POLYGON_AMOY_TESTNET";
1425
1361
  ChainID[ChainID["MANTLE_MAINNET"] = 5000] = "MANTLE_MAINNET";
1426
1362
  ChainID[ChainID["BASE_MAINNET"] = 8453] = "BASE_MAINNET";
1363
+ ChainID[ChainID["BASE_SEPOLIA_TESTNET"] = 84532] = "BASE_SEPOLIA_TESTNET";
1427
1364
  ChainID[ChainID["OASIS_SAPPHIRE_MAINNET"] = 23294] = "OASIS_SAPPHIRE_MAINNET";
1428
1365
  ChainID[ChainID["CELO_MAINNET"] = 42220] = "CELO_MAINNET";
1429
1366
  ChainID[ChainID["HYPEREVM_MAINNET"] = 999] = "HYPEREVM_MAINNET";
@@ -1435,10 +1372,9 @@ exports.ChainID = void 0;
1435
1372
  ChainID[ChainID["SONIC_MAINNET"] = 146] = "SONIC_MAINNET";
1436
1373
  ChainID[ChainID["WORLD_MAINNET"] = 480] = "WORLD_MAINNET";
1437
1374
  ChainID[ChainID["WORLD_SEPOLIA_TESTNET"] = 4801] = "WORLD_SEPOLIA_TESTNET";
1438
- ChainID[ChainID["LENS_SEPOLIA_TESTNET"] = 37111] = "LENS_SEPOLIA_TESTNET";
1375
+ ChainID[ChainID["MANTA_SEPOLIA_TESTNET"] = 3441006] = "MANTA_SEPOLIA_TESTNET";
1439
1376
  ChainID[ChainID["INK_SEPOLIA_TESTNET"] = 763373] = "INK_SEPOLIA_TESTNET";
1440
1377
  ChainID[ChainID["INK_MAINNET"] = 57073] = "INK_MAINNET";
1441
- ChainID[ChainID["LENS_MAINNET"] = 232] = "LENS_MAINNET";
1442
1378
  ChainID[ChainID["ZKSYNC_MAINNET"] = 324] = "ZKSYNC_MAINNET";
1443
1379
  ChainID[ChainID["BNB_OPBNB_MAINNET"] = 204] = "BNB_OPBNB_MAINNET";
1444
1380
  ChainID[ChainID["ZETACHAIN_MAINNET"] = 7000] = "ZETACHAIN_MAINNET";
@@ -1455,6 +1391,7 @@ exports.ChainID = void 0;
1455
1391
  *
1456
1392
  */
1457
1393
  class BitcoinService {
1394
+ execution;
1458
1395
  constructor(execution) {
1459
1396
  this.execution = execution;
1460
1397
  }
@@ -1589,101 +1526,10 @@ class BitcoinService {
1589
1526
  *
1590
1527
  */
1591
1528
  class NftService {
1529
+ execution;
1592
1530
  constructor(execution) {
1593
1531
  this.execution = execution;
1594
1532
  }
1595
- /**
1596
- *
1597
- * Commonly used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files.
1598
- *
1599
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
1600
- * @param {GetChainCollectionsQueryParamOpts} queryParamOpts
1601
- * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
1602
- * - `pageNumber`: 0-indexed page number to begin pagination.
1603
- * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
1604
- *
1605
- * @deprecated This endpoint is no longer supported by the GoldRush API.
1606
- */
1607
- async *getChainCollections(chainName, queryParamOpts) {
1608
- const endpoint = endpointGenerator(`${chainName}/nft/collections`, [
1609
- {
1610
- key: "page-size",
1611
- value: queryParamOpts?.pageSize,
1612
- },
1613
- {
1614
- key: "page-number",
1615
- value: queryParamOpts?.pageNumber,
1616
- },
1617
- {
1618
- key: "no-spam",
1619
- value: queryParamOpts?.noSpam,
1620
- },
1621
- ]);
1622
- const parseData = (data) => {
1623
- if (data.data) {
1624
- data.data.updated_at = data.data.updated_at
1625
- ? new Date(data.data.updated_at)
1626
- : null;
1627
- data.data.items = data.data.items
1628
- ? data.data.items.map((collectionItem) => ({
1629
- ...collectionItem,
1630
- last_scraped_at: collectionItem.last_scraped_at
1631
- ? new Date(collectionItem.last_scraped_at)
1632
- : null,
1633
- }))
1634
- : null;
1635
- }
1636
- return data;
1637
- };
1638
- for await (const data of paginateEndpoint(endpoint, this.execution, parseData, "pagination")) {
1639
- yield data;
1640
- }
1641
- }
1642
- /**
1643
- *
1644
- * Commonly used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files.
1645
- *
1646
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
1647
- * @param {GetChainCollectionsQueryParamOpts} queryParamOpts
1648
- * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
1649
- * - `pageNumber`: 0-indexed page number to begin pagination.
1650
- * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
1651
- *
1652
- * @deprecated This endpoint is no longer supported by the GoldRush API.
1653
- */
1654
- async getChainCollectionsByPage(chainName, queryParamOpts) {
1655
- const endpoint = endpointGenerator(`${chainName}/nft/collections`, [
1656
- {
1657
- key: "page-size",
1658
- value: queryParamOpts?.pageSize,
1659
- },
1660
- {
1661
- key: "page-number",
1662
- value: queryParamOpts?.pageNumber,
1663
- },
1664
- {
1665
- key: "no-spam",
1666
- value: queryParamOpts?.noSpam,
1667
- },
1668
- ]);
1669
- const parseData = (data) => {
1670
- if (data.data) {
1671
- data.data.updated_at = data.data.updated_at
1672
- ? new Date(data.data.updated_at)
1673
- : null;
1674
- data.data.items = data.data.items
1675
- ? data.data.items.map((collectionItem) => ({
1676
- ...collectionItem,
1677
- last_scraped_at: collectionItem.last_scraped_at
1678
- ? new Date(collectionItem.last_scraped_at)
1679
- : null,
1680
- }))
1681
- : null;
1682
- }
1683
- return data;
1684
- };
1685
- return await this.execution.execute(endpoint, parseData);
1686
- }
1687
1533
  /**
1688
1534
  *
1689
1535
  * Commonly used to render the NFTs (including ERC721 and ERC1155) held by an address.
@@ -1695,7 +1541,6 @@ class NftService {
1695
1541
  * @param {GetNftsForAddressQueryParamOpts} queryParamOpts
1696
1542
  * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
1697
1543
  * - `noNftAssetMetadata`: If `true`, the response shape is limited to a list of collections and token ids, omitting metadata and asset information. Helpful for faster response times and wallets holding a large number of NFTs.
1698
- * - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side.
1699
1544
  *
1700
1545
  */
1701
1546
  async getNftsForAddress(chainName, walletAddress, queryParamOpts) {
@@ -1708,10 +1553,6 @@ class NftService {
1708
1553
  key: "no-nft-asset-metadata",
1709
1554
  value: queryParamOpts?.noNftAssetMetadata,
1710
1555
  },
1711
- {
1712
- key: "with-uncached",
1713
- value: queryParamOpts?.withUncached,
1714
- },
1715
1556
  ]);
1716
1557
  const parseData = (data) => {
1717
1558
  if (data.data) {
@@ -1736,408 +1577,6 @@ class NftService {
1736
1577
  };
1737
1578
  return await this.execution.execute(endpoint, parseData);
1738
1579
  }
1739
- /**
1740
- *
1741
- * Commonly used to get NFT token IDs with metadata from a collection. Useful for building NFT card displays.
1742
- *
1743
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
1744
- * @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
1745
- * @param {GetTokenIdsForContractWithMetadataQueryParamOpts} queryParamOpts
1746
- * - `noMetadata`: Omit metadata.
1747
- * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
1748
- * - `pageNumber`: 0-indexed page number to begin pagination.
1749
- * - `traitsFilter`: Filters NFTs based on a specific trait. If this filter is used, the API will return all NFTs with the specified trait. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding.
1750
- * - `valuesFilter`: Filters NFTs based on a specific trait value. If this filter is used, the API will return all NFTs with the specified trait value. If used with "traits-filter", only NFTs matching both filters will be returned. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding.
1751
- * - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side.
1752
- *
1753
- * @deprecated This endpoint is no longer supported by the GoldRush API.
1754
- */
1755
- async *getTokenIdsForContractWithMetadata(chainName, contractAddress, queryParamOpts) {
1756
- const endpoint = endpointGenerator(`${chainName}/nft/${contractAddress}/metadata`, [
1757
- {
1758
- key: "no-metadata",
1759
- value: queryParamOpts?.noMetadata,
1760
- },
1761
- {
1762
- key: "page-size",
1763
- value: queryParamOpts?.pageSize,
1764
- },
1765
- {
1766
- key: "page-number",
1767
- value: queryParamOpts?.pageNumber,
1768
- },
1769
- {
1770
- key: "traits-filter",
1771
- value: queryParamOpts?.traitsFilter,
1772
- },
1773
- {
1774
- key: "values-filter",
1775
- value: queryParamOpts?.valuesFilter,
1776
- },
1777
- {
1778
- key: "with-uncached",
1779
- value: queryParamOpts?.withUncached,
1780
- },
1781
- ]);
1782
- const parseData = (data) => {
1783
- if (data.data) {
1784
- data.data.updated_at = data.data.updated_at
1785
- ? new Date(data.data.updated_at)
1786
- : null;
1787
- data.data.items = data.data.items
1788
- ? data.data.items.map((tokenItem) => ({
1789
- ...tokenItem,
1790
- nft_data: {
1791
- ...tokenItem.nft_data,
1792
- token_id: bigIntParser(tokenItem.nft_data?.token_id),
1793
- },
1794
- }))
1795
- : null;
1796
- }
1797
- return data;
1798
- };
1799
- for await (const data of paginateEndpoint(endpoint, this.execution, parseData, "pagination")) {
1800
- yield data;
1801
- }
1802
- }
1803
- /**
1804
- *
1805
- * Commonly used to get NFT token IDs with metadata from a collection. Useful for building NFT card displays.
1806
- *
1807
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
1808
- * @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
1809
- * @param {GetTokenIdsForContractWithMetadataQueryParamOpts} queryParamOpts
1810
- * - `noMetadata`: Omit metadata.
1811
- * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
1812
- * - `pageNumber`: 0-indexed page number to begin pagination.
1813
- * - `traitsFilter`: Filters NFTs based on a specific trait. If this filter is used, the API will return all NFTs with the specified trait. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding.
1814
- * - `valuesFilter`: Filters NFTs based on a specific trait value. If this filter is used, the API will return all NFTs with the specified trait value. If used with "traits-filter", only NFTs matching both filters will be returned. Accepts comma-separated values, is case-sensitive, and requires proper URL encoding.
1815
- * - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side.
1816
- *
1817
- * @deprecated This endpoint is no longer supported by the GoldRush API.
1818
- */
1819
- async getTokenIdsForContractWithMetadataByPage(chainName, contractAddress, queryParamOpts) {
1820
- const endpoint = endpointGenerator(`${chainName}/nft/${contractAddress}/metadata`, [
1821
- {
1822
- key: "no-metadata",
1823
- value: queryParamOpts?.noMetadata,
1824
- },
1825
- {
1826
- key: "page-size",
1827
- value: queryParamOpts?.pageSize,
1828
- },
1829
- {
1830
- key: "page-number",
1831
- value: queryParamOpts?.pageNumber,
1832
- },
1833
- {
1834
- key: "traits-filter",
1835
- value: queryParamOpts?.traitsFilter,
1836
- },
1837
- {
1838
- key: "values-filter",
1839
- value: queryParamOpts?.valuesFilter,
1840
- },
1841
- {
1842
- key: "with-uncached",
1843
- value: queryParamOpts?.withUncached,
1844
- },
1845
- ]);
1846
- const parseData = (data) => {
1847
- if (data.data) {
1848
- data.data.updated_at = data.data.updated_at
1849
- ? new Date(data.data.updated_at)
1850
- : null;
1851
- data.data.items = data.data.items
1852
- ? data.data.items.map((tokenItem) => ({
1853
- ...tokenItem,
1854
- nft_data: {
1855
- ...tokenItem.nft_data,
1856
- token_id: bigIntParser(tokenItem.nft_data?.token_id),
1857
- },
1858
- }))
1859
- : null;
1860
- }
1861
- return data;
1862
- };
1863
- return await this.execution.execute(endpoint, parseData);
1864
- }
1865
- /**
1866
- *
1867
- * Commonly used to get a single NFT metadata by token ID from a collection. Useful for building NFT card displays.
1868
- *
1869
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
1870
- * @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
1871
- * @param {string} tokenId - The requested token ID.
1872
- * @param {GetNftMetadataForGivenTokenIdForContractQueryParamOpts} queryParamOpts
1873
- * - `noMetadata`: Omit metadata.
1874
- * - `withUncached`: By default, this endpoint only works on chains where we've cached the assets and the metadata. When set to `true`, the API will fetch metadata from upstream servers even if it's not cached - the downside being that the upstream server can block or rate limit the call and therefore resulting in time outs or slow response times on the Covalent side.
1875
- *
1876
- * @deprecated This endpoint is no longer supported by the GoldRush API.
1877
- */
1878
- async getNftMetadataForGivenTokenIdForContract(chainName, contractAddress, tokenId, queryParamOpts) {
1879
- const endpoint = endpointGenerator(`${chainName}/nft/${contractAddress}/metadata/${tokenId}`, [
1880
- {
1881
- key: "no-metadata",
1882
- value: queryParamOpts?.noMetadata,
1883
- },
1884
- {
1885
- key: "with-uncached",
1886
- value: queryParamOpts?.withUncached,
1887
- },
1888
- ]);
1889
- const parseData = (data) => {
1890
- if (data.data) {
1891
- data.data.updated_at = data.data.updated_at
1892
- ? new Date(data.data.updated_at)
1893
- : null;
1894
- data.data.items = data.data.items
1895
- ? data.data.items.map((tokenItem) => ({
1896
- ...tokenItem,
1897
- nft_data: {
1898
- ...tokenItem.nft_data,
1899
- token_id: bigIntParser(tokenItem.nft_data?.token_id),
1900
- },
1901
- }))
1902
- : null;
1903
- }
1904
- return data;
1905
- };
1906
- return await this.execution.execute(endpoint, parseData);
1907
- }
1908
- /**
1909
- *
1910
- * Commonly used to get all transactions of an NFT token. Useful for building a transaction history table or price chart.
1911
- *
1912
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
1913
- * @param {string} contractAddress - The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
1914
- * @param {string} tokenId - The requested token ID.
1915
- * @param {GetNftTransactionsForContractTokenIdQueryParamOpts} queryParamOpts
1916
- * - `noSpam`: If `true`, the suspected spam tokens are removed. Supports `eth-mainnet` and `matic-mainnet`.
1917
- *
1918
- * @deprecated This endpoint is no longer supported by the GoldRush API.
1919
- */
1920
- async getNftTransactionsForContractTokenId(chainName, contractAddress, tokenId, queryParamOpts) {
1921
- const endpoint = endpointGenerator(`${chainName}/tokens/${contractAddress}/nft_transactions/${tokenId}`, [
1922
- {
1923
- key: "no-spam",
1924
- value: queryParamOpts?.noSpam,
1925
- },
1926
- ]);
1927
- const parseData = (data) => {
1928
- if (data.data) {
1929
- data.data.updated_at = data.data.updated_at
1930
- ? new Date(data.data.updated_at)
1931
- : null;
1932
- data.data.items = data.data.items
1933
- ? data.data.items.map((nftItem) => ({
1934
- ...nftItem,
1935
- nft_transactions: nftItem.nft_transactions
1936
- ? nftItem.nft_transactions.map((txItem) => ({
1937
- ...txItem,
1938
- block_signed_at: txItem.block_signed_at
1939
- ? new Date(txItem.block_signed_at)
1940
- : null,
1941
- value: bigIntParser(txItem.value),
1942
- fees_paid: bigIntParser(txItem.fees_paid),
1943
- log_events: txItem.log_events
1944
- ? txItem.log_events.map((logItem) => ({
1945
- ...logItem,
1946
- block_signed_at: logItem.block_signed_at
1947
- ? new Date(logItem.block_signed_at)
1948
- : null,
1949
- }))
1950
- : null,
1951
- }))
1952
- : null,
1953
- }))
1954
- : null;
1955
- }
1956
- return data;
1957
- };
1958
- return await this.execution.execute(endpoint, parseData);
1959
- }
1960
- /**
1961
- *
1962
- * Commonly used to fetch and render the traits of a collection as seen in rarity calculators.
1963
- *
1964
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
1965
- * @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
1966
- *
1967
- * @deprecated This endpoint is no longer supported by the GoldRush API.
1968
- */
1969
- async getTraitsForCollection(chainName, collectionContract) {
1970
- const endpoint = endpointGenerator(`${chainName}/nft/${collectionContract}/traits`, []);
1971
- const parseData = (data) => {
1972
- if (data.data) {
1973
- data.data.updated_at = data.data.updated_at
1974
- ? new Date(data.data.updated_at)
1975
- : null;
1976
- }
1977
- return data;
1978
- };
1979
- return await this.execution.execute(endpoint, parseData);
1980
- }
1981
- /**
1982
- *
1983
- * Commonly used to get the count of unique values for traits within an NFT collection.
1984
- *
1985
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
1986
- * @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
1987
- * @param {string} trait - The requested trait.
1988
- *
1989
- * @deprecated This endpoint is no longer supported by the GoldRush API.
1990
- */
1991
- async getAttributesForTraitInCollection(chainName, collectionContract, trait) {
1992
- const endpoint = endpointGenerator(`${chainName}/nft/${collectionContract}/traits/${trait}/attributes`, []);
1993
- const parseData = (data) => {
1994
- if (data.data) {
1995
- data.data.updated_at = data.data.updated_at
1996
- ? new Date(data.data.updated_at)
1997
- : null;
1998
- }
1999
- return data;
2000
- };
2001
- return await this.execution.execute(endpoint, parseData);
2002
- }
2003
- /**
2004
- *
2005
- * Commonly used to calculate rarity scores for a collection based on its traits.
2006
- *
2007
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
2008
- * @param {string} collectionContract - The requested collection address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
2009
- *
2010
- * @deprecated This endpoint is no longer supported by the GoldRush API.
2011
- */
2012
- async getCollectionTraitsSummary(chainName, collectionContract) {
2013
- const endpoint = endpointGenerator(`${chainName}/nft/${collectionContract}/traits_summary`, []);
2014
- const parseData = (data) => {
2015
- if (data.data) {
2016
- data.data.updated_at = data.data.updated_at
2017
- ? new Date(data.data.updated_at)
2018
- : null;
2019
- }
2020
- return data;
2021
- };
2022
- return await this.execution.execute(endpoint, parseData);
2023
- }
2024
- /**
2025
- *
2026
- * Commonly used to render a price floor chart for an NFT collection.
2027
- *
2028
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
2029
- * @param {string} collectionAddress - The requested address.
2030
- * @param {GetNftsForAddressQueryParamOpts} queryParamOpts
2031
- * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
2032
- * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days.
2033
- *
2034
- * @deprecated This endpoint is no longer supported by the GoldRush API.
2035
- */
2036
- async getHistoricalFloorPricesForCollection(chainName, collectionAddress, queryParamOpts) {
2037
- const endpoint = endpointGenerator(`${chainName}/nft_market/${collectionAddress}/floor_price`, [
2038
- {
2039
- key: "days",
2040
- value: queryParamOpts?.days,
2041
- },
2042
- {
2043
- key: "quote-currency",
2044
- value: queryParamOpts?.quote_currency,
2045
- },
2046
- ]);
2047
- const parseData = (data) => {
2048
- if (data.data) {
2049
- data.data.updated_at = data.data.updated_at
2050
- ? new Date(data.data.updated_at)
2051
- : null;
2052
- data.data.items = data.data.items
2053
- ? data.data.items.map((floorPriceItem) => ({
2054
- ...floorPriceItem,
2055
- date: floorPriceItem.date ? new Date(floorPriceItem.date) : null,
2056
- }))
2057
- : null;
2058
- }
2059
- return data;
2060
- };
2061
- return await this.execution.execute(endpoint, parseData);
2062
- }
2063
- /**
2064
- *
2065
- * Commonly used to build a time-series chart of the transaction volume of an NFT collection.
2066
- *
2067
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
2068
- * @param {string} collectionAddress - The requested address.
2069
- * @param {GetNftsForAddressQueryParamOpts} queryParamOpts
2070
- * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
2071
- * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days.
2072
- *
2073
- * @deprecated This endpoint is no longer supported by the GoldRush API.
2074
- */
2075
- async getHistoricalVolumeForCollection(chainName, collectionAddress, queryParamOpts) {
2076
- const endpoint = endpointGenerator(`${chainName}/nft_market/${collectionAddress}/volume`, [
2077
- {
2078
- key: "days",
2079
- value: queryParamOpts?.days,
2080
- },
2081
- {
2082
- key: "quote-currency",
2083
- value: queryParamOpts?.quote_currency,
2084
- },
2085
- ]);
2086
- const parseData = (data) => {
2087
- if (data.data) {
2088
- data.data.updated_at = data.data.updated_at
2089
- ? new Date(data.data.updated_at)
2090
- : null;
2091
- data.data.items = data.data.items
2092
- ? data.data.items.map((floorPriceItem) => ({
2093
- ...floorPriceItem,
2094
- date: floorPriceItem.date ? new Date(floorPriceItem.date) : null,
2095
- }))
2096
- : null;
2097
- }
2098
- return data;
2099
- };
2100
- return await this.execution.execute(endpoint, parseData);
2101
- }
2102
- /**
2103
- *
2104
- * Commonly used to build a time-series chart of the sales count of an NFT collection.
2105
- *
2106
- * @param {string} chainName - The chain name eg: `eth-mainnet`.
2107
- * @param {string} collectionAddress - The requested address.
2108
- * @param {GetNftsForAddressQueryParamOpts} queryParamOpts
2109
- * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
2110
- * - `days`: The number of days to return data for. Request up 365 days. Defaults to 30 days.
2111
- *
2112
- * @deprecated This endpoint is no longer supported by the GoldRush API.
2113
- */
2114
- async getHistoricalSalesCountForCollection(chainName, collectionAddress, queryParamOpts) {
2115
- const endpoint = endpointGenerator(`${chainName}/nft_market/${collectionAddress}/sale_count`, [
2116
- {
2117
- key: "days",
2118
- value: queryParamOpts?.days,
2119
- },
2120
- {
2121
- key: "quote-currency",
2122
- value: queryParamOpts?.quote_currency,
2123
- },
2124
- ]);
2125
- const parseData = (data) => {
2126
- if (data.data) {
2127
- data.data.updated_at = data.data.updated_at
2128
- ? new Date(data.data.updated_at)
2129
- : null;
2130
- data.data.items = data.data.items
2131
- ? data.data.items.map((floorPriceItem) => ({
2132
- ...floorPriceItem,
2133
- date: floorPriceItem.date ? new Date(floorPriceItem.date) : null,
2134
- }))
2135
- : null;
2136
- }
2137
- return data;
2138
- };
2139
- return await this.execution.execute(endpoint, parseData);
2140
- }
2141
1580
  /**
2142
1581
  *
2143
1582
  * Commonly used to verify ownership of NFTs (including ERC-721 and ERC-1155) within a collection.
@@ -2227,6 +1666,7 @@ class NftService {
2227
1666
  *
2228
1667
  */
2229
1668
  class PricingService {
1669
+ execution;
2230
1670
  constructor(execution) {
2231
1671
  this.execution = execution;
2232
1672
  }
@@ -2269,7 +1709,9 @@ class PricingService {
2269
1709
  dataItem.items = dataItem.items
2270
1710
  ? dataItem.items.map((priceItem) => ({
2271
1711
  ...priceItem,
2272
- date: priceItem.date ? new Date(priceItem.date) : null,
1712
+ date: priceItem.date
1713
+ ? new Date(priceItem.date)
1714
+ : null,
2273
1715
  }))
2274
1716
  : null;
2275
1717
  });
@@ -2316,6 +1758,7 @@ class PricingService {
2316
1758
  *
2317
1759
  */
2318
1760
  class SecurityService {
1761
+ execution;
2319
1762
  constructor(execution) {
2320
1763
  this.execution = execution;
2321
1764
  }
@@ -2355,37 +1798,6 @@ class SecurityService {
2355
1798
  };
2356
1799
  return await this.execution.execute(endpoint, parseData);
2357
1800
  }
2358
- /**
2359
- *
2360
- * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
2361
- * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
2362
-
2363
- *
2364
- */
2365
- async getNftApprovals(chainName, walletAddress) {
2366
- const endpoint = endpointGenerator(`${chainName}/nft/approvals/${walletAddress}`, []);
2367
- const parseData = (data) => {
2368
- if (data.data) {
2369
- data.data.updated_at = data.data.updated_at
2370
- ? new Date(data.data.updated_at)
2371
- : null;
2372
- data.data.items = data.data.items
2373
- ? data.data.items.map((approvalItem) => ({
2374
- ...approvalItem,
2375
- token_balances: approvalItem.token_balances
2376
- ? approvalItem.token_balances.map((balanceItem) => ({
2377
- ...balanceItem,
2378
- token_balance: bigIntParser(balanceItem.token_balance),
2379
- token_id: bigIntParser(balanceItem.token_id),
2380
- }))
2381
- : null,
2382
- }))
2383
- : null;
2384
- }
2385
- return data;
2386
- };
2387
- return await this.execution.execute(endpoint, parseData);
2388
- }
2389
1801
  }
2390
1802
 
2391
1803
  function extendedTypeof(val) {
@@ -2710,7 +2122,7 @@ function createClient(options) {
2710
2122
  if (retrying) {
2711
2123
  await retryWait(retries);
2712
2124
  if (!locks) {
2713
- connecting = undefined;
2125
+ connecting = void 0;
2714
2126
  return denied({ code: 1e3, reason: "All Subscriptions Gone" });
2715
2127
  }
2716
2128
  retries++;
@@ -2727,13 +2139,13 @@ function createClient(options) {
2727
2139
  queuedPing = setTimeout(() => {
2728
2140
  if (socket2.readyState === WebSocketImpl.OPEN) {
2729
2141
  socket2.send(stringifyMessage({ type: MessageType.Ping }));
2730
- emitter.emit("ping", false, undefined);
2142
+ emitter.emit("ping", false, void 0);
2731
2143
  }
2732
2144
  }, keepAlive);
2733
2145
  }
2734
2146
  }
2735
2147
  errorOrClosed((errOrEvent) => {
2736
- connecting = undefined;
2148
+ connecting = void 0;
2737
2149
  clearTimeout(connectionAckTimeout);
2738
2150
  clearTimeout(queuedPing);
2739
2151
  denied(errOrEvent);
@@ -3020,11 +2432,11 @@ function createClient(options) {
3020
2432
  deferred.error = err;
3021
2433
  deferred.resolve();
3022
2434
  }
3023
- return { done: true, value: undefined };
2435
+ return { done: true, value: void 0 };
3024
2436
  };
3025
2437
  iterator.return = async () => {
3026
2438
  dispose();
3027
- return { done: true, value: undefined };
2439
+ return { done: true, value: void 0 };
3028
2440
  };
3029
2441
  return iterator;
3030
2442
  },
@@ -3081,23 +2493,23 @@ function isWebSocket(val) {
3081
2493
  *
3082
2494
  */
3083
2495
  class StreamingService {
2496
+ defaultConfig = {
2497
+ shouldRetry: (retries) => retries < 5,
2498
+ maxReconnectAttempts: 5,
2499
+ onConnecting: () => {
2500
+ console.info("StreamingService Connection Connecting...");
2501
+ },
2502
+ onOpened: () => {
2503
+ console.info("StreamingService Connection Established Successfully!");
2504
+ },
2505
+ onClosed: () => {
2506
+ console.info("StreamingService Connection Closed");
2507
+ },
2508
+ onError: (err) => {
2509
+ console.error("StreamingService Connection Error:", err);
2510
+ },
2511
+ };
3084
2512
  constructor(apiKey, config) {
3085
- this.defaultConfig = {
3086
- shouldRetry: (retries) => retries < 5,
3087
- maxReconnectAttempts: 5,
3088
- onConnecting: () => {
3089
- console.info("StreamingService Connection Connecting...");
3090
- },
3091
- onOpened: () => {
3092
- console.info("StreamingService Connection Established Successfully!");
3093
- },
3094
- onClosed: () => {
3095
- console.info("StreamingService Connection Closed");
3096
- },
3097
- onError: (err) => {
3098
- console.error("StreamingService Connection Error:", err);
3099
- },
3100
- };
3101
2513
  StreamingWebSocketClient.configure(apiKey, {
3102
2514
  ...this.defaultConfig,
3103
2515
  ...config,
@@ -3569,8 +2981,18 @@ class StreamingService {
3569
2981
  }
3570
2982
  }
3571
2983
  ... on SwapTransaction {
3572
- token_in
3573
- token_out
2984
+ token_in {
2985
+ contract_name
2986
+ contract_address
2987
+ contract_decimals
2988
+ contract_ticker_symbol
2989
+ }
2990
+ token_out {
2991
+ contract_name
2992
+ contract_address
2993
+ contract_decimals
2994
+ contract_ticker_symbol
2995
+ }
3574
2996
  amount_in
3575
2997
  amount_out
3576
2998
  }
@@ -3840,6 +3262,12 @@ class StreamingService {
3840
3262
  *
3841
3263
  */
3842
3264
  class StreamingWebSocketClient {
3265
+ static apiKey;
3266
+ static instance = null;
3267
+ static client = null;
3268
+ static connected = false;
3269
+ static reconnectAttempts = 0;
3270
+ static config;
3843
3271
  constructor() { }
3844
3272
  static getInstance() {
3845
3273
  if (!StreamingWebSocketClient.instance) {
@@ -3904,16 +3332,13 @@ class StreamingWebSocketClient {
3904
3332
  await new Promise((resolve) => setTimeout(resolve, 1000));
3905
3333
  }
3906
3334
  }
3907
- StreamingWebSocketClient.instance = null;
3908
- StreamingWebSocketClient.client = null;
3909
- StreamingWebSocketClient.connected = false;
3910
- StreamingWebSocketClient.reconnectAttempts = 0;
3911
3335
 
3912
3336
  /**
3913
3337
  * Transactions API
3914
3338
  *
3915
3339
  */
3916
3340
  class TransactionService {
3341
+ execution;
3917
3342
  constructor(execution) {
3918
3343
  this.execution = execution;
3919
3344
  }
@@ -3995,6 +3420,7 @@ class TransactionService {
3995
3420
  * @param {GetTransactionSummaryQueryParamOpts} queryParamOpts
3996
3421
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
3997
3422
  * - `withGas`: Include gas summary details. Additional charge of 1 credit when true. Response times may be impacted for wallets with millions of transactions.
3423
+ * - `withTransferCount`: Represents the total count of ERC-20 token movement events, including `Transfer`, `Deposit` and `Withdraw`. Response times may be impacted for wallets with large number of transactions. Additional charge of 3 credits.
3998
3424
  *
3999
3425
  */
4000
3426
  async getTransactionSummary(chainName, walletAddress, queryParamOpts) {
@@ -4007,6 +3433,10 @@ class TransactionService {
4007
3433
  key: "with-gas",
4008
3434
  value: queryParamOpts?.withGas,
4009
3435
  },
3436
+ {
3437
+ key: "with-transfer-count",
3438
+ value: queryParamOpts?.withTransferCount,
3439
+ },
4010
3440
  ]);
4011
3441
  const parseData = (data) => {
4012
3442
  if (data.data) {
@@ -4018,14 +3448,18 @@ class TransactionService {
4018
3448
  ...txsItem,
4019
3449
  earliest_transaction: {
4020
3450
  ...txsItem.earliest_transaction,
4021
- block_signed_at: txsItem?.earliest_transaction?.block_signed_at
4022
- ? new Date(txsItem.earliest_transaction.block_signed_at)
3451
+ block_signed_at: txsItem?.earliest_transaction
3452
+ ?.block_signed_at
3453
+ ? new Date(txsItem.earliest_transaction
3454
+ .block_signed_at)
4023
3455
  : null,
4024
3456
  },
4025
3457
  latest_transaction: {
4026
3458
  ...txsItem.latest_transaction,
4027
- block_signed_at: txsItem?.latest_transaction?.block_signed_at
4028
- ? new Date(txsItem?.latest_transaction?.block_signed_at)
3459
+ block_signed_at: txsItem?.latest_transaction
3460
+ ?.block_signed_at
3461
+ ? new Date(txsItem?.latest_transaction
3462
+ ?.block_signed_at)
4029
3463
  : null,
4030
3464
  },
4031
3465
  // ? API vs docs non-consistent
@@ -4482,12 +3916,6 @@ class TransactionService {
4482
3916
  };
4483
3917
  return await this.execution.execute(endpoint, parseData);
4484
3918
  }
4485
- /**
4486
- * @deprecated This method has been deprecated and will be removed in future releases. Use `getPaginatedTransactionsForAddress` instead.
4487
- */
4488
- async getTransactionsForAddressV3(chainName, walletAddress, page, queryParamOpts) {
4489
- return this.getPaginatedTransactionsForAddress(chainName, walletAddress, page, queryParamOpts);
4490
- }
4491
3919
  }
4492
3920
 
4493
3921
  async function debugOutput(settings, ...content) {
@@ -4645,6 +4073,12 @@ var pLimit_1 = pLimit;
4645
4073
  var pLimit$1 = /*@__PURE__*/getDefaultExportFromCjs(pLimit_1);
4646
4074
 
4647
4075
  class Execution {
4076
+ settings;
4077
+ headers;
4078
+ maxRetries;
4079
+ retryDelay;
4080
+ enableRetry;
4081
+ processes;
4648
4082
  constructor(settings, headers) {
4649
4083
  this.settings = settings;
4650
4084
  this.headers = headers;
@@ -4731,8 +4165,17 @@ const isValidApiKey = (apiKey) => {
4731
4165
  * GoldRushClient Class
4732
4166
  */
4733
4167
  class GoldRushClient {
4168
+ userAgent = `com.covalenthq.sdk.typescript/${version}`;
4169
+ AllChainsService;
4170
+ BalanceService;
4171
+ BaseService;
4172
+ BitcoinService;
4173
+ NftService;
4174
+ PricingService;
4175
+ SecurityService;
4176
+ StreamingService;
4177
+ TransactionService;
4734
4178
  constructor(apiKey, settings = {}, streamingConfig = {}) {
4735
- this.userAgent = `com.covalenthq.sdk.typescript/${version}`;
4736
4179
  const validKey = isValidApiKey(apiKey);
4737
4180
  if (!validKey) {
4738
4181
  throw {