@covalenthq/client-sdk 0.2.9 → 0.5.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 (116) hide show
  1. package/README.md +117 -46
  2. package/dist/cjs/index.d.ts +9 -0
  3. package/dist/cjs/index.js +5226 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/services/BalanceService.d.ts +543 -0
  6. package/dist/cjs/services/BaseService.d.ts +357 -0
  7. package/dist/cjs/services/CovalentClient.d.ts +65 -0
  8. package/dist/cjs/services/NftService.d.ts +620 -0
  9. package/dist/cjs/services/PricingService.d.ts +88 -0
  10. package/dist/cjs/services/SecurityService.d.ts +158 -0
  11. package/dist/cjs/services/TransactionService.d.ts +457 -0
  12. package/dist/cjs/services/XykService.d.ts +686 -0
  13. package/dist/cjs/util/ApiHelpers.d.ts +5 -0
  14. package/dist/cjs/util/backoff.d.ts +11 -0
  15. package/dist/cjs/util/types/BalanceServiceTypes.d.ts +322 -0
  16. package/dist/cjs/util/types/BaseServiceTypes.d.ts +180 -0
  17. package/dist/cjs/util/types/GenericTypes.d.ts +96 -0
  18. package/dist/cjs/util/types/NftServiceTypes.d.ts +297 -0
  19. package/dist/cjs/util/types/PricingServiceTypes.d.ts +31 -0
  20. package/dist/cjs/util/types/SecurityServiceTypes.d.ts +121 -0
  21. package/dist/cjs/util/types/TransactionServiceTypes.d.ts +322 -0
  22. package/dist/cjs/util/types/XykServiceTypes.d.ts +479 -0
  23. package/dist/es/index.d.ts +9 -0
  24. package/dist/es/index.js +5223 -0
  25. package/dist/es/index.js.map +1 -0
  26. package/dist/es/services/BalanceService.d.ts +543 -0
  27. package/dist/es/services/BaseService.d.ts +357 -0
  28. package/dist/es/services/CovalentClient.d.ts +65 -0
  29. package/dist/es/services/NftService.d.ts +620 -0
  30. package/dist/es/services/PricingService.d.ts +88 -0
  31. package/dist/es/services/SecurityService.d.ts +158 -0
  32. package/dist/es/services/TransactionService.d.ts +457 -0
  33. package/dist/es/services/XykService.d.ts +686 -0
  34. package/dist/es/util/ApiHelpers.d.ts +5 -0
  35. package/dist/es/util/backoff.d.ts +11 -0
  36. package/dist/es/util/types/BalanceServiceTypes.d.ts +322 -0
  37. package/dist/es/util/types/BaseServiceTypes.d.ts +180 -0
  38. package/dist/es/util/types/GenericTypes.d.ts +96 -0
  39. package/dist/es/util/types/NftServiceTypes.d.ts +297 -0
  40. package/dist/es/util/types/PricingServiceTypes.d.ts +31 -0
  41. package/dist/es/util/types/SecurityServiceTypes.d.ts +121 -0
  42. package/dist/es/util/types/TransactionServiceTypes.d.ts +322 -0
  43. package/dist/es/util/types/XykServiceTypes.d.ts +479 -0
  44. package/dist/esm/index.d.ts +9 -0
  45. package/dist/esm/index.js +5223 -0
  46. package/dist/esm/index.js.map +1 -0
  47. package/dist/esm/services/BalanceService.d.ts +543 -0
  48. package/dist/esm/services/BaseService.d.ts +357 -0
  49. package/dist/esm/services/CovalentClient.d.ts +65 -0
  50. package/dist/esm/services/NftService.d.ts +620 -0
  51. package/dist/esm/services/PricingService.d.ts +88 -0
  52. package/dist/esm/services/SecurityService.d.ts +158 -0
  53. package/dist/esm/services/TransactionService.d.ts +457 -0
  54. package/dist/esm/services/XykService.d.ts +686 -0
  55. package/dist/esm/util/ApiHelpers.d.ts +5 -0
  56. package/dist/esm/util/backoff.d.ts +11 -0
  57. package/dist/esm/util/types/BalanceServiceTypes.d.ts +322 -0
  58. package/dist/esm/util/types/BaseServiceTypes.d.ts +180 -0
  59. package/dist/esm/util/types/GenericTypes.d.ts +96 -0
  60. package/dist/esm/util/types/NftServiceTypes.d.ts +297 -0
  61. package/dist/esm/util/types/PricingServiceTypes.d.ts +31 -0
  62. package/dist/esm/util/types/SecurityServiceTypes.d.ts +121 -0
  63. package/dist/esm/util/types/TransactionServiceTypes.d.ts +322 -0
  64. package/dist/esm/util/types/XykServiceTypes.d.ts +479 -0
  65. package/dist/index.d.ts +1 -1
  66. package/dist/index.js +9 -27
  67. package/dist/index.js.map +1 -1
  68. package/dist/services/BalanceService.d.ts +149 -11
  69. package/dist/services/BalanceService.js +300 -84
  70. package/dist/services/BalanceService.js.map +1 -1
  71. package/dist/services/BaseService.d.ts +46 -10
  72. package/dist/services/BaseService.js +199 -151
  73. package/dist/services/BaseService.js.map +1 -1
  74. package/dist/services/CovalentClient.d.ts +65 -0
  75. package/dist/services/CovalentClient.js +44 -0
  76. package/dist/services/CovalentClient.js.map +1 -0
  77. package/dist/services/NftService.d.ts +182 -16
  78. package/dist/services/NftService.js +490 -211
  79. package/dist/services/NftService.js.map +1 -1
  80. package/dist/services/PricingService.d.ts +8 -3
  81. package/dist/services/PricingService.js +44 -38
  82. package/dist/services/PricingService.js.map +1 -1
  83. package/dist/services/SecurityService.d.ts +71 -3
  84. package/dist/services/SecurityService.js +140 -32
  85. package/dist/services/SecurityService.js.map +1 -1
  86. package/dist/services/TransactionService.d.ts +58 -9
  87. package/dist/services/TransactionService.js +152 -103
  88. package/dist/services/TransactionService.js.map +1 -1
  89. package/dist/services/XykService.d.ts +85 -19
  90. package/dist/services/XykService.js +470 -291
  91. package/dist/services/XykService.js.map +1 -1
  92. package/dist/util/ApiHelpers.d.ts +2 -1
  93. package/dist/util/ApiHelpers.js +57 -36
  94. package/dist/util/ApiHelpers.js.map +1 -1
  95. package/dist/util/backoff.d.ts +5 -3
  96. package/dist/util/backoff.js +35 -13
  97. package/dist/util/backoff.js.map +1 -1
  98. package/dist/util/types/BalanceServiceTypes.d.ts +63 -0
  99. package/dist/util/types/BalanceServiceTypes.js +1 -2
  100. package/dist/util/types/BaseServiceTypes.d.ts +8 -0
  101. package/dist/util/types/BaseServiceTypes.js +1 -2
  102. package/dist/util/types/GenericTypes.d.ts +7 -0
  103. package/dist/util/types/GenericTypes.js +1 -2
  104. package/dist/util/types/NftServiceTypes.d.ts +86 -2
  105. package/dist/util/types/NftServiceTypes.js +1 -2
  106. package/dist/util/types/PricingServiceTypes.js +1 -2
  107. package/dist/util/types/SecurityServiceTypes.d.ts +51 -0
  108. package/dist/util/types/SecurityServiceTypes.js +1 -2
  109. package/dist/util/types/TransactionServiceTypes.d.ts +24 -2
  110. package/dist/util/types/TransactionServiceTypes.js +1 -2
  111. package/dist/util/types/XykServiceTypes.d.ts +20 -6
  112. package/dist/util/types/XykServiceTypes.js +1 -2
  113. package/package.json +19 -4
  114. package/dist/services/Client.d.ts +0 -29
  115. package/dist/services/Client.js +0 -30
  116. package/dist/services/Client.js.map +0 -1
