@covalenthq/client-sdk 0.7.5 → 0.8.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 (76) hide show
  1. package/README.md +25 -0
  2. package/dist/cjs/index.js +1183 -451
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/services/BalanceService.d.ts +15 -13
  5. package/dist/cjs/services/BaseService.d.ts +13 -11
  6. package/dist/cjs/services/CovalentClient.d.ts +8 -4
  7. package/dist/cjs/services/NftService.d.ts +19 -17
  8. package/dist/cjs/services/PricingService.d.ts +5 -3
  9. package/dist/cjs/services/SecurityService.d.ts +6 -4
  10. package/dist/cjs/services/TransactionService.d.ts +83 -12
  11. package/dist/cjs/services/XykService.d.ts +287 -22
  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 +160 -8
  16. package/dist/es/index.js +1183 -451
  17. package/dist/es/index.js.map +1 -1
  18. package/dist/es/services/BalanceService.d.ts +15 -13
  19. package/dist/es/services/BaseService.d.ts +13 -11
  20. package/dist/es/services/CovalentClient.d.ts +8 -4
  21. package/dist/es/services/NftService.d.ts +19 -17
  22. package/dist/es/services/PricingService.d.ts +5 -3
  23. package/dist/es/services/SecurityService.d.ts +6 -4
  24. package/dist/es/services/TransactionService.d.ts +83 -12
  25. package/dist/es/services/XykService.d.ts +287 -22
  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 +160 -8
  30. package/dist/esm/index.js +1183 -451
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/services/BalanceService.d.ts +15 -13
  33. package/dist/esm/services/BaseService.d.ts +13 -11
  34. package/dist/esm/services/CovalentClient.d.ts +8 -4
  35. package/dist/esm/services/NftService.d.ts +19 -17
  36. package/dist/esm/services/PricingService.d.ts +5 -3
  37. package/dist/esm/services/SecurityService.d.ts +6 -4
  38. package/dist/esm/services/TransactionService.d.ts +83 -12
  39. package/dist/esm/services/XykService.d.ts +287 -22
  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 +160 -8
  44. package/dist/services/BalanceService.d.ts +15 -13
  45. package/dist/services/BalanceService.js +47 -39
  46. package/dist/services/BalanceService.js.map +1 -1
  47. package/dist/services/BaseService.d.ts +13 -11
  48. package/dist/services/BaseService.js +77 -65
  49. package/dist/services/BaseService.js.map +1 -1
  50. package/dist/services/CovalentClient.d.ts +8 -4
  51. package/dist/services/CovalentClient.js +19 -19
  52. package/dist/services/CovalentClient.js.map +1 -1
  53. package/dist/services/NftService.d.ts +19 -17
  54. package/dist/services/NftService.js +96 -81
  55. package/dist/services/NftService.js.map +1 -1
  56. package/dist/services/PricingService.d.ts +5 -3
  57. package/dist/services/PricingService.js +10 -7
  58. package/dist/services/PricingService.js.map +1 -1
  59. package/dist/services/SecurityService.d.ts +6 -4
  60. package/dist/services/SecurityService.js +17 -13
  61. package/dist/services/SecurityService.js.map +1 -1
  62. package/dist/services/TransactionService.d.ts +83 -12
  63. package/dist/services/TransactionService.js +434 -90
  64. package/dist/services/TransactionService.js.map +1 -1
  65. package/dist/services/XykService.d.ts +287 -22
  66. package/dist/services/XykService.js +438 -93
  67. package/dist/services/XykService.js.map +1 -1
  68. package/dist/util/ApiHelpers.d.ts +2 -1
  69. package/dist/util/ApiHelpers.js +7 -6
  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 +160 -8
  76. package/package.json +1 -1
@@ -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. */
@@ -339,6 +339,8 @@ declare class RecentTransactionsResponse {
339
339
  private _apiKey;
340
340
  private _threadCount;
341
341
  private _urlParams;
342
+ private _enableRetry;
343
+ private _source;
342
344
  /** * The requested address. */
343
345
  address: string;
344
346
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -354,7 +356,7 @@ declare class RecentTransactionsResponse {
354
356
  links: PaginationLinks;
355
357
  /** * List of response items. */
356
358
  items: Transaction[];
357
- constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams);
359
+ constructor(data: RecentTransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean, _source: Source);
358
360
  prev(): Promise<Response<RecentTransactionsResponse>>;
359
361
  next(): Promise<Response<RecentTransactionsResponse>>;
360
362
  }
