@covalenthq/client-sdk 0.7.6 → 0.8.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.
Files changed (76) hide show
  1. package/README.md +5 -0
  2. package/dist/cjs/index.js +2762 -199
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/services/BalanceService.d.ts +14 -13
  5. package/dist/cjs/services/BaseService.d.ts +12 -11
  6. package/dist/cjs/services/CovalentClient.d.ts +5 -3
  7. package/dist/cjs/services/NftService.d.ts +18 -17
  8. package/dist/cjs/services/PricingService.d.ts +4 -3
  9. package/dist/cjs/services/SecurityService.d.ts +5 -4
  10. package/dist/cjs/services/TransactionService.d.ts +79 -12
  11. package/dist/cjs/services/XykService.d.ts +226 -15
  12. package/dist/cjs/util/ApiHelpers.d.ts +2 -1
  13. package/dist/cjs/util/backoff.d.ts +2 -1
  14. package/dist/cjs/util/types/TransactionServiceTypes.d.ts +11 -0
  15. package/dist/cjs/util/types/XykServiceTypes.d.ts +114 -0
  16. package/dist/es/index.js +2762 -199
  17. package/dist/es/index.js.map +1 -1
  18. package/dist/es/services/BalanceService.d.ts +14 -13
  19. package/dist/es/services/BaseService.d.ts +12 -11
  20. package/dist/es/services/CovalentClient.d.ts +5 -3
  21. package/dist/es/services/NftService.d.ts +18 -17
  22. package/dist/es/services/PricingService.d.ts +4 -3
  23. package/dist/es/services/SecurityService.d.ts +5 -4
  24. package/dist/es/services/TransactionService.d.ts +79 -12
  25. package/dist/es/services/XykService.d.ts +226 -15
  26. package/dist/es/util/ApiHelpers.d.ts +2 -1
  27. package/dist/es/util/backoff.d.ts +2 -1
  28. package/dist/es/util/types/TransactionServiceTypes.d.ts +11 -0
  29. package/dist/es/util/types/XykServiceTypes.d.ts +114 -0
  30. package/dist/esm/index.js +2762 -199
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/services/BalanceService.d.ts +14 -13
  33. package/dist/esm/services/BaseService.d.ts +12 -11
  34. package/dist/esm/services/CovalentClient.d.ts +5 -3
  35. package/dist/esm/services/NftService.d.ts +18 -17
  36. package/dist/esm/services/PricingService.d.ts +4 -3
  37. package/dist/esm/services/SecurityService.d.ts +5 -4
  38. package/dist/esm/services/TransactionService.d.ts +79 -12
  39. package/dist/esm/services/XykService.d.ts +226 -15
  40. package/dist/esm/util/ApiHelpers.d.ts +2 -1
  41. package/dist/esm/util/backoff.d.ts +2 -1
  42. package/dist/esm/util/types/TransactionServiceTypes.d.ts +11 -0
  43. package/dist/esm/util/types/XykServiceTypes.d.ts +114 -0
  44. package/dist/services/BalanceService.d.ts +14 -13
  45. package/dist/services/BalanceService.js +16 -15
  46. package/dist/services/BalanceService.js.map +1 -1
  47. package/dist/services/BaseService.d.ts +12 -11
  48. package/dist/services/BaseService.js +25 -24
  49. package/dist/services/BaseService.js.map +1 -1
  50. package/dist/services/CovalentClient.d.ts +5 -3
  51. package/dist/services/CovalentClient.js +17 -17
  52. package/dist/services/CovalentClient.js.map +1 -1
  53. package/dist/services/NftService.d.ts +18 -17
  54. package/dist/services/NftService.js +30 -29
  55. package/dist/services/NftService.js.map +1 -1
  56. package/dist/services/PricingService.d.ts +4 -3
  57. package/dist/services/PricingService.js +4 -3
  58. package/dist/services/PricingService.js.map +1 -1
  59. package/dist/services/SecurityService.d.ts +5 -4
  60. package/dist/services/SecurityService.js +6 -5
  61. package/dist/services/SecurityService.js.map +1 -1
  62. package/dist/services/TransactionService.d.ts +79 -12
  63. package/dist/services/TransactionService.js +369 -41
  64. package/dist/services/TransactionService.js.map +1 -1
  65. package/dist/services/XykService.d.ts +226 -15
  66. package/dist/services/XykService.js +335 -34
  67. package/dist/services/XykService.js.map +1 -1
  68. package/dist/util/ApiHelpers.d.ts +2 -1
  69. package/dist/util/ApiHelpers.js +3 -3
  70. package/dist/util/ApiHelpers.js.map +1 -1
  71. package/dist/util/backoff.d.ts +2 -1
  72. package/dist/util/backoff.js +3 -3
  73. package/dist/util/backoff.js.map +1 -1
  74. package/dist/util/types/TransactionServiceTypes.d.ts +11 -0
  75. package/dist/util/types/XykServiceTypes.d.ts +114 -0
  76. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { Chain, Quote, Response } from "./CovalentClient";
