@covalenthq/client-sdk 2.2.4 → 2.2.6

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.
@@ -50,7 +50,7 @@ export declare class BalanceService {
50
50
  * - `pageNumber`: 0-indexed page number to begin pagination.
51
51
  *
52
52
  */
53
- getErc20TransfersForWalletAddress(chainName: Chain, walletAddress: string, queryParamOpts?: GetErc20TransfersForWalletAddressQueryParamOpts): AsyncIterable<GoldRushResponse<Erc20TransfersResponse>>;
53
+ getErc20TransfersForWalletAddress(chainName: Chain, walletAddress: string, queryParamOpts: GetErc20TransfersForWalletAddressQueryParamOpts): AsyncIterable<GoldRushResponse<Erc20TransfersResponse>>;
54
54
  /**
55
55
  *
56
56
  * Commonly used to render the transfer-in and transfer-out of a token along with historical prices from an address.
@@ -66,7 +66,7 @@ export declare class BalanceService {
66
66
  * - `pageNumber`: 0-indexed page number to begin pagination.
67
67
  *
68
68
  */
69
- getErc20TransfersForWalletAddressByPage(chainName: Chain, walletAddress: string, queryParamOpts?: GetErc20TransfersForWalletAddressQueryParamOpts): Promise<GoldRushResponse<Erc20TransfersResponse>>;
69
+ getErc20TransfersForWalletAddressByPage(chainName: Chain, walletAddress: string, queryParamOpts: GetErc20TransfersForWalletAddressQueryParamOpts): Promise<GoldRushResponse<Erc20TransfersResponse>>;
70
70
  /**
71
71
  *
72
72
  * Commonly used to get a list of all the token holders for a specified ERC20 or ERC721 token. Returns historic token holders when block-height is set (defaults to `latest`). Useful for building pie charts of token holders.
@@ -1,6 +1,6 @@
1
1
  import { type Execution } from "../utils/functions/execution";
2
- import { type Chain, type GoldRushResponse, type Quote } from "../utils/types/Generic.types";
3
- import { type GetTokenPricesQueryParamOpts, type TokenPricesResponse } from "../utils/types/PricingService.types";
2
+ import type { Chain, GoldRushResponse, Quote } from "../utils/types/Generic.types";
3
+ import type { GetTokenPricesQueryParamOpts, PoolSpotPriceQueryParamsOpts, PoolSpotPricesResponse, TokenPricesResponse } from "../utils/types/PricingService.types";
4
4
  /**
5
5
  * Pricing API
6
6
  *
@@ -22,4 +22,15 @@ export declare class PricingService {
22
22
  *
23
23
  */
24
24
  getTokenPrices(chainName: Chain, quoteCurrency: Quote, contractAddress: string, queryParamOpts?: GetTokenPricesQueryParamOpts): Promise<GoldRushResponse<TokenPricesResponse[]>>;
25
+ /**
26
+ *
27
+ * Get the spot token pair prices for a specified pool contract address. Supports pools on Uniswap V2, V3 and their forks.
28
+ *
29
+ * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
30
+ * @param {string} contractAddress - The pool contract address.
31
+ * @param {GetTokenPricesQueryParamOpts} queryParamOpts
32
+ * - `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`.
33
+ *
34
+ */
35
+ getPoolSpotPrices(chainName: Chain, contractAddress: string, queryParamOpts?: PoolSpotPriceQueryParamsOpts): Promise<GoldRushResponse<PoolSpotPricesResponse[]>>;
25
36
  }
@@ -1,6 +1,6 @@
1
1
  import { type Execution } from "../utils/functions/execution";
2
- import { type Chain, type GoldRushResponse } from "../utils/types/Generic.types";
3
- import { type GetAllTransactionsForAddressQueryParamOpts, type GetTimeBucketTransactionsForAddressQueryParamOpts, type GetTransactionQueryParamOpts, type GetTransactionSummaryQueryParamOpts, type GetTransactionsForAddressV3QueryParamOpts, type GetTransactionsForBlockQueryParamOpts, type RecentTransactionsResponse, type TransactionResponse, type TransactionsBlockResponse, type TransactionsResponse, type TransactionsSummaryResponse, type TransactionsTimeBucketResponse } from "../utils/types/TransactionService.types";
2
+ import type { Chain, GoldRushResponse } from "../utils/types/Generic.types";
3
+ import type { EarliestTransactionsForAddressResponse, GetAllTransactionsForAddressQueryParamOpts, GetEarliestTransactionsForAddressQueryParamOpts, getPaginatedTransactionsForAddressQueryParamOpts, GetTimeBucketTransactionsForAddressQueryParamOpts, GetTransactionQueryParamOpts, getTransactionsForBlockByPageQueryParamOpts, GetTransactionSummaryQueryParamOpts, RecentTransactionsResponse, TransactionResponse, TransactionsBlockResponse, TransactionsForBlockResponse, TransactionsResponse, TransactionsSummaryResponse, TransactionsTimeBucketResponse } from "../utils/types/TransactionService.types";
4
4
  /**
5
5
  * Transactions API
6
6
  *
@@ -23,6 +23,30 @@ export declare class TransactionService {
23
23
  *
24
24
  */
