@covalenthq/client-sdk 1.0.2 → 2.0.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 (192) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +223 -282
  3. package/dist/cjs/index.d.ts +17 -20
  4. package/dist/cjs/index.js +2331 -7659
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/src/GoldRushClient.d.ts +20 -0
  7. package/dist/cjs/src/services/BalanceService.d.ts +125 -0
  8. package/dist/cjs/src/services/BaseService.d.ts +161 -0
  9. package/dist/cjs/src/services/NftService.d.ts +157 -0
  10. package/dist/cjs/src/services/PricingService.d.ts +25 -0
  11. package/dist/cjs/src/services/SecurityService.d.ts +28 -0
  12. package/dist/cjs/src/services/TransactionService.d.ts +128 -0
  13. package/dist/cjs/src/utils/functions/bigIntParser.d.ts +1 -0
  14. package/dist/cjs/{util/CalculatePrettyBalance.d.ts → src/utils/functions/calculatePrettyBalance.d.ts} +0 -0
  15. package/dist/cjs/src/utils/functions/debugOutput.d.ts +2 -0
  16. package/dist/cjs/src/utils/functions/endpointGenerator.d.ts +4 -0
  17. package/dist/cjs/src/utils/functions/execution.d.ts +11 -0
  18. package/dist/cjs/src/utils/functions/isValidApiKey.d.ts +1 -0
  19. package/dist/cjs/src/utils/functions/paginateEndpoint.d.ts +7 -0
  20. package/dist/cjs/src/utils/functions/prettifyCurrency.d.ts +2 -0
  21. package/dist/{esm/util/types/BalanceServiceTypes.d.ts → cjs/src/utils/types/BalanceService.types.d.ts} +91 -27
  22. package/dist/{es/util/types/BaseServiceTypes.d.ts → cjs/src/utils/types/BaseService.types.d.ts} +68 -18
  23. package/dist/cjs/src/utils/types/Generic.types.d.ts +477 -0
  24. package/dist/{esm/util/types/NftServiceTypes.d.ts → cjs/src/utils/types/NftService.types.d.ts} +53 -83
  25. package/dist/cjs/{util/types/PricingServiceTypes.d.ts → src/utils/types/PricingService.types.d.ts} +9 -3
  26. package/dist/{esm/util/types/SecurityServiceTypes.d.ts → cjs/src/utils/types/SecurityService.types.d.ts} +8 -7
  27. package/dist/{esm/util/types/TransactionServiceTypes.d.ts → cjs/src/utils/types/TransactionService.types.d.ts} +110 -24
  28. package/dist/es/index.d.ts +17 -20
  29. package/dist/es/index.js +2327 -7649
  30. package/dist/es/index.js.map +1 -1
  31. package/dist/es/src/GoldRushClient.d.ts +20 -0
  32. package/dist/es/src/services/BalanceService.d.ts +125 -0
  33. package/dist/es/src/services/BaseService.d.ts +161 -0
  34. package/dist/es/src/services/NftService.d.ts +157 -0
  35. package/dist/es/src/services/PricingService.d.ts +25 -0
  36. package/dist/es/src/services/SecurityService.d.ts +28 -0
  37. package/dist/es/src/services/TransactionService.d.ts +128 -0
  38. package/dist/es/src/utils/functions/bigIntParser.d.ts +1 -0
  39. package/dist/es/{util/CalculatePrettyBalance.d.ts → src/utils/functions/calculatePrettyBalance.d.ts} +0 -0
  40. package/dist/es/src/utils/functions/debugOutput.d.ts +2 -0
  41. package/dist/es/src/utils/functions/endpointGenerator.d.ts +4 -0
  42. package/dist/es/src/utils/functions/execution.d.ts +11 -0
  43. package/dist/es/src/utils/functions/isValidApiKey.d.ts +1 -0
  44. package/dist/es/src/utils/functions/paginateEndpoint.d.ts +7 -0
  45. package/dist/es/src/utils/functions/prettifyCurrency.d.ts +2 -0
  46. package/dist/{cjs/util/types/BalanceServiceTypes.d.ts → es/src/utils/types/BalanceService.types.d.ts} +91 -27
  47. package/dist/{esm/util/types/BaseServiceTypes.d.ts → es/src/utils/types/BaseService.types.d.ts} +68 -18
  48. package/dist/es/src/utils/types/Generic.types.d.ts +477 -0
  49. package/dist/{cjs/util/types/NftServiceTypes.d.ts → es/src/utils/types/NftService.types.d.ts} +53 -83
  50. package/dist/es/{util/types/PricingServiceTypes.d.ts → src/utils/types/PricingService.types.d.ts} +9 -3
  51. package/dist/{util/types/SecurityServiceTypes.d.ts → es/src/utils/types/SecurityService.types.d.ts} +8 -7
  52. package/dist/{cjs/util/types/TransactionServiceTypes.d.ts → es/src/utils/types/TransactionService.types.d.ts} +110 -24
  53. package/dist/esm/index.d.ts +17 -20
  54. package/dist/esm/index.js +2327 -7649
  55. package/dist/esm/index.js.map +1 -1
  56. package/dist/esm/src/GoldRushClient.d.ts +20 -0
  57. package/dist/esm/src/services/BalanceService.d.ts +125 -0
  58. package/dist/esm/src/services/BaseService.d.ts +161 -0
  59. package/dist/esm/src/services/NftService.d.ts +157 -0
  60. package/dist/esm/src/services/PricingService.d.ts +25 -0
  61. package/dist/esm/src/services/SecurityService.d.ts +28 -0
  62. package/dist/esm/src/services/TransactionService.d.ts +128 -0
  63. package/dist/esm/src/utils/functions/bigIntParser.d.ts +1 -0
  64. package/dist/esm/{util/CalculatePrettyBalance.d.ts → src/utils/functions/calculatePrettyBalance.d.ts} +0 -0
  65. package/dist/esm/src/utils/functions/debugOutput.d.ts +2 -0
  66. package/dist/esm/src/utils/functions/endpointGenerator.d.ts +4 -0
  67. package/dist/esm/src/utils/functions/execution.d.ts +11 -0
  68. package/dist/esm/src/utils/functions/isValidApiKey.d.ts +1 -0
  69. package/dist/esm/src/utils/functions/paginateEndpoint.d.ts +7 -0
  70. package/dist/esm/src/utils/functions/prettifyCurrency.d.ts +2 -0
  71. package/dist/{util/types/BalanceServiceTypes.d.ts → esm/src/utils/types/BalanceService.types.d.ts} +91 -27
  72. package/dist/{cjs/util/types/BaseServiceTypes.d.ts → esm/src/utils/types/BaseService.types.d.ts} +68 -18
  73. package/dist/esm/src/utils/types/Generic.types.d.ts +477 -0
  74. package/dist/{util/types/NftServiceTypes.d.ts → esm/src/utils/types/NftService.types.d.ts} +53 -83
  75. package/dist/esm/{util/types/PricingServiceTypes.d.ts → src/utils/types/PricingService.types.d.ts} +9 -3
  76. package/dist/{es/util/types/SecurityServiceTypes.d.ts → esm/src/utils/types/SecurityService.types.d.ts} +8 -7
  77. package/dist/{util/types/TransactionServiceTypes.d.ts → esm/src/utils/types/TransactionService.types.d.ts} +110 -24
  78. package/package.json +25 -12
  79. package/dist/cjs/services/BalanceService.d.ts +0 -638
  80. package/dist/cjs/services/BaseService.d.ts +0 -571
  81. package/dist/cjs/services/CovalentClient.d.ts +0 -57
  82. package/dist/cjs/services/NftService.d.ts +0 -686
  83. package/dist/cjs/services/PricingService.d.ts +0 -103
  84. package/dist/cjs/services/SecurityService.d.ts +0 -162
  85. package/dist/cjs/services/TransactionService.d.ts +0 -711
  86. package/dist/cjs/services/XykService.d.ts +0 -1018
  87. package/dist/cjs/util/ApiHelpers.d.ts +0 -6
  88. package/dist/cjs/util/ApiKeyValidator.d.ts +0 -8
  89. package/dist/cjs/util/Chains.d.ts +0 -223
  90. package/dist/cjs/util/backoff.d.ts +0 -12
  91. package/dist/cjs/util/prettifyCurrency.d.ts +0 -2
  92. package/dist/cjs/util/types/GenericTypes.d.ts +0 -116
  93. package/dist/cjs/util/types/SecurityServiceTypes.d.ts +0 -121
  94. package/dist/cjs/util/types/XykServiceTypes.d.ts +0 -687
  95. package/dist/es/services/BalanceService.d.ts +0 -638
  96. package/dist/es/services/BaseService.d.ts +0 -571
  97. package/dist/es/services/CovalentClient.d.ts +0 -57
  98. package/dist/es/services/NftService.d.ts +0 -686
  99. package/dist/es/services/PricingService.d.ts +0 -103
  100. package/dist/es/services/SecurityService.d.ts +0 -162
  101. package/dist/es/services/TransactionService.d.ts +0 -711
  102. package/dist/es/services/XykService.d.ts +0 -1018
  103. package/dist/es/util/ApiHelpers.d.ts +0 -6
  104. package/dist/es/util/ApiKeyValidator.d.ts +0 -8
  105. package/dist/es/util/Chains.d.ts +0 -223
  106. package/dist/es/util/backoff.d.ts +0 -12
  107. package/dist/es/util/prettifyCurrency.d.ts +0 -2
  108. package/dist/es/util/types/BalanceServiceTypes.d.ts +0 -378
  109. package/dist/es/util/types/GenericTypes.d.ts +0 -116
  110. package/dist/es/util/types/NftServiceTypes.d.ts +0 -303
  111. package/dist/es/util/types/TransactionServiceTypes.d.ts +0 -388
  112. package/dist/es/util/types/XykServiceTypes.d.ts +0 -687
  113. package/dist/esm/services/BalanceService.d.ts +0 -638
  114. package/dist/esm/services/BaseService.d.ts +0 -571
  115. package/dist/esm/services/CovalentClient.d.ts +0 -57
  116. package/dist/esm/services/NftService.d.ts +0 -686
  117. package/dist/esm/services/PricingService.d.ts +0 -103
  118. package/dist/esm/services/SecurityService.d.ts +0 -162
  119. package/dist/esm/services/TransactionService.d.ts +0 -711
  120. package/dist/esm/services/XykService.d.ts +0 -1018
  121. package/dist/esm/util/ApiHelpers.d.ts +0 -6
  122. package/dist/esm/util/ApiKeyValidator.d.ts +0 -8
  123. package/dist/esm/util/Chains.d.ts +0 -223
  124. package/dist/esm/util/backoff.d.ts +0 -12
  125. package/dist/esm/util/prettifyCurrency.d.ts +0 -2
  126. package/dist/esm/util/types/GenericTypes.d.ts +0 -116
  127. package/dist/esm/util/types/XykServiceTypes.d.ts +0 -687
  128. package/dist/index.d.ts +0 -20
  129. package/dist/index.js +0 -21
  130. package/dist/index.js.map +0 -1
  131. package/dist/services/BalanceService.d.ts +0 -638
  132. package/dist/services/BalanceService.js +0 -959
  133. package/dist/services/BalanceService.js.map +0 -1
  134. package/dist/services/BaseService.d.ts +0 -571
  135. package/dist/services/BaseService.js +0 -1202
  136. package/dist/services/BaseService.js.map +0 -1
  137. package/dist/services/CovalentClient.d.ts +0 -57
  138. package/dist/services/CovalentClient.js +0 -49
  139. package/dist/services/CovalentClient.js.map +0 -1
  140. package/dist/services/NftService.d.ts +0 -686
  141. package/dist/services/NftService.js +0 -1490
  142. package/dist/services/NftService.js.map +0 -1
  143. package/dist/services/PricingService.d.ts +0 -103
  144. package/dist/services/PricingService.js +0 -155
  145. package/dist/services/PricingService.js.map +0 -1
  146. package/dist/services/SecurityService.d.ts +0 -162
  147. package/dist/services/SecurityService.js +0 -249
  148. package/dist/services/SecurityService.js.map +0 -1
  149. package/dist/services/TransactionService.d.ts +0 -711
  150. package/dist/services/TransactionService.js +0 -1687
  151. package/dist/services/TransactionService.js.map +0 -1
  152. package/dist/services/XykService.d.ts +0 -1018
  153. package/dist/services/XykService.js +0 -1827
  154. package/dist/services/XykService.js.map +0 -1
  155. package/dist/util/ApiHelpers.d.ts +0 -6
  156. package/dist/util/ApiHelpers.js +0 -87
  157. package/dist/util/ApiHelpers.js.map +0 -1
  158. package/dist/util/ApiKeyValidator.d.ts +0 -8
  159. package/dist/util/ApiKeyValidator.js +0 -13
  160. package/dist/util/ApiKeyValidator.js.map +0 -1
  161. package/dist/util/CalculatePrettyBalance.d.ts +0 -1
  162. package/dist/util/CalculatePrettyBalance.js +0 -32
  163. package/dist/util/CalculatePrettyBalance.js.map +0 -1
  164. package/dist/util/Chains.d.ts +0 -223
  165. package/dist/util/Chains.js +0 -225
  166. package/dist/util/Chains.js.map +0 -1
  167. package/dist/util/backoff.d.ts +0 -12
  168. package/dist/util/backoff.js +0 -47
  169. package/dist/util/backoff.js.map +0 -1
  170. package/dist/util/prettifyCurrency.d.ts +0 -2
  171. package/dist/util/prettifyCurrency.js +0 -69
  172. package/dist/util/prettifyCurrency.js.map +0 -1
  173. package/dist/util/types/BalanceServiceTypes.js +0 -2
  174. package/dist/util/types/BalanceServiceTypes.js.map +0 -1
  175. package/dist/util/types/BaseServiceTypes.d.ts +0 -276
  176. package/dist/util/types/BaseServiceTypes.js +0 -2
  177. package/dist/util/types/BaseServiceTypes.js.map +0 -1
  178. package/dist/util/types/GenericTypes.d.ts +0 -116
  179. package/dist/util/types/GenericTypes.js +0 -2
  180. package/dist/util/types/GenericTypes.js.map +0 -1
  181. package/dist/util/types/NftServiceTypes.js +0 -2
  182. package/dist/util/types/NftServiceTypes.js.map +0 -1
  183. package/dist/util/types/PricingServiceTypes.d.ts +0 -33
  184. package/dist/util/types/PricingServiceTypes.js +0 -2
  185. package/dist/util/types/PricingServiceTypes.js.map +0 -1
  186. package/dist/util/types/SecurityServiceTypes.js +0 -2
  187. package/dist/util/types/SecurityServiceTypes.js.map +0 -1
  188. package/dist/util/types/TransactionServiceTypes.js +0 -2
  189. package/dist/util/types/TransactionServiceTypes.js.map +0 -1
  190. package/dist/util/types/XykServiceTypes.d.ts +0 -687
  191. package/dist/util/types/XykServiceTypes.js +0 -2
  192. package/dist/util/types/XykServiceTypes.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { ContractMetadata, LogoUrls } from "./GenericTypes";
