@covalenthq/client-sdk 0.6.6 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -5
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +758 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/BalanceService.d.ts +11 -9
- package/dist/cjs/services/BaseService.d.ts +65 -11
- package/dist/cjs/services/CovalentClient.d.ts +3 -15
- package/dist/cjs/services/NftService.d.ts +18 -16
- package/dist/cjs/services/PricingService.d.ts +4 -2
- package/dist/cjs/services/SecurityService.d.ts +5 -3
- package/dist/cjs/services/TransactionService.d.ts +12 -10
- package/dist/cjs/services/XykService.d.ts +16 -14
- package/dist/cjs/util/ApiKeyValidator.d.ts +8 -0
- package/dist/cjs/util/Chains.d.ts +180 -0
- package/dist/cjs/util/types/BaseServiceTypes.d.ts +36 -0
- package/dist/cjs/util/types/TransactionServiceTypes.d.ts +3 -3
- package/dist/es/index.d.ts +2 -1
- package/dist/es/index.js +759 -26
- package/dist/es/index.js.map +1 -1
- package/dist/es/services/BalanceService.d.ts +11 -9
- package/dist/es/services/BaseService.d.ts +65 -11
- package/dist/es/services/CovalentClient.d.ts +3 -15
- package/dist/es/services/NftService.d.ts +18 -16
- package/dist/es/services/PricingService.d.ts +4 -2
- package/dist/es/services/SecurityService.d.ts +5 -3
- package/dist/es/services/TransactionService.d.ts +12 -10
- package/dist/es/services/XykService.d.ts +16 -14
- package/dist/es/util/ApiKeyValidator.d.ts +8 -0
- package/dist/es/util/Chains.d.ts +180 -0
- package/dist/es/util/types/BaseServiceTypes.d.ts +36 -0
- package/dist/es/util/types/TransactionServiceTypes.d.ts +3 -3
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +759 -26
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/BalanceService.d.ts +11 -9
- package/dist/esm/services/BaseService.d.ts +65 -11
- package/dist/esm/services/CovalentClient.d.ts +3 -15
- package/dist/esm/services/NftService.d.ts +18 -16
- package/dist/esm/services/PricingService.d.ts +4 -2
- package/dist/esm/services/SecurityService.d.ts +5 -3
- package/dist/esm/services/TransactionService.d.ts +12 -10
- package/dist/esm/services/XykService.d.ts +16 -14
- package/dist/esm/util/ApiKeyValidator.d.ts +8 -0
- package/dist/esm/util/Chains.d.ts +180 -0
- package/dist/esm/util/types/BaseServiceTypes.d.ts +36 -0
- package/dist/esm/util/types/TransactionServiceTypes.d.ts +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/services/BalanceService.d.ts +11 -9
- package/dist/services/BalanceService.js +57 -1
- package/dist/services/BalanceService.js.map +1 -1
- package/dist/services/BaseService.d.ts +65 -11
- package/dist/services/BaseService.js +187 -1
- package/dist/services/BaseService.js.map +1 -1
- package/dist/services/CovalentClient.d.ts +3 -15
- package/dist/services/CovalentClient.js +20 -15
- package/dist/services/CovalentClient.js.map +1 -1
- package/dist/services/NftService.d.ts +18 -16
- package/dist/services/NftService.js +113 -1
- package/dist/services/NftService.js.map +1 -1
- package/dist/services/PricingService.d.ts +4 -2
- package/dist/services/PricingService.js +11 -1
- package/dist/services/PricingService.js.map +1 -1
- package/dist/services/SecurityService.d.ts +5 -3
- package/dist/services/SecurityService.js +19 -1
- package/dist/services/SecurityService.js.map +1 -1
- package/dist/services/TransactionService.d.ts +12 -10
- package/dist/services/TransactionService.js +49 -4
- package/dist/services/TransactionService.js.map +1 -1
- package/dist/services/XykService.d.ts +16 -14
- package/dist/services/XykService.js +115 -1
- package/dist/services/XykService.js.map +1 -1
- package/dist/util/ApiKeyValidator.d.ts +8 -0
- package/dist/util/ApiKeyValidator.js +13 -0
- package/dist/util/ApiKeyValidator.js.map +1 -0
- package/dist/util/Chains.d.ts +180 -0
- package/dist/util/Chains.js +182 -0
- package/dist/util/Chains.js.map +1 -0
- package/dist/util/types/BaseServiceTypes.d.ts +36 -0
- package/dist/util/types/TransactionServiceTypes.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Chain, Quote, Response } from "./CovalentClient";
|
|
2
|
+
import { Chains } from "../util/Chains";
|
|
2
3
|
declare class PoolResponse {
|
|
3
4
|
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
4
5
|
updated_at: Date;
|
|
@@ -543,8 +544,9 @@ export declare class XykService {
|
|
|
543
544
|
private apiKey;
|
|
544
545
|
private debug;
|
|
545
546
|
private threadCount;
|
|
547
|
+
private is_key_valid;
|
|
546
548
|
private LIMIT;
|
|
547
|
-
constructor(apiKey: string, debug
|
|
549
|
+
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean);
|
|
548
550
|
/**
|
|
549
551
|
*
|
|
550
552
|
* Commonly used to 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).
|
|
@@ -553,7 +555,7 @@ export declare class XykService {
|
|
|
553
555
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
554
556
|
*
|
|
555
557
|
*/
|
|
556
|
-
getPools(chainName: Chain, dexName: string): Promise<Response<PoolResponse>>;
|
|
558
|
+
getPools(chainName: Chain | Chains, dexName: string): Promise<Response<PoolResponse>>;
|
|
557
559
|
/**
|
|
558
560
|
*
|
|
559
561
|
* Commonly used to get the corresponding 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.
|
|
@@ -562,7 +564,7 @@ export declare class XykService {
|
|
|
562
564
|
* @param {string} poolAddress - The requested pool address.
|
|
563
565
|
*
|
|
564
566
|
*/
|
|
565
|
-
getDexForPoolAddress(chainName: Chain, poolAddress: string): Promise<Response<PoolToDexResponse>>;
|
|
567
|
+
getDexForPoolAddress(chainName: Chain | Chains, poolAddress: string): Promise<Response<PoolToDexResponse>>;
|
|
566
568
|
/**
|
|
567
569
|
*
|
|
568
570
|
* Commonly used to 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.
|
|
@@ -572,7 +574,7 @@ export declare class XykService {
|
|
|
572
574
|
* @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
573
575
|
*
|
|
574
576
|
*/
|
|
575
|
-
getPoolByAddress(chainName: Chain, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
|
|
577
|
+
getPoolByAddress(chainName: Chain | Chains, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
|
|
576
578
|
/**
|
|
577
579
|
*
|
|
578
580
|
* Commonly used to 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.
|
|
@@ -584,7 +586,7 @@ export declare class XykService {
|
|
|
584
586
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
585
587
|
*
|
|
586
588
|
*/
|
|
587
|
-
getPoolsForTokenAddress(chainName: Chain, tokenAddress: string, page: number, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
|
|
589
|
+
getPoolsForTokenAddress(chainName: Chain | Chains, tokenAddress: string, page: number, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
|
|
588
590
|
/**
|
|
589
591
|
*
|
|
590
592
|
* Commonly used to return balance of a wallet/contract address on a specific DEX.
|
|
@@ -594,7 +596,7 @@ export declare class XykService {
|
|
|
594
596
|
* @param {string} accountAddress - The account address.
|
|
595
597
|
*
|
|
596
598
|
*/
|
|
597
|
-
getAddressExchangeBalances(chainName: Chain, dexName: string, accountAddress: string): Promise<Response<AddressExchangeBalancesResponse>>;
|
|
599
|
+
getAddressExchangeBalances(chainName: Chain | Chains, dexName: string, accountAddress: string): Promise<Response<AddressExchangeBalancesResponse>>;
|
|
598
600
|
/**
|
|
599
601
|
*
|
|
600
602
|
* Commonly used to 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.
|
|
@@ -607,7 +609,7 @@ export declare class XykService {
|
|
|
607
609
|
* - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
|
|
608
610
|
*
|
|
609
611
|
*/
|
|
610
|
-
getPoolsForWalletAddress(chainName: Chain, walletAddress: string, page: number, queryParamOpts?: GetPoolsForWalletAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
|
|
612
|
+
getPoolsForWalletAddress(chainName: Chain | Chains, walletAddress: string, page: number, queryParamOpts?: GetPoolsForWalletAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
|
|
611
613
|
/**
|
|
612
614
|
*
|
|
613
615
|
* Commonly used to retrieve all network exchange tokens for a specific DEX. Useful for building a top tokens table by total liquidity within a particular DEX.
|
|
@@ -616,7 +618,7 @@ export declare class XykService {
|
|
|
616
618
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
617
619
|
*
|
|
618
620
|
*/
|
|
619
|
-
getNetworkExchangeTokens(chainName: Chain, dexName: string): Promise<Response<NetworkExchangeTokensResponse>>;
|
|
621
|
+
getNetworkExchangeTokens(chainName: Chain | Chains, dexName: string): Promise<Response<NetworkExchangeTokensResponse>>;
|
|
620
622
|
/**
|
|
621
623
|
*
|
|
622
624
|
* Commonly used to get all the supported DEXs available for the xy=k endpoints, along with the swap fees and factory addresses.
|
|
@@ -633,7 +635,7 @@ export declare class XykService {
|
|
|
633
635
|
* @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
634
636
|
*
|
|
635
637
|
*/
|
|
636
|
-
getSingleNetworkExchangeToken(chainName: Chain, dexName: string, tokenAddress: string): Promise<Response<SingleNetworkExchangeTokenResponse>>;
|
|
638
|
+
getSingleNetworkExchangeToken(chainName: Chain | Chains, dexName: string, tokenAddress: string): Promise<Response<SingleNetworkExchangeTokenResponse>>;
|
|
637
639
|
/**
|
|
638
640
|
*
|
|
639
641
|
* Commonly used to get all the DEX transactions of a wallet. Useful for building tables of DEX activity segmented by wallet.
|
|
@@ -643,7 +645,7 @@ export declare class XykService {
|
|
|
643
645
|
* @param {string} accountAddress - The account address. Passing in an `ENS` or `RNS` resolves automatically.
|
|
644
646
|
*
|
|
645
647
|
*/
|
|
646
|
-
getTransactionsForAccountAddress(chainName: Chain, dexName: string, accountAddress: string): Promise<Response<TransactionsForAccountAddressResponse>>;
|
|
648
|
+
getTransactionsForAccountAddress(chainName: Chain | Chains, dexName: string, accountAddress: string): Promise<Response<TransactionsForAccountAddressResponse>>;
|
|
647
649
|
/**
|
|
648
650
|
*
|
|
649
651
|
* Commonly used to get all the transactions of a token within a particular DEX. Useful for getting a per-token view of DEX activity.
|
|
@@ -653,7 +655,7 @@ export declare class XykService {
|
|
|
653
655
|
* @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
654
656
|
*
|
|
655
657
|
*/
|
|
656
|
-
getTransactionsForTokenAddress(chainName: Chain, dexName: string, tokenAddress: string): Promise<Response<TransactionsForTokenAddressResponse>>;
|
|
658
|
+
getTransactionsForTokenAddress(chainName: Chain | Chains, dexName: string, tokenAddress: string): Promise<Response<TransactionsForTokenAddressResponse>>;
|
|
657
659
|
/**
|
|
658
660
|
*
|
|
659
661
|
* Commonly used for getting all the transactions of a particular DEX liquidity pool. Useful for building a transactions history table for an individual pool.
|
|
@@ -663,7 +665,7 @@ export declare class XykService {
|
|
|
663
665
|
* @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
|
|
664
666
|
*
|
|
665
667
|
*/
|
|
666
|
-
getTransactionsForExchange(chainName: Chain, dexName: string, poolAddress: string): Promise<Response<TransactionsForExchangeResponse>>;
|
|
668
|
+
getTransactionsForExchange(chainName: Chain | Chains, dexName: string, poolAddress: string): Promise<Response<TransactionsForExchangeResponse>>;
|
|
667
669
|
/**
|
|
668
670
|
*
|
|
669
671
|
* Commonly used to get a 7d and 30d time-series chart of DEX activity. Includes volume and swap count.
|
|
@@ -672,7 +674,7 @@ export declare class XykService {
|
|
|
672
674
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
673
675
|
*
|
|
674
676
|
*/
|
|
675
|
-
getEcosystemChartData(chainName: Chain, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
|
|
677
|
+
getEcosystemChartData(chainName: Chain | Chains, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
|
|
676
678
|
/**
|
|
677
679
|
*
|
|
678
680
|
* Commonly used to ping the health of xy=k endpoints to get the synced block height per chain.
|
|
@@ -681,6 +683,6 @@ export declare class XykService {
|
|
|
681
683
|
* @param {string} dexName - The DEX name eg: `uniswap_v2`.
|
|
682
684
|
*
|
|
683
685
|
*/
|
|
684
|
-
getHealthData(chainName: Chain, dexName: string): Promise<Response<HealthDataResponse>>;
|
|
686
|
+
getHealthData(chainName: Chain | Chains, dexName: string): Promise<Response<HealthDataResponse>>;
|
|
685
687
|
}
|
|
686
688
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class ApiKeyValidator {
|
|
2
|
+
readonly _apiKey: string;
|
|
3
|
+
private static readonly _apiKeyV1Pattern;
|
|
4
|
+
private static readonly _apiKeyV2Pattern;
|
|
5
|
+
static readonly INVALID_API_KEY_MESSAGE = "Invalid or missing API key (sign up at covalenthq.com/platform)";
|
|
6
|
+
constructor(apiKey: string);
|
|
7
|
+
isValidApiKey(): boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
export declare enum Chains {
|
|
2
|
+
BTC_MAINNET = "btc-mainnet",
|
|
3
|
+
ETH_MAINNET = "eth-mainnet",
|
|
4
|
+
MATIC_MAINNET = "matic-mainnet",
|
|
5
|
+
BSC_MAINNET = "bsc-mainnet",
|
|
6
|
+
AVALANCHE_MAINNET = "avalanche-mainnet",
|
|
7
|
+
OPTIMISM_MAINNET = "optimism-mainnet",
|
|
8
|
+
FANTOM_MAINNET = "fantom-mainnet",
|
|
9
|
+
MOONBEAM_MAINNET = "moonbeam-mainnet",
|
|
10
|
+
MOONBEAM_MOONRIVER = "moonbeam-moonriver",
|
|
11
|
+
RSK_MAINNET = "rsk-mainnet",
|
|
12
|
+
ARBITRUM_MAINNET = "arbitrum-mainnet",
|
|
13
|
+
PALM_MAINNET = "palm-mainnet",
|
|
14
|
+
KLAYTN_MAINNET = "klaytn-mainnet",
|
|
15
|
+
HECO_MAINNET = "heco-mainnet",
|
|
16
|
+
NERVOS_GODWOKEN_MAINNET = "nervos-godwoken-mainnet",
|
|
17
|
+
AXIE_MAINNET = "axie-mainnet",
|
|
18
|
+
EVMOS_MAINNET = "evmos-mainnet",
|
|
19
|
+
ASTAR_MAINNET = "astar-mainnet",
|
|
20
|
+
IOTEX_MAINNET = "iotex-mainnet",
|
|
21
|
+
HARMONY_MAINNET = "harmony-mainnet",
|
|
22
|
+
CRONOS_MAINNET = "cronos-mainnet",
|
|
23
|
+
AURORA_MAINNET = "aurora-mainnet",
|
|
24
|
+
EMERALD_PARATIME_MAINNET = "emerald-paratime-mainnet",
|
|
25
|
+
BOBA_MAINNET = "boba-mainnet",
|
|
26
|
+
ETH_GOERLI = "eth-goerli",
|
|
27
|
+
MATIC_MUMBAI = "matic-mumbai",
|
|
28
|
+
AVALANCHE_TESTNET = "avalanche-testnet",
|
|
29
|
+
BSC_TESTNET = "bsc-testnet",
|
|
30
|
+
MOONBEAM_MOONBASE_ALPHA = "moonbeam-moonbase-alpha",
|
|
31
|
+
RSK_TESTNET = "rsk-testnet",
|
|
32
|
+
ARBITRUM_GOERLI = "arbitrum-goerli",
|
|
33
|
+
FANTOM_TESTNET = "fantom-testnet",
|
|
34
|
+
PALM_TESTNET = "palm-testnet",
|
|
35
|
+
HECO_TESTNET = "heco-testnet",
|
|
36
|
+
NERVOS_GODWOKEN_TESTNET = "nervos-godwoken-testnet",
|
|
37
|
+
EVMOS_TESTNET = "evmos-testnet",
|
|
38
|
+
ASTAR_SHIDEN = "astar-shiden",
|
|
39
|
+
IOTEX_TESTNET = "iotex-testnet",
|
|
40
|
+
HARMONY_TESTNET = "harmony-testnet",
|
|
41
|
+
AURORA_TESTNET = "aurora-testnet",
|
|
42
|
+
SCROLL_SEPOLIA_TESTNET = "scroll-sepolia-testnet",
|
|
43
|
+
COVALENT_INTERNAL_NETWORK_V1 = "covalent-internal-network-v1",
|
|
44
|
+
DEFI_KINGDOMS_MAINNET = "defi-kingdoms-mainnet",
|
|
45
|
+
SWIMMER_MAINNET = "swimmer-mainnet",
|
|
46
|
+
BOBA_AVALANCHE_MAINNET = "boba-avalanche-mainnet",
|
|
47
|
+
BOBA_BOBABEAM_MAINNET = "boba-bobabeam-mainnet",
|
|
48
|
+
BOBA_BNB_MAINNET = "boba-bnb-mainnet",
|
|
49
|
+
BOBA_RINKEBY_TESTNET = "boba-rinkeby-testnet",
|
|
50
|
+
BOBA_BOBABASE_TESTNET = "boba-bobabase-testnet",
|
|
51
|
+
BOBA_BNB_TESTNET = "boba-bnb-testnet",
|
|
52
|
+
BOBA_AVALANCHE_TESTNET = "boba-avalanche-testnet",
|
|
53
|
+
KLAYTN_TESTNET = "klaytn-testnet",
|
|
54
|
+
GATHER_MAINNET = "gather-mainnet",
|
|
55
|
+
GATHER_TESTNET = "gather-testnet",
|
|
56
|
+
SKALE_CALYPSO = "skale-calypso",
|
|
57
|
+
SKALE_MAINNET = "skale-mainnet",
|
|
58
|
+
SKALE_RAZOR = "skale-razor",
|
|
59
|
+
AVALANCHE_DEXALOT_MAINNET = "avalanche-dexalot-mainnet",
|
|
60
|
+
SKALE_OMNUS = "skale-omnus",
|
|
61
|
+
AVALANCHE_DEXALOT_TESTNET = "avalanche-dexalot-testnet",
|
|
62
|
+
ASTAR_SHIBUYA = "astar-shibuya",
|
|
63
|
+
CRONOS_TESTNET = "cronos-testnet",
|
|
64
|
+
DEFI_KINGDOMS_TESTNET = "defi-kingdoms-testnet",
|
|
65
|
+
METIS_MAINNET = "metis-mainnet",
|
|
66
|
+
METIS_STARDUST = "metis-stardust",
|
|
67
|
+
MILKOMEDA_A1_MAINNET = "milkomeda-a1-mainnet",
|
|
68
|
+
MILKOMEDA_A1_DEVNET = "milkomeda-a1-devnet",
|
|
69
|
+
MILKOMEDA_C1_MAINNET = "milkomeda-c1-mainnet",
|
|
70
|
+
MILKOMEDA_C1_DEVNET = "milkomeda-c1-devnet",
|
|
71
|
+
SWIMMER_TESTNET = "swimmer-testnet",
|
|
72
|
+
SOLANA_MAINNET = "solana-mainnet",
|
|
73
|
+
SKALE_EUROPA = "skale-europa",
|
|
74
|
+
METER_MAINNET = "meter-mainnet",
|
|
75
|
+
METER_TESTNET = "meter-testnet",
|
|
76
|
+
SKALE_EXORDE = "skale-exorde",
|
|
77
|
+
BOBA_GOERLI = "boba-goerli",
|
|
78
|
+
NEON_TESTNET = "neon-testnet",
|
|
79
|
+
SKALE_STAGING_UUM = "skale-staging-uum",
|
|
80
|
+
SKALE_STAGING_LCC = "skale-staging-lcc",
|
|
81
|
+
ARBITRUM_NOVA_MAINNET = "arbitrum-nova-mainnet",
|
|
82
|
+
CANTO_MAINNET = "canto-mainnet",
|
|
83
|
+
BITTORRENT_MAINNET = "bittorrent-mainnet",
|
|
84
|
+
BITTORRENT_TESTNET = "bittorrent-testnet",
|
|
85
|
+
FLARENETWORKS_FLARE_MAINNET = "flarenetworks-flare-mainnet",
|
|
86
|
+
FLARENETWORKS_FLARE_TESTNET = "flarenetworks-flare-testnet",
|
|
87
|
+
FLARENETWORKS_CANARY_MAINNET = "flarenetworks-canary-mainnet",
|
|
88
|
+
FLARENETWORKS_CANARY_TESTNET = "flarenetworks-canary-testnet",
|
|
89
|
+
KCC_MAINNET = "kcc-mainnet",
|
|
90
|
+
KCC_TESTNET = "kcc-testnet",
|
|
91
|
+
POLYGON_ZKEVM_TESTNET = "polygon-zkevm-testnet",
|
|
92
|
+
LINEA_TESTNET = "linea-testnet",
|
|
93
|
+
BASE_TESTNET = "base-testnet",
|
|
94
|
+
MANTLE_TESTNET = "mantle-testnet",
|
|
95
|
+
SCROLL_ALPHA_TESTNET = "scroll-alpha-testnet",
|
|
96
|
+
OASYS_MAINNET = "oasys-mainnet",
|
|
97
|
+
OASYS_TESTNET = "oasys-testnet",
|
|
98
|
+
FINDORA_MAINNET = "findora-mainnet",
|
|
99
|
+
FINDORA_FORGE_TESTNET = "findora-forge-testnet",
|
|
100
|
+
SX_MAINNET = "sx-mainnet",
|
|
101
|
+
OASIS_SAPPHIRE_MAINNET = "oasis-sapphire-mainnet",
|
|
102
|
+
OASIS_SAPPHIRE_TESTNET = "oasis-sapphire-testnet",
|
|
103
|
+
OPTIMISM_GOERLI = "optimism-goerli",
|
|
104
|
+
POLYGON_ZKEVM_MAINNET = "polygon-zkevm-mainnet",
|
|
105
|
+
HORIZEN_YUMA_TESTNET = "horizen-yuma-testnet",
|
|
106
|
+
CLV_PARACHAIN = "clv-parachain",
|
|
107
|
+
ENERGI_MAINNET = "energi-mainnet",
|
|
108
|
+
ENERGI_TESTNET = "energi-testnet",
|
|
109
|
+
HORIZEN_GOBI_TESTNET = "horizen-gobi-testnet",
|
|
110
|
+
ETH_SEPOLIA = "eth-sepolia",
|
|
111
|
+
SKALE_NEBULA = "skale-nebula",
|
|
112
|
+
SKALE_BATTLEGROUNDS = "skale-battleground",
|
|
113
|
+
AVALANCHE_MELD_TESTNET = "avalanche-meld-testnet",
|
|
114
|
+
GUNZILLA_TESTNET = "gunzilla-testnet",
|
|
115
|
+
ULTRON_MAINNET = "ultron-mainnet",
|
|
116
|
+
ULTRON_TESTNET = "ultron-testnet",
|
|
117
|
+
ZORA_MAINNET = "zora-mainnet",
|
|
118
|
+
ZORA_TESTNET = "zora-testnet",
|
|
119
|
+
NEON_MAINNET = "neon-mainnet",
|
|
120
|
+
AVALANCHE_SHRAPNEL_MAINNET = "avalanche-shrapnel-mainnet",
|
|
121
|
+
BASE_MAINNET = "base-mainnet",
|
|
122
|
+
MANTLE_MAINNET = "mantle-mainnet",
|
|
123
|
+
AVALANCHE_LOCO_LEGENDS_MAINNET = "avalanche-loco-legends-mainnet",
|
|
124
|
+
LINEA_MAINNET = "linea-mainnet",
|
|
125
|
+
HORIZEN_EON_MAINNET = "horizen-eon-mainnet",
|
|
126
|
+
AVALANCHE_NUMBERS = "avalanche-numbers",
|
|
127
|
+
AVALANCHE_DOS = "avalanche-dos",
|
|
128
|
+
AVALANCHE_STEP_NETWORK = "avalanche-step-network",
|
|
129
|
+
AVALANCHE_XPLUS = "avalanche-xplus",
|
|
130
|
+
AVALANCHE_XANACHAIN = "avalanche-xanachain",
|
|
131
|
+
AVALANCHE_MELD_MAINNET = "avalanche-meld-mainnet",
|
|
132
|
+
OPSIDE_PUBLIC_ZKEVM = "opside-public-zkevm",
|
|
133
|
+
OPSIDE_LAW_CHAIN = "opside-law-chain",
|
|
134
|
+
AVALANCHE_SHRAPNEL_TESTNET = "avalanche-shrapnel-testnet",
|
|
135
|
+
AVALANCHE_LOCO_LEGENDS_TESTNET = "avalanche-loco-legends-testnet",
|
|
136
|
+
OPSIDE_CB_ZKEVM = "opside-cb-zkevm",
|
|
137
|
+
OPSIDE_PRE_ALPHA_TESTNET = "opside-pre-alpha-testnet",
|
|
138
|
+
OPSIDE_ERA7 = "opside-era7",
|
|
139
|
+
OPSIDE_XTHRILL = "opside-xthrill",
|
|
140
|
+
ZKSYNC_MAINNET = "zksync-mainnet",
|
|
141
|
+
METIS_TESTNET = "metis-testnet",
|
|
142
|
+
ZKSYNC_TESTNET = "zksync-testnet",
|
|
143
|
+
AVALANCHE_BLITZ_TESTNET = "avalanche-blitz-testnet",
|
|
144
|
+
AVALANCHE_D_CHAIN_TESTNET = "avalanche-d-chain-testnet",
|
|
145
|
+
AVALANCHE_GREEN_DOT_TESTNET = "avalanche-green-dot-testnet",
|
|
146
|
+
AVALANCHE_MINTARA_TESTNET = "avalanche-mintara-testnet",
|
|
147
|
+
AVALANCHE_BEAM_TESTNET = "avalanche-beam-testnet",
|
|
148
|
+
BNB_META_APES_MAINNET = "bnb-meta-apes-mainnet",
|
|
149
|
+
BNB_ANTIMATTER_MAINNET = "bnb-antimatter-mainnet",
|
|
150
|
+
BNB_ANTIMATTER_TESTNET = "bnb-antimatter-testnet",
|
|
151
|
+
BNB_OPBNB_TESTNET = "bnb-opbnb-testnet",
|
|
152
|
+
OPSIDE_DEBOX = "opside-debox",
|
|
153
|
+
OPSIDE_JACKBOT = "opside-jackbot",
|
|
154
|
+
OPSIDE_ODX_ZKEVM_TESTNET = "opside-odx-zkevm-testnet",
|
|
155
|
+
OPSIDE_READON_CONTENT_TESTNET = "opside-readon-content-testnet",
|
|
156
|
+
OPSIDE_RELATION = "opside-relation",
|
|
157
|
+
OPSIDE_SOQUEST_ZKEVM = "opside-soquest-zkevm",
|
|
158
|
+
OPSIDE_VIP3 = "opside-vip3",
|
|
159
|
+
OPSIDE_ZKMETA = "opside-zkmeta",
|
|
160
|
+
AVALANCHE_PULSAR_TESTNET = "avalanche-pulsar-testnet",
|
|
161
|
+
AVALANCHE_UPTN = "avalanche-uptn",
|
|
162
|
+
BNB_FNCY_MAINNET = "bnb-fncy-mainnet",
|
|
163
|
+
ZETACHAIN_TESTNET = "zetachain-testnet",
|
|
164
|
+
KINTO_TESTNET = "kinto-testnet",
|
|
165
|
+
MODE_TESTNET = "mode-testnet",
|
|
166
|
+
LOOT_MAINNET = "loot-mainnet",
|
|
167
|
+
BNB_FNCY_TESTNET = "bnb-fncy-testnet",
|
|
168
|
+
MANTA_TESTNET = "manta-testnet",
|
|
169
|
+
PGN_MAINNET = "pgn-mainnet",
|
|
170
|
+
PGN_TESTNET = "pgn-testnet",
|
|
171
|
+
GNOSIS_MAINNET = "gnosis-mainnet",
|
|
172
|
+
GNOSIS_TESTNET = "gnosis-testnet",
|
|
173
|
+
ROLLUX_MAINNET = "rollux-mainnet",
|
|
174
|
+
ROLLUX_TESTNET = "rollux-testnet",
|
|
175
|
+
TAIKO_JOLNIR_TESTNET = "taiko-jolnir-testnet",
|
|
176
|
+
OPTIMISM_SEPOLIA = "optimism-sepolia",
|
|
177
|
+
BNB_OPBNB_MAINNET = "bnb-opbnb-mainnet",
|
|
178
|
+
TELOS_MAINNET = "telos-mainnet",
|
|
179
|
+
TELOS_TESTNET = "telos-testnet"
|
|
180
|
+
}
|
|
@@ -194,3 +194,39 @@ export interface ChainActivityEvent extends ChainItem {
|
|
|
194
194
|
/** * The timestamp when the address was last seen on the chain. */
|
|
195
195
|
last_seen_at: Date;
|
|
196
196
|
}
|
|
197
|
+
export interface GasPricesResponse {
|
|
198
|
+
/** * The requested chain ID eg: `1`. */
|
|
199
|
+
chain_id: number;
|
|
200
|
+
/** * The requested chain name eg: `eth-mainnet`. */
|
|
201
|
+
chain_name: string;
|
|
202
|
+
/** * The requested quote currency eg: `USD`. */
|
|
203
|
+
quote_currency: string;
|
|
204
|
+
/** * The timestamp when the response was generated. Useful to show data staleness to users. */
|
|
205
|
+
updated_at: Date;
|
|
206
|
+
/** * The requested event type. */
|
|
207
|
+
event_type: string;
|
|
208
|
+
/** * The exchange rate for the requested quote currency. */
|
|
209
|
+
gas_quote_rate: number;
|
|
210
|
+
/** * List of response items. */
|
|
211
|
+
items: PriceItem[];
|
|
212
|
+
}
|
|
213
|
+
export interface PriceItem {
|
|
214
|
+
/** * The average gas price, in WEI, for the time interval. */
|
|
215
|
+
gas_price: string;
|
|
216
|
+
/** * The average gas spent for the time interval. */
|
|
217
|
+
gas_spent: string;
|
|
218
|
+
/** * The average gas spent in `quote-currency` denomination for the time interval. */
|
|
219
|
+
gas_quote: number;
|
|
220
|
+
/** * Other fees, when applicable. For example: OP chain L1 fees. */
|
|
221
|
+
other_fees: OtherFees;
|
|
222
|
+
/** * The sum of the L1 and L2 gas spent, in quote-currency, for the specified time interval. */
|
|
223
|
+
total_gas_quote: number;
|
|
224
|
+
/** * A prettier version of the total average gas spent, in quote-currency, for the specified time interval, for rendering purposes. */
|
|
225
|
+
pretty_total_gas_quote: string;
|
|
226
|
+
/** * The specified time interval. */
|
|
227
|
+
interval: string;
|
|
228
|
+
}
|
|
229
|
+
export interface OtherFees {
|
|
230
|
+
/** * The calculated L1 gas spent, when applicable, in quote-currency, for the specified time interval. */
|
|
231
|
+
l1_gas_quote: number;
|
|
232
|
+
}
|
|
@@ -56,11 +56,11 @@ export interface Transaction {
|
|
|
56
56
|
/** * The explorer links for this transaction. */
|
|
57
57
|
explorers: Explorer[];
|
|
58
58
|
/** * The details for the dex transaction. */
|
|
59
|
-
dex_details: DexReport;
|
|
59
|
+
dex_details: DexReport[];
|
|
60
60
|
/** * The details for the NFT sale transaction. */
|
|
61
|
-
nft_sale_details: NftSalesReport;
|
|
61
|
+
nft_sale_details: NftSalesReport[];
|
|
62
62
|
/** * The details for the lending protocol transaction. */
|
|
63
|
-
lending_details: LendingReport;
|
|
63
|
+
lending_details: LendingReport[];
|
|
64
64
|
/** * The log events. */
|
|
65
65
|
log_events: LogEvent[];
|
|
66
66
|
/** * The details related to the safe transaction. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CovalentClient, Client, Chain, Quote,
|
|
1
|
+
export { CovalentClient, Client, Chain, Quote, CovalentClientSettings } from "./services/CovalentClient";
|
|
2
2
|
export * from "./util/types/BalanceServiceTypes";
|
|
3
3
|
export * from "./util/types/BaseServiceTypes";
|
|
4
4
|
export * from "./util/types/NftServiceTypes";
|
|
@@ -9,3 +9,4 @@ export * from "./util/types/GenericTypes";
|
|
|
9
9
|
export * from "./util/types/TransactionServiceTypes";
|
|
10
10
|
export { calculatePrettyBalance } from "./util/CalculatePrettyBalance";
|
|
11
11
|
export { prettifyCurrency } from "./util/prettifyCurrency";
|
|
12
|
+
export { Chains } from "./util/Chains";
|
package/dist/index.js
CHANGED
|
@@ -9,4 +9,5 @@ export * from "./util/types/GenericTypes";
|
|
|
9
9
|
export * from "./util/types/TransactionServiceTypes";
|
|
10
10
|
export { calculatePrettyBalance } from "./util/CalculatePrettyBalance";
|
|
11
11
|
export { prettifyCurrency } from "./util/prettifyCurrency";
|
|
12
|
+
export { Chains } from "./util/Chains";
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAwC,MAAM,2BAA2B,CAAC;AACzG,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Chain, Quote, Response } from "./CovalentClient";
|
|
2
|
+
import { Chains } from "../util/Chains";
|
|
2
3
|
declare class BalancesResponse {
|
|
3
4
|
/** * The requested address. */
|
|
4
5
|
address: string;
|
|
@@ -482,8 +483,9 @@ export declare class BalanceService {
|
|
|
482
483
|
private apiKey;
|
|
483
484
|
private debug;
|
|
484
485
|
private threadCount;
|
|
486
|
+
private is_key_valid;
|
|
485
487
|
private LIMIT;
|
|
486
|
-
constructor(apiKey: string, debug
|
|
488
|
+
constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean);
|
|
487
489
|
/**
|
|
488
490
|
*
|
|
489
491
|
* Commonly used to fetch the native, fungible (ERC20), and non-fungible (ERC721 & ERC1155) tokens held by an address. Response includes spot prices and other metadata.
|
|
@@ -498,7 +500,7 @@ export declare class BalanceService {
|
|
|
498
500
|
* - `noNftAssetMetadata`: If `true`, the response shape is limited to a list of collections and token ids, omitting metadata and asset information. Helpful for faster response times and wallets holding a large number of NFTs.
|
|
499
501
|
*
|
|
500
502
|
*/
|
|
501
|
-
getTokenBalancesForWalletAddress(chainName: Chain, walletAddress: string, queryParamOpts?: GetTokenBalancesForWalletAddressQueryParamOpts): Promise<Response<BalancesResponse>>;
|
|
503
|
+
getTokenBalancesForWalletAddress(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetTokenBalancesForWalletAddressQueryParamOpts): Promise<Response<BalancesResponse>>;
|
|
502
504
|
/**
|
|
503
505
|
*
|
|
504
506
|
* Commonly used to render a daily portfolio balance for an address broken down by the token. The timeframe is user-configurable, defaults to 30 days.
|
|
@@ -510,7 +512,7 @@ export declare class BalanceService {
|
|
|
510
512
|
* - `days`: The number of days to return data for. Defaults to 30 days.
|
|
511
513
|
*
|
|
512
514
|
*/
|
|
513
|
-
getHistoricalPortfolioForWalletAddress(chainName: Chain, walletAddress: string, queryParamOpts?: GetHistoricalPortfolioForWalletAddressQueryParamOpts): Promise<Response<PortfolioResponse>>;
|
|
515
|
+
getHistoricalPortfolioForWalletAddress(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetHistoricalPortfolioForWalletAddressQueryParamOpts): Promise<Response<PortfolioResponse>>;
|
|
514
516
|
/**
|
|
515
517
|
*
|
|
516
518
|
* Commonly used to render the transfer-in and transfer-out of a token along with historical prices from an address.
|
|
@@ -526,7 +528,7 @@ export declare class BalanceService {
|
|
|
526
528
|
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
527
529
|
*
|
|
528
530
|
*/
|
|
529
|
-
getErc20TransfersForWalletAddress(chainName: Chain, walletAddress: string, queryParamOpts?: GetErc20TransfersForWalletAddressQueryParamOpts): AsyncIterable<BlockTransactionWithContractTransfers>;
|
|
531
|
+
getErc20TransfersForWalletAddress(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetErc20TransfersForWalletAddressQueryParamOpts): AsyncIterable<BlockTransactionWithContractTransfers>;
|
|
530
532
|
/**
|
|
531
533
|
*
|
|
532
534
|
* Commonly used to render the transfer-in and transfer-out of a token along with historical prices from an address.
|
|
@@ -542,7 +544,7 @@ export declare class BalanceService {
|
|
|
542
544
|
* - `pageNumber`: 0-indexed page number to begin pagination.
|
|
543
545
|
*
|
|
544
546
|
*/
|
|
545
|
-
getErc20TransfersForWalletAddressByPage(chainName: Chain, walletAddress: string, queryParamOpts?: GetErc20TransfersForWalletAddressQueryParamOpts): Promise<Response<Erc20TransfersResponse>>;
|
|
547
|
+
getErc20TransfersForWalletAddressByPage(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetErc20TransfersForWalletAddressQueryParamOpts): Promise<Response<Erc20TransfersResponse>>;
|
|
546
548
|
/**
|
|
547
549
|
*
|
|
548
550
|
* Commonly used to 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.
|
|
@@ -556,7 +558,7 @@ export declare class BalanceService {
|
|
|
556
558
|
* - `date`: Ending date to define a block range (YYYY-MM-DD). Omitting this parameter defaults to the current date.
|
|
557
559
|
*
|
|
558
560
|
*/
|
|
559
|
-
getTokenHoldersV2ForTokenAddress(chainName: Chain, tokenAddress: string, queryParamOpts?: GetTokenHoldersV2ForTokenAddressQueryParamOpts): AsyncIterable<TokenHolder>;
|
|
561
|
+
getTokenHoldersV2ForTokenAddress(chainName: Chain | Chains, tokenAddress: string, queryParamOpts?: GetTokenHoldersV2ForTokenAddressQueryParamOpts): AsyncIterable<TokenHolder>;
|
|
560
562
|
/**
|
|
561
563
|
*
|
|
562
564
|
* Commonly used to 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.
|
|
@@ -570,7 +572,7 @@ export declare class BalanceService {
|
|
|
570
572
|
* - `date`: Ending date to define a block range (YYYY-MM-DD). Omitting this parameter defaults to the current date.
|
|
571
573
|
*
|
|
572
574
|
*/
|
|
573
|
-
getTokenHoldersV2ForTokenAddressByPage(chainName: Chain, tokenAddress: string, queryParamOpts?: GetTokenHoldersV2ForTokenAddressQueryParamOpts): Promise<Response<TokenHoldersResponse>>;
|
|
575
|
+
getTokenHoldersV2ForTokenAddressByPage(chainName: Chain | Chains, tokenAddress: string, queryParamOpts?: GetTokenHoldersV2ForTokenAddressQueryParamOpts): Promise<Response<TokenHoldersResponse>>;
|
|
574
576
|
/**
|
|
575
577
|
*
|
|
576
578
|
* Commonly used to 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.
|
|
@@ -587,7 +589,7 @@ export declare class BalanceService {
|
|
|
587
589
|
* - `date`: Ending date to define a block range (YYYY-MM-DD). Omitting this parameter defaults to the current date.
|
|
588
590
|
*
|
|
589
591
|
*/
|
|
590
|
-
getHistoricalTokenBalancesForWalletAddress(chainName: Chain, walletAddress: string, queryParamOpts?: GetHistoricalTokenBalancesForWalletAddressQueryParamOpts): Promise<Response<HistoricalBalancesResponse>>;
|
|
592
|
+
getHistoricalTokenBalancesForWalletAddress(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetHistoricalTokenBalancesForWalletAddressQueryParamOpts): Promise<Response<HistoricalBalancesResponse>>;
|
|
591
593
|
/**
|
|
592
594
|
*
|
|
593
595
|
* @param {string} chainName - The chain name eg: `eth-mainnet`.
|
|
@@ -597,6 +599,6 @@ export declare class BalanceService {
|
|
|
597
599
|
* - `blockHeight`: Ending block to define a block range. Omitting this parameter defaults to the latest block height.
|
|
598
600
|
*
|
|
599
601
|
*/
|
|
600
|
-
getNativeTokenBalance(chainName: Chain, walletAddress: string, queryParamOpts?: GetNativeTokenBalanceQueryParamOpts): Promise<Response<TokenBalanceNativeResponse>>;
|
|
602
|
+
getNativeTokenBalance(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetNativeTokenBalanceQueryParamOpts): Promise<Response<TokenBalanceNativeResponse>>;
|
|
601
603
|
}
|
|
602
604
|
export {};
|
|
@@ -3,6 +3,7 @@ import { checkAndModifyResponse, debugOutput, paginateEndpoint } from "../util/A
|
|
|
3
3
|
import { parseISO } from "date-fns";
|
|
4
4
|
import { ExponentialBackoff } from "../util/backoff";
|
|
5
5
|
import pLimit from "p-limit";
|
|
6
|
+
import { ApiKeyValidator } from "../util/ApiKeyValidator";
|
|
6
7
|
class BalancesResponse {
|
|
7
8
|
constructor(data) {
|
|
8
9
|
this.address = data.address;
|
|
@@ -284,10 +285,11 @@ class NativeBalanceItem {
|
|
|
284
285
|
*
|
|
285
286
|
*/
|
|
286
287
|
export class BalanceService {
|
|
287
|
-
constructor(apiKey, debug = false, threadCount = 3) {
|
|
288
|
+
constructor(apiKey, debug = false, threadCount = 3, is_key_valid) {
|
|
288
289
|
this.apiKey = apiKey;
|
|
289
290
|
this.debug = debug;
|
|
290
291
|
this.threadCount = threadCount;
|
|
292
|
+
this.is_key_valid = is_key_valid;
|
|
291
293
|
this.LIMIT = pLimit(this.threadCount);
|
|
292
294
|
}
|
|
293
295
|
/**
|
|
@@ -312,6 +314,14 @@ export class BalanceService {
|
|
|
312
314
|
while (!success) {
|
|
313
315
|
try {
|
|
314
316
|
const urlParams = new URLSearchParams();
|
|
317
|
+
if (!this.is_key_valid) {
|
|
318
|
+
return {
|
|
319
|
+
data: null,
|
|
320
|
+
error: true,
|
|
321
|
+
error_code: 401,
|
|
322
|
+
error_message: ApiKeyValidator.INVALID_API_KEY_MESSAGE
|
|
323
|
+
};
|
|
324
|
+
}
|
|
315
325
|
if (queryParamOpts?.quoteCurrency !== undefined) {
|
|
316
326
|
urlParams.append("quote-currency", queryParamOpts?.quoteCurrency.toString());
|
|
317
327
|
}
|
|
@@ -395,6 +405,14 @@ export class BalanceService {
|
|
|
395
405
|
while (!success) {
|
|
396
406
|
try {
|
|
397
407
|
const urlParams = new URLSearchParams();
|
|
408
|
+
if (!this.is_key_valid) {
|
|
409
|
+
return {
|
|
410
|
+
data: null,
|
|
411
|
+
error: true,
|
|
412
|
+
error_code: 401,
|
|
413
|
+
error_message: ApiKeyValidator.INVALID_API_KEY_MESSAGE
|
|
414
|
+
};
|
|
415
|
+
}
|
|
398
416
|
if (queryParamOpts?.quoteCurrency !== undefined) {
|
|
399
417
|
urlParams.append("quote-currency", queryParamOpts?.quoteCurrency.toString());
|
|
400
418
|
}
|
|
@@ -471,6 +489,9 @@ export class BalanceService {
|
|
|
471
489
|
while (!success) {
|
|
472
490
|
try {
|
|
473
491
|
const urlParams = new URLSearchParams();
|
|
492
|
+
if (!this.is_key_valid) {
|
|
493
|
+
throw new Error(`An error occurred 401: ${ApiKeyValidator.INVALID_API_KEY_MESSAGE}`);
|
|
494
|
+
}
|
|
474
495
|
if (queryParamOpts?.quoteCurrency !== undefined) {
|
|
475
496
|
urlParams.append("quote-currency", queryParamOpts?.quoteCurrency.toString());
|
|
476
497
|
}
|
|
@@ -523,6 +544,14 @@ export class BalanceService {
|
|
|
523
544
|
while (!success) {
|
|
524
545
|
try {
|
|
525
546
|
const urlParams = new URLSearchParams();
|
|
547
|
+
if (!this.is_key_valid) {
|
|
548
|
+
return {
|
|
549
|
+
data: null,
|
|
550
|
+
error: true,
|
|
551
|
+
error_code: 401,
|
|
552
|
+
error_message: ApiKeyValidator.INVALID_API_KEY_MESSAGE
|
|
553
|
+
};
|
|
554
|
+
}
|
|
526
555
|
if (queryParamOpts?.quoteCurrency !== undefined) {
|
|
527
556
|
urlParams.append("quote-currency", queryParamOpts?.quoteCurrency.toString());
|
|
528
557
|
}
|
|
@@ -609,6 +638,9 @@ export class BalanceService {
|
|
|
609
638
|
while (!success) {
|
|
610
639
|
try {
|
|
611
640
|
const urlParams = new URLSearchParams();
|
|
641
|
+
if (!this.is_key_valid) {
|
|
642
|
+
throw new Error(`An error occurred 401: ${ApiKeyValidator.INVALID_API_KEY_MESSAGE}`);
|
|
643
|
+
}
|
|
612
644
|
if (queryParamOpts?.blockHeight !== undefined) {
|
|
613
645
|
urlParams.append("block-height", queryParamOpts?.blockHeight.toString());
|
|
614
646
|
}
|
|
@@ -653,6 +685,14 @@ export class BalanceService {
|
|
|
653
685
|
while (!success) {
|
|
654
686
|
try {
|
|
655
687
|
const urlParams = new URLSearchParams();
|
|
688
|
+
if (!this.is_key_valid) {
|
|
689
|
+
return {
|
|
690
|
+
data: null,
|
|
691
|
+
error: true,
|
|
692
|
+
error_code: 401,
|
|
693
|
+
error_message: ApiKeyValidator.INVALID_API_KEY_MESSAGE
|
|
694
|
+
};
|
|
695
|
+
}
|
|
656
696
|
if (queryParamOpts?.blockHeight !== undefined) {
|
|
657
697
|
urlParams.append("block-height", queryParamOpts?.blockHeight.toString());
|
|
658
698
|
}
|
|
@@ -738,6 +778,14 @@ export class BalanceService {
|
|
|
738
778
|
while (!success) {
|
|
739
779
|
try {
|
|
740
780
|
const urlParams = new URLSearchParams();
|
|
781
|
+
if (!this.is_key_valid) {
|
|
782
|
+
return {
|
|
783
|
+
data: null,
|
|
784
|
+
error: true,
|
|
785
|
+
error_code: 401,
|
|
786
|
+
error_message: ApiKeyValidator.INVALID_API_KEY_MESSAGE
|
|
787
|
+
};
|
|
788
|
+
}
|
|
741
789
|
if (queryParamOpts?.quoteCurrency !== undefined) {
|
|
742
790
|
urlParams.append("quote-currency", queryParamOpts?.quoteCurrency.toString());
|
|
743
791
|
}
|
|
@@ -825,6 +873,14 @@ export class BalanceService {
|
|
|
825
873
|
while (!success) {
|
|
826
874
|
try {
|
|
827
875
|
const urlParams = new URLSearchParams();
|
|
876
|
+
if (!this.is_key_valid) {
|
|
877
|
+
return {
|
|
878
|
+
data: null,
|
|
879
|
+
error: true,
|
|
880
|
+
error_code: 401,
|
|
881
|
+
error_message: ApiKeyValidator.INVALID_API_KEY_MESSAGE
|
|
882
|
+
};
|
|
883
|
+
}
|
|
828
884
|
if (queryParamOpts?.quoteCurrency !== undefined) {
|
|
829
885
|
urlParams.append("quote-currency", queryParamOpts?.quoteCurrency.toString());
|
|
830
886
|
}
|