1
+ import { Chain, Quote, Response, ChainID, Source } from "./CovalentClient";
2
2
  import { Chains } from "../util/Chains";
3
3
  declare class TransactionResponse {
4
4
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -340,6 +340,7 @@ declare class RecentTransactionsResponse {
340
340
  private _threadCount;
341
341
  private _urlParams;
342
342
  private _enableRetry;
343
+ private _source;
343
344
  /** * The requested address. */
344
345
  address: string;
345
346
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -355,7 +356,7 @@ declare class RecentTransactionsResponse {
355
356
  links: PaginationLinks;
356
357
  /** * List of response items. */
357
358
  items: Transaction[];
358
- constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean);
359
+ constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean, _source: Source);
359
360
  prev(): Promise<Response<RecentTransactionsResponse>>;
360
361
  next(): Promise<Response<RecentTransactionsResponse>>;
361
362
  }
@@ -366,6 +367,26 @@ declare class PaginationLinks {
366
367
  next: string;
367
368
  constructor(data: PaginationLinks);
368
369
  }
370
+ declare class TransactionsBlockPageResponse {
371
+ private _debug;
372
+ private _apiKey;
373
+ private _threadCount;
374
+ private _urlParams;
375
+ private _enableRetry;
376
+ private _source;
377
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
378
+ updated_at: Date;
379
+ /** * The requested chain ID eg: `1`. */
380
+ chain_id: number;
381
+ /** * The requested chain name eg: `eth-mainnet`. */
382
+ chain_name: string;
383
+ links: PaginationLinks;
384
+ /** * List of response items. */
385
+ items: Transaction[];
386
+ constructor(data: TransactionsBlockPageResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean, _source: Source);
387
+ prev(): Promise<Response<TransactionsBlockPageResponse>>;
388
+ next(): Promise<Response<TransactionsBlockPageResponse>>;
389
+ }
369
390
  declare class TransactionsBlockResponse {
370
391
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
371
392
  updated_at: Date;
@@ -414,6 +435,7 @@ declare class TransactionsResponse {
414
435
  private _threadCount;
415
436
  private _urlParams;
416
437
  private _enableRetry;
438
+ private _source;
417
439
  /** * The requested address. */
418
440
  address: string;
419
441
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -429,7 +451,7 @@ declare class TransactionsResponse {
429
451
  links: PaginationLinks;
430
452
  /** * List of response items. */
431
453
  items: Transaction[];
432
- constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean);
454
+ constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean, _source: Source);
433
455
  prev(): Promise<Response<TransactionsResponse>>;
434
456
  next(): Promise<Response<TransactionsResponse>>;
435
457
  }
@@ -439,6 +461,7 @@ declare class TransactionsTimeBucketResponse {
439
461
  private _threadCount;
440
462
  private _urlParams;
441
463
  private _enableRetry;
464
+ private _source;
442
465
  /** * The requested address. */
443
466
  address: string;
444
467
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -455,7 +478,7 @@ declare class TransactionsTimeBucketResponse {
455
478
  links: PaginationLinks;
456
479
  /** * List of response items. */
457
480
  items: Transaction[];
458
- constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean);
481
+ constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean, _source: Source);
459
482
  prev(): Promise<Response<TransactionsTimeBucketResponse>>;
460
483
  next(): Promise<Response<TransactionsTimeBucketResponse>>;
461
484
  }
@@ -509,14 +532,31 @@ export interface GetTimeBucketTransactionsForAddressQueryParamOpts {
509
532
  /** * Include safe details. */
510
533
  withSafe?: boolean;
511
534
  }
535
+ export interface GetTransactionsForBlockHashByPageQueryParamOpts {
536
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
537
+ quoteCurrency?: Quote;
538
+ /** * Omit log events. */
539
+ noLogs?: boolean;
540
+ /** * Include safe details. */
541
+ withSafe?: boolean;
542
+ }
543
+ export interface GetTransactionsForBlockHashQueryParamOpts {
544
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
545
+ quoteCurrency?: Quote;
546
+ /** * Omit log events. */
547
+ noLogs?: boolean;
548
+ /** * Include safe details. */
549
+ withSafe?: boolean;
550
+ }
512
551
  export declare class TransactionService {
513
552
  private apiKey;
514
553
  private debug;
515
554
  private threadCount;
516
555
  private is_key_valid;
517
556
  private enableRetry;
557
+ private source;
518
558
  private LIMIT;
519
- constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean);
559
+ constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry: boolean, source: Source);
520
560
  /**
521
561
  *
522
562
  * Commonly used to fetch and render a single transaction including its decoded log events. Additionally return semantically decoded information for DEX trades, lending and NFT sales.
@@ -532,7 +572,7 @@ export declare class TransactionService {
532
572
  * - `withSafe`: Include safe details.
533
573
  *
534
574
  */
