@covalenthq/client-sdk 0.7.5 → 0.8.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.
Files changed (76) hide show
  1. package/README.md +25 -0
  2. package/dist/cjs/index.js +1183 -451
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/services/BalanceService.d.ts +15 -13
  5. package/dist/cjs/services/BaseService.d.ts +13 -11
  6. package/dist/cjs/services/CovalentClient.d.ts +8 -4
  7. package/dist/cjs/services/NftService.d.ts +19 -17
  8. package/dist/cjs/services/PricingService.d.ts +5 -3
  9. package/dist/cjs/services/SecurityService.d.ts +6 -4
  10. package/dist/cjs/services/TransactionService.d.ts +83 -12
  11. package/dist/cjs/services/XykService.d.ts +287 -22
  12. package/dist/cjs/util/ApiHelpers.d.ts +2 -1
  13. package/dist/cjs/util/backoff.d.ts +2 -1
  14. package/dist/cjs/util/types/TransactionServiceTypes.d.ts +11 -0
  15. package/dist/cjs/util/types/XykServiceTypes.d.ts +160 -8
  16. package/dist/es/index.js +1183 -451
  17. package/dist/es/index.js.map +1 -1
  18. package/dist/es/services/BalanceService.d.ts +15 -13
  19. package/dist/es/services/BaseService.d.ts +13 -11
  20. package/dist/es/services/CovalentClient.d.ts +8 -4
  21. package/dist/es/services/NftService.d.ts +19 -17
  22. package/dist/es/services/PricingService.d.ts +5 -3
  23. package/dist/es/services/SecurityService.d.ts +6 -4
  24. package/dist/es/services/TransactionService.d.ts +83 -12
  25. package/dist/es/services/XykService.d.ts +287 -22
  26. package/dist/es/util/ApiHelpers.d.ts +2 -1
  27. package/dist/es/util/backoff.d.ts +2 -1
  28. package/dist/es/util/types/TransactionServiceTypes.d.ts +11 -0
  29. package/dist/es/util/types/XykServiceTypes.d.ts +160 -8
  30. package/dist/esm/index.js +1183 -451
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/services/BalanceService.d.ts +15 -13
  33. package/dist/esm/services/BaseService.d.ts +13 -11
  34. package/dist/esm/services/CovalentClient.d.ts +8 -4
  35. package/dist/esm/services/NftService.d.ts +19 -17
  36. package/dist/esm/services/PricingService.d.ts +5 -3
  37. package/dist/esm/services/SecurityService.d.ts +6 -4
  38. package/dist/esm/services/TransactionService.d.ts +83 -12
  39. package/dist/esm/services/XykService.d.ts +287 -22
  40. package/dist/esm/util/ApiHelpers.d.ts +2 -1
  41. package/dist/esm/util/backoff.d.ts +2 -1
  42. package/dist/esm/util/types/TransactionServiceTypes.d.ts +11 -0
  43. package/dist/esm/util/types/XykServiceTypes.d.ts +160 -8
  44. package/dist/services/BalanceService.d.ts +15 -13
  45. package/dist/services/BalanceService.js +47 -39
  46. package/dist/services/BalanceService.js.map +1 -1
  47. package/dist/services/BaseService.d.ts +13 -11
  48. package/dist/services/BaseService.js +77 -65
  49. package/dist/services/BaseService.js.map +1 -1
  50. package/dist/services/CovalentClient.d.ts +8 -4
  51. package/dist/services/CovalentClient.js +19 -19
  52. package/dist/services/CovalentClient.js.map +1 -1
  53. package/dist/services/NftService.d.ts +19 -17
  54. package/dist/services/NftService.js +96 -81
  55. package/dist/services/NftService.js.map +1 -1
  56. package/dist/services/PricingService.d.ts +5 -3
  57. package/dist/services/PricingService.js +10 -7
  58. package/dist/services/PricingService.js.map +1 -1
  59. package/dist/services/SecurityService.d.ts +6 -4
  60. package/dist/services/SecurityService.js +17 -13
  61. package/dist/services/SecurityService.js.map +1 -1
  62. package/dist/services/TransactionService.d.ts +83 -12
  63. package/dist/services/TransactionService.js +434 -90
  64. package/dist/services/TransactionService.js.map +1 -1
  65. package/dist/services/XykService.d.ts +287 -22
  66. package/dist/services/XykService.js +438 -93
  67. package/dist/services/XykService.js.map +1 -1
  68. package/dist/util/ApiHelpers.d.ts +2 -1
  69. package/dist/util/ApiHelpers.js +7 -6
  70. package/dist/util/ApiHelpers.js.map +1 -1
  71. package/dist/util/backoff.d.ts +2 -1
  72. package/dist/util/backoff.js +3 -3
  73. package/dist/util/backoff.js.map +1 -1
  74. package/dist/util/types/TransactionServiceTypes.d.ts +11 -0
  75. package/dist/util/types/XykServiceTypes.d.ts +160 -8
  76. package/package.json +1 -1
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
+ <p align="center">
2
+ <a href="https://www.npmjs.com/package/@covalenthq/client-sdk">
3
+ <img src="https://img.shields.io/npm/v/@covalenthq/client-sdk" alt="NPM">
4
+ </a>
5
+ <a href="https://www.npmjs.com/package/@covalenthq/client-sdk">
6
+ <img src="https://img.shields.io/npm/dm/@covalenthq/client-sdk" alt="npm downloads">
7
+ </a>
8
+ </p>
9
+
10
+
1
11
  # Covalent SDK for TypeScript