25
25
  getTransaction(chainName: Chain, txHash: string, queryParamOpts?: GetTransactionQueryParamOpts): Promise<GoldRushResponse<TransactionResponse>>;
26
+ /**
27
+ *
28
+ * 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.
29
+ *
30
+ * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
31
+ * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
32
+ * @param {GetTransactionSummaryQueryParamOpts} queryParamOpts
33
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
34
+ * - `withGas`: Include gas summary details. Additional charge of 1 credit when true. Response times may be impacted for wallets with millions of transactions.
35
+ *
36
+ */
37
+ getTransactionSummary(chainName: Chain, walletAddress: string, queryParamOpts?: GetTransactionSummaryQueryParamOpts): Promise<GoldRushResponse<TransactionsSummaryResponse>>;
38
+ /**
39
+ *
40
+ * Commonly used to fetch and render the earliest transactions involving an address. Frequently seen in wallet applications.
41
+ *
42
+ * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
43
+ * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
44
+ * @param {GetEarliestTransactionsForAddressQueryParamOpts} queryParamOpts
45
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
46
+ * - `noLogs`: Omit log events.
47
+ *
48
+ */
49
+ getEarliestTransactionsForAddress(chainName: Chain, walletAddress: string, queryParamOpts?: GetEarliestTransactionsForAddressQueryParamOpts): Promise<GoldRushResponse<EarliestTransactionsForAddressResponse>>;
26
50
  /**
27
51
  *
28
52
  * Commonly used to fetch and render the most recent transactions involving an address. Frequently seen in wallet applications.
@@ -56,50 +80,55 @@ export declare class TransactionService {
56
80
  */
57
81
  getAllTransactionsForAddressByPage(chainName: Chain, walletAddress: string, queryParamOpts?: GetAllTransactionsForAddressQueryParamOpts): Promise<GoldRushResponse<RecentTransactionsResponse>>;
58
82
  /**
59
- *
60
- * Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
61
83
  *
62
84
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
63
- * @param {number} blockHeight - The requested block height.
64
- * @param {GetTransactionsForBlockQueryParamOpts} queryParamOpts
85
+ * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
86
+ * @param {number} page - The requested page, 0-indexed.
87
+ * @param {getPaginatedTransactionsForAddressQueryParamOpts} queryParamOpts
65
88
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
66
89
  * - `noLogs`: Omit log events.
90
+ * - `blockSignedAtAsc`: Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order.
67
91
  *
68
92
  */
69
- getTransactionsForBlock(chainName: Chain, blockHeight: number | string | "latest", queryParamOpts?: GetTransactionsForBlockQueryParamOpts): Promise<GoldRushResponse<TransactionsBlockResponse>>;
93
+ getPaginatedTransactionsForAddress(chainName: Chain, walletAddress: string, page: number, queryParamOpts?: getPaginatedTransactionsForAddressQueryParamOpts): Promise<GoldRushResponse<TransactionsResponse>>;
70
94
  /**
71
- *
72
- * 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.
73
95
  *
74
96
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
75
97
  * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
76
- * @param {GetTransactionSummaryQueryParamOpts} queryParamOpts
98
+ * @param {number} timeBucket - The 0-indexed 15-minute time bucket. E.g. 27 Feb 2023 05:23 GMT = 1677475383 (Unix time). 1677475383/900=1863861 timeBucket.
99
+ * @param {GetTimeBucketTransactionsForAddressQueryParamOpts} queryParamOpts
77
100
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
78
- * - `withGas`: Include gas summary details. Additional charge of 1 credit when true. Response times may be impacted for wallets with millions of transactions.
101
+ * - `noLogs`: Omit log events.
79
102
  *
80
103
  */