535
- getTransaction(chainName: Chain | Chains, txHash: string, queryParamOpts?: GetTransactionQueryParamOpts): Promise<Response<TransactionResponse>>;
575
+ getTransaction(chainName: Chain | Chains | ChainID, txHash: string, queryParamOpts?: GetTransactionQueryParamOpts): Promise<Response<TransactionResponse>>;
536
576
  /**
537
577
  *
538
578
  * Commonly used to fetch and render the most recent transactions involving an address. Frequently seen in wallet applications.
@@ -546,7 +586,7 @@ export declare class TransactionService {
546
586
  * - `withSafe`: Include safe details.
547
587
  *
548
588
  */
549
- getAllTransactionsForAddress(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): AsyncIterable<Transaction>;
589
+ getAllTransactionsForAddress(chainName: Chain | Chains | ChainID, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): AsyncIterable<Transaction>;
550
590
  /**
551
591
  *
552
592
  * Commonly used to fetch and render the most recent transactions involving an address. Frequently seen in wallet applications.
@@ -560,7 +600,7 @@ export declare class TransactionService {
560
600
  * - `withSafe`: Include safe details.
561
601
  *
562
602
  */
563
- getAllTransactionsForAddressByPage(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): Promise<Response<RecentTransactionsResponse>>;
603
+ getAllTransactionsForAddressByPage(chainName: Chain | Chains | ChainID, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): Promise<Response<RecentTransactionsResponse>>;
564
604
  /**
565
605
  *
566
606
  * Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
@@ -573,7 +613,7 @@ export declare class TransactionService {
573
613
  * - `withSafe`: Include safe details.
574
614
  *
575
615
  */
576
- getTransactionsForBlock(chainName: Chain | Chains, blockHeight: number, queryParamOpts?: GetTransactionsForBlockQueryParamOpts): Promise<Response<TransactionsBlockResponse>>;
616
+ getTransactionsForBlock(chainName: Chain | Chains | ChainID, blockHeight: number | string, queryParamOpts?: GetTransactionsForBlockQueryParamOpts): Promise<Response<TransactionsBlockResponse>>;
577
617
  /**
578
618
  *
579
619
  * Commonly used to fetch the earliest and latest transactions, and the transaction count for a wallet. Calculate the age of the wallet and the time it has been idle and quickly gain insights into their engagement with web3.
@@ -582,7 +622,7 @@ export declare class TransactionService {
582
622
  * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
583
623
  *
584
624
  */
585
- getTransactionSummary(chainName: Chain | Chains, walletAddress: string): Promise<Response<TransactionsSummaryResponse>>;
625
+ getTransactionSummary(chainName: Chain | Chains | ChainID, walletAddress: string): Promise<Response<TransactionsSummaryResponse>>;
586
626
  /**
587
627
  *
588
628
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
@@ -595,7 +635,7 @@ export declare class TransactionService {
595
635
  * - `withSafe`: Include safe details.
596
636
  *
597
637
  */
598
- getTransactionsForAddressV3(chainName: Chain | Chains, walletAddress: string, page: number, queryParamOpts?: GetTransactionsForAddressV3QueryParamOpts): Promise<Response<TransactionsResponse>>;
638
+ getTransactionsForAddressV3(chainName: Chain | Chains | ChainID, walletAddress: string, page: number, queryParamOpts?: GetTransactionsForAddressV3QueryParamOpts): Promise<Response<TransactionsResponse>>;
599
639
  /**
600
640
  *
601
641
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
@@ -607,6 +647,33 @@ export declare class TransactionService {
607
647
  * - `withSafe`: Include safe details.
608
648
  *
609
649
  */
