@covalenthq/client-sdk 0.2.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +117 -46
  2. package/dist/cjs/index.d.ts +9 -0
  3. package/dist/cjs/index.js +5226 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/services/BalanceService.d.ts +543 -0
  6. package/dist/cjs/services/BaseService.d.ts +357 -0
  7. package/dist/cjs/services/CovalentClient.d.ts +65 -0
  8. package/dist/cjs/services/NftService.d.ts +620 -0
  9. package/dist/cjs/services/PricingService.d.ts +88 -0
  10. package/dist/cjs/services/SecurityService.d.ts +158 -0
  11. package/dist/cjs/services/TransactionService.d.ts +457 -0
  12. package/dist/cjs/services/XykService.d.ts +686 -0
  13. package/dist/cjs/util/ApiHelpers.d.ts +5 -0
  14. package/dist/cjs/util/backoff.d.ts +11 -0
  15. package/dist/cjs/util/types/BalanceServiceTypes.d.ts +322 -0
  16. package/dist/cjs/util/types/BaseServiceTypes.d.ts +180 -0
  17. package/dist/cjs/util/types/GenericTypes.d.ts +96 -0
  18. package/dist/cjs/util/types/NftServiceTypes.d.ts +297 -0
  19. package/dist/cjs/util/types/PricingServiceTypes.d.ts +31 -0
  20. package/dist/cjs/util/types/SecurityServiceTypes.d.ts +121 -0
  21. package/dist/cjs/util/types/TransactionServiceTypes.d.ts +322 -0
  22. package/dist/cjs/util/types/XykServiceTypes.d.ts +479 -0
  23. package/dist/es/index.d.ts +9 -0
  24. package/dist/es/index.js +5223 -0
  25. package/dist/es/index.js.map +1 -0
  26. package/dist/es/services/BalanceService.d.ts +543 -0
  27. package/dist/es/services/BaseService.d.ts +357 -0
  28. package/dist/es/services/CovalentClient.d.ts +65 -0
  29. package/dist/es/services/NftService.d.ts +620 -0
  30. package/dist/es/services/PricingService.d.ts +88 -0
  31. package/dist/es/services/SecurityService.d.ts +158 -0
  32. package/dist/es/services/TransactionService.d.ts +457 -0
  33. package/dist/es/services/XykService.d.ts +686 -0
  34. package/dist/es/util/ApiHelpers.d.ts +5 -0
  35. package/dist/es/util/backoff.d.ts +11 -0
  36. package/dist/es/util/types/BalanceServiceTypes.d.ts +322 -0
  37. package/dist/es/util/types/BaseServiceTypes.d.ts +180 -0
  38. package/dist/es/util/types/GenericTypes.d.ts +96 -0
  39. package/dist/es/util/types/NftServiceTypes.d.ts +297 -0
  40. package/dist/es/util/types/PricingServiceTypes.d.ts +31 -0
  41. package/dist/es/util/types/SecurityServiceTypes.d.ts +121 -0
  42. package/dist/es/util/types/TransactionServiceTypes.d.ts +322 -0
  43. package/dist/es/util/types/XykServiceTypes.d.ts +479 -0
  44. package/dist/esm/index.d.ts +9 -0
  45. package/dist/esm/index.js +5223 -0
  46. package/dist/esm/index.js.map +1 -0
  47. package/dist/esm/services/BalanceService.d.ts +543 -0
  48. package/dist/esm/services/BaseService.d.ts +357 -0
  49. package/dist/esm/services/CovalentClient.d.ts +65 -0
  50. package/dist/esm/services/NftService.d.ts +620 -0
  51. package/dist/esm/services/PricingService.d.ts +88 -0
  52. package/dist/esm/services/SecurityService.d.ts +158 -0
  53. package/dist/esm/services/TransactionService.d.ts +457 -0
  54. package/dist/esm/services/XykService.d.ts +686 -0
  55. package/dist/esm/util/ApiHelpers.d.ts +5 -0
  56. package/dist/esm/util/backoff.d.ts +11 -0
  57. package/dist/esm/util/types/BalanceServiceTypes.d.ts +322 -0
  58. package/dist/esm/util/types/BaseServiceTypes.d.ts +180 -0
  59. package/dist/esm/util/types/GenericTypes.d.ts +96 -0
  60. package/dist/esm/util/types/NftServiceTypes.d.ts +297 -0
  61. package/dist/esm/util/types/PricingServiceTypes.d.ts +31 -0
  62. package/dist/esm/util/types/SecurityServiceTypes.d.ts +121 -0
  63. package/dist/esm/util/types/TransactionServiceTypes.d.ts +322 -0
  64. package/dist/esm/util/types/XykServiceTypes.d.ts +479 -0
  65. package/dist/index.d.ts +1 -1
  66. package/dist/index.js +9 -27
  67. package/dist/index.js.map +1 -1
  68. package/dist/services/BalanceService.d.ts +149 -11
  69. package/dist/services/BalanceService.js +300 -84
  70. package/dist/services/BalanceService.js.map +1 -1
  71. package/dist/services/BaseService.d.ts +46 -10
  72. package/dist/services/BaseService.js +199 -151
  73. package/dist/services/BaseService.js.map +1 -1
  74. package/dist/services/CovalentClient.d.ts +65 -0
  75. package/dist/services/CovalentClient.js +44 -0
  76. package/dist/services/CovalentClient.js.map +1 -0
  77. package/dist/services/NftService.d.ts +182 -16
  78. package/dist/services/NftService.js +490 -211
  79. package/dist/services/NftService.js.map +1 -1
  80. package/dist/services/PricingService.d.ts +8 -3
  81. package/dist/services/PricingService.js +44 -38
  82. package/dist/services/PricingService.js.map +1 -1
  83. package/dist/services/SecurityService.d.ts +71 -3
  84. package/dist/services/SecurityService.js +140 -32
  85. package/dist/services/SecurityService.js.map +1 -1
  86. package/dist/services/TransactionService.d.ts +58 -9
  87. package/dist/services/TransactionService.js +152 -103
  88. package/dist/services/TransactionService.js.map +1 -1
  89. package/dist/services/XykService.d.ts +85 -19
  90. package/dist/services/XykService.js +470 -291
  91. package/dist/services/XykService.js.map +1 -1
  92. package/dist/util/ApiHelpers.d.ts +2 -1
  93. package/dist/util/ApiHelpers.js +57 -36
  94. package/dist/util/ApiHelpers.js.map +1 -1
  95. package/dist/util/backoff.d.ts +5 -3
  96. package/dist/util/backoff.js +35 -13
  97. package/dist/util/backoff.js.map +1 -1
  98. package/dist/util/types/BalanceServiceTypes.d.ts +63 -0
  99. package/dist/util/types/BalanceServiceTypes.js +1 -2
  100. package/dist/util/types/BaseServiceTypes.d.ts +8 -0
  101. package/dist/util/types/BaseServiceTypes.js +1 -2
  102. package/dist/util/types/GenericTypes.d.ts +7 -0
  103. package/dist/util/types/GenericTypes.js +1 -2
  104. package/dist/util/types/NftServiceTypes.d.ts +86 -2
  105. package/dist/util/types/NftServiceTypes.js +1 -2
  106. package/dist/util/types/PricingServiceTypes.js +1 -2
  107. package/dist/util/types/SecurityServiceTypes.d.ts +51 -0
  108. package/dist/util/types/SecurityServiceTypes.js +1 -2
  109. package/dist/util/types/TransactionServiceTypes.d.ts +24 -2
  110. package/dist/util/types/TransactionServiceTypes.js +1 -2
  111. package/dist/util/types/XykServiceTypes.d.ts +20 -6
  112. package/dist/util/types/XykServiceTypes.js +1 -2
  113. package/package.json +19 -4
  114. package/dist/services/Client.d.ts +0 -29
  115. package/dist/services/Client.js +0 -30
  116. package/dist/services/Client.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Chains, Quotes, Response } from "./Client";