81
- getTransactionSummary(chainName: Chain, walletAddress: string, queryParamOpts?: GetTransactionSummaryQueryParamOpts): Promise<GoldRushResponse<TransactionsSummaryResponse>>;
104
+ getTimeBucketTransactionsForAddress(chainName: Chain, walletAddress: string, timeBucket: number, queryParamOpts?: GetTimeBucketTransactionsForAddressQueryParamOpts): Promise<GoldRushResponse<TransactionsTimeBucketResponse>>;
82
105
  /**
106
+ *
107
+ * Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
83
108
  *
84
109
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
85
- * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
110
+ * @param {number} blockHeight - The requested block height.
86
111
  * @param {number} page - The requested page, 0-indexed.
87
- * @param {GetTransactionsForAddressV3QueryParamOpts} queryParamOpts
112
+ * @param {getTransactionsForBlockByPageQueryParamOpts} queryParamOpts
88
113
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
89
114
  * - `noLogs`: Omit log events.
90
- * - `blockSignedAtAsc`: Sort the transactions in ascending chronological order. By default, it's set to `false` and returns transactions in descending chronological order.
91
115
  *
92
116
  */
93
- getTransactionsForAddressV3(chainName: Chain, walletAddress: string, page: number, queryParamOpts?: GetTransactionsForAddressV3QueryParamOpts): Promise<GoldRushResponse<TransactionsResponse>>;
117
+ getTransactionsForBlockByPage(chainName: Chain, blockHeight: number | string | "latest", page: number, queryParamOpts?: getTransactionsForBlockByPageQueryParamOpts): Promise<GoldRushResponse<TransactionsBlockResponse>>;
94
118
  /**
119
+ *
120
+ * Commonly used to fetch all transactions including their decoded log events in a block and further flag interesting wallets or transactions.
95
121
  *
96
122
  * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
97
- * @param {string} walletAddress - The requested address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
98
- * @param {number} timeBucket - The 0-indexed 15-minute time bucket. E.g. 27 Feb 2023 05:23 GMT = 1677475383 (Unix time). 1677475383/900=1863861 timeBucket.
99
- * @param {GetTimeBucketTransactionsForAddressQueryParamOpts} queryParamOpts
123
+ * @param {string} blockHash - The requested block hash.
124
+ * @param {getTransactionsForBlockByPageQueryParamOpts} queryParamOpts
100
125
  * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
101
126
  * - `noLogs`: Omit log events.
102
127
  *
103
128
  */
104
- getTimeBucketTransactionsForAddress(chainName: Chain, walletAddress: string, timeBucket: number, queryParamOpts?: GetTimeBucketTransactionsForAddressQueryParamOpts): Promise<GoldRushResponse<TransactionsTimeBucketResponse>>;
129
+ getTransactionsForBlock(chainName: Chain, blockHash: string, queryParamOpts?: getTransactionsForBlockByPageQueryParamOpts): Promise<GoldRushResponse<TransactionsForBlockResponse>>;
130
+ /**
131
+ * @deprecated This method has been deprecated and will be removed in future releases. Use `getPaginatedTransactionsForAddress` instead.
132
+ */
133
+ getTransactionsForAddressV3(chainName: Chain, walletAddress: string, page: number, queryParamOpts?: getPaginatedTransactionsForAddressQueryParamOpts): Promise<GoldRushResponse<TransactionsResponse>>;
105
134
  }