610
- getTimeBucketTransactionsForAddress(chainName: Chain | Chains, walletAddress: string, timeBucket: number, queryParamOpts?: GetTimeBucketTransactionsForAddressQueryParamOpts): Promise<Response<TransactionsTimeBucketResponse>>;
650
+ getTimeBucketTransactionsForAddress(chainName: Chain | Chains | ChainID, walletAddress: string, timeBucket: number, queryParamOpts?: GetTimeBucketTransactionsForAddressQueryParamOpts): Promise<Response<TransactionsTimeBucketResponse>>;
651
+ /**
652
+ *
653
+ * Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
654
+ *
655
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
656
+ * @param {string} blockHash - The requested block hash.
657
+ * @param {number} page - The requested 0-indexed page number.
658
+ * @param {GetTransactionsForBlockHashByPageQueryParamOpts} queryParamOpts
659
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
660
+ * - `noLogs`: Omit log events.
661
+ * - `withSafe`: Include safe details.
662
+ *
663
+ */
664
+ getTransactionsForBlockHashByPage(chainName: Chain | Chains | ChainID, blockHash: string, page: number, queryParamOpts?: GetTransactionsForBlockHashByPageQueryParamOpts): Promise<Response<TransactionsBlockPageResponse>>;
665
+ /**
666
+ *
667
+ * Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
668
+ *
669
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
670
+ * @param {string} blockHash - The requested block hash.
671
+ * @param {GetTransactionsForBlockHashQueryParamOpts} queryParamOpts
672
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
673
+ * - `noLogs`: Omit log events.
674
+ * - `withSafe`: Include safe details.
675
+ *
676
+ */
677
+ getTransactionsForBlockHash(chainName: Chain, blockHash: string, queryParamOpts?: GetTransactionsForBlockHashQueryParamOpts): Promise<Response<TransactionsBlockResponse>>;
611
678
  }
612
679
  export {};
@@ -1,4 +1,4 @@
1
- import { Chain, Quote, Response } from "./CovalentClient";
1
+ import { Chain, Quote, Response, ChainID, Source } from "./CovalentClient";
2
2
  import { Chains } from "../util/Chains";