1
+ import { type ContractMetadata, type LogoUrls } from "./Generic.types";
2
2
  export interface TokenPricesResponse {
3
3
  /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
4
4
  contract_decimals: number;
@@ -18,8 +18,6 @@ export interface TokenPricesResponse {
18
18
  /** * The contract logo URLs. */
19
19
  logo_urls: LogoUrls;
20
20
  /** * List of response items. */
21
- prices: Price[];
22
- /** * List of response items. */
23
21
  items: Price[];
24
22
  }
25
23
  export interface Price {
@@ -31,3 +29,11 @@ export interface Price {
31
29
  /** * A prettier version of the price for rendering purposes. */
32
30
  pretty_price: string;
33
31
  }
32
+ export interface GetTokenPricesQueryParamOpts {
33
+ /** * The start day of the historical price range (YYYY-MM-DD). */
34
+ from?: string;
35
+ /** * The end day of the historical price range (YYYY-MM-DD). */
36
+ to?: string;
37
+ /** * Sort the prices in chronological ascending order. By default, it's set to `false` and returns prices in chronological descending order. */
38
+ pricesAtAsc?: boolean;
39
+ }
@@ -1,3 +1,4 @@
1
+ import { type ChainID, type ChainName } from "./Generic.types";
1
2
  export interface ApprovalsResponse {
2
3
  /** * The requested address. */
3
4
  address: string;
@@ -6,9 +7,9 @@ export interface ApprovalsResponse {
6
7
  /** * The requested quote currency eg: `USD`. */
7
8
  quote_currency: string;
8
9
  /** * The requested chain ID eg: `1`. */
9
- chain_id: number;
10
+ chain_id: ChainID;
10
11
  /** * The requested chain name eg: `eth-mainnet`. */
11
- chain_name: string;
12
+ chain_name: ChainName;
12
13
  /** * List of response items. */
13
14
  items: TokensApprovalItem[];
14
15
  }
@@ -26,7 +27,7 @@ export interface TokensApprovalItem {
26
27
  /** * The exchange rate for the requested quote currency. */
27
28
  quote_rate: number;
28
29
  /** * Wallet balance of the token. */
29
- balance: bigint | null;
30
+ balance: bigint;
30
31
  /** * Value of the wallet balance of the token. */
31
32
  balance_quote: number;
32
33
  /** * A prettier version of the quote for rendering purposes. */
@@ -73,9 +74,9 @@ export interface NftApprovalsResponse {
73
74
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
74
75
  updated_at: Date;
75
76
  /** * The requested chain ID eg: `1`. */
76
- chain_id: number;
77
+ chain_id: ChainID;
77
78
  /** * The requested chain name eg: `eth-mainnet`. */
78
- chain_name: string;
79
+ chain_name: ChainName;
79
80
  /** * The requested address. */
80
81
  address: string;
81
82
  /** * List of response items. */
@@ -95,9 +96,9 @@ export interface NftApprovalsItem {
95
96
  }
96
97
  export interface NftApprovalBalance {
97
98
  /** * The token's id. */
98
- token_id: bigint | null;
99
+ token_id: bigint;
99
100
  /** * The NFT's token balance. */
100
- token_balance: bigint | null;
101
+ token_balance: bigint;
101
102
  }
102
103
  export interface NftApprovalSpender {
103
104
  /** * The height of the block. */
@@ -1,11 +1,11 @@
1
- import { ContractMetadata, LogEvent, Explorer } from "./GenericTypes";
1
+ import { type ChainID, type ChainName, type ContractMetadata, type Explorer, type GoldRushResponse, type LogEvent, type PaginationLinks, type Quote } from "./Generic.types";
2
2
  export interface TransactionResponse {
3
3
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
4
4
  updated_at: Date;
5
5
  /** * The requested chain ID eg: `1`. */
6
- chain_id: number;
6
+ chain_id: ChainID;
7
7
  /** * The requested chain name eg: `eth-mainnet`. */
8
- chain_name: string;
8
+ chain_name: ChainName;
9
9
  /** * List of response items. */
10
10
  items: Transaction[];
11
11
  }
@@ -33,7 +33,7 @@ export interface Transaction {
33
33
  /** * The label of `to` address. */
34
34
  to_address_label: string;
35
35
  /** * The value attached to this tx. */
36
- value: bigint | null;
36
+ value: bigint;
37
37
  /** * The value attached in `quote-currency` to this tx. */
38
38
  value_quote: number;
39
39
  /** * A prettier version of the quote for rendering purposes. */
@@ -46,7 +46,7 @@ export interface Transaction {
46
46
  /** * The gas price at the time of this tx. */
47
47
  gas_price: number;
48
48
  /** * The total transaction fees (`gas_price` * `gas_spent`) paid for this tx, denoted in wei. */
49
- fees_paid: bigint | null;
49
+ fees_paid: bigint;
50
50
  /** * The gas spent in `quote-currency` denomination. */
51
51
  gas_quote: number;
52
52
  /** * A prettier version of the quote for rendering purposes. */
@@ -269,21 +269,20 @@ export interface RecentTransactionsResponse {
269
269
  /** * The requested quote currency eg: `USD`. */
270
270
  quote_currency: string;
271
271
  /** * The requested chain ID eg: `1`. */
272
- chain_id: number;
272
+ chain_id: ChainID;
273
273
  /** * The requested chain name eg: `eth-mainnet`. */
274
- chain_name: string;
274
+ chain_name: ChainName;
275
275
  /** * The current page of the response. */
276
276
  current_page: number;
277
+ /** * URL link to the next and prev pages. */
277
278
  links: PaginationLinks;
279
+ /** * An executable async function for the next page. */
280
+ next: (() => Promise<GoldRushResponse<RecentTransactionsResponse>>) | null;
281
+ /** * An executable async function for the prev page. */
282
+ prev: (() => Promise<GoldRushResponse<RecentTransactionsResponse>>) | null;
278
283
  /** * List of response items. */
279
284
  items: Transaction[];
280
285
  }
281
- export interface PaginationLinks {
282
- /** * URL link to the next page. */
283
- prev: string;
284
- /** * URL link to the previous page. */
285
- next: string;
286
- }
287
286
  export interface TransactionsTimeBucketResponse {
288
287
  /** * The requested address. */
289
288
  address: string;
@@ -292,13 +291,18 @@ export interface TransactionsTimeBucketResponse {
292
291
  /** * The requested quote currency eg: `USD`. */
293
292
  quote_currency: string;
294
293
  /** * The requested chain ID eg: `1`. */
295
- chain_id: number;
294
+ chain_id: ChainID;
296
295
  /** * The requested chain name eg: `eth-mainnet`. */
297
- chain_name: string;
296
+ chain_name: ChainName;
298
297
  complete: boolean;
299
298
  /** * The current bucket of the response. */
300
299
  current_bucket: number;
300
+ /** * URL link to the next and prev pages. */
301
301
  links: PaginationLinks;
302
+ /** * An executable async function for the next page. */
303
+ next: (() => Promise<GoldRushResponse<TransactionsTimeBucketResponse>>) | null;
304
+ /** * An executable async function for the prev page. */
305
+ prev: (() => Promise<GoldRushResponse<TransactionsTimeBucketResponse>>) | null;
302
306
  /** * List of response items. */
303
307
  items: Transaction[];
304
308
  }
@@ -306,9 +310,9 @@ export interface TransactionsBlockResponse {
306
310
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
307
311
  updated_at: Date;
308
312
  /** * The requested chain ID eg: `1`. */
309
- chain_id: number;
313
+ chain_id: ChainID;
310
314
  /** * The requested chain name eg: `eth-mainnet`. */
311
- chain_name: string;
315
+ chain_name: ChainName;
312
316
  /** * List of response items. */
313
317
  items: Transaction[];
314
318
  }
@@ -318,9 +322,9 @@ export interface TransactionsSummaryResponse {
318
322
  /** * The requested address. */
319
323
  address: string;
320
324
  /** * The requested chain ID eg: `1`. */
321
- chain_id: number;
325
+ chain_id: ChainID;
322
326
  /** * The requested chain name eg: `eth-mainnet`. */
323
- chain_name: string;
327
+ chain_name: ChainName;
324
328
  /** * List of response items. */
325
329
  items: TransactionsSummary[];
326
330
  }
@@ -350,12 +354,17 @@ export interface TransactionsResponse {
350
354
  /** * The requested quote currency eg: `USD`. */
351
355
  quote_currency: string;
352
356
  /** * The requested chain ID eg: `1`. */
353
- chain_id: number;
357
+ chain_id: ChainID;
354
358
  /** * The requested chain name eg: `eth-mainnet`. */
355
- chain_name: string;
359
+ chain_name: ChainName;
356
360
  /** * The current page of the response. */
357
361
  current_page: number;
362
+ /** * URL link to the next and prev pages. */
358
363
  links: PaginationLinks;
364
+ /** * An executable async function for the next page. */
365
+ next: (() => Promise<GoldRushResponse<TransactionsResponse>>) | null;
366
+ /** * An executable async function for the prev page. */
367
+ prev: (() => Promise<GoldRushResponse<TransactionsResponse>>) | null;
359
368
  /** * List of response items. */
360
369
  items: Transaction[];
361
370
  }
@@ -363,10 +372,15 @@ export interface TransactionsBlockPageResponse {
363
372
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
364
373
  updated_at: Date;
365
374
  /** * The requested chain ID eg: `1`. */
366
- chain_id: number;
375
+ chain_id: ChainID;
367
376
  /** * The requested chain name eg: `eth-mainnet`. */
368
- chain_name: string;
377
+ chain_name: ChainName;
378
+ /** * URL link to the next and prev pages. */
369
379
  links: PaginationLinks;
380
+ /** * An executable async function for the next page. */
381
+ next: (() => Promise<GoldRushResponse<TransactionsBlockPageResponse>>) | null;
382
+ /** * An executable async function for the prev page. */
383
+ prev: (() => Promise<GoldRushResponse<TransactionsBlockPageResponse>>) | null;
370
384
  /** * List of response items. */
371
385
  items: Transaction[];
372
386
  }
@@ -374,7 +388,7 @@ export interface GasSummary {
374
388
  /** * The total number of transactions sent by the address. */
375
389
  total_sent_count: number;
376
390
  /** * The total transaction fees paid by the address, denoted in wei. */
377
- total_fees_paid: bigint | null;
391
+ total_fees_paid: bigint;
378
392
  /** * The total transaction fees paid by the address, denoted in `quote-currency`. */
379
393
  total_gas_quote: number;
380
394
  /** * A prettier version of the quote for rendering purposes. */
@@ -386,3 +400,75 @@ export interface GasSummary {
386
400
  /** * The requested chain native gas token metadata. */
387
401
  gas_metadata: ContractMetadata;
388
402
  }
403
+ export interface GetTransactionQueryParamOpts {
404
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
405
+ quoteCurrency?: Quote;
406
+ /** * Omit log events. */
407
+ noLogs?: boolean;
408
+ /** * Decoded DEX details including protocol (e.g. Uniswap), event (e.g 'add_liquidity') and tokens involved with historical prices. Additional 0.05 credits charged if data available. */
409
+ withDex?: boolean;
410
+ /** * Decoded NFT sales details including marketplace (e.g. Opensea) and cached media links. Additional 0.05 credits charged if data available. */
411
+ withNftSales?: boolean;
412
+ /** * Decoded lending details including protocol (e.g. Aave), event (e.g. 'deposit') and tokens involved with prices. Additional 0.05 credits charged if data available. */
413
+ withLending?: boolean;
414
+ /** * Include safe details. */
415
+ withSafe?: boolean;
416
+ }
417
+ export interface GetAllTransactionsForAddressQueryParamOpts {
418
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
419
+ quoteCurrency?: Quote;
420
+ /** * Omit log events. */
421
+ noLogs?: boolean;
422
+ /** * Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order. */
423
+ blockSignedAtAsc?: boolean;
424
+ /** * Include safe details. */
425
+ withSafe?: boolean;
426
+ }
427
+ export interface GetTransactionsForBlockQueryParamOpts {
428
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
429
+ quoteCurrency?: Quote;
430
+ /** * Omit log events. */
431
+ noLogs?: boolean;
432
+ /** * Include safe details. */
433
+ withSafe?: boolean;
434
+ }
435
+ export interface GetTransactionsForAddressV3QueryParamOpts {
436
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
437
+ quoteCurrency?: Quote;
438
+ /** * Omit log events. */
439
+ noLogs?: boolean;
440
+ /** * Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order. */
441
+ blockSignedAtAsc?: boolean;
442
+ /** * Include safe details. */
443
+ withSafe?: boolean;
444
+ }
445
+ export interface GetTimeBucketTransactionsForAddressQueryParamOpts {
446
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
447
+ quoteCurrency?: Quote;
448
+ /** * Omit log events. */
449
+ noLogs?: boolean;
450
+ /** * Include safe details. */
451
+ withSafe?: boolean;
452
+ }
453
+ export interface GetTransactionsForBlockHashByPageQueryParamOpts {
454
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
455
+ quoteCurrency?: Quote;
456
+ /** * Omit log events. */
457
+ noLogs?: boolean;
458
+ /** * Include safe details. */
459
+ withSafe?: boolean;
460
+ }
461
+ export interface GetTransactionsForBlockHashQueryParamOpts {
462
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
463
+ quoteCurrency?: Quote;
464
+ /** * Omit log events. */
465
+ noLogs?: boolean;
466
+ /** * Include safe details. */
467
+ withSafe?: boolean;
468
+ }
469
+ export interface GetTransactionSummaryQueryParamOpts {
470
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
471
+ quoteCurrency?: Quote;
472
+ /** * Include gas summary details. Additional charge of 1 credit when true. Response times may be impacted for wallets with millions of transactions. */
473
+ withGas?: boolean;
474
+ }
package/package.json CHANGED
@@ -1,35 +1,48 @@
1
1
  {
2
2
  "name": "@covalenthq/client-sdk",
3
- "version": "1.0.2",
3
+ "version": "2.0.1",
4
4
  "types": "dist/index.d.ts",
5
5
  "files": [
6
6
  "/dist"
7
7
  ],
8
8
  "repository": "https://github.com/covalenthq/covalent-api-sdk-ts",
9
- "author": "Covalenthq",
10
- "license": "MIT",
9
+ "author": "@covalenthq",
10
+ "license": "Apache-2.0",
11
11
  "dependencies": {
12
- "@rollup/plugin-commonjs": "^25.0.4",
13
- "@rollup/plugin-node-resolve": "^15.2.1",
14
- "big.js": "^6.2.1",
15
- "date-fns": "^2.30.0",
16
- "rollup": "^3.29.1",
17
- "rollup-plugin-typescript2": "^0.35.0",
18
- "typescript": "^5.1.6"
12
+ "big.js": "^6.2.1"
19
13
  },
20
14
  "homepage": "https://github.com/covalenthq/covalent-api-sdk-ts#readme",
21
15
  "devDependencies": {
16
+ "@rollup/plugin-commonjs": "^25.0.4",
17
+ "@rollup/plugin-json": "^6.1.0",
18
+ "@rollup/plugin-node-resolve": "^15.2.1",
19
+ "@trivago/prettier-plugin-sort-imports": "^4.3.0",
22
20
  "@types/big.js": "^6.2.2",
23
21
  "@types/jest": "^29.5.5",
22
+ "@types/node": "^20",
23
+ "@typescript-eslint/eslint-plugin": "^7.7.1",
24
+ "@typescript-eslint/parser": "^7.7.1",
25
+ "dotenv": "^16.4.5",
26
+ "eslint": "^8",
27
+ "eslint-config-prettier": "^9.1.0",
28
+ "eslint-plugin-prettier": "^5.1.3",
24
29
  "jest": "^29.6.1",
25
30
  "p-limit": "^3.1.0",
26
- "ts-jest": "^29.1.1"
31
+ "prettier": "^3.3.2",
32
+ "rollup": "^3.29.1",
33
+ "rollup-plugin-typescript2": "^0.35.0",
34
+ "ts-jest": "^29.1.1",
35
+ "ts-node": "^10.9.2",
36
+ "typescript": "^5"
27
37
  },
28
38
  "scripts": {
29
39
  "test": "jest",
30
40
  "build": "rollup -c rollup.config.js",
31
41
  "clean": "rm -rf dist",
32
- "start": "rollup -c"
42
+ "start": "rollup -c",
43
+ "lint": "eslint .",
44
+ "pretty": "prettier . --write",
45
+ "prepublishOnly": "npm run clean && npm run build"
33
46
  },
34
47
  "main": "dist/cjs/index.js",
35
48
  "main-es": "dist/es/index.js",