@@ -398,7 +398,7 @@ export type GetErc20TransfersForWalletAddressQueryParamOpts = Nullable<{
398
398
  /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
399
399
  quoteCurrency?: Quote;
400
400
  /** * The requested contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically. */
401
- contractAddress?: string;
401
+ contractAddress: string;
402
402
  /** * The block height to start from, defaults to `0`. */
403
403
  startingBlock?: number;
404
404
  /** * The block height to end at, defaults to current block height. */
@@ -38,3 +38,43 @@ export type GetTokenPricesQueryParamOpts = Nullable<{
38
38
  /** * Sort the prices in chronological ascending order. By default, it's set to `false` and returns prices in chronological descending order. */
39
39
  pricesAtAsc?: boolean;
40
40
  }>;
41
+ export type PoolSpotPriceQueryParamsOpts = Nullable<{
42
+ /** * The currency to convert. */
43
+ quoteCurrency: string;
44
+ }>;
45
+ export type PoolSpotPricesResponse = Nullable<{
46
+ /** * The timestamp when the response was generated. */
47
+ updated_at: Date;
48
+ /** * The pool contract address. */
49
+ pool_address: string;
50
+ /** * The contract address of token_0 in the token pair making up the pool. */
51
+ token_0_address: string;
52
+ /** * The contract name of token_0 in the token pair making up the pool. */
53
+ token_0_name: string;
54
+ /** * The contract symbol of token_0 in the token pair making up the pool. */
55
+ token_0_ticker: string;
56
+ /** * Price of token_0 in units of token_1. */
57
+ token_0_price: string;
58
+ /** * Price of token_0 in units of token_1 as of 24 hours ago. */
59
+ token_0_price_24h: string;
60
+ /** * Price of token_0 in the selected quote currency (defaults to USD). */
61
+ token_0_price_quote: string;
62
+ /** * Price of token_0 in the selected quote currency (defaults to USD) as of 24 hours ago. */
63
+ token_0_price_24h_quote: string;
64
+ /** * The contract address of token_1 in the token pair making up the pool. */
65
+ token_1_address: string;
66
+ /** * The contract name of token_1 in the token pair making up the pool. */
67
+ token_1_name: string;
68
+ /** * The contract symbol of token_1 in the token pair making up the pool. */
69
+ token_1_ticker: string;
70
+ /** * Price of token_1 in units of token_0. */
71
+ token_1_price: string;
72
+ /** * Price of token_1 in units of token_0 as of 24 hours ago. */
73
+ token_1_price_24h: string;
74
+ /** * Price of token_1 in the selected quote currency (defaults to USD). */
75
+ token_1_price_quote: string;
76
+ /** * Price of token_1 in the selected quote currency (defaults to USD) as of 24 hours ago. */
77
+ token_1_price_24h_quote: string;
78
+ /** * The currency to convert. */
79
+ quote_currency: string;
80
+ }>;
@@ -172,6 +172,12 @@ export type TransactionsBlockResponse = Nullable<{
172
172
  chain_name: ChainName;
173
173
  /** * List of response items. */
174
174
  items: Transaction[];
175
+ /** * URL link to the next and prev pages. */
176
+ links: PaginationLinks;
177
+ /** * An executable async function for the next page. */
178
+ next: (() => Promise<GoldRushResponse<TransactionsBlockResponse>>) | null;
179
+ /** * An executable async function for the prev page. */
180
+ prev: (() => Promise<GoldRushResponse<TransactionsBlockResponse>>) | null;
175
181
  }>;
176
182
  export type TransactionsSummaryResponse = Nullable<{
177
183
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
@@ -283,13 +289,13 @@ export type GetAllTransactionsForAddressQueryParamOpts = Nullable<{
283
289
  /** * Whether to include the transaction's input data such as the Method ID. */
284
290
  withInputData?: boolean;
285
291
  }>;
286
- export type GetTransactionsForBlockQueryParamOpts = Nullable<{
292
+ export type getTransactionsForBlockByPageQueryParamOpts = Nullable<{
287
293
  /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
288
294
  quoteCurrency?: Quote;
289
295
  /** * Omit log events. */
290
296
  noLogs?: boolean;
291
297
  }>;
292
- export type GetTransactionsForAddressV3QueryParamOpts = Nullable<{
298
+ export type getPaginatedTransactionsForAddressQueryParamOpts = Nullable<{
293
299
  /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
294
300
  quoteCurrency?: Quote;
295
301
  /** * Omit log events. */
@@ -345,3 +351,42 @@ export type InputData = Nullable<{
345
351
  /** * The first 4 bytes of the invoked smart contract function signature. Used to identify the function being called in the contract. */
346
352
  method_id: string;
347
353
  }>;
354
+ export type GetEarliestTransactionsForAddressQueryParamOpts = Nullable<{
355
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
356
+ quoteCurrency?: Quote;
357
+ /** * Omit log events. */
358
+ noLogs?: boolean;
359
+ }>;
360
+ export type EarliestTransactionsForAddressResponse = Nullable<{
361
+ /** * The requested address. */
362
+ address: string;
363
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
364
+ updated_at: Date;
365
+ /** * The requested quote currency eg: `USD`. */
366
+ quote_currency: Quote;
367
+ /** * The requested chain ID eg: `1`. */
368
+ chain_id: ChainID;
369
+ /** * The requested chain name eg: `eth-mainnet`. */
370
+ chain_name: ChainName;
371
+ complete: boolean;
372
+ /** * The current bucket of the response. */
373
+ current_bucket: number;
374
+ /** * URL link to the next and prev pages. */
375
+ links: PaginationLinks;
376
+ /** * List of response items. */
377
+ items: Transaction[];
378
+ /** * An executable async function for the prev page. */
379
+ prev: (() => Promise<GoldRushResponse<EarliestTransactionsForAddressResponse>>) | null;
380
+ /** * An executable async function for the next page. */
381
+ next: (() => Promise<GoldRushResponse<EarliestTransactionsForAddressResponse>>) | null;
382
+ }>;
383
+ export type TransactionsForBlockResponse = Nullable<{
384
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
385
+ updated_at: Date;
386
+ /** * The requested chain ID eg: `1`. */
387
+ chain_id: ChainID;
388
+ /** * The requested chain name eg: `eth-mainnet`. */
389
+ chain_name: ChainName;
390
+ /** * List of response items. */
391
+ items: Transaction[];
392
+ }>;