package/README.md CHANGED
@@ -1,12 +1,13 @@
1
- # covalent-api-sdk-ts
1
+ # Covalent SDK for TypeScript
2
2
 
3
- The Covalent API SDK supported for TypeScript.
3
+ 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.
4
+
5
+ Note - use `Node v18` and above for best results.
4
6
 
5
- The Covalent SDK supports all chains across Mainnets and Testnets. List of supported Networks can be found on our [Supported Networks page](https://www.covalenthq.com/docs/networks/)
6
7
 
7
8
  > **Name Resolution**
8
9
  >
9
- > The Covalent SDK supports address resolution natively allowing an ENS, RNS, Lens Handle or Unstoppable Domains address to be passed in directly for all our endpoints.
10
+ > The Covalent SDK natively supports ENS domains (e.g. `demo.eth`), Lens Handles (e.g. `@demo.lens`) and Unstoppable Domains (e.g. `demo.x`) which automatically resolve to the underlying user address (e.g. `0xfC43f5F9dd45258b3AFf31Bdbe6561D97e8B71de`)
10
11
 
11
12
  ## Getting started
12
13
 
@@ -18,14 +19,14 @@ or
18
19
  yarn add @covalenthq/client-sdk
19
20
  ```
20
21
 
21
- After installing the app, you can then import and use the SDK:
22
+ After installing, you can import and use the SDK with:
22
23
 
23
24
  ```ts
24
- import { Client } from "@covalenthq/client-sdk";
25
+ import { CovalentClient } from "@covalenthq/client-sdk";
25
26
 
26
27
  const ApiServices = async () => {
27
- const client = new Client("YOUR_API_KEY"); // Replace with your Covalent API key.
28
- const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS"); // Example call, refer to API Docs for required paramaters or click into the method `getTokenBalancesForWalletAddress` to see the accepted parameter arguments
28
+ const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
29
+ const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS"); // Example call
29
30
  if (!resp.error) {
30
31
  console.log(resp.data);
31
32
  } else {
@@ -33,55 +34,71 @@ const ApiServices = async () => {
33
34
  }
34
35
  }
35
36
  ```
36
- Query Parameters for any API endpoint is handled using `typed objects`. To pass in query parameters, developers can define an object that follows the type listed in the `tsdocs` and follow the `tsdocs` for autocomplete suggestions for the supported parameters. Supported parameters can be passed in as any order. For example: a developer wants to set the `quoteCurrency` parameter to `CAD` and `nft` to `true`.
37
+
38
+ > **Getting an API Key**
39
+ >
40
+ > To get your own Covalent API key, **[sign up here](https://www.covalenthq.com/platform/auth/register/)** and create your key from the *API Keys* tab.
41
+
42
+ Note about a **ℹ️ BREAKING CHANGE**:
43
+
44
+ > If you have been using:
45
+ >
46
+ > `import { Client } from "@covalenthq/client-sdk";`
47
+ >
48
+ > Please change to:
49
+ >
50
+ > `import { CovalentClient } from "@covalenthq/client-sdk";`
51
+
52
+ ### Typed Objects
53
+ Query parameters are handled using `typed objects`. To pass in query parameters, developers can define an object that follows the type listed in the provided `tsdocs` under `src/util/types/`. Additionally, developers can reference the `tsdocs` for autocomplete suggestions for the supported parameters. These supported parameters can be passed in any order.
54
+
55
+ For example, the following sets the `quoteCurrency` query parameter to `CAD` and the parameter `nft` to `true` for fetching all the token balances, including NFTs, for a wallet address:
37
56
  ```ts
38
57
  const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS", {quoteCurrency: "CAD", nft: true});
39
58
  ```
40
59
 
41
- All of our types are also available for import! For example:
60
+ You can import all the listed types. For example:
42
61
  ```ts
43
- import { Client, BalancesResponse, BalanceItem } from "@covalenthq/client-sdk";
62
+ import { CovalentClient, BalancesResponse, BalanceItem } from "@covalenthq/client-sdk";
44
63
  const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS", {quoteCurrency: "CAD", nft: true});
45
64
  const data: BalancesResponse = resp.data; // `resp.data` in this case is of type `BalancesResponse`
46
65
  const items: BalanceItem[] = resp.data.items; // `resp.data.items` is of type `BalanceItem[]`
47
66
  ```
48
67
 
49
- > **Creating a unique Covalent API Key**
50
- >
51
- > To create your own API key, **[sign up for an Covalent account here](https://www.covalenthq.com/platform/auth/register/)** and use the key created under the [API Keys](https://www.covalenthq.com/platform/apikey/) tab.
52
-
53
-
54
68
  ## How to use the Covalent SDK
55
69
 
56
- The Covalent SDK provides comprehensive support for all Class A, Class B, and Pricing endpoints grouped under various Services, offering a wide range of functionalities and capabilities:
70
+ The Covalent SDK provides comprehensive support for all Class A, Class B, and Pricing endpoints that are grouped under the following *Service* namespaces:
57
71
 
58
- - `SecurityService`: Access to the Covalent's getApprovals endpoint
59
- - `BalanceService`: Access to the Covalent's balances endpoints
60
- - `BaseServices`: Access to the Covalent's log events, chain, and block endpoints
61
- - `NftService`: Access to the Covalent's NFT endpoints
62
- - `PricingService`: Access to the Covalent's get historical token prices endpoint
63
- - `TransactionService`: Access to the Covalent's transactions endpoints
64
- - `XykService`: Access to the Covalent's Xy=k endpoints
72
+ - [`SecurityService`](#securityservice): Access to the token approvals endpoints
73
+ - [`BalanceService`](#balanceservice): Access to the balances endpoints
74
+ - [`BaseService`](#baseservice): Access to the address activity, log events, chain status, and block retrieval endpoints
75
+ - [`NftService`](#nftservice): Access to the NFT endpoints
76
+ - [`PricingService`](#pricingservice): Access to the historical token prices endpoint
77
+ - [`TransactionService`](#transactionservice): Access to the transactions endpoints
78
+ - [`XykService`](#xykservice): Access to the XY=K suite of endpoints
65
79
 
66
80
  ### SecurityService
67
81
 
68
- The `SecurityService` class contains the getApprovals() endpoint, refer to the [getApprovals endpoint on our API docs](https://www.covalenthq.com/docs/api/security/get-token-approvals-for-address/).
82
+ The `SecurityService` class refers to the [token approvals API endpoints](https://www.covalenthq.com/docs/api/security/get-token-approvals-for-address/):
69
83
 
70
- - `getApprovals()`: Get a list of approvals across all token contracts categorized by spenders for a wallet’s assets.
84
+ - `getApprovals()`: Get a list of approvals across all ERC20 token contracts categorized by spenders for a wallet’s assets.
85
+ - `getNftApprovals()`: Get a list of approvals across all NFT contracts categorized by spenders for a wallet’s assets.
71
86
 
72
87
  ### BalanceService
73
88
 
74
- The `BalanceService` class contains the balances endpoints. Listed below are the supported endpoints, also refer to our api docs under the Balances section in our class A endpoints.
89
+ The `BalanceService` class refers to the [balances API endpoints](https://www.covalenthq.com/docs/api/balances/get-token-balances-for-address/):
75
90
 
76
91
  - `getTokenBalancesForWalletAddress()`: Fetch the native, fungible (ERC20), and non-fungible (ERC721 & ERC1155) tokens held by an address. Response includes spot prices and other metadata.
77
92
  - `getHistoricalTokenBalancesForWalletAddress()`: Fetch the historical native, fungible (ERC20), and non-fungible (ERC721 & ERC1155) tokens held by an address at a given block height or date. Response includes daily prices and other metadata.
78
93
  - `getHistoricalPortfolioForWalletAddress()`: Render a daily portfolio balance for an address broken down by the token. The timeframe is user-configurable, defaults to 30 days.
79
- - `getErc20TransfersForWalletAddress()`: Render the transfer-in and transfer-out of a token along with historical prices from an address.
94
+ - `getErc20TransfersForWalletAddress()`: Render the transfer-in and transfer-out of a token along with historical prices from an address. (Paginated)
95
+ - `getErc20TransfersForWalletAddressByPage()`: Render the transfer-in and transfer-out of a token along with historical prices from an address. (By page)
80
96
  - `getTokenHoldersV2ForTokenAddress()`: Get a list of all the token holders for a specified ERC20 or ERC721 token. Returns historic token holders when block-height is set (defaults to latest). Useful for building pie charts of token holders.
97
+ - `getNativeTokenBalance()`: Get the native token balance for an address. This endpoint is required because native tokens are usually not ERC20 tokens and sometimes you want something lightweight.
81
98
 
82
- ### BaseServices
99
+ ### BaseService
83
100
 
84
- The `BaseServices` class contains the log events, chain, and block endpoints. Listed below are the supported endpoints, also refer to our api docs under the Base section in our class A endpoints.
101
+ The `BaseService` class refers to the [address activity, log events, chain status and block retrieval API endpoints](https://www.covalenthq.com/docs/api/base/get-address-activity/):
85
102
 
86
103
  - `getBlock()`: Fetch and render a single block for a block explorer.
87
104
  - `getLogs()`: Get all the event logs of the latest block, or for a range of blocks. Includes sender contract metadata as well as decoded logs.
@@ -95,7 +112,7 @@ The `BaseServices` class contains the log events, chain, and block endpoints. Li
95
112
 
96
113
  ### NftService
97
114
 
98
- The `NftService` class contains the NFT endpoints. Listed below are the supported endpoints, also refer to our api docs under the NFT section in our class A endpoints.
115
+ The `NftService` class refers to the [NFT API endpoints](https://www.covalenthq.com/docs/api/nft/get-nfts-for-address/):
99
116
 
100
117
  - `getChainCollections()`: Used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files.
101
118
  - `getNftsForAddress()`: Used to render the NFTs (including ERC721 and ERC1155) held by an address.
@@ -107,17 +124,19 @@ The `NftService` class contains the NFT endpoints. Listed below are the supporte
107
124
  - `getCollectionTraitsSummary()`: Used to calculate rarity scores for a collection based on its traits.
108
125
  - `checkOwnershipInNft()`: Used to verify ownership of NFTs (including ERC-721 and ERC-1155) within a collection.
109
126
  - `checkOwnershipInNftForSpecificTokenId()`: Used to verify ownership of a specific token (ERC-721 or ERC-1155) within a collection.
110
- - `getNftExternalMetadataForContract()`: Get a single NFT with metadata by token ID from a collection. Useful for building NFT card displays.
127
+ - `getNftMarketSaleCount()`: Used to build a time-series chart of the sales count of an NFT collection.
128
+ - `getNftMarketVolume()`: Used to build a time-series chart of the transaction volume of an NFT collection.
129
+ - `getNftMarketFloorPrice()`: Used to render a price floor chart for an NFT collection.
111
130
 
112
131
  ### PricingService
113
132
 
114
- The `PricingService` class contains the getTokenPrices() endpoint. Refer to the [getTokenPrices endpoint on our API docs](https://www.covalenthq.com/docs/api/pricing/get-historical-token-prices/).
133
+ The `PricingService` class refers to the [historical token prices API endpoint](https://www.covalenthq.com/docs/api/pricing/get-historical-token-prices/):
115
134
 
116
135
  - `getTokenPrices()`: Get historic prices of a token between date ranges. Supports native tokens.
117
136
 
118
137
  ### TransactionService
119
138
 
120
- The `TransactionService` class contains the transactions endpoint. Listed below are the supported endpoints, also refer to our api docs under the Transactions section in our class A endpoints.
139
+ The `TransactionService` class refers to the [transactions API endpoints](https://www.covalenthq.com/docs/api/transactions/get-a-transaction/):
121
140
 
122
141
  - `getAllTransactionsForAddress()`: Fetch and render the most recent transactions involving an address. Frequently seen in wallet applications.
123
142
  - `getTransaction()`: Fetch and render a single transaction including its decoded log events. Additionally return semantically decoded information for DEX trades, lending and NFT sales.
@@ -126,13 +145,14 @@ The `TransactionService` class contains the transactions endpoint. Listed below
126
145
 
127
146
  ### XykService
128
147
 
129
- The `XykService` class contains the Xy=k endpoints. Listed below are the supported endpoints, also refer to our api docs under the XY=K section in our class B endpoints.
148
+ The `XykService` refers to the [Xy=k API endpoints](https://www.covalenthq.com/docs/api/xyk/get-xyk-pools/):
130
149
 
131
150
  - `getPools()`: Get all the pools of a particular DEX. Supports most common DEXs (Uniswap, SushiSwap, etc), and returns detailed trading data (volume, liquidity, swap counts, fees, LP token prices).
132
151
  - `getPoolByAddress()`: Get the 7 day and 30 day time-series data (volume, liquidity, price) of a particular liquidity pool in a DEX. Useful for building time-series charts on DEX trading activity.
133
152
  - `getPoolsForTokenAddress()`: Get all pools and the supported DEX for a token. Useful for building a table of top pairs across all supported DEXes that the token is trading on.
153
+ - `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.
134
154
  - `getAddressExchangeBalances()`: Return balance of a wallet/contract address on a specific DEX.
135
- - `getNetworkExchangeTokens()`: Get the balance of a wallet address in a DEX. Useful for finding out user balances locked up in DEX pools.
155
+ - `getNetworkExchangeTokens()`: Retrieve all network exchange tokens for a specific DEX. Useful for building a top tokens table by total liquidity within a particular DEX.
136
156
  - `getSupportedDEXes()`: Get all the supported DEXs available for the xy=k endpoints, along with the swap fees and factory addresses.
137
157
  - `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.
138
158
  - `getSingleNetworkExchangeToken()`: Get historical daily swap count for a single network exchange token.
@@ -142,9 +162,9 @@ The `XykService` class contains the Xy=k endpoints. Listed below are the support
142
162
  - `getEcosystemChartData()`: Get a 7d and 30d time-series chart of DEX activity. Includes volume and swap count.
143
163
  - `getHealthData()`: Ping the health of xy=k endpoints to get the synced block height per chain.
144
164
 
145
- ### How pagination works
165
+ ## How pagination works
146
166
 
147
- #### Endpoints supporting pagination
167
+ The following endpoints support pagination:
148
168
 
149
169
  - `getErc20TransfersForWalletAddress()`
150
170
  - `getTokenHoldersV2ForTokenAddress()`
@@ -155,25 +175,76 @@ The `XykService` class contains the Xy=k endpoints. Listed below are the support
155
175
  - `getTokenIdsForContractWithMetadata()`
156
176
  - `getAllTransactionsForAddress()`
157
177
 
158
- The listed endpoints above are currently the only endpoints that support pagination which return 100 results per page. To get the next page, it uses a `link url` or the `page-number` provided in the endpoint response. Here's an example of how to paginate through all recent transactions on the ethereum blockchain for the demo's ENS address:
178
+ Using the Covalent API, paginated supported endpoints return only 100 items, such as transactions or log events, per page. However, the Covalent SDK leverages generators to *seamlessly fetch all items without the user having to deal with pagination*.
179
+
180
+ For example, the following fetches ALL transactions for `demo.eth` on Ethereum:
159
181
  ```ts
160
- import { Client } from "@covalenthq/client-sdk";
182
+ import { CovalentClient } from "@covalenthq/client-sdk";
161
183
 
162
184
  const ApiServices = async () => {
163
- const client = new Client("YOUR_API_KEY"); // Replace with your Covalent API key.
164
- for await (const tx of client.TransactionService.getAllTransactionsForAddress("eth-mainnet", "demo.eth")) {
165
- console.log("tx", tx);
185
+ const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
186
+ try {
187
+ for await (const tx of client.TransactionService.getAllTransactionsForAddress("eth-mainnet", "demo.eth")) {
188
+ console.log("tx", tx);
189
+ }
190
+ } catch (error) {
191
+ console.log(error.message);
166
192
  }
167
193
  }
168
194
  ```
169
- The paginated endpoints exclusively returns their response items without the response wrapper, enabling developers to access the list seamlessly, ensuring efficient and straightforward item retrieval.
195
+
196
+ ### Concurrency Mechanism
197
+
198
+ Developers have the flexibility to specify the desired number of concurrent API calls they wish to execute using the `threadCount` settings parameter, with a default value of `3`. For example:
199
+
200
+ ```ts
201
+ import { CovalentClient, CovalentClientSettings } from "@covalenthq/client-sdk";
202
+
203
+ const settings: CovalentClientSettings = {
204
+ threadCount: 5
205
+ }
206
+
207
+ const ApiServices = async () => {
208
+ const client = new CovalentClient("YOUR_API_KEY", settings); // Replace with your Covalent API key and add set debugger
209
+ const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
210
+ if (!resp.error) {
211
+ console.log(resp.data);
212
+ } else {
213
+ console.log(resp.error_message);
214
+ }
215
+ }
216
+ ```
217
+
218
+ ### Debugger Mode
219
+
220
+ Developers have the option to enable a debugger mode that provides response times, the URLs of called endpoints, and the HTTP statuses of those endpoints. This feature helps users identify which endpoints may have encountered failures. The default is `debug = false` if no input is provided.
221
+
222
+ ```ts
223
+ import { CovalentClient, CovalentClientSettings } from "@covalenthq/client-sdk";
224
+
225
+ const settings: CovalentClientSettings = {
226
+ debug: true
227
+ }
228
+
229
+ const ApiServices = async () => {
230
+ const client = new CovalentClient("YOUR_API_KEY", settings); // Replace with your Covalent API key and add set debugger
231
+ const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
232
+ if (!resp.error) {
233
+ console.log(resp.data);
234
+ } else {
235
+ console.log(resp.error_message);
236
+ }
237
+ }
238
+ ```
239
+
240
+ ![example result image](https://www.datocms-assets.com/86369/1697154621-sdk-debugger-output.png)
170
241
 
171
242
  ### Retry Mechanism
172
243
 
173
- Each endpoint is equipped with an exponential backoff algorithm that exponentially extends the wait time between retries, making up to a `maximum of 5` retry attempts only.
244
+ 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.
174
245
 
175
246
  ### Error Handling
176
- The paginated endpoints will throw an error message in this format: `An error occurred {error_code}: {error_message}`, when an error occurs. The developer would need to make sure to catch those errors if any. This endpoint does not follow our default response format unlike our other endpoints, shown below.
247
+ 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:
177
248
  ```ts
178
249
 
179
250
  "data": ...,
@@ -0,0 +1,9 @@
1
+ export { CovalentClient, Client, Chain, Quote, Chains, Quotes, CovalentClientSettings } from "./services/CovalentClient";
2
+ export * from "./util/types/BalanceServiceTypes";
3
+ export * from "./util/types/BaseServiceTypes";
4
+ export * from "./util/types/NftServiceTypes";
5
+ export * from "./util/types/PricingServiceTypes";
6
+ export * from "./util/types/SecurityServiceTypes";
7
+ export * from "./util/types/XykServiceTypes";
8
+ export * from "./util/types/GenericTypes";
9
+ export * from "./util/types/TransactionServiceTypes";