@covalenthq/client-sdk 2.1.2 → 2.2.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 (59) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +342 -326
  3. package/dist/cjs/index.d.ts +0 -0
  4. package/dist/cjs/index.js +112 -20
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/src/GoldRushClient.d.ts +3 -1
  7. package/dist/cjs/src/services/AllChainsService.d.ts +26 -0
  8. package/dist/cjs/src/services/BalanceService.d.ts +0 -0
  9. package/dist/cjs/src/services/BaseService.d.ts +4 -4
  10. package/dist/cjs/src/services/NftService.d.ts +0 -0
  11. package/dist/cjs/src/services/PricingService.d.ts +0 -0
  12. package/dist/cjs/src/services/SecurityService.d.ts +0 -0
  13. package/dist/cjs/src/services/TransactionService.d.ts +0 -0
  14. package/dist/cjs/src/utils/functions/bigIntParser.d.ts +0 -0
  15. package/dist/cjs/src/utils/functions/calculatePrettyBalance.d.ts +0 -0
  16. package/dist/cjs/src/utils/functions/debugOutput.d.ts +0 -0
  17. package/dist/cjs/src/utils/functions/endpointGenerator.d.ts +1 -1
  18. package/dist/cjs/src/utils/functions/execution.d.ts +0 -0
  19. package/dist/cjs/src/utils/functions/isValidApiKey.d.ts +0 -0
  20. package/dist/cjs/src/utils/functions/paginateEndpoint.d.ts +0 -0
  21. package/dist/cjs/src/utils/functions/prettifyCurrency.d.ts +0 -0
  22. package/dist/cjs/src/utils/functions/timestamp-parser.d.ts +1 -1
  23. package/dist/cjs/src/utils/types/AllChainService.types.d.ts +38 -0
  24. package/dist/cjs/src/utils/types/BalanceService.types.d.ts +0 -0
  25. package/dist/cjs/src/utils/types/BaseService.types.d.ts +2 -0
  26. package/dist/cjs/src/utils/types/Generic.types.d.ts +28 -16
  27. package/dist/cjs/src/utils/types/NftService.types.d.ts +0 -0
  28. package/dist/cjs/src/utils/types/PricingService.types.d.ts +3 -2
  29. package/dist/cjs/src/utils/types/SecurityService.types.d.ts +0 -0
  30. package/dist/cjs/src/utils/types/TransactionService.types.d.ts +1 -0
  31. package/dist/esm/index.d.ts +0 -0
  32. package/dist/esm/index.js +112 -20
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/src/GoldRushClient.d.ts +3 -1
  35. package/dist/esm/src/services/AllChainsService.d.ts +26 -0
  36. package/dist/esm/src/services/BalanceService.d.ts +0 -0
  37. package/dist/esm/src/services/BaseService.d.ts +4 -4
  38. package/dist/esm/src/services/NftService.d.ts +0 -0
  39. package/dist/esm/src/services/PricingService.d.ts +0 -0
  40. package/dist/esm/src/services/SecurityService.d.ts +0 -0
  41. package/dist/esm/src/services/TransactionService.d.ts +0 -0
  42. package/dist/esm/src/utils/functions/bigIntParser.d.ts +0 -0
  43. package/dist/esm/src/utils/functions/calculatePrettyBalance.d.ts +0 -0
  44. package/dist/esm/src/utils/functions/debugOutput.d.ts +0 -0
  45. package/dist/esm/src/utils/functions/endpointGenerator.d.ts +1 -1
  46. package/dist/esm/src/utils/functions/execution.d.ts +0 -0
  47. package/dist/esm/src/utils/functions/isValidApiKey.d.ts +0 -0
  48. package/dist/esm/src/utils/functions/paginateEndpoint.d.ts +0 -0
  49. package/dist/esm/src/utils/functions/prettifyCurrency.d.ts +0 -0
  50. package/dist/esm/src/utils/functions/timestamp-parser.d.ts +1 -1
  51. package/dist/esm/src/utils/types/AllChainService.types.d.ts +38 -0
  52. package/dist/esm/src/utils/types/BalanceService.types.d.ts +0 -0
  53. package/dist/esm/src/utils/types/BaseService.types.d.ts +2 -0
  54. package/dist/esm/src/utils/types/Generic.types.d.ts +28 -16
  55. package/dist/esm/src/utils/types/NftService.types.d.ts +0 -0
  56. package/dist/esm/src/utils/types/PricingService.types.d.ts +3 -2
  57. package/dist/esm/src/utils/types/SecurityService.types.d.ts +0 -0
  58. package/dist/esm/src/utils/types/TransactionService.types.d.ts +1 -0
  59. package/package.json +73 -73
@@ -1,3 +1,4 @@
1
+ import { AllChainsService } from "./services/AllChainsService";
1
2
  import { BalanceService } from "./services/BalanceService";
2
3
  import { BaseService } from "./services/BaseService";
3
4
  import { NftService } from "./services/NftService";
@@ -10,11 +11,12 @@ import { type GoldRushClientSettings } from "./utils/types/Generic.types";
10
11
  */
11
12
  export declare class GoldRushClient {
12
13
  private readonly userAgent;
13
- SecurityService: SecurityService;
14
+ AllChainsService: AllChainsService;
14
15
  BalanceService: BalanceService;
15
16
  BaseService: BaseService;
16
17
  NftService: NftService;
17
18
  PricingService: PricingService;
19
+ SecurityService: SecurityService;
18
20
  TransactionService: TransactionService;
19
21
  constructor(apiKey: string, settings?: GoldRushClientSettings);
20
22
  }