@@ -365,6 +367,26 @@ declare class PaginationLinks {
365
367
  next: string;
366
368
  constructor(data: PaginationLinks);
367
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
+ }
368
390
  declare class TransactionsBlockResponse {
369
391
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
370
392
  updated_at: Date;
@@ -412,6 +434,8 @@ declare class TransactionsResponse {
412
434
  private _apiKey;
413
435
  private _threadCount;
414
436
  private _urlParams;
437
+ private _enableRetry;
438
+ private _source;
415
439
  /** * The requested address. */
416
440
  address: string;
417
441
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -427,7 +451,7 @@ declare class TransactionsResponse {
427
451
  links: PaginationLinks;
428
452
  /** * List of response items. */
429
453
  items: Transaction[];
430
- constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams);
454
+ constructor(data: TransactionsResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean, _source: Source);
431
455
  prev(): Promise<Response<TransactionsResponse>>;
432
456
  next(): Promise<Response<TransactionsResponse>>;
433
457
  }
@@ -436,6 +460,8 @@ declare class TransactionsTimeBucketResponse {
436
460
  private _apiKey;
437
461
  private _threadCount;
438
462
  private _urlParams;
463
+ private _enableRetry;
464
+ private _source;
439
465
  /** * The requested address. */
440
466
  address: string;
441
467
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -452,7 +478,7 @@ declare class TransactionsTimeBucketResponse {
452
478
  links: PaginationLinks;
453
479
  /** * List of response items. */
454
480
  items: Transaction[];
455
- constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams);
481
+ constructor(data: TransactionsTimeBucketResponse, _debug: boolean, _apiKey: string, _threadCount: number, _urlParams: URLSearchParams, _enableRetry: boolean, _source: Source);
456
482
  prev(): Promise<Response<TransactionsTimeBucketResponse>>;
457
483
  next(): Promise<Response<TransactionsTimeBucketResponse>>;
458
484
  }
@@ -506,13 +532,31 @@ export interface GetTimeBucketTransactionsForAddressQueryParamOpts {
506
532
  /** * Include safe details. */
507
533
  withSafe?: boolean;
508
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
+ }
509
551
  export declare class TransactionService {
510
552
  private apiKey;
511
553
  private debug;
512
554
  private threadCount;
513
555
  private is_key_valid;
556
+ private enableRetry;
557
+ private source;
514
558
  private LIMIT;
515
- constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean);
559
+ constructor(apiKey: string, debug: boolean, threadCount: number, is_key_valid: boolean, enableRetry: boolean, source: Source);
516
560
  /**
517
561
  *
518
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.
@@ -528,7 +572,7 @@ export declare class TransactionService {
528
572
  * - `withSafe`: Include safe details.
529
573
  *
530
574
  */
531
- getTransaction(chainName: Chain | Chains, txHash: string, queryParamOpts?: GetTransactionQueryParamOpts): Promise<Response<TransactionResponse>>;
575
+ getTransaction(chainName: Chain | Chains | ChainID, txHash: string, queryParamOpts?: GetTransactionQueryParamOpts): Promise<Response<TransactionResponse>>;
532
576
  /**
533
577
  *
534
578
  * Commonly used to fetch and render the most recent transactions involving an address. Frequently seen in wallet applications.
@@ -542,7 +586,7 @@ export declare class TransactionService {
542
586
  * - `withSafe`: Include safe details.
543
587
  *
544
588
  */
545
- getAllTransactionsForAddress(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): AsyncIterable<Transaction>;
589
+ getAllTransactionsForAddress(chainName: Chain | Chains | ChainID, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): AsyncIterable<Transaction>;
546
590
  /**
547
591
  *
548
592
  * Commonly used to fetch and render the most recent transactions involving an address. Frequently seen in wallet applications.
@@ -556,7 +600,7 @@ export declare class TransactionService {
556
600
  * - `withSafe`: Include safe details.
557
601
  *
558
602
  */
559
- getAllTransactionsForAddressByPage(chainName: Chain | Chains, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): Promise<Response<RecentTransactionsResponse>>;
603
+ getAllTransactionsForAddressByPage(chainName: Chain | Chains | ChainID, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): Promise<Response<RecentTransactionsResponse>>;
560
604
  /**
561
605
  *
562
606
  * Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
@@ -569,7 +613,7 @@ export declare class TransactionService {
569
613
  * - `withSafe`: Include safe details.
570
614
  *
571
615
  */
572
- 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>>;
573
617
  /**
574
618
  *
575
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.
@@ -578,7 +622,7 @@ export declare class TransactionService {
578
622
  * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
579
623
  *
580
624
  */
581
- getTransactionSummary(chainName: Chain | Chains, walletAddress: string): Promise<Response<TransactionsSummaryResponse>>;
625
+ getTransactionSummary(chainName: Chain | Chains | ChainID, walletAddress: string): Promise<Response<TransactionsSummaryResponse>>;
582
626
  /**
583
627
  *
584
628
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
@@ -591,7 +635,7 @@ export declare class TransactionService {
591
635
  * - `withSafe`: Include safe details.
592
636
  *
593
637
  */
594
- 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>>;
595
639
  /**
596
640
  *
597
641
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
@@ -603,6 +647,33 @@ export declare class TransactionService {
603
647
  * - `withSafe`: Include safe details.
604
648
  *
605
649
  */
606
- 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>>;
607
678
  }
608
679
  export {};