@covalenthq/client-sdk 1.0.2 → 2.0.1
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/LICENSE +201 -0
- package/README.md +223 -282
- package/dist/cjs/index.d.ts +17 -20
- package/dist/cjs/index.js +2331 -7659
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/GoldRushClient.d.ts +20 -0
- package/dist/cjs/src/services/BalanceService.d.ts +125 -0
- package/dist/cjs/src/services/BaseService.d.ts +161 -0
- package/dist/cjs/src/services/NftService.d.ts +157 -0
- package/dist/cjs/src/services/PricingService.d.ts +25 -0
- package/dist/cjs/src/services/SecurityService.d.ts +28 -0
- package/dist/cjs/src/services/TransactionService.d.ts +128 -0
- package/dist/cjs/src/utils/functions/bigIntParser.d.ts +1 -0
- package/dist/cjs/{util/CalculatePrettyBalance.d.ts → src/utils/functions/calculatePrettyBalance.d.ts} +0 -0
- package/dist/cjs/src/utils/functions/debugOutput.d.ts +2 -0
- package/dist/cjs/src/utils/functions/endpointGenerator.d.ts +4 -0
- package/dist/cjs/src/utils/functions/execution.d.ts +11 -0
- package/dist/cjs/src/utils/functions/isValidApiKey.d.ts +1 -0
- package/dist/cjs/src/utils/functions/paginateEndpoint.d.ts +7 -0
- package/dist/cjs/src/utils/functions/prettifyCurrency.d.ts +2 -0
- package/dist/{esm/util/types/BalanceServiceTypes.d.ts → cjs/src/utils/types/BalanceService.types.d.ts} +91 -27
- package/dist/{es/util/types/BaseServiceTypes.d.ts → cjs/src/utils/types/BaseService.types.d.ts} +68 -18
- package/dist/cjs/src/utils/types/Generic.types.d.ts +477 -0
- package/dist/{esm/util/types/NftServiceTypes.d.ts → cjs/src/utils/types/NftService.types.d.ts} +53 -83
- package/dist/cjs/{util/types/PricingServiceTypes.d.ts → src/utils/types/PricingService.types.d.ts} +9 -3
- package/dist/{esm/util/types/SecurityServiceTypes.d.ts → cjs/src/utils/types/SecurityService.types.d.ts} +8 -7
- package/dist/{esm/util/types/TransactionServiceTypes.d.ts → cjs/src/utils/types/TransactionService.types.d.ts} +110 -24
- package/dist/es/index.d.ts +17 -20
- package/dist/es/index.js +2327 -7649
- package/dist/es/index.js.map +1 -1
- package/dist/es/src/GoldRushClient.d.ts +20 -0
- package/dist/es/src/services/BalanceService.d.ts +125 -0
- package/dist/es/src/services/BaseService.d.ts +161 -0
- package/dist/es/src/services/NftService.d.ts +157 -0
- package/dist/es/src/services/PricingService.d.ts +25 -0
- package/dist/es/src/services/SecurityService.d.ts +28 -0
- package/dist/es/src/services/TransactionService.d.ts +128 -0
- package/dist/es/src/utils/functions/bigIntParser.d.ts +1 -0
- package/dist/es/{util/CalculatePrettyBalance.d.ts → src/utils/functions/calculatePrettyBalance.d.ts} +0 -0
- package/dist/es/src/utils/functions/debugOutput.d.ts +2 -0
- package/dist/es/src/utils/functions/endpointGenerator.d.ts +4 -0
- package/dist/es/src/utils/functions/execution.d.ts +11 -0
- package/dist/es/src/utils/functions/isValidApiKey.d.ts +1 -0
- package/dist/es/src/utils/functions/paginateEndpoint.d.ts +7 -0
- package/dist/es/src/utils/functions/prettifyCurrency.d.ts +2 -0
- package/dist/{cjs/util/types/BalanceServiceTypes.d.ts → es/src/utils/types/BalanceService.types.d.ts} +91 -27
- package/dist/{esm/util/types/BaseServiceTypes.d.ts → es/src/utils/types/BaseService.types.d.ts} +68 -18
- package/dist/es/src/utils/types/Generic.types.d.ts +477 -0
- package/dist/{cjs/util/types/NftServiceTypes.d.ts → es/src/utils/types/NftService.types.d.ts} +53 -83
- package/dist/es/{util/types/PricingServiceTypes.d.ts → src/utils/types/PricingService.types.d.ts} +9 -3
- package/dist/{util/types/SecurityServiceTypes.d.ts → es/src/utils/types/SecurityService.types.d.ts} +8 -7
- package/dist/{cjs/util/types/TransactionServiceTypes.d.ts → es/src/utils/types/TransactionService.types.d.ts} +110 -24
- package/dist/esm/index.d.ts +17 -20
- package/dist/esm/index.js +2327 -7649
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/GoldRushClient.d.ts +20 -0
- package/dist/esm/src/services/BalanceService.d.ts +125 -0
- package/dist/esm/src/services/BaseService.d.ts +161 -0
- package/dist/esm/src/services/NftService.d.ts +157 -0
- package/dist/esm/src/services/PricingService.d.ts +25 -0
- package/dist/esm/src/services/SecurityService.d.ts +28 -0
- package/dist/esm/src/services/TransactionService.d.ts +128 -0
- package/dist/esm/src/utils/functions/bigIntParser.d.ts +1 -0
- package/dist/esm/{util/CalculatePrettyBalance.d.ts → src/utils/functions/calculatePrettyBalance.d.ts} +0 -0
- package/dist/esm/src/utils/functions/debugOutput.d.ts +2 -0
- package/dist/esm/src/utils/functions/endpointGenerator.d.ts +4 -0
- package/dist/esm/src/utils/functions/execution.d.ts +11 -0
- package/dist/esm/src/utils/functions/isValidApiKey.d.ts +1 -0
- package/dist/esm/src/utils/functions/paginateEndpoint.d.ts +7 -0
- package/dist/esm/src/utils/functions/prettifyCurrency.d.ts +2 -0
- package/dist/{util/types/BalanceServiceTypes.d.ts → esm/src/utils/types/BalanceService.types.d.ts} +91 -27
- package/dist/{cjs/util/types/BaseServiceTypes.d.ts → esm/src/utils/types/BaseService.types.d.ts} +68 -18
- package/dist/esm/src/utils/types/Generic.types.d.ts +477 -0
- package/dist/{util/types/NftServiceTypes.d.ts → esm/src/utils/types/NftService.types.d.ts} +53 -83
- package/dist/esm/{util/types/PricingServiceTypes.d.ts → src/utils/types/PricingService.types.d.ts} +9 -3
- package/dist/{es/util/types/SecurityServiceTypes.d.ts → esm/src/utils/types/SecurityService.types.d.ts} +8 -7
- package/dist/{util/types/TransactionServiceTypes.d.ts → esm/src/utils/types/TransactionService.types.d.ts} +110 -24
- package/package.json +25 -12
- package/dist/cjs/services/BalanceService.d.ts +0 -638
- package/dist/cjs/services/BaseService.d.ts +0 -571
- package/dist/cjs/services/CovalentClient.d.ts +0 -57
- package/dist/cjs/services/NftService.d.ts +0 -686
- package/dist/cjs/services/PricingService.d.ts +0 -103
- package/dist/cjs/services/SecurityService.d.ts +0 -162
- package/dist/cjs/services/TransactionService.d.ts +0 -711
- package/dist/cjs/services/XykService.d.ts +0 -1018
- package/dist/cjs/util/ApiHelpers.d.ts +0 -6
- package/dist/cjs/util/ApiKeyValidator.d.ts +0 -8
- package/dist/cjs/util/Chains.d.ts +0 -223
- package/dist/cjs/util/backoff.d.ts +0 -12
- package/dist/cjs/util/prettifyCurrency.d.ts +0 -2
- package/dist/cjs/util/types/GenericTypes.d.ts +0 -116
- package/dist/cjs/util/types/SecurityServiceTypes.d.ts +0 -121
- package/dist/cjs/util/types/XykServiceTypes.d.ts +0 -687
- package/dist/es/services/BalanceService.d.ts +0 -638
- package/dist/es/services/BaseService.d.ts +0 -571
- package/dist/es/services/CovalentClient.d.ts +0 -57
- package/dist/es/services/NftService.d.ts +0 -686
- package/dist/es/services/PricingService.d.ts +0 -103
- package/dist/es/services/SecurityService.d.ts +0 -162
- package/dist/es/services/TransactionService.d.ts +0 -711
- package/dist/es/services/XykService.d.ts +0 -1018
- package/dist/es/util/ApiHelpers.d.ts +0 -6
- package/dist/es/util/ApiKeyValidator.d.ts +0 -8
- package/dist/es/util/Chains.d.ts +0 -223
- package/dist/es/util/backoff.d.ts +0 -12
- package/dist/es/util/prettifyCurrency.d.ts +0 -2
- package/dist/es/util/types/BalanceServiceTypes.d.ts +0 -378
- package/dist/es/util/types/GenericTypes.d.ts +0 -116
- package/dist/es/util/types/NftServiceTypes.d.ts +0 -303
- package/dist/es/util/types/TransactionServiceTypes.d.ts +0 -388
- package/dist/es/util/types/XykServiceTypes.d.ts +0 -687
- package/dist/esm/services/BalanceService.d.ts +0 -638
- package/dist/esm/services/BaseService.d.ts +0 -571
- package/dist/esm/services/CovalentClient.d.ts +0 -57
- package/dist/esm/services/NftService.d.ts +0 -686
- package/dist/esm/services/PricingService.d.ts +0 -103
- package/dist/esm/services/SecurityService.d.ts +0 -162
- package/dist/esm/services/TransactionService.d.ts +0 -711
- package/dist/esm/services/XykService.d.ts +0 -1018
- package/dist/esm/util/ApiHelpers.d.ts +0 -6
- package/dist/esm/util/ApiKeyValidator.d.ts +0 -8
- package/dist/esm/util/Chains.d.ts +0 -223
- package/dist/esm/util/backoff.d.ts +0 -12
- package/dist/esm/util/prettifyCurrency.d.ts +0 -2
- package/dist/esm/util/types/GenericTypes.d.ts +0 -116
- package/dist/esm/util/types/XykServiceTypes.d.ts +0 -687
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -21
- package/dist/index.js.map +0 -1
- package/dist/services/BalanceService.d.ts +0 -638
- package/dist/services/BalanceService.js +0 -959
- package/dist/services/BalanceService.js.map +0 -1
- package/dist/services/BaseService.d.ts +0 -571
- package/dist/services/BaseService.js +0 -1202
- package/dist/services/BaseService.js.map +0 -1
- package/dist/services/CovalentClient.d.ts +0 -57
- package/dist/services/CovalentClient.js +0 -49
- package/dist/services/CovalentClient.js.map +0 -1
- package/dist/services/NftService.d.ts +0 -686
- package/dist/services/NftService.js +0 -1490
- package/dist/services/NftService.js.map +0 -1
- package/dist/services/PricingService.d.ts +0 -103
- package/dist/services/PricingService.js +0 -155
- package/dist/services/PricingService.js.map +0 -1
- package/dist/services/SecurityService.d.ts +0 -162
- package/dist/services/SecurityService.js +0 -249
- package/dist/services/SecurityService.js.map +0 -1
- package/dist/services/TransactionService.d.ts +0 -711
- package/dist/services/TransactionService.js +0 -1687
- package/dist/services/TransactionService.js.map +0 -1
- package/dist/services/XykService.d.ts +0 -1018
- package/dist/services/XykService.js +0 -1827
- package/dist/services/XykService.js.map +0 -1
- package/dist/util/ApiHelpers.d.ts +0 -6
- package/dist/util/ApiHelpers.js +0 -87
- package/dist/util/ApiHelpers.js.map +0 -1
- package/dist/util/ApiKeyValidator.d.ts +0 -8
- package/dist/util/ApiKeyValidator.js +0 -13
- package/dist/util/ApiKeyValidator.js.map +0 -1
- package/dist/util/CalculatePrettyBalance.d.ts +0 -1
- package/dist/util/CalculatePrettyBalance.js +0 -32
- package/dist/util/CalculatePrettyBalance.js.map +0 -1
- package/dist/util/Chains.d.ts +0 -223
- package/dist/util/Chains.js +0 -225
- package/dist/util/Chains.js.map +0 -1
- package/dist/util/backoff.d.ts +0 -12
- package/dist/util/backoff.js +0 -47
- package/dist/util/backoff.js.map +0 -1
- package/dist/util/prettifyCurrency.d.ts +0 -2
- package/dist/util/prettifyCurrency.js +0 -69
- package/dist/util/prettifyCurrency.js.map +0 -1
- package/dist/util/types/BalanceServiceTypes.js +0 -2
- package/dist/util/types/BalanceServiceTypes.js.map +0 -1
- package/dist/util/types/BaseServiceTypes.d.ts +0 -276
- package/dist/util/types/BaseServiceTypes.js +0 -2
- package/dist/util/types/BaseServiceTypes.js.map +0 -1
- package/dist/util/types/GenericTypes.d.ts +0 -116
- package/dist/util/types/GenericTypes.js +0 -2
- package/dist/util/types/GenericTypes.js.map +0 -1
- package/dist/util/types/NftServiceTypes.js +0 -2
- package/dist/util/types/NftServiceTypes.js.map +0 -1
- package/dist/util/types/PricingServiceTypes.d.ts +0 -33
- package/dist/util/types/PricingServiceTypes.js +0 -2
- package/dist/util/types/PricingServiceTypes.js.map +0 -1
- package/dist/util/types/SecurityServiceTypes.js +0 -2
- package/dist/util/types/SecurityServiceTypes.js.map +0 -1
- package/dist/util/types/TransactionServiceTypes.js +0 -2
- package/dist/util/types/TransactionServiceTypes.js.map +0 -1
- package/dist/util/types/XykServiceTypes.d.ts +0 -687
- package/dist/util/types/XykServiceTypes.js +0 -2
- package/dist/util/types/XykServiceTypes.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://goldrush.dev/products/goldrush/" target="_blank" rel="noopener noreferrer">
|
|
3
|
+
<img alt="GoldRush Kit Logo" src="./assets/ts-sdk-banner.png" style="max-width: 100%;"/>
|
|
4
|
+
</a>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<br/>
|
|
8
|
+
|
|
1
9
|
<p align="center">
|
|
2
10
|
<a href="https://www.npmjs.com/package/@covalenthq/client-sdk">
|
|
3
11
|
<img src="https://img.shields.io/npm/v/@covalenthq/client-sdk" alt="NPM">
|
|
@@ -5,128 +13,231 @@
|
|
|
5
13
|
<a href="https://www.npmjs.com/package/@covalenthq/client-sdk">
|
|
6
14
|
<img src="https://img.shields.io/npm/dm/@covalenthq/client-sdk" alt="npm downloads">
|
|
7
15
|
</a>
|
|
8
|
-
<
|
|
9
|
-
<img src="https://img.shields.io/badge/node-20.x-green">
|
|
10
|
-
<a>
|
|
16
|
+
<img src="https://img.shields.io/github/license/covalenthq/client-sdk" alt="Apache-2.0">
|
|
11
17
|
</p>
|
|
12
18
|
|
|
19
|
+
# GoldRush SDK for TypeScript
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
The GoldRush SDK is the fastest way to integrate the GoldRush API for working with blockchain data. The SDK works with all [supported chains](https://www.covalenthq.com/docs/networks/) including Mainnets and Testnets.
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
> Use with [`NodeJS v18`](https://nodejs.org/en) or above for best results.
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
> The GoldRush API is required. You can register for a free key on [GoldRush's website](https://goldrush.dev/platform/apikey)
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
>
|
|
22
|
-
> 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.
|
|
27
|
+
## Using the SDK
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
> You can also follow the [video tutorial](https://www.youtube.com/watch?v=XSpPJP2w62E&ab_channel=Covalent)
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
npm install @covalenthq/client-sdk
|
|
28
|
-
```
|
|
29
|
-
or
|
|
30
|
-
```
|
|
31
|
-
yarn add @covalenthq/client-sdk
|
|
32
|
-
```
|
|
31
|
+
1. Install the dependencies
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
```bash
|
|
34
|
+
npm install @covalenthq/client-sdk
|
|
35
|
+
```
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
2. Create a client using the `GoldRushClient`
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
```ts
|
|
40
|
+
import { GoldRushClient, Chains } from "@covalenthq/client-sdk";
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
import { CovalentClient, Chains } from "@covalenthq/client-sdk";
|
|
42
|
+
const client = new GoldRushClient("<YOUR_API_KEY>");
|
|
42
43
|
|
|
43
|
-
const ApiServices = async () => {
|
|
44
|
-
|
|
44
|
+
const ApiServices = async () => {
|
|
45
|
+
try {
|
|
46
|
+
const balanceResp =
|
|
47
|
+
await client.BalanceService.getTokenBalancesForWalletAddress(
|
|
48
|
+
"eth-mainnet",
|
|
49
|
+
"demo.eth"
|
|
50
|
+
);
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
**ℹ️ BREAKING CHANGE**
|
|
59
|
-
> If you have been importing with `Client`:
|
|
60
|
-
```ts
|
|
61
|
-
import { Client } from "@covalenthq/client-sdk";
|
|
62
|
-
```
|
|
63
|
-
>
|
|
64
|
-
> Please change to `CovalentClient`:
|
|
65
|
-
```ts
|
|
66
|
-
import { CovalentClient } from "@covalenthq/client-sdk";
|
|
67
|
-
```
|
|
52
|
+
if (balanceResp.error) {
|
|
53
|
+
throw balanceResp;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log(balanceResp.data);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error(error);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The `GoldRushClient` can be configured with a second object argument, `settings`. The settings offered are
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
1. **debug**: A boolean that enables server logs of the API calls, enhanced with the request URL, response time and code, and other settings. It is set as `false` by default.
|
|
66
|
+
2. **threadCount**: A number that sets the number of concurrent requests allowed. It is set as `2` by default.
|
|
67
|
+
3. **enableRetry**: A boolean that enables retrying the API endpoint in case of a `429 - rate limit` error. It is set as `true` by default.
|
|
68
|
+
4. **maxRetries**: A number that sets the number of retries to be made in case of `429 - rate limit` error. To be in effect, it requires `enableRetry` to be enabled. It is set as `2` by default.
|
|
69
|
+
5. **retryDelay**: A number that sets the delay in `ms` for retrying the API endpoint in case of `429 - rate limit` error. To be in effect, it requires `enableRetry` to be enabled. It is set as `2` by default.
|
|
70
|
+
6. **source**: A string that defines the `source` of the request of better analytics.
|
|
71
|
+
|
|
72
|
+
## Features
|
|
73
|
+
|
|
74
|
+
### 1. Name Resolution
|
|
75
|
+
|
|
76
|
+
The GoldRush SDK natively resolves the underlying wallet address for the following
|
|
77
|
+
|
|
78
|
+
1. ENS Domains (e.g. `demo.eth`)
|
|
79
|
+
2. Lens Handles (e.g. `@demo.lens`)
|
|
80
|
+
3. Unstoppable Domains (e.g. `demo.x`)
|
|
81
|
+
4. RNS Domains (e.g. `demo.ron`)
|
|
82
|
+
|
|
83
|
+
### 2. Query Parameters
|
|
84
|
+
|
|
85
|
+
All the API call arguments have an option to pass `typed objects` as Query parameters.
|
|
71
86
|
|
|
72
87
|
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:
|
|
88
|
+
|
|
73
89
|
```ts
|
|
74
|
-
const resp = await client.BalanceService.getTokenBalancesForWalletAddress(
|
|
90
|
+
const resp = await client.BalanceService.getTokenBalancesForWalletAddress(
|
|
91
|
+
"eth-mainnet",
|
|
92
|
+
"demo.eth",
|
|
93
|
+
{
|
|
94
|
+
quoteCurrency: "CAD",
|
|
95
|
+
nft: true,
|
|
96
|
+
}
|
|
97
|
+
);
|
|
75
98
|
```
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
|
|
100
|
+
### 3. Exported Types
|
|
101
|
+
|
|
102
|
+
All the `interface`s used, for arguments, query parameters and responses are also exported from the package which can be used for custom usage.
|
|
103
|
+
|
|
104
|
+
For example, explicitly typecasting the response
|
|
105
|
+
|
|
78
106
|
```ts
|
|
79
|
-
import {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
107
|
+
import {
|
|
108
|
+
GoldRushClient,
|
|
109
|
+
BalancesResponse,
|
|
110
|
+
BalanceItem,
|
|
111
|
+
} from "@covalenthq/client-sdk";
|
|
112
|
+
|
|
113
|
+
const resp = await client.BalanceService.getTokenBalancesForWalletAddress(
|
|
114
|
+
"eth-mainnet",
|
|
115
|
+
"demo.eth",
|
|
116
|
+
{
|
|
117
|
+
quoteCurrency: "CAD",
|
|
118
|
+
nft: true,
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const data: BalancesResponse = resp.data;
|
|
123
|
+
const items: BalanceItem[] = resp.data.items;
|
|
83
124
|
```
|
|
84
125
|
|
|
85
|
-
###
|
|
86
|
-
|
|
126
|
+
### 4. Multiple Chain input formats
|
|
127
|
+
|
|
128
|
+
The SDK supports the following formats for the chain input:
|
|
129
|
+
|
|
130
|
+
1. Chain Name (e.g. `eth-mainnet`)
|
|
131
|
+
2. Chain ID (e.g. `1`)
|
|
132
|
+
3. Chain Name Enum (e.g. `ChainName.ETH_MAINNET`)
|
|
133
|
+
4. Chain ID Enum (e.g. `ChainID.ETH_MAINNET`)
|
|
87
134
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
135
|
+
### 5. Additional Non-Paginated methods
|
|
136
|
+
|
|
137
|
+
For paginated responses, the GoldRush API can at max support 100 items per page. However, the Covalent SDK leverages generators to _seamlessly fetch all items without the user having to deal with pagination_.
|
|
138
|
+
|
|
139
|
+
For example, the following fetches ALL transactions for `demo.eth` on Ethereum:
|
|
91
140
|
|
|
92
|
-
Example with string literal
|
|
93
141
|
```ts
|
|
94
|
-
|
|
95
|
-
|
|
142
|
+
import { GoldRushClient } from "@covalenthq/client-sdk";
|
|
143
|
+
|
|
144
|
+
const ApiServices = async () => {
|
|
145
|
+
const client = new GoldRushClient("<YOUR_API_KEY>");
|
|
146
|
+
try {
|
|
147
|
+
for await (const tx of client.TransactionService.getAllTransactionsForAddress(
|
|
148
|
+
"eth-mainnet",
|
|
149
|
+
"demo.eth"
|
|
150
|
+
)) {
|
|
151
|
+
console.log("tx", tx);
|
|
152
|
+
}
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.log(error.message);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
96
157
|
```
|
|
97
|
-
|
|
158
|
+
|
|
159
|
+
### 6. Executable pagination functions
|
|
160
|
+
|
|
161
|
+
Paginated methods 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.
|
|
162
|
+
|
|
98
163
|
```ts
|
|
99
|
-
|
|
100
|
-
|
|
164
|
+
import { GoldRushClient } from "@covalenthq/client-sdk";
|
|
165
|
+
|
|
166
|
+
const client = new GoldRushClient("<YOUR_API_KEY>");
|
|
167
|
+
const resp = await client.TransactionService.getAllTransactionsForAddressByPage(
|
|
168
|
+
"eth-mainnet",
|
|
169
|
+
"demo.eth"
|
|
170
|
+
); // assuming resp.data.current_page is 10
|
|
171
|
+
if (resp.data !== null) {
|
|
172
|
+
const prevPage = await resp.data.prev(); // will retrieve page 9
|
|
173
|
+
console.log(prevPage.data);
|
|
174
|
+
}
|
|
101
175
|
```
|
|
102
|
-
|
|
176
|
+
|
|
177
|
+
### 7. Utility Functions
|
|
178
|
+
|
|
179
|
+
1. **bigIntParser**: Formats input as a `bigint` value. For example
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
bigIntParser("-123"); // -123n
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
You can explore more examples [here](./test/unit/bigint-parser.test.ts)
|
|
186
|
+
|
|
187
|
+
2. **calculatePrettyBalance**: Formats large and raw numbers and bigints to human friendly format. For example
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
calculatePrettyBalance(1.5, 3, true, 4); // "0.0015"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
You can explore more examples [here](./test/unit/calculate-pretty-balance.test.ts)
|
|
194
|
+
|
|
195
|
+
3. **isValidApiKey**: Checks for the input as a valid GoldRush API Key. For example
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
isValidApiKey(cqt_wF123); // false
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
You can explore more examples [here](./test/unit/is-valid-api-key.test.ts)
|
|
202
|
+
|
|
203
|
+
4. **prettifyCurrency**: Formats large and raw numbers and bigints to human friendly currency format. For example
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
prettifyCurrency(89.0, 2, "CAD"); // "CA$89.00"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
You can explore more examples [here](./test/unit/is-valid-api-key.test.ts)
|
|
210
|
+
|
|
211
|
+
### 8. Standardized (Error) Responses
|
|
212
|
+
|
|
213
|
+
All the responses are of the same standardized format
|
|
214
|
+
|
|
103
215
|
```ts
|
|
104
|
-
|
|
105
|
-
|
|
216
|
+
❴
|
|
217
|
+
"data": <object>,
|
|
218
|
+
"error": <boolean>,
|
|
219
|
+
"error_message": <string>,
|
|
220
|
+
"error_code": <number>
|
|
221
|
+
❵
|
|
106
222
|
```
|
|
107
223
|
|
|
108
224
|
## Supported Endpoints
|
|
109
225
|
|
|
110
|
-
The Covalent SDK provides comprehensive support for all Class A, Class B, and Pricing endpoints that are grouped under the following
|
|
226
|
+
The Covalent SDK provides comprehensive support for all Class A, Class B, and Pricing endpoints that are grouped under the following _Service_ namespaces:
|
|
111
227
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- [`PricingService`](#pricingservice): Access to the historical token prices endpoint
|
|
117
|
-
- [`TransactionService`](#transactionservice): Access to the transactions endpoints
|
|
118
|
-
- [`XykService`](#xykservice): Access to the XY=K suite of endpoints
|
|
119
|
-
|
|
120
|
-
### SecurityService
|
|
121
|
-
|
|
122
|
-
The `SecurityService` class refers to the [token approvals API endpoints](https://www.covalenthq.com/docs/api/security/get-token-approvals-for-address/):
|
|
228
|
+
<details>
|
|
229
|
+
<summary>
|
|
230
|
+
1. <strong>Security Service</strong>: Access to the token approvals API endpoints
|
|
231
|
+
</summary>
|
|
123
232
|
|
|
124
233
|
- `getApprovals()`: Get a list of approvals across all ERC20 token contracts categorized by spenders for a wallet’s assets.
|
|
125
234
|
- `getNftApprovals()`: Get a list of approvals across all NFT contracts categorized by spenders for a wallet’s assets.
|
|
235
|
+
</details>
|
|
126
236
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
237
|
+
<details>
|
|
238
|
+
<summary>
|
|
239
|
+
2. <strong>Balance Service</strong>: Access to the balances endpoints
|
|
240
|
+
</summary>
|
|
130
241
|
|
|
131
242
|
- `getTokenBalancesForWalletAddress()`: Fetch the native, fungible (ERC20), and non-fungible (ERC721 & ERC1155) tokens held by an address. Response includes spot prices and other metadata.
|
|
132
243
|
- `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.
|
|
@@ -136,10 +247,12 @@ The `BalanceService` class refers to the [balances API endpoints](https://www.co
|
|
|
136
247
|
- `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. (Paginated)
|
|
137
248
|
- `getTokenHoldersV2ForTokenAddressByPage()`: 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. (Nonpaginated)
|
|
138
249
|
- `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.
|
|
250
|
+
</details>
|
|
139
251
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
252
|
+
<details>
|
|
253
|
+
<summary>
|
|
254
|
+
3. <strong>Balance Service</strong>: Access to the address activity, log events, chain status, and block retrieval endpoints
|
|
255
|
+
</summary>
|
|
143
256
|
|
|
144
257
|
- `getBlock()`: Fetch and render a single block for a block explorer.
|
|
145
258
|
- `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.
|
|
@@ -154,10 +267,12 @@ The `BaseService` class refers to the [address activity, log events, chain statu
|
|
|
154
267
|
- `getAllChainStatus()`: Used to build internal status dashboards of all supported chains.
|
|
155
268
|
- `getAddressActivity()`: Locate chains where an address is active on with a single API call.
|
|
156
269
|
- `getGasPrices()`: Get real-time gas estimates for different transaction speeds on a specific network, enabling users to optimize transaction costs and confirmation times.
|
|
270
|
+
</details>
|
|
157
271
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
272
|
+
<details>
|
|
273
|
+
<summary>
|
|
274
|
+
4. <strong>NFT Service</strong>: Access to the NFT endpoints
|
|
275
|
+
</summary>
|
|
161
276
|
|
|
162
277
|
- `getChainCollections()`: Used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files. (Paginated)
|
|
163
278
|
- `getChainCollectionsByPage()`: Used to fetch the list of NFT collections with downloaded and cached off chain data like token metadata and asset files. (Nonpaginated)
|
|
@@ -171,19 +286,20 @@ The `NftService` class refers to the [NFT API endpoints](https://www.covalenthq.
|
|
|
171
286
|
- `getCollectionTraitsSummary()`: Used to calculate rarity scores for a collection based on its traits.
|
|
172
287
|
- `checkOwnershipInNft()`: Used to verify ownership of NFTs (including ERC-721 and ERC-1155) within a collection.
|
|
173
288
|
- `checkOwnershipInNftForSpecificTokenId()`: Used to verify ownership of a specific token (ERC-721 or ERC-1155) within a collection.
|
|
174
|
-
|
|
175
|
-
- `getNftMarketVolume()`: Used to build a time-series chart of the transaction volume of an NFT collection.
|
|
176
|
-
- `getNftMarketFloorPrice()`: Used to render a price floor chart for an NFT collection.
|
|
177
|
-
|
|
178
|
-
### PricingService
|
|
289
|
+
</details>
|
|
179
290
|
|
|
180
|
-
|
|
291
|
+
<details>
|
|
292
|
+
<summary>
|
|
293
|
+
5. <strong>Pricing Service</strong>: Access to the historical token prices endpoint
|
|
294
|
+
</summary>
|
|
181
295
|
|
|
182
296
|
- `getTokenPrices()`: Get historic prices of a token between date ranges. Supports native tokens.
|
|
297
|
+
</details>
|
|
183
298
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
299
|
+
<details>
|
|
300
|
+
<summary>
|
|
301
|
+
6. <strong>Transaction Service</strong>: Access to the transactions endpoints
|
|
302
|
+
</summary>
|
|
187
303
|
|
|
188
304
|
- `getAllTransactionsForAddress()`: Fetch and render the most recent transactions involving an address. Frequently seen in wallet applications. (Paginated)
|
|
189
305
|
- `getAllTransactionsForAddressByPage()`: Fetch and render the most recent transactions involving an address. Frequently seen in wallet applications. (Nonpaginated)
|
|
@@ -194,192 +310,17 @@ The `TransactionService` class refers to the [transactions API endpoints](https:
|
|
|
194
310
|
- `getTimeBucketTransactionsForAddress()`: Fetch all transactions including their decoded log events in a 15-minute time bucket interval.
|
|
195
311
|
- `getTransactionsForBlockHashByPage()`: Fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
|
|
196
312
|
- `getTransactionsForBlockHash()`: Fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
|
|
313
|
+
</details>
|
|
197
314
|
|
|
315
|
+
## Contributing
|
|
198
316
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
```ts
|
|
202
|
-
import { CovalentClient } from "@covalenthq/client-sdk";
|
|
203
|
-
|
|
204
|
-
const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
|
|
205
|
-
const resp = await client.TransactionService.getAllTransactionsForAddressByPage("eth-mainnet", "WALLET_ADDRESS");
|
|
206
|
-
// assuming resp.data.current_page is 10
|
|
207
|
-
if (resp.data !== null) {
|
|
208
|
-
const prevPage = await resp.data.prev() // will retrieve page 9
|
|
209
|
-
console.log(prevPage.data)
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### XykService
|
|
214
|
-
|
|
215
|
-
The `XykService` refers to the [Xy=k API endpoints](https://www.covalenthq.com/docs/api/xyk/get-xyk-pools/):
|
|
216
|
-
|
|
217
|
-
- `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).
|
|
218
|
-
- `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.
|
|
219
|
-
- `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.
|
|
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.
|
|
221
|
-
- `getAddressExchangeBalances()`: Return balance of a wallet/contract address on a specific DEX.
|
|
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.
|
|
224
|
-
- `getSupportedDEXes()`: Get all the supported DEXs available for the xy=k endpoints, along with the swap fees and factory addresses.
|
|
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.
|
|
226
|
-
- `getSingleNetworkExchangeToken()`: Get historical daily swap count for a single network exchange token.
|
|
227
|
-
- `getTransactionsForAccountAddress()`: Get all the DEX transactions of a wallet. Useful for building tables of DEX activity segmented by wallet.
|
|
228
|
-
- `getTransactionsForTokenAddress()`: Get all the transactions of a token within a particular DEX. Useful for getting a per-token view of DEX activity.
|
|
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.
|
|
231
|
-
- `getEcosystemChartData()`: Get a 7d and 30d time-series chart of DEX activity. Includes volume and swap count.
|
|
232
|
-
- `getHealthData()`: Ping the health of xy=k endpoints to get the synced block height per chain.
|
|
233
|
-
|
|
234
|
-
## Additional Helper Functions
|
|
235
|
-
### calculatePrettyBalance
|
|
236
|
-
The `calculatePrettyBalance` function is designed to take up to 4 inputs: the `balance` field obtained from the `tokenBalance` endpoint and the `contract_decimals`. The function also includes two optional fields, `roundOff` and `precision`, to allow developers to round the unscaled balance to a certain decimal precision. The primary purpose of this function is to convert the scaled token balance (the balance parameter) into its unscaled, human-readable form. The scaled balance needs to be divided by 10^(contractDecimals) to remove the scaling factor.
|
|
237
|
-
|
|
238
|
-
```ts
|
|
239
|
-
import { CovalentClient, calculatePrettyBalance } from "@covalenthq/client-sdk";
|
|
240
|
-
|
|
241
|
-
const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
|
|
242
|
-
const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
|
|
243
|
-
const prettyBalance = calculatePrettyBalance(resp.data.items[0].balance, resp.data.items[0].contract_decimals);
|
|
244
|
-
```
|
|
245
|
-
### prettifyCurrency
|
|
246
|
-
The `prettifyCurrency` function refines the presentation of a monetary value, accepting a numerical amount and a fiat currency code as parameters (with USD as the default currency). It simplifies currency formatting for developers, ensuring visually polished representations of financial information in user interfaces for an enhanced user experience.
|
|
247
|
-
|
|
248
|
-
```ts
|
|
249
|
-
import { CovalentClient, prettifyCurrency } from "@covalenthq/client-sdk";
|
|
250
|
-
|
|
251
|
-
const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
|
|
252
|
-
const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
|
|
253
|
-
const prettyCurrency = prettifyCurrency(resp.data.items[0].quote_rate);
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## Built-in SDK Features
|
|
257
|
-
### Explaining Pagination Mechanism Within the SDK
|
|
258
|
-
|
|
259
|
-
The following endpoints support pagination:
|
|
260
|
-
|
|
261
|
-
- `getErc20TransfersForWalletAddress()`
|
|
262
|
-
- `getTokenHoldersV2ForTokenAddress()`
|
|
263
|
-
- `getBlockHeights()`
|
|
264
|
-
- `getLogEventsByAddress()`
|
|
265
|
-
- `getLogEventsByTopicHash()`
|
|
266
|
-
- `getChainCollections()`
|
|
267
|
-
- `getTokenIdsForContractWithMetadata()`
|
|
268
|
-
- `getAllTransactionsForAddress()`
|
|
317
|
+
Contributions, issues and feature requests are welcome!
|
|
318
|
+
Feel free to check [issues](https://github.com/covalenthq/covalent-api-sdk-ts/issues) page.
|
|
269
319
|
|
|
270
|
-
|
|
320
|
+
## Show your support
|
|
271
321
|
|
|
272
|
-
|
|
273
|
-
```ts
|
|
274
|
-
import { CovalentClient } from "@covalenthq/client-sdk";
|
|
275
|
-
|
|
276
|
-
const ApiServices = async () => {
|
|
277
|
-
const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
|
|
278
|
-
try {
|
|
279
|
-
for await (const tx of client.TransactionService.getAllTransactionsForAddress("eth-mainnet", "demo.eth")) {
|
|
280
|
-
console.log("tx", tx);
|
|
281
|
-
}
|
|
282
|
-
} catch (error) {
|
|
283
|
-
console.log(error.message);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
### Concurrency Mechanism
|
|
289
|
-
|
|
290
|
-
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:
|
|
291
|
-
|
|
292
|
-
```ts
|
|
293
|
-
import { CovalentClient, CovalentClientSettings } from "@covalenthq/client-sdk";
|
|
294
|
-
|
|
295
|
-
const settings: CovalentClientSettings = {
|
|
296
|
-
threadCount: 5
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const ApiServices = async () => {
|
|
300
|
-
const client = new CovalentClient("YOUR_API_KEY", settings); // Replace with your Covalent API key and add set debugger
|
|
301
|
-
const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
|
|
302
|
-
if (!resp.error) {
|
|
303
|
-
console.log(resp.data);
|
|
304
|
-
} else {
|
|
305
|
-
console.log(resp.error_message);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Debugger Mode
|
|
311
|
-
|
|
312
|
-
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.
|
|
313
|
-
|
|
314
|
-
```ts
|
|
315
|
-
import { CovalentClient, CovalentClientSettings } from "@covalenthq/client-sdk";
|
|
316
|
-
|
|
317
|
-
const settings: CovalentClientSettings = {
|
|
318
|
-
debug: true
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const ApiServices = async () => {
|
|
322
|
-
const client = new CovalentClient("YOUR_API_KEY", settings); // Replace with your Covalent API key and add set debugger
|
|
323
|
-
const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
|
|
324
|
-
if (!resp.error) {
|
|
325
|
-
console.log(resp.data);
|
|
326
|
-
} else {
|
|
327
|
-
console.log(resp.error_message);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-

|
|
333
|
-
|
|
334
|
-
### Retry Mechanism
|
|
335
|
-
|
|
336
|
-
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.
|
|
337
|
-
|
|
338
|
-
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`.
|
|
339
|
-
|
|
340
|
-
```ts
|
|
341
|
-
import { CovalentClient, CovalentClientSettings } from "@covalenthq/client-sdk";
|
|
342
|
-
|
|
343
|
-
const settings: CovalentClientSettings = {
|
|
344
|
-
enableRetry: false
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Error Handling
|
|
349
|
-
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:
|
|
350
|
-
```ts
|
|
351
|
-
❴
|
|
352
|
-
"data": ...,
|
|
353
|
-
"error": false,
|
|
354
|
-
"error_message": null,
|
|
355
|
-
"error_code": null
|
|
356
|
-
❵
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
### Error codes
|
|
360
|
-
Covalent uses standard HTTP response codes to indicate the success or failure of an API request. In general: codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, etc.). Codes in the 5xx range indicate an error with Covalent's servers (these are rare).
|
|
361
|
-
|
|
362
|
-
| Code | Description |
|
|
363
|
-
| ----------- | ----------- |
|
|
364
|
-
| 200 | OK Everything worked as expected. |
|
|
365
|
-
| 400 | Bad Request The request could not be accepted, usually due to a missing required parameter. |
|
|
366
|
-
| 401 | Unauthorized No valid API key was provided. |
|
|
367
|
-
| 404 | Not Found The request path does not exist. |
|
|
368
|
-
| 429 | Too Many Requests You are being rate-limited. Please see the rate limiting section for more information. |
|
|
369
|
-
| 500, 502, 503 | Server Errors Something went wrong on Covalent's servers. These are rare. |
|
|
370
|
-
|
|
371
|
-
## Tests
|
|
372
|
-
to run all tests, you need to input your api key first shown below
|
|
373
|
-
```
|
|
374
|
-
COVALENT_API_KEY=YOUR_KEY npm test
|
|
375
|
-
```
|
|
376
|
-
OR
|
|
377
|
-
|
|
378
|
-
you can run individual tests for each service, for example
|
|
379
|
-
```
|
|
380
|
-
COVALENT_API_KEY=YOUR_KEY npm test -- security-service.test.ts
|
|
381
|
-
```
|
|
322
|
+
Give a ⭐️ if this project helped you!
|
|
382
323
|
|
|
383
|
-
##
|
|
324
|
+
## License
|
|
384
325
|
|
|
385
|
-
|
|
326
|
+
This project is [Apache-2.0](./LICENSE) licensed.
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export { calculatePrettyBalance } from "./util/CalculatePrettyBalance";
|
|
19
|
-
export { prettifyCurrency } from "./util/prettifyCurrency";
|
|
20
|
-
export { Chains } from "./util/Chains";
|
|
1
|
+
export {
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Please use `GoldRushClient` going forward!
|
|
4
|
+
* `CovalentClient` will be removed after Aug 30, 2024.
|
|
5
|
+
*/
|
|
6
|
+
GoldRushClient as CovalentClient, GoldRushClient, } from "./src/GoldRushClient";
|
|
7
|
+
export { bigIntParser } from "./src/utils/functions/bigIntParser";
|
|
8
|
+
export { calculatePrettyBalance } from "./src/utils/functions/calculatePrettyBalance";
|
|
9
|
+
export { isValidApiKey } from "./src/utils/functions/isValidApiKey";
|
|
10
|
+
export { prettifyCurrency } from "./src/utils/functions/prettifyCurrency";
|
|
11
|
+
export * from "./src/utils/types/BalanceService.types";
|
|
12
|
+
export * from "./src/utils/types/BaseService.types";
|
|
13
|
+
export * from "./src/utils/types/Generic.types";
|
|
14
|
+
export * from "./src/utils/types/NftService.types";
|
|
15
|
+
export * from "./src/utils/types/PricingService.types";
|
|
16
|
+
export * from "./src/utils/types/SecurityService.types";
|
|
17
|
+
export * from "./src/utils/types/TransactionService.types";
|