@@ -0,0 +1,26 @@
1
+ import { type Execution } from "../utils/functions/execution";
2
+ import { type GetMultiChainAndMultiAddressTransactionsParamOtps, type MultiChainMultiAddressTransactionsResponse } from "../utils/types/AllChainService.types";
3
+ import { type GoldRushResponse } from "../utils/types/Generic.types";
4
+ /**
5
+ * Cross Chain API
6
+ *
7
+ */
8
+ export declare class AllChainsService {
9
+ private execution;
10
+ constructor(execution: Execution);
11
+ /**
12
+ *
13
+ * Commonly used to get transactions cross chains and addresses.
14
+ *
15
+ * @param {Chain[]} chains - An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains.
16
+ * @param {string[]} addresses - An array of addresses for which transactions are fetched. Does not support name resolution.
17
+ * @param {number} limit - Number of transactions to return per page, up to the default max of 100 items.
18
+ * @param {string} before - Pagination cursor pointing to fetch transactions before a certain point.
19
+ * @param {string} after - Pagination cursor pointing to fetch transactions after a certain point.
20
+ * @param {boolean} withLogs - Whether to include raw logs in the response.
21
+ * @param {boolean} withDecodedLogs - Whether to include decoded logs in the response.
22
+ * @param {Quote | "BTC" | "ETH"} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, "BTC" and "ETH".
23
+ *
24
+ */
25
+ getMultiChainAndMultiAddressTransactions(queryParamOpts?: GetMultiChainAndMultiAddressTransactionsParamOtps): Promise<GoldRushResponse<MultiChainMultiAddressTransactionsResponse>>;
26
+ }
File without changes
@@ -32,26 +32,26 @@ export declare class BaseService {
32
32
  *
33
33
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
34
34
  * @param {string} startDate - The start date in YYYY-MM-DD format.
35
- * @param {string} endDate - The end date in YYYY-MM-DD format.
35
+ * @param {string | "latest"} endDate - The end date in YYYY-MM-DD format. Also accepts "latest" for the latest block height
36
36
  * @param {GetBlockHeightsQueryParamOpts} queryParamOpts
37
37
  * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
38
38
  * - `pageNumber`: 0-indexed page number to begin pagination.
39
39
  *
40
40
  */
41
- getBlockHeights(chainName: Chain, startDate: string, endDate: string, queryParamOpts?: GetBlockHeightsQueryParamOpts): AsyncIterable<GoldRushResponse<BlockHeightsResponse>>;
41
+ getBlockHeights(chainName: Chain, startDate: string, endDate: string | "latest", queryParamOpts?: GetBlockHeightsQueryParamOpts): AsyncIterable<GoldRushResponse<BlockHeightsResponse>>;
42
42
  /**
43
43
  *
44
44
  * Commonly used to get all the block heights within a particular date range. Useful for rendering a display where you sort blocks by day.
45
45
  *
46
46
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
47
47
  * @param {string} startDate - The start date in YYYY-MM-DD format.
48
- * @param {string} endDate - The end date in YYYY-MM-DD format.
48
+ * @param {string | "latest"} endDate - The end date in YYYY-MM-DD format. Also accepts "latest" for the latest block height
49
49
  * @param {GetBlockHeightsQueryParamOpts} queryParamOpts
50
50
  * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
51
51
  * - `pageNumber`: 0-indexed page number to begin pagination.
52
52
  *
53
53
  */
54
- getBlockHeightsByPage(chainName: Chain, startDate: string, endDate: string, queryParamOpts?: GetBlockHeightsQueryParamOpts): Promise<GoldRushResponse<BlockHeightsResponse>>;
54
+ getBlockHeightsByPage(chainName: Chain, startDate: string, endDate: string | "latest", queryParamOpts?: GetBlockHeightsQueryParamOpts): Promise<GoldRushResponse<BlockHeightsResponse>>;
55
55
  /**
56
56
  *
57
57
  * Commonly used to get all the event logs of the latest block, or for a range of blocks. Includes sender contract metadata as well as decoded logs.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
1
  export declare const endpointGenerator: (extension?: string, params?: {
2
2
  key: string;
3
- value: boolean | null | string | number | undefined;
3
+ value: boolean | null | string | string[] | number | undefined;
4
4
  }[]) => URL;
File without changes
File without changes
@@ -1 +1 @@
1
- export declare const timestampParser: (timestamp: string | Date, type: "descriptive" | "DD MMM YY" | "relative" | "YYYY MM DD") => string;
1
+ export declare const timestampParser: (timestamp: string | Date, type: "descriptive" | "DD MMM YY" | "relative" | "YYYY-MM-DD") => string;
@@ -0,0 +1,38 @@
1
+ import { type Chain, type ChainID, type ChainName, type Nullable, type Quote } from "./Generic.types";
2
+ import { type Transaction } from "./TransactionService.types";
3
+ export type MultiChainTransaction = Transaction & {
4
+ /** * The requested chain ID eg: `1`. */
5
+ chain_id: ChainID;
6
+ /** * The requested chain name eg: `eth-mainnet`. */
7
+ chain_name: ChainName;
8
+ };
9
+ export type MultiChainMultiAddressTransactionsResponse = Nullable<{
10
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
11
+ updated_at: Date;
12
+ /** * The the pagination cursor to get the previous page of results */
13
+ cursor_before: string;
14
+ /** * The the pagination cursor to get the next page of results */
15
+ cursor_after: string;
16
+ /** * The requested quote currency eg: `USD`. */
17
+ quote_currency: Quote | "ETH" | "BTC";
18
+ /** * List of response items. */
19
+ items: MultiChainTransaction[];
20
+ }>;
21
+ export type GetMultiChainAndMultiAddressTransactionsParamOtps = Nullable<{
22
+ /** * An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains. */
23
+ chains?: Chain[];
24
+ /** * An array of addresses for which transactions are fetched. Does not support name resolution. */
25
+ addresses?: string[];
26
+ /** * Number of transactions to return per page, up to the default max of 100 items. */
27
+ limit?: number;
28
+ /** * Pagination cursor pointing to fetch transactions before a certain point. */
29
+ before?: string;
30
+ /** * Pagination cursor pointing to fetch transactions after a certain point. */
31
+ after?: string;
32
+ /** * Whether to include raw logs in the response. */
33
+ withLogs?: boolean;
34
+ /** * Whether to include decoded logs in the response. */
35
+ withDecodedLogs?: boolean;
36
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, "BTC" and "ETH". */
37
+ quoteCurrency?: Quote | "BTC" | "ETH";
38
+ }>;
@@ -181,6 +181,8 @@ export type ChainItem = Nullable<{
181
181
  is_appchain: boolean;
182
182
  /** * The ChainItem the appchain is a part of. */
183
183
  appchain_of: ChainItem;
184
+ /** * A classification of the chain */
185
+ priority_label: "Foundational" | "Frontier" | "Community";
184
186
  }>;