2
12
 
3
13
  The Covalent SDK is the fastest way to integrate the Covalent Unified API for working with blockchain data. The SDK works with all [supported chains](https://www.covalenthq.com/docs/networks/) including Mainnets and Testnets.
@@ -182,6 +192,9 @@ The `TransactionService` class refers to the [transactions API endpoints](https:
182
192
  - `getTransactionsForBlock()`: Fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
183
193
  - `getTransactionSummary()`: Fetch the earliest and latest transactions, and the transaction count for a wallet. Calculate the age of the wallet and the time it has been idle and quickly gain insights into their engagement with web3.
184
194
  - `getTimeBucketTransactionsForAddress()`: Fetch all transactions including their decoded log events in a 15-minute time bucket interval.
195
+ - `getTransactionsForBlockHashByPage()`: Fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
196
+ - `getTransactionsForBlockHash()`: Fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
197
+
185
198
 
186
199
  The functions `getAllTransactionsForAddressByPage()`, `getTransactionsForAddressV3()`, and `getTimeBucketTransactionsForAddress()` have been enhanced with the introduction of `next()` and `prev()` support functions. These functions facilitate a smoother transition for developers navigating through our links object, which includes `prev` and `next` fields. Instead of requiring developers to manually extract values from these fields and create JavaScript API fetch calls for the URL values, the new `next()` and `prev()` functions provide a streamlined approach, allowing developers to simulate this behavior more efficiently.
187
200
 
@@ -207,12 +220,14 @@ The `XykService` refers to the [Xy=k API endpoints](https://www.covalenthq.com/d
207
220
  - `getPoolsForWalletAddress()`: Get all pools and supported DEX for a wallet. Useful for building a personal DEX UI showcasing pairs and supported DEXes associated to the wallet.
208
221
  - `getAddressExchangeBalances()`: Return balance of a wallet/contract address on a specific DEX.
209
222
  - `getNetworkExchangeTokens()`: Retrieve all network exchange tokens for a specific DEX. Useful for building a top tokens table by total liquidity within a particular DEX.
223
+ - `getLpTokenView()`: Get a detailed view for a single liquidity pool token. Includes time series data.
210
224
  - `getSupportedDEXes()`: Get all the supported DEXs available for the xy=k endpoints, along with the swap fees and factory addresses.
211
225
  - `getDexForPoolAddress()`: Get the supported DEX given a pool address, along with the swap fees, DEX's logo url, and factory addresses. Useful to identifying the specific DEX to which a pair address is associated.
212
226
  - `getSingleNetworkExchangeToken()`: Get historical daily swap count for a single network exchange token.
213
227
  - `getTransactionsForAccountAddress()`: Get all the DEX transactions of a wallet. Useful for building tables of DEX activity segmented by wallet.
214
228
  - `getTransactionsForTokenAddress()`: Get all the transactions of a token within a particular DEX. Useful for getting a per-token view of DEX activity.
215
229
  - `getTransactionsForExchange()`: Get all the transactions of a particular DEX liquidity pool. Useful for building a transactions history table for an individual pool.
230
+ - `getTransactionsForDex()`: Get all the the transactions for a given DEX. Useful for building DEX activity views.
216
231
  - `getEcosystemChartData()`: Get a 7d and 30d time-series chart of DEX activity. Includes volume and swap count.
217
232
  - `getHealthData()`: Ping the health of xy=k endpoints to get the synced block height per chain.
218
233
 
@@ -297,6 +312,16 @@ const ApiServices = async () => {
297
312
 
298
313
  Each endpoint is equipped with an exponential backoff algorithm that exponentially extends the wait time between retries, up to a `maximum of 5` retry attempts.
299
314
 
315
+ Users have the ability to control the retry feature through the enableRetry configuration setting. By default, this feature is enabled `true`. However, users can deactivate it by setting `enableRetry` to `false`.
316
+
317
+ ```ts
318
+ import { CovalentClient, CovalentClientSettings } from "@covalenthq/client-sdk";
319
+
320
+ const settings: CovalentClientSettings = {
321
+ enableRetry: false
322
+ }
323
+ ```
324
+
300
325
  ### Error Handling
301
326
  The paginated endpoints throw an error message in this format: `An error occurred {error_code}: {error_message}`. The developer will need to `catch` these errors. Note - these endpoints do not follow the default response format which is:
302
327
  ```ts