@covalenthq/client-sdk 0.9.3 → 0.9.5
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/README.md +72 -51
- package/dist/cjs/index.js +59 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/BalanceService.d.ts +8 -6
- package/dist/cjs/services/BaseService.d.ts +12 -1
- package/dist/cjs/services/CovalentClient.d.ts +3 -3
- package/dist/cjs/services/NftService.d.ts +12 -8
- package/dist/cjs/services/PricingService.d.ts +13 -2
- package/dist/cjs/services/TransactionService.d.ts +13 -11
- package/dist/cjs/services/XykService.d.ts +50 -50
- package/dist/cjs/util/Chains.d.ts +29 -4
- package/dist/cjs/util/types/BalanceServiceTypes.d.ts +6 -14
- package/dist/cjs/util/types/BaseServiceTypes.d.ts +9 -1
- package/dist/cjs/util/types/GenericTypes.d.ts +12 -0
- package/dist/cjs/util/types/NftServiceTypes.d.ts +8 -8
- package/dist/cjs/util/types/PricingServiceTypes.d.ts +4 -2
- package/dist/cjs/util/types/TransactionServiceTypes.d.ts +10 -10
- package/dist/cjs/util/types/XykServiceTypes.d.ts +51 -51
- package/dist/es/index.js +59 -14
- package/dist/es/index.js.map +1 -1
- package/dist/es/services/BalanceService.d.ts +8 -6
- package/dist/es/services/BaseService.d.ts +12 -1
- package/dist/es/services/CovalentClient.d.ts +3 -3
- package/dist/es/services/NftService.d.ts +12 -8
- package/dist/es/services/PricingService.d.ts +13 -2
- package/dist/es/services/TransactionService.d.ts +13 -11
- package/dist/es/services/XykService.d.ts +50 -50
- package/dist/es/util/Chains.d.ts +29 -4
- package/dist/es/util/types/BalanceServiceTypes.d.ts +6 -14
- package/dist/es/util/types/BaseServiceTypes.d.ts +9 -1
- package/dist/es/util/types/GenericTypes.d.ts +12 -0
- package/dist/es/util/types/NftServiceTypes.d.ts +8 -8
- package/dist/es/util/types/PricingServiceTypes.d.ts +4 -2
- package/dist/es/util/types/TransactionServiceTypes.d.ts +10 -10
- package/dist/es/util/types/XykServiceTypes.d.ts +51 -51
- package/dist/esm/index.js +59 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/BalanceService.d.ts +8 -6
- package/dist/esm/services/BaseService.d.ts +12 -1
- package/dist/esm/services/CovalentClient.d.ts +3 -3
- package/dist/esm/services/NftService.d.ts +12 -8
- package/dist/esm/services/PricingService.d.ts +13 -2
- package/dist/esm/services/TransactionService.d.ts +13 -11
- package/dist/esm/services/XykService.d.ts +50 -50
- package/dist/esm/util/Chains.d.ts +29 -4
- package/dist/esm/util/types/BalanceServiceTypes.d.ts +6 -14
- package/dist/esm/util/types/BaseServiceTypes.d.ts +9 -1
- package/dist/esm/util/types/GenericTypes.d.ts +12 -0
- package/dist/esm/util/types/NftServiceTypes.d.ts +8 -8
- package/dist/esm/util/types/PricingServiceTypes.d.ts +4 -2
- package/dist/esm/util/types/TransactionServiceTypes.d.ts +10 -10
- package/dist/esm/util/types/XykServiceTypes.d.ts +51 -51
- package/dist/services/BalanceService.d.ts +8 -6
- package/dist/services/BalanceService.js +1 -0
- package/dist/services/BalanceService.js.map +1 -1
- package/dist/services/BaseService.d.ts +12 -1
- package/dist/services/BaseService.js +9 -1
- package/dist/services/BaseService.js.map +1 -1
- package/dist/services/CovalentClient.d.ts +3 -3
- package/dist/services/CovalentClient.js +1 -1
- package/dist/services/NftService.d.ts +12 -8
- package/dist/services/NftService.js +2 -0
- package/dist/services/NftService.js.map +1 -1
- package/dist/services/PricingService.d.ts +13 -2
- package/dist/services/PricingService.js +8 -0
- package/dist/services/PricingService.js.map +1 -1
- package/dist/services/TransactionService.d.ts +13 -11
- package/dist/services/TransactionService.js +1 -0
- package/dist/services/TransactionService.js.map +1 -1
- package/dist/services/XykService.d.ts +50 -50
- package/dist/services/XykService.js +6 -6
- package/dist/services/XykService.js.map +1 -1
- package/dist/util/Chains.d.ts +29 -4
- package/dist/util/Chains.js +28 -3
- package/dist/util/Chains.js.map +1 -1
- package/dist/util/types/BalanceServiceTypes.d.ts +6 -14
- package/dist/util/types/BaseServiceTypes.d.ts +9 -1
- package/dist/util/types/GenericTypes.d.ts +12 -0
- package/dist/util/types/NftServiceTypes.d.ts +8 -8
- package/dist/util/types/PricingServiceTypes.d.ts +4 -2
- package/dist/util/types/TransactionServiceTypes.d.ts +10 -10
- package/dist/util/types/XykServiceTypes.d.ts +51 -51
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,9 +17,9 @@ The Covalent SDK is the fastest way to integrate the Covalent Unified API for wo
|
|
|
17
17
|
|
|
18
18
|
**Note - Require `Node v18` and above for best results.**
|
|
19
19
|
|
|
20
|
-
> **
|
|
20
|
+
> **Sign up for an API Key**
|
|
21
21
|
>
|
|
22
|
-
>
|
|
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.
|
|
23
23
|
|
|
24
24
|
## Getting started
|
|
25
25
|
|
|
@@ -31,6 +31,10 @@ or
|
|
|
31
31
|
yarn add @covalenthq/client-sdk
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
## How to use the Covalent SDK
|
|
35
|
+
|
|
36
|
+
**Video Tutorial**: https://www.youtube.com/watch?v=XSpPJP2w62E&ab_channel=Covalent
|
|
37
|
+
|
|
34
38
|
After installing, you can import and use the SDK with:
|
|
35
39
|
|
|
36
40
|
```ts
|
|
@@ -39,47 +43,38 @@ import { CovalentClient, Chains } from "@covalenthq/client-sdk";
|
|
|
39
43
|
const ApiServices = async () => {
|
|
40
44
|
const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
console.log(respWithStringLiteral.data);
|
|
46
|
-
} else {
|
|
47
|
-
console.log(respWithStringLiteral.error_message);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Example call with enum
|
|
51
|
-
const respWithEnum = await client.BalanceService.getTokenBalancesForWalletAddress(Chains.ETH_MAINNET, "WALLET_ADDRESS");
|
|
52
|
-
if (!respWithEnum.error) {
|
|
53
|
-
console.log(respWithEnum.data);
|
|
46
|
+
const balanceResp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
|
|
47
|
+
if (!balanceResp.error) {
|
|
48
|
+
console.log(balanceResp.data);
|
|
54
49
|
} else {
|
|
55
|
-
console.log(
|
|
50
|
+
console.log(balanceResp.error_message);
|
|
56
51
|
}
|
|
57
52
|
}
|
|
58
53
|
```
|
|
59
|
-
|
|
60
|
-
> **Getting an API Key**
|
|
54
|
+
> **Name Resolution**
|
|
61
55
|
>
|
|
62
|
-
>
|
|
63
|
-
|
|
64
|
-
Note about a **ℹ️ BREAKING CHANGE**:
|
|
56
|
+
> 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`)
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
**ℹ️ BREAKING CHANGE**
|
|
59
|
+
> If you have been importing with `Client`:
|
|
60
|
+
```ts
|
|
61
|
+
import { Client } from "@covalenthq/client-sdk";
|
|
62
|
+
```
|
|
71
63
|
>
|
|
72
|
-
>
|
|
64
|
+
> Please change to `CovalentClient`:
|
|
65
|
+
```ts
|
|
66
|
+
import { CovalentClient } from "@covalenthq/client-sdk";
|
|
67
|
+
```
|
|
73
68
|
|
|
74
|
-
###
|
|
69
|
+
### How to apply supported query parameters to endpoints
|
|
75
70
|
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.
|
|
76
71
|
|
|
77
72
|
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:
|
|
78
73
|
```ts
|
|
79
74
|
const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS", {quoteCurrency: "CAD", nft: true});
|
|
80
75
|
```
|
|
81
|
-
|
|
82
|
-
You can import
|
|
76
|
+
### Assign Types
|
|
77
|
+
You can import types for each endpoint, found here `src/util/types/`. Here is an example:
|
|
83
78
|
```ts
|
|
84
79
|
import { CovalentClient, BalancesResponse, BalanceItem } from "@covalenthq/client-sdk";
|
|
85
80
|
const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS", {quoteCurrency: "CAD", nft: true});
|
|
@@ -87,7 +82,30 @@ const data: BalancesResponse = resp.data; // `resp.data` in this case is of type
|
|
|
87
82
|
const items: BalanceItem[] = resp.data.items; // `resp.data.items` is of type `BalanceItem[]`
|
|
88
83
|
```
|
|
89
84
|
|
|
90
|
-
|
|
85
|
+
### Different ways to input chains in chain fields
|
|
86
|
+
We offer users three options for specifying a chain in the designated field:
|
|
87
|
+
|
|
88
|
+
1. String literal - directly inputting the chain name, such as `eth-mainnet`, with auto-completion functionality as the user types.
|
|
89
|
+
2. Chain Enum - utilizing the Chain enum `Chains.ETH_MAINNET`, which provides auto-suggestions as the user types in the chain field.
|
|
90
|
+
3. Chain Id - entering the ChainId as a numerical value.
|
|
91
|
+
|
|
92
|
+
Example with string literal
|
|
93
|
+
```ts
|
|
94
|
+
// Example call with string literal ("eth-mainnet")
|
|
95
|
+
const respWithStringLiteral = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
|
|
96
|
+
```
|
|
97
|
+
Example with Chain Enum
|
|
98
|
+
```ts
|
|
99
|
+
// Example call with enum (Chains.ETH_MAINNET)
|
|
100
|
+
const respWithEnum = await client.BalanceService.getTokenBalancesForWalletAddress(Chains.ETH_MAINNET, "WALLET_ADDRESS");
|
|
101
|
+
```
|
|
102
|
+
Example with Chain Id
|
|
103
|
+
```ts
|
|
104
|
+
// Example call with chain Id (1)
|
|
105
|
+
const respWithChainId = await client.BalanceService.getTokenBalancesForWalletAddress(1, "WALLET_ADDRESS");
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Supported Endpoints
|
|
91
109
|
|
|
92
110
|
The Covalent SDK provides comprehensive support for all Class A, Class B, and Pricing endpoints that are grouped under the following *Service* namespaces:
|
|
93
111
|
|
|
@@ -119,26 +137,6 @@ The `BalanceService` class refers to the [balances API endpoints](https://www.co
|
|
|
119
137
|
- `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)
|
|
120
138
|
- `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.
|
|
121
139
|
|
|
122
|
-
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.
|
|
123
|
-
|
|
124
|
-
```ts
|
|
125
|
-
import { CovalentClient, calculatePrettyBalance } from "@covalenthq/client-sdk";
|
|
126
|
-
|
|
127
|
-
const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
|
|
128
|
-
const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
|
|
129
|
-
const prettyBalance = calculatePrettyBalance(resp.data.items[0].balance, resp.data.items[0].contract_decimals);
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
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.
|
|
133
|
-
|
|
134
|
-
```ts
|
|
135
|
-
import { CovalentClient, prettifyCurrency } from "@covalenthq/client-sdk";
|
|
136
|
-
|
|
137
|
-
const client = new CovalentClient("YOUR_API_KEY"); // Replace with your Covalent API key.
|
|
138
|
-
const resp = await client.BalanceService.getTokenBalancesForWalletAddress("eth-mainnet", "WALLET_ADDRESS");
|
|
139
|
-
const prettyCurrency = prettifyCurrency(resp.data.items[0].quote_rate);
|
|
140
|
-
```
|
|
141
|
-
|
|
142
140
|
### BaseService
|
|
143
141
|
|
|
144
142
|
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/):
|
|
@@ -233,7 +231,30 @@ The `XykService` refers to the [Xy=k API endpoints](https://www.covalenthq.com/d
|
|
|
233
231
|
- `getEcosystemChartData()`: Get a 7d and 30d time-series chart of DEX activity. Includes volume and swap count.
|
|
234
232
|
- `getHealthData()`: Ping the health of xy=k endpoints to get the synced block height per chain.
|
|
235
233
|
|
|
236
|
-
##
|
|
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
|
|
237
258
|
|
|
238
259
|
The following endpoints support pagination:
|
|
239
260
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -555,18 +555,18 @@ class BalanceItem {
|
|
|
555
555
|
this.quote_24h = data.quote_24h;
|
|
556
556
|
this.pretty_quote = data.pretty_quote;
|
|
557
557
|
this.pretty_quote_24h = data.pretty_quote_24h;
|
|
558
|
-
this.logo_urls = data.logo_urls && data.logo_urls !== null ? new LogoUrls(data.logo_urls) : null;
|
|
558
|
+
this.logo_urls = data.logo_urls && data.logo_urls !== null ? new LogoUrls$1(data.logo_urls) : null;
|
|
559
559
|
this.protocol_metadata = data.protocol_metadata && data.protocol_metadata !== null ? new ProtocolMetadata(data.protocol_metadata) : null;
|
|
560
560
|
this.nft_data = data.nft_data && data.nft_data !== null ? data.nft_data.map((itemData) => new NftData$1(itemData)) : null;
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
class LogoUrls {
|
|
563
|
+
let LogoUrls$1 = class LogoUrls {
|
|
564
564
|
constructor(data) {
|
|
565
565
|
this.token_logo_url = data.token_logo_url;
|
|
566
566
|
this.protocol_logo_url = data.protocol_logo_url;
|
|
567
567
|
this.chain_logo_url = data.chain_logo_url;
|
|
568
568
|
}
|
|
569
|
-
}
|
|
569
|
+
};
|
|
570
570
|
class ProtocolMetadata {
|
|
571
571
|
constructor(data) {
|
|
572
572
|
this.protocol_name = data.protocol_name;
|
|
@@ -577,6 +577,7 @@ let NftData$1 = class NftData {
|
|
|
577
577
|
this.token_id = data.token_id && data.token_id !== null ? BigInt(data.token_id) : null;
|
|
578
578
|
this.token_url = data.token_url;
|
|
579
579
|
this.original_owner = data.original_owner;
|
|
580
|
+
this.current_owner = data.current_owner;
|
|
580
581
|
this.asset_cached = data.asset_cached;
|
|
581
582
|
this.image_cached = data.image_cached;
|
|
582
583
|
this.external_data = data.external_data && data.external_data !== null ? new NftExternalData$1(data.external_data) : null;
|
|
@@ -1514,10 +1515,16 @@ class BlockHeightsResponse {
|
|
|
1514
1515
|
this.updated_at = data.updated_at && data.updated_at !== null ? dateFns.parseISO(data.updated_at.toString()) : null;
|
|
1515
1516
|
this.chain_id = data.chain_id;
|
|
1516
1517
|
this.chain_name = data.chain_name;
|
|
1517
|
-
this.items = data.items && data.items !== null ? data.items.map((itemData) => new
|
|
1518
|
+
this.items = data.items && data.items !== null ? data.items.map((itemData) => new BlockHeights(itemData)) : null;
|
|
1518
1519
|
this.pagination = data.pagination && data.pagination !== null ? new Pagination$2(data.pagination) : null;
|
|
1519
1520
|
}
|
|
1520
1521
|
}
|
|
1522
|
+
class BlockHeights {
|
|
1523
|
+
constructor(data) {
|
|
1524
|
+
this.signed_at = data.signed_at && data.signed_at !== null ? dateFns.parseISO(data.signed_at.toString()) : null;
|
|
1525
|
+
this.height = data.height;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1521
1528
|
let Pagination$2 = class Pagination {
|
|
1522
1529
|
constructor(data) {
|
|
1523
1530
|
this.has_more = data.has_more;
|
|
@@ -1549,6 +1556,7 @@ class GetLogsEvent {
|
|
|
1549
1556
|
this.sender_address = data.sender_address;
|
|
1550
1557
|
this.sender_address_label = data.sender_address_label;
|
|
1551
1558
|
this.sender_logo_url = data.sender_logo_url;
|
|
1559
|
+
this.sender_factory_address = data.sender_factory_address;
|
|
1552
1560
|
this.raw_log_data = data.raw_log_data;
|
|
1553
1561
|
this.decoded = data.decoded && data.decoded !== null ? new DecodedItem$2(data.decoded) : null;
|
|
1554
1562
|
}
|
|
@@ -1592,6 +1600,7 @@ let LogEvent$2 = class LogEvent {
|
|
|
1592
1600
|
this.sender_address = data.sender_address;
|
|
1593
1601
|
this.sender_address_label = data.sender_address_label;
|
|
1594
1602
|
this.sender_logo_url = data.sender_logo_url;
|
|
1603
|
+
this.sender_factory_address = data.sender_factory_address;
|
|
1595
1604
|
this.raw_log_data = data.raw_log_data;
|
|
1596
1605
|
this.decoded = data.decoded && data.decoded !== null ? new DecodedItem$2(data.decoded) : null;
|
|
1597
1606
|
}
|
|
@@ -2708,6 +2717,7 @@ class NftData {
|
|
|
2708
2717
|
this.token_id = data.token_id && data.token_id !== null ? BigInt(data.token_id) : null;
|
|
2709
2718
|
this.token_url = data.token_url;
|
|
2710
2719
|
this.original_owner = data.original_owner;
|
|
2720
|
+
this.current_owner = data.current_owner;
|
|
2711
2721
|
this.asset_cached = data.asset_cached;
|
|
2712
2722
|
this.image_cached = data.image_cached;
|
|
2713
2723
|
this.external_data = data.external_data && data.external_data !== null ? new NftExternalData(data.external_data) : null;
|
|
@@ -2811,6 +2821,7 @@ let LogEvent$1 = class LogEvent {
|
|
|
2811
2821
|
this.sender_address = data.sender_address;
|
|
2812
2822
|
this.sender_address_label = data.sender_address_label;
|
|
2813
2823
|
this.sender_logo_url = data.sender_logo_url;
|
|
2824
|
+
this.sender_factory_address = data.sender_factory_address;
|
|
2814
2825
|
this.raw_log_data = data.raw_log_data;
|
|
2815
2826
|
this.decoded = data.decoded && data.decoded !== null ? new DecodedItem$1(data.decoded) : null;
|
|
2816
2827
|
}
|
|
@@ -4142,10 +4153,18 @@ class TokenPricesResponse {
|
|
|
4142
4153
|
this.logo_url = data.logo_url;
|
|
4143
4154
|
this.update_at = data.update_at && data.update_at !== null ? dateFns.parseISO(data.update_at.toString()) : null;
|
|
4144
4155
|
this.quote_currency = data.quote_currency;
|
|
4156
|
+
this.logo_urls = data.logo_urls && data.logo_urls !== null ? new LogoUrls(data.logo_urls) : null;
|
|
4145
4157
|
this.prices = data.prices && data.prices !== null ? data.prices.map((itemData) => new Price(itemData)) : null;
|
|
4146
4158
|
this.items = data.items && data.items !== null ? data.items.map((itemData) => new Price(itemData)) : null;
|
|
4147
4159
|
}
|
|
4148
4160
|
}
|
|
4161
|
+
class LogoUrls {
|
|
4162
|
+
constructor(data) {
|
|
4163
|
+
this.token_logo_url = data.token_logo_url;
|
|
4164
|
+
this.protocol_logo_url = data.protocol_logo_url;
|
|
4165
|
+
this.chain_logo_url = data.chain_logo_url;
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4149
4168
|
class Price {
|
|
4150
4169
|
constructor(data) {
|
|
4151
4170
|
this.date = data.date && data.date !== null ? dateFns.parseISO(data.date.toString()) : null;
|
|
@@ -4459,6 +4478,7 @@ class LogEvent {
|
|
|
4459
4478
|
this.sender_address = data.sender_address;
|
|
4460
4479
|
this.sender_address_label = data.sender_address_label;
|
|
4461
4480
|
this.sender_logo_url = data.sender_logo_url;
|
|
4481
|
+
this.sender_factory_address = data.sender_factory_address;
|
|
4462
4482
|
this.raw_log_data = data.raw_log_data;
|
|
4463
4483
|
this.decoded = data.decoded && data.decoded !== null ? new DecodedItem(data.decoded) : null;
|
|
4464
4484
|
}
|
|
@@ -6082,7 +6102,7 @@ class VolumeTimeseries {
|
|
|
6082
6102
|
constructor(data) {
|
|
6083
6103
|
this.dex_name = data.dex_name;
|
|
6084
6104
|
this.chain_id = data.chain_id;
|
|
6085
|
-
this.dt = data.dt;
|
|
6105
|
+
this.dt = data.dt && data.dt !== null ? dateFns.parseISO(data.dt.toString()) : null;
|
|
6086
6106
|
this.exchange = data.exchange;
|
|
6087
6107
|
this.sum_amount0in = data.sum_amount0in;
|
|
6088
6108
|
this.sum_amount0out = data.sum_amount0out;
|
|
@@ -6099,7 +6119,7 @@ class LiquidityTimeseries {
|
|
|
6099
6119
|
constructor(data) {
|
|
6100
6120
|
this.dex_name = data.dex_name;
|
|
6101
6121
|
this.chain_id = data.chain_id;
|
|
6102
|
-
this.dt = data.dt;
|
|
6122
|
+
this.dt = data.dt && data.dt !== null ? dateFns.parseISO(data.dt.toString()) : null;
|
|
6103
6123
|
this.exchange = data.exchange;
|
|
6104
6124
|
this.r0_c = data.r0_c;
|
|
6105
6125
|
this.r1_c = data.r1_c;
|
|
@@ -6113,7 +6133,7 @@ class PriceTimeseries {
|
|
|
6113
6133
|
constructor(data) {
|
|
6114
6134
|
this.dex_name = data.dex_name;
|
|
6115
6135
|
this.chain_id = data.chain_id;
|
|
6116
|
-
this.dt = data.dt;
|
|
6136
|
+
this.dt = data.dt && data.dt !== null ? dateFns.parseISO(data.dt.toString()) : null;
|
|
6117
6137
|
this.exchange = data.exchange;
|
|
6118
6138
|
this.price_of_token0_in_token1 = data.price_of_token0_in_token1;
|
|
6119
6139
|
this.pretty_price_of_token0_in_token1 = data.pretty_price_of_token0_in_token1;
|
|
@@ -6288,7 +6308,7 @@ class VolumeTokenTimeseries {
|
|
|
6288
6308
|
constructor(data) {
|
|
6289
6309
|
this.dex_name = data.dex_name;
|
|
6290
6310
|
this.chain_id = data.chain_id;
|
|
6291
|
-
this.dt = data.dt;
|
|
6311
|
+
this.dt = data.dt && data.dt !== null ? dateFns.parseISO(data.dt.toString()) : null;
|
|
6292
6312
|
this.total_volume = data.total_volume;
|
|
6293
6313
|
this.volume_quote = data.volume_quote;
|
|
6294
6314
|
this.pretty_volume_quote = data.pretty_volume_quote;
|
|
@@ -6298,7 +6318,7 @@ class LiquidityTokenTimeseries {
|
|
|
6298
6318
|
constructor(data) {
|
|
6299
6319
|
this.dex_name = data.dex_name;
|
|
6300
6320
|
this.chain_id = data.chain_id;
|
|
6301
|
-
this.dt = data.dt;
|
|
6321
|
+
this.dt = data.dt && data.dt !== null ? dateFns.parseISO(data.dt.toString()) : null;
|
|
6302
6322
|
this.total_liquidity = data.total_liquidity;
|
|
6303
6323
|
this.liquidity_quote = data.liquidity_quote;
|
|
6304
6324
|
this.pretty_liquidity_quote = data.pretty_liquidity_quote;
|
|
@@ -6308,7 +6328,7 @@ class PriceTokenTimeseries {
|
|
|
6308
6328
|
constructor(data) {
|
|
6309
6329
|
this.dex_name = data.dex_name;
|
|
6310
6330
|
this.chain_id = data.chain_id;
|
|
6311
|
-
this.dt = data.dt;
|
|
6331
|
+
this.dt = data.dt && data.dt !== null ? dateFns.parseISO(data.dt.toString()) : null;
|
|
6312
6332
|
this.quote_currency = data.quote_currency;
|
|
6313
6333
|
this.quote_rate = data.quote_rate;
|
|
6314
6334
|
this.pretty_quote_rate = data.pretty_quote_rate;
|
|
@@ -7773,7 +7793,7 @@ class XykService {
|
|
|
7773
7793
|
}
|
|
7774
7794
|
}
|
|
7775
7795
|
|
|
7776
|
-
const userAgent = "com.covalenthq.sdk.typescript/0.9.
|
|
7796
|
+
const userAgent = "com.covalenthq.sdk.typescript/0.9.5";
|
|
7777
7797
|
class Response {
|
|
7778
7798
|
}
|
|
7779
7799
|
/**
|
|
@@ -7949,10 +7969,10 @@ exports.Chains = void 0;
|
|
|
7949
7969
|
Chains["HECO_TESTNET"] = "heco-testnet";
|
|
7950
7970
|
Chains["NERVOS_GODWOKEN_TESTNET"] = "nervos-godwoken-testnet";
|
|
7951
7971
|
Chains["EVMOS_TESTNET"] = "evmos-testnet";
|
|
7952
|
-
Chains["ASTAR_SHIDEN"] = "astar-shiden";
|
|
7953
7972
|
Chains["IOTEX_TESTNET"] = "iotex-testnet";
|
|
7954
7973
|
Chains["HARMONY_TESTNET"] = "harmony-testnet";
|
|
7955
7974
|
Chains["AURORA_TESTNET"] = "aurora-testnet";
|
|
7975
|
+
Chains["SCROLL_L2_TESTNET"] = "scroll-l2-testnet";
|
|
7956
7976
|
Chains["SCROLL_SEPOLIA_TESTNET"] = "scroll-sepolia-testnet";
|
|
7957
7977
|
Chains["COVALENT_INTERNAL_NETWORK_V1"] = "covalent-internal-network-v1";
|
|
7958
7978
|
Chains["DEFI_KINGDOMS_MAINNET"] = "defi-kingdoms-mainnet";
|
|
@@ -8023,13 +8043,13 @@ exports.Chains = void 0;
|
|
|
8023
8043
|
Chains["HORIZEN_GOBI_TESTNET"] = "horizen-gobi-testnet";
|
|
8024
8044
|
Chains["ETH_SEPOLIA"] = "eth-sepolia";
|
|
8025
8045
|
Chains["SKALE_NEBULA"] = "skale-nebula";
|
|
8026
|
-
Chains["
|
|
8046
|
+
Chains["SKALE_BATTLEGROUND"] = "skale-battleground";
|
|
8027
8047
|
Chains["AVALANCHE_MELD_TESTNET"] = "avalanche-meld-testnet";
|
|
8028
8048
|
Chains["GUNZILLA_TESTNET"] = "gunzilla-testnet";
|
|
8029
8049
|
Chains["ULTRON_MAINNET"] = "ultron-mainnet";
|
|
8030
8050
|
Chains["ULTRON_TESTNET"] = "ultron-testnet";
|
|
8031
8051
|
Chains["ZORA_MAINNET"] = "zora-mainnet";
|
|
8032
|
-
Chains["
|
|
8052
|
+
Chains["ZORA_GOERLI_TESTNET"] = "zora-goerli-testnet";
|
|
8033
8053
|
Chains["NEON_MAINNET"] = "neon-mainnet";
|
|
8034
8054
|
Chains["AVALANCHE_SHRAPNEL_MAINNET"] = "avalanche-shrapnel-mainnet";
|
|
8035
8055
|
Chains["BASE_MAINNET"] = "base-mainnet";
|
|
@@ -8109,6 +8129,31 @@ exports.Chains = void 0;
|
|
|
8109
8129
|
Chains["AVALANCHE_BEAM_MAINNET"] = "avalanche-beam-mainnet";
|
|
8110
8130
|
Chains["SCROLL_MAINNET"] = "scroll-mainnet";
|
|
8111
8131
|
Chains["ETH_HOLESKY"] = "eth-holesky";
|
|
8132
|
+
Chains["TOMOCHAIN_MAINNET"] = "tomochain-mainnet";
|
|
8133
|
+
Chains["TOMOCHAIN_TESTNET"] = "tomochain-testnet";
|
|
8134
|
+
Chains["AVALANCHE_JONO11_TESTNET"] = "avalanche-jono11-testnet";
|
|
8135
|
+
Chains["BASE_SEPOLIA_TESTNET"] = "base-sepolia-testnet";
|
|
8136
|
+
Chains["XAI_TESTNET"] = "xai-testnet";
|
|
8137
|
+
Chains["ARBITRUM_SEPOLIA"] = "arbitrum-sepolia";
|
|
8138
|
+
Chains["LUMOZ_PUBLIC_ZKSYNC_V2"] = "lumoz-public-zksync-v2";
|
|
8139
|
+
Chains["LUMOZ_DECIBLING"] = "lumoz-decibling";
|
|
8140
|
+
Chains["LUMOZ_STARK_SPORT"] = "lumoz-stark-sport";
|
|
8141
|
+
Chains["AVALANCHE_LT0_TESTNET"] = "avalanche-lt0-testnet";
|
|
8142
|
+
Chains["AVALANCHE_LT1_TESTNET"] = "avalanche-lt1-testnet";
|
|
8143
|
+
Chains["AVALANCHE_LT2_TESTNET"] = "avalanche-lt2-testnet";
|
|
8144
|
+
Chains["AVALANCHE_LT3_TESTNET"] = "avalanche-lt3-testnet";
|
|
8145
|
+
Chains["AVALANCHE_LT4_TESTNET"] = "avalanche-lt4-testnet";
|
|
8146
|
+
Chains["AVALANCHE_LT5_TESTNET"] = "avalanche-lt5-testnet";
|
|
8147
|
+
Chains["SYNDR_TESTNET"] = "syndr-testnet";
|
|
8148
|
+
Chains["CROSSFI_EVM_TESTNET"] = "crossfi-evm-testnet";
|
|
8149
|
+
Chains["CELO_MAINNET"] = "celo-mainnet";
|
|
8150
|
+
Chains["TAIKO_KATLA_TESTNET"] = "taiko-katla-testnet";
|
|
8151
|
+
Chains["MOVEMENT_MEVM_TESTNET"] = "movement-mevm-testnet";
|
|
8152
|
+
Chains["ZORA_SEPOLIA_TESTNET"] = "zora-sepolia-testnet";
|
|
8153
|
+
Chains["MERLIN_MAINNET"] = "merlin-mainnet";
|
|
8154
|
+
Chains["MERLIN_TESTNET"] = "merlin-testnet";
|
|
8155
|
+
Chains["AVALANCHE_HUBBLE_EXCHANGE_MAINNET"] = "avalanche-hubble-exchange-mainnet";
|
|
8156
|
+
Chains["XAI_MAINNET"] = "xai-mainnet";
|
|
8112
8157
|
})(exports.Chains || (exports.Chains = {}));
|
|
8113
8158
|
|
|
8114
8159
|
exports.BalanceService = BalanceService;
|