185
187
  export type ColorTheme = Nullable<{
186
188
  /** * The red color code. */
@@ -1,7 +1,7 @@
1
1
  export declare enum ChainName {
2
2
  ETH_MAINNET = "eth-mainnet",
3
- ETH_GOERLI = "eth-goerli",
4
3
  ETH_SEPOLIA = "eth-sepolia",
4
+ ETH_GOERLI = "eth-goerli",
5
5
  ETH_HOLESKY = "eth-holesky",
6
6
  MATIC_MAINNET = "matic-mainnet",
7
7
  MATIC_MUMBAI = "matic-mumbai",
@@ -33,6 +33,7 @@ export declare enum ChainName {
33
33
  CRONOS_MAINNET = "cronos-mainnet",
34
34
  CRONOS_TESTNET = "cronos-testnet",
35
35
  CRONOS_ZKEVM_TESTNET = "cronos-zkevm-testnet",
36
+ CRONOS_ZKEVM_MAINNET = "cronos-zkevm-mainnet",
36
37
  AURORA_MAINNET = "aurora-mainnet",
37
38
  AURORA_TESTNET = "aurora-testnet",
38
39
  EMERALD_PARATIME_MAINNET = "emerald-paratime-mainnet",
@@ -90,15 +91,15 @@ export declare enum ChainName {
90
91
  FLARENETWORKS_CANARY_TESTNET = "flarenetworks-canary-testnet",
91
92
  KCC_MAINNET = "kcc-mainnet",
92
93
  KCC_TESTNET = "kcc-testnet",
93
- LINEA_MAINNET = "linea-mainnet",
94
94
  POLYGON_ZKEVM_MAINNET = "polygon-zkevm-mainnet",
95
- LINEA_SEPOLIA_TESTNET = "linea-sepolia-testnet",
95
+ LINEA_MAINNET = "linea-mainnet",
96
96
  LINEA_GOERLI_TESTNET = "linea-goerli-testnet",
97
+ LINEA_SEPOLIA_TESTNET = "linea-sepolia-testnet",
97
98
  POLYGON_ZKEVM_TESTNET = "polygon-zkevm-testnet",
98
99
  POLYGON_AMOY_TESTNET = "polygon-amoy-testnet",
99
100
  MANTLE_MAINNET = "mantle-mainnet",
100
- MANTLE_SEPOLIA_TESTNET = "mantle-sepolia-testnet",
101
101
  POLYGON_ZKEVM_CARDONA_TESTNET = "polygon-zkevm-cardona-testnet",
102
+ MANTLE_SEPOLIA_TESTNET = "mantle-sepolia-testnet",
102
103
  BASE_MAINNET = "base-mainnet",
103
104
  BASE_TESTNET = "base-testnet",
104
105
  BASE_SEPOLIA_TESTNET = "base-sepolia-testnet",
@@ -109,8 +110,8 @@ export declare enum ChainName {
109
110
  LUMOZ_STARK_SPORT = "lumoz-stark-sport",
110
111
  OASIS_SAPPHIRE_MAINNET = "oasis-sapphire-mainnet",
111
112
  OASIS_SAPPHIRE_TESTNET = "oasis-sapphire-testnet",
112
- SYNDR_TESTNET = "syndr-testnet",
113
113
  XAI_MAINNET = "xai-mainnet",
114
+ SYNDR_TESTNET = "syndr-testnet",
114
115
  CELO_MAINNET = "celo-mainnet",
115
116
  X1_MAINNET = "x1-mainnet",
116
117
  CROSSFI_EVM_TESTNET = "crossfi-evm-testnet",
@@ -119,6 +120,7 @@ export declare enum ChainName {
119
120
  FRAXTAL_MAINNET = "fraxtal-mainnet",
120
121
  APECHAIN_TESTNET = "apechain-testnet",
121
122
  LISK_MAINNET = "lisk-mainnet",
123
+ BERACHAIN_TESTNET = "berachain-testnet",
122
124
  REDSTONE_MAINNET = "redstone-mainnet",
123
125
  SEI_MAINNET = "sei-mainnet",
124
126
  AVALANCHE_MELD_TESTNET = "avalanche-meld-testnet",
@@ -153,10 +155,10 @@ export declare enum ChainName {
153
155
  GNOSIS_TESTNET = "gnosis-testnet",
154
156
  TELOS_MAINNET = "telos-mainnet",
155
157
  TELOS_TESTNET = "telos-testnet",
156
- TOMOCHAIN_MAINNET = "tomochain-mainnet",
157
- TOMOCHAIN_TESTNET = "tomochain-testnet",
158
- TAIKO_MAINNET = "taiko-mainnet",
158
+ VICTION_MAINNET = "viction-mainnet",
159
+ VICTION_TESTNET = "viction-testnet",
159
160
  TAIKO_HEKLA_TESTNET = "taiko-hekla-testnet",
161
+ TAIKO_MAINNET = "taiko-mainnet",
160
162
  MERLIN_MAINNET = "merlin-mainnet",
161
163
  MERLIN_TESTNET = "merlin-testnet",
162
164
  BLAST_MAINNET = "blast-mainnet",
@@ -166,8 +168,8 @@ export declare enum ChainName {
166
168
  }
167
169
  export declare enum ChainID {
168
170
  ETH_MAINNET = 1,
169
- ETH_GOERLI = 5,
170
171
  ETH_SEPOLIA = 11155111,
172
+ ETH_GOERLI = 5,
171
173
  ETH_HOLESKY = 17000,
172
174
  MATIC_MAINNET = 137,
173
175
  MATIC_MUMBAI = 80001,
@@ -199,6 +201,7 @@ export declare enum ChainID {
199
201
  CRONOS_MAINNET = 25,
200
202
  CRONOS_TESTNET = 338,
201
203
  CRONOS_ZKEVM_TESTNET = 282,
204
+ CRONOS_ZKEVM_MAINNET = 388,
202
205
  AURORA_MAINNET = 1313161554,
203
206
  AURORA_TESTNET = 1313161555,
204
207
  EMERALD_PARATIME_MAINNET = 42262,
@@ -256,15 +259,15 @@ export declare enum ChainID {
256
259
  FLARENETWORKS_CANARY_TESTNET = 16,
257
260
  KCC_MAINNET = 321,
258
261
  KCC_TESTNET = 322,
259
- LINEA_MAINNET = 59144,
260
262
  POLYGON_ZKEVM_MAINNET = 1101,
261
- LINEA_SEPOLIA_TESTNET = 59141,
263
+ LINEA_MAINNET = 59144,
262
264
  LINEA_GOERLI_TESTNET = 59140,
265
+ LINEA_SEPOLIA_TESTNET = 59141,
263
266
  POLYGON_ZKEVM_TESTNET = 1422,
264
267
  POLYGON_AMOY_TESTNET = 80002,
265
268
  MANTLE_MAINNET = 5000,
266
- MANTLE_SEPOLIA_TESTNET = 5003,
267
269
  POLYGON_ZKEVM_CARDONA_TESTNET = 2442,
270
+ MANTLE_SEPOLIA_TESTNET = 5003,
268
271
  BASE_MAINNET = 8453,
269
272
  BASE_TESTNET = 84531,
270
273
  BASE_SEPOLIA_TESTNET = 84532,
@@ -275,8 +278,8 @@ export declare enum ChainID {
275
278
  LUMOZ_STARK_SPORT = 12029,
276
279
  OASIS_SAPPHIRE_MAINNET = 23294,
277
280
  OASIS_SAPPHIRE_TESTNET = 23295,
278
- SYNDR_TESTNET = 412346,
279
281
  XAI_MAINNET = 660279,
282
+ SYNDR_TESTNET = 412346,
280
283
  CELO_MAINNET = 42220,
281
284
  X1_MAINNET = 196,
282
285
  CROSSFI_EVM_TESTNET = 8545,
@@ -284,6 +287,7 @@ export declare enum ChainID {
284
287
  HORIZEN_GOBI_TESTNET = 1663,
285
288
  FRAXTAL_MAINNET = 252,
286
289
  APECHAIN_TESTNET = 1798,
290
+ BERACHAIN_TESTNET = 80084,
287
291
  LISK_MAINNET = 1135,
288
292
  REDSTONE_MAINNET = 690,
289
293
  SEI_MAINNET = 1329,
@@ -317,12 +321,12 @@ export declare enum ChainID {
317
321
  ROLLUX_TESTNET = 57000,
318
322
  GNOSIS_MAINNET = 100,
319
323
  GNOSIS_TESTNET = 10200,
324
+ VICTION_MAINNET = 88,
325
+ VICTION_TESTNET = 89,
320
326
  TELOS_MAINNET = 40,
321
327
  TELOS_TESTNET = 41,
322
- TOMOCHAIN_MAINNET = 88,
323
- TOMOCHAIN_TESTNET = 89,
324
- TAIKO_MAINNET = 167000,
325
328
  TAIKO_HEKLA_TESTNET = 167009,
329
+ TAIKO_MAINNET = 167000,
326
330
  MERLIN_MAINNET = 4200,
327
331
  MERLIN_TESTNET = 686868,
328
332
  BLAST_MAINNET = 81457,
@@ -381,6 +385,14 @@ export interface NftExternalData {
381
385
  animation_url: string;
382
386
  external_url: string;
383
387
  attributes: NftCollectionAttribute[];
388
+ thumbnails: NFTThumbnails;
389
+ }
390
+ export interface NFTThumbnails {
391
+ image256: string;
392
+ image512: string;
393
+ image1024: string;
394
+ image_opengraph_url: string;
395
+ thumbhash: string;
384
396
  }
385
397
  export interface DecodedItem {
386
398
  name: string;
File without changes
@@ -1,4 +1,4 @@
1
- import { type ContractMetadata, type LogoUrls, type Nullable } from "./Generic.types";
1
+ import { type ContractMetadata, type LogoUrls, type Nullable, type Quote } from "./Generic.types";
2
2
  export type TokenPricesResponse = Nullable<{
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;
@@ -12,9 +12,10 @@ export type TokenPricesResponse = Nullable<{
12
12
  supports_erc: string[];
13
13
  /** * The contract logo URL. */
14
14
  logo_url: string;
15
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
15
16
  update_at: Date;
16
17
  /** * The requested quote currency eg: `USD`. */
17
- quote_currency: string;
18
+ quote_currency: Quote;
18
19
  /** * The contract logo URLs. */
19
20
  logo_urls: LogoUrls;
20
21
  /** * List of response items. */
@@ -40,6 +40,7 @@ export type Transaction = Nullable<{
40
40
  pretty_value_quote: string;
41
41
  /** * The requested chain native gas token metadata. */
42
42
  gas_metadata: ContractMetadata;
43
+ /** * The gas offered for this tx. */
43
44
  gas_offered: number;
44
45
  /** * The gas spent for this tx. */
45
46
  gas_spent: number;
File without changes
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "2.1.2";
1
+ var version = "2.2.1";
2
2
 
3
3
  const bigIntParser = (val) => {
4
4
  if (val === null || val === undefined) {
@@ -25,6 +25,93 @@ const endpointGenerator = (extension = "", params = []) => {
25
25
  return new URL(`${baseUrl}/${extension}?${urlParams}`);
26
26
  };
27
27
 
28
+ /**
29
+ * Cross Chain API
30
+ *
31
+ */
32
+ class AllChainsService {
33
+ constructor(execution) {
34
+ this.execution = execution;
35
+ }
36
+ /**
37
+ *
38
+ * Commonly used to get transactions cross chains and addresses.
39
+ *
40
+ * @param {Chain[]} chains - An array of the chain names or IDs to retrieve transactions from. Defaults to all foundational chains.
41
+ * @param {string[]} addresses - An array of addresses for which transactions are fetched. Does not support name resolution.
42
+ * @param {number} limit - Number of transactions to return per page, up to the default max of 100 items.
43
+ * @param {string} before - Pagination cursor pointing to fetch transactions before a certain point.
44
+ * @param {string} after - Pagination cursor pointing to fetch transactions after a certain point.
45
+ * @param {boolean} withLogs - Whether to include raw logs in the response.
46
+ * @param {boolean} withDecodedLogs - Whether to include decoded logs in the response.
47
+ * @param {Quote | "BTC" | "ETH"} quoteCurrency - The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, "BTC" and "ETH".
48
+ *
49
+ */
50
+ async getMultiChainAndMultiAddressTransactions(queryParamOpts) {
51
+ const endpoint = endpointGenerator(`allchains/transactions`, [
52
+ {
53
+ key: "chains",
54
+ value: queryParamOpts?.chains,
55
+ },
56
+ {
57
+ key: "addresses",
58
+ value: queryParamOpts?.addresses,
59
+ },
60
+ {
61
+ key: "limit",
62
+ value: queryParamOpts?.limit,
63
+ },
64
+ {
65
+ key: "before",
66
+ value: queryParamOpts?.before,
67
+ },
68
+ {
69
+ key: "after",
70
+ value: queryParamOpts?.after,
71
+ },
72
+ {
73
+ key: "with-logs",
74
+ value: queryParamOpts?.withLogs,
75
+ },
76
+ {
77
+ key: "with-decoded-logs",
78
+ value: queryParamOpts?.withDecodedLogs,
79
+ },
80
+ {
81
+ key: "quote-currency",
82
+ value: queryParamOpts?.quoteCurrency,
83
+ },
84
+ ]);
85
+ const parseData = (data) => {
86
+ if (data.data) {
87
+ data.data.updated_at = data.data.updated_at
88
+ ? new Date(data.data.updated_at)
89
+ : null;
90
+ data.data.items = data.data.items
91
+ ? data.data.items.map((txItem) => ({
92
+ ...txItem,
93
+ value: bigIntParser(txItem.value),
94
+ fees_paid: bigIntParser(txItem.fees_paid),
95
+ block_signed_at: txItem.block_signed_at
96
+ ? new Date(txItem.block_signed_at)
97
+ : null,
98
+ log_events: txItem.log_events
99
+ ? txItem.log_events.map((logItem) => ({
100
+ ...logItem,
101
+ block_signed_at: logItem.block_signed_at
102
+ ? new Date(logItem.block_signed_at)
103
+ : null,
104
+ }))
105
+ : null,
106
+ }))
107
+ : null;
108
+ }
109
+ return data;
110
+ };
111
+ return await this.execution.execute(endpoint, parseData);
112
+ }
113
+ }
114
+
28
115
  async function* paginateEndpoint(endpoint, execution, parseData, implementation) {
29
116
  let _endpoint = new URL(endpoint);
30
117
  let hasMore = true;
@@ -615,7 +702,7 @@ class BaseService {
615
702
  *
616
703
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
617
704
  * @param {string} startDate - The start date in YYYY-MM-DD format.
618
- * @param {string} endDate - The end date in YYYY-MM-DD format.
705
+ * @param {string | "latest"} endDate - The end date in YYYY-MM-DD format. Also accepts "latest" for the latest block height
619
706
  * @param {GetBlockHeightsQueryParamOpts} queryParamOpts
620
707
  * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
621
708
  * - `pageNumber`: 0-indexed page number to begin pagination.
@@ -658,7 +745,7 @@ class BaseService {
658
745
  *
659
746
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
660
747
  * @param {string} startDate - The start date in YYYY-MM-DD format.
661
- * @param {string} endDate - The end date in YYYY-MM-DD format.
748
+ * @param {string | "latest"} endDate - The end date in YYYY-MM-DD format. Also accepts "latest" for the latest block height
662
749
  * @param {GetBlockHeightsQueryParamOpts} queryParamOpts
663
750
  * - `pageSize`: Number of items per page. Omitting this parameter defaults to 100.
664
751
  * - `pageNumber`: 0-indexed page number to begin pagination.
@@ -2516,6 +2603,7 @@ class GoldRushClient {
2516
2603
  ? `${settings.source} (${this.userAgent})`
2517
2604
  : this.userAgent,
2518
2605
  });
2606
+ this.AllChainsService = new AllChainsService(execution);
2519
2607
  this.BalanceService = new BalanceService(execution);
2520
2608
  this.BaseService = new BaseService(execution);
2521
2609
  this.NftService = new NftService(execution);
@@ -3684,7 +3772,7 @@ const timestampParser = (timestamp, type) => {
3684
3772
  return `just now`;
3685
3773
  }
3686
3774
  }
3687
- case "YYYY MM DD": {
3775
+ case "YYYY-MM-DD": {
3688
3776
  const offsetMinutes = _unix.getTimezoneOffset();
3689
3777
  const offsetMilliseconds = offsetMinutes * 60 * 1000;
3690
3778
  const utcTime = _unix.getTime() + offsetMilliseconds;
@@ -3703,8 +3791,8 @@ const timestampParser = (timestamp, type) => {
3703
3791
  var ChainName;
3704
3792
  (function (ChainName) {
3705
3793
  ChainName["ETH_MAINNET"] = "eth-mainnet";
3706
- ChainName["ETH_GOERLI"] = "eth-goerli";
3707
3794
  ChainName["ETH_SEPOLIA"] = "eth-sepolia";
3795
+ ChainName["ETH_GOERLI"] = "eth-goerli";
3708
3796
  ChainName["ETH_HOLESKY"] = "eth-holesky";
3709
3797
  ChainName["MATIC_MAINNET"] = "matic-mainnet";
3710
3798
  ChainName["MATIC_MUMBAI"] = "matic-mumbai";
@@ -3736,6 +3824,7 @@ var ChainName;
3736
3824
  ChainName["CRONOS_MAINNET"] = "cronos-mainnet";
3737
3825
  ChainName["CRONOS_TESTNET"] = "cronos-testnet";
3738
3826
  ChainName["CRONOS_ZKEVM_TESTNET"] = "cronos-zkevm-testnet";
3827
+ ChainName["CRONOS_ZKEVM_MAINNET"] = "cronos-zkevm-mainnet";
3739
3828
  ChainName["AURORA_MAINNET"] = "aurora-mainnet";
3740
3829
  ChainName["AURORA_TESTNET"] = "aurora-testnet";
3741
3830
  ChainName["EMERALD_PARATIME_MAINNET"] = "emerald-paratime-mainnet";
@@ -3793,15 +3882,15 @@ var ChainName;
3793
3882
  ChainName["FLARENETWORKS_CANARY_TESTNET"] = "flarenetworks-canary-testnet";
3794
3883
  ChainName["KCC_MAINNET"] = "kcc-mainnet";
3795
3884
  ChainName["KCC_TESTNET"] = "kcc-testnet";
3796
- ChainName["LINEA_MAINNET"] = "linea-mainnet";
3797
3885
  ChainName["POLYGON_ZKEVM_MAINNET"] = "polygon-zkevm-mainnet";
3798
- ChainName["LINEA_SEPOLIA_TESTNET"] = "linea-sepolia-testnet";
3886
+ ChainName["LINEA_MAINNET"] = "linea-mainnet";
3799
3887
  ChainName["LINEA_GOERLI_TESTNET"] = "linea-goerli-testnet";
3888
+ ChainName["LINEA_SEPOLIA_TESTNET"] = "linea-sepolia-testnet";
3800
3889
  ChainName["POLYGON_ZKEVM_TESTNET"] = "polygon-zkevm-testnet";
3801
3890
  ChainName["POLYGON_AMOY_TESTNET"] = "polygon-amoy-testnet";
3802
3891
  ChainName["MANTLE_MAINNET"] = "mantle-mainnet";
3803
- ChainName["MANTLE_SEPOLIA_TESTNET"] = "mantle-sepolia-testnet";
3804
3892
  ChainName["POLYGON_ZKEVM_CARDONA_TESTNET"] = "polygon-zkevm-cardona-testnet";
3893
+ ChainName["MANTLE_SEPOLIA_TESTNET"] = "mantle-sepolia-testnet";
3805
3894
  ChainName["BASE_MAINNET"] = "base-mainnet";
3806
3895
  ChainName["BASE_TESTNET"] = "base-testnet";
3807
3896
  ChainName["BASE_SEPOLIA_TESTNET"] = "base-sepolia-testnet";
@@ -3812,8 +3901,8 @@ var ChainName;
3812
3901
  ChainName["LUMOZ_STARK_SPORT"] = "lumoz-stark-sport";
3813
3902
  ChainName["OASIS_SAPPHIRE_MAINNET"] = "oasis-sapphire-mainnet";
3814
3903
  ChainName["OASIS_SAPPHIRE_TESTNET"] = "oasis-sapphire-testnet";
3815
- ChainName["SYNDR_TESTNET"] = "syndr-testnet";
3816
3904
  ChainName["XAI_MAINNET"] = "xai-mainnet";
3905
+ ChainName["SYNDR_TESTNET"] = "syndr-testnet";
3817
3906
  ChainName["CELO_MAINNET"] = "celo-mainnet";
3818
3907
  ChainName["X1_MAINNET"] = "x1-mainnet";
3819
3908
  ChainName["CROSSFI_EVM_TESTNET"] = "crossfi-evm-testnet";
@@ -3822,6 +3911,7 @@ var ChainName;
3822
3911
  ChainName["FRAXTAL_MAINNET"] = "fraxtal-mainnet";
3823
3912
  ChainName["APECHAIN_TESTNET"] = "apechain-testnet";
3824
3913
  ChainName["LISK_MAINNET"] = "lisk-mainnet";
3914
+ ChainName["BERACHAIN_TESTNET"] = "berachain-testnet";
3825
3915
  ChainName["REDSTONE_MAINNET"] = "redstone-mainnet";
3826
3916
  ChainName["SEI_MAINNET"] = "sei-mainnet";
3827
3917
  ChainName["AVALANCHE_MELD_TESTNET"] = "avalanche-meld-testnet";
@@ -3856,10 +3946,10 @@ var ChainName;
3856
3946
  ChainName["GNOSIS_TESTNET"] = "gnosis-testnet";
3857
3947
  ChainName["TELOS_MAINNET"] = "telos-mainnet";
3858
3948
  ChainName["TELOS_TESTNET"] = "telos-testnet";
3859
- ChainName["TOMOCHAIN_MAINNET"] = "tomochain-mainnet";
3860
- ChainName["TOMOCHAIN_TESTNET"] = "tomochain-testnet";
3861
- ChainName["TAIKO_MAINNET"] = "taiko-mainnet";
3949
+ ChainName["VICTION_MAINNET"] = "viction-mainnet";
3950
+ ChainName["VICTION_TESTNET"] = "viction-testnet";
3862
3951
  ChainName["TAIKO_HEKLA_TESTNET"] = "taiko-hekla-testnet";
3952
+ ChainName["TAIKO_MAINNET"] = "taiko-mainnet";
3863
3953
  ChainName["MERLIN_MAINNET"] = "merlin-mainnet";
3864
3954
  ChainName["MERLIN_TESTNET"] = "merlin-testnet";
3865
3955
  ChainName["BLAST_MAINNET"] = "blast-mainnet";
@@ -3870,8 +3960,8 @@ var ChainName;
3870
3960
  var ChainID;
3871
3961
  (function (ChainID) {
3872
3962
  ChainID[ChainID["ETH_MAINNET"] = 1] = "ETH_MAINNET";
3873
- ChainID[ChainID["ETH_GOERLI"] = 5] = "ETH_GOERLI";
3874
3963
  ChainID[ChainID["ETH_SEPOLIA"] = 11155111] = "ETH_SEPOLIA";
3964
+ ChainID[ChainID["ETH_GOERLI"] = 5] = "ETH_GOERLI";
3875
3965
  ChainID[ChainID["ETH_HOLESKY"] = 17000] = "ETH_HOLESKY";
3876
3966
  ChainID[ChainID["MATIC_MAINNET"] = 137] = "MATIC_MAINNET";
3877
3967
  ChainID[ChainID["MATIC_MUMBAI"] = 80001] = "MATIC_MUMBAI";
@@ -3903,6 +3993,7 @@ var ChainID;
3903
3993
  ChainID[ChainID["CRONOS_MAINNET"] = 25] = "CRONOS_MAINNET";
3904
3994
  ChainID[ChainID["CRONOS_TESTNET"] = 338] = "CRONOS_TESTNET";
3905
3995
  ChainID[ChainID["CRONOS_ZKEVM_TESTNET"] = 282] = "CRONOS_ZKEVM_TESTNET";
3996
+ ChainID[ChainID["CRONOS_ZKEVM_MAINNET"] = 388] = "CRONOS_ZKEVM_MAINNET";
3906
3997
  ChainID[ChainID["AURORA_MAINNET"] = 1313161554] = "AURORA_MAINNET";
3907
3998
  ChainID[ChainID["AURORA_TESTNET"] = 1313161555] = "AURORA_TESTNET";
3908
3999
  ChainID[ChainID["EMERALD_PARATIME_MAINNET"] = 42262] = "EMERALD_PARATIME_MAINNET";
@@ -3960,15 +4051,15 @@ var ChainID;
3960
4051
  ChainID[ChainID["FLARENETWORKS_CANARY_TESTNET"] = 16] = "FLARENETWORKS_CANARY_TESTNET";
3961
4052
  ChainID[ChainID["KCC_MAINNET"] = 321] = "KCC_MAINNET";
3962
4053
  ChainID[ChainID["KCC_TESTNET"] = 322] = "KCC_TESTNET";
3963
- ChainID[ChainID["LINEA_MAINNET"] = 59144] = "LINEA_MAINNET";
3964
4054
  ChainID[ChainID["POLYGON_ZKEVM_MAINNET"] = 1101] = "POLYGON_ZKEVM_MAINNET";
3965
- ChainID[ChainID["LINEA_SEPOLIA_TESTNET"] = 59141] = "LINEA_SEPOLIA_TESTNET";
4055
+ ChainID[ChainID["LINEA_MAINNET"] = 59144] = "LINEA_MAINNET";
3966
4056
  ChainID[ChainID["LINEA_GOERLI_TESTNET"] = 59140] = "LINEA_GOERLI_TESTNET";
4057
+ ChainID[ChainID["LINEA_SEPOLIA_TESTNET"] = 59141] = "LINEA_SEPOLIA_TESTNET";
3967
4058
  ChainID[ChainID["POLYGON_ZKEVM_TESTNET"] = 1422] = "POLYGON_ZKEVM_TESTNET";
3968
4059
  ChainID[ChainID["POLYGON_AMOY_TESTNET"] = 80002] = "POLYGON_AMOY_TESTNET";
3969
4060
  ChainID[ChainID["MANTLE_MAINNET"] = 5000] = "MANTLE_MAINNET";
3970
- ChainID[ChainID["MANTLE_SEPOLIA_TESTNET"] = 5003] = "MANTLE_SEPOLIA_TESTNET";
3971
4061
  ChainID[ChainID["POLYGON_ZKEVM_CARDONA_TESTNET"] = 2442] = "POLYGON_ZKEVM_CARDONA_TESTNET";
4062
+ ChainID[ChainID["MANTLE_SEPOLIA_TESTNET"] = 5003] = "MANTLE_SEPOLIA_TESTNET";
3972
4063
  ChainID[ChainID["BASE_MAINNET"] = 8453] = "BASE_MAINNET";
3973
4064
  ChainID[ChainID["BASE_TESTNET"] = 84531] = "BASE_TESTNET";
3974
4065
  ChainID[ChainID["BASE_SEPOLIA_TESTNET"] = 84532] = "BASE_SEPOLIA_TESTNET";
@@ -3979,8 +4070,8 @@ var ChainID;
3979
4070
  ChainID[ChainID["LUMOZ_STARK_SPORT"] = 12029] = "LUMOZ_STARK_SPORT";
3980
4071
  ChainID[ChainID["OASIS_SAPPHIRE_MAINNET"] = 23294] = "OASIS_SAPPHIRE_MAINNET";
3981
4072
  ChainID[ChainID["OASIS_SAPPHIRE_TESTNET"] = 23295] = "OASIS_SAPPHIRE_TESTNET";
3982
- ChainID[ChainID["SYNDR_TESTNET"] = 412346] = "SYNDR_TESTNET";
3983
4073
  ChainID[ChainID["XAI_MAINNET"] = 660279] = "XAI_MAINNET";
4074
+ ChainID[ChainID["SYNDR_TESTNET"] = 412346] = "SYNDR_TESTNET";
3984
4075
  ChainID[ChainID["CELO_MAINNET"] = 42220] = "CELO_MAINNET";
3985
4076
  ChainID[ChainID["X1_MAINNET"] = 196] = "X1_MAINNET";
3986
4077
  ChainID[ChainID["CROSSFI_EVM_TESTNET"] = 8545] = "CROSSFI_EVM_TESTNET";
@@ -3988,6 +4079,7 @@ var ChainID;
3988
4079
  ChainID[ChainID["HORIZEN_GOBI_TESTNET"] = 1663] = "HORIZEN_GOBI_TESTNET";
3989
4080
  ChainID[ChainID["FRAXTAL_MAINNET"] = 252] = "FRAXTAL_MAINNET";
3990
4081
  ChainID[ChainID["APECHAIN_TESTNET"] = 1798] = "APECHAIN_TESTNET";
4082
+ ChainID[ChainID["BERACHAIN_TESTNET"] = 80084] = "BERACHAIN_TESTNET";
3991
4083
  ChainID[ChainID["LISK_MAINNET"] = 1135] = "LISK_MAINNET";
3992
4084
  ChainID[ChainID["REDSTONE_MAINNET"] = 690] = "REDSTONE_MAINNET";
3993
4085
  ChainID[ChainID["SEI_MAINNET"] = 1329] = "SEI_MAINNET";
@@ -4021,12 +4113,12 @@ var ChainID;
4021
4113
  ChainID[ChainID["ROLLUX_TESTNET"] = 57000] = "ROLLUX_TESTNET";
4022
4114
  ChainID[ChainID["GNOSIS_MAINNET"] = 100] = "GNOSIS_MAINNET";
4023
4115
  ChainID[ChainID["GNOSIS_TESTNET"] = 10200] = "GNOSIS_TESTNET";
4116
+ ChainID[ChainID["VICTION_MAINNET"] = 88] = "VICTION_MAINNET";
4117
+ ChainID[ChainID["VICTION_TESTNET"] = 89] = "VICTION_TESTNET";
4024
4118
  ChainID[ChainID["TELOS_MAINNET"] = 40] = "TELOS_MAINNET";
4025
4119
  ChainID[ChainID["TELOS_TESTNET"] = 41] = "TELOS_TESTNET";
4026
- ChainID[ChainID["TOMOCHAIN_MAINNET"] = 88] = "TOMOCHAIN_MAINNET";
4027
- ChainID[ChainID["TOMOCHAIN_TESTNET"] = 89] = "TOMOCHAIN_TESTNET";
4028
- ChainID[ChainID["TAIKO_MAINNET"] = 167000] = "TAIKO_MAINNET";
4029
4120
  ChainID[ChainID["TAIKO_HEKLA_TESTNET"] = 167009] = "TAIKO_HEKLA_TESTNET";
4121
+ ChainID[ChainID["TAIKO_MAINNET"] = 167000] = "TAIKO_MAINNET";
4030
4122
  ChainID[ChainID["MERLIN_MAINNET"] = 4200] = "MERLIN_MAINNET";
4031
4123
  ChainID[ChainID["MERLIN_TESTNET"] = 686868] = "MERLIN_TESTNET";
4032
4124
  ChainID[ChainID["BLAST_MAINNET"] = 81457] = "BLAST_MAINNET";