3
3
  declare class PoolResponse {
4
4
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -395,6 +395,113 @@ declare class TokenV2Volume {
395
395
  total_volume_24h_quote: number;
396
396
  constructor(data: TokenV2Volume);
397
397
  }
398
+ declare class NetworkExchangeTokenViewResponse {
399
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
400
+ updated_at: Date;
401
+ /** * The requested chain ID eg: `1`. */
402
+ chain_id: number;
403
+ /** * The requested chain name eg: `eth-mainnet`. */
404
+ chain_name: string;
405
+ /** * List of response items. */
406
+ items: TokenV2VolumeWithChartData[];
407
+ /** * Pagination metadata. */
408
+ pagination: Pagination;
409
+ constructor(data: NetworkExchangeTokenViewResponse);
410
+ }
411
+ declare class TokenV2VolumeWithChartData {
412
+ /** * The requested chain name eg: `eth-mainnet`. */
413
+ chain_name: string;
414
+ /** * The requested chain ID eg: `1`. */
415
+ chain_id: string;
416
+ /** * The name of the DEX, eg: `uniswap_v2`. */
417
+ dex_name: string;
418
+ /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
419
+ contract_address: string;
420
+ /** * The string returned by the `name()` method. */
421
+ contract_name: string;
422
+ /** * The total liquidity unscaled value. */
423
+ total_liquidity: number;
424
+ /** * The total volume 24h unscaled value. */
425
+ total_volume_24h: number;
426
+ /** * The contract logo URL. */
427
+ logo_url: string;
428
+ /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
429
+ contract_ticker_symbol: string;
430
+ /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
431
+ contract_decimals: number;
432
+ /** * The total amount of swaps in the last 24h. */
433
+ swap_count_24h: number;
434
+ /** * The exchange rate for the requested quote currency. */
435
+ quote_rate: number;
436
+ /** * The 24h exchange rate for the requested quote currency. */
437
+ quote_rate_24h: number;
438
+ /** * A prettier version of the exchange rate for rendering purposes. */
439
+ pretty_quote_rate: string;
440
+ /** * A prettier version of the 24h exchange rate for rendering purposes. */
441
+ pretty_quote_rate_24h: string;
442
+ /** * A prettier version of the total liquidity quote for rendering purposes. */
443
+ pretty_total_liquidity_quote: string;
444
+ /** * A prettier version of the 24h volume quote for rendering purposes. */
445
+ pretty_total_volume_24h_quote: string;
446
+ /** * The total liquidity converted to fiat in `quote-currency`. */
447
+ total_liquidity_quote: number;
448
+ /** * The total volume 24h converted to fiat in `quote-currency`. */
449
+ total_volume_24h_quote: number;
450
+ /** * The number of transactions in the last 24h. */
451
+ transactions_24h: number;
452
+ volume_timeseries_7d: VolumeTokenTimeseries[];
453
+ volume_timeseries_30d: VolumeTokenTimeseries[];
454
+ liquidity_timeseries_7d: LiquidityTokenTimeseries[];
455
+ liquidity_timeseries_30d: LiquidityTokenTimeseries[];
456
+ price_timeseries_7d: PriceTokenTimeseries[];
457
+ price_timeseries_30d: PriceTokenTimeseries[];
458
+ constructor(data: TokenV2VolumeWithChartData);
459
+ }
460
+ declare class VolumeTokenTimeseries {
461
+ /** * The name of the DEX, eg: `uniswap_v2`. */
462
+ dex_name: string;
463
+ /** * The requested chain ID eg: `1`. */
464
+ chain_id: string;
465
+ /** * The current date. */
466
+ dt: string;
467
+ /** * The total volume unscaled for this day. */
468
+ total_volume: string;
469
+ /** * The volume in `quote-currency` denomination. */
470
+ volume_quote: number;
471
+ /** * A prettier version of the volume quote for rendering purposes. */
472
+ pretty_volume_quote: string;
473
+ constructor(data: VolumeTokenTimeseries);
474
+ }
475
+ declare class LiquidityTokenTimeseries {
476
+ /** * The name of the DEX, eg: `uniswap_v2`. */
477
+ dex_name: string;
478
+ /** * The requested chain ID eg: `1`. */
479
+ chain_id: string;
480
+ /** * The current date. */
481
+ dt: string;
482
+ /** * The total liquidity unscaled up to this day. */
483
+ total_liquidity: string;
484
+ /** * The liquidity in `quote-currency` denomination. */
485
+ liquidity_quote: number;
486
+ /** * A prettier version of the liquidity quote for rendering purposes. */
487
+ pretty_liquidity_quote: string;
488
+ constructor(data: LiquidityTokenTimeseries);
489
+ }
490
+ declare class PriceTokenTimeseries {
491
+ /** * The name of the DEX, eg: `uniswap_v2`. */
492
+ dex_name: string;
493
+ /** * The requested chain ID eg: `1`. */
494
+ chain_id: string;
495
+ /** * The current date. */
496
+ dt: string;
497
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
498
+ quote_currency: string;
499
+ /** * The exchange rate for the requested quote currency. */
500
+ quote_rate: number;
501
+ /** * A prettier version of the exchange rate for rendering purposes. */
502
+ pretty_quote_rate: string;
503
+ constructor(data: PriceTokenTimeseries);
504
+ }
398
505
  declare class SupportedDexesResponse {
399
506
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
400
507
  updated_at: Date;
@@ -536,6 +643,19 @@ declare class TransactionsForExchangeResponse {
536
643
  pagination: Pagination;
537
644
  constructor(data: TransactionsForExchangeResponse);
538
645
  }
646
+ declare class NetworkTransactionsResponse {
647
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
648
+ updated_at: Date;
649
+ /** * The requested chain ID eg: `1`. */
650
+ chain_id: number;
651
+ /** * The requested chain name eg: `eth-mainnet`. */
652
+ chain_name: string;
653
+ /** * List of response items. */
654
+ items: ExchangeTransaction[];
655
+ /** * Pagination metadata. */
656
+ pagination: Pagination;
657
+ constructor(data: NetworkTransactionsResponse);
658
+ }
539
659
  declare class EcosystemChartDataResponse {
540
660
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
541
661
  updated_at: Date;
@@ -617,11 +737,19 @@ declare class HealthData {
617
737
  latest_block_signed_at: Date;
618
738
  constructor(data: HealthData);
619
739
  }
740
+ export interface GetPoolsQueryParamOpts {
741
+ /** * Number of items per page. Omitting this parameter defaults to 100. */
742
+ pageSize?: number;
743
+ /** * 0-indexed page number to begin pagination. */
744
+ pageNumber?: number;
745
+ }
620
746
  export interface GetPoolsForTokenAddressQueryParamOpts {
621
747
  /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
622
748
  quoteCurrency?: Quote;
623
749
  /** * The DEX name eg: `uniswap_v2`. */
624
750
  dexName?: string;
751
+ /** * Number of items per page. Omitting this parameter defaults to 100. */
752
+ pageSize?: number;
625
753
  }
626
754
  export interface GetPoolsForWalletAddressQueryParamOpts {
627
755
  /** * The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. */
@@ -630,6 +758,44 @@ export interface GetPoolsForWalletAddressQueryParamOpts {
630
758
  quoteCurrency?: Quote;
631
759
  /** * The DEX name eg: `uniswap_v2`. */
632
760
  dexName?: string;
761
+ /** * Number of items per page. Omitting this parameter defaults to 100. */
762
+ pageSize?: number;
763
+ }
764
+ export interface GetNetworkExchangeTokensQueryParamOpts {
765
+ /** * Number of items per page. Omitting this parameter defaults to 100. */
766
+ pageSize?: number;
767
+ /** * 0-indexed page number to begin pagination. */
768
+ pageNumber?: number;
769
+ }
770
+ export interface GetLpTokenViewQueryParamOpts {
771
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
772
+ quoteCurrency?: Quote;
773
+ }
774
+ export interface GetSingleNetworkExchangeTokenQueryParamOpts {
775
+ /** * Number of items per page. Omitting this parameter defaults to 100. */
776
+ pageSize?: number;
777
+ /** * 0-indexed page number to begin pagination. */
778
+ pageNumber?: number;
779
+ }
780
+ export interface GetTransactionsForTokenAddressQueryParamOpts {
781
+ /** * Number of items per page. Omitting this parameter defaults to 100. */
782
+ pageSize?: number;
783
+ /** * 0-indexed page number to begin pagination. */
784
+ pageNumber?: number;
785
+ }
786
+ export interface GetTransactionsForExchangeQueryParamOpts {
787
+ /** * Number of items per page. Omitting this parameter defaults to 100. */
788
+ pageSize?: number;
789
+ /** * 0-indexed page number to begin pagination. */
790
+ pageNumber?: number;
791
+ }
792
+ export interface GetTransactionsForDexQueryParamOpts {
793
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
794
+ quoteCurrency?: Quote;
795
+ /** * Number of items per page. Omitting this parameter defaults to 100. */
796
+ pageSize?: number;
797
+ /** * 0-indexed page number to begin pagination. */
798
+ pageNumber?: number;
633
799
  }
634
800
  /**
635
801
  * XYK APIs
@@ -641,17 +807,21 @@ export declare class XykService {
641
807
  private threadCount;
642
808
  private is_key_valid;
643
809
  private enableRetry;
810
+ private source;
644
811
  private LIMIT;
645
- constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry?: boolean);
812
+ constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry: boolean, source: Source);
646
813
  /**
647
814
  *
648
815
  * 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).
649
816
  *
650
817
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
651
818
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
819
+ * @param {GetPoolsQueryParamOpts} queryParamOpts
820
+ * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
821
+ * - `pageNumber`: 0-indexed page number to begin pagination.
652
822
  *
653
823
  */
654
- getPools(chainName: Chain | Chains, dexName: string): Promise<Response<PoolResponse>>;
824
+ getPools(chainName: Chain | Chains | ChainID, dexName: string, queryParamOpts?: GetPoolsQueryParamOpts): Promise<Response<PoolResponse>>;
655
825
  /**
656
826
  *
657
827
  * 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.
@@ -660,7 +830,7 @@ export declare class XykService {
660
830
  * @param {string} poolAddress - The requested pool address.
661
831
  *
662
832
  */
663
- getDexForPoolAddress(chainName: Chain | Chains, poolAddress: string): Promise<Response<PoolToDexResponse>>;
833
+ getDexForPoolAddress(chainName: Chain | Chains | ChainID, poolAddress: string): Promise<Response<PoolToDexResponse>>;
664
834
  /**
665
835
  *
666
836
  * 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.
@@ -670,7 +840,7 @@ export declare class XykService {
670
840
  * @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
671
841
  *
672
842
  */
673
- getPoolByAddress(chainName: Chain | Chains, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
843
+ getPoolByAddress(chainName: Chain | Chains | ChainID, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
674
844
  /**
675
845
  *
676
846
  * 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.
@@ -680,9 +850,11 @@ export declare class XykService {
680
850
  * @param {number} page - The requested 0-indexed page number.
681
851
  * @param {GetPoolsForTokenAddressQueryParamOpts} queryParamOpts
682
852
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
853
+ * - `dexName`: The DEX name eg: `uniswap_v2`.
854
+ * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
683
855
  *
684
856
  */
685
- getPoolsForTokenAddress(chainName: Chain | Chains, tokenAddress: string, page: number, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
857
+ getPoolsForTokenAddress(chainName: Chain | Chains | ChainID, tokenAddress: string, page: number, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
686
858
  /**
687
859
  *
688
860
  * Commonly used to return balance of a wallet/contract address on a specific DEX.
@@ -692,7 +864,7 @@ export declare class XykService {
692
864
  * @param {string} accountAddress - The account address.
693
865
  *
694
866
  */
695
- getAddressExchangeBalances(chainName: Chain | Chains, dexName: string, accountAddress: string): Promise<Response<AddressExchangeBalancesResponse>>;
867
+ getAddressExchangeBalances(chainName: Chain | Chains | ChainID, dexName: string, accountAddress: string): Promise<Response<AddressExchangeBalancesResponse>>;
696
868
  /**
697
869
  *
698
870
  * 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.
@@ -703,18 +875,35 @@ export declare class XykService {
703
875
  * @param {GetPoolsForWalletAddressQueryParamOpts} queryParamOpts
704
876
  * - `tokenAddress`: The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
705
877
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
878
+ * - `dexName`: The DEX name eg: `uniswap_v2`.
879
+ * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
706
880
  *
707
881
  */
708
- getPoolsForWalletAddress(chainName: Chain | Chains, walletAddress: string, page: number, queryParamOpts?: GetPoolsForWalletAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
882
+ getPoolsForWalletAddress(chainName: Chain | Chains | ChainID, walletAddress: string, page: number, queryParamOpts?: GetPoolsForWalletAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
709
883
  /**
710
884
  *
711
885
  * 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.
712
886
  *
713
887
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
714
888
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
889
+ * @param {GetNetworkExchangeTokensQueryParamOpts} queryParamOpts
890
+ * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
891
+ * - `pageNumber`: 0-indexed page number to begin pagination.
715
892
  *
716
893
  */
717
- getNetworkExchangeTokens(chainName: Chain | Chains, dexName: string): Promise<Response<NetworkExchangeTokensResponse>>;
894
+ getNetworkExchangeTokens(chainName: Chain | Chains | ChainID, dexName: string, queryParamOpts?: GetNetworkExchangeTokensQueryParamOpts): Promise<Response<NetworkExchangeTokensResponse>>;
895
+ /**
896
+ *
897
+ * Commonly used to get a detailed view for a single liquidity pool token. Includes time series data.
898
+ *
899
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
900
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
901
+ * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
902
+ * @param {GetLpTokenViewQueryParamOpts} queryParamOpts
903
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
904
+ *
905
+ */
906
+ getLpTokenView(chainName: Chain | Chains | ChainID, dexName: string, tokenAddress: string, queryParamOpts?: GetLpTokenViewQueryParamOpts): Promise<Response<NetworkExchangeTokenViewResponse>>;
718
907
  /**
719
908
  *
720
909
  * Commonly used to get all the supported DEXs available for the xy=k endpoints, along with the swap fees and factory addresses.
@@ -729,9 +918,12 @@ export declare class XykService {
729
918
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
730
919
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
731
920
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
921
+ * @param {GetSingleNetworkExchangeTokenQueryParamOpts} queryParamOpts
922
+ * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
923
+ * - `pageNumber`: 0-indexed page number to begin pagination.
732
924
  *
733
925
  */
734
- getSingleNetworkExchangeToken(chainName: Chain | Chains, dexName: string, tokenAddress: string): Promise<Response<SingleNetworkExchangeTokenResponse>>;
926
+ getSingleNetworkExchangeToken(chainName: Chain | Chains | ChainID, dexName: string, tokenAddress: string, queryParamOpts?: GetSingleNetworkExchangeTokenQueryParamOpts): Promise<Response<SingleNetworkExchangeTokenResponse>>;
735
927
  /**
736
928
  *
737
929
  * Commonly used to get all the DEX transactions of a wallet. Useful for building tables of DEX activity segmented by wallet.
@@ -741,7 +933,7 @@ export declare class XykService {
741
933
  * @param {string} accountAddress - The account address. Passing in an `ENS` or `RNS` resolves automatically.
742
934
  *
743
935
  */
744
- getTransactionsForAccountAddress(chainName: Chain | Chains, dexName: string, accountAddress: string): Promise<Response<TransactionsForAccountAddressResponse>>;
936
+ getTransactionsForAccountAddress(chainName: Chain | Chains | ChainID, dexName: string, accountAddress: string): Promise<Response<TransactionsForAccountAddressResponse>>;
745
937
  /**
746
938
  *
747
939
  * Commonly used to get all the transactions of a token within a particular DEX. Useful for getting a per-token view of DEX activity.
@@ -749,9 +941,12 @@ export declare class XykService {
749
941
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
750
942
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
751
943
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
944
+ * @param {GetTransactionsForTokenAddressQueryParamOpts} queryParamOpts
945
+ * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
946
+ * - `pageNumber`: 0-indexed page number to begin pagination.
752
947
  *
753
948
  */
754
- getTransactionsForTokenAddress(chainName: Chain | Chains, dexName: string, tokenAddress: string): Promise<Response<TransactionsForTokenAddressResponse>>;
949
+ getTransactionsForTokenAddress(chainName: Chain | Chains | ChainID, dexName: string, tokenAddress: string, queryParamOpts?: GetTransactionsForTokenAddressQueryParamOpts): Promise<Response<TransactionsForTokenAddressResponse>>;
755
950
  /**
756
951
  *
757
952
  * Commonly used for getting all the transactions of a particular DEX liquidity pool. Useful for building a transactions history table for an individual pool.
@@ -759,9 +954,25 @@ export declare class XykService {
759
954
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
760
955
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
761
956
  * @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
957
+ * @param {GetTransactionsForExchangeQueryParamOpts} queryParamOpts
958
+ * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
959
+ * - `pageNumber`: 0-indexed page number to begin pagination.
960
+ *
961
+ */
962
+ getTransactionsForExchange(chainName: Chain | Chains | ChainID, dexName: string, poolAddress: string, queryParamOpts?: GetTransactionsForExchangeQueryParamOpts): Promise<Response<TransactionsForExchangeResponse>>;
963
+ /**
964
+ *
965
+ * Commonly used to get all the the transactions for a given DEX. Useful for building DEX activity views.
966
+ *
967
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
968
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
969
+ * @param {GetTransactionsForDexQueryParamOpts} queryParamOpts
970
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
971
+ * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
972
+ * - `pageNumber`: 0-indexed page number to begin pagination.
762
973
  *
763
974
  */
764
- getTransactionsForExchange(chainName: Chain | Chains, dexName: string, poolAddress: string): Promise<Response<TransactionsForExchangeResponse>>;
975
+ getTransactionsForDex(chainName: Chain | Chains | ChainID, dexName: string, queryParamOpts?: GetTransactionsForDexQueryParamOpts): Promise<Response<NetworkTransactionsResponse>>;
765
976
  /**
766
977
  *
767
978
  * Commonly used to get a 7d and 30d time-series chart of DEX activity. Includes volume and swap count.
@@ -770,7 +981,7 @@ export declare class XykService {
770
981
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
771
982
  *
772
983
  */
773
- getEcosystemChartData(chainName: Chain | Chains, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
984
+ getEcosystemChartData(chainName: Chain | Chains | ChainID, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
774
985
  /**
775
986
  *
776
987
  * Commonly used to ping the health of xy=k endpoints to get the synced block height per chain.
@@ -779,6 +990,6 @@ export declare class XykService {
779
990
  * @param {string} dexName - The DEX name eg: `uniswap_v2`.
780
991
  *
781
992
  */
782
- getHealthData(chainName: Chain | Chains, dexName: string): Promise<Response<HealthDataResponse>>;
993
+ getHealthData(chainName: Chain | Chains | ChainID, dexName: string): Promise<Response<HealthDataResponse>>;
783
994
  }
784
995
  export {};
@@ -1,5 +1,6 @@
1
+ import { Source } from "../services/CovalentClient";
1
2
  export declare function checkAndModifyResponse(jsonObj: any): void;
2
3
  export declare function debugOutput(url: string, responseStatus: number, startTime: number | [number, number] | undefined): Promise<void>;
3
4
  type Constructor<T> = new (...args: any[]) => T;
4
- export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number, enableRetry: boolean): AsyncIterable<T1>;
5
+ export declare function paginateEndpoint<T1, T2>(url: string, apiKey: string, urlsParams: URLSearchParams, dataClassConstructor: Constructor<T1>, debug: boolean, threadCount: number, enableRetry: boolean, source: Source): AsyncIterable<T1>;
5
6
  export {};
@@ -1,3 +1,4 @@
1
+ import { Source } from "../services/CovalentClient";
1
2
  export declare const DEFAULT_BACKOFF_MAX_RETRIES = 5;
2
3
  export declare const BASE_DELAY_MS = 1000;
3
4
  export declare class ExponentialBackoff<T> {
@@ -6,6 +7,6 @@ export declare class ExponentialBackoff<T> {
6
7
  _apiKey: string;
7
8
  _debug: boolean;
8
9
  constructor(apiKey: string, debug: boolean, maxRetries?: number);
9
- backOff(url: string): Promise<T>;
10
+ backOff(url: string, source: Source): Promise<T>;
10
11
  setNumAttempts(retryCount: number): void;
11
12
  }
@@ -357,3 +357,14 @@ export interface TransactionsResponse {
357
357
  /** * List of response items. */
358
358
  items: Transaction[];
359
359
  }
360
+ export interface TransactionsBlockPageResponse {
361
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
362
+ updated_at: Date;
363
+ /** * The requested chain ID eg: `1`. */
364
+ chain_id: number;
365
+ /** * The requested chain name eg: `eth-mainnet`. */
366
+ chain_name: string;
367
+ links: PaginationLinks;
368
+ /** * List of response items. */
369
+ items: Transaction[];
370
+ }