1
+ import { Chain, Quote, Response } from "./CovalentClient";
2
2
  declare class PoolResponse {
3
3
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
4
4
  updated_at: Date;
@@ -93,7 +93,7 @@ declare class SupportedDex {
93
93
  constructor(data: SupportedDex);
94
94
  }
95
95
  declare class PoolToDexItem extends SupportedDex {
96
- /** * The dex logo URL */
96
+ /** * The dex logo URL. */
97
97
  logo_url: string;
98
98
  constructor(data: PoolToDexItem);
99
99
  }
@@ -221,6 +221,18 @@ declare class PoolsDexDataItem {
221
221
  total_liquidity_quote: number;
222
222
  /** * A prettier version of the total liquidity quote for rendering purposes. */
223
223
  pretty_total_liquidity_quote: string;
224
+ /** * The volume 24h converted to fiat in `quote-currency`. */
225
+ volume_24h_quote: number;
226
+ /** * The volume 7d converted to fiat in `quote-currency`. */
227
+ volume_7d_quote: number;
228
+ /** * The fee 24h converted to fiat in `quote-currency`. */
229
+ fee_24h_quote: number;
230
+ /** * A prettier version of the volume 24h quote for rendering purposes. */
231
+ pretty_volume_24h_quote: string;
232
+ /** * A prettier version of the volume 7d quote for rendering purposes. */
233
+ pretty_volume_7d_quote: string;
234
+ /** * A prettier version of the fee 24h quote for rendering purposes. */
235
+ pretty_fee_24h_quote: string;
224
236
  /** * Token0's contract metadata and reserve data. */
225
237
  token_0: PoolsDexToken;
226
238
  /** * Token1's contract metadata and reserve data. */
@@ -228,6 +240,10 @@ declare class PoolsDexDataItem {
228
240
  constructor(data: PoolsDexDataItem);
229
241
  }
230
242
  declare class PoolsDexToken {
243
+ /** * The reserves for the token. */
244
+ reserve: string;
245
+ /** * The string returned by the `name()` method. */
246
+ contract_name: string;
231
247
  /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
232
248
  contract_decimals: number;
233
249
  /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
@@ -236,8 +252,6 @@ declare class PoolsDexToken {
236
252
  contract_address: string;
237
253
  /** * The contract logo URL. */
238
254
  logo_url: string;
239
- /** * The reserves for the token. */
240
- reserve: string;
241
255
  /** * The exchange rate for the requested quote currency. */
242
256
  quote_rate: number;
243
257
  constructor(data: PoolsDexToken);
@@ -509,7 +523,17 @@ declare class HealthData {
509
523
  }
510
524
  export interface GetPoolsForTokenAddressQueryParamOpts {
511
525
  /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
512
- quoteCurrency?: Quotes;
526
+ quoteCurrency?: Quote;
527
+ /** * The DEX name eg: `uniswap_v2`. */
528
+ dexName?: string;
529
+ }
530
+ export interface GetPoolsForWalletAddressQueryParamOpts {
531
+ /** * The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. */
532
+ tokenAddress?: string;
533
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
534
+ quoteCurrency?: Quote;
535
+ /** * The DEX name eg: `uniswap_v2`. */
536
+ dexName?: string;
513
537
  }
514
538
  /**
515
539
  * XYK APIs
@@ -517,104 +541,146 @@ export interface GetPoolsForTokenAddressQueryParamOpts {
517
541
  */
518
542
  export declare class XykService {
519
543
  private apiKey;
520
- constructor(apiKey: string);
544
+ private debug;
545
+ private threadCount;
546
+ private LIMIT;
547
+ constructor(apiKey: string, debug?: boolean, threadCount?: number);
521
548
  /**
549
+ *
550
+ * 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).
522
551
  *
523
552
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
524
553
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
525
554
  *
526
555
  */
527
- getPools(chainName: Chains, dexName: string): Promise<Response<PoolResponse>>;
556
+ getPools(chainName: Chain, dexName: string): Promise<Response<PoolResponse>>;
528
557
  /**
558
+ *
559
+ * 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.
529
560
  *
530
561
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
531
562
  * @param {string} poolAddress - The requested pool address.
532
563
  *
533
564
  */
534
- getDexForPoolAddress(chainName: Chains, poolAddress: string): Promise<Response<PoolToDexResponse>>;
565
+ getDexForPoolAddress(chainName: Chain, poolAddress: string): Promise<Response<PoolToDexResponse>>;
535
566
  /**
567
+ *
568
+ * 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.
536
569
  *
537
570
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
538
571
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
539
572
  * @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
540
573
  *
541
574
  */
542
- getPoolByAddress(chainName: Chains, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
575
+ getPoolByAddress(chainName: Chain, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
543
576
  /**
577
+ *
578
+ * 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.
544
579
  *
545
580
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
546
581
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
582
+ * @param {number} page - The requested 0-indexed page number.
547
583
  * @param {GetPoolsForTokenAddressQueryParamOpts} queryParamOpts
548
584
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
549
585
  *
550
586
  */
551
- getPoolsForTokenAddress(chainName: Chains, tokenAddress: string, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
587
+ getPoolsForTokenAddress(chainName: Chain, tokenAddress: string, page: number, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
552
588
  /**
589
+ *
590
+ * Commonly used to return balance of a wallet/contract address on a specific DEX.
553
591
  *
554
592
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
555
593
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
556
594
  * @param {string} accountAddress - The account address.
557
595
  *
558
596
  */
559
- getAddressExchangeBalances(chainName: Chains, dexName: string, accountAddress: string): Promise<Response<AddressExchangeBalancesResponse>>;
597
+ getAddressExchangeBalances(chainName: Chain, dexName: string, accountAddress: string): Promise<Response<AddressExchangeBalancesResponse>>;
598
+ /**
599
+ *
600
+ * 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.
601
+ *
602
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
603
+ * @param {string} walletAddress - The account address.
604
+ * @param {number} page - The requested 0-indexed page number.
605
+ * @param {GetPoolsForWalletAddressQueryParamOpts} queryParamOpts
606
+ * - `tokenAddress`: The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
607
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
608
+ *
609
+ */
610
+ getPoolsForWalletAddress(chainName: Chain, walletAddress: string, page: number, queryParamOpts?: GetPoolsForWalletAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
560
611
  /**
612
+ *
613
+ * 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.
561
614
  *
562
615
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
563
616
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
564
617
  *
565
618
  */
566
- getNetworkExchangeTokens(chainName: Chains, dexName: string): Promise<Response<NetworkExchangeTokensResponse>>;
619
+ getNetworkExchangeTokens(chainName: Chain, dexName: string): Promise<Response<NetworkExchangeTokensResponse>>;
567
620
  /**
568
621
  *
569
-
622
+ * Commonly used to get all the supported DEXs available for the xy=k endpoints, along with the swap fees and factory addresses.
623
+ *
570
624
  *
571
625
  */
572
626
  getSupportedDEXes(): Promise<Response<SupportedDexesResponse>>;
573
627
  /**
628
+ *
629
+ * Commonly used to get historical daily swap count for a single network exchange token.
574
630
  *
575
631
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
576
632
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
577
633
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
578
634
  *
579
635
  */
580
- getSingleNetworkExchangeToken(chainName: Chains, dexName: string, tokenAddress: string): Promise<Response<SingleNetworkExchangeTokenResponse>>;
636
+ getSingleNetworkExchangeToken(chainName: Chain, dexName: string, tokenAddress: string): Promise<Response<SingleNetworkExchangeTokenResponse>>;
581
637
  /**
638
+ *
639
+ * Commonly used to get all the DEX transactions of a wallet. Useful for building tables of DEX activity segmented by wallet.
582
640
  *
583
641
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
584
642
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
585
643
  * @param {string} accountAddress - The account address. Passing in an `ENS` or `RNS` resolves automatically.
586
644
  *
587
645
  */
588
- getTransactionsForAccountAddress(chainName: Chains, dexName: string, accountAddress: string): Promise<Response<TransactionsForAccountAddressResponse>>;
646
+ getTransactionsForAccountAddress(chainName: Chain, dexName: string, accountAddress: string): Promise<Response<TransactionsForAccountAddressResponse>>;
589
647
  /**
648
+ *
649
+ * Commonly used to get all the transactions of a token within a particular DEX. Useful for getting a per-token view of DEX activity.
590
650
  *
591
651
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
592
652
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
593
653
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
594
654
  *
595
655
  */
596
- getTransactionsForTokenAddress(chainName: Chains, dexName: string, tokenAddress: string): Promise<Response<TransactionsForTokenAddressResponse>>;
656
+ getTransactionsForTokenAddress(chainName: Chain, dexName: string, tokenAddress: string): Promise<Response<TransactionsForTokenAddressResponse>>;
597
657
  /**
658
+ *
659
+ * Commonly used for getting all the transactions of a particular DEX liquidity pool. Useful for building a transactions history table for an individual pool.
598
660
  *
599
661
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
600
662
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
601
663
  * @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
602
664
  *
603
665
  */
604
- getTransactionsForExchange(chainName: Chains, dexName: string, poolAddress: string): Promise<Response<TransactionsForExchangeResponse>>;
666
+ getTransactionsForExchange(chainName: Chain, dexName: string, poolAddress: string): Promise<Response<TransactionsForExchangeResponse>>;
605
667
  /**
668
+ *
669
+ * Commonly used to get a 7d and 30d time-series chart of DEX activity. Includes volume and swap count.
606
670
  *
607
671
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
608
672
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
609
673
  *
610
674
  */
611
- getEcosystemChartData(chainName: Chains, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
675
+ getEcosystemChartData(chainName: Chain, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
612
676
  /**
677
+ *
678
+ * Commonly used to ping the health of xy=k endpoints to get the synced block height per chain.
613
679
  *
614
680
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
615
681
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
616
682
  *
617
683
  */
618
- getHealthData(chainName: Chains, dexName: string): Promise<Response<HealthDataResponse>>;
684
+ getHealthData(chainName: Chain, dexName: string): Promise<Response<HealthDataResponse>>;
619
685
  }
620
686
  export {};